投稿時間:2021-09-13 22:43:54 RSSフィード2021-09-13 22:00 分まとめ(60件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
IT ITmedia 総合記事一覧 [ITmedia News] Google マップにドコモ・バイクシェア拠点の表示機能 東京と大阪で https://www.itmedia.co.jp/news/articles/2109/13/news156.html itmedianewsgoogle 2021-09-13 21:06:00
AWS AWS Game Tech Blog Detect anomalies in games with Amazon Lookout for Metrics and the Game Analytics Pipeline Solution https://aws.amazon.com/blogs/gametech/detect-game-anomalies-amazon-lookout-for-metrics-game-analytics-pipeline/ Detect anomalies in games with Amazon Lookout for Metrics and the Game Analytics Pipeline SolutionGame analytics can be a powerful tool to help studios throughout the development cycle Insights driven from game data can help you to create more engaging personalized experiences for players and more efficiently monetize games it can also help with fraud investigations as well as performance monitoring and error reporting Anomaly detection is commonly used … 2021-09-13 12:40:16
AWS AWS The Internet of Things Blog Building a scalable IoT system for connected air purifiers on AWS IoT: Blueair (a Unilever company) https://aws.amazon.com/blogs/iot/building-a-scalable-iot-system-for-connected-air-purifiers-on-aws-iot-blueair-a-unilever-company/ Building a scalable IoT system for connected air purifiers on AWS IoT Blueair a Unilever company Introduction Our homes contain everything from dust cooking fumes and chemicals released from paint furniture and cleaning agents Add to that polluted outdoor air making its way into our homes through ventilation and you ve got a cocktail of toxins floating around between your four walls Clean air has proven positive health benefits It can provide … 2021-09-13 12:33:32
python Pythonタグが付けられた新着投稿 - Qiita 【Python】【ffmpeg】ffmpegで.movから.mp4に変換する https://qiita.com/nonono_copen/items/9b1848b99c174576da15 なお、ffmpegの変換コードは以下の通りであるffmpegi変換前ファイルmovpixfmtyuvp変換後ファイル名mpこれをコマンドプロンプトを開かずとも、GUIで複数ファイルを変換できるようにするため、pythonのtkinterでコーディングする。 2021-09-13 21:51:58
python Pythonタグが付けられた新着投稿 - Qiita 【知ってた?】えっ!?環境構築しなくてもPythonも機械学習も使えて、その上GPUまで使わせてもらえる無料ツールがあるってマジ!? https://qiita.com/taqro/items/5514e50ccb371cf487cb 【知ってた】えっ環境構築しなくてもPythonも機械学習も使えて、その上GPUまで使わせてもらえる無料ツールがあるってマジはじめにPythonや機械学習を勉強しようと思って環境構築を試みるも挫折したことのある人におすすめのツールがあります。 2021-09-13 21:38:54
python Pythonタグが付けられた新着投稿 - Qiita torchvizで計算グラフを可視化 https://qiita.com/nt__yji/items/033eb2ede9ab2ad49f00 2021-09-13 21:33:45
python Pythonタグが付けられた新着投稿 - Qiita ABC218 C - Shapes から学んだ https://qiita.com/AKpirion/items/9b6c6aa19dff1382517c 赤線の交点を探す。 2021-09-13 21:31:02
js JavaScriptタグが付けられた新着投稿 - Qiita [React]onClickするたびに配列に要素を追加する https://qiita.com/kanako-110/items/41d9f0d9ab8dd056f25e ReactonClickするたびに配列に要素を追加するはじめにラジオボタンを押すと、押した選択肢のvalueが配列に追加するようにしたかった。 2021-09-13 21:28:53
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) JQueryで取った値をいれたinput type="text"があります。laravelのcreate.blade.phpでvalue="{{ old('method_set') }}"が効かない。 https://teratail.com/questions/359328?rss=all JQueryで取った値をいれたinputtypequottextquotがあります。 2021-09-13 21:59:26
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) 商品リストにソート機能を付けたい https://teratail.com/questions/359327?rss=all 商品リストにソート機能を付けたい前提・実現したいこと商品リストを商品名・カテゴリー・価格で並び替えたいセレクトボックスで選択して並び替えをしたい発生している問題・エラーメッセージ下記SQL文のORDERnbspBYの後ろを書き換えればソート方法を変えられるがセレクトボックスで選択した内容に対応させる方法がわかりません。 2021-09-13 21:48:30
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) wordpressのカスタマイズ画面でヘッダーの色を変更できるようにしたい https://teratail.com/questions/359326?rss=all wordpressのカスタマイズ画面でヘッダーの色を変更できるようにしたいwordpressでテーマの開発を行っています。 2021-09-13 21:41:09
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) Google Apps Script : 特定の列に同じ値のセルが並んだ場合に結合したい https://teratail.com/questions/359325?rss=all GoogleAppsScript特定の列に同じ値のセルが並んだ場合に結合したい上記の質問にて、下の行から重複を探して結合することは実現できたのですが、これだと結合したセルの上に行を追加してそこで連続した値が出てきた際にもう一度実行してもセルの結合が行われません。 2021-09-13 21:37:04
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) レスポンシブ時、ハンバーガーメニューを使いたい https://teratail.com/questions/359324?rss=all 原因と解決策を追求したいですがわかりませんでしたheaderlinkが消えない。 2021-09-13 21:36:50
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) Cent Osのイメージファイル(IOSファイル)どれをダウンロードしたらいいか教えてください。 https://teratail.com/questions/359323?rss=all CentOsのイメージファイルIOSファイルどれをダウンロードしたらいいか教えてください。 2021-09-13 21:35:57
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) 複数画面が存在するアプリの設計思想 https://teratail.com/questions/359322?rss=all 複数画面が存在するアプリの設計思想前提・実現したいことここに質問の内容を詳しく書いてください。 2021-09-13 21:33:48
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) c# wpf richtextboxについて https://teratail.com/questions/359321?rss=all cwpfrichtextboxについて前提・実現したいことcでguiアプリケーションを作成しているのですが、特定の文字列の色を変更すると言うものを作りたくて調べた結果、Richtextboxが使えるということで調べながらコードを打っていたのですが、RichBoxTextFindを使用したところ「エラーnbspCSnbspaposRichTextBoxaposnbspにnbspaposFindaposnbspの定義が含まれておらず、型nbspaposRichTextBoxaposnbspの最初の引数を受け付けるアクセス可能な拡張メソッドnbspaposFindaposnbspが見つかりませんでした。 2021-09-13 21:29:16
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) react Modalを上部までスクロールさせたい https://teratail.com/questions/359320?rss=all modal 2021-09-13 21:28:44
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) AbstractController::DoubleRenderErrorが出てしまう。 https://teratail.com/questions/359319?rss=all AbstractControllerDoubleRenderErrorが出てしまう。 2021-09-13 21:10:27
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) 【WordPress】デフォルト投稿カテゴリーを複数選択できないようにしたい https://teratail.com/questions/359318?rss=all 【WordPress】デフォルト投稿カテゴリーを複数選択できないようにしたいカスタム投稿ではなく、デフォルトの投稿タイプのカテゴリー選択を複数選択できないようにしたいです。 2021-09-13 21:03:29
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) squidを使ったKerberos+AD連携をしたい。 https://teratail.com/questions/359317?rss=all WindowsでTeraTermを利用してサーバーやルーター等にsshをするときにプロキシ経由でのユーザー接続認証KerberosをAD連携したい。 2021-09-13 21:01:40
Ruby Rubyタグが付けられた新着投稿 - Qiita 2部グラフの判定の練習:BFS・DFS・Union-Find https://qiita.com/HMMNRST/items/0d4906b40e9cdf0da0e4 「辺で繋がった頂点は逆の値」という規則があるため、適当な頂点に値を決め打ちしたら隣接する頂点を貪欲に埋めていけばいい探索順序は問わない。 2021-09-13 21:37:17
Ruby Rubyタグが付けられた新着投稿 - Qiita 【Rails】gemのアンインストールは、慎重に。 https://qiita.com/mihooo24/items/709a486c8925ed40a508 今回の場合だと該当プロジェクト内のGemfilelockに沿ってアンインストールが実行されていることになります。 2021-09-13 21:34:55
Ruby Rubyタグが付けられた新着投稿 - Qiita view内でif文を用いた条件分岐のスマートな書き方[Ruby, Rails] https://qiita.com/koki0527/items/cd15a624f02b8989c397 view内でif文を用いた条件分岐のスマートな書き方RubyRailsはじめに今回の記事はとても局所的なテーマを扱いますRubyの構文において、以下のようなif文を用いた冗長的な書き方を、よりスマートにまとめますappviewsannouncementhtmlerbBeforeltthgt配信元ltthgtlttdgtltifannouncementuseridgtltannouncementusernamegtltelsegt管理者ltendgtlttdgt結論三項演算子を用いて、かつ文字列の部分はStringオブジェクトにしますAfterltthgt配信元ltthgtlttdgtltannouncementuseridannouncementusername管理者gtlttdgt想定状況announcementインスタンスはuserインスタンスに紐づく、もしくは紐づいていない、状況ですappmodelsuserrbclassUserltApplicationRecordhasmanyannouncementsdependentdestroyendappmodelsannouncementrbclassAnnouncementltApplicationRecordbelongstoclientoptionaltrueendポイント文字列の部分をStringクラスにしていること以下の場合、Encounteredasyntaxerrorwhilerenderingtemplateのエラーが発生し、失敗します。 2021-09-13 21:18:52
Ruby Rubyタグが付けられた新着投稿 - Qiita 【Rails】bulletを使ってN + 1問題解決 https://qiita.com/kinoshitaken123/items/16c9e1e4b06a87d6be69 【Rails】bulletを使ってN問題解決N問題とはN問題とは、データベースからデータを取り出す際に、大量のSQLが発行されてパフォーマンスが低下してしまう問題のことです。 2021-09-13 21:08:39
Ruby Rubyタグが付けられた新着投稿 - Qiita エラー:Routing Error_Uninitialized constant HomesControllerにつまづいた話 https://qiita.com/keigo1401/items/700508fb1f838c6c07c2 public側はURLにpublicを表示しないという仕様のため、namespaceで指定しなければいいのかと思っていたのですが、コントローラアクションはちゃんとpublicフォルダ内のコントローラを使うよと設定してあげないといけなかったんですね。 2021-09-13 21:02:38
Linux Ubuntuタグが付けられた新着投稿 - Qiita motioneye for x64 install ubuntu20.04LTS https://qiita.com/ae86jr225kei/items/47ce862ffa3b75ba603f 2021-09-13 21:39:57
AWS AWSタグが付けられた新着投稿 - Qiita 【AWS Azure GCP】GCPの公式に各サービスの比較表があるじゃん https://qiita.com/taqro/items/fb9ad86ecedd135d2a93 awsazuregcp 2021-09-13 21:38:19
AWS AWSタグが付けられた新着投稿 - Qiita 【AWS Azure GCP】主要クラウドのAIサービス一覧と機能概要まとめ(2021年9月時点) https://qiita.com/taqro/items/dfd5d84fbadfd98f3ba9 Dataprep分析と機械学習に使用するデータを準備するためのサービス。 2021-09-13 21:37:32
GCP gcpタグが付けられた新着投稿 - Qiita 【AWS Azure GCP】GCPの公式に各サービスの比較表があるじゃん https://qiita.com/taqro/items/fb9ad86ecedd135d2a93 awsazuregcp 2021-09-13 21:38:19
GCP gcpタグが付けられた新着投稿 - Qiita 【AWS Azure GCP】主要クラウドのAIサービス一覧と機能概要まとめ(2021年9月時点) https://qiita.com/taqro/items/dfd5d84fbadfd98f3ba9 Dataprep分析と機械学習に使用するデータを準備するためのサービス。 2021-09-13 21:37:32
Azure Azureタグが付けられた新着投稿 - Qiita 【AWS Azure GCP】GCPの公式に各サービスの比較表があるじゃん https://qiita.com/taqro/items/fb9ad86ecedd135d2a93 awsazuregcp 2021-09-13 21:38:19
Azure Azureタグが付けられた新着投稿 - Qiita 【AWS Azure GCP】主要クラウドのAIサービス一覧と機能概要まとめ(2021年9月時点) https://qiita.com/taqro/items/dfd5d84fbadfd98f3ba9 Dataprep分析と機械学習に使用するデータを準備するためのサービス。 2021-09-13 21:37:32
Ruby Railsタグが付けられた新着投稿 - Qiita 【Rails】gemのアンインストールは、慎重に。 https://qiita.com/mihooo24/items/709a486c8925ed40a508 今回の場合だと該当プロジェクト内のGemfilelockに沿ってアンインストールが実行されていることになります。 2021-09-13 21:34:55
Ruby Railsタグが付けられた新着投稿 - Qiita view内でif文を用いた条件分岐のスマートな書き方[Ruby, Rails] https://qiita.com/koki0527/items/cd15a624f02b8989c397 view内でif文を用いた条件分岐のスマートな書き方RubyRailsはじめに今回の記事はとても局所的なテーマを扱いますRubyの構文において、以下のようなif文を用いた冗長的な書き方を、よりスマートにまとめますappviewsannouncementhtmlerbBeforeltthgt配信元ltthgtlttdgtltifannouncementuseridgtltannouncementusernamegtltelsegt管理者ltendgtlttdgt結論三項演算子を用いて、かつ文字列の部分はStringオブジェクトにしますAfterltthgt配信元ltthgtlttdgtltannouncementuseridannouncementusername管理者gtlttdgt想定状況announcementインスタンスはuserインスタンスに紐づく、もしくは紐づいていない、状況ですappmodelsuserrbclassUserltApplicationRecordhasmanyannouncementsdependentdestroyendappmodelsannouncementrbclassAnnouncementltApplicationRecordbelongstoclientoptionaltrueendポイント文字列の部分をStringクラスにしていること以下の場合、Encounteredasyntaxerrorwhilerenderingtemplateのエラーが発生し、失敗します。 2021-09-13 21:18:52
Ruby Railsタグが付けられた新着投稿 - Qiita 【Rails】bulletを使ってN + 1問題解決 https://qiita.com/kinoshitaken123/items/16c9e1e4b06a87d6be69 【Rails】bulletを使ってN問題解決N問題とはN問題とは、データベースからデータを取り出す際に、大量のSQLが発行されてパフォーマンスが低下してしまう問題のことです。 2021-09-13 21:08:39
Ruby Railsタグが付けられた新着投稿 - Qiita Rails6で、An error occurred while installing mysql2 (0.5.3), and Bundler cannot continue.が出た時、の対処 https://qiita.com/petertakahashi/items/474682d343ad05c8083a Railsで、AnerroroccurredwhileinstallingmysqlandBundlercannotcontinueが出た時、の対処Railsで、下記が出た時の対処AnerroroccurredwhileinstallingmysqlandBundlercannotcontinue下記を実行する。 2021-09-13 21:04:03
Ruby Railsタグが付けられた新着投稿 - Qiita エラー:Routing Error_Uninitialized constant HomesControllerにつまづいた話 https://qiita.com/keigo1401/items/700508fb1f838c6c07c2 public側はURLにpublicを表示しないという仕様のため、namespaceで指定しなければいいのかと思っていたのですが、コントローラアクションはちゃんとpublicフォルダ内のコントローラを使うよと設定してあげないといけなかったんですね。 2021-09-13 21:02:38
海外TECH Ars Technica Why is Dmitry Rogozin so thirsty for Elon Musk to visit Russia? https://arstechnica.com/?p=1792482 russia 2021-09-13 12:46:46
海外TECH Ars Technica Texas abortion ban prompts Salesforce to help employees, families “exit” state https://arstechnica.com/?p=1793991 salesforce 2021-09-13 12:22:12
海外TECH Ars Technica Deathloop game review: A dishonorable Bethesda discharge https://arstechnica.com/?p=1793897 execution 2021-09-13 12:01:51
海外TECH DEV Community I built the entire universe in JavaScript https://dev.to/jesuisundev/i-built-the-entire-universe-in-javascript-4i10 I built the entire universe in JavaScriptIt s not a clickbait title I really did it And it s not just a web experience No It s a real game freely explorable in D right in your browser Don t you believe me TLDRHo i know your time is precious Here s the condensed version I built a free D browser game freely explorable across infinite universes procedurally generated in JavaScript The goal Go from universe to universe and discover the origin of everything It s a four chapter story with an epic reveal at the end Before going further in reading this article stop everything put yourself in full screen take some popcorn and play ACROSS THE MULTIVERSE No time to play You prefer to enjoy it on a PC and not on a mobile phone Or do you just want to see more before playing it I got you I made a launch trailer on YouTube It s only minutes long It shows a lot of things But beware it s extremely spectacular I put a lot of my time my soul and my skills in the creation of this free game for the internet If you have five seconds to share it that would be wonderful Mehdi Zed jesuisundev LAUNCH TRAILERAcross The MultiverseA free in browser game across infinite universes procedurally generated Go from universe to universe and discover the origin of everything buff ly zqdI javascript threejs webgl webdev gamedevbuff ly nsPUKg AM Sep Meanwhile it s time to talk about the flashing elephant in the middle of the room How the fuck i did that Talk is cheap Show me the codeI know that many of you prefer to dive right into the code Even before reading my beautiful explanations And I totally understand this For the most impatient here is the full source code of the game jesuisundev acrossthemultiverse An in browser freely explorable D game across infinite universes procedurally generated Go from universe to universe and discover the origin of everything A four chapter story with an epic revelation at the end Across The MultiverseAn in browser freely explorable D game across infinite universes procedurally generatedGo from universe to universe and discover the origin of everythingA four chapter story with an epic revelation at the end A blog post explaining how everything works is available here LicenseSource CodeUnder MIT license MusicAll musics are owned by artists see list below and are used here underAttribution NonCommercial ShareAlike Unported CC BY NC SA licenseYou can t use the musics for commercial use and or without mentioning the following artistsTranscendent Joel NielsenI Walk With Ghosts Scott BuckleyDiscovery Scott BuckleyCelestial Scott BuckleyOmega Scott BuckleyInto the Night MelodysheepFootageUnder Attribution International CC BY You can use footage of the game for any use but you must mention this project with the following link Install… View on GitHubIt is of course open source under MIT license for the code I still recommend following the story of the project s gradual creation via this article It will give more context And most importantly make a lot more sense How to build the universe Before I even start you should know that I use the Three js JavaScript library This library allows you to use the WebGL api via JavaScript to do D rendering in the browser It It is possible that you don t understand the sentence before and or that you don t know Three js Fortunately I thought of everyone I made an article dedicated to Three js and D rendering in JavaScript This article will allow you to immediately understand the basis of the project in only minutes Anyway back to the point How to build the universe Clearly the problem is too big I couldn t tackle this problem head on And that s not how you do it when you re a developer There is only one reflex to have when faced with a huge and complex problem Reducing complexityBuilding the universe Too complicated I don t even know where to start Okay then let s narrow it down Building the Milky Way Still too complicated let s reduce it Building our solar system No It s too complicated Let s reduce it Building an empty space filled with stars Ha That sounds doable A simple starfield in the darkness of space Thinking about it a little bit I think this problem is really simple That means I ve reduced the complexity enough It s time to get started How to build a simple starfield From then on I always used a reference image A photo or a real representation of what I wanted to recreate An image to look at to get as close as possible to a realistic rendering For the starfield I had decided to take a picture from the Hubble satellite I figure I just need to display random white dots in a black space It is very easy Let s start by creating an empty black space and put a camera in it const scene new THREE Scene const renderer new THREE WebGLRenderer powerPreference high performance antialias false stencil false depth false renderer setSize window innerWidth window innerHeight renderer setClearColor xffffff renderer domElement id starfield document body appendChild renderer domElement const camera new THREE PerspectiveCamera window innerWidth window innerHeight camera position set camera lookAt function animate time renderer render scene camera requestAnimationFrame animate animate OKAY Great stuff All this to display a black screen Yes Let s be patient We have to start somewhere Now harder Let s display white dots randomly in this black space Can you do it I didn t know how So I look at to the documentation And i fount it There is a class dedicated to this Points Perfect let s follow the doc and write this down function getStarsGeometry const geometry new THREE BufferGeometry geometry setAttribute position new THREE FloatBufferAttribute getStarsRandomVertices return geometry function getStarsRandomVertices verticesNumber const vertices for let i i lt verticesNumber i const x Math random const y Math random const z Math random vertices push x y z return vertices function getStarsMaterial const starSprite new THREE TextureLoader load images star png const starMaterial new THREE PointsMaterial size sizeAttenuation true map starSprite alphaTest transparent true return starMaterial function getStars const stars new THREE Points getStarsGeometry getStarsMaterial return stars scene add getStars In this piece of code what will really do the magic is the getStarsRandomVertices function Our starfield here represented by new THREE Points needs two things The coordinates of each point to be displayed The material of each of the points That is to say what we will display to simplify for each of the points The coordinates are managed by getStarsRandomVertices Our camera is placed at coordinates We want stars all around us So our points should be placed between the coordinates and All around us To do this we will do a simple calculation Math random This very simple piece of math gives us a random value math random is not really random but let s admit it between and We put this calculation in each axis x y z and that s it The material is managed by getStarsMaterialNot much to say here We ll just use an image of a white circle as a texture and apply it For the moment we don t need much We put the two together in the getStars function and we have solved our problem Well for the moment it just gives an image with static white dots in D It s kind of lame We can do better It s time to iterate on this result Improvement via iterationLet s just start by bringing things to life The idea right now is to just move the camera in relation to the movement of the mouse When I did that I just wanted to make sure I was aware that I was doing D now Let s write this down document body addEventListener pointermove onPointerMove function onPointerMove event if event isPrimary false return mouseX event clientX windowHalfX mouseY event clientY windowHalfY function animate time renderer render scene camera camera position x mouseX camera position x camera position y mouseY camera position y requestAnimationFrame animate OK it s cool it moves it s D we are happy Now let s make it even more interactive What I d like to do is walk around in there Freely Like in an FPS game with the mouse and the keyboard At that point I had two choices Either I rewrote a whole FPS navigation system myself Either I took a FPS control class already made by Three js I obviously chose to use the code already done It is tested and used by many people I advise you to do the same thing when this situation happens to you Unless you are in a learning process there is no point in reinventing the wheel However the features offered by the module were not enough for me I wanted more I wanted a velocity system Give the players that feeling of acceleration and deceleration So I had to use the existing module and extend those possibilities in my own class OK let s write this down import PointerLockControls from PointerLockControls js import as THREE from three export default class Controls constructor camera parameters this parameters parameters this camera camera this pointerLockControls new PointerLockControls this camera document body this velocity new THREE Vector this direction new THREE Vector this moveForward false this moveBackward false this moveLeft false this moveRight false onKeyDown event if this pointerLockControls isLocked switch event code case ArrowUp case KeyW case KeyZ this moveForward true break case ArrowLeft case KeyA case KeyQ this moveLeft true break case ArrowDown case KeyS this moveBackward true break case ArrowRight case KeyD this moveRight true break onKeyUp event if this pointerLockControls isLocked switch event code case ArrowUp case KeyW case KeyZ this moveForward false break case ArrowLeft case KeyA case KeyQ this moveLeft false break case ArrowDown case KeyS this moveBackward false break case ArrowRight case KeyD this moveRight false break handleMovements timePerf prevTimePerf const delta timePerf prevTimePerf this direction z Number this moveForward Number this moveBackward this direction x Number this moveRight Number this moveLeft if this moveForward this moveBackward this velocity z this direction z this parameters controls velocity delta if this moveLeft this moveRight this velocity x this direction x this parameters controls velocity delta this pointerLockControls moveRight this velocity x delta this pointerLockControls moveForward this velocity z delta And just like that we built a starfield that can be explored like in a FPS Here you go I ll put a codesandbox you can play live in it You just have to click in the stars to switch to FPS mode Not bad right It s not bad But it s time to get down to business How to simulate infinity So far we have just placed dots around the player But all he has to do is move a little bit and he sees the trickery It s a bit lame again So how do we get this scaled How do you do it in a way that makes sense And above all how do you do it without blowing up the memory and or without going below FPS Now the real project begins The grid At that point I stopped touching my keyboard To code a solution for this kind of problem you can t “feel your way to it No You have to solve the problem conceptually on paper before doing anything Otherwise you are wasting your time And I hate wasting my time It s time to make drawings One of the first ideas that came to mind was the concept of a grid to represent space Concretely the space would be an infinite grid The player would go from square to square to see what it contains And in each square you put what you want Stars nebulae galaxies suns black holes whatever you want To better understand what I m talking about I ll draw you a little picture Solve the problemLet s start by representing our existing code Right now we have our player in the original square surrounded by stars If he moves away a little he is in complete darkness Conceptually it looks like this The little dude represents our player The blue stars represent the points already randomly placed around him The numbers in red are the coordinates of each square in space So far nothing complex And that s the goal I want to keep it simple at all costs It s complex to keep it simple Let s try to keep it simple in the algorithm for updating the grid We need two main functions The initialization function This function will create the material in the original square and in all the squares around the player The advantage of the initialization phase is that you can afford expensive actions As long as the player is not in a gameplay phase you are quite free Conceptually it looks like this The green stars represent the points dynamically created by the initialization functionThe update function This function will update the grid only when the player crosses the border between two squares With this function we want two things Delete the content of the squares which are too far from the playerCreate the content of the squares where the player is most likely to goConceptually it would look like this The blue stars represent the points already placedThe green stars represent the points we create dynamicallyThe red stars represent the points that are deletedAnd just like that we managed the infinity simulation The player can go anywhere he wants In the direction and the way he wants He will not see the trickery Wherever he goes there will be wonderful things to look at I like this solution because it has several advantages It is relatively efficientThe fact that the contents of the squares are created on the fly and above all that they are deleted at the same time relieves the memory a lot In addition only the minimum number of squares necessary is created each time We don t have to manage the player s directionNo matter which direction the player is going the algorithm will be the same Indeed we don t need to know what are the squares in front of the player We just want to know which squares around the player are empty So he can go in the direction he wants our algorithm will do exactly the same thing It s easy to manageNo need for a data structure straight from hell like a graph or a tree like an octree No no Fuck that leave me alone One array two hashmaps and that s enough No headaches Keep it simple Well let s write this down Coding the solutionWe are going to create this famous class which will manage the grid For the sake of length and simplification I don t explain everything And above all I don t show everything You have the full source code if you want to see everything We re just looking at the important parts today import MultiverseFactory from procedural MultiverseFactory export default class Grid constructor camera parameters scene library this camera camera this parameters parameters this scene scene this library library this activeClusters new Map this queueClusters new Map this multiverseFactory new MultiverseFactory this scene this library this parameters getCurrentClusterPosition const currentCameraPosition this getCurrentCameraPosition const xCoordinate Math trunc currentCameraPosition x this parameters grid clusterSize const yCoordinate Math trunc currentCameraPosition y this parameters grid clusterSize const zCoordinate Math trunc currentCameraPosition z this parameters grid clusterSize const currentClusterPosition xCoordinate yCoordinate zCoordinate return currentClusterPosition getCurrentCameraPosition this camera updateMatrixWorld return this camera position getClustersStatus currentCluster const clustersNeighbour this getNeighbourClusters currentCluster const clustersToPopulate this getEmptyClustersToPopulate clustersNeighbour const clustersToDispose this getPopulatedClustersToDispose clustersNeighbour currentCluster return clustersNeighbour clustersToPopulate clustersToDispose getNeighbourClusters currentCluster const neighbourClusters currentCluster const currentClusterArray currentCluster split const x currentClusterArray const y currentClusterArray const z currentClusterArray forward neighbourClusters push x y Number z backward neighbourClusters push x y Number z right neighbourClusters push Number x y z left neighbourClusters push Number x y z forward right neighbourClusters push Number x y Number z forward left neighbourClusters push Number x y Number z backward right neighbourClusters push Number x y Number z backward left neighbourClusters push Number x y Number z return neighbourClusters disposeClusters clustersToDispose for const clusterToDispose of clustersToDispose let matter this activeClusters get clusterToDispose matter dispose matter null this activeClusters delete clusterToDispose addMattersToClustersQueue matters type starfield subtype null for const clusterToPopulate of Object keys matters this queueClusters set clusterToPopulate type type subtype subtype data matters clusterToPopulate populateNewUniverse const clusterStatus this getClustersStatus this buildMatters clusterStatus clustersToPopulate renderMatters position cluster const matter this multiverseFactory createMatter cluster type matter generate cluster data position cluster subtype matter show this queueClusters delete position this activeClusters set position matter getEmptyClustersToPopulate neighbourClusters const emptyClustersToPopulate for const neighbourCluster of neighbourClusters if this activeClusters has neighbourCluster emptyClustersToPopulate push neighbourCluster return emptyClustersToPopulate getPopulatedClustersToDispose neighbourClusters currentCluster const populatedClustersToDispose for const activeClusterKey of this activeClusters keys if currentCluster activeClusterKey amp amp neighbourClusters includes activeClusterKey populatedClustersToDispose push activeClusterKey return populatedClustersToDispose And it works The contents of the boxes are added on the fly as the player approaches The illusion is almost perfect I say almost because unfortunately we have a big problem I know it doesn t show much in the video The performances when updating the grid are disastrous It freezes the image it s just disgusting and unplayable as is It is therefore time to diagnose and optimize Diagnose amp OptimizeWhen a performance problem occurs in an application the first reflex is to diagnose before doing anything DiagnoseIn the case of a web application like ours we will do this with the chrome dev tools F tab “Performance then CTRL E to record what happens Then we use the application normally before stopping the recording and analyzing the results By doing this I quickly understood what was going on We have big FPS drops because we try to do too many things at the same time We do too many things for JavaScript JavaScript being single threaded it is not forgiving Too much is required in too little time for a single thread Remember the simple calculation I told you about at the beginning Math random We do this times for each stars In one frame Multiply by for each axis x y x of the coordinates Again multiplied by for the three new squares that are created each time the player moves from square to square And right now we re just doing simple math for starfield When we ll create nebulae or galaxies later the math will be much more intensive It s expensive Very expensive So expensive that we exceed the limit of ms allowed per frame for a fluid image We go up to ms It blocks the event loop it freezes the image and it becomes unplayable If we leave it like that our player will also leave the game in ms OptimizeTo avoid this I have two solutions First we will free ourselves from the single thread limit of JavaScript We will do it using the Web Workers of the browser I m not going to do a lecture on this it s very well known and the MDN page is extremely well done to understand them Concretely we will send to Web Workers all the heavy calculations of the game These calculations will then be done in the background by the browser The goal is not to disturb our main thread It must be in charge of only one thing displaying things in a fluid way to the players Once the heavy calculations are done the Web Workers return the results in events Our main thread just has to display them in worker jsself onmessage messageEvent gt const heavyMath getHeavyMath self postMessage heavyMath function getHeavyMath const positions const colors heavy math to process positions and colors of particles return positions new FloatArray positions colors new FloatArray colors in main jsworker onmessage messageEvent gt this showData messageEvent data And just like that we divide the load by ten But that s not enough In order to have excellent performances we will relieve the event loop a little more Secondly we are going to spread out the display phases of the squares in time As it is the heavy calculations are well done in the web workers But it is very possible that the display of the three squares are requested at exactly the same time We want to avoid this to have a perfectly smooth image To do this we will use a little trick We will allow only one display of star fields at the same time via a boolean Then we will spread out in time the display phases of each square via a setTimeout This means that the display of each square will not be instantaneous It will be spaced out by ms One by one ms is huge in terms of relief for the event loop And it is imperceptible to the player Exactly what we need isRenderingClusterInProgress trueconst clusterTorender grid queueClusters keys next valuesetTimeout gt grid renderMatters clusterTorender grid queueClusters get clusterTorender isRenderingClusterInProgress false parameters global clusterRenderTimeOut Et voilà Infinite starfields in your browser Isn t life beautiful And the rest If you have played the game and or seen the trailer you can see that of the content is missing in this article Nebulae suns black holes red giants fucking wormholes between universes four different universes and the incredible finale Yes it is But this project is huge Too huge to be written about in one article A lot of articles at least four on the subject is coming We ll take a look at each of the topics to talk about them How to build Nebulae in JavaScript How to build Red Giant in JavaScript How to build Black Hole in JavaScript How to build Worm Hole in Javascript So stay tuned folks I m just getting started EpilogueIt was the biggest personal project I ve ever done It was incredible to do There were ups downs distress and wonder I ll let you enjoy the game I m not sure I ll be doing a project this big again anytime soon Please share it with others It would mean a lot to me I m going to get some sleep now 2021-09-13 12:31:20
海外TECH DEV Community Creating a Serverless application with Firebase https://dev.to/miketalbot/creating-a-serverless-application-with-firebase-5d31 Creating a Serverless application with Firebase TLDR If you ve been reading along you ll know I m building a widget to provide some fun interactions in blogging posts to support the C community In this article I cover building out the data model in Firebase using FireStore I ll touch on the security rules and the use of Cloud Functions to create an API MotivationI m describing the process of building the interactive widget below vote and see how other people are thinking about serverless RequirementsOur widget requires the following A user can create an account as a content creatorWith an account a user can provide a display name an avatar an HTML personal biography and a URL for their profile siteWith an account a user can create an article or a comment An article allows the user to specify the URL of one of their posts and have that tracked and enhanced by the widget Articles will be recommended on other instances of the widgetA comment allows the user to create a unique configuration of the widget that they can embed in comments or other parts of a postComments and articles allow the content creator to configure the widgets to be shownWhen a widget is shown the system will track the number of views and unique visiting users for that configurationWidgets are able to provide the reader with achievements and points for interacting with the contentWidgets may provide additional responsive and interactive capabilities that are used by plugin developers to create great experiences For instance performing polls or providing quizzes A robust and secure method of handling these responses will be provided by the widget framework ArchitectureI decided to build the widget backend framework using only Firebase I chose to use Firebase authentication Firestore as a database Firebase storage and Firebase Functions to provide an API I host the widget using Firebase Hosting Firebase AuthenticationAll users of the widget are signed in but unless you are a content creator then this is an anonymous login and its used to track your points and the answers you provide in responses to the plugins creating the widget experience Content creators sign in using Email Github or Google to create an account that is allowed to access the admin area of the website These users can create configurations of the widget to fit with the content they are creating FirestoreAll of the data is stored in Firestore a description of the choices of structure security and tables follows below Firestore is easy to use but can become rapidly costly as you pay for each read of data This has continually exceeded the free k limit on most days I ve published content using the widget I ll go into further detail about how I ve addressed this as best I could work out It s important to note that Firestore does not have any in built aggregation queries which is pretty limiting for a widget that desires to perform reporting Aggregations mostly have to be created by updating counters as the data is written reading volumes of data for reporting would become very expensive very quickly Firebase FunctionsThe Functions feature of Firebase allows you to create an API and also to create triggers that perform operations as data is updated I ve used both of these techniques to create the widget Firebase StorageI don t need to store much but I do allow users to upload an avatar and I store this in Firebase Storage in a file keyed by their user id That s all Firebase HostingThe widget framework is built as a React app it s deployed to Firebase Hosting which serves it for both the admin and the runtime interfaces There s not much to say here except that I ve used the rules to ensure that it works well as a SPA by writing every sub path to read index html firebase json hosting public build ignore firebase json node modules rewrites source destination index html Data ModelTo support the requirements I came up with this data model User Writable CollectionsAt the core of this model are the collections that a content creator can write to All of the other collections require a logged in user anonymous is fine and are read only IDsThere are only ID types used in the collections The articleId is generated by nanoid whenever a new article is added the user uid comes from Firebase Auth and the tag is a text string there are some special ones that start but otherwise they come from the user specification UsersThe user record generated by Firebase is also used to populate a record of my own in the userprofiles collection The data for displayName photoURL and email are copied across every time that they change In addition entries in this collection include a description for the biography and a profileURL to optionally contain somewhere to link to if the user s avatar is clicked when it is shown in the widget ArticlesA user can create articles Comments are articles with a comment field set to true The user can only create update and delete articles inside their own userarticles sub collection of articles When a userarticles article is saved a Firebase Function Trigger copies the record to the main articles table For security purposes it is possible for a system admin to ban an article in the main articles collection and the function ensures that this cannot be overwritten by the user In addition when a user deletes an article it is not deleted in the main collection but the enabled flag is set to false An article comprises some meta information about the original post if it isn t a comment so that this may be used to recommend the article when other users display the widget We ll look in detail at the trigger in a moment as it sanitizes all HTML contentcreates other entries in the counts and responses collections and keeps core field in these up to date Article Response informationWhen I first put together the data model I had the count information and the responses in a single collection however this proved costly as it caused all currently running instances of the widget to redraw whenever anyone viewed an article What I want to happen is when you are viewing the result of a poll if another user votes your screen immediately updates There is no point doing this update though if another user only saw the poll and didn t interact yet By separating out the counts and the responses I was able to significantly reduce the amount of reads and reduce the cost of the system Firebase has the excellent onSnapshot function to notify you of table writes in real time this provides for an exciting score update animation as you interact and the pleasure of watching the results of a poll change as others vote onSnapshot works with individual records and collections Below you can see the various tables that track interactions with an article The clouds show the Functions API calls that are writing to these tables CountsCounts contains a list of all of the unique visitor ids and uses this to track a unique visitor count in addition to a total number of views Counts does also contain a copy of the responseCount so that it can be reported to the content creator by reading a single record The trick to saving reads in Firebase is to synchronise data so that you can read it all back in one go ResponsesThe contents of the responses in the responses collection is down to the author of the plugin Only interactive plugins like polls and quizzes need to use these features The responses collection has a number of API calls that ensure the responses of individual users are kept separate providing a very robust way to interact Plugin authors use this data to render their user interfaces and update it using the respond and respondUnique methods tagsThe tags table is a collection of counters they are used to track the popularity of tags associated with articles and comments and to track other things like the total number of views for all C content managed by the widget Firebase has some pretty heavy limits on concurrency and write speed record update per second for this reason fast moving counters end up being sharded across a number of entries In the case of the widget we shard total views into separate keys and then add up the values in all to get the total answer A shard in this case is just a tag name with a random number between and added to the end of it User ScoresThe only other collection contains a score for the user It also contains a list of the achievements they have earned Scores are automatically awarded for viewing and interacting with content A plugin author may also add additional items based on their design for instance quizzes award points for correct answers  Enforcing SecurityA number of methods are used for enforcing security in the app An integration of App Check and Recaptcha v attempts to stop illegal calls to the API functions and a definition of the rules for Firestore access provides the way to stop a malicious user writing things that they shouldn t Firestore rules are applied in sequence the final rule bans all reads and writes rules version service cloud firestore match databases database documents match responses document allow read if request auth null allow write if false match counts document allow read if request auth null allow write if false match tags document allow read if request auth null allow write if false match articles document allow read if request auth null allow write if false match userarticles userId document allow read if request auth null allow update delete if request auth null amp amp request auth uid userId allow create if request auth null amp amp request auth uid userId match scores userId allow read if request auth null allow write if false match userprofiles userId allow read if request auth null allow update delete if request auth null amp amp request auth uid userId allow create if request auth null match document allow read write if false Cloud Functions do not have these rules applied and hence they can be used to write to the read only tables TriggersThe source code which is available on GitHub applies a number of trigger functions but the most interesting one is the creation or update of an article The Firestore Function onWrite is a catch all for create update and delete exports createArticle functions firestore document userarticles userId articles articleId onWrite async change context gt Here we say we want to run this function every time a user writes an article if change after exists const id change before data uid await db collection responses doc id set enabled false merge true await db collection counts doc id set enabled false merge true return If the after does not exist the record has been deleted we tell both the responses and the collection this information const data change after data sanitizeAll data data comment data comment false delete data banned await change after ref set data Here we are sanitizing the HTML and setting the comment flag null is not good enough for Firestore queries as a false it must be explicit We also don t allow the incoming record to change the banned property of the master article The last line above writes the data back into the users copy of the record await db collection articles doc data uid set data merge true This is now writing the master article record Next we setup the response and count or update them if they already exist const responseRef db collection responses doc data uid const responseSnap await responseRef get if responseSnap exists await responseRef set processedTags data processedTags author data author enabled data enabled comment data comment false merge true else await responseRef set types enabled data enabled created Date now author data author comment data comment false responses processedTags data processedTags const countRef db collection counts doc data uid const countSnap await countRef get if countSnap exists await countRef set processedTags data processedTags author data author enabled data enabled comment data comment false merge true else await countRef set enabled data enabled created Date now author data author visits comment data comment false uniqueVisits lastUniqueVisit lastUniqueDay recommends clicks processedTags data processedTags ConclusionFirebase turned out to be flexible enough to build the widget but it is very limited on reporting and has to be carefully watched to avoid costs associated with reading lots of data The article recommendation will feature next time but this was a serious cause of read usage 2021-09-13 12:26:53
海外TECH DEV Community How to get an attribute value in Angular's components and directives https://dev.to/shhdharmen/how-to-get-an-attribute-value-in-angular-s-components-and-directives-4b0c How to get an attribute value in Angular x s components and directivesIn this tutorial we will explore all the ways to read HTML attribute values passed in the component or directive Reading HTML AttributesElements in HTML have attributes these are additional values that configure the elements or adjust their behavior in various ways to meet the criteria the users want MDN DocsFor example lt input type text gt lt td colspan gt lt td gt type and colspan are some examples of HTML attributes In some cases you need to handle the behaviour of a component or directive based on a value set for the HTML attribute For example there is a component called smart input You want to render different layouts for different types passed as values to the HTML attribute lt should render UI for text gt lt smart input type text gt lt smart input gt lt should render UI for number gt lt smart input type number gt lt smart input gt ElementRef ClassOne way to read such attribute values is through ElementRef import Component ElementRef from angular core Component selector smart input template lt div ngSwitch type gt lt input type text ngSwitchCase text gt lt input type number ngSwitchCase number gt lt p ngSwitchDefault gt Unsupported type type lt p gt lt div gt export class SmartInputComponent type string constructor private elementRef ElementRef this type this elementRef nativeElement getAttribute type Above is fine and works as expected But there is a shorter way available for the above in Angular The Attribute Parameter DecoratorYou can use the Attribute parameter decorator to pass the value of the HTML attribute to the component or directive constructor through dependency injection So for an earlier example to read the type attribute we will do something like below import Attribute Component from angular core Component selector smart input template export class SmartInputComponent constructor Attribute type public type string With the above code smart input will render lt input type text gt for lt smart input type text gt lt smart input gt lt input type number gt for lt smart input type number gt lt smart input gt Usage with providers Attribute decorator can also be used in deps when making a FactoryProvider So for smart input we can also write our code like below import Component Inject InjectionToken Attribute from angular core export const TOKEN new InjectionToken lt string gt TypeAttribute export function factory token string string return token Component selector smart input template providers provide TOKEN deps new Attribute type useFactory factory export class SmartInputComponent constructor Inject TOKEN readonly type string Usage in other built in directivesThis decorator is also used by few built in directives RouterLink reads tabindexRouterOutlet reads namengPluralCase reads self value LimitationsBelow are two limitations of using Attribute decorator It only works with static HTML attribute values It doesn t work with attribute binding and property binding As it only works with static values only string type is supported To overcome the above limitations we can use Input decorator The Input Property Decorator Input is a property decorator used in the child component or directive which signifies that property can receive its value from the parent component So for the above example we can rewrite it as below Component selector smart input template export class SmartInputComponent Input type string Above works fine And unlike Attribute this supports all data types and if you use property binding or text interpolation it also tracks changes to the values Also note that Input works with static and dynamic both bindings Usage in other built in directivesThis decorator is also used by many built in directives Below are a couple of examples ngClass to read self valuengStyle to read self value LimitationThe only limitation of using Input decorator is that it s value is available only after component or directive is initialized i e in ngOnInit life cycle hook ElementRef Attribute vs Input We learned three ways to read type s value for oursmart input component how they re used in some built in directives and limitations Let s look at the major differences again AvailabilityElementRef and Attribute makes attribute s value available in constructor through dependency injection Input makes the value available after component directive initialization i e in the ngOnInit life cycle hook Type supportElementRef and Attribute supports only string Input supports all types Value updatesElementRef and Attribute don t track value update Input tracks value updates if property binding or text interpolation is used General usageAs ElementRef and Attribute supports only string type they are generally used to read static HTML attribute s valueAs Input supports all types and it also tracks updates it is generally used to read DOM property or custom data passed to the component directive ConclusionWe learned how to read the HTML attribute value in a component or directive using the ElementRef class Attribute and Input decorators We also learned their usages how they re used in some built in directives and limitations I have created a stackblitz for all of the code above 2021-09-13 12:21:06
海外TECH DEV Community 7 Microservices Best Practices for Developers https://dev.to/mbogan/7-microservices-best-practices-for-developers-ec5 Microservices Best Practices for DevelopersUnless you ve been developing software in a cave you ve probably heard people sing the praises of microservices They re agile simple and an overall improvement on the monolith and service oriented architecture days But of course with all the benefits of microservices comes a new set of challenges In this article we ll look at some microservices best practices Plus we ll suggest a few proven ways to help you design orchestrate and secure your microservices architecture By understanding these practices you ll have a head start on a successful project Benefits and Challenges of MicroservicesBefore we dive into microservices best practices however we should first talk about some of the benefits and challenges of microservices and why you would want to use them in the first place Briefly microservices are an improved software architecture that allow you to Deploy and scale faster Smaller application domain responsibility allows for automation leading to faster deployments and faster scaling Reduce downtime Limit the impact that one unavailable service has on your primary business function improving your overall business uptime Ensure availability Keep functionality between microservices discrete limiting the impact when an instance goes down Of course with these benefits we have a new set of challenges including inter service communication security and scalability Inter service communication With a monolithic application all of the modules can inherently talk to one another You have one certificate to manage and once a request is authenticated and authorized it can traverse the code paths without issue When you extract a function out of the monolith architecture to a microservices application what was once an internal function call becomes an external API call requiring authentication and authorization for that outside microservice Security layer Authentication and authorization in the monolith application can be handled one time at the point of entry With the transition to microservices every microservice needs to perform some authentication and authorization to enforce access controls It s not realistic to ask users to log in every time they use a different microservice so a comprehensive auth strategy needs to be established Scalability Although microservices allow you to scale independent functionality quickly doing so effectively requires good app management and even better tooling The effectiveness of your scalability hinges on your microservice orchestration platform which we ll talk about in more detail below Microservices Best PracticesWith that quick overview of the benefits and challenges of microservices let s now dive into some best practices These best practices will help you create a robust easy to manage scalable and secure system of intercommunicating microservices Small Application DomainAdopting a microservices strategy requires embracing the single responsibility principle By limiting the scope of responsibility for any single service we limit the negative impact of that service failing If a single microservice is responsible for too much its failure or unavailability will have a domino effect on the rest of the system A micro service should be just that micro Keep the app domain of your microservices small dedicated to one logical functionality This will reduce the impact that a given microservice has if any issues arise In addition smaller services are simpler to maintain The result is easier updating and faster development What does this look like in practice For example let s assume that our microservice is an API server that accepts requests to fetch data and an authorization token must accompany those requests When you re just starting this is the only microservice that requires an authorization token Why not just make authentication and token generation part of the microservice At first glance the advantage is fewer moving parts less to manage Of course there will come a day when you ll have other services that require an authorization token You ll soon find your original microservice functioning as an API server and an authentication server If your API server goes down then your authentication server goes down with it With that so does every other service that requires an authorization token Be considerate of your future self keep your microservices small Separation of Data StorageMultiple microservices connecting to the same database are still in essence a monolithic architecture The monolith is just at the database layer instead of the application layer making it just as fragile Each microservice should have as much as possible its own data persistence layer This not only ensures isolation from other microservices but also minimizes the blast radius if that particular data set were to become unavailable At times it might seem to make sense for different microservices to access data in the same database However a deeper examination might reveal that one microservice only works with a subset of database tables while the other microservice only works with a completely different subset of tables If the two subsets of data are completely orthogonal this would be a good case for separating the database into separate services This way a single service depends on its dedicated data store and that data store s failure will not impact any service besides that one We could make an analogous case for file stores When adopting a microservices architecture there s no requirement for separate microservices to use the same file storage service Unless there s an actual overlap of files separate microservices ought to have separate file stores With this separation of data comes an increase in flexibility For example let s assume we had two microservices both sharing the same file storage service with a cloud provider One microservice regularly touches numerous assets but is small in file size The other microservice has only a few files that it touches periodically but those files are hundreds of gigabytes in size Using a common file store service for both microservices makes you less flexible to optimize costs since you have a mix of large and small files and a mix of regular and periodic access If each microservice had its own data persistence layerーand that could be a separate microservice of courseーthen you d have more flexibility to find the provider or service that best fits the needs of that individual microservice Cost optimization the flexibility of options and less dependence on a single solution that could failーthese are all reasons to separate the data of different microservices Communication ChannelsHow microservices communicate with one anotherーin particular regarding events of interestーrequires thoughtful consideration Otherwise a single unavailable service can lead to a communication breakdown that collapses an entire application Imagine a system of microservices for an online store One microservice takes orders placed by a website Another microservice sends a text notification to the customer that it received their order Another microservice notifies the warehouse to send out the product Finally another microservice updates inventory counts There are two types of communication between microservices synchronous and asynchronous If we approach the above example using synchronous communication a web server might process a new order by first sending a request to the customer notification service After the customer notification service responds the web server sends a request to the warehouse notification service and again it waits for a response Last the web server sends a request to the inventory updater Our synchronous approach would look like this Synchronous communication between microservicesOf course suppose the customer notification service happened to be down In that case the request to notify the customer might timeout or return an error or perhaps leave the web server waiting for a response indefinitely The warehouse notification service might never get the request to fulfill the shipment Synchronous communication between microservices can create a dependency chain that breaks if any link in the chain breaks In asynchronous communication a service sends a request and continues its life without waiting for a response In one possible asynchronous approach the web server might send the notify customer request and then complete its task The customer notification service is responsible for notifying the customer and sending an asynchronous request to the warehouse notification service which is responsible for sending a request to the inventory updater service It might look like this Chained asynchronous communication between microservicesIn this model of course we see that asynchronous communication can still result in a chain dependency and the failure of a single service would still disrupt the application A simple but effective approach to asynchronous communication is to adopt the publish subscribe pattern When an event of interest occurs the producerーin this case the microserviceーpublishes a record of that event to a message queue service Any other microservices interested in that type of event subscribe to the message queue service as consumers of that event Microservices only talk to and listen to the message queue service not each other For our example it might look like this Asynchronous communication facilitated by a message queue serviceThe message queue is a separate service of its own decoupled from all of the microservices It is in charge of receiving published events and notifying subscribers of those events This ensures that the failure of one microservice which might mean delayed delivery of a message has minimal impact on other related but unconcerned services There are many tools to accomplish this kind of asynchronous communication for example Kafka or RabbitMQ Look for ways to integrate tools like these as asynchronous communication backbones for your microservices There are cases when synchronous communication between microservices is necessary Most request response interactions are out of necessity synchronous For example an API server querying a database must wait for the query response a web server fetching cached data must wait for the key value store to respond When synchronous communication is needed you ll want to use the open source Kong Gateway to ensure that your communication is routed quickly and reliably to the right microservices CompatibilityAs much as possible maintain backward compatibility so your consumers don t encounter broken APIs The popular way to do this is by following path level compatibility guarantees like api v or api v Any backward incompatible changes go to a new path like api v However despite our best efforts as software engineers sometimes we need to deprecate APIs so we re not stuck running them forever With the API gateway request transformation plugin your microservices can alert your API consumers by easily injecting deprecation notices alongside the original API response or attaching a “deprecation header similar to Kubernetes Orchestrating MicroservicesOrchestration of your microservices is a key factor of success in both process and tooling Technically you could use something like systemd and Docker or podman to run containers on a virtual machine but that doesn t provide the same level of resiliency as a container orchestration platform This negatively affects the uptime and availability benefits that come with adopting a microservices architecture For effective microservice orchestration you ll want to rely on a battle tested container orchestration platform and the clear leader in that field is Kubernetes Kubernetes manages all of your containers provisioning and deployment while handling load balancing scaling replica sets for high availability and network communication concerns You might deploy bare Kubernetes on premises or you might go with a cloud distribution like Azure Kubernetes Service Red Hat OpenShift or Amazon Elastic Kubernetes Service The built in scheduling replication and networking capabilities of Kubernetes make microservice orchestration much easier than on a traditional operating system Couple Kubernetes with Kuma service mesh and Kong Ingress Controller and you have microservices that are discoverable monitored and resilientーlike magic Microservices SecurityAs your application comprises more and more microservices ensuring proper security can become a complicated beast A centralized system for enforcing security policies is vital to protecting your overall application from malicious users invasive bots and faulty code Kong ought to be the start of your security story with microservices whether you re running on VMs or in Kubernetes The abundance of Kong maintained security plugins makes it easy to address some of the most common needs for microservices including authentication authorization traffic control and rate limiting Example Rate Limiting with Kong Ingress ControllerTo demonstrate an example of a security plugin at work we ll deploy Kong s Rate Limiting plugin to show how Kong can prevent excessive inbound requests to your applications We ll create a local Kubernetes cluster with kind and then deploy the Kong Ingress Controller by following these instructions After creating a cluster and deploying the Kong Ingress Controller our first step is to set up the Rate Limiting plugin There are different scopes for which you can set up the plugin We ll use the default project on our Kubernetes cluster for our use case and scope the plugin to that default namespace echo apiVersion configuration konghq com vkind KongPluginmetadata name rate limiting example namespace defaultconfig second hour policy localplugin rate limiting kubectl apply f kongplugin configuration konghq com rate limiting example createdNow we ll create an “echo service and an ingress for the service In this case we re borrowing the example from Kong s Getting Started with Kubernetes Ingress Controller documentation kubectl apply f service echo createddeployment apps echo created echo apiVersion extensions vbetakind Ingressmetadata name demo annotations kubernetes io ingress class kong konghq com plugins rate limiting examplespec rules http paths path foo backend serviceName echo servicePort kubectl apply f The last thing we need to do is test We ll borrow the shell demo from the Kubernetes documentation for in cluster testing kubectl apply f n defaultBefore getting into our shell pod we ll need the cluster IP of kong proxy kubectl get svc kong proxy n kong o jsonpath spec clusterIP Now we can get shell access to our pod and test the rate limiting kubectl exec stdin tty shell demo bin bash curl I fooHTTP OKContent Type text plain charset UTF Connection keep aliveX RateLimit Limit Second X RateLimit Remaining Hour X RateLimit Limit Hour RateLimit Reset RateLimit Remaining RateLimit Limit X RateLimit Remaining Second Date Sat Jul GMTServer echoserverX Kong Upstream Latency X Kong Proxy Latency Via kong The additional step of using an intermediary pod to test the rate limiting won t be necessary for most cloud providers which gives you a load balancer out of the box In this case since we re using kind there s no load balancer provisioned so our test comes from within the cluster This same test would work externally if a load balancer were available Rate limiting is just one example of where Kong fits into the security concerns of your overall microservices strategy and best practices but can easily provide a fully comprehensive solution Kong maintains several plugins and products to keep your communication channels bulletproof API change impact minimal and your application domains manageable Plus it s compatible with most programming languages and vendor options Metrics and MonitoringAn architecture built on microservices can lead to massive scaling of hundreds or thousands of small modular services While that yields huge potential for increased speed availability and reach a sprawling system of microservices requires a strategic and systematic approach to monitoring By keeping an eye on all of your microservices you ll ensure that they are functioning as they ought to are available to your users and are using resources appropriately When any of these expectations are not met you can respond by taking proper action Fortunately you don t need to reinvent the wheel when it comes to monitoring There are several widely adopted monitoring solutions that can integrate seamlessly within your infrastructure Some solutions use metrics exporter SDKs which can be integrated by adding one or two lines of code in your microservice Others can be integrated with your API gateway or service mesh as a plugin for monitoring networking concerns and resource usage As your monitoring tools gather metrics those metrics can be consumed by visualization toolsーbeautiful dashboards that help you see the numbers behind your microservices How many users were online last Thursday at PM How much has CPU load increased since we released that new feature What s the latency between our product shipping API and the invoicing API By monitoring your microservices and having your hard numbers presented clearly you re equipped to make informed decisions about how to keep your microservices healthy and available As you do that you ll keep your users happy Don t Forget Your Lap Bar Microservices are a wild ride You start with the incredible benefits of speedier deployment and scalability reduced downtime and overall improvement of your business availability Then you throw in your orchestration platform along with some best practices powered by Kong and its plugins and boom You have a symphony of packets flowing to and fro between your microservices that are secure reliable and bulletproof We ve only covered a small subset of what Kong can do so I d highly recommend checking out Kong Hub to see all the functionality available to ease your journey to microservice nirvana 2021-09-13 12:21:05
Apple AppleInsider - Frontpage News Apple's colorful iPhone 13 cases surface one day before launch https://appleinsider.com/articles/21/09/13/eight-colorful-iphone-13-cases-surface-one-day-before-launch?utm_medium=rss Apple x s colorful iPhone cases surface one day before launchApple will seemingly introduce cases in at least eight different colors according to a leaker with photographs showing the variety of silicone cases that will be arriving alongside the iPhone iPhone silicone cases via MajinbuOfficial Twitter Apple is anticipated to launch the iPhone lineup during its California Streaming special event on Tuesday among other product introductions Along with a new smartphone Apple is also expected to bring out accessories to match Read more 2021-09-13 12:58:24
Apple AppleInsider - Frontpage News Apple releases extended 'The Morning Show' promo video https://appleinsider.com/articles/21/09/13/apple-releases-extended-the-morning-show-promo-video?utm_medium=rss Apple releases extended x The Morning Show x promo videoThe cast and crew of The Morning Show are featured in a new Apple TV video discussing the drama s forthcoming second season L R Jennifer Aniston Billy Crudup and Reese Witherspoon in The Morning Show season twoAhead of its second season launch on Friday September The Morning Show is the subject of an extended four minute roundup of interviews with stars including Jennifer Aniston and writer Kerry Ehrin Read more 2021-09-13 12:47:37
Apple AppleInsider - Frontpage News iPhone 13, Apple Watch Series 7 to feature in first of two Apple events https://appleinsider.com/articles/21/09/12/iphone-13-apple-watch-series-7-to-feature-in-first-of-two-apple-events?utm_medium=rss iPhone Apple Watch Series to feature in first of two Apple eventsApple s fall product launches are likely to be spread across two events with one source claiming the first will just be for the iPhone and Apple Watch Series Apple will be holding its California Streaming special event on Tuesday with the iPhone widely expected to be one of the chief products launched at that time While rumors have suggested there could be more than one event it seems that there will be two in Earlier on Sunday Mark Gurman said in his newsletter there would be a wait of several weeks for the inch MacBook Pro and inch MacBook Pro to arrive On Twitter Gurman clarified the newsletter comment Read more 2021-09-13 12:01:53
海外TECH Engadget 'Deathloop' is an exhilarating, innovative, time-bending mess https://www.engadget.com/deathloop-review-ps5-arkane-120139958.html?src=rss x Deathloop x is an exhilarating innovative time bending messDeathloop is the coolest escape room I ve ever experienced That may not sound like much considering plenty of escape rooms are cheesy monuments to corporate team building exercises and gentrification but I mean it as a compliment Deathloop uses the fundamentals of old school locked room mysteries to deliver a rich and stylish universe driven by intrigue action and strategy The main difference between Deathloop and an actual escape room is well all the death Unsurprisingly there s a fair amount of dying in Deathloop Dying is a core mechanic of the game and it s the first thing players actually do in the campaign called Break the Loop The opening scene has Colt the main character on his back with a murderous woman called Julianna sitting on top of him pressing a massive blade to his chest After some banter she plunges the knife into Colt s heart and he sputters and dies BethesdaAnd then the game begins Colt awakens on a cold empty beach littered with bottles and he makes his way to a compound built into the side of the sea wall As he walks glowing words appear around the environment as if a loved one is leaving words of encouragement and warning for him Colt is confused ーhe doesn t even know his own name at this point let alone how he got here or who s trying to talk to him The identity of the message writer is just one of a dozen or so core mysteries in Deathloop and these are the driving force of the campaign Colt s job is to explore Blackreef the island where he s been trapped in an infinite respawn cycle and learn as much about its leaders and technology as possible in order to burn it all down Blackreef is a retrofuturistic bubble populated by residents who split their time between partying and violently defending their consequence free way of life and Colt can either sneak or shoot his way through their ranks In action Deathloop feels a lot like Dishonored nbsp of course with a chaser of We Happy Few and Quadrilateral Cowboy It s mechanically mature and narratively dense but best of all it doesn t take itself too seriously BethesdaDeathloop is one of the few first person action games that I can successfully play in stealth mode silently taking down enemies hacking turrets and sniping from the rooftops in order to stay alive Usually with games like this ーI m thinking Deus Ex and Far Cry ーI intend to play stealthily but it doesn t work out I get too close to an enemy or miss my headshot or forget about that security camera and I end up just throwing a grenade and emptying my magazine recklessly running into danger Deathloop invites the kind of stealth that I can sustain The environments are endlessly climbable offering plenty of vantage points for Colt to survey and mark his enemies tracking their movements and revealing the kinds of weapons they re carrying If something in Deathloop looks scalable it likely is opening up the game world in all directions Additionally if I accidentally alert the enemies in one location I don t feel like I have to abandon my plans and roll in guns blazing Generally speaking I can find some cover pick off the folks that follow me and return to the rest of the mission in stealth mode My favorite weapons in these moments are the Tribunal and the PT Spiker both of which are silent and deliver instant kill headshots I d like to blame the success of Deathloop s stealth mechanics on my own skills or the masterful sense of level design coming out of Arkane Studios but it might just be the game s hit or miss AI There are times it feels too easy to sneak up on enemies and moments when they fail to react appropriately to Colt s presence standing still for seconds too long piling up in hallways or ignoring nearby scuffles It s not every encounter and there are still plenty of moments when I m bested by the NPCs but it s enough that I d classify the enemy AI in Deathloop as OK rather than good Along his way Colt picks up a variety of weapons and ultra high tech artifacts that grant him special abilities and perks There are Trinkets which are small glowing items that enhance whatever gun they re attached to and Slabs which give Colt ーand his enemies ーsuperhuman powers like invisibility telekinesis and short distance teleportation Once collected the Slabs are swappable in Colt s loadout and they tend to be tons of fun Blackreef is controlled by eight Visionaries of the AEON Program one of whom is Julianna and the only way to escape the island is for Colt to kill them all in a single day breaking the loop However it s not as simple as speedrunning through Blackreef in order to take them all out Colt has deep ties to the AEON Program and the Visionaries all keep their own schedules meaning a successful assassination run will require hours of information gathering and strategizing And it turns out dying Once he gets going Colt is able to die twice during any playthrough with few consequences he s simply transported to a previous location and allowed to keep going health restored On the third death however he s sent back to that bottle lined beach resources depleted He also loses his gear after a full day of activity regardless of progress Deathloop is divided into four times ーmorning noon afternoon and night ーand after each complete sequence Colt is beached Certain missions can only be completed at specific times of day so players have to plan their attacks accordingly either shifting time forward or simply delaying until the next loop BethesdaEventually Colt gains the ability to carry some slabs trinkets and weapons with him between loops though he has to infuse the items he wants to keep with a resource called Residiuum Colt can harvest Residiuum from the shiny glitched out objects in Blackreef or by killing visionaries and absorbing their energy Residiuum can then be applied to specific items in Colt s kit holding them for good With all of these trinkets slabs weapons Residiuum visionaries and loops there s a lot to keep tabs on in Deathlooop The amount of stuff in the game is overwhelming at times and it s complicated by an intense plot filled with overlapping time bending mysteries Small scraps of paper and brief audio recordings often contain crucial bits of information rewarding players who obsessively explore every bookshelf desk and dead end with reams of notes and leads The game does a good job of organizing all of these details in the resource management screen but overall Deathloop demands full and complete attention lest you completely lose the plot For those who pay attention the story and environment of Blackreef unravels beautifully with important secrets hidden in plain view and new parts of the world opening and closing depending on the time of day From this perspective the density of things to collect use and learn in Deathloop makes perfect sense This game is built on the idea of replaying the same four maps again and again ーColt needs something new to do every time BethesdaJulianna is a charming constant in Deathloop generally talking shit and fleshing out the background of Blackreef She s also the star of the game s second mode Protect the Loop Here players are able to invade the games of friends or strangers playing as Julianna and hunting down Colt as he tries to complete a mission She has her own loadout trinkets and slabs including a masquerade ability that lets her trade appearances with allied NPCs ーmeaning everyone except Colt Protect the Loop is marked by long periods of silence and inactivity followed by furious gunfire and death Colt can take any route he wants through the various maps and Julianna has to actively hunt him down or wait for him to appear near the objective She may be able to disguise herself but she only has one life while Colt has to die three times to make it final This results in a delicious cat and mouse game that s different with each new player That said Protect the Loop is also where I ve encountered the most technical issues I played on PS and one round crashed fully right after launching while two more were completely unplayable from my end repeatedly setting my Julianna back a few frames until Colt finally showed up and shot her That s in comparison with four glitch free rounds My recommendation here is to use an ethernet cable rather than Wi Fi and make sure your friends do too Deathloop is incredibly dense but it s also inherently forgiving Relying on death as a mechanic in Break the Loop takes the sting out of failing a cycle or two since retrying is built into the narrative Colt uncovers helpful information in most of his runs even when he ends up dead ーlike dead dead ーand it feels like there s always something new to uncover in Blackreef no matter how many times he returns to the same location If it does ever get old there s always the option to Protect the Loop And then Break the Loop And then Protect the Loop And then Break the Loop You get the idea 2021-09-13 12:01:39
Cisco Cisco Blog Celebrating excellence in advocacy and innovation https://blogs.cisco.com/customerspotlight/celebrating-excellence-in-advocacy-and-innovation november 2021-09-13 12:39:36
金融 金融庁ホームページ 第47回金融審議会総会・第35回金融分科会合同会合の諮問事項について公表しました。 https://www.fsa.go.jp/singi/singi_kinyu/soukai/siryou/2021_0913.html 金融審議会 2021-09-13 13:00:00
ニュース BBC News - Home M25 junctions blocked by Insulate Britain campaigners https://www.bbc.co.uk/news/uk-england-beds-bucks-herts-58543603?at_medium=RSS&at_campaign=KARANGA britain 2021-09-13 12:41:56
ニュース BBC News - Home Apple iPhone risk from powerful motorbike vibrations https://www.bbc.co.uk/news/technology-58507764?at_medium=RSS&at_campaign=KARANGA apple 2021-09-13 12:02:35
ニュース BBC News - Home Afghanistan: UN seeks millions in international aid https://www.bbc.co.uk/news/world-asia-58542451?at_medium=RSS&at_campaign=KARANGA taliban 2021-09-13 12:55:34
ニュース BBC News - Home Emma Raducanu set to earn millions after US Open win https://www.bbc.co.uk/news/business-58508806?at_medium=RSS&at_campaign=KARANGA experts 2021-09-13 12:15:51
ニュース BBC News - Home Raikkonen fit to return for Russian Grand Prix https://www.bbc.co.uk/sport/formula1/58544615?at_medium=RSS&at_campaign=KARANGA raikkonen 2021-09-13 12:39:28
北海道 北海道新聞 バレー男子、日本は開幕2連勝 アジア選手権 https://www.hokkaido-np.co.jp/article/588801/ 開幕 2021-09-13 21:04:05
北海道 北海道新聞 後志管内の感染者ゼロ 13日 https://www.hokkaido-np.co.jp/article/588808/ 新型コロナウイルス 2021-09-13 21:14:00
北海道 北海道新聞 濃厚ワインへ 仕込み開始 はこだてわいん、高品質に期待 https://www.hokkaido-np.co.jp/article/588804/ 高品質 2021-09-13 21:10:00
北海道 北海道新聞 コロナ禍 変わる道南の結婚式 貸別荘で少人数 披露宴を来年に https://www.hokkaido-np.co.jp/article/588803/ 新型コロナウイルス 2021-09-13 21:09:00
仮想通貨 BITPRESS(ビットプレス) [日経] NFT熱狂、著名ブランドに波及 価格高騰に危うさ https://bitpress.jp/count2/3_9_12770 高騰 2021-09-13 21:57:06

コメント

このブログの人気の投稿

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