投稿時間:2023-07-31 18:30:08 RSSフィード2023-07-31 18:00 分まとめ(32件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
ROBOT ロボスタ 東京ミッドタウン八重洲で人の代わりに配送ロボットがデリバリーサービス 出前館/三井不動産/TIS/アスラテックが共同で https://robotstart.info/2023/07/31/demaekan-deliveryrobot.html 東京ミッドタウン八重洲で人の代わりに配送ロボットがデリバリーサービス出前館三井不動産TISアスラテックが共同でシェアツイートはてブ出前館は、三井不動産が管理する東京ミッドタウン八重洲東京都中央区にて、デリバリーロボットを活用したデリバリーサービスに参画。 2023-07-31 08:53:16
IT ITmedia 総合記事一覧 [ITmedia Mobile] カード式の「Suica」と「PASMO」、8月2日から記名式も販売休止 モバイルSuica/PASMOの利用を呼びかけ https://www.itmedia.co.jp/mobile/articles/2307/31/news159.html itmediamobile 2023-07-31 17:15:00
IT ITmedia 総合記事一覧 [ITmedia ビジネスオンライン] 自治体提供の「地域DXアプリ」 誰が・どのように利用している? https://www.itmedia.co.jp/business/articles/2307/31/news132.html dearone 2023-07-31 17:12:00
IT ITmedia 総合記事一覧 [ITmedia News] 「Suica」「PASMO」カード、記名式も販売中止に 8月2日から https://www.itmedia.co.jp/news/articles/2307/31/news158.html itmedia 2023-07-31 17:10:00
AWS AWS Japan Blog Nx と AWS Amplify Hosting を用いて Next.js アプリ間でコードを共有する https://aws.amazon.com/jp/blogs/news/share-code-between-next-js-apps-with-nx-on-aws-amplify-hosting/ NxとAWSAmplifyHostingを用いてNextjsアプリ間でコードを共有するこの記事では、AWSAmplifyHostingがモノレポ、特にNxと連携し、モノレポで管理されているフロントエンドアプリケーションをデプロイする機能を探ります。 2023-07-31 08:20:55
python Pythonタグが付けられた新着投稿 - Qiita 特異値分解と低ランク近似 https://qiita.com/bokuikkun/items/6486d4d78c0710df7c54 参考書籍 2023-07-31 17:23:38
js JavaScriptタグが付けられた新着投稿 - Qiita 【JavaScript】西暦を和暦に変換する10のパターン https://qiita.com/mori_goq/items/f8db30ca2bbae3cc5d0f constdatenewdate 2023-07-31 17:29:58
js JavaScriptタグが付けられた新着投稿 - Qiita ElectronでHTMLコンテンツをPDF出力する方法 https://qiita.com/maru_dev/items/48b0d0764147e2fb2e74 electron 2023-07-31 17:27:27
Ruby Rubyタグが付けられた新着投稿 - Qiita Ruby on Railsのエラー画面の読み方 https://qiita.com/lemonade_37/items/17ec25ebd38f8b231e9e rubyonrails 2023-07-31 17:40:25
Linux Ubuntuタグが付けられた新着投稿 - Qiita Quarkus Webサービスで Hello World する https://qiita.com/fsdg-adachi_h/items/695b6b5bc31adee105c9 fsdgadachih 2023-07-31 17:02:55
AWS AWSタグが付けられた新着投稿 - Qiita [AWS Q&A 365][StepFunction]AWSのよくある問題の毎日5選 #101 https://qiita.com/shinonome_taku/items/e112c5344bd2fa525295 awsqampastepfunctionaws 2023-07-31 17:34:18
AWS AWSタグが付けられた新着投稿 - Qiita [AWS Q&A 365][StepFunction]Daily Five Common Questions #101 https://qiita.com/shinonome_taku/items/c5bc104a691b50cab4c6 stepfunction 2023-07-31 17:32:36
golang Goタグが付けられた新着投稿 - Qiita 【Go】値レシーバーとポインタレシーバーの実装比較 https://qiita.com/Takuya__/items/c4f97fc00219b80e5208 fmttyperectanglestruct 2023-07-31 17:36:42
Ruby Railsタグが付けられた新着投稿 - Qiita Ruby on Railsのエラー画面の読み方 https://qiita.com/lemonade_37/items/17ec25ebd38f8b231e9e rubyonrails 2023-07-31 17:40:25
技術ブログ Developers.IO m1 MacbookにLlama 2をインストールして使ってみる https://dev.classmethod.jp/articles/15c6ef47d273a1d5c0f1891dd231a8718a836c3e/ apple 2023-07-31 08:29:31
技術ブログ Developers.IO 【Security Hub修復手順】[CloudFront.4] CloudFront ディストリビューションでは、オリジンフェイルオーバーが設定されている必要があります https://dev.classmethod.jp/articles/securityhub-fsbp-remediation-cloudfront-4/ awssecurityhub 2023-07-31 08:06:17
技術ブログ Hatena::Engineering はてなのポッドキャスト Backyard Hatena #27 - うごメモはてなの思い出、プランナーの頭の中(id:sawaccio) #byhatena https://developer.hatenastaff.com/entry/2023/07/31/173000 はてなのポッドキャストBackyardHatenaうごメモはてなの思い出、プランナーの頭の中idsawacciobyhatenaはてな「技術グループ」によるポッドキャスト「BackyardHatena」を更新。 2023-07-31 17:30:00
海外TECH DEV Community Create an URL Shortener Using Rebrandly API and LocalStorage https://dev.to/sh20raj/create-an-url-shortener-using-rebrandly-api-and-localstorage-1j14 Create an URL Shortener Using Rebrandly API and LocalStorageTitle How to Create an URL Shortener Using Rebrandly LocalStorage Bootstrap and jQueryIntroduction URL shorteners are handy tools that allow you to condense long and complex URLs into shorter more user friendly versions In this step by step guide we will show you how to build your own URL shortener using Rebrandly API for shortening URLs LocalStorage to store and display the links Bootstrap for styling and jQuery for handling form submissions and AJAX requests This SEO friendly URL shortener will allow you to create shortened links and store them locally in the browser making it an excellent project to learn and apply various web development techniques Step Setting up the ProjectLet s start by creating the basic HTML structure for our URL shortener We ll include the required Bootstrap CSS and JavaScript files and create a form to input the long URLs Additionally we ll add a container to display the shortened URLs and the Copy button lt Paste this code inside the lt body gt tag gt lt div class container mt gt lt h gt URLy Link Shortener lt h gt lt form id shortenForm class mt gt lt Input field for the long URL gt lt div class input group gt lt input type text id urlInput class form control placeholder Enter your URL here required gt lt div class input group append gt lt button type submit class btn btn primary gt Shorten URL lt button gt lt div gt lt div gt lt form gt lt Container to display the shortened URL and Copy button gt lt div id shortenedURLContainer class mt style display none gt lt h gt Shortened URL lt h gt lt div class input group gt lt input type text id shortenedURL class form control readonly gt lt div class input group append gt lt button id copyButton class btn btn secondary gt Copy lt button gt lt div gt lt div gt lt div gt lt Container to display the saved shortened URLs gt lt div class mt gt lt h gt Saved Shortened URLs lt h gt lt table class table table bordered gt lt thead gt lt tr gt lt th gt Shortened URL lt th gt lt th gt Full URL lt th gt lt th gt Date Time lt th gt lt th gt Copy lt th gt lt tr gt lt thead gt lt tbody id savedLinksBody gt lt tbody gt lt table gt lt div gt lt div gt Step Adding CSS and JavaScript LibrariesTo ensure that the project runs smoothly add the following links to the head section of your HTML file lt head gt lt title gt URLy Link Shortener lt title gt lt Bootstrap CSS gt lt link rel stylesheet href gt lt head gt Also include the Bootstrap and jQuery scripts just before the closing lt body gt tag lt Bootstrap JS and jQuery gt lt script src gt lt script gt lt script src popperjs core dist umd popper min js gt lt script gt lt script src gt lt script gt Step Setting Up Rebrandly APICreate a Rebrandly account and obtain your API key Replace YOUR REBRANDLY API KEY with your actual Rebrandly API key in the script section lt script gt const API KEY YOUR REBRANDLY API KEY const API URL lt script gt Step Creating the FunctionalityNext let s create JavaScript functions to handle form submissions shorten URLs using Rebrandly API and save the shortened URLs in LocalStorage lt script gt Check if local storage is available in the browser const isLocalStorageSupported typeof Storage undefined Function to display saved links from local storage function displaySavedLinks Display saved links on page load window addEventListener load gt displaySavedLinks Function to handle form submission document getElementById shortenForm addEventListener submit event gt event preventDefault const inputElement document getElementById urlInput const urlToShorten inputElement value shortenURL urlToShorten then shortenedURL gt catch error gt console error Error shortening URL error lt script gt Step Saving Shortened URLs to LocalStorageIn theshortenURL function save the shortened link info in LocalStorage and display the updated saved links lt script gt async function shortenURL url const response await fetch API URL method POST headers Content Type application json apikey API KEY body JSON stringify destination url if response ok throw new Error Failed to shorten URL const shortenedURL await response json const shortenedURLContainer document getElementById shortenedURLContainer const shortenedURLElement document getElementById shortenedURL const copyButton document getElementById copyButton shortenedURLElement value shortenedURL shortUrl shortenedURLContainer style display block if isLocalStorageSupported Save the shortened link info in local storage const savedLinks JSON parse localStorage getItem shortenedLinks savedLinks push shortUrl shortenedURL shortUrl fullUrl url dateTime new Date toLocaleString localStorage setItem shortenedLinks JSON stringify savedLinks Display updated saved links displaySavedLinks Enable the copy button copyButton disabled false return shortenedURL lt script gt Step Implementing the Copy to Clipboard FunctionFinally let s create a function to copy the shortened URL to the clipboard lt script gt function copyToClipboard text const tempElement document createElement textarea tempElement value text document body appendChild tempElement tempElement select document execCommand copy document body removeChild tempElement alert Copied to clipboard lt script gt Step Styling the PageFor styling we have already included Bootstrap CSS which provides a clean and responsive design for the URL shortener Step Full CodeHere is the full code for your SEO friendly URL shortener lt Paste the full code here gt lt script gt Complete script code from the previous steps lt script gt Step Try the DemoYou can see a live demo of the URL shortener at URLy Link Shortener Demo Conclusion Congratulations You have successfully built an SEO friendly URL shortener using Rebrandly API for shortening URLs LocalStorage for storing and displaying the links Bootstrap for styling and jQuery for handling form submissions and AJAX requests This project is a great way to learn about various web development concepts and improve your skills in front end development Feel free to explore and enhance the URL shortener further based on your requirements and preferences Happy coding 2023-07-31 08:29:55
海外TECH DEV Community AWS open source newsletter, #167 https://dev.to/aws/aws-open-source-newsletter-167-5bg7 AWS open source newsletter July st Instalment Welcome to of the AWS open source newsletter and another edition packed with new open source projects for you to explore Whether you are new to this newsletter or returning we thank you there is something for you This week we have projects that will help use Terraform to deploy your monolith applications a tool to accelerate your GraphQL building when working with Amazon DynamoDB a project that will help you introduce chaos without changes to your code and a couple of really nice demos of using generative AI that allows you to use natural language to query your data This edition is also packed with open source goodness covering topics across Terraform Rust LangChain Streamlit PostgreSQL Supabase OpenSearch Powertools for AWS Lambda Open Application Model Traefik Keycloak FastAPI PyTorch IAM Roles Anywhere Apache Iceberg Amazon EMR Apache Hudi Go Cedar RabbitMQ Pacu and many more Make sure to check out the events section too I am adding new events weekly so make sure you don t miss out FeedbackBefore you dive in however I need your help Please please please take minute to complete this short survey and you will forever have my gratitude Celebrating open source contributorsThe articles and projects shared in this newsletter are only possible thanks to the many contributors in open source I would like to shout out and thank those folks who really do power open source and enable us all to learn and build on top of what they have created So thank you to the following open source heroes Chuong Tran Chris Gary Stafford Efi Merdler Kravitz Matt Carey Sreekesh Iyer Dejanu Alex Lars Jacobsson Mark Sailes Tsahi Duek Andreas Lindh Siva Guruvareddiar Cameron Senese Joseph Keating Dinuth De Zoysa Virginia Chu Sarat Vemulapalli Dan Widdis Owais Kazi Daniel dB Doubrovkine Dagney Braun Minal Shah Fanit Kolchina Ravi Kumar Singh Kevin Wikant Micah Walter Yanko Bolanos Ramesh Mathikumar and Francesco Vergona Latest open source projectsThe great thing about open source projects is that you can review the source code If you like the look of these projects make sure you that take a look at the code and if it is useful to you get in touch with the maintainer to provide feedback suggestions or even submit a contribution The projects mentioned here do not represent any formal recommendation or endorsement I am just sharing for greater awareness as I think they look useful and interesting Toolsaws terrajetaws terrajet is a project from Chuong Tran Chris that aide from having a really cool project name aims to help Developers deploy their monolith application to AWS in the easiest and fastest way From the README we can see that TerraJet follows AWS best practices to help your infrastructure archives reliability security performance and cost optimisation Certainly looks interesting and got a lot of interest on Reddit aws dynasyncaws dynasync is fresh from the open source forge at awslabs and this project helps you create an AWS AppSync GraphQL API and an Amazon DynamoDB database with a single command You can automate the building and provisioning of a GraphQL API using a single config file with AWS AppSync and Amazon DynamoDb to store the data Nicely details documentation with examples means that if you are working in AWS AppSync and Amazon DynamoDB you have to try this out chaos lambda extensionchaos lambda extension AWS Hero Efi Merdler Kravitz is back with another tool that allows you to inject faults into Lambda functions without modifying the function code Unlike previous chaos implementations that required tight coupling with the Lambda runtime this extension is runtime agnostic It can operate with any runtime that utilises Amazon Linux The chaos extension is publicly available as a layer and you can easily incorporate the layer using the AWS Console or your preferred IAC solution Efi is on a mission to create Rust based tools that help AWS developers so check this out and let him know what you think Efi reach out and added It s a Rust written Lambda extension that introduces chaos but here s the kicker no code changes needed It s a bit of a game changer compared to other chaos utilities for Lambda Also Efi is looking for your feedback He told me I ve been diving deep into Rust to boost the performance of some AWS CLI tools I m on the lookout for tools in the AWS ecosystem that might either need a revamp or simply don t exist yet but could greatly benefit from that Rust speed magic Got any pain points or gaps you ve noticed that I might tackle I d love to hear your thoughts Demos Samples Solutions and Workshopsguidance for natural language queries of relational databases on awsguidance for natural language queries of relational databases on aws demonstrates how to build an application enabling users to ask questions directly of relational databases using natural language queries NLQ The architecture uses LangChain s SQL Database Chain a Streamlit framework and an Amazon SageMaker JumpStart Foundation Model FM With this Guidance your NLQ will be converted into a natural language answer as part of the NLQ process After submitting the converted SQL query and compiling the results the results will be converted using generative artificial intelligence AI into a text explanation written in NLQ The translation from SQL to NLQ is supported by a foundation model FM that translates the natural language question to SQL and back to a natural language answer Gary Stafford who features regularly in this newsletter wrote This solution is first in a set of Generative AI Guidance from AWS to help our customers accelerate development of Generative AI use cases on AWS Natural Language Query NLQ of structured data in relational NoSQL timeseries and graph databases is of huge industry interest llm langchain sql demollm langchain sql demo this repo provides code to enable you to follow along in the excellent post from colleague and regular face within this newsletter Gary Stafford In Generative AI for Analytics Performing Natural Language Queries on Amazon RDS using SageMaker LangChain and LLMs Gary shows you how you can use LangChain s SQL Database Chain and Agent with large language models to perform natural language queries NLQ of Amazon RDS for PostgreSQL database You will need access to OpenAI and Anthropic API keys to use this code AWS and Community blog postsCommunity round upLots of really interesting content from the AWS Community this week but starting us off is AWS Community Builder Sreekesh Iyer with his post Self Hosting Supabase on AWS Supabase is a well loved open source backend as a service that allows web and app developers to simplify common functionality they need authentication and authorisation storage API generation etc and in this post Sreekesh provides a quick guide to get this up and running in your AWS environment so you can try it out for yourself I somehow missed this post when it first came out but AWS Hero Efi Merdler Kravitz put together Migrating a Web App to AWS Lambda with Lambda Web Adapter that looked at how to use a project featured in of this newsletter aws lambda web adapter to migrate a sample web application If you missed this project the first time read Efi s post and check out the project it is super interesting Vector databases and Large Language Models LLMs are everywhere it seems so it is handy that AWS Community Builder Dejanu Alex has put together OpenSearch as Vector DB Supercharge Your LLM which provides a quick post on how Amazon OpenSearch can help you as well as showing you how to get this up and running To finish up this Community roundup we have a regular face AWS Community Builder Lars Jacobsson He is back with a blog post this time Introducing samp cli for local Lambda debugging of SAM and CDK stacks looking at how one of this projects can help you dear developer to improve the local developer experience when using AWS SAM and CDK It is a must read this week Powertools for AWS LambdaWhether you are new to Powertools for AWS Lambda or a seasoned user Mark Sailes tweeted last week details about the Discord server that you should join in order to meet the broader Powertools community and stay up to date with all the latest news Open Application Model OAM Open Application Model OAM is an open source specification for building cloud native applications It provides a declarative way to define the components of an application including its services configuration and dependencies In the post Application first delivery on Kubernetes with Open Application Model Daniel Higuero CTO of Napptive collaborates with Tsahi Duek Andreas Lindh and Siva Guruvareddiar on a hands on guide on how to implement the OAM using KubeVela an open source project which implements the Open Application Model Great post well worth checking out hands on TraefikTraefik is an open source cloud native load balancer and reverse proxy application developed by the software company Traefik Labs In the post Implementing application load balancing of Amazon ECS Anywhere workloads using Traefik Proxy Cameron Senese demonstrates how to deploy and load balance a web application across multiple Amazon ECS Anywhere external instances using Traefik Proxy Traefik hands on KeycloakAfter blogging recently about how to use the CDK construct to deploy Keycloak into your AWS environment I was delighted to see this post from Joseph Keating Dinuth De Zoysa and Virginia Chu Configure Keycloak on Amazon Elastic Kubernetes Service Amazon EKS using Terraform helps you to deploy Keycloak into your AWS environment using Terraform Whereas my post helped you deploy on ECS this one deploys into your Kubernetes clusters Very nice post with all the source code you need to deploy provide in the GitHub repo hands on Other posts and quick readsBuilding better container images shows you how to build better container images using best practices hands on The role of vector datastores in generative AI applications describes the role of vector databases in generative AI applicationsRevolutionize retail recommendations for ecommerce with Amazon RDS for PostgreSQL and GenAI explores the significance of vector databases in retail recommendations and how they are revolutionising the ecommerce landscapeBuild a centralized audit data collection for Amazon RDS for PostgreSQL using Amazon S and Amazon Athena is a hands on guide that shows you how to capture and store audit data from an Amazon RDS for PostgreSQL database store it in Amazon S and then process the data so you can query it with Amazon Athena hands on Optimize AWS Inferentia utilization with FastAPI and PyTorch models on Amazon EC Inf amp Inf instances helps you get started in deploying FastAPI model servers on AWS Inferentia devices ready to start serving up your PyTorch models hands on Quick updatesOpenSearchLast week the OpenSearch community posted Introducing OpenSearch with new features designed to help you build better search solutions and integrate more machine learning ML into your applications along with updates for security analytics workloads geospatial visualisations and more Read the post to get all that OpenSearch goodness One of the interesting experimental features in this release are Extensions In the post Introducing extensions for OpenSearch Sarat Vemulapalli Dan Widdis Owais Kazi Daniel dB Doubrovkine Dagney Braun Minal Shah and Fanit Kolchina dive deeper and walk you through what Extensions in OpenSearch are and why it was needed MySQLAmazon Aurora MySQL Compatible Edition with MySQL compatibility now supports MySQL In addition to several security enhancements and bug fixes this release is fully compatible with MySQL Previous Aurora MySQL x versions were compatible with MySQL IAM Roles AnywhereAWS Identity and Access Management IAM Roles Anywhere is an open source project that enables workloads that run outside of AWS such as servers containers and applications to use X digital certificates to obtain temporary AWS credentials and access AWS resources using the same IAM roles and policies that you have configured for your AWS workloads to access AWS resources IAM Roles Anywhere released credential helper version to include support for X certificates and private keys that are stored in macOS and Windows certificate stores IAM Roles Anywhere credential helper is a tool that manages the process of signing the CreateSession API with the private key associated with an X end entity certificate and calls the endpoint to obtain temporary AWS credentials With this release you can now use IAM Roles Anywhere credential helper to delegate signing operations to keys stored within those OS specific certificate stores without those keys ever leaving those stores which can improve your security posture In Windows both CryptoAPI and Cryptography API Next Generation CNG are supported in macOS Keychain is supported MQTTAWS IoT Core MQTT now supports Device Location IoT Core Device Location feature allows customers to obtain devices location data and build location based applications even when devices don t have a built in GPS With IoT Core Device Location feature customers can use advanced cloud based location solvers such as Wi Fi scan Cellular scan Global Navigation Satellite System GNSS scan and reverse IP look up to determine geo coordinates of their IoT devices for use cases such as map visualisation historical route tracking and Geo fencing Now with MQTT support for Device Location customers can use their MQTT devices existing connection and data path with AWS IoT Core to obtain devices geo coordinates and send them to AWS services including Amazon Location Service The added support for MQTT devices eliminates the need of maintaining multiple data paths between IoT devices and AWS IoT Core simplifying customer s development process when building location based IoT solutions Amazon EMRA few of updates this week First up is news that you can now store logs for your EMR Serverless Spark and Hive applications in Amazon CloudWatch Amazon EMR Serverless is a serverless option that makes it simple for data analysts and engineers to run open source big data analytics frameworks like Apache Spark and Apache Hive without configuring managing and scaling clusters or servers When you submit a job to an EMR Serverless application you can decide where to store your application logs in a managed storage system an Amazon S location or both Now you can choose Amazon CloudWatch as an option as well This feature allows you to take advantage of CloudWatch log analysis features such as CloudWatch Logs Insights Live Tail etc as well as stream logs from CloudWatch to other systems such as Amazon OpenSearch for further analysis When storing logs in Amazon CloudWatch log data is always encrypted but you can choose to use your own encryption keys as well From Amazon EMR Serverless to Amazon EMR on EC Announced last week was a new feature that enables user authentication to EMR on EC clusters using Lightweight Directory Access Protocol LDAP based credentials This feature allows administrators to configure EMR on EC clusters to authenticate corporate identities in their Active Directory AD using LDAP With this launch AD users are synced to the EMR on EC cluster automatically when LDAP authentication is enabled This simplifies authentication to EMR clusters for administrators by eliminating the manual steps to sync users and or implementing application specific LDAP configuration Amazon EMR on EC customers create and manage their corporate user identities and groups in an LDAP directory based service such as AD or openLDAP With native LDAP integration end users can authenticate to EMR clusters using their AD credentials and use applications such as Hue Presto and Livy to run jobs as themselves This simplifies user authentication with EMR on EC clusters using AD and allows corporate users to launch queries and sessions on applications such as Hue Presto using their LDAP based credentials Prior to this launch administrators configured Kerberos to authenticate AD users which is manual and effort intensive With this launch administrators can also enforce fine grained access control FGAC for AD users through Apache Ranger authorisation for Hive Metastore database and tables Next and sticking with Amazon EMR on EC was news that two new capabilities that enhances the scaling experience for Amazon EMR on EC clusters a new retry mechanism for faster scaling of your Amazon EMR on EC clusters running Presto or Trino and faster scale down of Amazon EMR on EC clusters by enforcing the data redundancy requirements These capabilities are automatically enabled for clusters running Amazon EMR or higher releases and no action is needed from your end Check out the post Improved scalability and resiliency for Amazon EMR on EC clusters where Ravi Kumar Singh and Kevin Wikant dive deeper into this Finally from Amazon EMR on EC to Amazon EMR on EKS Apache Spark with Java in EMR on EKS is now supported AWS customers can now leverage Java as a supported Java runtime to run Spark workloads on Amazon EMR on EKS and benefit from Java s language enhancement and performance improvement Amazon EMR on EKS enables customers to run open source big data frameworks such as Apache Spark on Amazon EKS Up until this update Amazon EMR on EKS ran Spark with Java as the default Java runtime with Java as an option In order to run Spark on EMR on EKS with Java it requires an additional effort to the customer by creating a custom image and replacing the default Java runtime with Java With this new feature customers can now select Java as a supported runtime to run Spark jobs on EMR on EKS Apache IcebergAmazon Redshift today announces the preview release of Apache Iceberg support enabling users to run analytics queries on Apache Iceberg tables within Redshift Apache Iceberg one of the most recent open table formats has been used by many customers to simplify data processing on rapidly expanding and evolving tables stored in data lakes You can now use Amazon Redshift to query your Apache Iceberg tables in AWS Glue Data Catalog while other users or applications can safely conduct data manipulation on your tables using ACID atomicity consistency isolation and durability compliant services like Amazon EMR Amazon Athena and AWS Glue Apache HudiAWS Glue Crawlers now supports Apache Hudi tables allowing customers to query data in Apache Hudi tables directly from AWS analytics services like Amazon Athena Apache Hudi is an open source table format that brings database and data warehouse capabilities to the data lake Apache Hudi helps data engineers manage continuously evolving data sets while maintaining query performance To query data from Apache Hudi tables previously Amazon Athena users had to manually create a table within the Glue Data Catalog and update partition changes to ensure the query results were current With today s launch users can automatically register Apache Hudi tables into the Glue Catalog by running the Glue Crawler Glue Crawler supports partitioned and non partitioned Copy on write CoW and Merge on read MoR Hudi tables Users can then query Glue Catalog Hudi tables across various analytics services and apply Lake Formation fine grained permissions With Glue Crawlers users can also migrate data from other Hudi Catalogs to the Glue Catalog GoIf you are a Go developer then make sure you check out Migrating AWS Lambda functions from the Go x runtime to the custom runtime on Amazon Linux where Micah Walter Yanko Bolanos and Ramesh Mathikumar describes our plans to improve performance and streamline the user experience for customers writing AWS Lambda functions using Go PythonOn a related note you can now use Python in AWS Lambda Ramesh Mathikumar and Francesco Vergona put together Python runtime now available in AWS Lambda that explores this in more details Videos of the weekCedarI shared details about this community meetup in previous issues of the newsletter If you were not able to attend you can now watch the recording which is available on permit io s YouTube channel One of the great things in this video was a look at how you as developers can implement Cedar into your applications RabbitMQTake a peek at this discussion in the RabbitMQ community where AWS talk about recent changes to quorum queues PacuPacu is an open source tool which is used for ethical offensive security In this video you re going to learn how to ethically hack AWS cloud environments that you have explicit permissions for so that you can find exploitable vulnerabilities in your own AWS accounts or for your clients as a pentester before the bad threat actors do Build on Open SourceFor those unfamiliar with this show Build on Open Source is where we go over this newsletter and then invite special guests to dive deep into their open source project Expect plenty of code demos and hopefully laughs We have put together a playlist so that you can easily access all sixteen of the episodes of the Build on Open Source show Build on Open Source playlist We are currently planning the third series if you have an open source project you want to talk about get in touch and we might be able to feature your project in future episodes of Build on Open Source Events for your diaryIf you are planning any events in either virtual in person or hybrid get in touch as I would love to share details of your event with readers AWS User Group UK Meetup London August thAWS User groups regularly meet across the world and in this London chapter of the AWS User group Matt Carey will be sharing his talk Building a Viral Open Source AI Chatbot A Journey from Concept to Reality From the extract Learn how we built Quivr the open source virtual brain In months we achieved k active users of the demo app and a whopping k stars on GitHub We were number on the GitHub trending page for multiple days in a row This is the story of how Quivr went viral and how our tiny dev team struggled to build all the features our user base wanted We will talk about the challenges we faced scaling a generative AI powered app without it costing the earth on ECS Fargate and the extra tooling we had to build along the way We will cover how we solved the problems of keeping the project open source and super easy to both use and contribute whilst leveraging AWS services in a different way to most Find out more about the other talk and details of how to register over at the meetup page AWS User Group UK MeetupRADIUSS AWS Tutorials Learn how to use a modern HPC software stackOnline throughout August Check out this series of online tutorials happening throughout August demonstrating how to use several GPU ready projects in the cloud and on premises Follow along on your own EC instance provided No previous experience necessary Lots of open source technologies are covered in this series so if you are looking to get started in this space check out the details on the information page Learn how to use a modern HPC software stack Brenden Bouffler has also put together a great blog post Call for participation RADIUSS Tutorial Series that dives deeper into some of these topics and provides further information Building ML capabilities with PostgreSQL and pgvector extensionYouTube th September pm UK timeGenerative AI and Large Language Models LLMs are powerful technologies for building applications with richer and more personalised user experiences Application developers who use Amazon Aurora for PostgreSQL or Amazon RDS for PostgreSQL can use pgvector an open source extension for PostgreSQL to harness the power of generative AI and LLMs for driving richer user experiences Register now to learn more about this powerful technology Watch it live on YouTube Build ML into your apps with PostgreSQL and the pgvector extensionYouTube st September pm UK timeThis office hours session is a follow up for those who attended the fireside chat titled Building ML capabilities into your apps with PostgreSQL and the open source pgvector extension Others are also welcome Office hours attendees can ask questions related to this topic Application developers who use Amazon Aurora for PostgreSQL or Amazon RDS for PostgreSQL can use pgvector an open source extension for PostgreSQL to harness the power of generative AI and LLMs for driving richer user experiences Join us to ask your questions and hear the answers to the most frequently asked questions about the pgvector extension for PostgreSQL Watch it live on YouTube Open Source Summit EuropeSeptember th st Bilboa Spain Open Source Summit is the premier event for open source developers technologists and community leaders to collaborate share information solve problems and gain knowledge furthering open source innovation and ensuring a sustainable open source ecosystem It is the gathering place for open source code and community contributors You will find AWS as well as myself at Open Source Summit this year so come by the AWS booth and say hello from the glimpses I have seen so far it is going to be awesome Find out more at the official site Open Source Summit Europe UC Santa Cruz Open Source SymposiumUniversity of California Santa CruzThis three day event in Santa Cruz California will provide the opportunity to learn about the cutting edge open source research being done throughout the University of California To find out more and to register your interest sign up here OpenSearchConSeattle September Registration is now open source OpenSearchCon Check out this post from Daryll Swager Registration for OpenSearchCon is now open that provides you with what you can expect and resources you need to help plan your trip CDK Day Online th September Back for the fourth instalment this Community led event is a must attend for anyone working with infrastructure as code using the AWS Cloud Development Kit CDK It is intended to provide learning opportunities for all users of the CDK and related libraries The CFP is open so if you have some ideas for some talks then make sure you check that section out Also this year they are accepting talks in Espanol Woohoo love it Check more at the website CDK Day Open Source IndiaOctober th NIMHANS Convention Center BengaluruOne of the most important open source events in the region Open Source India will be welcoming thousands of attendees all to discuss and learn about open source technologies I will be there too doing a talk so I would love to meet with any of you who are also planning on attending Check out more details on their web page here All Things OpenOctober th th Raleigh Convention Center Raleigh North CarolinaI will be attending and speaking at All Things Open looking at Apache Airflow as an container orchestrator I will be there with a bunch of fellow AWS colleagues and I hope to meet some of you there Check us out at the AWS booth where you will find me and the other AWS folk throughout the event Check out the event and sessions speakers at the official webpage for the event AllThingsOpen CortexEvery other Thursday next one th FebruaryThe Cortex community call happens every two weeks on Thursday alternating at UTC and UTC You can check out the GitHub project for more details go to the Community Meetings section The community calls keep a rolling doc of previous meetings so you can catch up on the previous discussions Check the Cortex Community Meetings Notes for more info OpenSearchEvery other Tuesday pm GMTThis regular meet up is for anyone interested in OpenSearch amp Open Distro All skill levels are welcome and they cover and welcome talks on topics including search logging log analytics and data visualisation Sign up to the next session OpenSearch Community Meeting Stay in touch with open source at AWSRemember to check out the Open Source homepage to keep up to date with all our activity in open source by following us on AWSOpen 2023-07-31 08:14:43
海外TECH DEV Community How To Use Task.Run in C# for Multithreading https://dev.to/bytehide/how-to-use-taskrun-in-c-for-multithreading-4ba9 How To Use Task Run in C for MultithreadingWelcome Let s dive into the exciting world of multithreading in C Today we will explore Task Run learn about Task Factory StartNew and harness the might of asynchronous tasks Along the way we ll discuss various aspects that can transform how you write multithreaded programs using C So let s get started shall we Understanding C Task RunIsn t it great when things just run and get the job done without hogging the primary thread That s exactly what Task Run in C does It s a method that allows us to start a task on a separate thread from the ThreadPool enhancing the performance and responsiveness of your applications Example of using Task RunTask Run gt Console WriteLine Running in a separate thread This code snippet runs a lambda expression on a separate thread leaving the main thread free to continue executing other tasks Quite handy right The Basics of C Task RunThe C Task Run method is an integral method in multithreading programming It s like the bass player in a band ーwhile invisible to many it plays a key role in giving structure and rhythm to the harmonic ensemble But what makes Task Run the unsung hero in C The brilliance of Task Run lies in its ability to run operations on the ThreadPool s threads outside of the main thread much like hiring an assistant to deal with administrative work while you can focus on critical tasks Let s consider a basic example Example of using Task RunTask Run gt Calculation running on a different thread int result LongCalculation Console WriteLine Result is result In this example we use Task Run to execute a potentially time consuming calculation on a separate thread This behavior ensures that our main thread continues to run undisturbed keeping user interface responsive or server processing incoming requests Now imagine you re teaching a kid how to tidy their room Traditionally they might start by picking up one toy walk to the toy box drop it off and then go back for another toy This is equivalent to a synchronous operation With Task Run it s like they re capable of tidying up their toys and their books at the same time vastly improving efficiency It s an year old with superpowers Task Run in NET What it Is Used for and How it Works In multithreaded applications Task Run is like an experienced conductor directing the orchestra portraying harmony by managing multiple threads as they run side by side each performing different tasks simultaneously Here s an in depth example of how we can utilize Task Run in a NET application int numbers Enumerable Range ToArray Use Task Run to start a task that computes the sum of numbersTask lt long gt task Task Run gt long total for int i i lt numbers Length i total numbers i return total Console WriteLine Doing some other work Await the task to retrieve the resultlong result await task Console WriteLine Sum is result In this code we have an array of a million numbers Now adding them all might be a long operation blocking our main thread if done synchronously But Task Run allows us to offload the work onto a separate thread As the sum is being computed the main thread is free to do other work When the result is needed we use await to retrieve it This is what makes NET s Task Run a favorite tool among developers to increase responsiveness and performance of applications Take our kid s room tidying example again but this time imagine they have friends over While they re busy tidying up their own mess Task Run is equivalent to their friends concurrently cleaning up their own messes Each kid is a thread and they all work together to clean the room more quickly and efficiently than one child could alone Gaining Control with Task Factory StartNewHold on to your seat It s time to learn about Task Factory StartNew Think of it as the orchestra conductor of multithreading in C It allows you to start tasks offers more granular control over task creation than Task Run and paves the way for creating complex layered tasks Creating a task with TaskFactory StartNew Task Factory StartNew gt This block runs in a separate thread Console WriteLine New Task started In this example we create a task using TaskFactory StartNew and write to the console from a separate thread But how does this StartNew method create such great music Commanding Your Code with Task Factory StartNewTask Factory s StartNew method surely sounds fancy doesn t it It s like the conductor s baton waving methodically to make the orchestra come alive By controlling where and when every note or in our case tasks is played the conductor ensures a harmonious performance The StartNew method serves a similar purpose in the world of C It helps control the life cycle of a task right from its inception offering numerous overloads to customize these task “notes to create our code s beautiful symphony Sample of creating a task with Task Factory Start NewTask task Task Factory StartNew gt This code will run in a separate thread for int i i lt i Console WriteLine Iteration i Thread Sleep In this code snippet a task is started by the TaskFactory StartNew method that runs a for loop Each iteration is paused for a second simulating a time consuming task Upon executing it prints the iteration number to the console It s like a clock ticking every second on a different thread freeing the main thread to do whatever it needs simultaneously Diving Deeper How Task Factory StartNew Enhances Your ProgrammingTask Factory StartNew has its charm that Task Run perhaps cannot match Don t get me wrong Task Run is quite nifty for most common scenarios and should be used unless we require a tad bit more control and customization But if we need to control task scheduling cancellation or need a parent child relationship between tasks enter Task Factory StartNew Think of it like the difference between a DJ playing a pre recorded track and a conductor leading a live orchestra Task Run is that DJ comfortable pretty versatile and can handle most party scenarios But when you need to control every instrument and make on the go changes you need the conductor our Task Factory StartNew Here s a more specific scenario Suppose we need to start a new task but also want an option to cancel it midway if required Task Factory s StartNew comes to the rescue Sample of creating a task with Task Factory Start New with cancellationvar cancellationTokenSource new CancellationTokenSource Task longRunningTask Task Factory StartNew gt This code will run in a separate thread Check for cancellation request frequently so the task can be stopped for int i i lt i if cancellationTokenSource Token IsCancellationRequested break Console WriteLine Iteration i Thread Sleep cancellationTokenSource Token Let s run the task for seconds and then cancel itThread Sleep cancellationTokenSource Cancel In this code example I ve created a new task using Task Factory StartNew and also provided a cancellation token This created task runs a for loop for iterations but between each iteration it checks if a cancel request has been issued If so it breaks the loop I also simulated a cancel request after five seconds using cancellationTokenSource Cancel It s pretty much like giving a kid a new toy train And we also have a remote control to stop the train in its tracks whenever we want The train long running task runs happily on its own without interrupting the kid main thread But if mommy calls and it s bedtime we have the power to stop this train immediately and save the day As you can see the StartNew method from Task Factory puts you in the driving seat giving you control over when and how tasks are to be executed It s complex indeed but it opens up a world of possibilities for managing simultaneous tasks which we need while dealing with advanced applications Happy multitasking Navigating Asynchrony The Role of C Task Run AsyncAsynchronous programming is like jugglingーonce you master it the performance becomes a spectacle We ll now move to the Async aspect of Task Run a key concept that will help you write highly efficient code by allowing tasks to run concurrently Example of Task Run Asyncawait Task Run async gt Simulate a long running task await Task Delay Console WriteLine Done with the async task In this example an asynchronous task is queued using Task Run that waits for a second simulating a long running task before writing to the console But isn t the whole deal with async tasks kind of mind boggling at first Let s break it down and understand how it actually works A Primer on Await Task Run in C The await keyword in C as in awaiting a result or response communicates to the NET runtime that the execution should be paused at this line until the awaited task is complete This awaiting doesn t block the thread it just waits until the awaited operation is complete and then resumes where it left off Run a Task and await for its completionpublic async Task DoJustMagicAsync await Task Run gt Console WriteLine Doing magic asynchronously Simulate a long running task Thread Sleep Console WriteLine Magic done In this example Task Run is used to start a new Task for a time consuming operation simulated by Thread Sleep which then is awaited using await The control returns to the calling method until the awaited operation is complete allowing the UI thread in case of a GUI application like WPF or WinForms to stay responsive The second Console WriteLine statement will be executed after the long running task finishes Also don t let me forget to mention a crucial necessity The method containing the await keyword needs to be marked async indicating that this method contains an awaited operation It familiarizes the NET runtime with how to handle the execution flow Task Run Asynchronous Magic in C What You Need to KnowWhenever you use Task Run to kick off an asynchronous operation you allow the NET runtime to manage the execution of this operation on a separate thread from the ThreadPool without blocking the calling thread It lets your application stay responsive especially in a GUI scenario or when you re dealing with IO bound operations Example of Task Run Asyncpublic async Task ComplexCalculationAsync Create a task to run asynchronously await Task Run gt Simulate a complex calculation for int i i lt int MaxValue i var calculatedValue Math Sqrt i Console WriteLine Finished the complex calculation In this example Task Run is used to start a complex calculation simulating a CPU intensive operation running in a different thread than the one it was called from By doing this we free the calling thread presumably the UI thread and allow the NET runtime to handle how and when this operation is executed To see this magic in a real life example consider the case of a Windows Forms app that needs to perform a time consuming operation such as creating a complex report or downloading a large file from a server Magic indeed isn t it The beauty of Task Run is in its simplicity and power offering you control over when and how to run tasks concurrently improving your C applications performance and responsiveness Exploring C Parallel Tasks for High Performance ComputingParallel tasks in C are like the members of an orchestra each instrument plays its part independently yet together they create a harmonious symphony Similarly each task does its work independently of the others but together they accomplish the overall goal Just as a symphony conductor coordinates the actions of every musician the NET runtime controls the operation of every task Consider the previous example Rather than having a single loop printing out numbers sequentially like a single musician playing every note we have multiple tasks operating simultaneously like an orchestra playing a symphony This is essentially how parallel execution in NET works Parallel programming is particularly effective when working with data structures that can be divided into distinct parts and computed separately Suppose you re working with a large array of data and you re tasked with performing a calculation on each element Initialize an arrayint data Enumerable Range ToArray Transform the data in parallelParallel For data Length i gt This calculation takes place in parallel data i PerformExpensiveCalculation data i Here s our hypothetical expensive calculationint PerformExpensiveCalculation int value return value value For simplicity let s just square it The PerformExpensiveCalculation is an intensive operation that can sufficiently benefit from parallel execution In the example we use Parallel For to perform this operation on each element of our data array simultaneously in a separate thread These operations don t depend on one another so their execution order doesn t matter making the perfect case for parallel execution Parallel Tasks in C Driving Your Code s EfficiencyParallelization can significantly increase the efficiency of your C programs primarily when working with CPU intensive operations or when your application deals with blocking operations When you re dealing with CPU bound operations like computations parallelizing can distribute the work across multiple cores On the other hand when dealing with IO bound operations like reading writing to disk or network requests parallelizing such tasks allows your program to progress with other tasks while waiting for these operations to complete Here is an IO bound example where we download multiple files in parallel Let s assume we have a list of file URLs we need to downloadList lt string gt fileUrls GetFileUrls We ll use HttpClient to download the filesHttpClient client new HttpClient Download all files in parallelParallel ForEach fileUrls async url gt byte data await client GetByteArrayAsync url Save the file locally Hypothetical GetFileUrlsList lt string gt GetFileUrls gt new List lt string gt urls here In the code above while one task is waiting for a file to download another task can start downloading the next file thus using the resources more efficiently Task Start in Parallel Tasks in C Starting a task in C is much like hitting the first note in a song When you call Task Start you re telling the runtime to start executing the task This can be particularly useful in cases where you want to control when the task starts executing Consider the following example Declare the tasksTask tasks new Task Initialize and start the tasksfor var i i lt i int taskNum i To avoid closure on the loop variable tasks i new Task gt System Threading Thread Sleep Console WriteLine Task taskNum complete Now let s start our tasksforeach var task in tasks task Start And wait for all of them to completeTask WaitAll tasks In the above example we create tasks each of which sleeps for a second and then writes a message to the console Task Start is used to start each task explicitly Parallel execution has an inherent randomness since we can t predict the exact time each task starts completes or gets CPU time Therefore you may notice that the task numbers in the console output may not be perfectly sequential This randomness is expected and can vary every time you run the program By the way notice the use of Task WaitAll to wait for all tasks to complete It s like the final note of the orchestra signaling the end of the performance Getting Started with Await Task Run C In any multitasking orchestra the await keyword in C plays the role of the conductor s baton guiding tasks to wait elegantly while others complete It helps maintain the rhythm and structure of your program while ensuring that tasks do not block each other unnecessarily Let s look into its workings Here s an example of using await with Task Run Simulate a long running task within Task Run and use await keywordTask task Task Run gt for int i i lt i Thread Sleep Simulate a task that takes seconds Console WriteLine Done with the part i of the task await task Console WriteLine All parts of the task are done and now the main thread is free to do other things In this code we start a task that runs ten parts each of which behaves as a separate long running task Notice that we offload the work to a different task then use await to tell our program to continue executing other tasks in the meantime But isn t this fascinating and a tad intimidating Let s dive deeper to understand how Task Run and await work their magic Insight Into C Start Task and Await MethodsTask Run and await smoothly work together like duet musicians who know when to start and stop so that the music flows in harmony Task Run can start tasks and await can make the current method wait for the task to finish before proceeding But how s this possible This example represents how to use Start and await togetherTask task new Task gt Simulate a task that takes seconds Thread Sleep Console WriteLine Task has completed Console WriteLine Starting the task task Start Console WriteLine Waiting for the task to finish await task Await the completion of the taskConsole WriteLine Task is complete In this example we create a new task that simulates a time consuming task just like in our previous scenario After it starts by using Start the rest of the code doesn t wait for it to complete until await is reached Once there the method where this block of code is located will pause until the task completes This effectively frees up the main thread while waiting for the task to finish Deep Dive into Run Async Task in C Asynchronous programming in C is huge just imagine a drummer playing different rhythms with each of his limbs Run Async aids in creating responsive apps which remain interactive even when doing heavy computations Take a deep breath and let s get into it This example represent multiple asynchronous tasksList lt Task gt tasks new List lt Task gt for int i i lt i int taskNum i To avoid the closure variable trap tasks Add Task Run async gt Simulate a long running task await Task Delay Console WriteLine Task taskNum completed Console WriteLine Waiting for all tasks to complete await Task WhenAll tasks Console WriteLine All tasks completed Here we kick off five tasks each waiting around for one second to mimic lengthy computations The await inside Task Run means that the executing of the lambda we provided will pause until Task Delay completes then will resume executing the Console WriteLine call This all happens without blocking the main thread The call to Task WhenAll then waits for all the tasks in its argument to complete This allows concurrent asynchronous tasks to be easily initiated and managed So isn t this an effective way of creating a multitasking program while ensuring all tasks are completed successfully Pretty stellar don t you think Let me extend the information NET Core Tasks Advancements and AcesThere s a symphony playing in the NET Core world and Tasks are playing the lead role With NET Core task handling has changed for the better providing you with more control and flexibility than ever before But we re not just going to talk about itーwe re going to get our hands dirty and write some code as well Look at this piece Example of using tasks in Net Corevar task new Task gt This will run on a separate thread Console WriteLine NET Core task running task Start Here we re creating a new task and then starting it This asynchronous operation allows our application to stay responsive More complex examples can see tasks perform various operations and return results as necessary all fine tuned to improve our program s performance But how is this possible What makes NET Core task handling all that different from the NET Framework Decoding the Importance of NET Core Task in C To start NET Core has redefined the Task implementation altogether making it more flexible portable and modifiable than the NET Framework s predecessor NET Core introduced the concept of TaskCompletionSource This allows us to create tasks that can be manually controlled especially when it comes to signaling their completion Do you have a callback based asynchronous method you d like to translate to Task Asynchronous Pattern TAP TaskCompletionSource is your friend Here s a simple usage Create a TaskCompletionSourceTaskCompletionSource lt bool gt tcs new TaskCompletionSource lt bool gt Start an asynchronous operationStartSomeOperation gt Callback to signal that the operation has completed tcs SetResult true You can also use tcs SetException to signal an error Now you can await the taskawait tcs Task Output Operation Complete Console WriteLine Operation Complete The last line await tcs Task will wait for the callback to execute Then it will complete freeing up our main application flow to resume operations And this isn t even the end of the cool stuff TaskCompletionSource can doーbut I ll leave you to explore more Furthermore with the introduction of ValueTask in NET Core developers can handle scenarios where an operation often completes synchronously without allocating a new task This way we reduce overheads and improve performance especially in high throughput scenarios public ValueTask lt int gt DoSomethingAsync int number if number lt synchronous completion return new ValueTask lt int gt else asynchronous completion return new ValueTask lt int gt Task Run gt number In the above example if the input number is less than we don t need to queue any task or create a Task lt int gt Instead we create a ValueTask lt int gt that wraps an actual value avoiding unnecessary allocations In case of an async operation we wrap a Task lt int gt These features and more have made NET Core an excellent environment for efficient high performance task based programming Your tasks in your NET Core applications can be more responsive and lightweight leading to a more fulfilling user experience After all isn t that what every programmerーand userーwants Implementing C Periodical Task for Real Time ApplicationsImagine a coffee machine repeating its brewing task every morning or a server health monitoring system running checks every few seconds These are perfect examples of periodic tasks in the real world In C creating periodic tasks allows you to automate these repetitive operations neatly and efficiently A simple example of a periodic task in C using the Timer class might look like this Example of a periodic task in C var timer new Timer state gt This task will run periodically Console WriteLine Running periodic task null TimeSpan Zero TimeSpan FromSeconds In the code snippet we ve just generated a task that will write “Running periodic task… in the console every seconds Time based repeating tasks are fundamental to numerous applications covering a wide range of domains from health monitoring to automated machine operations But how are these marvels strung together in C Let s delve deeper Setting Up Periodic Tasks in C A Step By Step GuideCreating periodic tasks in C can be a bit tricky The routine is similar to the trumpet player in a band playing the same note in a rhythmic pattern creating a perfect harmony Sounds soothing right But how can we achieve it in C Let s start with a basic example Assume we want to monitor a server s health by pinging it every seconds Here s how you could set it up in C Import the necessary librariesusing System using System Threading Set up the periodic taskvar timer new Timer async e gt Console WriteLine Checking the server s health Simulate a server health check that takes seconds await Task Delay Console WriteLine Server health check completed null TimeSpan Zero TimeSpan FromSeconds In this example the periodical task starts by setting up a timer object A timer takes a delegate function that it will call every time the specified period elapses Here we ve defined an asynchronous function that simulates a server health check We then set the timer to fire immediately after creation TimeSpan Zero and then every seconds TimeSpan FromSeconds Now we ve got a well tuned trumpet playing our rhythmic pattern But what if we want to scale that up and add an entire brass section Use of C Run Method Async in Periodical TasksIntroducing asynchronous methods into the mix can empower our periodic task ensemble Asynchronous periodic tasks can make your NET applications more responsive as they ensure tasks waiting for things like IO operations or other time consuming tasks don t block the primary thread Let s say you need to fetch and process customer data every hour for your application Below is an example of how you could utilize Task Run async and await to create a non blocking periodic task in C Import the necessary librariesusing System using System Threading Tasks Dummy method that fetches and processes customer dataasync Task ProcessCustomerDataAsync Console WriteLine Data processing started Simulate time consuming data processing await Task Delay TimeSpan FromMinutes Console WriteLine Data processing completed after minutes Timer timer new Timer state gt Task Run async gt await ProcessCustomerDataAsync null TimeSpan Zero TimeSpan FromHours See the concert of async programming now in full swing In this example the Timer is initialized to run the ProcessCustomerDataAsync method every hour We use Task Run to execute this method on a separate thread ensuring our primary thread doesn t get blocked Now we ve not only got our trumpet playing but a complete brass section making sweet music all in perfect harmony Discovering the New Task Async C New Async Tasks in C are the power tools of your concurrency toolbox They allow developers to split time consuming operations from the main thread and run them in the background It s like having an assistant who takes over your tedious tasks leaving you free to focus on critical issues Example of new Task async in C var task new Task async gt await Task Delay Console WriteLine New async task finished In this code snippet we use new Task to create a task that performs an operation asynchronously The task waits for a second mimicking a long running task and then writes to the console This separation takes the load off the main thread making your application more responsive But the async keyword s potential does not stop here Let s look at another example handling multiple async tasks Example of multiple async tasks in C var task new Task async gt await Task Delay Console WriteLine Task finished var task new Task async gt await Task Delay Console WriteLine Task completed Task WhenAll task task Wait This script demonstrates the magic of handling multiple async tasks Task WhenAll efficiently waits for all the provided tasks to complete The Impact of New Task Async Methods in C The advent of async methods in C has enhanced the control developers have over the execution flow resulting in code that is not just efficient but also clean and readable Async methods allow tasks to be non blocking ensuring your application remains responsive even during heavy computation or I O operations Chaining tasks using asyncvar firstTask new Task lt string gt FirstTask var secondTask new Task lt string gt SecondTask firstTask ContinueWith t gt secondTask Start In this example we chain two tasks The ContinueWith method signals Task to start once Task finishes demonstrating how we can decompose complex operations into smaller manageable tasks and run them in a controlled sequential manner using async features Task Run Async Await C TechniquesWhen integrating async and await into Task Run we uncover various techniques to optimize multitasking The await keyword lets the system know that the method can return at this point freeing up the thread to handle other tasks Implementing await with Task RunTask myTask Task Run async gt for int i i lt i await Task Delay Console WriteLine Processing task myTask Wait Here we use Task Run along with async and await to start an operation that iterates times However at each iteration the task itself is not blocking instead it gives up control after each loop allowing the thread to execute other tasks during the delay This flexibility of Task Run in combination with async and await empowers us to construct complex programs where multiple tasks can execute concurrently without blocking the main thread making the most efficient use of system resources Owning Asynchronous Programming with C Run AsyncAsynchronous programming is like playing jazz it s all about breaking the monotony improvising on the go and most importantly ensuring harmony despite the haphazardness Run Async in C channels this spirit of jazz into your NET applications making them highly responsive and performant The real power of async programming lies in its ability to improve the execution flow When a process encounters a task expected to take a long time instead of just keeping everything on hold it delegates the task moves on and later comes to check on it This makes your applications quite the juggler Conversely understanding async programming requires understanding how async and await work together like perfect dance partners to accomplish this Example of Task Run AsyncTask Run async gt Simulate a long running task await Task Delay Console WriteLine First task finished await Task Delay Console WriteLine Second task finished In this orchestrating script Task Run starts an asynchronous task that first waits for a second and then draws First task finished on the console Immediately after it embarks on another long running task of waiting for two seconds and then calls out “Second task finished This interaction between run async and await allows your application to efficiently handle multiple tasks concurrently Advanced Scenarios in Task Run for Async Programming in C As programmers we love to push the limits don t we And guess what async programming with Task Run is just the canvas for us to test our creative boundaries Consider a scenario where you have to fetch data from an API and at the same time perform some local file operations How would our artist Task Run paint this async Task FetchAndProcessDataAsync Task apiDataFetchTask Task Run async gt This simulates fetching data from an API await Task Delay Console WriteLine Data fetched from API successfully Task localFileOperationTask Task Run gt This simulates local file operations Thread Sleep Console WriteLine Local file operations done successfully await Task WhenAll apiDataFetchTask localFileOperationTask Console WriteLine Both tasks finished successfully In this masterpiece Task Run creates two separate tasks One task mimics fetching data from an API and another for local file operations The main thread doesn t wait around aimlessly It moves on to the next lines of codes The Task WhenAll method makes sure all the tasks have completed their roles The Balancing Act Task Run C Async and Error HandlingAny good performance needs to address hiccups with elegance and async programming is no exception Exception handling is key to this Let s say we are doing multiple tasks concurrently and one of them hits a snag How do we handle this elegantly without letting the whole performance collapse try await Task Run async gt Simulate a task await Task Delay Oops something went wrong throw new Exception Something nasty happened in the async task catch Exception ex Console WriteLine Caught an exception ex Message In this harmonious piece we ve introduced a try catch block to handle any discordance If a problem occurs inside the asynchronous task in this case we re throwing an exception it gets caught and handled gracefully Async and await in C used with Task Run allow you to create rhythmic melodic pieces with your code by easily allowing concurrent execution of tasks And handling errors within this concurrency adds the right amount of grace and fluidity to your performance Ready for the encore Success in async programming much like music comes from mastering the basics and then consistently practicing and experimenting So break a leg and keep coding 2023-07-31 08:09:53
ニュース BBC News - Home David Hunter: British husband who killed wife in Cyprus released https://www.bbc.co.uk/news/uk-england-tyne-66322478?at_medium=RSS&at_campaign=KARANGA janice 2023-07-31 08:40:56
ニュース BBC News - Home Mortgage support ad campaign launched by lenders https://www.bbc.co.uk/news/business-66311343?at_medium=RSS&at_campaign=KARANGA radio 2023-07-31 08:45:47
ニュース BBC News - Home Wagner pauses fighter recruitment and focuses on Africa and Belarus - Prigozhin https://www.bbc.co.uk/news/world-europe-66358269?at_medium=RSS&at_campaign=KARANGA group 2023-07-31 08:41:15
ニュース BBC News - Home Cardi B throws microphone into crowd at gig after being hit by drink https://www.bbc.co.uk/news/entertainment-arts-66358971?at_medium=RSS&at_campaign=KARANGA drinkthe 2023-07-31 08:36:21
ニュース BBC News - Home Belfast drug users warned over possible bad batch of 'benzos' https://www.bbc.co.uk/news/uk-northern-ireland-66343493?at_medium=RSS&at_campaign=KARANGA overdoses 2023-07-31 08:41:18
ニュース BBC News - Home Six killed at Palestinian refugee camp in Lebanon https://www.bbc.co.uk/news/world-middle-east-66354364?at_medium=RSS&at_campaign=KARANGA refugee 2023-07-31 08:29:18
ニュース BBC News - Home Manchester United agree 10-year extension with Adidas worth at least £900m https://www.bbc.co.uk/sport/football/66358793?at_medium=RSS&at_campaign=KARANGA adidas 2023-07-31 08:51:09
マーケティング MarkeZine 【視聴無料】イオンが推進するOMOの現状 http://markezine.jp/article/detail/42956 視聴 2023-07-31 17:30:00
IT 週刊アスキー 楽天カードを装う詐欺メールの見分けは意外と難易度高し https://weekly.ascii.jp/elem/000/004/147/4147477/ 楽天カード 2023-07-31 17:30:00
IT 週刊アスキー くまもとあか牛の魅力を全国に発信して熊本県を応援 「湖池屋プライドポテト JAPAN あか牛鉄板焼き わさび醤油 熊本」新発売 https://weekly.ascii.jp/elem/000/004/147/4147577/ japan 2023-07-31 17:30:00
IT 週刊アスキー PS5+コントローラー2台入りの「ダブルパック」が8月9日より発売決定 https://weekly.ascii.jp/elem/000/004/147/4147588/ dualsense 2023-07-31 17:30:00
IT 週刊アスキー 可愛い猫のボンボンショコラが登場! Philly chocolate、ルミネ新宿ルミネ1 B2催事スペースに期間限定出店 https://weekly.ascii.jp/elem/000/004/147/4147590/ chocolate 2023-07-31 17:30: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件)