投稿時間:2021-05-24 23:36:57 RSSフィード2021-05-24 23:00 分まとめ(45件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
IT 気になる、記になる… 「Google Pixel 6」シリーズの一部仕様などの情報が明らかに https://taisy0.com/2021/05/24/140891.html androidpolice 2021-05-24 13:45:59
IT 気になる、記になる… Apple、エルメス製の「AirTag」用アクセサリを販売停止 − 品質問題が原因の可能性も https://taisy0.com/2021/05/24/140884.html airtaghe 2021-05-24 13:04:24
python Pythonタグが付けられた新着投稿 - Qiita 【python】@propertyと@x.setter でデコレータ https://qiita.com/XPT60/items/12305766c40c72c3c937 ここでは、gettersetterの関数の実装として使ってみます。 2021-05-24 22:59:14
python Pythonタグが付けられた新着投稿 - Qiita SHAP(SHapley Additive exPlanation)についての備忘録 https://qiita.com/perico_v1/items/fbbb18681ecc362a4f9e あるつの特徴量今回はRMについて、訓練データ全体でのその特徴量RMの値と、対応するSHAP値の散布図を作成横軸が特徴量の値、縦軸が対応するSHAP値SHAP値は予測値に対する特徴量の寄与を示すので、この図から、RMが変化したら予測値がどう変化するか読み取れるRMが大きいほどSHAP値は大きい、つまり、homepriceが大きくなることを示しているまた、このグラフでは選択した特徴量RMと他の特徴量との相互作用も確認できるようになっていてcolor引数にshap値の変数を指定すると、自動的に適した変数が選択される今回はRADが選ばれていて、RADの大小によって、同じRMでもSHAP値が異なることが確認できるshapplotsscattershapvaluesRMcolorshapvalues以下でも似たグラフが描画できる。 2021-05-24 22:32:26
python Pythonタグが付けられた新着投稿 - Qiita VTKFortranをWindowsでビルドする https://qiita.com/implicit_none/items/567732f30461db3a0b17 VTKFortranをWindowsでビルドする概要VTKファイルフォーマットをFortranで扱うためのオープンソースライブラリVTKFortranをWindowsでビルドする手順を整理しましたVTKFortranのリポジトリにも書かれていますがLinux上で開発されており他のOSはサポートされていませんWSLやMacOSでは簡単にビルドできますがWindowsでビルドするには色々と問題がありましたいくつかの方法でビルドする方法を見つけたので備忘録的にまとめます環境VTKFortranvWindowsProHcmakeGNUMakegfortrangitforWindowsMinGWWxPythonAnacondaindividualeditionParaViewforWindowsUbuntuonWSLmacOSディレクトリ構成下記のようなディレクトリ構成を想定して作業していきます├ーここにVTKFortranを持ってくる├ーsrc│└ーmainf├ーinclude└ーlibVTKFortranVTKとはVisualizationToolKitの略でDCG画像処理科学的可視化のためのオープンソースソフトウェア正確にはCのクラスライブラリとTclTkJavaPython用のインタフェースです本記事で対象とするのはオープンソースソフトウェアではなくVTKで定められたファイルフォーマットです以後区別するためにVTKファイルフォーマットと称しますVTKはCTclTkJavaPythonを対象としているためそれぞれの言語のネイティブな記述でVTKに定められたデータ構造の作成や入出力が可能です一方VTKにはFortran用のインタフェースが用意されていないのでFortranでVTKファイルフォーマットを取り扱うには個々人で特定の形式に対する入出力ルーチンを作成するかC言語との混合言語プログラミングが必要になりますVTKファイルフォーマットにはレガシー形式とXML形式があり情報として入手できるのは主にレガシー形式の方でしたまた情報もほとんどがASCII形式で取り扱うように書かれておりそれらを参考にするとどうしてもファイルサイズが増加するという問題もありましたVTKFortranはXML形式のVTKファイルフォーマットを取り扱える純粋なFortranのライブラリとして開発されました開発にはFortranが用いられておりASCII形式Baseエンコードのバイナリ形式RAW形式をサポートしていますライセンスはいくつかありオープンソースのプロジェクトに対してはGPLvオープンソースでないまたは商用のプロジェクトに対してはBSDClauseBSDClauseMITとなっていますVTKFortranコードの入手VTKFortranのコードはGithubから入手しますこのとき単純にgitcloneするのではなくVTKFortranが参照する外部のリポジトリもまとめてクローンするようにしますgtgitclonerecursiveそうするとプロジェクトのルートにVTKFortranディレクトリが作られるのでそのディレクトリに移動してgitsubmoduleupdateを実行しますgtcdVTKFortranVTKFortrangtgitsubmoduleupdateinitrecursiverecursiveという表現が多いと思われるかも知れませんがVTKFortranは外部のリポジトリを何重にも引っ張ってきているので依存関係は結構面倒ですVTKFortranのビルドmacOSWSLいわゆるUnix系のシェルとコマンドが使える環境ではビルドは非常に簡単ですルートにmakefileが用意されているのでmakeを実行すると静的ライブラリlibvtkfortranaが作成されますVTKFortranmakeCompilerusedgnugtusrbingfortranSourcedirsrcLibdirstaticLibraystaticlibvtkfortranaSharedlibnoDebugnoFstandardnoOptimizenoOpenMPnoMPInoCompileoptionscppcJstaticmodLinkoptionsCompilepenfglobalparametersvariablesFCompilepenfbsizeFCompilepenfstringifyFCompilepenfFCompilebeforpackdatamFCompilebeforFCompilefaceFCompilestringiforstringtFCompilestringiforFCompilefoxyxmltagFCompilefoxyxmlfilefCompilefoxyfCompilevtkfortranparametersfCompilevtkfortranvtkfilexmlwriterabstractfCompilevtkfortrandataarrayencoderfCompilevtkfortranvtkfilexmlwriterasciilocalfCompilevtkfortranpvtkfilefCompilevtkfortranvtkfilexmlwriterappendedfCompilevtkfortranvtkfilexmlwriterbinarylocalfCompilevtkfortranvtkfilefCompilevtkfortranvtmfileFCompilevtkfortranfAssembleVTKFortranただしmacOSの場合は長々と警告が出ますApplicationsXcodeappContentsDeveloperToolchainsXcodeDefaultxctoolchainusrbinranlibfilestaticlibvtkfortranafoxyohasnosymbolsApplicationsXcodeappContentsDeveloperToolchainsXcodeDefaultxctoolchainusrbinranlibfilestaticlibvtkfortranavtkfortranparametersohasnosymbolsApplicationsXcodeappContentsDeveloperToolchainsXcodeDefaultxctoolchainusrbinranlibfilestaticlibvtkfortranafoxyohasnosymbolsApplicationsXcodeappContentsDeveloperToolchainsXcodeDefaultxctoolchainusrbinranlibfilestaticlibvtkfortranavtkfortranparametersohasnosymbolsこのときビルドした結果はVTKFortrastaticに出力されますlibvtkfortranaはstaticディレクトリにオブジェクトファイルはstaticobjにモジュールファイルはstaticmodに出力されますlibvtkfortranaをlibにmodファイルをincludeディレクトリにコピーして利用します├ーVTKFortran├ーsrc│└ーmainf├ーinclude│└ーmod└ーlib└ーlibvtkfortranaVTKFortranのビルドWindowsいわゆるUnix系のシェルとコマンドが使える環境ではビルドは簡単だと述べましたWindows環境ではビルドがかなりややこしくなりますVTKFortranは何通りかのビルド方法を提供していますがそれぞれで問題が生じるためですcmakeを使うVTKFortranのルートにCMakeListstxtがあるのでcmakeでビルドできそうなのですが実際にはビルドできませんルートにあるCMakeListstxt内ではADDSUBDIRECTORYでVTKFortransrclibとVTKFortransrctestを追加していますがlibディレクトリにCMakeListstxtが無くまたtestディレクトリ自体存在しませんtestsはあるがその中にCMakeListstxtはないそのためcmakeを実行するとエラーが生じまたコンパイルするソースファイルが一切指定されてないという状況になりますADDSUBDIRECTORYLIBSRCPATHADDSUBDIRECTORYTESTSRCPATHVTKFortrangtcmakeHBbuildGUnixMakefilesDCMAKEFortranCOMPILERgfortranTheFortrancompileridentificationisGNU中略CMakeErroratCMakeListstxtADDSUBDIRECTORYThesourcedirectory中略VTKFortransrclibdoesnotcontainaCMakeListstxtfileCMakeErroratCMakeListstxtADDSUBDIRECTORYADDSUBDIRECTORYgivensource中略VTKFortransrctestwhichisnotanexistingdirectory以下省略しかし参照するべきソースファイルは判っていますしコンパイルオプションもCMakeListstxtで設定されているのでそれらのソースを明記してaddlibraryを呼べばライブラリは作成できます参照するべきソースファイルはVTKFortransrclibfとFVTKFortranが参照するモジュールのソースVTKFortransrcthirdpartyBeFoRsrclibFVTKFortransrcthirdpartyFACEsrclibFVTKFortransrcthirdpartyFoXysrclibfとFVTKFortransrcthirdpartyPENFsrclibFVTKFortransrcthirdpartyStringiForsrclibFですADDSUBDIRECTORYをコメントアウトして非常に適当ですが以下のようにCMakeListstxtを修正するとlibvtkfortranaとmodファイルが作成されますFILEGLOBlibSRCPATHlibfFILEGLOBBeFoRSRCPATHthirdpartyBeFoRsrclibfFILEGLOBFACESRCPATHthirdpartyFACEsrclibfFILEGLOBFoXySRCPATHthirdpartyFoXysrclibfFILEGLOBPENFSRCPATHthirdpartyPENFsrclibfFILEGLOBStringiForSRCPATHthirdpartyStringiForsrclibfaddlibraryvtkfortranSTATIClibBeFoRFACEFoXyPENFStringiForVTKFortrangtcmakeHBbuildGUnixMakefilesDCMAKEFortranCOMPILERgfortranTheFortrancompileridentificationisGNU以下省略VTKFortrangtcmakebuildbuild以下省略VTKFortranbuildlibにlibvtkfortranaがVTKFortranbuildmodulesにmodファイルが作成されますこの方法は一度CMakeListstxtを書いてしまうと途中で警告も出ないのですが年前に作られて更新されていないCMakeListstxtで本当に大丈夫なのか気になりますmakefileを使うGNUMakeforWindows等をインストールしている場合makeコマンドが実行できるのでmakefileを参照してビルドできると思うかもしれませんしかしVTKFortranのmakefileはLinuxで実行する事を前提に書かれているのでコマンドプロンプトで実行しても構文エラーで止まってしまいますVTKFortrangtmakeprocessbeginCreateProcessNULLwhichgfortranfailedECHOはltOFFgtです。 2021-05-24 22:29:38
js JavaScriptタグが付けられた新着投稿 - Qiita 2021年に学ぶべきJavaScriptフレームワークは何かね? https://qiita.com/rana_kualu/items/28783c56402543098371 Gatsbyも好きなんだけどサイズが大きすぎてリッチアプリのためのものになってる。 2021-05-24 22:26:26
js JavaScriptタグが付けられた新着投稿 - Qiita React入門 - Tips9 - null,undefined,空文字 https://qiita.com/yokowake12345/items/8d4e8d8b0895050cdcf7 React入門Tipsnullundefined空文字目次nullとundefinedと空文字の違いについてこちらを参考にさせていただきました。 2021-05-24 22:23:12
js JavaScriptタグが付けられた新着投稿 - Qiita React入門 - Tips7 - immer。オブジェクト配列のクローン https://qiita.com/yokowake12345/items/6ce6890ceb9139e126b6 constmotoNetaTptptptestitmitmitmitmクローンできるか試すパターンconsttesttestmotoNeta元ネタをオブジェクト配列とそれ以外に分離constslicetestsliceで分離したオブジェクト配列をsliceconstspreadTesttestで分離したオブジェクト配列をスプレッド構文で展開constassignObjectassigntestで分離したオブジェクト配列にOBjectassignを使ってみるconstcreateObjectcreatetestで分離したオブジェクト配列にOBjectcreateを使ってみるconstjsonpTestJSONparseJSONstringifytestで分離したオブジェクト配列にJSONparseJSONstringifyクローン出来ているか確認するため、test配列の一部を変更します。 2021-05-24 22:09:43
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) display:flexで左に隙間ができる https://teratail.com/questions/340155?rss=all displayflexで左に隙間ができる前提・実現したいことdisplayflexで要素を横並びにしたいのですが左に隙間ができてしまいます。 2021-05-24 22:51:02
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) Rspec レシーバが存在しないメソッドをスタブしたい https://teratail.com/questions/340154?rss=all Rspecレシーバが存在しないメソッドをスタブしたい前提・実現したいことRspecを用いてスクレイピングプログラムのテストを考えています。 2021-05-24 22:48:12
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) 「もし値が存在したら、それ自身をvalueとする」という条件分岐の書き方 https://teratail.com/questions/340153?rss=all 「もし値が存在したら、それ自身をvalueとする」という条件分岐の書き方実現したいこと確認画面から入力画面に戻ったときに、「もし特定の変数が存在していたら、その変数の値自身を、hiddenのvalueとする」というのを、三項演算子を使わず実現したいです。 2021-05-24 22:45:48
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) 【Ruby】seleniumでログイン情報を記録できません。 https://teratail.com/questions/340152?rss=all ログイン情報を記録したchromenbspprofileを作成したいです。 2021-05-24 22:43:50
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) Flutterで独自関数を実装する https://teratail.com/questions/340151?rss=all Flutterで独自関数を実装するFlutterを勉強しております。 2021-05-24 22:40:58
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) JSONデータでvalue値からkeyの値1件のみ取得したい https://teratail.com/questions/340150?rss=all JSONデータでvalue値からkeyの値件のみ取得したい前提・実現したいことJSONデータにてkeyの値を取得したい。 2021-05-24 22:39:30
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) パスについて HTMLファイルからJavaファイルを指定 https://teratail.com/questions/340149?rss=all パスについてHTMLファイルからJavaファイルを指定前提・実現したいことここに質問の内容を詳しく書いてください。 2021-05-24 22:34:58
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) Must supply api_keyについて https://teratail.com/questions/340148?rss=all Mustsupplyapikeyについて前提・実現したいことlaravelのプロジェクトをAWSにデプロイしました。 2021-05-24 22:28:10
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) リアルタイム検索でハイライトしたい https://teratail.com/questions/340147?rss=all リアルタイム検索でハイライトしたい前提・実現したいことリアルタイム検索で、ターゲットエリアの該当文字列検索する文字をハイライトしたいがやり方が分からない。 2021-05-24 22:23:54
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) ファイルの文中の単語をカウントする https://teratail.com/questions/340146?rss=all ngrep 2021-05-24 22:17:50
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) line-height: 1;と指定してもfont-sizeと揃わない https://teratail.com/questions/340145?rss=all lineheightと指定してもfontsizeと揃わない前提・実現したいことfontsizenbsppxlineheightnbspと指定し、chromeのデベロッパーツールで高さを確認すると、pxになっています。 2021-05-24 22:15:12
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) Kotlin REPL https://teratail.com/questions/340144?rss=all KotlinREPL前提・実現したいことAndroidnbspstudioでKotlinnbspREPLの機能を使いたいのですが、以下のようなメッセージが出て、文字を入力しようとすると「Thisnbspviewnbspisnbspreadonly」と表示されます。 2021-05-24 22:11:56
Ruby Rubyタグが付けられた新着投稿 - Qiita [Rails]link_toメソッドからcreateを実行する https://qiita.com/kei-kun1960/items/088a1c43b53c9cd79d20 いつもcreate実行するときはformwithのフォームからユーザーが入力したものを送信してサーバー側で受け取りcreateすることが多い。 2021-05-24 22:23:36
AWS AWSタグが付けられた新着投稿 - Qiita Step FunctionsからLambda経由せずにSlackへ通知する https://qiita.com/masaminh/items/17edb2aaeb78c4c7274e 本当はプライベートAPIにする方がいいのかな、とも思ったのですが、StepFunctionsからはプライベートAPIは呼び出せない旨がAWSのドキュメントに記載されていたので、リージョンAPIにした上でIAM認証にすることで、無関係の他者から呼び出せないようにしています。 2021-05-24 22:04:51
Docker dockerタグが付けられた新着投稿 - Qiita M1 Macbookでdocker loginが失敗する https://qiita.com/ddtkra/items/67b2ed77c8bf321fd54e 2021-05-24 22:33:26
Linux CentOSタグが付けられた新着投稿 - Qiita [備忘録]redmine-centos-ansibleでインストールに失敗したときの対処法(create locale ja_JP.UTF-8でこけた編) https://qiita.com/Aqua_Marinne/items/64bc3f1a62d82747bdd3 発生したエラー今回Redmineのインストールに使ったのはこれ。 2021-05-24 22:30:44
Ruby Railsタグが付けられた新着投稿 - Qiita [Rails]link_toメソッドからcreateを実行する https://qiita.com/kei-kun1960/items/088a1c43b53c9cd79d20 いつもcreate実行するときはformwithのフォームからユーザーが入力したものを送信してサーバー側で受け取りcreateすることが多い。 2021-05-24 22:23:36
技術ブログ Developers.IO CloudflareがCDN向けキャッシュヘッダーCDN-Cache-Controlを実装したので触ってみた https://dev.classmethod.jp/articles/cloudflare-supports-cdn-cache-control/ edhttpresponseheaderfi 2021-05-24 13:16:19
海外TECH Ars Technica YouTube feels heat as Russia ramps up “digital sovereignty” drive https://arstechnica.com/?p=1767081 groups 2021-05-24 13:40:42
海外TECH DEV Community How to fetch data from the Anilist API (GraphQL) using Axios https://dev.to/synxc/how-to-fetch-data-from-the-anilist-api-graphql-using-axios-1356 2021-05-24 13:48:45
海外TECH DEV Community Here’s How Casinos Are Using AI https://dev.to/killingclown007/here-s-how-casinos-are-using-ai-26l5 Here s How Casinos Are Using AIIn person casinos and online gaming platforms are using AI in unique ways to improve the gaming experience In addition to helping players have fun and thus spend more money at a slot machine or table casinos and online gaming platforms use AI to keep players information secure and even identify signs of gambling addiction How AI Can Enhance the Casino Experience for Players There are several use cases for AI in casinos both in person and online Here are some of the most prevalent ways casino software developers are using AI today Keep players engagedThe first rule of any casino or casino like platform is to find ways to keep players engaged so they spend more time and money playing In person casinos want to encourage their guests to spend time at different machines and tables so they ll spend more money That s why there aren t clocks or windows in casinos You can easily spend an entire day there eating and drinking as you play without realizing it The experience is not the same when you move to an online platform Because online gaming sites rely heavily on ad revenue they don t necessarily need to encourage players to spend money Instead they need to find ways to keep players engaged long enough to generate ad revenue In gaming software AI can achieve this by analyzing a player s behaviors to gauge their interest Once AI understands what a player likes it can recommend games that the player might want to try Instead of playing random games online the player will be explicitly directed to games they have a high probability of enjoying and spending their time and money on Protect playersBoth in person and online gaming software collects data from players In person casinos use cards to collect data about gamers They can use the data collected to make decisions about the future of the casino by analyzing trends in which games get played the most and by who They can also use the data to determine where to place specific machines or tables to maximize profits Online casinos and casino software use personal data in similar ways By understanding how players are using their online games and analyzing player behavior they can make informed decisions about what types of games to make next and how to market them This includes identifying signs of gambling addiction Some online casinos will shut down a player s account and guide that player to helpful resources if it recognizes patterns of addictive behavior Prevent fraudEvery casino whether online or in person runs the risk of fraud Machine learning can detect fraudulent activities immediately by noticing when something does not match the predictive pattern This protects the casino as well as individual users ConclusionOnline casinos are becoming increasingly popular especially as a result of the COVID pandemic By incorporating AI into their software online casinos can enhance the experience for their players while protecting them from fraud and addictive behaviors This is one area where we can expect to see a significant impact from AI as more companies recognize its benefits 2021-05-24 13:43:55
海外TECH DEV Community How to create Tokens using Stellar https://dev.to/cypriantinasheaarons/how-to-create-tokens-using-stellar-33e8 How to create Tokens using StellarLearning blockchain can be intimidating and the learning curve can be very steep Stellar makes it easier IMO With this article I hope to help you gain a better understanding of how the stellar blockchain network works My only hope is to inspire you to learn blockchain and be excited about the technology Stellar is a distributed ledger technology that allows anyone to build low cost and fast financial services Stellar has some of the best documentation and tutorials to help a blockchain developer get started quickly The stellar laboratory is the best place to explore the stellar ecosystem and how the technology works It allows us to connect to the stellar server The Stellar Laboratory is a set of tools that enables people to try out and learn about the Stellar network The laboratory can build transactions sign them and submit them to the network It can also make requests to any of the Horizon endpoints This article will have four key steps Step Create two stellar accounts Step Create a trustline between the issuer and distributor accounts Step Prevent the issuer from making more tokens Step Distribution of the tokensOkay folks let s get our hands dirty Step Create two stellar accountsThe first step is setting up two accounts on Stellar one for issuing tokens and the other for distributing tokens Firstly lets navigate to stellar laboratory and select the stellar test server to allow us to work in a test environment Next we will set up the two test accounts one for the issuer account and another for the distributor account This can be done by clicking the generate key pair This will output a public and private key for one account Repeat the process for the second account Lastly we will fund both accounts with lumens on the test network You can do this by clicking the Get test network lumens button Lumens are native tokens in the Stellar network and you can read more on lumens here Step Create a trustline between the issuer and distributor accountsThe second step is about setting up a trustline between the issuer of tokens and the distributor A Trustline in Stellar explicitly implies that the distribution account trusts the issuing account with the handling of the assets issued Firstly we change tabs and go on the Build Transaction page The transaction builder lets us build a new Stellar transaction on the Stellar Network We add the distributor public id into the Source Account field And then we click the Fetch next sequence number for account starting with XXXXXXXX button Let s go to the Operation Type field and select Change Trust option from the dropdown On the Asset field we named our asset Gold added the issuer public Id and added a trust limit of A trust limit of means we will create tokens when we submit the transaction Next we complete the transaction by clicking the Sign in Transaction Singer button Lastly we sign the transaction using the issuer s private key id and by clicking the Submit In Transaction Submitter button When the transaction is successful tokens are generated and added to the Distributor s balance Step Prevent the issuer from making more tokensThe goal of this step is to prevent the issuer from generating more tokens on the Stellar network So basically this locks the issuer s account Firstly we go back to the transaction builder page Let s add the issuer s public key in the Source Account field and generate a transaction sequence number by clicking Fetch next sequence number for account starting with XXXXXXXX button We go on the Operation Type field and select the Set Options option from the dropdown Let s go to the Master Weight field and add a value of Then we click the Sign In Transaction Singer button at the bottom of the page Lastly we add the issuer s private key in the Add Singer field and finish off by clicking Submit In Transaction Submitter button at the bottom of the page Step Distribution of the tokensWe have generated our tokens and everything is set up finally we need to be able to distribute the tokens We can trade and convert our assets on the stellar network Stellar offers a decentralized exchange and you can read more about it on Using this link we can check out if we successfully generated the tokens You now have a understanding of how the stellar blockchain network works Where to go from here I suggest you start building a blockchain solution with the help of Stellar SDKs ThanksThanks to Stellar and the stellar developer foundation team Thank you for reading this Follow me on TwitterCheckout my website 2021-05-24 13:35:37
海外TECH DEV Community #30DaysOfAppwrite : Our First Cloud Function https://dev.to/appwrite/30daysofappwrite-our-first-cloud-function-59k6 DaysOfAppwrite Our First Cloud Function Intro DaysOfAppwrite is a month long event focused at giving developers a walk through of all of Appwrite s features starting from the basics to more advanced features like Cloud Functions Alongside we will also be building a fully featured Medium Clone to demonstrate how these concepts can be applied when building a real world app We also have some exciting prizes for developers who follow along with us Reading TimeThe first Cloud Function we are going to implement in our Medium Clone will be a function that will calculate the reading time of a post Calculating the reading time of a post can be quite the extensive task depending on the length of the content In order not to slow down your application unnecessarily we will run this process on our server We are going to use a formula suggested in this blog post from Infusion Media First of all we are going to add following rule to our Posts collection Label Reading TimeKey readingTimeRule Type TextNow that the Database is prepared let s start with our cloud function For this we are going to create a Cloud function with Node js runtime In your Function Dashboard under the Settings Tab we need to enable the trigger for the events database documents create and database documents update As environment variables we are going to add the following APPWRITE PROJECT ID Insert your project ID APPWRITE ENDPOINT Insert your appwrite endpoint APPWRITE API KEY Insert an API key that has documents write permission POSTS COLLECTION Insert the ID of the Posts collection To stay true to the language of our demo project we will write it in Node js Create a Node js package using npm mkdir calculate reading timecd calculate reading timenpm init yNow adding node appwrite as a dependency npm install node appwriteCreate index js file and put in following content const DATA JSON parse process env APPWRITE FUNCTION EVENT DATA const POSTS COLLECTION process env POSTS COLLECTION const id collection text published DATA Stop if it s not the Posts Collection or not publishedif collection POSTS COLLECTION published return Initialise the client SDKconst appwrite require node appwrite const client new appwrite Client const database new appwrite Database client client setEndpoint process env APPWRITE ENDPOINT Your API Endpoint setProject process env APPWRITE PROJECT ID Your project ID setKey process env APPWRITE API KEY Your secret API key Get word countlet words text match A Za z uC uF u uFF u uF u uFF uF uFFF uE uFFF d g words words words length let minutes words let seconds minutes let readingTime Math floor minutes m Math floor seconds s Don t update Post if reading time has not changedif readingTime DATA readingTime return database updateDocument collection id readingTime readingTime then console log catch console error This function is triggered on every document write and update events calculates the reading time and saves it to the readingTime attribute We are also checking if the reading time changes this is necessary to not create an infinite loop and unnecessarily hit the API with our Cloud Function We can upload the Function very easily using the Appwrite CLI or upload it manually in the dashboard appwrite functions createTag code functionId YOUR FUNCTION ID command node index js Don t forget to activate the tag we just created We covered both the CLI method and Manual method on Day So feel free to check it out if you get stuck Testing Our Cloud FunctionWe can easily test out our reading time calculation now when navigating to the Posts collection and edit the text of a published post You can either navigate to the Functions Dashboard and check the log or just refresh the document we just updated and see how the readingTime attribute has magically been updated The only thing left for us is to add the reading time to our Medium Clone at the top of each post src routes Post svelte lt i gt post readingTime lt i gt CreditsWe hope you liked this write up You can follow DaysOfAppwrite on Social Media to keep up with all of our posts The complete event timeline can be found hereDiscord ServerAppwrite HomepageAppwrite s GithubFeel free to reach out to us on Discord if you would like to learn more about Appwrite Aliens or Unicorns Stay tuned for tomorrow s article Until then 2021-05-24 13:10:16
海外TECH DEV Community A Complete Beginner's Guide to Next.js https://dev.to/aspittel/a-complete-beginner-s-guide-to-next-js-1md0 A Complete Beginner x s Guide to Next jsI ve used Create React App non stop to scaffold React apps and I love it Recently though I ve been using Next js for more and more of them It has a bunch of great features like routing and server side rendering that offer amazing experiences for both end users and developers Next js is a React metaframework which means that it s a framework built on top of React that enforces more structure and gives you additional capabilities like server side rendering routing bundling and more In this post we ll go through how to get started with Next js SSR vs SSG and routing If you haven t used React before read my getting started with React tutorial and then come back here to do this tutorial You ll need a React foundation first Create a Next js AppWe re going to create an app that lists colors on the home page Each one links to a color page that displays that color s information First we ll initialize a Next js app using the CLI This works like most app initialization scripts where it generates a bunch of starter files for you npx create next app color pages cd color pagesThen we ll start the development server it has hot reloading built in and links to the docs on the generated home page npm run devNow we can start writing code We re going to create a static json file with the colors first Create a directory for the colors then add a colors file inside Then add the colors mkdir datatouch data colors jsonI used a bunch of Pantone colors of the year to create this one feel free to copy it If you make your own make sure to use this structure so the rest of the code works data colors json name Illuminating hex FDFD name Classic Blue hex fc name Living Coral hex FA name Ultra Violet hex fbb name Greenery hex bb name Rose Quartz hex FCAC name Marsala hex B name Radiant Orchid hex ba RoutingNow we ll work on the color pages With Next js if you create a file within the pages folder it makes that into a route So you could create about js to get a about page the exception in index js which routes to You can make folders to create routes like blog my post title too If you put the file name in then the name inside the brackets becomes a parameter name We want to create routes for each color in our array above so we will create a file called color js this will allow us to dynamically create a page for Classic Blue Ultra Violet etc all at one no need to create a separate js file for each one touch pages color js getStaticPathsNow let s create our getStaticPaths function Next js looks for this function in order to generate all the static pages for that template in our case our colors We want to build a page for each of our colors following the same format but without having to hardcode each page First will import our colors array Then inside our function we ll loop through them and name the route params for each In this case our route parameter is color to match the parameter name inside of the in our file name We want the color in our route to match each color name so Marsala will render the page that displays Marsala Finally we ll return all of our colors in the format that Next js is looking for We ll put them in an object with fallback set to false this will make it so that if you go to hotpink a color not in our array you ll get a page color js import the colors arrayimport colors from data colors json export async function getStaticPaths loop through the colors array const paths colors map color gt return an object with params color set to the color s name params color color name Paths will look like this params color Marsala params color Illuminating return paths fallback false In most larger use cases you may want to read files from your file system such as markdown files for blog posts or fetch data from an external API You could do either task within getStaticPaths to generate paths for your app getStaticPropsNow we ll define the getStaticProps function which Next js is looking for This function will provide props to the React component for the page In our use case we ll want just the information about the color on the current page So the page for Marsala gets the data name Marsala hex B not all the other colors The getStaticProps function gets the params passed to it in our case the color name For the page Marsala params would look like color Marsala just like we created in the getStaticPaths function In our case we ll find just the color in our array whose name matches the color in the params Then we ll return the data Next js requires the return to be nested within props color jsexport async function getStaticProps params find the info for just one color const color colors find color gt color name params color return it in the necessary format return props color Within a larger app you may pull from an API in getStaticProps in order to get the information about one item or you may need to fetch just one markdown file to render a blog post Template the PageNow we re on to the fun part Creating the React component to template the page The props object we created in getStaticProps will be passed to the component by Next js we just need to render the data on the page We ll use the hex code to add a background color to the page and render the color name color js export default function Color color return lt div className color page style backgroundColor color hex gt lt h gt color name lt h gt lt div gt I replaced the CSS file with the following to make the page look a little better global css html body next color page padding margin height width top px position absolute display block font family apple system BlinkMacSystemFont Segoe UI Roboto Oxygen Ubuntu Cantarell Fira Sans Droid Sans Helvetica Neue sans serif color page display flex justify content center align items center Link ComponentNow all we need to do is use the Link component to link to each color s page from the home page We ll update index js with the list of colors We ll use two Next js specific components in this Home component Link and Head lt Link gt allows you to do client side route transitions which will make page transitions smoother for users We ll use it in place of and otherwise just like an a tag The lt Head gt component allows us to insert data into the html head tag from within the component We ll update the page title and meta tags from there index jsimport Head from next head import Link from next link import colors from data colors json export default function Home return lt div gt lt Head gt lt title gt Colors lt title gt lt meta name description content App that displays pretty colors to learn Next gt lt Head gt colors map color gt lt Link href color name gt lt h gt color name lt h gt lt Link gt lt div gt SSR vs SSGWe just built a statically generated Next js app what that means is data is only fetched at build time If our colors were coming from an API and we had our site built and deployed our app would not update with any API changes say the color of the year was added For many apps this is totally fine A blog doesn t need to update too often with content SSG static site generation allows Next js to generate HTML for each page when the site is being built Those pages can then be cached by a CDN and lead to a super performant site That being said sometimes you need a site that updates dynamically and that s where server side rendering comes in SSR server side rendering allows you to still render HTML on the server side but do that for each request made by a user to the page instead of at build time In order to use SSR instead of SSG we would replace our getStaticProps and getStaticPaths with just getServerSideProps Note that the below example will not work because we did not actually create an API export async function getServerSideProps params Make a request to get data about the color via our API const res await fetch params color const color await fetch json return the data as props that will be passed to the Color component return props color If you want to read more about SSR vs SSG I have a full blog post about the difference DeploymentNow that you have a Next js app written you need to get it live online AWS Amplify supports deploying both SSR and SSG Next js apps without any additional configuration on your end If you re creating a statically generated Next js app go to your package json file and change your build script to next build amp amp next export If you re instead creating a server side rendered app you don t need to change a thing The scripts Next js generated for you will be what you need scripts dev next dev build next build amp amp next export start next start Then create a repository on your git provider of choice and push your code to it Create an AWS account if you don t already have one Navigate to the Amplify ConsoleClick on the orange connect app button Choose GitHub in the From your existing code menu and click continueType in the name of your GitHub repo you just created it should autofill and then click nextThe build settings will auto populate and so you can just click next on the Configure build settingsClick Save and deploy ConclusionNext js has an amazing developer experience It has great error messages comprehensive and understandable documentation and is super powerful for just a little bit more work than a normal React app I hope this tutorial was helpful 2021-05-24 13:03:57
Apple AppleInsider - Frontpage News EuFy's security problem, new HomeKit gear, new updates, and Deep Sentinel camera review on HomeKit Insider https://appleinsider.com/articles/21/05/24/eufys-security-problem-new-homekit-gear-new-updates-and-deep-sentinel-camera-review-on-homekit-insider?utm_medium=rss EuFy x s security problem new HomeKit gear new updates and Deep Sentinel camera review on HomeKit InsiderThis week EuFy had a major problem with users seeing other people s camera feeds instead of their own ーunless they were HomeKit users Andrew and Stephen explain what happened and why HomeKit Secure Video users saw none of this Whereas HomeKit users could see all manner of new hardware and software announcements including some from Apple As the Apple TV K with its HomeKit Thread support started arriving for pre order customers so we learned more about how it works with the new lossless Apple Music There s a lot of confusion over which devices will be able to play back the new improved audio though so HomeKit Insider clears that up ーas much as anyone can so far Read more 2021-05-24 13:41:22
Apple AppleInsider - Frontpage News Apple stops online sales of Hermes AirTag, possibly over quality problems https://appleinsider.com/articles/21/05/24/apple-stops-online-sales-of-hermes-airtag-possibly-over-quality-problems?utm_medium=rss Apple stops online sales of Hermes AirTag possibly over quality problemsThe online Apple Store has temporarily stopped selling the Hermes AirTags in the United States in what could be a precautionary measure over potential quality issues Visitors to the online version of the Apple Store are not able to buy any of the AirTag Hermes products on Monday with all three items listed as currently unavailable This includes the key ring the bag charm and the luggage tag models The website doesn t mention why the premium model is unavailable at this time but the phenomenon isn t limited to just the United States AppleInsider checks found that both the luggage tag and key ring versions aren t available in the UK and France yet the bag charm continues to be sold in those markets Read more 2021-05-24 13:16:21
海外TECH Engadget Amazon's Fire TV Cube is on sale for $100 right now https://www.engadget.com/amazon-fire-tv-cube-sale-fire-tv-stick-4k-fire-tv-stick-lite-discounts-131043562.html stick 2021-05-24 13:10:43
金融 RSS FILE - 日本証券業協会 新型コロナウイルス感染症への対応について https://www.jsda.or.jp/shinchaku/coronavirus/index.html 新型コロナウイルス 2021-05-24 15:00:00
金融 RSS FILE - 日本証券業協会 J-IRISS https://www.jsda.or.jp/anshin/j-iriss/index.html iriss 2021-05-24 13:53:00
ニュース BBC News - Home Western powers voice outrage as Belarus accused of hijacking plane https://www.bbc.co.uk/news/world-europe-57224452 dissident 2021-05-24 13:01:16
ニュース BBC News - Home BBC to review editorial policies and Martin Bashir hiring https://www.bbc.co.uk/news/uk-57229049 wales 2021-05-24 13:52:09
ニュース BBC News - Home Sasha Johnson: Black Lives Matter activist shot in London https://www.bbc.co.uk/news/uk-england-57223755 people 2021-05-24 13:12:03
ニュース BBC News - Home UK holidays: When and where can I go.... and who with? https://www.bbc.co.uk/news/explainers-52646738 uk 2021-05-24 13:30:11
LifeHuck ライフハッカー[日本版] 着実に変わりつつある。次の時代で必要な仕事の資質とは? https://www.lifehacker.jp/2021/05/how-the-growing-identity-economy-is-reshaping-the-future-of-work.html 心理療法 2021-05-24 22:05:00
北海道 北海道新聞 テレ朝の下平アナがコロナ陽性 夫の長野選手が感染し検査 https://www.hokkaido-np.co.jp/article/547514/ 下平さやか 2021-05-24 22:15:00
北海道 北海道新聞 自民、LGBT法案を了承 少数者への理解増進図る https://www.hokkaido-np.co.jp/article/547512/ 性的指向 2021-05-24 22:13:00
仮想通貨 BITPRESS(ビットプレス) ビットポイントジャパン、NFT事業へ参入 https://bitpress.jp/count2/3_10_12511 事業 2021-05-24 22:57:19

コメント

このブログの人気の投稿

投稿時間: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件)

投稿時間:2020-12-01 09:41:49 RSSフィード2020-12-01 09:00 分まとめ(69件)