投稿時間:2023-02-18 01:21:32 RSSフィード2023-02-18 01:00 分まとめ(24件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
IT 気になる、記になる… Kindleストア、「幻冬舎 電本フェス 後夜祭」のセールを開催中 ー 1,300冊以上が最大70%オフに https://taisy0.com/2023/02/18/168612.html amazon 2023-02-17 15:14:39
AWS AWS Management Tools Blog Gain compliance insights using the open source community for AWS CloudTrail https://aws.amazon.com/blogs/mt/gain-compliance-insights-using-the-open-source-community-for-aws-cloudtrail/ Gain compliance insights using the open source community for AWS CloudTrailDoes your organization need to maintain visibility into operations in their AWS accounts for security and compliance Do you need this visibility across multiple AWS accounts and geographic regions Would you like predefined templates to help you get started with analyzing account activity quickly Using AWS CloudTrail Lake and our newly announced public repository of … 2023-02-17 15:07:10
AWS AWS Government, Education, and Nonprofits Blog The true costs of resiliency decisions https://aws.amazon.com/blogs/publicsector/true-costs-resiliency-decisions/ The true costs of resiliency decisionsMany organizations may not fully recognize or calculate the true costs of workload resiliency decisions These true costs include the full spectrum of costing considerations that make up a decision from readily determinable accounting costs to less recognizable intangible costs As public sector organizations often have limited resources and complex missions it s important to understand the true costs and economic impact involved in a resiliency decision this can help these organizations to both prepare and plan with their available resources 2023-02-17 15:52:17
python Pythonタグが付けられた新着投稿 - Qiita PythonのRequestsでサイズの大きいファイルをダウンロード https://qiita.com/ousaan/items/c83e068c4e46035f49bd rrequestsgethttpshogehoge 2023-02-18 00:14:35
js JavaScriptタグが付けられた新着投稿 - Qiita innerHTMLで要素を追加させる https://qiita.com/yuta-10112022/items/5a7c1ef29bfc31daaeff appendchild 2023-02-18 00:14:24
海外TECH MakeUseOf How to Create a Color Palette Using the Pantone Studio App https://www.makeuseof.com/create-color-palette-pantone-studio-app/ studio 2023-02-17 15:30:19
海外TECH MakeUseOf How to Fix Windows Update Error Code 0x80073712 https://www.makeuseof.com/windows-update-error-code-0x80073712-fix/ error 2023-02-17 15:15:16
海外TECH DEV Community Building a real-time commenting app with Socket.io and React https://dev.to/knocklabs/building-a-real-time-commenting-app-with-socketio-and-react-11ae Building a real time commenting app with Socket io and ReactIn this guide we ll walk through how to build a real time commenting system using React Node js and Socket io We ll show you how to build a list of comments fed from an API create new comments and broadcast comments in real time to connected users using Socket io We ll also briefly introduce Knock a developer platform for building a cross channel notification system Engineers use Knock for building powerful cross channel notifications that can send to in app and out of app channels like email SMS push and Slack All through a single API call PrerequisitesWe recommend the following prerequisites before beginning Familiarity with JavaScript and the React libraryNode installed on your machine Getting startedIn this section we ll set up the basics of our application including the structure we ll use to house our Node js server and our React front end application First create the project folder and two subfolders for the client and server of the application mkdir real time commenting appcd real time commenting appmkdir client server Building our Node js API serverNext we re going to be creating the basis of our Node js API server The API server s job is to send information to the client for the comments we have available and process any new comments created in the client The server will also set up our Socket io connection and expose a websocket that can be connected to from our React client Inside our server directory we re going to install the dependencies we need to build our API server Express js is a minimalist web framework for Node js that provides a simple interface for building HTTP listeners as well as other functionality that makes it easy to build web applications in Node js CORS is an NPM package that lets us process cross origin requests This is important as we ll be running a separate client and server application e g they will be running on different ports Nodemon is a package that will automatically restart our Node js server after detecting any changes making local development easy Socket io is a Javascript library that allows us to create real time bidirectional communication between web browsers clients and a Node js server Let s go ahead and install our dependencies inside our server directory npm install express cors nodemon socket ioThe next step is to create the entry point of our web server as index js touch index jsNow inside the server index js file we re going to setup our simple Node js server using Express js const express require express const app express const http require http Server app const cors require cors const PORT app use cors app use express json app get users req res gt TODO implement res json app get comments req res gt TODO implement res json app post comments async req res gt TODO implement res json null http listen PORT gt console log Server listening on PORT Here we re defining a few endpoints that we ll be filling in during the course of this guide GET users returns a list of available usersGET comments returns a list of posted commentsPOST comments creates a new commentWe re also adding CORS support to our express server with app use cors and the ability to parse incoming JSON with app use express json Now let s add a start script so we can start our API server Inside your server package json file add the following scripts test echo Error no test specified amp amp exit start nodemon index js You can now start the server on port by running npm startWe can verify our server is working correctly by going to http localhost users where you should receive an empty list of users Implementing our users and commenting endpointsIn this next section we re going to add the implementation for our HTTP endpoints Note in this example application we re going to be using static and in memory data which won t work for any production use cases You ll need to use a persistent database like MySQL or Postgres if you want to prepare this for production First of all let s add some information to power our GET users endpoint which will return a static list of users that we can post comments as touch lib users jsAnd the contents of the lib users js file will be const users id name Dennis Nedry email dnedry ingen net avatar x x filters focal x x format webp cdn vox cdn com uploads chorus image image dennis nedry jpg id name John Hammond email jhammond ingen net avatar id name Ellie Sattler email esattler ingen net avatar ANdGcRQKxKHuGTXeNrhoozgtgrxNOmNlAcExYBwthSyyfGGWbEewgIGvptNGdCDZamMg amp usqp CAU function findUserById userId return users find user gt user id userId module exports users findUserById We can now go back to our index js server root and start returning this static list of users Under the last require const users require lib users Replace the get users endpoint withapp get users req res gt res json users This ensures that the static list of users is returned as JSON when the users endpoint is requested Let s next implement our comments functions touch lib comments jsThe contents of the lib comments js file will be const findUserById users require users let comments let lastId function getCommentWithAuthor comment return comment author findUserById comment authorId function createComment params const comment id lastId body params body authorId params authorId insertedAt new Date toISOString comments push comment const commentWithAuthor getCommentWithAuthor comment return commentWithAuthor function listComments return comments map comment gt getCommentWithAuthor comment module exports createComment listComments Here we re adding two new functions that we ll be calling from our endpoint createComment and listComments Our comments are implemented as a mutable array that we append to when we create a new comment using an auto incrementing id to generate a unique id for each comment created The createComment function expects to be passed an object that contains a body and a authorId which we ll implement within our React application shortly We re also loading the associated author with each comment when they are both created and listed matching the authorId on the comment with a corresponding user that we have in our static user list Next let s implement the endpoints in our index js server entry point Under the last require const listComments createComment require lib comments app get comments req res gt const comments listComments res json comments app post comments req res gt const comment createComment req body res json comment Here we re creating a comment by passing the req body which will contain any JSON params that the client is sending up in the create comment request These params expect a JSON encoded object to be sent that will look like body My comment authorId It s worth checking at this stage that everything is working as expected You can check out the endpoints we just added in an API testing tool like Postman You should be able to create a new comment and then retrieve the full list of comments with what we ve built so far Note since our comments are only stored in memory when you refresh your Node server or make changes any comments will be reset Creating our comments app in ReactIn this section we re going to build out the client portion of our commenting app The goal is that we ll end up with a single page React application that looks like this First of all we re going to be working in our client directory for this section so let s move to that directory cd clientWe re going to bootstrap our React application using the excellent create react app which is a library from the React team that makes it easy to start building a single page application in React npx create react app Next we re going to install any additional dependencies we need In our case we re just going to need date fns which is a library that makes it trivial to work with datetimes in JavaScript npm i date fnsNow that we ve bootstrapped our React application and installed our dependencies we can start our client running in the browser With create react app you ll get a live reloading application environment so that any changes you re making should be automatically displayed in the browser npm run startYour application should open on port by default in your browser Laying out our application through componentsNext up we re going to start creating our components For this application we re breaking things down into Header and Comments components where the Comments component renders individual Comment components Let s first make our empty component files We ll be filling them in with code shortly touch src components Header jstouch src components Comment jstouch src components Comments js Creating the Header componentInside our src components Header js file const Header users selectedUserId setSelectedUserId gt return lt header className Header key selectedUserId gt lt div className Header user gt lt select value selectedUserId onChange e gt setSelectedUserId e target value gt lt option gt Select a user lt option gt users map user gt lt option key user id value user id gt user name lt option gt lt select gt lt div gt lt header gt export default Header Creating the Comment componentIn our src components Comment js component import parseISO from date fns parseISO import formatDistance from date fns formatDistance function formatDate dateStr const date parseISO dateStr return formatDistance date new Date addSuffix true const Comment comment isYou gt lt div className Comment gt lt div className Comment header gt lt div className Comment avatar gt lt img src comment author avatar alt comment author name gt lt div gt lt span className Comment author gt isYou You comment author name lt span gt lt span className Comment time gt formatDate comment insertedAt lt span gt lt div gt lt div className Comment body gt comment body lt div gt lt div gt export default Comment Here we re using the date fns library to format the date and time in which the comment was posted as a relative date time e g days ago Our formatDate function takes care of this behavior for us using the formatDistance function in date fns to generate relative dates You ll also notice here that we re passing in an isYou prop which when true shows You as the author name rather than the full name Creating the Comments componentNext up let s add the implementation for the src components Comments js file This component represents our comments sidebar and has the responsibility of showing a list of comments and displaying a form to post new comments The brains of our commenting application live in this component and it also houses the state about exactly which comments we have import useEffect useState from react import Comment from Comment const Comments selectedUserId gt const comments setComments useState const input setInput useState async function sendComment const result await fetch http localhost comments method POST headers Content Type application json body JSON stringify body input authorId selectedUserId const comment await result json setComments comments gt comments comment async function fetchComments const result await fetch http localhost comments const comments await result json setComments comments useEffect gt fetchComments return lt div className Comments gt lt h className Comments title gt comments length comment comments length comments lt h gt lt div className Comments list gt comments map comment gt lt Comment key comment id comment comment isYou selectedUserId comment authorId gt lt div gt lt div className Comments box gt lt form className onSubmit e gt e preventDefault sendComment input setInput gt lt textarea value input onChange e gt setInput e target value name body className Comments box input gt lt button type submit disabled selectedUserId className Comments box btn gt Send lt button gt lt form gt lt div gt lt div gt export default Comments There s quite a bit happening in here so let s walk through it We setup a piece of state comments to keep track of the currently fetched comments We fetch all of the existing comments from the API by calling the fetchComments function on mount We have a form where we can post new comments which calls the sendComment function Once a comment has been successfully sent we store it in the comments state Updating our App componentInside src App js we re going to set up the main component structure import useEffect useState from react import App css import Comments from components Comments import Header from components Header function App const users setUsers useState const selectedUserId setSelectedUserId useState async function fetchUsers const result await fetch http localhost users const users await result json setUsers users useEffect gt fetchUsers return lt div className App gt lt Header users users selectedUserId selectedUserId setSelectedUserId setSelectedUserId gt lt Comments selectedUserId selectedUserId gt lt div gt export default App Again there are a few things going on here so let s break it down We keep track of fetched users in state as users When the component mounts we fetch all users from the API by calling the fetchUsers function We also keep track of the selectedUserId which represents which user we ve selected We pass the selectedUserId and setSelectedUserId components down to the child components Styling our applicationFor our styling you can replace the contents of the src App css file with App display flex flex direction column height vh width vw background color c Header display flex padding px px height px background color b border bottom px solid f Header notifications margin left auto position relative Header user display flex align items center Comments width px margin left auto height display flex flex direction column background color b Comments title color fff margin px font size px font weight normal Comments list overflow y auto border top px solid f Comments box margin top auto border top px solid f padding px Comments box input background color rgb border px solid transparent font family inherit font size px color fff display block box sizing border box width height px padding px border radius px margin bottom px Comments box input focus Comments box input active border color rgb appearance none Comments box btn background color rgb color fff border px solid transparent padding px px display inline block appearance none font family inherit font size px border radius px margin left auto Comments box btn disabled background color ccc Comment padding px border bottom px solid f color fff Comment header margin bottom px display flex align items center Comment avatar width px height px background color c border radius margin right px overflow hidden Comment avatar img width height Comment author font weight font size px margin right px Comment time font size px color rgb Comment body margin left px You should now have a functioning styled React application that allows you to select a user in the top left corner and post a comment as that user What you might notice at this stage is that our application does not post any sent comments in real time to any other users who are looking at the application We re going to fix this next Adding Socket io to our application for real time communication between React and Node jsOur goal now is to add real time support to our client and our server so that whenever a comment is posted everyone viewing the comments page will receive the comment This is where Socket io is useful We can add websocket support to our Node js server and have users connect to receive comments created in real time Let s start by adding Socket io in our webserver Inside our server index js file we ll add the necessary socket io setup code Add this to where your other requires areconst io require socket io http cors origin http localhost Above our app get users handlerio on connection socket gt console log socket id user just connected socket on disconnect gt console log A user disconnected This sets up our socket io websocket server and allows a cross origin websocket request to be made from our client application which is running on port We ll also automatically log when a user connects and disconnects from the websocket which happens when the websocket connection is terminated from the client The next step in our server is to broadcast any new comments that are created over a channel in socket io so that we can receive them on the client To do so we ll change our create comment endpoint handler to emit the created comment Replace our create comment handlerapp post comments async req res gt const comment createComment req body io emit new comment comment res json comment Here we re saying to socket io to emit broadcast to all connected clients on the new comment channel and send a payload that includes the created comment When we listen for this event in our client application we ll be able to receive the created comment and add it to the list of comments that we have available in state And now let s implement the changes required on the client Inside the client directory let s install the socket io client library which allows us to connect from the client to the web socket connection on the server npm install socket io clientAnd in client src App js we re going to set up the websocket connection Add with other importsimport io from socket io client Before the component definition const socket io connect http localhost function App Next we re going to pass this newly created socket to our Comments component in our src App js component so we have it accessible in the Comments component lt Comments socket socket selectedUserId selectedUserId gt And now in src components Comments js we ll add our real time support for creating and receiving a comment Let s extract the passed in socket prop in our component definition const Comments socket selectedUserId gt Same component codeAnd now we want to connect to our new comment channel when the component mounts so we ll add a new useEffect hook that will handle the socket setup code for us useEffect gt socket on new comment comment gt Only insert comments when the current user is not the author if comment author id selectedUserId setComments comments gt comments comment return gt socket off new comment setComments socket selectedUserId Here we re saying that every time a new comment event is received we want to append that comment to the list of comments that we already have in our comments state We use the function setter to do this so that any existing comments in state are preserved Note that we re also returning a cleanup function to stop listening to the channel once the component unmounts the return from the useEffect does this One other important line to note here is that we re not appending the comment to our list of comments when the selected user is the author This avoids the duplicate comment problem where we add the comment to the list of comments in state twice once when it s been created in the sendComment handler and once when it s broadcast in the new comment channel And with that we should now have a fully functioning real time commenting app You can try it out by opening up two browser windows selecting different users and posting a few comments You should see the comments coming in real time to each connected user Using Knock to send cross channel notificationsCommenting is a common use case for where you ll likely want to add some notifications to your product In a collaboration product with commenting you can imagine needing to add both an in app notification feed of comments that have been left as well as an email summarizing any missed comments while the user was away from the product and did not see their notifications This is where Knock can help Knock is a developer tool for building cross channel notification systems With Knock you can create complex cross channel notifications for your product without the need to build out the system yourself You call Knock s API and you can send notifications with a single API call to in app and out of app channels like email push SMS and Slack When it comes to integrating an in app notification feed Knock s pre built React feed components comes ready out of the box with real time behavior live updating badge counts and the ability to mark notifications as read or seen You can use the in app notification components to effortlessly get in app notification inboxes feeds or toasts up and running in a matter of hours all powered by Knock s scalable and reliable notification engine In addition to powering in app notifications Knock takes care of batching collapsing multiple notifications about a single topic into one intelligent orchestration send to email only if the in app notification has been seen managing user preferences and gives you unparalleled visibility into the notifications your product is sending If you d like to try it out you can sign up for a free account or book a demo 2023-02-17 15:38:16
海外TECH DEV Community 2023 Started https://dev.to/constantinrazvan/2023-started-3dh4 StartedHello everyone started since almost two months ago What tehnology do you think will be popular this year In my opinion I think this year popular will be ML AI and Mobile I am not familiar with ML and AI so I will talk about Mobile Why do I think mobile will be popular this year I think Mobile Development will popular this year because a mobile app will help you to reach customer much better than a simple website Trough mobile development you can access notifications you can create Widgets and many many more things which will make your user experience better What programming languages should I choose for Mobile Development Well there are many languages and frameworks which can help you to develop mobile applications I will make a list Cross Platform write once run on Android and iOS React Native gt It s a framework based on JavaScript Xamarin gt Framework based on C Flutter gt Framework based on DartNative Kotlin gt Programming language for writing Mobile Apps for Android Swift gt Programming language for writing Mobile Apps for iOS WatchOS iPad 2023-02-17 15:00:54
Apple AppleInsider - Frontpage News What is Display Scaling on Mac, and why you (probably) shouldn't worry about it https://appleinsider.com/inside/macos/tips/what-is-display-scaling-on-mac-and-why-you-probably-shouldnt-worry-about-it?utm_medium=rss What is Display Scaling on Mac and why you probably shouldn x t worry about itDisplay scaling makes the size of your Mac s interface more comfortable on non Retina monitors but incurs some visual and performance penalties We explain these effects and how much they matter A MacBook connected to an external monitor In a world where Apple s idea of display resolution is different from that of the PC monitor industry it s time to make sense of how these two standards meet and meld on your Mac s desktop Read more 2023-02-17 15:47:11
Apple AppleInsider - Frontpage News Apple may be getting a slice of Google Chrome search earnings https://appleinsider.com/articles/23/02/17/apple-may-be-getting-a-slice-of-google-chrome-search-earnings?utm_medium=rss Apple may be getting a slice of Google Chrome search earningsA UK regulator appears to have discovered but then redacted that Google has been paying Apple search revenues generated through Chrome in order to discourage it from launching a rival system Google Chrome iconApple has regularly been rumored to be working on its own search engine to rival Google It appears it could be in the company s interest to not do so Read more 2023-02-17 15:07:38
海外TECH Engadget The FTC is opening a tech-focused office to help it keep up with Silicon Valley https://www.engadget.com/the-ftc-is-opening-a-tech-focused-office-to-help-it-keep-up-with-silicon-valley-152226979.html?src=rss The FTC is opening a tech focused office to help it keep up with Silicon ValleyThe Federal Trade Commission is opening a dedicated technology office that will place Silicon Valley under more scrutiny and help it stay on top of emerging tech and trends in a fast moving market Commissioners voted on Thursday to create the office Under the direction of chair Lina Khan the FTC has trained its focus on tech companies Last year Epic Games agreed to a record million settlement following FTC allegations that it violated the Children s Online Privacy Protection Act The agency has also attempted to block Microsoft s proposed takeover of Activision Blizzard and sued to stop NVIDIA from buying ARM NVIDIA backed out of the deal Moreover the FTC has looked into Amazon s purchases of One Medical and MGM according to reports However the agency failed in an attempt to block Meta s takeover of Within “For more than a century the FTC has worked to keep pace with new markets and ever changing technologies by building internal expertise quot Khan said in a statement quot Our office of technology is a natural next step in ensuring we have the in house skills needed to fully grasp evolving technologies and market trends as we continue to tackle unlawful business practices and protect Americans The Office of Technology will support FTC s investigations by the antitrust and consumer protection divisions into business practices and the tech behind them It will advise FTC staff and commissioners on policy and research Additionally it will shine a spotlight on emerging tech and market trends that affect the FTC s work “Actually being able to have staff internally to approach these matters and help with subject matter expertise is critical quot FTC chief technology officer Stephanie Nguyen who will lead the department told The Washington Post The agency aims to more than double its number of technology focused staff from to around “The areas we will focus on is to work on cases Ngyuen said “This means understanding the specific market and business models This means articulating the platform s technologies and services And this means analyzing the competition and key market players With more expertise and a deeper understanding of how tech companies operate the office could help the agency fine tune subpoenas and the details of settlements to make them more impactful The team will help fellow FTC bureaus with other cases most companies use tech after all but its core mandate is to keep a close eye on the tech sector The move to create the office and expand the agency s roster of tech experts comes at a time of great upheaval in the industry Microsoft and Google recently detailed plans to embed AI chatbots into their search engines and other services 2023-02-17 15:22:26
Cisco Cisco Blog How The Week is shifting the cultural norm on climate engagement https://feedpress.me/link/23532/15980879/how-the-week-is-shifting-the-cultural-norm-on-climate-engagement How The Week is shifting the cultural norm on climate engagementThe Week is a recipient of funding through Cisco s climate portfolio and is on a mission to shift the cultural norm on climate engagement 2023-02-17 15:43:27
海外TECH CodeProject Latest Articles Data Visualization with .NET C# https://www.codeproject.com/Articles/5354650/Data-Visualization-with-NET-Csharp Data Visualization with NET C In this article we ll take a closer look at List Label and some of the key features and benefits making it a great choice for developers looking to equip their applications with solid data visualization capabilities 2023-02-17 15:14:00
金融 金融庁ホームページ 金融機関における貸付条件の変更等の状況について更新しました。 https://www.fsa.go.jp/ordinary/coronavirus202001/kashitsuke/20200430.html 金融機関 2023-02-17 17:00:00
金融 金融庁ホームページ 「新型コロナウイルス感染症関連情報」特設ページを更新しました。 https://www.fsa.go.jp/ordinary/coronavirus202001/press.html 感染拡大 2023-02-17 17:00:00
金融 金融庁ホームページ 「インパクト投資等に関する検討会」(第5回)を開催します。 https://www.fsa.go.jp/news/r4/singi/20230217.html 検討会 2023-02-17 17:00:00
金融 金融庁ホームページ 「事務ガイドライン(第三分冊:金融会社関係)」の一部改正(案)を公表しました。 https://www.fsa.go.jp/news/r4/sonota/20230217-2/20230217-2.html 関係 2023-02-17 17:00:00
金融 金融庁ホームページ エヌエヌ生命保険株式会社に対する行政処分について公表しました。 https://www.fsa.go.jp/news/r4/hoken/20230217/20230217-1.html 株式会社 2023-02-17 16:00:00
ニュース BBC News - Home Ex-officers plead not guilty over Tyre Nichols death https://www.bbc.co.uk/news/world-us-canada-64680815?at_medium=RSS&at_campaign=KARANGA memphis 2023-02-17 15:40:03
ニュース BBC News - Home NI post-Brexit trade faces big moment, says DUP https://www.bbc.co.uk/news/uk-northern-ireland-64671210?at_medium=RSS&at_campaign=KARANGA brexit 2023-02-17 15:03:46
ニュース BBC News - Home Power cuts and schools closed as Storm Otto hits https://www.bbc.co.uk/news/uk-scotland-64662300?at_medium=RSS&at_campaign=KARANGA leaves 2023-02-17 15:44:04
ニュース BBC News - Home Bus £2 fare cap extended for three months https://www.bbc.co.uk/news/business-64678990?at_medium=RSS&at_campaign=KARANGA hundreds 2023-02-17 15:52:41
ニュース BBC News - Home Humza Yousaf 'seriously considering' SNP leadership bid https://www.bbc.co.uk/news/uk-scotland-scotland-politics-64677180?at_medium=RSS&at_campaign=KARANGA bidscotland 2023-02-17 15:18:35

コメント

このブログの人気の投稿

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