ROBOT |
ロボスタ |
コカ・コーラ・ヨルダン ネコ型自動配送ロボット「BellaBot」を本格導入 Pudu Roboticsと戦略的提携協定を締結 |
https://robotstart.info/2022/04/22/coca-cola-jordan-pudu-robotics.html
|
|
2022-04-22 04:34:02 |
IT |
ITmedia 総合記事一覧 |
[ITmedia News] Google、欧州でCookie同意バナーの全拒否ボタン提供開始へ |
https://www.itmedia.co.jp/news/articles/2204/22/news128.html
|
cookie |
2022-04-22 13:47:00 |
IT |
ITmedia 総合記事一覧 |
[ITmedia ビジネスオンライン] 「子どもと楽しみたい知育お菓子」ランキング 「手づくりアポロ」を抑えた圧倒的1位は? |
https://www.itmedia.co.jp/business/articles/2204/22/news112.html
|
arina |
2022-04-22 13:06:00 |
IT |
ITmedia 総合記事一覧 |
[ITmedia PC USER] ASUS、IPSパネルを採用したスタンダード31.5型4K液晶ディスプレイなど3製品 |
https://www.itmedia.co.jp/pcuser/articles/2204/22/news122.html
|
asusjapan |
2022-04-22 13:01:00 |
TECH |
Techable(テッカブル) |
honto、読書の習慣化をサポートするサブスクサービス「ケイドク」正式リリース |
https://techable.jp/archives/177577
|
honto |
2022-04-22 04:00:48 |
js |
JavaScriptタグが付けられた新着投稿 - Qiita |
jsPsychのプラグインをカスタマイズ - 参加者の回答を制限する方法 |
https://qiita.com/kurokida/items/f29a5bf7b587153b1bab
|
jspsych |
2022-04-22 13:41:25 |
Ruby |
Rubyタグが付けられた新着投稿 - Qiita |
FFIやFiddleで生成したメソッドをYardドキュメントに掲載させる |
https://qiita.com/kojix2/items/9f9ceea610698ddd1665
|
fiddle |
2022-04-22 13:53:37 |
AWS |
AWSタグが付けられた新着投稿 - Qiita |
AWS Cognito でLINEログインのボットリンク機能を使う |
https://qiita.com/eup42/items/7d999236b5b84760cead
|
awsamplify |
2022-04-22 13:22:49 |
golang |
Goタグが付けられた新着投稿 - Qiita |
AWS Cognito でLINEログインのボットリンク機能を使う |
https://qiita.com/eup42/items/7d999236b5b84760cead
|
awsamplify |
2022-04-22 13:22:49 |
Git |
Gitタグが付けられた新着投稿 - Qiita |
Git で "fatal: unsafe repository" エラーが出たときの解消法 |
https://qiita.com/elfincafe/items/dd0f8793113f0437f078
|
fatalunsaferepositoryxxxd |
2022-04-22 13:49:10 |
技術ブログ |
Developers.IO |
EC / CRMプラットフォーム prismatix を支える組織の構成とは? |
https://dev.classmethod.jp/articles/pz-team-structure/
|
eccrm |
2022-04-22 04:47:30 |
海外TECH |
DEV Community |
How can I get this shimmering animation on a button in react native? |
https://dev.to/yashyon/how-can-i-get-this-shimmering-animation-on-a-button-in-react-native-3jgg
|
How can I get this shimmering animation on a button in react native Animation LinkI have implemented this animation using css in a react app but I want to use this animation in react native as there are no keyframes and transition properties in react native s stylesheet So I don t know how to implement this in react native Please help |
2022-04-22 04:16:01 |
海外TECH |
DEV Community |
Add authentication to your Express app with Asgardeo |
https://dev.to/suvink/add-authentication-to-your-express-app-with-asgardeo-13bh
|
Add authentication to your Express app with AsgardeoWhen you are writing code for a project at some point you re gonna have to come across user logins To perform user specific tasks to save user data and to do various kinds of stuff user accounts is a mandatory feature in any system But building a fully fledged login system is not so easy especially having the flexibility to incorporate many kinds of login options Email and password Social Logins Magic Links etc securely takes in a lot of effort That is where Asgardeo by WSO comes into play TLDR Try the official sample app here Asgardeo is an IDaaS Identity as a Service empowering developers to implement secure and frictionless access In a broader sense it is a cloud based solution that offers Identity and Access Management IAM capabilities to your applications easily Now let s have a look at how we can integrate Asgardeo OIDC Open ID Connect authentication to our Express application For that we will be using Asgardeo Node SDK Prerequisites An Asgardeo organization You can create an organization upon registration at A Standard Based Application Once you create an organization in the Asgardeo Console you can create a Standard Based Application from the dashboard More info Projet InitializationLet s get started First and foremost you re gonna have to create a new folder or a directory and initialize a new project You can do that with yarn init y and it will create a new package json file for you Now open your folder in your favourite code editor and we re ready to proceed Now you have to install all the dependancies yarn add asgardeo auth node cookie parser express uuidTo live reload the changes as we do we need nodemon as a dev dependancy yarn add D nodemonAfter installing add the following to your package json file If you already have a scripts block you can replace it scripts test echo Error no test specified amp amp exit serve nodemon server js Implement an Express appCreate a new file and name it as server js You can choose whatever the name you want p but make sure you change the name in the package json as well Then create a simple express server inside your server js file Something similar to this const express require express const cookieParser require cookie parser Define the Portconst PORT Initialize Express Appconst app express app use cookieParser app get req res gt res send Hello World Start the app and listen on the PORTapp listen PORT gt console log Server Started at PORT PORT Run the server withyarn run serveNow if you navigate to localhost you should see a Hello World Integrate Asgardeo AuthenticationNow that we have a working Express app let s integrate Asgardeo authentication First you need to create a new file and name it to config js Inside that file you need to specify the configuration for Asgardeo initialization const config clientID YOUR CLIENT ID clientSecret YOUR CLIENT SECRET baseUrl YOUR BASE URL signInRedirectURL http localhost login signOutRedirectURL http localhost scope openid profile module exports config Replace the clientID clientSecret and baseUrl from the values you get from Asgardeo Console The signInRedirectURL is the one a user should be redirected after the login Keep in mind that the login endpoint and signInRedirectURL should be the same You ll see why later Also make sure you add localhost as an allowed origin and add signInRedirectURL as an authorized redirect URL in the console Now open the server js file and import the Asgardeo Node SDK and our config file Note As an additional package we need the uuid package as well const AsgardeoNodeClient require asgardeo auth node const v uuidv require uuid const config require config Then initialize the AsgardeoNodeClient with the configuration const authClient new AsgardeoNodeClient config After that we can move onto implementing the login endpoint Earlier we declared our signInRedirectURL in the config file to a login endpoint So we ll implement that endpoint here app get login req res gt Inside the route handler first you need to check if the incoming request is already authenticated or not To do this we can check the ASGARDEO SESSION ID cookie If the request has a session ID we can use that to re authenticate the user and if not we can create a new session ID and assign it to the request let userID req cookies ASGARDEO SESSION ID if userID userID uuidv After that you have to implement a callback function which will be used to redirect the user to the authorization URL const redirectCallback url gt if url res redirect url return This function will take in the authorization URL string as a parameter and will redirect the user Now we will use the signIn function from the SDK to authorize the user authClient signIn redirectCallback userID req query code req query session state req query state then response gt Just to see whats going on console log response Make sure you use the httpOnly and sameSite to prevent from cross site request forgery CSRF attacks if response session res cookie ASGARDEO SESSION ID response session maxAge httpOnly true sameSite true res status send response Now let s figure out why we added the signInRedirectURL in the config file as same as the login endpoint login The signIn method accepts parameters namely redirectCallback userID code session state and state When a user logs in for the first time the login endpoint will not get any values for code session state and state even though the signIn function expects the URL to have them If those parameters are not present the SDK will generate an authorization URL and passes it down to the redirectCallback function From there the user will be redirected to the Asgardeo Login Page and will securely authenticated After doing so as per our config file the user will be redirected into the signInRedirectURL This redirection will have the code session state and state URL parameters Now the SDK knows this user has been redirected from the Asgardeo Login and will validate the code session state and state then create a session in the Express app against the userID There is a complicated process under the hood but the user just have to call login endpoint once and the SDK will handle the flow smoothly After the session is created in the Express app you can send the session ID as a cookie back to the user Make sure you use the httpOnly and sameSite attributes to prevent your cookie from cross site request forgery CSRF attacks The final code block for the login endpoint will look like this app get login req res gt let userID req cookies ASGARDEO SESSION ID if userID userID uuidv const redirectCallback url gt if url res redirect url return authClient signIn redirectCallback userID req query code req query session state req query state then response gt console log response Make sure you use the httpOnly and sameSite to prevent from cross site request forgery CSRF attacks if response session res cookie ASGARDEO SESSION ID response session maxAge httpOnly true sameSite true res status send response Now you have a working login endpoint for your users Let s add a log out endpoint as well Logging out is rather easy than implementing the log in We ll start with defining a new route app get logout req res gt In the logout logic first we need to check if the session ID cookie is present in the request If so we know this user has already been authenticated if req cookies ASGARDEO SESSION ID undefined res send Unauthenticated If the cookie is not present we reject the logout request But if it s present we need to logout the user and delete the session authClient signOut req cookies ASGARDEO SESSION ID then response gt Invalidate the session cookie res cookie ASGARDEO SESSION ID null maxAge res redirect response catch err gt console log err res send err We can extract the session ID from the cookie and then pass it on to signOut function It will identify the relevant user s session and will destroy accordingly After that we need to invalidate the cookie This can be done by setting the value to null sending back So the code block for logout endpoint will look like this app get logout req res gt if req cookies ASGARDEO SESSION ID undefined res send Unauthenticated else authClient signOut req cookies ASGARDEO SESSION ID then response gt Invalidate the session cookie res cookie ASGARDEO SESSION ID null maxAge res redirect response catch err gt console log err res send err Congratulations now you have implemented asgardeo authentication to your Express app The Asgardeo Node SDK comes up with more functions that will be useful to implement your next project so do check them out as well Please check the official sample app here and you can try out the SDK including the functions we coded earlier in this article That s it for now thanks for reading See you folks soon |
2022-04-22 04:09:13 |
海外TECH |
DEV Community |
How to resolve "multi-word vue/multi-word-component-names" issue in VueJs 3 default option. |
https://dev.to/gayathri_r/how-to-resolve-multi-word-vuemulti-word-component-names-issue-in-vuejs-3-default-option-1eoh
|
How to resolve quot multi word vue multi word component names quot issue in VueJs default option Problem While running the VueJs application failed with Multi word vue multi word component names error home user tutorials animations vuejs src components HelloWorld vue error Component name hello should always be multi word vue multi word component names problem error warnings Solution This problem is due to the eslint setting issues By default the linting rule is enabled in Vuejs Default Vue babel eslint You can resolve this problem in two ways Method Rename the component name Here in this case the component name provided is hello you can change this as a multi word like HelloWorld export default name HelloWorld props msg String Method Disable the linting rule By disabling the eslint execute the below command npm remove vue cli plugin eslint |
2022-04-22 04:09:01 |
海外TECH |
DEV Community |
React Custom Hook example |
https://dev.to/tienbku/react-custom-hook-example-3da6
|
React Custom Hook exampleIn addition to the familiar Hooks like useState useEffect useRef React also allows us to create custom Hooks with unique features that extracts component logic into reusable functions Let s learn how to write a Custom Hook in React through a simple useAxiosFetch example Tutorial from Bezkoder React Custom Hook exampleWhat are React Custom Hooks From version React Hooks are officially added to React js Besides built in Hooks such as useState useEffect useCallback we can define our own hooks to use state and other React features without writing a class A Custom Hook has following features As a function it takes input and returns output Its name starts with use like useQuery useMedia Unlike functional components custom hooks return a normal non jsx data Unlike normal functions custom hooks can use other hooks such as useState useRef and other custom hooks You can see that some libraries also provide hooks such as useForm React Hook Form useMediaQuery MUI Why and When to use React Custom HooksCustom hooks give us following benefits Completely separate logic from user interface Reusable in many different components with the same processing logic Therefore the logic only needs to be fixed in one place if it changes Share logic between components Hide code with complex logic in a component make the component easier to read So when to use React custom hook When a piece of code logic is reused in many places it s easy to see when you copy a whole piece of code without editing anything except for the parameter passed Split like how you separate a function When the logic is too long and complicated you want to write it in another file so that your component is shorter and easier to read because you don t need to care about the logic of that hook anymore React Custom Hook exampleLet s say that we build a React application with the following components TutorialsList get a list of Tutorials from an API call GET tutorials and display the list Tutorial get a Tutorial s details from an API call GET tutorials id and display it but the interface will be different import React from react import Routes Route from react router dom import Tutorial from components Tutorial import TutorialsList from components TutorialsList function App return amp lt div gt amp lt div gt amp lt Routes gt amp lt Route path tutorials element amp lt TutorialsList gt gt amp lt Route path tutorials id element amp lt Tutorial gt gt amp lt Routes gt amp lt div gt amp lt div gt export default App You can find the complete tutorial and source code for the React App at React Hooks CRUD example with Axios and Web APIWhen not using React Custom HooksLet s see how we ve made for simple API call from the components TutorialsList and Tutorial without using React Custom Hooks We set up axios base URL and headers first http common jsimport axios from axios export default axios create baseURL http localhost api headers Content type application json Then we use axios get to fetch data from API with response result or error components TutorialsList jsimport axios from http common js const TutorialsList gt const tutorials setTutorials useState const currentTutorial setCurrentTutorial useState null const searchTitle setSearchTitle useState useEffect gt retrieveTutorials const retrieveTutorials gt axios get tutorials then response gt setTutorials response data console log response data catch e gt console log e const findByTitle gt axios get tutorials title searchTitle then response gt setTutorials response data console log response data catch e gt console log e return components Tutorial jsimport useParams from react router dom const Tutorial props gt const id useParams const initialTutorialState const currentTutorial setCurrentTutorial useState initialTutorialState const getTutorial id gt axios get tutorials id then response gt setCurrentTutorial response data console log response data catch e gt console log e useEffect gt if id getTutorial id id return Using React Custom HookLook at the code above you can see that both components above have a very similar logic They all call API to get data save the response data into the state to update again when the data is successfully retrieved The only difference is that they render different UI and different URL when calling API axios get then response gt catch e gt We can reduce the repetition by creating a custom hook useAxiosFetch for reuse as follows customer hooks useAxiosFetch jsimport useState useEffect from react import axios from axios axios defaults baseURL http localhost api export const useAxiosFetch url gt const data setData useState undefined const error setError useState const loading setLoading useState true const fetchData async gt try const response await axios get url setData response data catch error setError error setLoading false finally setLoading false useEffect gt fetchData return data error loading From now in components TutorialsList and Tutorial we just need to use custom hook useAxiosFetch without worrying too much about the logic inside it Just know it receives url and returns values data loading and error We can make the custom hook more dynamic For example we want to pass more details of the request method url params body instead of only url Furthermore we may need to call fetchData method outside the hook Let s modify a few code like this useAxiosFetch jsimport useState useEffect from react import axios from axios axios defaults baseURL http localhost api export const useAxiosFetch axiosParams gt const data setData useState undefined const error setError useState const loading setLoading useState true const fetchData async gt try const response await axios request axiosParams setData response data catch error setError error setLoading false finally setLoading false useEffect gt fetchData return data error loading fetchData Let s use this React custom Hook in our components components TutorialsList jsimport React useState useEffect from react import useAxiosFetch from custom hooks useAxiosFetch const TutorialsList gt const tutorials setTutorials useState const searchTitle setSearchTitle useState const fetchData data loading error useAxiosFetch method GET url tutorials params title searchTitle useEffect gt if data setTutorials data console log data else setTutorials data useEffect gt if error console log error error useEffect gt if loading console log retrieving tutorials loading const onChangeSearchTitle e gt const searchTitle e target value setSearchTitle searchTitle const findByTitle gt fetchData return amp lt div gt amp lt div gt amp lt input type text placeholder Search by title value searchTitle onChange onChangeSearchTitle gt amp lt button type button onClick findByTitle gt Search amp lt button gt amp lt div gt amp lt div gt amp lt h gt Tutorials List amp lt h gt loading amp amp amp lt p gt loading amp lt p gt amp lt ul className list group gt tutorials amp amp tutorials map tutorial index gt amp lt li key index gt tutorial title amp lt li gt amp lt ul gt amp lt div gt amp lt div gt export default TutorialsList components Tutorial jsimport React useState useEffect from react import useParams useNavigate from react router dom import useAxiosFetch from custom hooks useAxiosFetch const Tutorial gt const id useParams const initialTutorialState const currentTutorial setCurrentTutorial useState initialTutorialState const data loading error useAxiosFetch method GET url tutorials id useEffect gt if data setCurrentTutorial data console log data data useEffect gt if error console log error error useEffect gt if loading console log getting tutorial loading const handleInputChange event gt const name value event target setCurrentTutorial currentTutorial name value return amp lt div gt currentTutorial amp lt div gt amp lt h gt Tutorial amp lt h gt loading amp amp amp lt p gt loading amp lt p gt amp lt form gt amp lt div gt amp lt label htmlFor title gt Title amp lt label gt amp lt input type text id title name title value currentTutorial title onChange handleInputChange gt amp lt div gt amp lt div gt amp lt label htmlFor description gt Description amp lt label gt amp lt input type text id description name description value currentTutorial description onChange handleInputChange gt amp lt div gt amp lt div gt amp lt label gt amp lt strong gt Status amp lt strong gt amp lt label gt currentTutorial published Published Pending amp lt div gt amp lt form gt amp lt div gt amp lt div gt amp lt br gt amp lt p gt Please click on a Tutorial amp lt p gt amp lt div gt amp lt div gt export default Tutorial ConclusionIn this tutorial you ve known what why and when to use a React Custom Hook You also implement the Custom Hook for API call using Axios with an example Further ReadingMore Practice React Hooks CRUD example with Axios and Web APIReact Hooks File Upload example with AxiosReact Form Validation with Hooks exampleReact Hooks JWT Authentication without Redux exampleReact Redux JWT Authentication exampleServerless React Hooks Firebase Realtime Database CRUD AppReact Hooks Firestore example CRUD app |
2022-04-22 04:01:00 |
海外科学 |
BBC News - Science & Environment |
Large hadron collider: A revamp that could revolutionise physics |
https://www.bbc.co.uk/news/science-environment-61149387?at_medium=RSS&at_campaign=KARANGA
|
universe |
2022-04-22 04:30:05 |
金融 |
ニッセイ基礎研究所 |
ドイツの民間医療保険及び民間医療保険会社の状況(1)-2020年結果- |
https://www.nli-research.co.jp/topics_detail1/id=70949?site=nli
|
医療保険の普及率等は、公的医療保険制度との役割分担が大きく影響しており、民間医療保険に大きく依存しているオランダやスイスが高いものとなっているが、ドイツもこれらに次ぐ国となっている。 |
2022-04-22 13:16:38 |
金融 |
ニッセイ基礎研究所 |
商業施設売上高の長期予測(2)-少子高齢化・EC市場拡大・コロナ禍による消費行動の変容が商業施設売上高に及ぼす影響 |
https://www.nli-research.co.jp/topics_detail1/id=70950?site=nli
|
目次ー商業施設はコロナ禍の不確実性に加え、少子高齢化とEC市場拡大が逆風にー少子高齢化の商業施設売上高への影響将来の人口・世帯数の推移単身世帯増加による物販・外食・サービス支出への影響高齢化による物販・外食・サービス支出への影響ーEC市場拡大による商業施設売上高への影響EC市場拡大の動向ー商業施設の売上環境のシミュレーション手法とシナリオ設定シミュレーション手法コロナ禍による消費行動の変容に関するシナリオ設定ー年までの商業施設の売上環境のシミュレーション結果物販・外食・サービス支出の見通し商業施設売上高の見通し可処分所得が増加した場合の商業施設売上高の見通しー長期的な下押し圧力のなか、運営力強化と投資対象の選別が求められる日本の小売業を取り巻く環境は厳しさを増している。 |
2022-04-22 13:02:22 |
金融 |
日本銀行:RSS |
【記者会見要旨】黒田総裁(G20・G7、4月20日分) |
http://www.boj.or.jp/announcements/press/kaiken_2022/kk220422a.pdf
|
記者会見 |
2022-04-22 13:20:00 |
海外ニュース |
Japan Times latest articles |
Japan March consumer prices rose at fastest pace in over two years |
https://www.japantimes.co.jp/news/2022/04/22/business/consumer-price-increase-march/
|
Japan March consumer prices rose at fastest pace in over two yearsThe core consumer price index which excludes volatile fresh food prices but includes fuel and broader energy costs jumped in March from a year |
2022-04-22 13:30:01 |
海外ニュース |
Japan Times latest articles |
Macron closes in on second term in France as Le Pen falters |
https://www.japantimes.co.jp/news/2022/04/22/world/macron-closing-in-on-second-term/
|
weaknesses |
2022-04-22 13:21:20 |
海外ニュース |
Japan Times latest articles |
Tokyo to ease COVID-19 group dining guidelines |
https://www.japantimes.co.jp/news/2022/04/22/national/tokyo-covid-dining-guidelines/
|
cases |
2022-04-22 13:14:35 |
ニュース |
BBC News - Home |
Madeleine McCann: Portuguese authorities declare formal suspect |
https://www.bbc.co.uk/news/uk-61183857?at_medium=RSS&at_campaign=KARANGA
|
german |
2022-04-22 04:47:53 |
ニュース |
BBC News - Home |
Boris Johnson and India's Narendra Modi to discuss defence and trade |
https://www.bbc.co.uk/news/uk-politics-61183833?at_medium=RSS&at_campaign=KARANGA
|
india |
2022-04-22 04:18:56 |
ニュース |
BBC News - Home |
Large hadron collider: A revamp that could revolutionise physics |
https://www.bbc.co.uk/news/science-environment-61149387?at_medium=RSS&at_campaign=KARANGA
|
universe |
2022-04-22 04:30:05 |
ニュース |
BBC News - Home |
The Papers: 'The gig is up, Boris' and 'Johnson buckles' |
https://www.bbc.co.uk/news/blogs-the-papers-61184349?at_medium=RSS&at_campaign=KARANGA
|
front |
2022-04-22 04:13:17 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
米国とサウジの友好関係、限界に至るまで - WSJ発 |
https://diamond.jp/articles/-/302212
|
限界 |
2022-04-22 13:11:00 |
北海道 |
北海道新聞 |
ロッテ、森永乳業が値上げ 「雪見だいふく」「ピノ」 |
https://www.hokkaido-np.co.jp/article/672738/
|
板チョコレート |
2022-04-22 13:13:38 |
ニュース |
Newsweek |
【ゼロから分かる】「円安=株高」が崩れたのはなぜ? |
https://www.newsweekjapan.jp/stories/business/2022/04/post-98556.php
|
もはや為替ではなく、国際間での日本企業の競争力が大切になっているのです。 |
2022-04-22 13:40:00 |
IT |
週刊アスキー |
PC「ガンダムネットワーク大戦」でイベントバトル「激突!黒いユニコーン」が開催中! |
https://weekly.ascii.jp/elem/000/004/089/4089925/
|
開催期間 |
2022-04-22 13:30:00 |
IT |
週刊アスキー |
パナソニック、AIの高画質処理を強化した「ビエラ LX950/900」 |
https://weekly.ascii.jp/elem/000/004/089/4089843/
|
発売予定 |
2022-04-22 13:15:00 |
コメント
コメントを投稿