投稿時間:2023-06-06 21:37:28 RSSフィード2023-06-06 21:00 分まとめ(42件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
IT 気になる、記になる… 「MacBook Air 15インチ」、Amazonでも注文受付開始 https://taisy0.com/2023/06/06/172674.html amazon 2023-06-06 11:39:44
IT ITmedia 総合記事一覧 [ITmedia News] 「NSX」のエンジン音が流れるぬいぐるみ「赤ちゃんスマイル」 なお外観は「S600クーペ」 https://www.itmedia.co.jp/news/articles/2306/06/news215.html itmedia 2023-06-06 20:48:00
IT ITmedia 総合記事一覧 [ITmedia Mobile] 新型マイナンバーカード、2026年に発行へ 券面デザインの見直し iOSへの搭載は検討継続 https://www.itmedia.co.jp/mobile/articles/2306/06/news214.html itmediamobile 2023-06-06 20:35:00
TECH Techable(テッカブル) 企業が求めるスキルを習得したIT人材を採用!「SLスタジオ」の新リクルーティングサービス https://techable.jp/archives/210641 foxhound 2023-06-06 11:00:25
python Pythonタグが付けられた新着投稿 - Qiita 素人が時系列データに対するフィルタ処理を行なってみた https://qiita.com/chibagon/items/8a331b0d115322e2c4db 退化 2023-06-06 20:39:46
js JavaScriptタグが付けられた新着投稿 - Qiita TypaScriptの環境構築してみた【Mac】 https://qiita.com/Raio14f/items/b8c68b6c2186e41b74d4 typascript 2023-06-06 20:38:26
js JavaScriptタグが付けられた新着投稿 - Qiita 猫の手を借りてweb会議中のトイレの不安を払拭してみた https://qiita.com/Satomi-2023/items/59f3aee6ea1870bb3619 普段 2023-06-06 20:37:00
js JavaScriptタグが付けられた新着投稿 - Qiita C子ちゃん例え話シリーズ:ランダムなエスケープ処理(JavaScript) https://qiita.com/engbJapan/items/3cf8a1eee675c0af1715 javascript 2023-06-06 20:21:15
golang Goタグが付けられた新着投稿 - Qiita 【個人開発】キリ番を判定するGoライブラリを作りました。 https://qiita.com/kumackey/items/9a76e7d347b50490a325 作りました 2023-06-06 20:07:43
Git Gitタグが付けられた新着投稿 - Qiita [Git] 動作を試す 実行例52:pullで引数を省略した時の振る舞いを見る https://qiita.com/dl_from_scratch/items/ec2c4eeed01c4666cecb 振る舞い 2023-06-06 20:19:12
技術ブログ Developers.IO 【セキュアアカウント切り戻し手順】GuardDutyの停止・無効化手順のご案内 https://dev.classmethod.jp/articles/secure-account-setting-switchback-guardduty/ guardduty 2023-06-06 11:39:02
技術ブログ Developers.IO Exploring Git, GitHub and GitHub Desktop https://dev.classmethod.jp/articles/exploring-git-github-and-github-desktop/ Exploring Git GitHub and GitHub DesktopIntroduction This is Pooja from Alliance department This blog summaries basics of Git GitHub and GitHub Des 2023-06-06 11:28:11
技術ブログ Developers.IO Brazeのイベントアプリの生成系AIを触ってみた! https://dev.classmethod.jp/articles/brazejapanevent-app/ braze 2023-06-06 11:04:51
海外TECH DEV Community Building an efficient email marketing application with ChatGPT, ToolJet, and PostgreSQL https://dev.to/tooljet/building-an-efficient-email-marketing-application-with-chatgpt-tooljet-and-postgresql-25g8 Building an efficient email marketing application with ChatGPT ToolJet and PostgreSQLIn this tutorial you ll learn how to build an email marketing application using ToolJet ChatGPT and PostgreSQL The application allows you to add subscribers to your mailing list group them into categories and send them newsletters using Brevo formerly Sendinblue We ll also use ChatGPT for generating email content All these features are very easy to integrate with the help of ToolJet What is ToolJet ToolJet is an open source low code framework that enables us to build full stack web applications within a few minutes With ToolJet you can create standalone fully functional full stack applications or embed applications into other websites ToolJet allows you to build applications that use relational and non relational databases REST APIs OpenAI technologies and cloud storage like Google Cloud Storage  AWS S and Minio It is an excellent development tool helping individuals developers and businesses create and ship products faster Before we continue I need your help I would be super happy if you could give us a star And let me also know in the comments section ️ Setting up an ElephantSQL PostgreSQL databaseElephantSQL enables us to create a PostgreSQL database on the cloud instead of your local machine Follow the steps below to create a PostgreSQL database Create an ElephantSQL account here Add a new database instance No credit card or billing information is required Once you ve created the database instance your database information is displayed Congratulations You ve successfully created the database needed for this application Next let s design the application interface and connect the database to the application Building the application with ToolJetHere you ll learn how to create a ToolJet account and build a fully functional application with ToolJet If you are new to ToolJet  create an account Create a Workspace and a new app called Newsletter Manager The application is divided into four pages the home page the ViewNewsletter page the CreateNewsletter page and the SubscribersManager page Click on the pages icon on the top left corner to create the three additional pages On the home page you can view all the available newsletters and navigate to the SubscribersManager and CreateNewsletter pages The ViewNewsletter page displays the details of a published newsletter The CreateNewsletter page enables us to create a newsletter as a draft or publish it by sending it to a group of users The SubscribersManager page displays existing subscribers and allows you to add a new subscriber to the list The Home pageHere you ll learn how to build the user interface below To create the UI above you need to add a container element on the canvas that will house all the other UI elements of the application Next drag the Text and Button component from the panel on the right into the container element to create the title and buttons In the image above I added a Tab component below the button and text components Next edit the Tab component to contain only the Published and Drafts tab menu by copying the code snippet below into the Tabs input at the right hand side of the screen title Published id title Drafts id Remove the ToolJet image at the centre of the list and insert the ListView component into the body of the Tab component Adjust it until it becomes similar to this Next add an on click event on the Subscribers button to navigate users to the SubscribersManager page Finally add an on click event on the Create button that redirects users to the Create Newsletter page The View newsletter pageChange the current page to the ViewNewsletter page place a large container on the canvas and create a UI similar to the image below There are three text components the application s name title and content and the Back button The Title and content texts are placeholders for the title and content of each newsletter This page allows us to view the contents of any published newsletter Finally add an on click event on the Back button to redirect users to the Home page The Create newsletter pageThis page enables you to save and publish a newsletter It accepts the newsletter s title email group and content You can also use AI generated content with ChatGPT by providing accurate prompts The Save to Draft and Send buttons allow us to save the newsletter or send it to the users email Finally redirect users to the home when they click the Back button The Subscribers manager pageOn this page you can view all the existing subscribers and add a new subscriber to the list Design the page as shown below We have the Title and Button components at the top of the page and the Table component displaying the list of subscribers Then add an on click event on the Add button such that it displays a Modal component that allows you to add the subscriber s details Congratulations You ve successfully built the user interface for the application Next let s add the required functionalities to the application How to communicate with a PostgreSQL database in ToolJetToolJet allows us to communicate with external resources or create custom functions via a panel known as Query Panel In ToolJet any function that interacts with a database API or cloud storage and runs a JavaScript or Python code is called a Query Here you ll learn how to communicate with a PostgreSQL database in ToolJet First let me walk you through connecting a PostgreSQL database to ToolJet Connecting the PostgreSQL database to ToolJetSelect Global Datasources from the top right menu bar on your ToolJet dashboard Select PostgreSQL from the list of databases under the Global Datasources panel and provide the required information as shown below From the image above the host is the same as the server name on ElephantSQL excluding the brackets The username and database name are the same and copy and paste the password into its field Scroll down the page and click Test Connection If the connection is verified we can start making queries to the database Setting up the database structureYou need to create two database tables one for the Subscribers and another for the Newsletters Both the newsletter and subscriber table will have an email group property to enable us to identify subscribers who belong to a group and send emails to only subscribers within a group Therefore let s create the database tables and add some dummy data Navigate to the browser section on your ElephantSQL database and execute the code snippet below CREATE TABLE Letters id SERIAL PRIMARY KEY title VARCHAR content TEXT email group VARCHAR published BOOLEAN published date VARCHAR INSERT INTO Letters title content email group published published date VALUES ToolJet v is live ToolJet is an open source low code framework that enables us to build full stack web applications within a few minutes one false INSERT INTO Letters title content email group published published date VALUES Team Community Call is live ToolJet is an open source low code framework that enables us to build full stack web applications within a few minutes two true INSERT INTO Letters title content email group published published date VALUES Invitation to product launch It is an excellent development tool helping individuals developers and businesses create and ship products faster three true The code snippet above creates the Letters table on the database and adds three data entries two are published and the last one is a draft Finally create the Subscribers table CREATE TABLE Subscribers name VARCHAR email VARCHAR organisation VARCHAR email group VARCHAR INSERT INTO Subscribers name email organisation email group VALUES Jack jack gmail com ToolJet one INSERT INTO Subscribers name email organisation email group VALUES Teja teja gmail com ToolJet two INSERT INTO Subscribers name email organisation email group VALUES Badri badri gmail com ToolJet three Querying the PostgreSQL database in ToolJetTo create the email marketing application you need to create some database queries Get all the subscribers Add a new subscriber to the list Get newsletters saved as drafts Get published newsletters Save a newsletter as draft Save a published newsletterGet all the details of a published newsletter Getting all available subscribersOn the SubscriberManager page we need to display the list of subscribers from the database on the table as shown below Therefore create a new query on the Postgres database called getSubscribers and retrieve all the data from the Subscribers table Ensure you set the Run this query on application load toggle to true Finally update the the Table data with the data returned from the query Adding a new subscriber to the listOn the SubscribersManager page there is a Add button When you click on the button it displays a modal that enables you to add the various details related to a subscriber Therefore you need to execute a createSubscriber query when you click the Add button INSERT INTO Subscribers name email organisation email group VALUES components subscriberName value components subscriberEmail value components subscriberOrg value components subscriberGroup value The code snippet above access the value of the input components on the modal The components object allows you to access every component s properties Finally let s run the query when a user clicks the Add button and closes the modal immediately Getting newsletters saved as draftsCreate a PostgreSQL query that retrieves all the newsletters saved as drafts Enable the Transformations below the SQL editor It enables us to modify the data returned from the query const imageURL return data map obj gt return imageURL text obj title group obj email group Update the Draft tab to display the data returned from the getDrafts query Each element on the List View displays the content using the listItem property Therefore to access each data property use listItem lt propertyName gt listItem text and listItem group Getting published newslettersCreate a similar query to the getDrafts query which will return only newsletters whose published attribute is true SELECT FROM LettersWHERE published TRUE const imageURL return data map obj gt return imageURL text obj title date obj published date group obj email group id obj id The code snippet above returns an image URL text title date group and id of the published letters Display all the published newsletters in the list view Recall you need to use the listItem lt property gt method to access each attribute returned from the query Saving newsletters as draftCreate another query that accepts the values from the createNewsletter page and saves the newsletter as a draft INSERT INTO Letters title content email group published published date VALUES components title value components content value components group value false The query is executed when a user clicks the Save to Drafts button in the image below You can redirect the user to the home page after saving the newsletter Saving published newslettersAdd another query called savePublished that accepts the values from the input field and saves it as a published newsletter INSERT INTO Letters title content email group published published date VALUES components title value components content value components group value true CURRENT DATE Run the query when a user clicks on the Send button In the upcoming section after saving the published newsletter we ll also send it to the subscribers in that email group Getting the details of a published newsletterWe have a page called viewNewsletter that is supposed to display the title and content of a published post when a user clicks on them To do this you need to get the id of the selected newsletter and query the Letters database using the id First add the set Variable action on each row of the list view When you click on each list item it sets the variable s value to its index in the list view The variable selectedListviewId contains the selected item s index Therefore you can get the item s ID from the data returned from its query SELECT FROM LettersWHERE id queries getPublished data variables selectedListviewId id The code snippet above accesses the variables object and gets the selected item s id using its index Then you can filter the Letters database using the id Since we only need the title and content attribute of the newsletter Therefore you can update the data returned with only the required data return data map item gt return title item title content item content Next run the query when a user clicks on each item of the List View Finally redirect the user to the View Newsletter page when they click on each item in the List View to enable them to view the title and content of the newsletter How to communicate with ChatGPT in ToolJetHere you ll learn how to communicate with ChatGPT via OpenAI in ToolJet by accepting prompts and generating email contents Setting up an OpenAI accountLog in or create an OpenAI account here Click Personal on the navigation bar and select View API keys from the menu bar to create a new secret key Generate a new API key and copy it somewhere on your computer We ll use it in the upcoming section Communicating with the OpenAI API in ToolJetUnder the Global Datasources tab on your dashboard click Plugins and select OpenAI Then paste your API key and organization ID into the input fields and test the connection You can now access the OpenAI data source from the query panel If you don t have an organization ID use “Personal Select OpenAI from the Query Panel and set its content to draft an email using ChatGPT Draft a newsletter about components prompt value Run the query when a user clicks the Ask button on the createNewsLetter page How to send emails via the Sendinblue API in ToolJetSendinblue is a digital marketing tool that provides Email SMS Facebook Chat and more via one platform to help grow businesses by building stronger customer relationships In this section you ll learn how to integrate and send emails via Sendinblue in ToolJet First you need to log in or create a SendinBlue account Select SMTP and API on your dashboard generate an SMTP key and copy it somewhere on your computer You ll need it shortly Return to your ToolJet app add a new SMTP data source and fill in the required credentials Your password is the generated SMTP key If successfully connected it will display Connection Verified Then you can start sending emails Next create the query for sending the emails Provide your email name the recipient s email subject and title components From the image above the email recipient is the data returned from another query queries querySubscriber data Since you need to send the newsletter to a particular group of subscribers when you select a group on the createNewsLetter page Therefore the querySubscriber query fetches the list of subscribers under a particular group The image above returns an array of the subscribers email related to the selected group Congratulations You ve completed this project Here is a working demo of the application Toolbus newsletter managerYou can also download its JSON file and import it into a ToolJet app but you ll need to provide your Sendinblue credentials and OpenAI API key ConclusionSo far you ve learnt how toadd a PostgreSQL database to ToolJetsend emails within a ToolJet application using Sendinblue communicate with ChatGPT in ToolJet andbuild full stack applications in a few minutes with ToolJet ToolJet is both an excellent development tool and open source meaning its code is readily available for everyone to modify and improve It has a large community of developers and talented contributors constantly maintaining and improving the software As a user you can be sure of getting the best performance when you use ToolJet Are you interested in contributing to ToolJet Feel free to check out our GitHub repo   to contribute and raise issues about ToolJet Thank you for reading 2023-06-06 11:44:47
海外TECH DEV Community A Complete Guide to Listing Docker Containers https://dev.to/refine/a-complete-guide-to-listing-docker-containers-e9a A Complete Guide to Listing Docker ContainersAuthor Muhammad Khabbab Brief overview of the importance of listing Docker containersListing containers is an essential task if you are working with containerized applications as this allows you to see the running container on a Docker host monitor their health efficiently utilize the resource help identify potential causes of the problem help balance loads organize container placement and also take care of security by checking the presence of unauthorized or malicious containers Listing Running Containers docker ps command to list only the running containers You might have created many containers Some are running but some are stopped Now you will execute the docker ps command for listing docker containers but executing this command will show you only running containers by default Explanation of the columns displayed in the output Once you have executed the docker ps command you can see the following output against each running container based on seven different columns Container Id This column contains the identity mapped to each container running Image This is an image of each container specifically used to create that container Command Command executed in the background to initialize and run each container Created Timestamp when each container is created Status The current state of each container that can be running exited paused removing restarting etc Ports Ports are bind to each container and they will help you to access the service inside each container by utilizing the host port For Example if host port is bind to container port then you can be able to access the container web content by using http localhost URL on your local machine Names Each running container has a unique name assigned to them Listing All Containers docker ps a command to list all containers including the stopped ones If you want to see all containers add a keyword with the docker ps command i e a This command will show you all containers whether they are running restarting paused or stopped Differentiating between running and stopped containers in the output In the output of the docker ps a command you can distinguish between running and stopped containers by looking at the STATUS column If the value is up hours the container has been running for the last hours and if the value is Exited hours go the container was stopped hours ago Listing Latest Containers docker ps l command to list the latest created container docker ps l is used to list the latest container created but the l keyword is depreciated in recent versions of docker Instead of l you can use docker ps n to see the latest one Using docker ps n it is important to set the limit of showing the latest containers you must add the number of limits after the n keyword For Example if you want to list the last latest containers created then you can execute docker ps n Explanation of the usefulness in scenarios where the latest container is of interest Rollback on encountering issues with the latest update Suppose you regularly deploy new updates to your containerized application and anything goes wrong after the last update In that case this command will help you easily identify most latest containers created since the last update for immediate rollback to the older version Limitation on resources for container deployment Suppose you have limited resources CPU RAM Storage etc and want an effective allocation of resources for that you need to have a track of the resource utilized by the most recent containers created and this command will help you list them all to make a change in their configuration to ensure efficiency Disabling Truncation docker ps no trunc command to disable truncation of container namesWhen you run the command docker ps you will find out that in output the values of a few columns are truncating making it difficult to understand especially when you need full container ids or image names For that purpose you need to use docker ps no trunc which will turn off the docker default truncating feature and give you a full view of values in the output Displaying full values in the output Following is the example output after disabling docker default truncation by using the docker ps no trunc command Listing the ID Only Quiet Mode docker ps q command to list only the container IDs in quiet modeMost of the time in the docker ps command output the additional information except Container ids is not useful for you and instead of showing images ports names etc against each container in the output you only want to list the container ids then for this purpose there is a specific command i e docker ps q that will customize your output to only display container ids Open source enterprise application platform for serious web developersrefine new enables you to create React based headless UI enterprise applications within your browser that you can preview tweak and download instantly By visually combining options for your preferred React platform UI framework backend connector and auth provider you can create tailor made architectures for your project in seconds It feels like having access to thousands of project templates at your fingertips allowing you to choose the one that best suits your needs Suitable for scenarios where only the container IDs are required Orchestration EnvironmentMost companies especially enterprises use orchestration tools like Kubernetes and docker swarm These orchestration tools often utilize Container IDs to manage and schedule containers You can retrieve a container ID and run operations on containers in the orchestration environment using docker ps q Connecting ContainersIn a distributed architecture we usually must establish a connection between containers for resource sharing network connectivity and scalability For creating a connection between containers we need to have IDs specific to them Using the command docker ps q we can quickly fetch the required ids to create a connection Viewing Container Size docker ps size command to display the size of containersAs we have discussed earlier in the Listing Latest Containers scenarios section that we might have limited resources so to avoid unnecessary usage we need to monitor the resource utilization by each container This specific command will facilitate us by representing the disk space utilized by each container and allow us to quickly identify containers that consume large amounts of space on the disk to take the appropriate actions Understanding the additional size column in the output The docker ps size command will add an additional column to the list of containers output that represents the Actual Size overall size and Virtual Size utilized by each container Actual Size The size utilized by the writable container layer consists of the container s filesystem and any modifications made Virtual Size If each layer in a container were to be separated and not shared the virtual size is the total amount of disk space required The combined size of all the container s layers which include any shares base pictures and additional layers comes under the virtual size Customizing the Output docker ps format command to customize the output format using Go templatesSuppose you want to get the customized output that will only contain the column of your choice while listing your containers In that case you can use docker ps with the keyword format along with the Go template string that is directly integrated with docker and can be used simply with the docker command because its syntax is native to the Go Programming Language on which the docker is itself built The command will look something like this docker ps format “GOTEMPLATE Go Template String Syntax docker ps format ID ID Name Names Image Image Status Status Double curly brackets are used to denote placeholders that relate to particular container properties such as ID Names Image and Status These placeholders will be replaced by actual values when you run the command Examples of customizing the displayed informationLet s customize an output that only displays Container ID Image and Name Let s customize an output that displays the latest containers with Container ID Status and additional column SIZE Using Advanced Filters docker ps filter command to apply advanced filters for listing specific containersDocker also provides advanced filtering options that will allow you to list the containers based on different attributes and conditions of your choice All you need to do is to add filter keyword with the key value pair Key will be the name of an attribute of the container on which you want to filter and Value will be the condition you want to apply to that attribute An interesting fact about the filter keyword is that you can repeat it multiple times with different conditions Filtering based on various criteria such as name label status etc Filtering Based on Name Only show the container with the name admiring benz Command docker ps filter “name admiring benz Filtering Based on Status Filter output based on different statuses e g exited created or running etc Commands docker ps filter “status running docker ps filter “status exited docker ps filter “status created Filtering Based on Label Filter output by using Filter keyword multiple times for status attribute and label conditioning Command docker ps filter status created filter label com example version Conclusion Recap of the different options and commands covered docker ps command can be use to list all containers that are running By using docker ps command with other options docker ps n docker ps l docker ps a docker ps q we can achieve the output with the list of the latest containers containers with ids only and containers in different states running stopped created etc The output of docker ps command can be customized by adding a format keyword followed by the Go Template in the command e g docker ps format TEMPLATE We can also use advance filters based on attributes to get the result with specific containers against docker ps command The actual and Virtual size of each container can be added and viewed in additional column of the container list by using size keyword with docker ps command e g docker ps size Final thoughts on the usefulness of Docker container listingContainer listing is useful for container management to view all created containers comprehensively It is useful in connecting different containers to share resources and monitor container specific health and performance Integrating container listing commands in scripts third party monitoring systems and orchestration tools will help to accomplish automated workflows Container listing will also assist in identifying the bug in the containerized environment by using them with logging allowing you to examine each container s details 2023-06-06 11:41:20
海外TECH DEV Community Power up your serverless application with AWS Lambda extensions https://dev.to/kumo/power-up-your-serverless-application-with-aws-lambda-extensions-3a31 Power up your serverless application with AWS Lambda extensionsAWS Lambda service comes packed with impressive features that might still be new to you One of them is the ability to run additional code side by side with the handler code This feature is called extensions This article teaches you how to use extensions in order to create your own monitoring tool for lambdas without compromising their performances The implementation uses NodeJs Lambda deployed with AWS CDK The Lambda extension featureLet s start by a quick recap on Lambda extension If you are already familiar with it feel free to jump to the creation part What is an Lambda extension An Lambda extension is a piece of code that runs in the same execution environment as the lambda handler It can be internal it runs in the same process as the handler code external it runs in a separate process In both case it shares the memory timeout and ephemeral storage of the execution environment with the handler It can interact with the Lambda service to be notified on each event received by the handler and can receive telemetry events from the Lambda service An internal extension can be used to add capabilities directly to the handler code because it runs in the same process For example an internal monitoring extension can override the http library to intercept and log all http calls Because it runs in a separate process an external extension can add capabilities to the handler without impacting its performance For example an external monitoring extension can send metrics to an external monitoring service after the handler has returned its response to avoid degrading an API performance How to use a Lambda extensionA Lambda extension comes as a Lambda layer To add an external extension you only need to add the layer to your lambda The extension process will be spawn automatically To add an internal extension you need to add the layer to your lambda but you also have to configure the runtime to execute the entrypoint of the extension alongside with the handler This configuration is done using runtime specific environment variable or wrapper script For example for NodeJs you can set the NODE OPTIONS environment variable to require opt my extension js or set the AWS LAMBDA EXEC WRAPPER environment variable to the path of a wrapper script ️How to create an extensionLet s create a monitoring extension that logs all http calls made by the lambda and send them to an external service for storage and visualisation We will use an internal extension to intercept all http calls and forward them to an external extension which sends a monitoring recap after each lambda invocation All the code following code is available on github CorentinDoue lambda extensions example Minimal repository to create and use both internal and external Lambda extensions with a NodeJs lambda Lambda extensions exampleThis example shows how to create a simple Lambda with a monitoring tool composed of an internal extension that logs all http calls made by the Lambdaan external extension that aggregate those logs and send them to an hypothetical monitoring toolInstallChange the urls in src urls ts to your own webhook urls pnpm install pnpm cdk bootstrap pnpm run deployTestpnpm integration test View on GitHub The interceptor internal extensionThe interceptor must be executed in the same process as the handler to be able to intercept all http calls The interceptor codeFor simplicity we use msw as an out of the box node interceptor src layers monitorExtension partial interceptor tsimport rest from msw import setupServer from msw node const server setupServer rest all async req gt const url req url toString const method req method console log request intercepted in interceptor method url return req passthrough server listen onUnhandledRequest bypass Then we forward the logs to the external extension with a local http call We must use the sandbox url because it s the only one authorized in the lambda execution environment The port is free so I chose a random one src layers monitorExtension interceptor tsimport rest from msw import setupServer from msw node import fetch from node fetch console log Executing interceptor extension code const LOG EXTENSION SERVER URL http sandbox const server setupServer rest all async req res ctx gt const url req url toString Bypass the calls made by this code to the local server to avoid infinite loop if url includes LOG EXTENSION SERVER URL return req passthrough const method req method const headers req headers const body await req text console log request intercepted in interceptor method url fetch LOG EXTENSION SERVER URL method POST body JSON stringify url method headers body date new Date toISOString catch error gt console error error sending logs in interceptor extension error return req passthrough server listen onUnhandledRequest bypass Deploy the internal extensionFirst we need to make the extension code executable by the lambda The simplest way is to use esbuild to bundle it in a single cjs file That s basically what is done with the handler code under the wood by CDK when using the NodejsFunction construct But here we need to do it manually scripts build interceptor node modules bin esbuild src layers monitorExtension interceptor ts bundle outfile dist layers monitorExtension interceptor js platform node main fields module main Then we need to ship the code to the lambda thanks to a lambda layer With CDK we can use the LambdaLayerVersion construct to create a layer which will ship all the content of a directory into the opt folder of the lambda lib partial stack tsexport class AppStack extends Stack constructor scope Construct id string props StackProps super scope id props const layer new LayerVersion scope MonitorLayer code Code fromAsset dist layers monitorExtension const helloFunction new NodejsFunction this Hello runtime Runtime NODEJS X handler handler entry path join dirname src functions hello handler ts layers layer Finally we need to configure the lambda to execute the interceptor code alongside the handler code For that we will use a runtime specific environment variables For NodeJs we need to set the NODE OPTIONS environment variable to require opt interceptor js lib stack tsexport class AppStack extends Stack constructor scope Construct id string props StackProps super scope id props const layer new LayerVersion scope MonitorLayer code Code fromAsset dist layers monitorExtension const helloFunction new NodejsFunction this Hello runtime Runtime NODEJS X handler handler entry path join dirname src functions hello handler ts layers layer environment NODE OPTIONS require opt interceptor js That s it We have created our internal extension ResultsLets deploy it on a simple lambda that make http calls src functions hello handler tsimport fetch from node fetch export const hello async gt await fetch await fetch method POST body JSON stringify message hello world return statusCode headers Content Type application json body JSON stringify message OK export const handler hello We can see those logs The interceptor code ran alongside the handler code and intercepted the http calls But we can see that it fails to forward them to the local http server because it doesn t exist Let s create the external extension to fix that The monitoring external extensionWe want to aggregate the logs and send them to an external service without impacting the lambda performance So we will use an external process aka an external extension to handle those logs The external extension codeFirst we want our external process to be aware of whats happening in the lambda To do so we can use the lambda extension API to register the process as an extensionsubscribe to various lambda events or telemetry eventsIf you re not familiar with the lambda extension API I recommend you to read the wonderful article Simplifying internal AWS Lambda APIs of Wakeem s World I published a node package inspired by his article to abstract the communication with the lambda extension API CorentinDoue lambda extension service SDK to easily implement nodejs lambda extension Lambda extension serviceSDK to easily build Lambda extensions in NodeJs and typescript Inspired by Simplifying internal AWS Lambda APIsInstallationpnpm add lambda extension serviceor if using yarnyarn add lambda extension serviceor if using npmnpm install lambda extension serviceUsageimport EventTypes ExtensionAPIService TelemetryEventTypes from lambda extension service async gt const extensionApiService new ExtensionAPIService extensionName my extension await extensionApiService register EventTypes Invoke EventTypes Shutdown extensionApiService onTelemetryEvent event gt console log Telemetry event received JSON stringify event await extensionApiService registerTelemetry TelemetryEventTypes Function TelemetryEventTypes Platform TelemetryEventTypes Extension while true const event await extensionApiService next console log… View on GitHubWith it we can easily register our external extension and subscribe to all the invocation events and be notified when the lambda is about to shutdown src layers monitorExtension partial monitor tsimport EventTypes ExtensionAPIService from lambda extension service console log Executing monitor extension code const main async gt const extensionApiService new ExtensionAPIService extensionName monitor await extensionApiService register EventTypes Invoke EventTypes Shutdown while true const event await extensionApiService next console log Received event event main catch error gt console error error Now we can start a http server to receive the logs from the internal extension src layers monitorExtension logServer tsimport createServer from http import Log from types type LogServerOptions port number export const listenForLog onLogReceived log Log gt void port LogServerOptions port gt const server createServer function request response if request method POST let body request on data function data body data request on end function try onLogReceived JSON parse body catch e console error failed to parse logs e response writeHead response end OK else console error unexpected request request method request url response writeHead response end server listen port sandbox console info Listening for logs at http sandbox port And then aggregate and send them to an external service on each new invocation or on shutdown src layers monitorExtension monitor tsimport EventTypes ExtensionAPIService from lambda extension service import Log from types import LogAggregator from logAggregator import listenForLog from logServer import LambdaContext from lambdaContext import forwardLogs from forwardLogs console log Executing monitor extension code const main async gt const logAggregator new LogAggregator const lambdaContext new LambdaContext const onLogReceived log Log gt logAggregator addLog log lambdaContext getRequestId listenForLog onLogReceived const extensionApiService new ExtensionAPIService extensionName monitor await extensionApiService register EventTypes Invoke EventTypes Shutdown while true const event await extensionApiService next const lastContext lambdaContext getContext lambdaContext updateContext event if lastContext undefined await forwardLogs context lastContext logs logAggregator getLogs lastContext requestId main catch error gt console error error Deploy the external extensionFirst we also need to make the extension code executable by the lambda But this time it should be a standalone executable file We reuse the same esbuild command as with the interceptor extension but we need to add a shebang to make the file executable with the banner js usr bin env node option scripts build monitor node modules bin esbuild src layers monitorExtension monitor index ts bundle outfile dist layers monitorExtension monitor js platform node main fields module main banner js usr bin env node Then we need to ship the code to the lambda thanks to a lambda layer By outputting the build of the monitor code in the same folder as the interceptor code dist layers interceptorExtension the layer will ship both files without changing our CDK configuration Finally we need to make the lambda execute the monitor process By default the lambda service will try to execute all files in the opt extensions folder when starting the lambda environment So let s add a bash script into dist layers monitorExtension extensions to start the monitor code dist layers monitorExtension extensions monitor bin bashset euo pipefailOWN FILENAME basename LAMBDA EXTENSION NAME OWN FILENAME external extension name has to match the filenameNODE OPTIONS Needed to reset NODE OPTIONS set by Lambda runtime Otherwise the internal interceptor extension will be loaded in the external process too exec opt LAMBDA EXTENSION NAME js This script will be shipped to opt extensions monitor and will be executed automatically by the lambda service Note that the environment variables of the lambda are shared between processes So the external process will have the NODE OPTIONS set to require the interceptor code We need to reset NODE OPTIONS to avoid this and cause the interceptor code to be load twice and intercept the monitor calls That s it We finished our monitoring extension ResultsLet s deploy it again on our previous lambda Here are the final logs The lambda service inits the lambda execution environmentThe monitoring external extension initializesThe interceptor internal extension initializesThe lambda service acknowledges the initialization of the monitoring extensionThe lambda service starts the first event handlingThe interceptor internal extension intercepts the two http callsThe lambda service ends the first event handlingThe lambda service starts the second event handlingThe monitoring external extension sends the logs of the first event to the external monitoring serviceThe interceptor internal extension intercepts the two http callsThe lambda service ends the first event handlingAt lambda shutdown the monitoring external extension sends the logs of the second event to the external monitoring serviceOn the fake external monitoring service we received aggregated logs by event ️Test it on your own AWS account using the dedicated repository CorentinDoue lambda extensions example Minimal repository to create and use both internal and external Lambda extensions with a NodeJs lambda Lambda extensions exampleThis example shows how to create a simple Lambda with a monitoring tool composed of an internal extension that logs all http calls made by the Lambdaan external extension that aggregate those logs and send them to an hypothetical monitoring toolInstallChange the urls in src urls ts to your own webhook urls pnpm install pnpm cdk bootstrap pnpm run deployTestpnpm integration test View on GitHub ConclusionNow know how to create internal and external extensions for lambda It s a powerful way to implement and share support tools for your lambdas without impacting their performances and without directly modifying the handler code written by other developers Feel free to share your thoughts and questions in the comments below I will be happy to answer them 2023-06-06 11:14:12
Apple AppleInsider - Frontpage News Apple accidentally releases public iOS 17 beta early https://appleinsider.com/articles/23/06/06/apple-accidentally-releases-public-ios-17-beta-early?utm_medium=rss Apple accidentally releases public iOS beta earlyThe developer only beta of iOS is available to all users seemingly by mistake Apple announced at WWDC that a public beta or test release of the forthcoming iOS would be released in July But it is now already available in what has to be a simple but colossal mistake As first spotted by Twitter user Connor Jewiss iOS is listed as available for download in the beta section of Settings This is the same release that has been correctly released for developers Read more 2023-06-06 11:58:39
Apple AppleInsider - Frontpage News First iOS 17 developer beta references new MagSafe accessories https://appleinsider.com/articles/23/06/06/first-ios-17-developer-beta-references-new-magsafe-accessories?utm_medium=rss First iOS developer beta references new MagSafe accessoriesThere may be a new MagSafe Charger on the way with references in the first developer beta of iOS also mentioning a MagSafe Battery Pack MagSafe Battery PackDevelopers have just gotten their hands on the first beta release of iOS and are combing through it for new features and unmentioned secretive items An early discovery appears to revolve around MagSafe hardware Read more 2023-06-06 11:55:52
Apple AppleInsider - Frontpage News iOS 17 feature roundup: StandBy, NameDrop, Contact Posters, more https://appleinsider.com/articles/23/06/06/ios-17-feature-roundup-standby-namedrop-contact-posters-more?utm_medium=rss iOS feature roundup StandBy NameDrop Contact Posters moreThe WWDC keynote was jam packed with news and didn t even include everything coming to iOS Here are all of the features we ve found so far iOS has a lot of new featuresApple flew through the software portion of its WWDC keynote to ensure there was space for the Apple Vision Pro and visionOS So although iOS wasn t the focus it still held plenty of new features for users and developers Read more 2023-06-06 11:16:54
Apple AppleInsider - Frontpage News Apple Design Awards winners revealed at WWDC 2023 https://appleinsider.com/articles/23/06/06/apple-design-awards-twelve-winners-revealed?utm_medium=rss Apple Design Awards winners revealed at WWDC As part of WWDC Apple has selected and announced the twelve winning apps and games across six categories for the Apple Design Awards Apple Design AwardsEach WWDC the best apps and games on the App Store compete for top honors from Apple The winners were chosen from finalists which demonstrated outstanding technical achievement Read more 2023-06-06 11:02:00
海外TECH Engadget Google brings its predictive smart compose feature to Chat https://www.engadget.com/google-brings-its-predictive-smart-compose-feature-to-chat-113511311.html?src=rss Google brings its predictive smart compose feature to ChatGoogle s Slack like business app Chat previously known as Hangouts is getting an AI update on web the company announced As with Docs and Gmail Google is introducing quot smart compose quot suggesting relevant phrases in context as you write effectively saving time by reducing repetitive typing The aim the company said is to help you communicate with colleagues quicker quot to move conversations or projects forward more efficiently quot Google has notoriously confusing communications around its messaging apps so as a reminder Chat is its enterprise chat app originally introduced among a slate of business offerings It has features similar to the original Hangouts experience but with upgrades like reactions and reply suggestions While designed for enterprises it s available for free to individual users as well nbsp GoogleChat got Google s Material Design treatment earlier this year tying it more closely to Gmail from where it can be directly launched Along with new fonts colors panel sizing and other aesthetic changes Google introduced a new topic button designed to make project collaboration easier nbsp Since Chat has a lot in common with Gmail it makes sense to have the smart compose option in both apps Google notes that it will be turned ON by default and can be disabled by unchecking quot Enable predictive suggestions as you compose a message on web and desktop quot under smart compose As mentioned the update only pertains to the web version ーit s now rolling out to rapid release domains and will arrive to others starting on June th nbsp This article originally appeared on Engadget at 2023-06-06 11:35:11
海外TECH Engadget The Morning After: Apple reveals its mixed reality headset, the Vision Pro https://www.engadget.com/the-morning-after-apple-reveals-its-mixed-reality-headset-the-vision-pro-111424711.html?src=rss The Morning After Apple reveals its mixed reality headset the Vision ProIt s an Apple heavy TMA today so strap in At its WWDC keynote yesterday Apple revealed almost everything about its first spatial computing headset the Vision Pro In typical Apple style it looks almost completely different to existing headsets As Engadget s Devindra Hardawar put it during his time with the device the Vision Pro is like the iPod to MP players of old the iPhone to the BlackBerry AppleThe Vision Pro is a standalone headset well with battery pack that forgoes controllers Instead through external and internal sensors and cameras you use the Vision Pro with voice input and hand eye gestures You can finger pinch to select things and use pinch slide motion for scrolling up down or left right Unlike the Oculus Quest series you can even make those hand gestures comfortably on your lap you don t have to hold your hands up dramatically like a Minority Report cosplayer The most unusual twist might be EyeSight Apple uses the curved display on the headset s exterior to display your eyes and reactions while you re wearing the device Apple s visionOS made for this new kind of product feels like a cross between iOS and macOS powered by a new R chip and an M processor to deliver what Apple describes as responsive quot lag free quot standalone performance Tapping the digital crown yes like the Apple Watch brings up your app icons while in some demos rotating the crown will blend the augmented reality vision into a more immersive one Read our full impressions testing out the headset right here but expect to wait and save up the Vision Pro will be and it won t be available until early Countries outside the US will have to wait longer still Mat SmithThe Morning After isn t just a newsletter it s also a daily podcast Get our daily audio briefings Monday through Friday by subscribing right here The biggest stories you might have missedWatch Apple s WWDC keynote in minutes Microsoft will pay the FTC million to settle charges over collecting children s data The God of War Ragnarok PlayStation bundle is cheaper than ever Apple s inch MacBook Air versus the competition Apple s upgraded Mac Studio includes the M Max or M Ultra chipiPadOS gets a customizable lock screen interactive widgets and Apple Health macOS Sonoma brings widgets to the desktopThe best backpacking and camping gear for dadsApple finally announces the inch MacBook Air for Another device that s been a long time coming EngadgetAs expected the new MacBook Air is extremely similar to the redesigned inch version announced at WWDC one year ago just a bit bigger But it marks the first time Apple has released a laptop with a screen this size that wasn t part of its quot pro quot lineup of devices stretching all the way back to the PowerBook era of Apple laptops The inch MacBook Air has the same M chip as the smaller model but Apple hasn t said exactly what the resolution of the inch MacBook Air display is yet It doesn t have the ProMotion adaptive refresh rate up to Hz this one tops out at Hz Apple says it should offer hours of battery life and is only about pounds and mm thick The laptop starts at and is available to pre order Continue reading Apple s iOS adds Live Voicemail StandBy and a Journal appIt also has improved sharing and a smarter Siri AppleThe big update to your iPhone brings a raft of improvements to smartphone basics Incoming calls can now include custom posters for certain contacts and you ll get Google style live transcripts for voicemail Messages meanwhile offers easier replies audio message transcripts and a check in feature that automatically lets people know if you ve arrived or are delayed You ll even be able to leave voicemails through Facetime With NameDrop a new feature you can share contact details just by bringing your iPhone close to someone else s device You can also share photos that way and leave AirDrop transferring content even when you have to step away As rumored you ll also get a new Journal app which will send shockwaves to the litany of third party journaling and diary apps already out The iOS developer preview is available today with a public beta coming in July The software will officially debut this fall Continue reading Apple drops support for the iPhone and X with iOS All the compatible devices for Apple s upcoming operating systems If you re still clinging on to an iPhone iPhone Plus or iPhone X you won t be able to update it to iOS In other words your iPhone will need to have an A Bionic or later chip to install the new OS If you have an iPhone XR XS XS Max iPhone SE second gen or later you ll have access to features including Live Voicemail transcripts the StandBy display mode and improved autocorrect Continue reading The Apple Watch embraces widgets again in watchOS A new version of the old Glances feature Your Apple Watch may look very different when watchOS arrives As expected the company is giving the smartwatch user interface an overhaul as part of one of the firmware s biggest updates yet The original Apple Watch UI was designed in part around Glances a carousel of widgets for different apps and features You ll be able to rotate the Digital Crown to access a smart stack of relevant widgets Things like timers stopwatches and podcasts will show up as widgets when they re in use You can even have a widget with your favorite complications A public beta will arrive next month and Apple plans to release watchOS this fall Continue reading Reddit communities are going dark to protest changes that would hurt third party appsThe subreddits object to pricing that could hurt apps like Apollo Reddit s potential threat to third party apps is prompting a high profile protest Dozens of subreddits including major examples like Earthporn LifeProTips ReactionGIFs and Videos have declared they re quot going dark quot that is going private starting June th in response to an API pricing increase they believe will shut out third party clients Some will resume public access after hours but others will quot permanently quot isolate themselves until Reddit addresses their concerns Christian Selig the creator of popular client Apollo says the API pricing would cost him million per year The developers of other apps such as Narwhal and Reddit is Fun have also warned they can t afford the new prices and will likely shut down soon as a result Moderators are concerned because third party Reddit apps frequently include customizations and other features that help keep subreddits in check Continue reading This article originally appeared on Engadget at 2023-06-06 11:14:24
海外TECH CodeProject Latest Articles VS2022, ver. 17.6.2 – EntityFramework6 broken https://www.codeproject.com/Tips/5362208/VS2022-ver-17-6-2-EntityFramework6-broken classic 2023-06-06 11:16:00
医療系 医療介護 CBnews 要件満たさない企業は市場参入できない仕組みを-医薬品供給の有識者検討会報告案、引き続き検討も https://www.cbnews.jp/news/entry/20230606201202 厚生労働省 2023-06-06 20:35:00
ニュース BBC News - Home Phillip Schofield: ITV defends duty of care to staff at 'toxic' This Morning https://www.bbc.co.uk/news/entertainment-arts-65818564?at_medium=RSS&at_campaign=KARANGA editor 2023-06-06 11:23:21
ニュース BBC News - Home Daniel Allen pleads guilty to killing Gossett family in house fire https://www.bbc.co.uk/news/uk-northern-ireland-65820447?at_medium=RSS&at_campaign=KARANGA morgana 2023-06-06 11:49:00
ニュース BBC News - Home NHS failing women, England's health guru says https://www.bbc.co.uk/news/health-65809418?at_medium=RSS&at_campaign=KARANGA england 2023-06-06 11:13:46
ニュース BBC News - Home Scotland's transport minister quits due to poor mental health https://www.bbc.co.uk/news/uk-scotland-scotland-politics-65823221?at_medium=RSS&at_campaign=KARANGA health 2023-06-06 11:43:55
ニュース BBC News - Home Manchester Arena bomb victim's mother says she is broken https://www.bbc.co.uk/news/uk-england-manchester-65821713?at_medium=RSS&at_campaign=KARANGA arena 2023-06-06 11:15:32
ニュース BBC News - Home Prince Harry accuses tabloids of casting him as 'thicko' https://www.bbc.co.uk/news/uk-65818521?at_medium=RSS&at_campaign=KARANGA newspapers 2023-06-06 11:52:12
ニュース BBC News - Home Nursing: Strikes 'because patients are dying', says nurse https://www.bbc.co.uk/news/uk-wales-65815004?at_medium=RSS&at_campaign=KARANGA picket 2023-06-06 11:48:41
ニュース BBC News - Home Vision Pro: Apple's new augmented reality headset unveiled https://www.bbc.co.uk/news/technology-65809408?at_medium=RSS&at_campaign=KARANGA device 2023-06-06 11:31:47
ニュース BBC News - Home Lord John Morris, ex-Welsh secretary and Blair attorney general dies https://www.bbc.co.uk/news/uk-wales-politics-65484126?at_medium=RSS&at_campaign=KARANGA fruition 2023-06-06 11:33:41
ニュース BBC News - Home David Warner: Stuart Broad rivalry, playing the pantomime villain and Ashes look ahead https://www.bbc.co.uk/sport/av/cricket/65822655?at_medium=RSS&at_campaign=KARANGA David Warner Stuart Broad rivalry playing the pantomime villain and Ashes look aheadDavid Warner looks ahead to the Ashes series against England as he discusses his rivalry with Stuart Broad and his role as pantomime villain 2023-06-06 11:23:25
ニュース BBC News - Home French Open 2023: Karolina Muchova beats Anastasia Pavlyuchenkova to reach semi-finals https://www.bbc.co.uk/sport/tennis/65820023?at_medium=RSS&at_campaign=KARANGA French Open Karolina Muchova beats Anastasia Pavlyuchenkova to reach semi finalsKarolina Muchova reaches her first French Open semi final with a straight set victory over former finalist Anastasia Pavlyuchenkova 2023-06-06 11:02:01
ニュース BBC News - Home Ukraine dam: Thousands evacuated from ‘critical zone’ near Kakhovka plant https://www.bbc.co.uk/news/world-europe-65819591?at_medium=RSS&at_campaign=KARANGA ukraine 2023-06-06 11:11:04
ニュース BBC News - Home Why is the Kakhovka dam important? https://www.bbc.co.uk/news/world-europe-65818705?at_medium=RSS&at_campaign=KARANGA kherson 2023-06-06 11:45:11
ビジネス ダイヤモンド・オンライン - 新着記事 アップルのAR端末が抱える現実的な課題 - WSJ発 https://diamond.jp/articles/-/324092 課題 2023-06-06 20:19:00
IT 週刊アスキー 「iPadOS 17」発表! ヘルスケアアプリや新型ウィジェットでiPadがより便利に https://weekly.ascii.jp/elem/000/004/139/4139860/ ipados 2023-06-06 20:30:00
IT 週刊アスキー インテリアに馴染む木目調デザインの5個口電源タップ、サンワサプライ https://weekly.ascii.jp/elem/000/004/139/4139826/ 差し込み 2023-06-06 20:30:00
IT 週刊アスキー Yahoo!乗換案内・MAP、小田急バスのリアルタイムな接近・遅延情報に対応 https://weekly.ascii.jp/elem/000/004/139/4139817/ yahoo 2023-06-06 20:15:00
IT 週刊アスキー 日本郵便、約2万店の全直営郵便局でキャッシュレス導入へ。9月末までに https://weekly.ascii.jp/elem/000/004/139/4139831/ 日本郵便 2023-06-06 20:45: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件)