TECH |
Engadget Japanese |
インテル、ノート向けGPU「Arc A」シリーズ発表。4月より搭載PC発売へ。デスクトップ版は夏に延期 |
https://japanese.engadget.com/intel-arc-a-series-desktop-gpu-215039443.html
|
製品 |
2022-03-30 21:50:39 |
IT |
ITmedia 総合記事一覧 |
[ITmedia News] Chrome OS(ChromebookのOS)もバージョン100に ランチャーや音声入力改善など |
https://www.itmedia.co.jp/news/articles/2203/31/news088.html
|
chrome |
2022-03-31 06:39:00 |
IT |
ITmedia 総合記事一覧 |
[ITmedia ビジネスオンライン] “恐竜”が出迎えるイトーヨーカ堂の新フロアが面白い! エンタメは大型商業ビジネスの切り札となるか |
https://www.itmedia.co.jp/business/articles/2203/31/news040.html
|
itmedia |
2022-03-31 06:30:00 |
Google |
カグア!Google Analytics 活用塾:事例や使い方 |
世界のフォートナイトのメタバース制作ではスタジオやチームがすでに一般的 |
https://www.kagua.biz/playgame/fortnite-playgame/20220331a1.html
|
人気ゲーム |
2022-03-30 21:00:46 |
AWS |
AWS Networking and Content Delivery |
Implementing Default Directory Indexes in Amazon S3-backed Amazon CloudFront Origins Using CloudFront Functions |
https://aws.amazon.com/blogs/networking-and-content-delivery/implementing-default-directory-indexes-in-amazon-s3-backed-amazon-cloudfront-origins-using-cloudfront-functions/
|
Implementing Default Directory Indexes in Amazon S backed Amazon CloudFront Origins Using CloudFront FunctionsAmazon CloudFront Functions now makes it possible to do things that were previously only possible with AWS Lambda Edge but in a more performant manner For example now you can manipulate the URI pathーsomething that is essential when you want to secure an origin using an Origin Access Identity OAI with Amazon CloudFront In I … |
2022-03-30 21:46:54 |
AWS |
AWS - Webinar Channel |
Introduction to Amazon DocumentDB (with MongoDB compatibility) with hands on labs |
https://www.youtube.com/watch?v=atN4n55iXkE
|
Introduction to Amazon DocumentDB with MongoDB compatibility with hands on labsAmazon DocumentDB is a scalable highly durable and fully managed database service for operating mission critical MongoDB workloads With Amazon DocumentDB you can run the same application code and use the same drivers and tools that you use with MongoDB For customers migrating from MongoDB DocumentDB requires zero to minimal code changes to your existing applications and integrates natively with existing AWS services Learning Objectives Receive an introduction to Amazon DocumentDB including why Document Databases use cases differences between DocumentDB and traditional databases and challenges scaling traditional databases Hands on labs with expert guidance on getting started with Amazon DocumentDB Please come prepared to build To learn more about the services featured in this AWS Virtual Workshop please visit |
2022-03-30 22:00:08 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
mtg-sdk-pythonで四苦八苦する |
https://qiita.com/poslogithub/items/a23252dd6b7075c5453f
|
MTGArenaでは日本語版カード画像があるように見えるが、あれは多分レイアウトにアートとテキストを重ねて生成したもので、印刷用の日本語版カード画像というのはどこにも無い。 |
2022-03-31 06:29:05 |
海外TECH |
Ars Technica |
Apple plans to build its own financial infrastructure for payments and lending |
https://arstechnica.com/?p=1844608
|
sources |
2022-03-30 21:11:44 |
海外TECH |
MakeUseOf |
How to Create an Ebook With Canva |
https://www.makeuseof.com/how-to-create-ebook-canva/
|
canva |
2022-03-30 21:30:13 |
海外TECH |
MakeUseOf |
How to Get CNN+ at Half Price for Life (Limited Time Offer) |
https://www.makeuseof.com/how-to-get-cnn-half-price-for-life/
|
limited |
2022-03-30 21:07:59 |
海外TECH |
DEV Community |
100 Days of Swift - Day 2 |
https://dev.to/davjvo/100-days-of-swift-day-2-32n4
|
Days of Swift Day Continuation of Hacking With Swift Days of SwiftDay Arrays Dictionaries Sets and EnumsArrays are a standard type declaration is not instead of int in swift we do Int Sets are quite simple just use the named reserved function Set Have in mind that these guys are unordered not random just unordered Talking about functions in swift you only use func nameOfFunction property type as a definer but when you call them you need to do it weirdly as nameOfFunction property value Tuples like in Net are fixed size but have the advantage that can be named iirc Named tuples only come later in Net or something Dictionaries are declared like in JavaScript which btw accessing a none existing key instead of throwing an error returns nil null in other languages let s not talk about undefined if you don t want nil to show you can use dictionary nonExistingKey default fallback string Lastly for type declaration we go as String otherType ex String Double Enums are declared differently but just a bit Inside each option of an enum you d have to add the reserved keyword case which results in enum Directions case north case south and for specific values inside enums works exactly like Net ALERT the semicolon is only needed since this is an enum declared as a one liner in a line break enum the semicolon is not required Enums in swift can also have an associated value where we can create something like enum Weather case sunny case windy speed Int and we would get windy speed as a result Side note I need to look up for swift naming standards eventually |
2022-03-30 21:35:24 |
海外TECH |
DEV Community |
How to use Puppeteer inside a Docker container |
https://dev.to/cloudx/how-to-use-puppeteer-inside-a-docker-container-568c
|
How to use Puppeteer inside a Docker container IntroductionPuppeteer is a Node js library which provides a high level API to control Chromium or Firefox browsers over the DevTools Protocol This guide helps to use Puppeteer inside a Docker container using the Node js image If we use the Docker images for Node js v LTS Gallium when installing the chromium package from apt it will be v which can have compatibility issues with the latest Puppeteer This is because it was tested with the latest Chromium stable release Selecting the correct imageWell we want to run a web browser inside a container it s important to know what are the different between the available variants Alpine is enough but Yeah we can run Chromium using Alpine Linux but we ll need a few extra steps to make it run That s why we prefer Debian variants to make it easier Which distro Every major version of Node js in built over a version of Debian and that Debian version comes with an old version of Chromium which one could be not compatible with the latest version of Puppeteer Node jsDebianChromiumv v v To quickly solve that issue we can use the Google Chrome s Debian package that always installs the latest stable version Therefore this Dockerfile is compatible with Node js v v or any new one Why not the built in ChromiumWhen we install Google Chrome apt will install all the dependencies for us DockerfileFROM node slim AS app We don t need the standalone ChromiumENV PUPPETEER SKIP CHROMIUM DOWNLOAD true Install Google Chrome Stable and fonts Note this installs the necessary libs to make the browser work with Puppeteer RUN apt get update amp amp apt get install curl gnupg y amp amp curl location silent apt key add amp amp sh c echo deb arch amd stable main gt gt etc apt sources list d google list amp amp apt get update amp amp apt get install google chrome stable y no install recommends amp amp rm rf var lib apt lists Install your app here The code configRemember to use the installed browser instead of the Puppeteer s built in one inside your app s code import puppeteer from puppeteer const browser await puppeteer launch executablePath usr bin google chrome args if we need them ConclusionThe browser installation via apt will resolve the required dependencies to run a headless browser inside a Docker container without a manual intervention these dependencies are not included in the Node js Docker images by default The easiest path to use Puppeteer inside a Docker container is installing Google Chrome because in contrast to the Chromium package offered by Debian Chrome only offers the latest stable |
2022-03-30 21:30:08 |
海外TECH |
DEV Community |
101 touches of coding Linux tool with C# for fun |
https://dev.to/stipecmv/101-touches-of-coding-linux-tool-with-c-for-fun-1gaa
|
touches of coding Linux tool with C for funIt is hard to start such a blog but at least it can serve me as feedback during developing a Linux application with C You can ask if I am crazy C and Linux it is not a good idea but you know what I do not care I know or at least I think I know how to code within C So why not use my existing experience and create something that will help At least for me I like UI applications and Linux has plenty of space where such applications exist only in the form of terminals For me I see a space in managing installed software especially this is a problem in Arch Linux distributions So I will try to create a UI tool for installing uninstalling updating applications installed on Arch based distributions of Linux You can still ask why and what touch means Actually is a cool number like dalmatians So it means I do not know how many specific articles for this topic I will write Problems will show if it is relevant to share it as an article in my blog But still touches What do you mean by that you can ask Basically it will be one touch for one article I would like to share with others It can refer to some specific problem or solution I will face What tools do I plan to use during such a journey As the title says I will use C and Linux but more specifically I have an idea of what I want to use so in the list below it is written but by the time I will update it when I use something else so I can then check backwards as a retrospective my chosen paths Also next to that I will use the yay tool which has plenty of possibilities for what I need to execute behind the UI for the user Arch Linux I will use Endeavour distribution currently the latest is the Atlantis Neo releaseC for UI with C I will use the Avalonia framework together with its Avalonia Diagnostics and Avalonia ReativeUIReactiveUI Fody for simplifying and removing the need of implementing INotifyPropertyChanged interface for each View Modelfor logs I will use Serilog together with Serilog Sinks Constole and Serilog Sinks FileSplat for Service Location together with Spat Serilog to simplify loggingCliWrap for executing yay commandsNUnit for unit testsCurrently not sure but maybe also FluentAssertionsSpecflow with NUnit for BDD testsOwn tasks and targets for MSBuild as a building mechanismfor CI CD maybe Azure Dev OpsGitHub and maybe GitHub free actionsI decided that my project will be called yay see sharp Because in base it will be UI for yay in C If you liked this you can follow my next progress and give me feedback during articles Also from this article you will be able to navigate to my next “touches The list is here |
2022-03-30 21:28:50 |
海外TECH |
DEV Community |
Why We Chose Polygon Over Ethereum |
https://dev.to/codecast/why-we-chose-polygon-over-ethereum-1o49
|
Why We Chose Polygon Over EthereumWe recently announced Codewrangrlz an exploratory project in the web world When we announced the project we published a blog post detailing the project and what our goals were However one of the things that have been very clear to us since we began entering this space is that there are a lot of controversies surrounding blockchains NFTs and DeFi In this post we want to outline some more aspects of the project including the reasons behind choosing to work on the Polygon chain Above all else we love to learn and all of us here at CodeCast love to learn by doing While trying to absorb as much information as we could we realized very quickly that building out an NFT project from scratch was going to be our best bet at understanding it Our end goal is not only to be able to communicate effectively with members of our community who are learning web but to be able to create some teaching materials ourselves Despite the controversies the web space is constantly growing It s hard to go on Twitter without seeing anything about it It s establishing its place in the developer community and appears to only be growing with time So with all that being said we want to discuss one of the major points of concern with the community as a whole Proof of work vs Proof of stakeThere has been a lot of conversation surrounding energy usage in the blockchain space The concerns have reached far outside the community highlighting the validity of the concern Energy usage is a very important and real topic in our current world Tech companies play an important role in changing the way we consume and spend energy and this has rightfully become a very large topic Whether you re familiar with blockchain technology or not you have likely heard the phrase “mining Mining is how transactions are confirmed and added to the blockchain This process is actually the proof of work mechanism Miners work to solve a mathematical problem as fast as possible as the first one to solve the problem gets to update the blockchain in return receiving an amount of crypto in return Since everyone on the chain can compete this has led to large mining farms which are using a ton of energy Currently the Ethereum blockchain Ethereum is proof of work The goal is to transition to the proof of stake mechanism for Ethereum which is hoped to be released by the end of the year Proof of stake operates differently Instead of every node competing to solve a problem at once nodes are “randomly selected to validate a block The randomness isn t truly random though as a validator instead of a miner has to add a “stake think of it as a security deposit The larger the stake the better chance you have of being chosen to validate the block If you validate the block you receive crypto in return There are of course a lot of other aspects that separate the proof of work and proof of stake mechanisms and I highly recommend the video below if you want to learn a bit more without getting completely overwhelmed with information PolygonSo this is where Polygon comes in Polygon is a side chain on the Ethereum chain It s what s called a Layer Scaling Solution I know it sounds incredibly confusing and if you want to learn more about it I recommend this video In short form all you need to understand is that the Polygon network runs parallel to the Ethereum network and it has its own cryptocurrency called Matic Our decision to use Polygon instead of Ethereum was based on two main factors mechanism and cost Polygon use proof of stake which is significantly better for the environment When Ethereum switches to proof of stake and releases they are stating they will be able to reduce their energy impact by That s a mind blowing decrease and really showcases how much less energy the proof of stake mechanism uses Given that we are concerned about our own environmental impact proof of stake felt like the only real choice Polygon has the proof of stake mechanism that we wanted but it also has a significantly lower cost than Ethereum which makes it a much more accessible chain for everyone in the community It s a great place for people to get started in the NFT world and since we wanted to create a project that added some exciting utilities for our users it needed to be accessible to the average user As a whole the space is constantly evolving and we were looking to find somewhere for ourselves and our community in it We ll be announcing some of our NFT utilities soon so if you re as excited about this space as we are definitely follow Codewranglrz to stay updated with everything we re doing |
2022-03-30 21:16:14 |
海外TECH |
DEV Community |
Turbocharge your monorepo with Lerna and Github Actions |
https://dev.to/eteesh/turbocharge-your-monorepo-with-lerna-and-github-actions-3bgo
|
Turbocharge your monorepo with Lerna and Github Actions ProblemAt Scalable Capital we use a Whitelabel platform which is a common place for reusable react components configs helpers etc The platform is organised in a monorepo to manage it s packages We re using Lerna to handle the packages and their dependencies Now Lerna does not uses any cache system Every time you build or run tests on root level it will run everything for all packages even if you changed a file in one of the packages This is bad because building and testing takes time and can take up lot of development time What if somehow we build and run tests only for the package that is changed and not all packages What if we can cache the Github action workflows for the Pull requests subsequent commits for PR checks Enter Turborepo ️ ChangesLet s get right into changes Part Add Turborepo assuming Lerna is already setup To add turbo run the following command in your terminalyarn add turbo dev WCreate a turbo json file in the root of your project schema pipeline build dependsOn build outputs next test outputs test coverage outputs coverage start cache false typecheck outputs prepublishOnly outputs scacap whitelabel app cockpit prepublishOnly dependsOn scacap whitelabel components prepublishOnly scacap whitelabel app onboarding prepublishOnly dependsOn scacap whitelabel components prepublishOnly In the above turbo json file you need to define pipeline So everything which you want to run in NPM scripts of root package json using turbo run lt tests build gt same field should be present in pipeline turbo applies the pipeline task to the NPM scripts during execution Most important thing to note here is dependsOn In above config scacap whitelabel app cockpit package prepublishOnly NPM script will run only when scacap whitelabel components s prepublishOnly script has been run More info on setting up pipeline is hereFinally changes to root package jsonAdd packageManager to package json if you are using Yarn Workspaces with Lerna packageManager yarn Part Setting up Github actions with turbo cacheWe use Github actions PR checks to maintain the quality of code The problem is every commit to a PR will trigger these checks running tests type checks etc and without some caching mechanism these tasks will run for all packages Let s add Turbo magic to Github actions to speed up the the action workflow Let s take example of running tests If we change some tests for a package without Turbo Cache Lerna will run tests for all packages And this happens for every commit Let s change thattests name Unit tests runs on ubuntu steps name Checkout repo uses actions checkout v with fetch depth name Setup node uses actions setup node v with node version name Restore node modules cache uses actions cache v with path node modules key runner os modules hashFiles yarn lock name Turbo Cache id turbo cache uses actions cache v with path turbo key turbo github job github ref name github sha restore keys turbo github job github ref name name Install packages run yarn frozen lockfile name All tests run yarn test coverage cache dir turbo name Add coverage comment continue on error true uses eeshdarthvader code coverage assistant master with github token secrets GITHUB TOKEN monorepo base path packages Here we are adding mem cache in Github action workflow and store our cache data in turbo which will be reused between commits in the same PR ResultsNormal CI PR checks on each commit looks like this ️Note the time This much time is taken for every tiny commit you push to PR CI runs with TurboRepo️The test run has decreased from min to min and Typecheck reduced from min to sec Let s see how it helps when you are developing locally After first run of tests using yarn test try running it again gt FULL TURBO The tests which usually takes sec to run everytime with Turborepo it ran for freaking sec with its caching system That s all folks Hope you all Turbocharge your monorepo s with TurborepoMore resourcesOfficial guide Migrate from Lerna Pull request Github Action workflow mentioned in the PostCode coverage Github action built for Monorepo s |
2022-03-30 21:12:11 |
海外TECH |
DEV Community |
Recebendo e-mails utilizando o Google Apps Script. |
https://dev.to/jhonyrdesouza/recebendo-e-mails-utilizando-o-google-apps-script-346j
|
Recebendo e mails utilizando o Google Apps Script Um exemplo passo a passo de como usar um formulário HTML para enviar uma mensagem do tipo fale conosco por e mail sem um servidor de back end utilizando o serviço do Google Apps Scripts Veja um exemplo funcional aqui Por quê Precisava de uma maneira de receber os dados preenchidos de um formulário Newsletters em uma página HTML estática Sem utilizar um servidor para realizar os envios de e mails Precisava dos dados para importar para a substack com ferramenta de boletim informativo por e mail para pequenos escritores no qual faço envio dos meus conteúdos techs que escrevo Principais vantagens Sem backend para implantar manterou pagar Inteiramente customizável cada aspecto écustomizável E mail enviado via Google Mail que estána lista de permissões em todos os lugares sucesso de alta capacidade de entrega Colete armazene quaisquer dados de formulário em uma planilha para facilitar a visualização perfeito se vocêprecisar compartilhá lo com pessoas não técnicas Script E mail ao qual seráenviado as respostas do formulário var TO ADDRESS seu email com Copia todas as chaves valores do formulário em HTML para o e mail Usa um array de chaves se fornecido ou o objeto para determinar a ordem dos campos function formatMailBody obj order var result if order order Object keys obj Faz um loop sobre todas as chaves nos dados do formulário ordenado for var idx in order var key order idx result lt h style text transform capitalize margin bottom gt key lt h gt lt div gt sanitizeInput obj key lt div gt Para cada chave concatenar um par lt h gt lt div gt do nome da chave e seu valor e anexá lo àstring result criada no início return result Uma vez que o loop éfeito result seráuma longa string para colocar no corpo do email Limpa o conteúdo do usuário function sanitizeInput rawInput var placeholder HtmlService createHtmlOutput placeholder appendUntrusted rawInput return placeholder getContent function doPost e try Logger log e A versão do Google Script de console log consulte Class Logger record data e Nome mais curto para os dados de formulário var mailData e parameters Nomes e ordem dos elementos do formulário se definido var orderParameter e parameters formDataNameOrder var dataOrder if orderParameter dataOrder JSON parse orderParameter Determina o destinatário do e mail Se vocêtiver seu e mail sem comentários acima ele usa esse TO ADDRESS Caso contrário o padrão éo email fornecido pelo atributo de dados do formulário var sendEmailTo typeof TO ADDRESS undefined TO ADDRESS mailData formGoogleSendEmail Envia e mail se o endereço estiver definido if sendEmailTo MailApp sendEmail to String sendEmailTo subject Notificação do forumulário da Newsletters jhony me links replyTo String mailData email Isso éopcional e depende do seu formulário realmente coletando um campo chamado email htmlBody formatMailBody mailData dataOrder return ContentService createTextOutput Retorna resultados de sucesso do JSON JSON stringify result success data JSON stringify e parameters setMimeType ContentService MimeType JSON catch error Se erro retornar isso Logger log error return ContentService createTextOutput JSON stringify result error error error setMimeType ContentService MimeType JSON Record data insere os dados recebidos do envio do formulário html e são os dados recebidos do POST function record data e var lock LockService getDocumentLock lock waitLock Espera até segundos para evitar escrita simultânea try Logger log JSON stringify e Registra os dados POST caso precisemos depurá los Seleciona a planilha respostas por padrão var doc SpreadsheetApp getActiveSpreadsheet var sheetName e parameters formGoogleSheetName responses var sheet doc getSheetByName sheetName var oldHeader sheet getRange sheet getLastColumn getValues var newHeader oldHeader slice var fieldsFromForm getDataColumns e parameters var row new Date O primeiro elemento da linha deve ser sempre um timestamp sendo dd mm aaaa hh mm ss Percorre as colunas do cabeçalho for var i i lt oldHeader length i Começa em para evitar a coluna Timestamp var field oldHeader i var output getFieldFromData field e parameters row push output Marca como armazenado removendo dos campos do formulário var formIndex fieldsFromForm indexOf field if formIndex gt fieldsFromForm splice formIndex Define quaisquer novos campos em nosso formulário for var i i lt fieldsFromForm length i var field fieldsFromForm i var output getFieldFromData field e parameters row push output newHeader push field Mais eficiente para definir valores como array do que individualmente var nextRow sheet getLastRow Obtém a próxima linha sheet getRange nextRow row length setValues row Atualiza a linha do cabeçalho com quaisquer novos dados if newHeader length gt oldHeader length sheet getRange newHeader length setValues newHeader catch error Logger log error finally lock releaseLock return function getDataColumns data return Object keys data filter function column return column formDataNameOrder column formGoogleSheetName column formGoogleSendEmail column honeypot function getFieldFromData field data var values data field var output values join values join values return output Observação Com a LGPD recomendo pesquisar recomendações sobre privacidade do usuário vocêpode ser responsabilizado pela guarda dos dados pessoais dos usuários e deve fornecer a eles uma maneira de entrar em contato com você Aviso A API do Google tem limites de quantos e mails pode enviar por dia Isso pode variar na sua conta do Google veja os limites aqui Recomendo implementar este tutorial atéa Parte pois os dados sempre serão adicionados àplanilha primeiro e depois enviados por e mail se possível |
2022-03-30 21:04:34 |
海外TECH |
DEV Community |
What are some HTML attributes and tags that you’ve discovered recently? |
https://dev.to/nickytonline/what-are-some-html-attributes-and-tags-that-youve-discovered-recently-35nl
|
What are some HTML attributes and tags that you ve discovered recently Louis Lazaris published Those HTML Attributes You Never Use on Smashing Mag recently I knew a few of the HTML attributes they mention in the blog post e g the download attribute for an anchor element but there were definitely some that were new to me What are some HTML attributes and HTML tags that you ve discovered that others might not know |
2022-03-30 21:03:58 |
海外TECH |
DEV Community |
Augmented Reality Application for Autonomous Transport Vehicle |
https://dev.to/zekeriyyaa_/augmented-reality-application-for-autonomous-transport-vehicle-4ipp
|
Augmented Reality Application for Autonomous Transport VehicleAR Augmented Reality has a wide range of uses in many fields such as medicine entertainment education or industry After the Industry revolution it has become one of the focal points of smart factory applications In this article I will talk about our approach that applies the augmented reality application to an ATV Autonomous Transport Vehicle Augmented Reality In Business ーForbesLet s start First of all I would like to clarify that this approach was developed for the “Development of Autonomous Transportation Vehicles and HMI MM Interfaces for Smart Factories project financed by TÜBİTAK You can access all project on my github repo In practise it s aimed to augment the sensor data received from the ATV in order to inform the operator and prevent possible hazard For this purpose the ATV and laboratory shown in Figure were used Figure ーATV and Laboratory EnvironmentPrior to realize this approach in real environment it was performed in Gazebo simulation environment shown in Figure Figure ーGazebo simulation environmentThe data used are as follows Position x y left top side of the screenVelocity left top side of the screenCharge percentage left top side of the screenLaser degree red colored circlesRoute orange colored linesROS Robot Operating System is located at the center of the architecture shown in Figure It acts as middleware between system components and allows them to communicate easily Figure ーSystem ArchitectureThere are two different camera perspectives that you can switch while ATV is performing its task “ATV Camera mounted on the front of the ATV “AR Camera of additional devices such as telephone or tablet ResultsYou can see the screenshots of simulation environment shown in Figure Figure ーGazebo simulation environmentYou can also see the screenshots of real environment shown in Figure Figure ーReal environmentYou can access the application videos using the URLs given below Simulation Environment AR Camera Real Environment AR Camera Real Environment ATV Camera |
2022-03-30 21:02:28 |
海外TECH |
DEV Community |
An Introduction To AWS CloudFront Functions |
https://dev.to/honeybadger/an-introduction-to-aws-cloudfront-functions-hh0
|
An Introduction To AWS CloudFront FunctionsThis article was originally written by Ayooluwa Isaiah on the Honeybadger Developer Blog Amazon CloudFront is a service that speeds up the distribution and delivery of static and dynamic web content through its global network of machines spread across hundreds of locations also known as edge locations CloudFront Functions are an incarnation of FaaS Function as a Service and allow you to deploy JavaScript functions to AWS network of edge locations to be executed as close as possible to end users This new feature allows you to customize or personalize content for your application users closer to where they re located thus minimizing network latency For example you can transform HTTP headers or API responses to personalize your application for each visitor implement authentication or encryption logic such as JWT authentication to allow or deny requests or set up URL rewrites and redirects right on the edge In this article we will explore CloudFront Functions in detail including their purpose use cases and how you can get started with writing and deploying your first function How CloudFront Functions compare to AWS Lambda EdgeAWS Lambda Edge introduced in July is an extension of AWS Lambda with capabilities similar to CloudFront Functions as it allows you to leverage Amazon CloudFront to deliver function results globally While Lambda Edge is quite robust it s not the best choice in many cases especially those that require a small amount of computation before requests are served up by the CloudFront infrastructure or right before the responses to such requests are dispatched to end users primarily because Lambda Edge functions are executed in a regional edge cache usually in the AWS region closest to the CloudFront edge location reached by the client instead of the edge location itself CloudFront Functions were created to provide a solution better suited for higher volumes and even lower latency since they are executed at the edge location closest to the end user instead of AWS Regions This makes them ideal for lightweight CloudFront CDN transformations and manipulations that can run on every request to enable latency sensitive operations at a higher volume Here s a summary of how CloudFront Functions compare to Lambda Edge CloudFront Functions and Lambda Edge are executed in response to events generated by CloudFront CloudFront Functions only respond to viewer triggers when CloudFront receives a request from a viewer or sends a response to a viewer However Lambda Edge can work with both viewer triggers and origin triggers when CloudFront forwards the request to the origin or receives a response from the origin Lambda Edge functions are executed in about regional edge caches at the time of writing while CloudFront Functions are executed at edge locations CloudFront Functions support JavaScript only while Lambda Edge has runtime support for both Node js and Python CloudFront Functions can only manipulate HTTP headers If you need to remove or replace the body of an HTTP request or response use Lambda Edge instead CloudFront Functions do not have access to the network or filesystem but Lambda Edge does CloudFront Functions run for less than one millisecond while Lambda Edge can take up to seconds for viewer triggers and seconds for origin triggers The maximum memory assigned to CloudFront Functions is MB compared to MB viewer triggers and GB origin triggers for Lambda Edge CloudFront Functions and Lambda Edge may be used together if you want to manipulate content before and after it s cached A free tier of CloudFront Functions is available unlike Lambda Edge The former is also charged per request per million invocations while the latter is charged per request per million invocations and function duration for every MB second How CloudFront Functions workCloudFront Functions are natively built into the CloudFront infrastructure with over points of presence spread across cities and countries Each of these locations hosts an instance of the Functions runtime which is an ECMAScript compliant JavaScript engine and each of these runtimes is capable of handling tens of millions of requests per second while delivering sub millisecond latency For security reasons each function script is well isolated within its own process with several virtual walls of protection around each process This model eliminates the cold starts of the virtual machine VM based isolation model used by AWS Lambda and Lambda Edge further reducing latency Individual function scripts are also short lived as they run for less than ms without any perceptible impact on the performance of the CloudFront CDN CloudFront Functions are triggered by events on a specific CloudFront distribution such as when CloudFront receives a request from a viewer viewer request and before CloudFront is about to deliver a response to the viewer viewer response You can create new functions from the CloudFront console using the IDE or through the CloudFront CLI Testing your functions can be done directly against a CloudFront distribution to ensure they will run correctly once deployed Use cases of CloudFront FunctionsCloudFront Functions are a great way to expand your product s capabilities or completely overhaul the way it performs certain tasks by executing code at the CDN layer instead of on origin servers By opting to use Functions you ll be able to build a variety of solutions such as the following Serve different content based on the device being used to make the request by rewriting the URL of the request based on the condition you care about For example you can send video content at different resolutions to users based on their devices Implement Geo targeting to ensure the right content is served depending on the origin country of the end user For example you can use this to give Purchasing Power Parity PPP Discounts Inspect or modify any of the request headers before forwarding to the origin or client Protect the content on your web properties from being hot linked by other websites Add security rules and filters to block unwanted visitors and bots Set up an A B test by controlling what response is served based on cookies This helps with testing different versions of a website without changing the URL or redirect Respond directly and quickly from the edge without hitting the origin Implement access control and authorization for the content delivered through CloudFront and redirect unauthenticated users to login pages Analyze and track user activity on your website and mobile applications Add HTTP security headers such as a Content Security Policy to all responses without modifying your application code What CloudFront Functions can doEach CloudFront function has an entry point called handler It takes a single argument called event which is a JSON representation of an HTTP request and response The basic structure of this event object is shown below version context lt context object gt viewer lt viewer object gt request lt request object gt response lt response object gt There are three things a function can do Modify an HTTP requestYou can write a script to modify a client request before being returned to CloudFront for continued processing For example you can modify existing request headers or set new ones function handler event var request event request Modify the request object here request headers x custom header value example value return modified request to CloudFront for further processing return request Modify an HTTP responseWith CloudFront Functions you can modify HTTP response headers before delivery to the client function handler event var response event response Modify the response object here response statusDescription a description response headers x custom header value example value return modified response return response Create a new HTTP responseYou can respond to an HTTP request at the edge without any further processing by CloudFront Note that you cannot include a response body with CloudFront Functions If you need to do so use Lambda Edge instead function handler event var request event request Create the response object here var response statusCode headers some header value some value return response return response Getting started with CloudFront FunctionsLet s go ahead and create our first function using the CloudFront console This function will add a few security headers to each response before it is delivered to the client Before you proceed ensure that you have an existing CloudFront distribution or follow the steps in this document to create one Creating the function Using the CloudFront consoleOn the CloudFront console choose Functions on the side navigation and then click the Create Functions button Enter a function name such as security headers and then click Continue At this point you ll be able to write the code for the body of the function Enter the following into the editor under the Development stage and click the Save button function handler event var response event response response headers content security policy value default src self script src self unsafe inline response headers x xss protection value mode block response headers feature policy value accelerometer none camera none geolocation none gyroscope none magnetometer none microphone none payment none usb none response headers x frame options value DENY response headers referrer policy value strict origin when cross origin response headers x content type options value nosniff return response Using the AWS CLIEnsure that you have installed and configured the AWS CLI with the right credentials for your account before proceeding Write the function code listed above in a function js file created somewhere in your filesystem and then use the command below to create the function on CloudFront aws cloudfront create function name security headers function config Comment Security headers function Runtime cloudfront js function code fileb function jsIf everything goes well you ll get the following output describing the function that you just created Note and copy the ETag value as it will be used to identify this function in subsequent sections Location aws cloudfront function security headers ETag ETVPDKIKXDER FunctionSummary Name security headers Status UNPUBLISHED FunctionConfig Comment Security headers function Runtime cloudfront js FunctionMetadata FunctionARN arn aws cloudfront function security headers Stage DEVELOPMENT CreatedTime T LastModifiedTime T Testing the function Using the CloudFront consoleOnce you ve created the function you can test it by providing an event object that is representative of the type of HTTP requests or responses that your CloudFront distribution would receive in production On the function page click the Test tab Select the event type Viewer Response the Stage Development and a sample event Viewer response with headers You can modify this sample event or create one from scratch through the options in the Input section The JSON tab is particularly handy for copying the JSON representation of the event object for testing through the AWS CLI or CloudFront API You don t need to change anything here so go ahead and click the Test button to run the test Once the test runs you will see a success message at the top of the screen or a failure message if the test fails Under the Output section under Compute utilization you ll see a number that indicates the length of time that the function took to run as a percentage of the maximum allowed time For example a compute utilization of means that the function completed in of the maximum allowed time Using the AWS CLITo test functions using the AWS CLI you need to create a JSON file such as event object json and pass it to the test function subcommand Here s the JSON object that mirrors the Viewer response with headers sample event on the CloudFront console version context eventType viewer response viewer ip request method GET uri index html querystring test value true fruit value apple multiValue value apple value banana headers host value www example com accept value text html multiValue value text html value application xhtml xml cookies id value CookieIdValue loggedIn value false response statusDescription OK headers server value CustomOriginServer content type value text html charset UTF content length value cookies statusCode Once saved pass the JSON file to the test function subcommand as shown below Ensure that you replace the value of the if match flag with the ETag value that you copied in the previous section aws cloudfront test function name security headers if match ETVPDKIKXDER event object fileb event object json stage DEVELOPMENTIf the command is successful you will see output similar to the one shown below which shows the results of testing the function TestResult FunctionSummary Name security headers Status UNPUBLISHED FunctionConfig Comment Security headers function Runtime cloudfront js FunctionMetadata FunctionARN arn aws cloudfront function security headers Stage DEVELOPMENT CreatedTime T LastModifiedTime T ComputeUtilization FunctionExecutionLogs FunctionErrorMessage FunctionOutput response headers server value CustomOriginServer content length value content security policy value default src self script src self unsafe inline x content type options value nosniff x xss protection value mode block x frame options value DENY referrer policy value strict origin when cross origin content type value text html charset UTF feature policy value accelerometer none camera none geolocation none gyroscope none magnetometer none microphone none payment none usb none statusDescription OK cookies statusCode Note the following about the output FunctionSummary describes the tested function ComputeUtilization indicates the length of time that the function took to run as a percentage of the maximum allowed time FunctionOutput is the object that the function returned As you can see the output object includes the security headers that were set in the function code which proves that the function is working as intended FunctionErrorMessage will contain an error message if the test was unsuccessful Publishing the function Using the CloudFront consoleAfter testing your function thoroughly you can move to the Publish tab to copy the function from the development stage to the live stage All you need to do is click the Publish button or Publish and update if updating a function Using the AWS CLIThe aws cloudfront publish function command will publish the function that matches the name and ETag value that was passed to the name and if match options respectively aws cloudfront publish function name security headers if match ETVPDKIKXDERHere s the output you can expect to get if the publishing succeeds FunctionSummary Name security headers Status UNASSOCIATED FunctionConfig Comment Security headers function Runtime cloudfront js FunctionMetadata FunctionARN arn aws cloudfront function security headers Stage LIVE CreatedTime T LastModifiedTime T Associating the function with a CloudFront distribution Using the CloudFront consoleClick the Associate tab and select the Distribution Event type Viewer Response in this case and Cache behavior Afterwards click Add association and confirm in the dialog A banner should appear at the top of the page confirming the successful association with the distribution You can also see the function association under Associated CloudFront distributions Using the AWS CLITo associate a CloudFront Function with an existing distribution using the AWS CLI get the distribution ID from the console and pass it to the id flag of the aws cloudfront get distribution config command as shown below aws cloudfront get distribution config id EGAOOQINAXA output yaml gt dist config yamlIf successful the above command will not display any output However you should see a newly created dist config yaml file in the current directory which should be opened in your favorite text editor Edit the file as described below Change the Etag field to IfMatch but leave the value unchanged Find the FunctionAssociations field and update it as shown below dist config yamlFunctionAssociations Items EventType viewer response FunctionARN arn aws cloudfront function security headers Quantity Replace the value of FunctionARN above with the FunctionARN field of the appropriate function retrieved by running aws cloudfront list functions in the terminal You can also change viewer response to viewer request if this is what your function needs to be triggered on For the security headers function viewer response is appropriate Once you re through with the edits save the file Finally use the aws cloudfront update distribution command to update the specified distribution with the contents of the dist config yaml file as shown below aws cloudfront update distribution id EGAOOQINAXA cli input yaml file dist config yamlAfter running the command some output that describes the distribution that was just updated will be printed to the console The Status of the distribution will change to InProgress while the distribution is redeployed which typically takes a few minutes Verifying the functionNow that the function has been published and associated with a CloudFront distribution it s time to confirm that it works correctly You may use curl or the browser to make a request to a resource that exists on your CloudFront distribution as shown below curl head HTTP content type text htmlcontent length date Tue Jun GMTlast modified Tue Jun GMTetag ddcdfbeecfe accept ranges bytesserver AmazonSvia eedeeeafe cloudfront net CloudFront content security policy default src self script src self unsafe inline x xss protection mode blockx frame options DENYreferrer policy strict origin when cross originfeature policy accelerometer none camera none geolocation none gyroscope none magnetometer none microphone none payment none usb none x content type options nosniffx cache Hit from cloudfrontx amz cf pop JFK Cx amz cf id PwPkvETjGl ssjryL vmkWdhaeHgaoHZvABPzklbVlWg Notice that all the response headers added by the function code are included in the response This proves that the function is working correctly ConclusionCloudFront Functions are a great way to implement high volume CDN customizations that can run on every request enabling you to deliver richer and more personalized content to your end users at low latency I hope this introduction has helped you figure out how you can leverage them in your applications To learn more about CloudFront Functions refer to the CloudFront Developer Guide or FAQs A GitHub repository is also available with several examples that you can use as a starting point for building functions Thanks for reading and happy coding |
2022-03-30 21:00:54 |
Apple |
AppleInsider - Frontpage News |
Apple's M1 Mac mini falls to $645 (up to $110 off), plus $20 off AppleCare |
https://appleinsider.com/articles/22/03/30/apples-m1-mac-mini-falls-to-645-up-to-110-off-plus-20-off-applecare?utm_medium=rss
|
Apple x s M Mac mini falls to up to off plus off AppleCareA new price drop is in effect on Apple s Mac mini with the standard configuration on sale for and upgraded models up to off Plus save on AppleCare Apple s M Mac mini has just gotten cheaper thanks to exclusive dealsApple s M Mac mini is no slouch offering an affordable entry point into the Mac ecosystem And with the standard Mac mini ringing in at one third of what a Mac Studio costs it s easy to see why the M Mac mini is a popular choice among students and home users Read more |
2022-03-30 21:52:53 |
海外TECH |
Engadget |
YouTube TV finally supports picture-in-picture on iOS |
https://www.engadget.com/youtube-tv-picture-in-picture-ios-213505208.html?src=rss
|
YouTube TV finally supports picture in picture on iOSGoogle has begun rolling out a new update to its iOS YouTube TV app that allows both iPhone and iPad users to take advantage of picture in picture functionality To watch something in PiP mode swipe up from the bottom of the screen The video will then automatically resize and move across your device s display iPhone amp iPad users We re happy to share that picture in picture is now rolling out to your iOS devices Simply select a video to watch and swipe ️from the bottom of the screen to return to the device s homepage The video can scale down and move across your screen ーYouTube TV YouTubeTV March Today s update is long overdue a fact Google acknowledged “We really appreciate your patience while we worked on enabling this key feature for your iOS devices the company said on Twitter To put the wait in perspective Apple s mobile operating system has supported picture in picture functionality on iPad since iOS and iPhone since iOS What s more the feature has been available through the company s main YouTube app since last year |
2022-03-30 21:35:05 |
海外科学 |
NYT > Science |
On the Space Station, U.S. and Russian Astronauts Steer Around the War in Ukraine |
https://www.nytimes.com/2022/03/30/science/nasa-us-russia-mark-vande-hei.html
|
On the Space Station U S and Russian Astronauts Steer Around the War in UkraineMark Vande Hei and two Russian counterparts landed on Earth on Wednesday as NASA and the Russian space agency seek to sustain cooperation in the face of a strained relationship |
2022-03-30 21:55:24 |
海外科学 |
NYT > Science |
您是否正在接受、支付或為他人提供長期照護? |
https://www.nytimes.com/zh-hant/2022/03/30/science/long-term-care-costs.html
|
齡漸 |
2022-03-30 21:42:18 |
海外科学 |
NYT > Science |
¿Recibes, pagas o brindas cuidado a largo plazo? |
https://www.nytimes.com/es/2022/03/30/science/recibes-pagas-o-brindas-cuidado-a-largo-plazo.html
|
conforme |
2022-03-30 21:42:17 |
海外科学 |
NYT > Science |
您是否正在接受、支付或为他人提供长期照护? |
https://www.nytimes.com/zh-hans/2022/03/30/science/long-term-care-costs.html
|
龄渐 |
2022-03-30 21:42:16 |
海外科学 |
NYT > Science |
Are You Receiving, Providing or Paying for Long-Term Care? |
https://www.nytimes.com/2022/03/30/science/long-term-care-costs.html
|
health |
2022-03-30 21:42:03 |
海外科学 |
NYT > Science |
New ALS Treatment, AMX0035, Lacks Evidence of Benefit, FDA Panel Finds |
https://www.nytimes.com/2022/03/30/health/als-treatment-amx0035.html
|
New ALS Treatment AMX Lacks Evidence of Benefit FDA Panel FindsWith a vote the group of independent advisers to the agency narrowly concluded that results from another clinical trial are needed to assess whether the therapy called AMX can help patients |
2022-03-30 21:20:18 |
海外科学 |
NYT > Science |
Covid Vaccines Did Not Protect Adolescents as Effectively During the Omicron Surge |
https://www.nytimes.com/2022/03/30/health/covid-vaccines-children.html
|
Covid Vaccines Did Not Protect Adolescents as Effectively During the Omicron SurgeHospitalizations of children remained comparatively rare but vaccine effectiveness fell sharply among adolescents who did not have life threatening Covid |
2022-03-30 21:08:48 |
海外科学 |
NYT > Science |
Ivermectin Does Not Reduce Risk of Covid Hospitalization, Large Study Finds |
https://www.nytimes.com/2022/03/30/health/covid-ivermectin-hospitalization.html
|
finds |
2022-03-30 21:12:29 |
海外科学 |
NYT > Science |
Americans are taking fewer precautions two years into the pandemic, a poll says. |
https://www.nytimes.com/2022/03/29/us/americans-are-taking-fewer-precautions-two-years-into-the-pandemic-poll-says.html
|
Detail Nothing |
2022-03-30 21:17:46 |
金融 |
ニュース - 保険市場TIMES |
日本生命、「NISSAY ペンギンプロジェクト」を始動 |
https://www.hokende.com/news/blog/entry/2022/03/31/070000
|
|
2022-03-31 07:00:00 |
ニュース |
@日本経済新聞 電子版 |
ロシア軍、キエフ周辺から2割近くを再配置 米分析
https://t.co/kmDMvubqIk |
https://twitter.com/nikkei/statuses/1509276445470003201
|
配置 |
2022-03-30 21:08:40 |
ニュース |
BBC News - Home |
Ukraine War: Putin demands Mariupol surrender to end shelling |
https://www.bbc.co.uk/news/world-europe-60926470?at_medium=RSS&at_campaign=KARANGA
|
ceasefire |
2022-03-30 21:50:03 |
ニュース |
BBC News - Home |
Paris St-Germain Féminines 2-2 FC Bayern München Ladies (4-3 agg): Ramona Bachmann scores winner in extra time |
https://www.bbc.co.uk/sport/football/60934507?at_medium=RSS&at_campaign=KARANGA
|
Paris St Germain Féminines FC Bayern München Ladies agg Ramona Bachmann scores winner in extra timeRamona Bachmann scores in extra time to send PSG into the Women s Champions League semi finals with a aggregate victory over Bayern Munich |
2022-03-30 21:41:37 |
ニュース |
BBC News - Home |
Gloucester & Worcester reach Premiership Cup semis |
https://www.bbc.co.uk/sport/rugby-union/60918800?at_medium=RSS&at_campaign=KARANGA
|
leicester |
2022-03-30 21:08:41 |
北海道 |
北海道新聞 |
NY円、121円後半 |
https://www.hokkaido-np.co.jp/article/663436/
|
外国為替市場 |
2022-03-31 06:33:00 |
ビジネス |
東洋経済オンライン |
発達障害児「学級に2人」、衝撃結果が広げた大波紋 文科省や都の調査に教師が反発した理由とは? | 「発達障害」は学校から生まれる | 東洋経済オンライン |
https://toyokeizai.net/articles/-/541320?utm_source=rss&utm_medium=http&utm_campaign=link_back
|
東洋経済オンライン |
2022-03-31 06:30:00 |
ニュース |
THE BRIDGE |
イチゴ完全自動栽培のHarvestX、1.5億円を調達——ANRI、東大IPC、DEEPCOREから |
https://thebridge.jp/2022/03/harvestx-jpy150m-funding
|
イチゴ完全自動栽培のHarvestX、億円を調達ーANRI、東大IPC、DEEPCOREからイチゴをはじめ果菜類の受粉や収穫を自動化する完全自動栽培ロボットを開発するHarvestXは日、億万円を資金調達したと発表した。 |
2022-03-30 21:15:00 |
コメント
コメントを投稿