投稿時間:2021-10-24 11:17:28 RSSフィード2021-10-24 11:00 分まとめ(17件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
TECH Engadget Japanese ステレオスピーカーとフルHD1080Pカメラを搭載。自転車用スマートヘルメット「Pelios」 https://japanese.engadget.com/pelios-smart-helmet-134011925.html 「Pelios」ペリオス主な特徴フルHDPカメラ内蔵ドライブレコーダーとしての記録にステレオスピーカー搭載スマホ連携で、ハンズフリー通話・音楽・ナビゲーションも音楽、ナビゲーションを聴きながら、車や歩行者の接近に気がつき、リスクを避けることが可能。 2021-10-24 01:40:11
python Pythonタグが付けられた新着投稿 - Qiita Pythonでできること https://qiita.com/sora8han/items/6da8c62dd4ec7daf5447 機械学習 2021-10-24 10:36:55
python Pythonタグが付けられた新着投稿 - Qiita 情報収集自動化 https://qiita.com/ronk/items/06b1529296dad82c3130 Pythonライブラリの追加pipampnbspinstallampnbspextractcontentPythonプログラムltdivgtURLからextractcontentを使用して記事本文を抜き出します。 2021-10-24 10:24:26
js JavaScriptタグが付けられた新着投稿 - Qiita Blobとencoding.jsでシフトJIS CSVを出力する https://qiita.com/niwadoron/items/e13562ba57d271c228bc 流れとしては、①一旦文字列にする②charCodeAtでUnicodeコードポイントに変換して配列化③encodingjsでSJISに変換④UnitArrayで型付き配列に変換⑤Blobでバイナリデータファイル出力⑥JSZipでzip化となっています。 2021-10-24 10:40:59
js JavaScriptタグが付けられた新着投稿 - Qiita Google Apps Script(Gas)でスプレッドシートの操作 https://qiita.com/tykt/items/464d096b14eb4de88170 値を範囲指定して取得する際に、ここからここまでみたいな指定だとメンテナンス面倒です。 2021-10-24 10:32:59
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) Javaでの定数の命名規則について確認 https://teratail.com/questions/365930?rss=all Javaでの定数の命名規則について確認根本的なこととは思っていますが、Javaのフィールドに定数を宣言する場合の命名規則について確認させてください。 2021-10-24 10:42:21
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) opengl 頂点インデックスを使うと立方体の形がおかしくなる原因が知りたい。 https://teratail.com/questions/365929?rss=all opengl頂点インデックスを使うと立方体の形がおかしくなる原因が知りたい。 2021-10-24 10:33:08
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) CSVファイルからデータを読み込み、matplotlibでグラフを出力したい。 https://teratail.com/questions/365928?rss=all CSVファイルからデータを読み込み、matplotlibでグラフを出力したい。 2021-10-24 10:30:57
海外TECH DEV Community How to Emulate Firebase Auth https://dev.to/harvtronix/how-to-emulate-firebase-auth-5ah7 How to Emulate Firebase AuthI was recently building an app in which I was trying to integrate Firebase Authentication and Firebase Realtime Database But I ran into a problem pretty quickly while I was testing things locally Even though Firebase has a super amazing Emulator Suite for local testing authentication is not included To me this meant that the lovely auth based Realtime DB rules I d crafted were impossible to test locally unless I modified my DB rules beforehand But that doesn t make for a very good permissions test does it There is an open issue on GitHub for addressing this but at the time of writing no solution has yet been included in the emulator suite Update Firebase Auth is now part of the Emulator Suite Upgrade the Firebase CLI to version or greater to use it If that s all you were looking for the rest of this post might not be useful to you but feel free to keep reading for a more detailed look at Firebase Auth and my general philosophy towards testing and modularization I spent a bunch of hours trying to figure out how to string things together with Band Aids and glue to do something that honestly seems like a pretty basic requirement for DB testing Test my auth rules in both development and production without modifying the very security model I m trying to test After all who would want to do real permissions testing for the first time in a production environment Nothing was working I was stuck I missed Then I missed again Then I got sad I had a popsicle And then I passed out in the snow Just kidding on the last few but what I did do what have an epiphany in the shower I do some of my best thinking there Anyone else No Okay Moving on The SolutionMy app in particular is using Google Login and the Google auth provider so that s what I m going to focus on here but I believe this approach would translate to other auth providers as well The key to making this work is abstraction Take any Firebase call that you d normally make and hide it behind a function that may or may not do the same thing Usually it s the same sort of thing with some extras sprinkled in In this case we ll be looking at the firebase initializeApp function In the normal production environment this is super simple We pass in a siteConfig object and we re on our merry way However when working locally and or with Firebase Emulators this doesn t work one for one In the docs they indicate that we should use initializeTestApp instead to perform our initialization This comes from the firebase testing module as opposed to the firebase app module This might seem perfect on the surface but the issue is that anywhere we might normally use firebase lt sometThing gt to interact with the default firebase app we can t We instead need to work with the app instance returned from the call to firebase initializeTestApp By extension this means we should structure our code so that we re always using app lt someThing gt in favor of firebase lt someThing gt regardless of whether we re using initializeApp or initializeTestApp Again this doesn t seem too bad on the surface but there s one more catch In each case the app instance as provided by initialize App siteConfig is slightly different Namely app auth is not a thing for apps initialized via initializeTestApp This is the crux of the auth emulation problem And this is what we are going to solve Let s take a look at some code Here is a utility function to initialize either a test or production app and return it const createApp async onAuthStateChanged gt const firebase await importFirebase if isDevelopment const app firebase initializeTestApp siteConfig set up custom hooks for auth mocking app internal onAuthStateChanged return app else const app firebase initializeApp siteConfig Set up the auth observer app auth onAuthStateChanged onAuthStateChanged return app There s a lot going on here so let s break it down line by line const createApp async onAuthStateChanged gt I went with async here because in a couple lines you ll see some dynamic imports More on that in a sec The other important piece here is that this createApp function takes an onAuthStateChanged callback and not a siteConfig object like initializeApp Since we control the module containing this abstraction function we can put our siteConfig object here too for easy access I mean you can put the siteConfig wherever you want but to me it makes sense to have the same module own the config block and the utility functions since the goal is to drive all Firebase related functions through this abstraction module The onAuthStateChanged callback will be called whenーyou guessed itーthe auth state changes In the production case we can simply set up an auth observer in the usual manner but in the development case it s a bit more interesting More on that in a sec const firebase await importFirebase Here s another layer of abstraction We want a reference to Firebase as a module and more specifically we might want a reference to the testing version of Firebase but we don t actually care how it is obtained Dynamic imports are a huge help here This is what the definition of importFirebase looks like const importFirebase async gt if isDevelopment return await import firebase testing else const firebase await import firebase app await import firebase auth await import firebase database return firebase There s nothing too surprising here We are either importing test Firebase from firebase testing or we are importing real Firebase from firebase app along with our other Firebase dependencies Dynamically importing real Firebase is a little more involved but it s basically the traditional way of doing it converted to dynamic import form I feel like this is a good time to mention that the reason for using dynamic imports here is so that you only ever end up importing either the test Firebase or the production one but never both Dynamic imports give us that flexibility The astute reader might realize that even with dynamic imports Webpack will still bundle both modules into the output since we don t know until runtime which type of environment we ll be in While this is true it can be avoided by splitting the vendor modules out as part of the build and filtering out one of the two Firebase chunks depending on the build type Development Modeif isDevelopment Assuming this is a React app created via create react app we can calculate whether or not this is a development build by looking for process env NODE ENV development const app firebase initializeTestApp siteConfig Next we need to initialize the test app using the now obtained Firebase module providing it our siteConfig as usual There s a key piece that needs to exist in the siteConfig for this to work though An auth block Here s an example config const siteConfig apiKey authDomain window location host databaseURL isDevelopment http localhost ns https firebaseio com databaseName projectId storageBucket appspot com messagingSenderId appId measurementId auth uid u email u example com That auth block is the key because that means that we can inject a user email into the app manually as we see fit There s a caveat though Since this isn t real auth we ll never get onAuthStateChanged callbacks fired We re going to need to do that ourselves And the first step towards doing that is to store a reference to the provided callback in our test app for later set up custom hooks for auth mockingapp internal onAuthStateChanged return appHere I chose internal as a namespace that I figured nobody would collide with but this could just as easily have been any other unique key on the app object Production ModeThe other case to consider here is the production case Let s take a look at the else block else const app firebase initializeApp siteConfig Set up the auth observer app auth onAuthStateChanged onAuthStateChanged return app This is very similar to what happens in development except we end up importing real Firebase and setting up an actual auth observer with that callback we took in as an argument All of this is to say that we can now callconst app MyFirebaseUtils createApp onAuthStateChanged to get back a firebase app that s ready to go with either emulated auth in development or real auth in production I recommend holding onto this app instance in your application state so that it can be provided to any abstraction functions that may depend on it such as simulating a login in development mode Simulating onAuthStateChangedFor any function we have that would trigger a login or logout we can add in a separate development only flow in which we manually fire an onAuthStateChanged event Looking at the docs those events are either passed a user or null depending on whether the user is logged in or not If our production flow for logging in a user looks like this const doGoogleLogin async app onSuccess onFailure gt const firebase await importFirebase const provider new firebase auth GoogleAuthProvider Show the actual login popup Succeeding here will update the internally managed uid and auth of the app which allows subsequent database calls and other stuff to work app auth signInWithPopup provider then onSuccess catch onFailure Then we can add in a development flow like this const doGoogleLogin async app onSuccess onFailure gt if isDevelopment usercredential onSuccess credential accessToken TEST ID AUTH TOKEN user uid siteConfig auth uid Fire a simulated onAuthStateChanged event passing it the user from our siteConfig auth block app internal onAuthStateChanged uid siteConfig auth uid getIdToken gt TEST ID AUTH TOKEN else production flow And there you have it A sorta kinda way to emulate auth from within a Firebase enabled app Hopefully you find this useful I ve been successfully using this approach in my project to help with offline testing using Firebase emulators 2021-10-24 01:26:27
ニュース BBC News - Home Colombia's most wanted drug lord Otoniel captured https://www.bbc.co.uk/news/world-latin-america-59026214?at_medium=RSS&at_campaign=KARANGA otoniel 2021-10-24 01:16:35
北海道 北海道新聞 桃田賢斗、山口茜らが決勝進出 バドミントンのデンマークOP https://www.hokkaido-np.co.jp/article/603576/ 桃田賢斗 2021-10-24 10:16:00
北海道 北海道新聞 新車の納車遅れ深刻 コロナ拡大や半導体不足で大幅減産 中古車価格が高騰 https://www.hokkaido-np.co.jp/article/603425/ 東南アジア 2021-10-24 10:15:51
北海道 北海道新聞 噴火湾とようら観光協会「アドベンチャートラベル」模索 コロナ収束後見据え https://www.hokkaido-np.co.jp/article/603575/ 観光協会 2021-10-24 10:08:00
ビジネス 東洋経済オンライン 人がストレスから心を病むまでの知られざる経緯 漫画「こころのナース夜野さん」第4集・第25話 | こころのナース夜野さん | 東洋経済オンライン https://toyokeizai.net/articles/-/461270?utm_source=rss&utm_medium=http&utm_campaign=link_back 整形外科 2021-10-24 10:30:00
海外TECH reddit [2021 ISU Grand Prix of Figure Skating] Skate America - Pairs Free Skate Discussion Thread https://www.reddit.com/r/FigureSkating/comments/qd5gce/2021_isu_grand_prix_of_figure_skating_skate/ ISU Grand Prix of Figure Skating Skate America Pairs Free Skate Discussion ThreadDiscuss the Pairs Free Skate here Saturday October Las Vegas Nevada UTC Time and Date Converter Detailed Colour Schedule Entries Music Selections Planned Program Content Results STREAMS The Official ISU YouTube Channel will stream all events and is available in nations without broadcaster agreements See the ISU How To Watch page for more information on what nations have broadcast agreements Or you know you can use a VPN to evade region restrictions The Opera internet browser has a free built in VPN or there are many paid VPN services USA viewers must be subscribed to Peacock Premium a month with a day free trial Canadian viewers CBC Streams Russian Viewers Channel will stream on their website and their YouTube channel Links for other national streams and possible fanstreams are available on SYWTWFS s post All hail SYWTWFS whose skate laces we are not fit to tie Skate America Discussion Thread Masterpost You can also discuss the events on the r figureskating Discord Channel more information on the community and its rules is here submitted by u CountyKildare to r FigureSkating link comments 2021-10-24 01:20:43
ニュース THE BRIDGE Binance(幣安)、音楽NFTプラットフォーム「Melos Studio」に出資 http://feedproxy.google.com/~r/SdJapan/~3/Nm9w8VLL9PI/binance-invests-music-nft-platform-melos-studio Binance幣安、音楽NFTプラットフォーム「MelosStudio」に出資TechinAsiaでは、有料購読サービスを提供。 2021-10-24 01:15:44
ニュース THE BRIDGE グローバル通貨「Wordcoin」に賭けた投資家たちの面々(2) http://feedproxy.google.com/~r/SdJapan/~3/McXjEZOg3mo/worldcoin-launches-a-global-cryptocurrency-that-will-be-given-to-every-person-on-earth-the-last-part グローバル通貨「Wordcoin」に賭けた投資家たちの面々前回からのつづきWorldcoinがすべてのユーザーにとって便利なものとなるよう、チームは誰でも使えるようなウォレットアプリも開発している。 2021-10-24 01:11:27

コメント

このブログの人気の投稿

投稿時間:2021-06-17 22:08:45 RSSフィード2021-06-17 22:00 分まとめ(2089件)

投稿時間:2021-06-20 02:06:12 RSSフィード2021-06-20 02:00 分まとめ(3871件)

投稿時間:2021-06-17 05:05:34 RSSフィード2021-06-17 05:00 分まとめ(1274件)