投稿時間:2021-05-29 03:18:07 RSSフィード2021-05-29 03:00 分まとめ(18件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
AWS AWS Safely Grant Access to Your Authorized Users, Expected Network Locations, and AWS Services Together https://www.youtube.com/watch?v=gv-_H8a42G4 Safely Grant Access to Your Authorized Users Expected Network Locations and AWS Services TogetherHow you can use the new aws PrincipalIsAWSService global condition key to Safely grant access to your authorized users expected network locations and AWS services together Learn more about AWS at Subscribe More AWS videos More AWS events videos AWS 2021-05-28 17:03:12
js JavaScriptタグが付けられた新着投稿 - Qiita CesiumJS Getting Started (Build a Flight Tracker)のフォロー https://qiita.com/XPT60/items/89943ff9235917f1cbdd CesiumWorldTerrain解像度mのデータCesiumOSMBuildingsOpenStreetMapのデータBingMapsAerialImagery解像度cmの衛星画像StepStepのときにあったindexhtmlのconstviewerの部分をコメントアウトして、stepのコードをペーストします。 2021-05-29 02:34:08
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) 編集画面でパスワード未入力の場合はバリデーションエラーが出ないようにしたい https://teratail.com/questions/340939?rss=all 編集画面でパスワード未入力の場合はバリデーションエラーが出ないようにしたいSpringnbspBootで編集画面を作成しています。 2021-05-29 02:51:52
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) 正規表現のコード内容を説明して頂きたいです https://teratail.com/questions/340938?rss=all 正規表現のコード内容を説明して頂きたいです下記のコードについて、制御文字のチェックをしているのは分かったのですが、具体的な内容の理解がうまくできてませんつまりこのコードはどう言った挙動をするのか解説して頂けると助かります。 2021-05-29 02:38:33
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) ps1ファイルをShift-Jisで開きたい(VScode) https://teratail.com/questions/340937?rss=all psファイルをShiftJisで開きたいVScodeVisualnbspStudionbspCodenbspにてPowerShellファイルpsファイルを編集しているのですが、開くときに毎回Windowsという文字コードで開かれてしまいますCtrlnbspnbspShiftnbspnbspPnbsp「changenbspfilenbspEncoding」でSjisにして保存しても次に開くときには、Windowsで開かれてしまいます。 2021-05-29 02:16:56
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) 正規表現の記述に変数を展開できない https://teratail.com/questions/340936?rss=all 2021-05-29 02:14:18
海外TECH Ars Technica Google Photos wants money: Stricter storage limitations kick in next week https://arstechnica.com/?p=1768431 google 2021-05-28 17:12:22
海外TECH DEV Community What was your win this week? https://dev.to/devteam/what-was-your-win-this-week-2ei4 What was your win this week Hey there Looking back on your week what was something you re proud of All wins count ーbig or small Examples of wins include Starting a new projectFixing a tricky bugGoing on a walk with a friend or whatever else might spark joy ️Happy Friday 2021-05-28 17:49:47
海外TECH DEV Community Redux: Beginner's guide https://dev.to/ericchapman/redux-beginner-s-guide-208 Redux Beginner x s guideYour app is getting more and more complex Over time your React application becomes more complex with more app components and more data going in and out of it Managing multiple simultaneous components and sub components state can become very complex Is there a better way to manage all yours app components and sub components state Yes and that library is name Redux What is ReduxRedux is the most popular state management solution As of today Redux is the standard adopt by big company Redux is making use of a redux store such that the entire application is handled by one state object Here are Redux three core principles The state of your whole application is stored in an object tree within a single store that act as the single source of truth for your app Ensure the application state is read only and requires changes to be made by emitting a descriptive action To specify how the state tree is transformed by actions you write pure reducer functions The entire state of your application is centralized in one location So no more props drilling between components and sub components No need to send props to child components or callback functions to parent components With Redux you state is now centralized in one location and each component has direct access to the state When using Redux the centralized store is now the only place where state will be change in your application State can be change in your store by dispatching different actions For example an action to add another action to update another action to delete etc Install ReduxFrom an already created React project folder you can type in terminal npm install reduxjs toolkit react reduxcreate react appIf your app is not yet created you can create it with redux store already install and pre config npx create react app my app template reduxNoted For this tutorial we do not use the create react app template redux In this tutorial we setup an Redux app from scratch using Redux Toolkit to setup a redux storeRedux DevToolsYou can also install a DevToll in your browser that will be handy to debug For Chrome there is extension call Redux DevToolsHow Redux work Redux change the way you will code your app Redux also introduce many new Redux specific terms like store provider splice reducer selector action etc Before creating all those elements and make your store work We need to step back and try to understand the concept as a hole The goal we try to achieve is to find a more efficient way to manage the state of all ours components and sub components without using props drilling To do that we use Redux Redux centralize all our state in one place That centralize place is call the store So from now on when you hear the term store that mean your app central place that contain all your components state Create a Redux storeThe first step is to create your app Redux store Create a js file src app store js and type Redux initialization code import configureStore from reduxjs toolkit export default configureStore reducer This creates a Redux store and for now set the reducer to empty I will explain reducer a bit later Make the store available to ReactOnce the store is created we can make it available to our React components by putting a React Redux Provider around our application in src index js import React from react import ReactDOM from react dom import index css import App from App import store from app store import Provider from react redux ReactDOM render lt Provider store store gt lt App gt lt Provider gt document getElementById root Import the Redux store we just created put a Provider around your App and pass the store as a prop Now the store is available for all components within the Provider SelectorsSince our components state are in a central place we need a way to make call to that store and retrieved state Redux have a selector hook to help use do just that For example in your store you can have a selector name selectItems we will create that later That selector for example could return all items in your ecom app basket In your component you can use a selector hook to call that store selector and retrieve your items import useSelector from react redux const items useSelector selectItems That s it As you can see retrieving state from your store is very easy Anywhere you are in your component three you can always easily retrieve the state in your store ReducersWhat about changing the state of items For example adding or removing items How can you tell your store that you want to add or remove an item You will use a store functions name reducer Reducer function never mutate the current state It always return a new updated state object For example you can have a reducer function name addItemToBasket That function will return the new state that include the new item In your component you can call reducer function by using the dispatch hook import useDispatch from react redux import addItemToBasket from basketSlice const dispatch useDispatch return lt button onClick gt dispatch addItemToBasket item gt Add lt button gt Where and how we declare selectors and reducers Selectors and reducers can be create using the createSlice function The name “slice comes from the idea that we re splitting up your app state into multiple “slices of slate For example for an e commerce app a slice could be the basket another one for users another one for products etc It is a good idea because we need a way to group our selectors and reducers we cannot put all those functions in one big file So better group them by slice For example if you want to create a basket slice you will create a file scr app features basketSlice jsimport createSlice from reduxjs toolkit const initialState items id name iPhone id name iPadPro id name iWatch let nextId export const basketSlice createSlice name basket initialState reducers addItemToBasket state action gt console log in state items state items id nextId name action payload name nextId removeItemFromBasket state action gt state items state items filter item gt item id action payload id export const addItemToBasket removeItemFromBasket basketSlice actions export const selectItems state gt state basket items export default basketSlice reducer This basket slice contain reducers and one selector That s it Can we now use those reducers and selectors into your component Not yet You need to register the reducer with the store For that revisite the store js you create earlier and add the basketSlice reducer import configureStore from reduxjs toolkit import basketReducer from features basket basketSlice export const store configureStore reducer basket basketReducer Now the basket slice is available to all your app component SummaryOk let s recap We have a store that contains all our app state We create our app store in scr app store jsTo make that store available to your components We add the Provider tag in between our App top level componentTo retrieve or mutate data from the store we need to use selectors and reducers Selectors and reducers are group by app features call slice To call a selector we use a hook name useSelector For example items useSelector basketItems To call reducer action we use a hook name useDispatch For example dispatch addItemToBasket item ConclusionOuff that s a lot to gaps in one read If you dont understand everything that s normal Read this post more than once and continu your learning on the web with other tutorial That s it for today I still have a lot of posts coming about React so if you want to be sure to miss nothing click follow me I am new on twitter so if you want to make me happyFollow me Follow justericchapman 2021-05-28 17:43:26
海外TECH DEV Community Adding physics to web components https://dev.to/eerk/adding-physics-to-web-components-4kh2 Adding physics to web componentsIt s Friday afternoon so I wanted to do some crazy experiment In a previous post I already looked into using Web Components Custom Elements for browser game development Today we re going to add physics to our HTML tags just because it s possible And to learn a bit about web components and Matter JSWe ll be looking at Custom ElementsGame LoopAdding Physics with Matter js Project setup with Parcel js A simulation with bouncy barrels stubborn crates platforms and a player character Example code is in Typescript but you can leave out type annotations such as a number and public private to convert to Javascript Custom ElementsA custom element is a HTML tag that has executable code added to it That s really handy for game objects We ll use that to add physics later You can nest custom elements within each other to create a hierarchy The tag names have to end with component at least I get an error if I leave that out HTML lt game component gt lt platform component gt lt platform component gt lt crate component gt lt crate component gt lt player component gt lt player component gt lt game component gt CSSWe will use translate to position our elements with javascript so that means all elements need position absolute and display block You can use a background image for the visual it s shorter and faster than using lt img gt tags and you can use repeating backgrounds platform component position absolute display block background image url images platform png width px height px TYPESCRIPTFirst we have to bind our code to the HTML tag by creating a class and registering it using customElments define In Javascript this is exactly the same except for the number type annotationsexport class Crate extends HTMLElement constructor x number y number super console log I am a crate at x y customElements define crate component Crate You can add it to the DOM by placing the tag in the HTML document lt crate component gt lt crate component gt But if we do it by code we can pass constructor arguments in this case an x and y position This is handy if we want several crates at different positions let c new Crate document body appendChild c GAME LOOPTo use physics we need a game loop This will update the physics engine times per second The game loop will then update all the custom elements In this example we create a game class with a game loop that updates all crates import Crate from crate export class Game extends HTMLElement private crates Crate constructor super this elements push new Crate this gameLoop private gameLoop for let c of this crates c update requestAnimationFrame gt this gameLoop customElements define game component Game The crate component gets an update function to translate its position export class Crate extends HTMLElement constructor private x number private y number super public update this style transform translate this x px this y px customElements define crate component Crate PHYSICSFINALLY we get to the point where we add Matter js physics Matter js creates a physics engine that can run invisibly in the background If we add objects such as boxes cylinders floors and ceilings to it it will create a physics simulation with those objects Our elements will respond to gravity friction velocity force bounciness and get precise collision detection Matter js has a renderer that can draw those objects directly in a canvas but that s boring We ll use the positions of the physics elements to position DOM elements Plan Adding the physics world to the game class Adding physics to the crates What more can you do with physics Adding Matter js to the Game classimport Matter from matter js import Crate from crate export class Game extends HTMLElement private engine Matter Engine private world Matter World private crates Crate constructor super this engine Matter Engine create this world this engine world this crates push new Crate this world new Crate this world this gameLoop private gameLoop Matter Engine update this engine for let c of this crates c update requestAnimationFrame gt this gameLoop customElements define game component Game Adding physics to the cratesThe Crate class will add a physics box to the physics world Then it will read the physics box position in the update function and update the crate element position in the DOM world import Matter from matter js export class Crate extends HTMLElement private physicsBox Matter Body constructor x number y number private width number private height number super this physicsBox Matter Bodies rectangle x y this width this height options Matter Composite add game getWorld this physicsBox document body appendChild this public update let pos this physicsBox position let angle this physicsBox angle let degrees angle Math PI this style transform translate pos x this width px pos y this height px rotate degrees deg customElements define crate component Crate What more can you do with physics We re really just getting started using Matter JS To build the game you see in the images from this post you use the following concepts Static elementsThese are elements such as platforms and walls that do not have forces applied to them but still cause collisions this physicsBox Matter Bodies rectangle x y w h isStatic true VelocityBy setting the velocity of an object manually you can create a player or enemy character that moves according to player input Matter Body setVelocity this physicsBox x y this physicsBox velocity y ForceBy adding force you can temporarily boost an object in a certain direction for example a rocket or a bullet You can use force to make a character jump Matter Body applyForce this physicsBox x this physicsBox position x y this physicsBox position y x y Project setupYou can set up the above project with or without Typescript using Parcel to bundle your modules npm install g parcel bundlernpm install matter jsnpm install types matter jsnpm install typescriptThen you can run the project in watch mode usingparcel dev index htmlOr build the whole project usingparcel build dev index html public url ConclusionI hope this post didn t become too long I think this approach is great fun but is it really useful compared to using a canvas for physics simulations Well Canvas elements can t have Event ListenersCanvas doesn t have a nice DOM tree that you can traverseDisadvantages Rendering and game structure are a bit too intertwined you can t easily switch to canvas rendering at a late stage in development If you want thousands or tens of thousands of objects bouncing around a canvas is much more efficient LinksCustom ElementsMatter jsParcel js 2021-05-28 17:20:48
海外TECH Engadget Researchers combine gene therapy and event cameras to partially restore a blind man's sight https://www.engadget.com/researchers-combine-gene-therapy-and-event-cameras-to-partially-restore-a-blind-mans-sight-173002101.html?src=rss_b2c Researchers combine gene therapy and event cameras to partially restore a blind man x s sightA formerly blind patient has unexpectedly had a portion of his visual perception restored thanks to a cutting edge hybrid biological technological therapy known as optogenetics 2021-05-28 17:30:02
金融 金融庁ホームページ Bybit Fintech Limitedに対する警告書の発出について公表しました。 https://www.fsa.go.jp/policy/virtual_currency02/BybitFintechLimited_keikokushiryo.pdf bybitfintechlimited 2021-05-28 17:30:00
ニュース BBC News - Home Downing Street flat: PM cleared of misconduct but acted unwisely, says watchdog https://www.bbc.co.uk/news/uk-politics-57280418 downing 2021-05-28 17:56:53
ニュース BBC News - Home Matt Hancock broke ministerial code over stake in firm https://www.bbc.co.uk/news/uk-politics-57272252 breach 2021-05-28 17:06:40
ニュース BBC News - Home Republicans block 9/11-style congressional probe of Capitol riot https://www.bbc.co.uk/news/world-us-canada-57272756 january 2021-05-28 17:11:55
ニュース BBC News - Home Hungarian PM Orban defends anti-migrant remarks on UK visit https://www.bbc.co.uk/news/uk-politics-57287343 viktor 2021-05-28 17:29:51
ニュース BBC News - Home Covid: EU approves Pfizer-BioNTech jab for 12-15 year olds https://www.bbc.co.uk/news/world-europe-57287755 biontech 2021-05-28 17:17:53
北海道 北海道新聞 茨城・境の家族殺傷、男再逮捕へ 子ども2人を襲った疑い https://www.hokkaido-np.co.jp/article/549340/ 茨城県境町 2021-05-29 02:16:00

コメント

このブログの人気の投稿

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

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