IT |
ITmedia 総合記事一覧 |
[ITmedia News] Xでのマスク氏の“戦い”ポストにザッカーバーグ氏がスレッズで応酬 |
https://www.itmedia.co.jp/news/articles/2308/08/news077.html
|
itmedianewsx |
2023-08-08 06:33:00 |
IT |
ITmedia 総合記事一覧 |
[ITmedia ビジネスオンライン] ビッグモーター不正 忖度した「中間管理職」は加害者か被害者か? |
https://www.itmedia.co.jp/business/articles/2308/08/news011.html
|
itmedia |
2023-08-08 06:30:00 |
TECH |
Techable(テッカブル) |
患者と面会者がメタバースでハイタッチ、お出かけ。リモートでも“ぬくもりのある面会”を実現するアプリ |
https://techable.jp/archives/216077
|
medicalmeetup |
2023-08-07 21:00:22 |
AWS |
AWS |
Data Strategy Unravelled: Creating Business Value with GenAI - Part 1 | Amazon Web Services |
https://www.youtube.com/watch?v=8VtNW-bIIHA
|
Data Strategy Unravelled Creating Business Value with GenAI Part Amazon Web ServicesIn this video Khendr a Reid Principal Data Strategy Tech Specialist at AWS meets with Kathy Koontz Principal Data Strategist at AWS to understand what GenAI is and how organizations can create business value from it discuss how to Create Business Value with GenAI About Data Strategy Unravelled A New Vantage study found of blue chip companies are investing in data yet only have successfully created a data driven organization Data Strategy Unravelled is a video series intended to help organizations become data driven This series interviews experienced professionals from both the business and technical realms to discuss topics and strategies that organizations can implement to become data driven Learn more at Subscribe More AWS videos More AWS events videos Do you have technical AWS questions Ask the community of experts on AWS re Post ABOUT AWSAmazon Web Services AWS is the world s most comprehensive and broadly adopted cloud platform offering over fully featured services from data centers globally Millions of customers ーincluding the fastest growing startups largest enterprises and leading government agencies ーare using AWS to lower costs become more agile and innovate faster AWSforData DataDriven DataStrategy DataStrategyUnravelled GenAI GenerativeAI Data Analytics AWS AmazonWebServices CloudComputing |
2023-08-07 21:22:24 |
海外TECH |
Ars Technica |
Starliner undergoing three independent investigations as flight slips to 2024 |
https://arstechnica.com/?p=1959382
|
changes |
2023-08-07 21:07:45 |
海外TECH |
DEV Community |
Building a Real-Time Chat Gateway with NestJS: Testing WebSocket Features and Implementing Simple Private Messaging |
https://dev.to/jfrancai/building-a-real-time-chat-gateway-with-nestjs-testing-websocket-features-and-implementing-simple-private-messaging-467l
|
Building a Real Time Chat Gateway with NestJS Testing WebSocket Features and Implementing Simple Private Messaging IntroductionWebSocket technology has revolutionized real time communication on the web enabling bidirectional data flow between clients and servers NestJS a powerful Node js framework provides excellent support for building WebSocket applications using its WebSocket Gateways In this guide we will explore how to effectively test NestJS WebSocket Gateways step by step In the first part of this series we started by setting up a basic NestJS application and explored how to effectively test WebSocket gateways using Jest and Socket IO In this second part we will build on the foundation laid in the previous article and dive deeper into testing by implementing new features for our chat gateway We will also explore more advanced testing techniques to ensure the reliability of our chat WebSocket gateway Let s get started Disclaimer It s important to note that there is no need to follow the previous part of this series to understand and follow along with this article However if you are interested in the initial setup and testing of WebSocket gateways using Jest and Socket IO you can find the first part of the series here Part Setting Up the Project and DependenciesNext we will clone a sample repository that we ll use as the starting point for our project Use the following commands to clone the repository git clone nest appAnd navigate into the project folder cd nest appNow let s take a look at the folder structure of the project ├ーnest cli json├ーpackage json├ーpackage lock json├ーREADME md├ーsrc│ ├ーapp controller spec ts│ ├ーapp controller ts│ ├ーapp module ts│ ├ーapp service ts│ ├ーchat│ │ ├ーchat gateway spec ts│ │ └ーchat gateway ts│ └ーmain ts├ーtest│ ├ーapp ee spec ts│ └ーjest ee json├ーtsconfig build json└ーtsconfig jsonIn the src folder you ll find various files related to the NestJS application including the WebSocket Gateway for the chat module The test folder contains end to end testing files we are not going to use it for now and the package json file lists the project s dependencies Setting Up Your Own Git RepositorySince we cloned the sample repository it is essential to set up your own Git repository for your project We ll start by removing the current git folder rm rf gitNext initialize a new Git repository in the project folder git initgit add git commit m first commit With this you have your own Git repository ready to track your project s changes Install Node DependenciesNow let s install the necessary Node js dependencies for our project Run the following command to install them npm installThe package json file contains the list of dependencies required for the project dependencies nestjs platform socket io nestjs websockets devDependencies socket io client Note that we have socket io client installed as a dev dependency which will be used to test our application backend Additionally the jest configuration in the same file sets up the testing environment Jest ConfigurationJest is the default testing library provided with NestJS The configuration for Jest can be found in the package json file jest moduleFileExtensions js json ts rootDir src testRegex spec ts transform t j s ts jest collectCoverageFrom t j s coverageDirectory coverage testEnvironment node For more detailed information on Jest configuration options you can refer to the official Jest documentation available here Starting Jest Watch ModeNow that we have everything set up we can start Jest in watch mode which allows it to automatically rerun the test suite whenever a file change is detected Open a new shell window and run the following command npm run test watchThis command executes Jest in watch mode If you look inside the package json file you ll find the actual command used jest watch scripts start watch jest watch With Jest running in watch mode you can now develop your NestJS WebSocket Gateway and have your tests automatically updated and executed on each change Part Updating Existing TestsLet s start by updating the test we wrote in the previous article to make it more readable and reusable The test was responsible for checking if the server responds with pong when it receives a ping event Here s the original test it should emit pong on ping async gt ioClient connect ioClient emit ping Hello world await new Promise lt void gt resolve gt ioClient on connect gt console log connected ioClient on pong data gt expect data toBe Hello world resolve ioClient disconnect While this test works it can be improved for better readability and reusability To achieve this we will create a helper function called eventReception which will handle the asynchronous event reception during testing The eventReception Helper FunctionLet s create the eventReception function inside the chat gateway spec ts file async function eventReception from Socket event string Promise lt void gt return new Promise lt void gt resolve gt from on event gt resolve This function takes two parameters from A socket object in this case the client socket event The name of the event we expect the client to receive The function returns a new Promise which will resolve when the specified event is received from the client This allows us to await the reception of a specific event in our test Note Before proceeding let s briefly explain the concept of async await and promises which might have been covered too quickly in the previous article JavaScript PromiseA Promise is an object representing the eventual completion or failure of an asynchronous operation and its resulting value It allows you to handle asynchronous operations in a more structured and readable way avoiding the use of nested callbacks Understanding Async AwaitIn JavaScript asynchronous operations are common when dealing with tasks like fetching data from an API reading files or making network requests Traditionally asynchronous code was handled using callbacks but it could lead to callback hell and make the code difficult to read and maintain To address these issues ECMAScript ES introduced the async and await keywords which provide a more elegant way to write asynchronous code in a synchronous style Here s a breakdown of how async and await work async FunctionWhen you define a function with the async keyword it becomes an asynchronous function An asynchronous function always returns a Promise implicitly The function can contain one or more asynchronous operations such as API calls or file reads async function fetchData Asynchronous operations can be performed here return result The function returns a Promise await OperatorThe await keyword is used inside an async function to wait for the resolution of a Promise When you use await the function execution will pause until the Promise is resolved or rejected This allows you to handle asynchronous code in a more sequential manner making it easier to read and write async function fetchData const result await fetch Code here will wait until the fetch Promise is resolved return result Error HandlingAsync functions can also use try catch to handle errors from awaited promises If the awaited Promise is rejected the catch block will catch the error async function fetchData try const result await fetch return result catch error Handle the error here The async and await keywords offer a more structured and readable way to work with asynchronous operations in JavaScript By using async await you can avoid the complexities of nested callbacks and write asynchronous code in a style that resembles synchronous code This feature is especially useful for writing clear and maintainable tests that involve asynchronous operations Rewriting the Test Using eventReceptionNow that we have the eventReception helper function let s rewrite our test it should emit pong on ping async gt ioClient on connect gt console log connected ioClient on pong data gt expect data toBe Hello world ioClient connect await eventReception ioClient connect ioClient emit ping Hello world await eventReception ioClient pong ioClient disconnect With the eventReception function our test becomes cleaner more readable and easily reusable in other tests In the next part we will delve into implementing new features for our chat gateway We ll enable user private messaging Additionally we ll emit an event to notify all clients when a new user joins the server Part Implementing Private MessagingLet s start by writing a test for the private messaging feature The test will ensure that a message sent from one client socket ioClient is received by another client socket receiverClient as a private message Here s the test it should send a private message to another client async gt receiverClient on private message data gt expect data toHaveProperty from expect data from toBe ioClient id expect data toHaveProperty message expect data message toBe Hello from the other side ioClient connect await eventReception ioClient connect receiverClient connect await eventReception receiverClient connect ioClient emit private message from ioClient id to receiverClient id message Hello from the other side await eventReception receiverClient private message ioClient disconnect receiverClient disconnect We create an event listener on the receiverClient for the private message event The test checks if the received data object contains properties for from and message and if the values are as expected We connect both ioClient and receiverClient to the chat gateway using ioClient connect and receiverClient connect respectively We then use the eventReception helper function to wait for the connect event to be emitted on both clients before proceeding with the test Next we use ioClient emit private message to send a private message from ioClient to receiverClient The message object contains from to and message properties Finally we use eventReception receiverClient private message to wait for the private message event to be received by receiverClient The test ensures that the private message is correctly sent and received between the two clients Note In the test setup the receiverClient is declared in the beforeEach section of the test suite like for ioClient The beforeEach function is a hook provided by Jest and it is executed before each test case in the current test suite describe ChatGateway gt let receiverClient Socket beforeEach async gt receiverClient io http localhost autoConnect false transports websocket polling Implementing Private Messaging in the Chat GatewayTo pass the test we need to add the code that handles private messages in our ChatGateway class controller Add the following code to the ChatGateway class controller in src chat chat gateway ts SubscribeMessage private message handlePrivateMessage client any data any client to data to emit private message from client id message data message The handlePrivateMessage function is a WebSocket event handler for the private message event When the server receives a private message event from a client it will call this function Inside the function we use the client to data to emit method to send the private message to the specified recipient data to The message object contains the sender s ID from and the message text message The test we wrote earlier ensures that private messages are correctly sent and received between clients Part Start Using Promise all In this part we will introduce a new feature for our chat gateway We want clients to receive information about the list of already connected clients upon their own connection to the server We will achieve this by emitting a custom event called connected clients to each newly connected client Writing the TestLet s start by writing a test to ensure that the server sends the correct list of connected clients to a newly connected client We create an event listener on the receiverClient for the connected clients event When the server emits this event the test will check the data received We utilize Jest assertions to ensure that the received data is an array with a length of two Each element in the array should be an object containing a userID property with the corresponding ID of the ioClient and receiverClient respectively it should send the number of clients on the server when connecting async gt receiverClient on connected clients data gt expect data length toBe expect data toEqual expect arrayContaining expect objectContaining userID ioClient id expect objectContaining userID receiverClient id We connect both ioClient and receiverClient to the chat gateway using ioClient connect and receiverClient connect respectively We then use the eventReception helper function to wait for the connect event to be emitted on both clients before proceeding with the test it should send the number of clients on the server when connecting async gt ioClient connect await eventReception ioClient connect receiverClient connect await eventReception receiverClient connect Next we use eventReception receiverClient connected clients to wait for the connected clients event to be received by receiverClient This ensures that the server has sent the list of connected clients to the newly connected client it should send the number of clients on the server when connecting async gt await eventReception receiverClient connected clients And we don t forget to disconnect clients once the test is finishing ioClient disconnect receiverClient disconnect The test ensures that the server correctly sends the list of connected clients to each client upon connection Implementing the connected clients FeatureNow that the test has been written we need to implement the connected clients feature in our ChatGateway class controller Update the handleConnection function in src chat chat gateway ts handleConnection client any args any const sockets this io sockets this logger log Client id client id connected this logger debug Number of connected clients sockets size const connectedClients Array from sockets map socket gt userID socket id client emit connected clients connectedClients In the handleConnection function we first collect all the sockets connected to the server using this io sockets Then we create an array of objects containing the userID of each connected client Finally we emit the connected clients event to the newly connected client client with the list of connected clients connectedClients And the test should pass But this approach may not always work as expected depending on the situation In some cases using the following code await eventReception receiverClient connect followed by await eventReception receiverClient connected clients may cause your test to pass or fail based on the delay between the connect event and the connected clients event If the connected clients event arrives too quickly after the connect event it may result in a test timeout on the second await eventReception call To address this issue there are two approaches we can consider Approach Removing the await eventReception receiverClient connect line as we have already tested the connect event in a previous test However this is more of a workaround and does not solve the underlying problem Additionally in other scenarios we might want to test the arrival of multiple messages not knowing which one arrives first Approach Using Promise allPromise all is a built in JavaScript function that takes an array of promises and returns a new promise that resolves when all the promises in the array have resolved or rejects if any of the promises reject Here s how we can use Promise all to handle multiple awaited events await Promise all eventReception receiverClient connect eventReception receiverClient connected clients With Promise all both eventReception promises will be executed simultaneously and the test will wait for both events to be received before proceeding to the next step By using Promise all we can maintain a clean and expressive writing style for our tests while ensuring that we handle multiple awaited events efficiently and reliably ConclusionIn this article we delved into enhancing our NestJS WebSocket gateway by implementing new features and writing effective tests using Jest and Socket IO We started by introducing private messaging allowing clients to send messages directly to each other We then explored how to emit an event containing the list of already connected clients to newly connected clients Throughout the process we leveraged Jest s powerful assertion functions to validate the behavior of our chat gateway and ensure that it functions as intended Additionally we utilized async await to handle asynchronous operations in a more synchronous and readable manner making our tests more manageable and organized We also encountered challenges such as handling multiple awaited events which we skillfully resolved using Promise all This allowed us to efficiently synchronize and manage multiple asynchronous events in our tests providing a robust testing framework for future enhancements In conclusion I hope that this step by step guide has simplified the process of building a NestJS WebSocket gateway and provided valuable insights into effective testing strategies If you enjoyed reading this article and found it helpful please consider giving it a thumbs up or leaving a comment below Your feedback and engagement encourage me to create more content like this helping the community learn and grow together Happy coding |
2023-08-07 21:26:55 |
海外TECH |
Engadget |
Zoom reverses policy that allowed it to train AI on customer data |
https://www.engadget.com/zoom-reverses-policy-that-allowed-it-to-train-ai-on-customer-data-212230598.html?src=rss
|
Zoom reverses policy that allowed it to train AI on customer dataZoom has made changes to its terms of service after online blowback over recent updates to the company s fine print allowing AI training on customer data A report from StackDiary over the weekend highlighted how the changes which rolled out in March without fanfare appeared to grant the company sweeping control over customer data for AI training purposes In response Zoom published a blog post today claiming it wouldn t do what its terms said it could do the company then updated its terms in response to the continued blowback It now says it doesn t train AI models on consumer video audio or chats “without customer consent At least part of the issue stemmed from Zoom s experimental AI tools including IQ Meeting Summary ML powered summarizations and IQ Team Chat Compose AI powered message drafting Although account owners have to provide consent before starting a meeting using these tools additional participants are only presented with two options accept the terms and join the meeting or reject them and leave the meeting “What raises alarm is the explicit mention of the company s right to use this data for machine learning and artificial intelligence including training and tuning of algorithms and models Alex Ivanovs wrote for Stack Diary “This effectively allows Zoom to train its AI on customer content without providing an opt out option a decision that is likely to spark significant debate about user privacy and consent Ivanovs highlighted how the terms give it the right to “redistribute publish import access use store transmit review disclose preserve extract modify reproduce share use display copy distribute translate transcribe create derivative works and process Customer Content and to perform all acts with respect to the Customer Content In the company blog post published today Zoom s Chief Product Officer Smita Hashim stressed that account owners and administrators indeed have to provide consent before choosing to share their data for AI training insisting it s “used solely to improve the performance and accuracy of these AI services Hashim added that “even if you chose to share your data it will not be used for training of any third party models Continuing she wrote “We have permission to use this customer content to provide value added services based on this content but our customers continue to own and control their content For example a customer may have a webinar that they ask us to livestream on YouTube Even if we use the customer video and audio content to livestream they own the underlying content “We will not use customer content including education records or protected health information to train our artificial intelligence models without your consent the blog post reads A new section added to Zoom s terms today makes it clearer “Notwithstanding the above Zoom will not use audio video or chat Customer Content to train our artificial intelligence models without your consent “Our goal is to enable Zoom account owners and administrators to have control over these features and decisions and we re here to shed light on how we do that and how that affects certain customer groups Hashim wrote This article originally appeared on Engadget at |
2023-08-07 21:22:30 |
海外TECH |
Engadget |
Boeing's Starliner could be ready for crewed flights by next March |
https://www.engadget.com/boeings-starliner-could-be-ready-for-crewed-flights-by-next-march-210222245.html?src=rss
|
Boeing x s Starliner could be ready for crewed flights by next MarchBoeing has rediscovered just how hard space can be in recent months as its ambitious Starliner program has been repeatedly sidelined by lingering technical issues However the company announced at a press conference Monday that it is confident that it will have those issues ironed out by next March and will be ready to test its reusable crew capsule with live NASA astronauts aboard “Based on the current plans we re anticipating that we re going to be ready with the spacecraft in early March That does not mean we have a launch date in early March Boeing VP and Starliner manager Mark Nappi stressed during the event per CNBC “We re now working with NASA Commercial Crew program and International Space Station and ULA on potential launch dates based on our readiness we ll work throughout the next several weeks and see where we can get fit in and then then we ll set a launch date The Starliner has been in development for nearly fifteen years now first being unveiled in It s Boeing s entry into the reusable crew capsule race which is currently being dominated by SpaceX with its Dragon nbsp The two companies were actually awarded grants at the same time in to develop systems capable of transporting astronauts to the ISS with a contract deadline of By Boeing s first scheduled launch had already been pushed from to late By April NASA was tempering its launch expectations to between and The first uncrewed orbital test flight in late failed to reach orbit which further delayed the project NASA however did agree to pay for a second uncrewed test in August of That test never made it off the launch pad due to a valve issue Fixing that problem took until the following May when the follow up test flight completed successfully The two subsequent preparatory attempts for a crewed flight did not The scheduled July flight was scrubbed after faults were discovered in both the parachute system and wiring harnesses Which brings us to March which is when Boeing is confident its Starliner will successfully shuttle a pair of NASA astronauts to the ISS for a weeklong stay To date Boeing is estimated to have incurred around billion in project cost overruns nbsp nbsp nbsp This article originally appeared on Engadget at |
2023-08-07 21:02:22 |
海外科学 |
NYT > Science |
Our Galaxy Is Home to Trillions of Worlds Gone Rogue |
https://www.nytimes.com/2023/08/06/science/rogue-planets-milky-way.html
|
galaxy |
2023-08-07 21:30:59 |
ニュース |
BBC News - Home |
Man charged over death of 12-year-old on M62 |
https://www.bbc.co.uk/news/uk-england-leeds-66434750?at_medium=RSS&at_campaign=KARANGA
|
yorkshire |
2023-08-07 21:45:52 |
ニュース |
BBC News - Home |
Zoom orders workers back to the office |
https://www.bbc.co.uk/news/business-66432173?at_medium=RSS&at_campaign=KARANGA
|
company |
2023-08-07 21:31:45 |
ビジネス |
東洋経済オンライン |
こんなに物価高なのに「2%目標は未達」でいいのか 日銀が依拠する「物価見通し」の精度を確かめる | 政策 | 東洋経済オンライン |
https://toyokeizai.net/articles/-/692826?utm_source=rss&utm_medium=http&utm_campaign=link_back
|
東洋経済オンライン |
2023-08-08 06:40:00 |
コメント
コメントを投稿