TECH |
Engadget Japanese |
Engadget日本版 終了のご挨拶 |
https://japanese.engadget.com/end-of-engadget-japanese-134505916.html
|
engadget |
2022-03-31 13:45:05 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
pythonのインタプリンタで四則演算する |
https://qiita.com/wwww_xxx12345/items/8bc7ca9a0ae9e29f9d2f
|
float |
2022-03-31 22:50:38 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
【IBM/coursera】IBMのデータサイエンス専門家コース(11ヶ月)を正答率100%で修了した話。 |
https://qiita.com/Shu25/items/f18d89920a874fda0f18
|
生徒同士で交流が深められるスレッド的なページはあるが、過疎っている章末プロジェクトが面白いPro特に最終プロジェクトなのですが、内容が被っていればどんなプロジェクトをしても良い講師からの承認は必要事があったので、自分がやりたい事をコースの一部として消化できたのはとても有意義でした。 |
2022-03-31 22:15:22 |
js |
JavaScriptタグが付けられた新着投稿 - Qiita |
ループ内でコールバック関数に変数を渡すとき、変数のスコープ次第でんぁぁぁぁってなる |
https://qiita.com/hamusica/items/9674031d15d69388787f
|
また、letで宣言せずにforvariiltiと記述しても同じ結果になります。 |
2022-03-31 22:39:01 |
AWS |
AWSタグが付けられた新着投稿 - Qiita |
GitHub ActionsによるCDKアプリのデプロイ自動化 (エンタープライズ向け) |
https://qiita.com/daitek/items/8e0328c4a1044e96c204
|
デプロイ先AWS環境のCFNコンソールからも、スタック作成に成功していることが確認できると思います。 |
2022-03-31 22:55:38 |
AWS |
AWSタグが付けられた新着投稿 - Qiita |
AWS Systems Manager Runbook(旧 Automation Document)の`aws:createStack`にパラメーターを渡すやり方を考える |
https://qiita.com/kosukeKK/items/d180557799ac2b4f6681
|
すみませんがまだちゃんと書けてないですはじめに突然ですがAWSSystemsManagerRunbookは好きですか私は最近Solrの環境構築をRunbookで実装する機会がありました。 |
2022-03-31 22:38:33 |
golang |
Goタグが付けられた新着投稿 - Qiita |
【Go】VSCodeの実行で標準入力を行うと「noDebug mode: unable to process 'evaluate' request」が発生 |
https://qiita.com/someone7140/items/d17cd9ea4abccbec0699
|
【Go】VSCodeの実行で標準入力を行うと「noDebugmodeunabletoprocessxevaluatexrequest」が発生概要GoでAtCoderをやる時など、標準入力を使うと思いますが、VSCodeで実行時にnoDebugmodeunabletoprocessevaluaterequestというエラーが発生しました。 |
2022-03-31 22:37:46 |
golang |
Goタグが付けられた新着投稿 - Qiita |
Goを使ってNotionカレンダーからGoogleカレンダーへデータを移動させてみる |
https://qiita.com/aki0151/items/8bb6ffdf8e9a7808af95
|
NotionAPINotioAPIスタートガイドNotionAPIリファレンスGoogleCalendarAPIGoogleCalendarAPIクイックスタートGoogleCalendarAPIリファレンスGoドキュメントGoogleCalendarAPIを使う際、OAuth認証のトークン取得に少し手間取ったので以下のqita記事を参考にしました、GoogleAPIOAuthのアクセストークンampリフレッシュトークン取得手順年月版実装やりたい事開始日と終了日を決めて範囲内のデータを移動させるすでにGoogleカレンダーに同名の項目が登録済みならば更新する簡単な設計最初にPlantUMLを使ってざっくりとシーケンス図を作ってみました。 |
2022-03-31 22:30:29 |
Azure |
Azureタグが付けられた新着投稿 - Qiita |
Graph APIでAzure ADにユーザーを作成する |
https://qiita.com/Yosuke_Sakaue/items/cb8a3cc2e2705ad52e62
|
GraphAPIでAzureADにユーザーを作成するAzureADにアプリケーションを作成AzureADで「アプリの登録」⇒「新規登録」任意の名前を付けて作成作成できたら「概要」からクライアントIDとテナントIDを控えておくAPIのアクセス許可を追加DirectoryReadWriteAllUserReadWriteAll※アプリケーションにアクセス許可を追加する場合は管理者の同意が必要です。 |
2022-03-31 22:35:30 |
Ruby |
Railsタグが付けられた新着投稿 - Qiita |
本番環境をRails6.0からRails7.0へアップグレード |
https://qiita.com/dpkawa/items/24e7fd2aeb4f0e72333d
|
そこで、自動テストを回したり、手動でサイトを操作することでエラーの発生を確認し、以前の動作に戻す設定を探すことで、必要な対応ポイントの洗い出しを行いました。 |
2022-03-31 22:32:25 |
技術ブログ |
Developers.IO |
Cloudflare StremのライブストリーミングをAPIでやってみた |
https://dev.classmethod.jp/articles/cloudflare-strem-api-de-livestreaming/
|
cloudflare |
2022-03-31 13:46:58 |
技術ブログ |
Developers.IO |
AWS CDKでNLB->Fargate環境を簡単に構築する |
https://dev.classmethod.jp/articles/how-to-make-aws-cdk-with-nlb-fargate/
|
etworkloadbalancedfargate |
2022-03-31 13:35:10 |
技術ブログ |
Developers.IO |
組織に根ざす問題の明確化を促す 2on2 を試してみた |
https://dev.classmethod.jp/articles/2on2/
|
exjapan |
2022-03-31 13:30:34 |
海外TECH |
MakeUseOf |
How Does an Electric Car Battery Charger Work |
https://www.makeuseof.com/electric-car-battery-charger-explained/
|
How Does an Electric Car Battery Charger WorkBefore you decide on an ideal charging method for your EV it s imperative to understand how electric car battery chargers work So let s dive in |
2022-03-31 13:45:13 |
海外TECH |
MakeUseOf |
6 Benefits of Using Twitter as a Photographer |
https://www.makeuseof.com/photographers-using-twitter-benefits/
|
great |
2022-03-31 13:30:14 |
海外TECH |
MakeUseOf |
How to Fast-Track Candidate Screening With Toggl Hire |
https://www.makeuseof.com/fast-track-candidate-screening-toggl-hire/
|
toggl |
2022-03-31 13:15:14 |
海外TECH |
MakeUseOf |
Wowcube: It's Real, But Does It Really Wow? |
https://www.makeuseof.com/wowcube-its-real-but-does-it-really-wow/
|
price |
2022-03-31 13:05:14 |
海外TECH |
DEV Community |
Building a Recharts Dashboard with Cube |
https://dev.to/cubejs/building-a-recharts-dashboard-with-cube-5cco
|
Building a Recharts Dashboard with CubeThis guest post was written by Julien Bras He s an Innovation Team Leader at Wiiisdom You can get in touch with him through her website or Twitter Great job developer You ve nearly finished your first major React based project for that new customer But now you re asked to add a dashboard to show sales revenues or user retention percentage You know it will take you weeks with traditional methodsーcomputing the data to share building an endpoint to expose the right data handling it on the front end side presenting it correctly tweaking the metrics Isn t there a more straightforward way Yes there is This tutorial will show you how to build a dashboard using Recharts a React library that offers you a set of chart components to speed up the creation of a dashboard and Cube a Headless BI tool that allows you to expose your application database via a set of APIs The combination will allow you to play with your data and simply copy paste the generated dashboard code content to your React application Here is the expected result of this tutorial Introducing CubeCube positions itself as “Headless BI for buildingdata applications The tool acts as a bridge between the data that is stored generally in a database PostgreSQL MySQL etc and your front end application that is consuming an API Cube is available in two flavors an open source product generally named Cube js which you must host yourself and Cube Cloud an enterprise ready service with high availability and scalability Both options provide the same features Introducing RechartsRecharts is a React library designed to help you create nice charts By providing an expanded set of pre existing charts it allows you to present data in the way you need Let s take the following piece of code where data is a simple JavaScript array containing the data lt BarChart width height data data gt lt CartesianGrid strokeDasharray gt lt XAxis dataKey name gt lt YAxis gt lt Tooltip gt lt Legend gt lt Bar dataKey pv fill d gt lt Bar dataKey uv fill cad gt lt BarChart gt It will be shown like this Recharts is a very common solution since it integrates easily in your React environment via the multiple components available It s also very customizable to match your requirements color style chart type etc You can also specify how to label content define axis organization choose the correct shape and so forthBut because it s just a front end library it needs a data object with all the content shown on the chart It s obvious but it can be complex to produce this information for example if the application is relying on a traditional back end with a classic database system like PostgreSQL or MySQL There are also other options for rendering charts on a web application Charts js is a popular solution but it s not a React library so you may need to rely on third party integrations like this one D is also a classic option but it s generally much more complex to integrate D into a React application because both libraries will try to access the document object model DOM In this tutorial you ll combine Cube and Recharts The good news is that Cube supports out of the box Recharts as a charting engine saving you a lot of time when it s time to write code Build a Recharts Dashboard with React and CubeLet s build the dashboard To reproduce the results here use a sample database available online You ll use the MySQL Employee Sample Database Based on this data you will build charts to highlight useful metrics Number of employees per department gender birth date etc Average salary per department gender hire date etc PrerequisitesYou need to have docker and docker compose to use the open source version of Cube Since you will spin up a local MySQL database containing the sample data you will use Docker to start both a MySQL container and a Cube container You also need to have node and npm installed to create the React application for the dashboard With that in place we can begin Start CubeTo start you ll follow the docker compose steps In an empty new folder named cube create a docker compose yml file version services cube image cubejs cube latest ports environment CUBEJS DEV MODE true volumes cube conf database image genschsa mysql employees environment MYSQL ROOT PASSWORD passIt will allow you to define the two containers needed cubejs cube is obviously the Cube image started in development mode CUBEJS DEV MODE true to use the playground which you ll see later genschsa mysql employees is a MySQL server image with the employee sample database already loadedThen run the following to start Cube with the database docker compose upBoth containers will start up and will be able to communicate with each other Start Cube via Cube CloudIf you want to use Cube Cloud instead the process is easier than using Docker The free tier is generous for testing the SaaS solution From Cube Cloud log in for example by using your GitHub account Then create a deployment You can either import an existing project from GitHub or create a new project from scratch Connect to the DatabaseLet s roll back to the local deployment Once the containers are up and running you ll be able to connect to http localhost via any browser The first task is to connect to the database where your data is located In your case you need to connect to the employee sample data So first select MySQL then configure the connection Hostname databasePort Database employeesUsername rootPassword pass Side note the root password is set in the docker compose yml file as pass Yes it s a local deployment It should not be shipped to your production environment An env file is generated after this step to store the database credential information Generate a SchemaThe important next step is to generate a schema of your database It will define the API for later interaction Select the tables as shown in the screenshot below and click on Generate Schema It will create a set of JavaScript files located in the schema folder next to your docker compose yml file Each file describes how to use each table of your database that is which fields can be used as a metric number of employees a dimension department name or what links can be done between tables The dedicated section of the documentation is a good starting point to get a good foundation of schema in Cube Make sure to replace the generated files with the one you can find in the GitHub repository for this tutorial The files here have been carefully designed to let Cube work well with this particular database Start Playing With Your DataOnce your schema is available you can start experimenting and build your app For example go to the Build section of the app Select Employee Count as the measure and Departments Name as the dimensions and keep the Segment Time and Filters empty Use a Bar chart instead of Line and click on Run in the middle of the screen You will see this kind of chart Take some time to play with this interface It s called the playground after all so experiment with your data You can explore measures and dimensions as well as chart styles You can also define the chart engine for your output In our case we want to select first React then Recharts You can also switch between the following Chart renders a test chart JSON Query shows the JSON data sent to the Cube API GraphiQL shows the equivalent information if you want to use the GraphiQL Cube API Code generates the code for the current selected engine We will use it shortly SQL shows the exact SQL query sent to the database engine The screenshot below is of the code screen This code can be copy pasted to any React stack app to include the current element of the playground in our case a Recharts chart that is built based on the Cube API If you scroll down you ll see the Cube API information const cubejsApi cubejs APIKEY apiUrl http localhost cubejs api v Here is the query that is sent to the Cube engine query measures Employees count timeDimensions order Employees count desc filters dimensions Departments Name And also the graph component from Recharts return lt CartesianChart resultSet resultSet ChartComponent BarChart gt resultSet seriesNames map series i gt lt Bar key series key stackId a dataKey series key name series title fill colors i gt lt CartesianChart gt This code saves you hours during dashboard coding You simply have to organize the elements on the page correctly and define a set of environment variables Cube API URL Cube API Token to have a production ready dashboard Build Your Recharts DashboardThe goal of this section is to integrate the various elements generated from the Cube playground into a React application Create a new React application using the Create React App starter npx create react app react appAdd some needed libraries Recharts for charting CubeJs for connecting to Cube API AntD for styling Use Deep Compare for a React Hook used by the code produced by Cube cd react appnpm add cubejs client core cubejs client react antd use deep compare rechartsStart your development server npm startCopy paste the content of the code screen of your first query in a new file in src charts EmployeesPerDept jsRemove the last two lines at the end of the file const rootElement document getElementById root ReactDOM render lt ChartRenderer gt rootElement Replace the removed code with a classic component export to declare the chart as a React functional component that can be used in the main src App js file export default ChartRenderer Now modify the src App js import EmployeesPerDept from charts EmployeesPerDept function App return lt div className App gt lt EmployeesPerDept gt lt div gt export default App If you followed all the steps you should have the chart below on your development server You re welcome to explore this tutorial s GitHub repository containing the schema for the Cube application under cube and the final React application under react app It contains the Recharts dashboard with the multiple charts you saw at the start of this tutorial Learn MoreIf you want to learn more about Cube and Recharts start by working on query acceleration It allows you to speed up the execution of the query by adding pre aggregation There is also a prebuilt Dashboard App that allows you to build your React app directly based on popular templates You can use the Add to Dashboard button to add any query built via the playground directly It s even quicker than the process described in this tutorial What Have You Learned Today At first building a custom dashboard integrated into a React application seems like a complex task But with the right tools it can be as simple as deciding what to show as a metric and how to present it The Cube playground handles all the complexity without limiting you to its default values You can explore the Cube API documentation and the Recharts API documentation to understand how to customize the generated code If your project is dealing with analytics it s worth trying Cube Don t hesitate to ping the team on their Slack channel They re very responsive and helpful especially if you re a new player |
2022-03-31 13:42:21 |
海外TECH |
DEV Community |
Why wrapping 3rd-party calls to external services is always a good idea |
https://dev.to/lukapeharda/why-wrapping-3rd-party-calls-to-external-services-is-always-a-good-idea-46ae
|
Why wrapping rd party calls to external services is always a good ideaWhen using a rd party package that makes calls or API requests to an external service it is always a good idea to wrap rd party service with a thin wrapper Facade Why Wrapping it avoids vendor lock in and tight coupling Imagine that the API the rd party is using stops working Now you need to change service calls across your whole project If wrapped you only need to modify your code once Another reason is that you can then build and setup the rd party service or the client according to your requirements Let me give you an example use Kourses Website use Mpociot VatCalculator VatCalculator class VatHelper protected calculator public function construct Website website calculator new VatCalculator calculator gt setBusinessCountryCode website gt user gt country this gt calculator calculator In my project I m using driesvints vat calculator package to calculate VAT value added tax rate and to validate the EU VAT number EU VAT number validation is being done by calling an external API As VAT rate calculation needs to take into account your business location I need to provide the business country code when setting up the calculator As a product I m working on is a SaaS I need to specify this param on each request and can t do it through configuration files which this package supports So I m building up the VatCalculator according to my requirements If I did not wrap this service I would have to configure it each time I call it Not a big deal I know but this is a simple example Besides doing a simple wrapping I ve added a couple of methods that slightly modify rd party service behavior use KoursesMember use KoursesErrorsVatValidationException use Exception class VatHelper public function isValidVatId string vatNumber bool try return this gt calculator gt isValidVATNumber vatNumber catch Exception exception throw new VatValidationException VAT validation failed public function getTaxRate string countryCode string postalCode null string vatNumber null float isCompany this gt isValidVatId vatNumber return this gt calculator gt getTaxRateForLocation countryCode postalCode isCompany public function getTaxRateForMember Member member float return this gt getTaxRate member gt country member gt zip member gt vat id In method isValidVatId I m catching a rd party service exception and re throwing it using a message and code that is in sync with my app Now I don t need to catch rd party package exceptions in my controllers If I decide to change this rd party package I wouldn t have to go through my code and change all mentions of this package In getTaxRate method I ve also slightly altered behavior which suits my flow better I m validating the VAT number before getting the tax rate for the user s location as it is dependent on your business location as well as your customers location Method getTaxRateForMember is a simple helper which allows me to easily pass my member object and get its current VAT rate without needing to spread required params Using this technique you could easily implement caching in front of external service calls if need be Here as the VAT number checked should be different each time I m not doing that This wrapper borrows from a Facade design pattern a Proxy and even a Decorator If you wish to learn more about design patterns be sure to check out as they have a nice overview of basic patterns as well as real world examples |
2022-03-31 13:24:38 |
海外TECH |
DEV Community |
Making your own Email Subscription Service with Node.JS |
https://dev.to/smpnjn/making-your-own-email-subscription-service-with-nodejs-29bc
|
Making your own Email Subscription Service with Node JSIt s common for websites to have a subscription button where you can pass along your email address and you ll receive emails every week month or day Sometimes these are automated emails and sometimes they are custom posts written by an editor It s also common to pay for this service sometimes extortionately In this article I ll show you it s pretty easy to create your own although you will obviously still have to pay for hosting Let s look at how to create an email subscription service with MongoDB and Node JS You can find the source code for this article here Flow of Data for Email SubscriptionEmails subscriptions are not architecturally hard to understand You start with a form where users can submit their email Then every so often we ll run a job which will send that email to users at a particular time and day For this guide we ll be using Node JS and MongoDB The flow of data looks something like this How a subscription service worksFor this to all tie together we ll have to make two endpoints on a Node JS server one for unsubscribing and one for subscribing Our file structure for this project looks like this daemons lt For storing any regular jobs subscription daemon js lt Our subscription service which runs automatically once a weekmodels lt For storing database models subscription model js lt How our subscription service will look in the MongoDB databasepublic lt All our public files index html lt Landing page local js lt local frontend Javascripttemplates mail html lt the mail we will send to our users env lt configuration gitignore index js lt where we will store our subscribe and unsubscribe routesutil js lt some utility functionspackage jsonpackage lock json Step Setup your FrontendThe first step is to make your frontend form You might be using a framework for this like Vue or React but for simplicity I ve created one in plain HTML Here is our simple subscription form which I ve put in public index html lt div id subscribe box gt lt h gt Subscribe for Daily Dev Tips lt h gt lt p gt Subscribe to our weekly newsletter to stay up to date with our latest web development and software engineering posts via email You can opt out at any time lt p gt lt div class error message gt Not a valid email lt div gt lt div class form holder gt lt input type text value placeholder dev email com gt lt input type submit value Subscribe gt lt div gt lt div gt lt script src local js gt lt script gt As we discussed before we ll ultimately be making two server endpoints one to save user s email details to a database and another to allow them to unsubscribe thus removing them from the database As such there is a bit of frontend Javascript to go along with this which I m storing in local js Our Javascript accomplishes a few things which you can read about in the inline comments If a user clicks or presses enter then we submit their email to let them subscribe If a user enters an invalid email we ll show them an error When we get the response back from the server we ll display that to the user We ll use fetch to send our API requests local js if document getElementById subscribe box null If the subscribe box is on this page if document getElementById subscribe box null For validating an email const validateEmail function email const regex lt gt s lt gt s a zA Z a zA Z return regex test email For verifying a subscription const subscribe async function Get the value of the input let input document querySelector subscribe box input type text value Validate if it s an email if validateEmail input Show an error if it s not document querySelector subscribe box error message classList add active setTimeout function document querySelector subscribe box error message classList remove active else Otherwise post to our subscribe endpoint let postEmailSubscription await fetch subscribe email method POST body JSON stringify email input headers content type application json Get the response let getResponse await postEmailSubscription json document querySelector subscribe box error message textContent getResponse message document querySelector subscribe box error message classList add active Show the apropriate response if getResponse code localStorage setItem subscribe input else setTimeout function document querySelector subscribe box error message classList remove active If the user clicks subscribe submit their subscription document querySelector subscribe box input type submit addEventListener click function e subscribe If the user presses enter submit their subscription document querySelector subscribe box input type text addEventListener keydown function e if e keyCode subscribe Step Setup BackendFirst things first make sure you have MongoDB installed Now we ll create our two routes for subscribing and for unsubscribing It s worth noting I ve set up a a barebones subscription model which defines how the subscriptions will look in our database It can be found in models subscription model js import dotenv from dotenv dotenv config import mongoose from mongoose mongoose createConnection process env mongooseUri useNewUrlParser true useUnifiedTopology true const schema new mongoose Schema email string const Subscription mongoose model Subscription schema export Subscription index jsNext up let s make our routes We ll be putting them in index js We aren t doing anything too complicated here we are initiating an express server and adding two routes to it one which saves data to the database and another which deletes it I m using a validateEmail function which can be found in util js to validate any incoming emails I ll leave it to you to integrate this into your already existing server if you need to but the full code for index js is shown below NPMimport dotenv from dotenv dotenv config NPMimport dotenv from dotenv dotenv config import express from express import bodyParser from body parser import mongoose from mongoose Modelimport as Subscription from models subscription model js Utilsimport validateEmail from util js mongoose connect process env mongooseUri useNewUrlParser true useUnifiedTopology true App Settingslet app express let port let jsonParser bodyParser json Set up our public folderapp use express static public A user wishes to subscribeapp post subscribe email jsonParser async function req res try Check if the email exists first of all let checkSubscription await Subscription Subscription find email req body email If it doesn t if checkSubscription length Then validate the email if validateEmail req body email And add it to the database const newSubscription new Subscription Subscription email req body email newSubscription save function err if err res status send message Error saving your email code else res status send message User has subscribed code else Otherwise show errors res status send message Error saving your email code else res status send message User Already Subscribed code catch e Or a real error if something really goes wrong console log e app get unsubscribe email async req res gt Unsubscribe email if typeof req params email undefined When we unsubscribe check for an email let findEmail await Subscription Subscription find email req params email if findEmail length gt If it exists remove it await Subscription Subscription deleteOne email req params email res send message Email deleted code else Otherwise the user wasn t even subscribed to begin with res send message Email doesn t exist code app listen port At this point we have a functioning database frontend connection Users can submit or delete subscriptions via the frontend and we ll store it all in one MongoDB backend database Configure your env fileThe last thing to do for this step is to configure your env file to include some basic settings mongodb detailsmongooseUri LINK TO YOUR MONGODB URI email connection detailscontactEmail EMAIL ACCOUNTcontactPassword PASSWORD FOR EMAILcontactHost SMTP HOST comSince we ll be using nodemailer you need an SMTP account You can read more about why you need an SMTP account here Fortunately there are a few ways to set this up and if you have Plesk it s pretty easy to make new webmail accounts Regardless you will need a username and password to login to your SMTP webmail account wherever it is hosted As such make sure it s in your env file as shown above Step Setup a CronJobThe final step in our code is to start sending emails to people This job will be in daemons subscription daemon js Let s look at some of the main things going on in this file to start with How CronJobs workCronJobs are processes which run at specific times and days To set it up in Node JS we use node scheduler but the basic syntax of a CronJob remains the same in most scheduler systems A CronJob schedule as the following pattern ┬┬┬┬┬┬│││││││││││└day of week or is Sun ││││└ーmonth │││└ーday of month ││└ーhour │└ーminute └ーsecond OPTIONAL Since I wanted my emails to send every Monday at am the CronJob schedule looks like this schedule scheduleJob function How Nodemailer worksWe ll also be using nodemailer which is what sends the mail Using our email and password from our env file we configure a transporter From that transporter we can start to send mail to users const mailer async function title obj try let email await fs readFile templates mail html encoding utf let text replaceHTML email obj let transporter mail createTransport host process env contactHost port maxMessages Infinity debug true secure true auth user process env contactEmail pass process env contactPassword tls rejectUnauthorized false let allSubs await Subscription Subscription find allSubs forEach function item if typeof item email undefined transporter sendMail from process env contactEmail lt process env contactEmail gt to item email subject title replyTo process env contactEmail headers Mime Version X Priority Content type text html charset iso html text err info gt if err null console log err else console log Email sent to item email at new Date toISOString catch e console log e Run the CronJobschedule scheduleJob async function try mailer This is our Subscription Email content Hello welcome to our email catch e console log e As you start to scale to larger and larger amounts of messages you may wish to alter the transport used here You can also alter the maxConnections property of your transport to increase the number of connections available to send messages from as you scale Ideally you will run this on a dedicated mail server but it s not always possible to do that This will work really well for s of messages but if you scale beyond that other solutions may be required Step Make sure your email is configured rightSince you ll be sending emails to users you have to make sure your mail is configured right If you re running into trouble try the following Make sure port and are open on your mail server Your host or cloud provider should have documentation on how to do this Ensure you DNS is configured properly That means having an MX CNAME setup For me this looks like MX mail fjolt com Make sure you have secured your mail It s easy for mail providers to mark an email as spam Make sure you have DKIM DMARC and SPF setup on your DNS so that gmail and others knows your mail is legitimate Check the logs If you have issues sending mail check to see the mail is successfully being sent If it s not you might have a server configuration problem If it is your mail may be marked as spam Run the daemon with test emails Use a service like mail tester or your own personal email to see if you are receiving messages You can change the CronJob to to run it every seconds for testing purposes Finally make sure you update the email to be sent You can find the default email that will be sent in the templates mail html file Running your servicesWe now have two services One is for our database subscribe and unsubscribe to add and remove emails The other is our mailer daemon which will run every Monday at am To run both we can use pm which is easily installed by using npm i g pm on the command line This will ensure both of our services run successfully for as long as we want them to pm index jspm daemons subscription daemon js ConclusionIf everything is configured right and you have a valid SMTP account your mail server should now work and you ll be able to send messages out to everyone in your database You can also extend this to get the email itself from the database allowing you to craft custom mails which are sent out every Monday This solution is relatively scalable and works fine for most use cases For larger ones where millions of messages are involved you may have to look into scaling I hope you ve enjoyed this article Here are some useful links The source code is available on GitHub Nodemailer documentation on setting up an SMTP account An introduction to DKIM DMARC and SPF |
2022-03-31 13:14:02 |
海外TECH |
DEV Community |
3 Best Practices to Make Cloud Migration Easier |
https://dev.to/mbogan/3-best-practices-to-make-cloud-migration-easier-3fp1
|
Best Practices to Make Cloud Migration EasierCloud migration It s a term that comes up in most enterprise conversations at least once While the term represents the practice of moving from on premises infrastructure to cloud infrastructure what is meant by “cloud migration has evolved Cloud migration is no longer as simple as moving from on prem servers to AWS EC It could include moving to managed databases or API gateways or maybe you need AWS for some workloads and Azure for others Perhaps you re a financial or public sector organization and you need a private cloud Or maybe you need to meet special regulatory requirements In this article we re going to look at three best practices for making cloud migration easier for your enterprise Refine your culture Engage in intelligent change Observe and monitor By applying these guiding principles to your organization s cloud migration effort you ll avoid turning the cloud migration effort into an aimless and inefficient slog Instead you ll have the organizational awareness and the tools in place to tackle the job with confidence Before we dive right into our best practices however let s first touch on the different approaches typically used during cloud migration Cloud Migration Approaches The R sThough there are guidelines for cloud migration there is no one size fits all approach Today s cloud environment is complicated by the diversity of options industry nuances and business needs Traditionally businesses needed to take an approach from one of the following Five R s Rehost This is your traditional lift and shift approach For example you have applications running on prem in VMs and you redeploy your application to VMs running in a cloud Refactor This is similar to rehost except that you have a midpoint step to make tweaks lift tweak and shift Revise This is an amalgamation of rehost and refactor The revise approach often includes significant application changes to leverage the capabilities of the destination cloud Rebuild This takes your effort one step further than the revise approach by in some cases fully rebuilding applications to leverage the destination cloud s capabilities Replace With this approach an organization cordons off and removes a piece of functionality that was being maintained in house replacing it with a third party option Now let s take these and put a modern cloud spin on them Rehost You have applications running on prem in VMs that you redeploy to VMs running in multiple clouds Refactor Your midpoint step makes tweaks for each destination cloud Revise You include significant application changes to leverage the capabilities of each destination cloud Rebuild You fully rebuild applications to leverage multiple destination cloud capabilities Replace You replace pieces of functionality with potentially multiple third party options Talking about multiple clouds specialized use cases or industry regulations quickly compounds the complexity of cloud migration Even amid this complexity organizations can follow three key best practices to smooth out and simplify the cloud migration effort Refine Your CulturePerhaps one of the most difficult yet rewarding best practices is cultural refinement You probably have a loose idea of who s in charge of what pieces of your technical estate and that s a good start However before attempting a cloud migration much more awareness is necessary Identifying responsibilitiesOne good technique is to use a RACI matrix for a given component or domain This will clearly show who is responsible accountable consulted and informed for all of the changes that will be happening during the migration The cloud moves fast and your team needs to move faster Knowing who to go to for each piece is key Tracking metricsAnother piece of the cultural refinement is not just identifying key metrics but also putting those metrics in writing Many are hesitant to take this approach because it often shines a light on operational inefficiencies Remember If it s not measured it can t be improved This practice should be adopted at various levels From the application team perspective metrics around network and storage latency may be important For the management level and higher however composite service level objectives SLOs that show a high level team metric may be more important Be clear and concise on what comprises an SLO and if possible standardize the generation of the SLOs among as many teams as possible While you might have service level agreements SLAs to enforce contractual guarantees SLOs help your entire organization understand how application performance and reliability impact your customers and the overall business Remember SLOs enable SLAs and SLAs enable your customers Answer business questions efficientlyCarrying forward the idea of codifying metrics it s essential to lower the bar for observability and monitoring If a team member needs to copy and paste a PromQL query in order to answer a business impacting question you can consider this an opportunity for improvement This can be an expansive and complex topic but ultimately it comes down to answering business questions as quickly and accurately as possible Most often this is achieved by coupling your data store s with a flexible visualization system that s open and available for all levels Engage in Intelligent ChangeChange management often conjures up the image of a stifling board of attendees whose sole jobs are to poke holes in progress and to say no Luckily that s not what s meant by “intelligent change Intelligent change is an approach to cloud migration that uses technical gating instead of process gating In other words protection should be enforced through automated processes like end to end testing continuous integration and provability through distributed tracing Pieces that can t be covered by technical gating or would require a non trivial amount of work should be moved lower on the migration list The process of creating the technical gating for smaller or easier workloads often paves the way for more complex pieces to follow the same processes Work through each piece iteratively until a sufficient level of correctness and functionality is achieved then rinse and repeat Observe and MonitorObservation and monitoring are critical to validating the success of your cloud migration effort Before the effort begins then it s important to make systems and applications observable if they re not already Observability is not the same thing as monitoring Monitoring is in a sense observing the observability As an example you can monitor if a database is up or down based on whether or not you can make a connection to it but a database is observable when you can see utilization metrics query times and active connection counts Second make systems and applications monitorable if they re not already This is how you make informed decisions based on observability Examples of questions to ask yourself include Can I send alerts based on monitoring data Can my infrastructure self heal based on monitoring How long does it take me to answer X about a system application In essence monitorability is the nexus of decision making during a cloud migration Without it success is difficult to achieve if at all Lastly it s paramount to have a single pane of glass through which you can trace back each change deployment and ideally the lack of impact on the environment The ability to zero in on likely culprits of issues during your cloud migration is critical Wrapping UpIn reality there are many best practices probably enough to write several in depth books about how to migrate to the cloud These three practices give you the “who the “what and the “why of how to migrate successfully Now the difficult part is what tooling should you use There s always the roll your own option but if you re staring down a cloud migration especially in a large tech estate going with a homegrown option will make things more difficult For a cloud migration we would almost always recommend choosing an established vendor of which there are many One particularly good option is Lightstep Lightstep is building SRE tools for the cloud native enterprise including observability monitoring and incident response One of the key use cases for their platform is cloud migrations |
2022-03-31 13:09:15 |
海外TECH |
DEV Community |
Adding periodic task in Elixir with OTP |
https://dev.to/rafaquelhodev/adding-periodic-task-in-elixir-with-otp-2ge4
|
Adding periodic task in Elixir with OTPIn this post I ll show how to create a simple periodic task using Elixir OTP In this example we ll create a simple server calculator For somehow we want to keep adding numbers periodically over time The initial structure for this process is defmodule Calculator do use GenServer doc Starts the calculator def start link opts do GenServer start link MODULE ok opts end impl true def init ok do IO puts starting calculator ok end impl true def handle call add num from state do result state num IO puts result reply ok result result end def add server num do ok result GenServer call server add num result endendHere we can add a number by sending a message add num to the server The client function for this purpose is add Then we need to create a new process that will handle the periodic tasks defmodule Periodic do use GenServer defstruct freq nil server nil callback nil def start link opts do GenServer start link MODULE ok opts end impl true def init ok do ok end impl true def handle call periodic data from state do Process send after data server tick data data freq reply data state end impl true def handle info tick data state do data callback Process send after data server tick data data freq noreply state end def retry server data do data Map put data server server GenServer call data server periodic data endendThe periodic task is created using the Process send after function By doing this a message tick data is sent to the server after a time of data freq ms The idea behind this server is that the client must provide a callback function that is run periodically in a frequency in ms also defined by the client Therefore the client must provide two inputs callback and freq In order to run a periodic task a client must call the retry function passing the callback and freq information Finally we need to define the periodic task that must be run the in Calculator server Remember we want to keep adding numbers periodically For this we define a new function add periodic and a constant freq set to be ms at the Calculator module defmodule Calculator do alias Periodic freq def add periodic server num freq freq do ok pid Periodic start link callback fn gt add server num end Periodic retry pid Periodic freq freq callback callback endThe entire code can be found HERE Usage example First open the iex shell by iex S mixThen import Calculator ok pid Calculator start link Calculator add periodic pid And voila we ll see something like this |
2022-03-31 13:01:44 |
Apple |
AppleInsider - Frontpage News |
Apple named a titan in Time's 2022 list of most influential companies |
https://appleinsider.com/articles/22/03/31/apple-named-a-titan-in-times-2022-list-of-most-influential-companies?utm_medium=rss
|
Apple named a titan in Time x s list of most influential companiesApple has again made the Time Magazine list of the most influential companies of with the publication naming Apple a titan that is flexing its power with impactful privacy features Credit Laurenz Heymann UnsplashTime magazine said that Apple was flexing its muscles throughout and its description of the iPhone maker s accomplishments focused on the company s privacy features ーsuch as App Tracking Transparency ATT Read more |
2022-03-31 13:50:13 |
Apple |
AppleInsider - Frontpage News |
How to backup your Mac |
https://appleinsider.com/inside/mac/tips/how-to-backup-your-mac?utm_medium=rss
|
How to backup your MacWhether it s a MacBook Pro that s always out on the road with you or a Mac Studio that gets left in an office your Mac holds critical data and you ve got to back it up Apple works very hard to make it so that you don t have to consciously think which of your computers you need to use You can start writing a sentence on your iPhone and finish it off on your Mac Pro without thought But that same way your data is available to you across all your devices is also a way that tricks you into thinking it s all safe If your MacBook Pro is stolen at least all the data is still on your office Mac for instance Read more |
2022-03-31 13:41:07 |
Apple |
AppleInsider - Frontpage News |
Death knell sounds for iPhone 6 as Twitter app drops support |
https://appleinsider.com/articles/22/03/31/death-knell-sounds-for-iphone-6-as-twitter-app-drops-support?utm_medium=rss
|
Death knell sounds for iPhone as Twitter app drops supportTwitter has ended support for iOS and along with it the iPhone Owners of this eight year old smartphone have taken to social media to lament this nail in the coffin The iPhone was released in The iPhone was released in as the first iPhone with a phablet display size and an all new candy bar design The device was so popular that it broke sales records and created the now infamous supercycle Apple provided new operating system updates for this device until iOS was released in August Read more |
2022-03-31 13:27:58 |
海外TECH |
Engadget |
The US Space Force will use a 'digital twin' to simulate satellite incidents |
https://www.engadget.com/us-space-force-digital-twin-slingshot-aerospace-130219924.html?src=rss
|
The US Space Force will use a x digital twin x to simulate satellite incidentsThe US Space Force needs to prepare for calamities but how can it do that when it can t practice using real satellites in orbit It s going to use a digital twin apparently Slingshot Aerospace says it s developing a quot Digital Space Twin quot that will combine physics based modelling with real time object mapping to help the Space Force simulate various situations and plan responses well in advance The twin will help mission teams decide how to react to a potential collision for instance The Space Force could also use the simulation to design safer and more efficient satellite constellations And yes the military branch will also use the digital environment to ready itself for quot nefarious acts quot from countries with a less than peaceful approach to space Slingshot is building the Digital Space Twin thanks to a month million contract The funding will also help Slingshot conduct a pilot program that brings a Laboratory simulation platform shown above to Space Force educational and training outfits including Basic Military Training the National Security Space Institute and two training squadrons Any practical proof of effectiveness is likely years away With that said digital twins like this might be crucial for the Space Force and other beyond Earth agencies They could not only trim costs and speed up development but help avoid disasters that ruin costly spacecraft or spark international incidents |
2022-03-31 13:02:19 |
金融 |
RSS FILE - 日本証券業協会 |
IOSCO「資産運用におけるサステナビリティに関連した実務、方針、手続及び開示に関する提言」 |
https://www.jsda.or.jp/about/international/iosco_report_202111.html
|
iosco |
2022-03-31 13:22:00 |
金融 |
金融庁ホームページ |
「主要行等向けの総合的な監督指針」等の一部改正について公表しました。 |
https://www.fsa.go.jp/news/r3/sonota/20220331.html
|
行等 |
2022-03-31 15:00:00 |
ニュース |
BBC News - Home |
French intelligence chief Vidaud fired over Russian war failings |
https://www.bbc.co.uk/news/world-europe-60938538?at_medium=RSS&at_campaign=KARANGA
|
invasion |
2022-03-31 13:31:38 |
ニュース |
BBC News - Home |
David and Victoria Beckham's London mansion burgled |
https://www.bbc.co.uk/news/uk-england-london-60938629?at_medium=RSS&at_campaign=KARANGA
|
kensington |
2022-03-31 13:40:43 |
ニュース |
BBC News - Home |
War in Ukraine: President Zelensky addresses Australian parliament |
https://www.bbc.co.uk/news/world-60944942?at_medium=RSS&at_campaign=KARANGA
|
australian |
2022-03-31 13:18:40 |
ニュース |
BBC News - Home |
Liz Truss visits India on same day as Sergei Lavrov |
https://www.bbc.co.uk/news/uk-politics-60939406?at_medium=RSS&at_campaign=KARANGA
|
ukraine |
2022-03-31 13:01:04 |
ニュース |
BBC News - Home |
Premier League clubs agree to five substitutes from 2022-23 season |
https://www.bbc.co.uk/sport/football/60945430?at_medium=RSS&at_campaign=KARANGA
|
seasonpremier |
2022-03-31 13:48:00 |
ニュース |
BBC News - Home |
Sebastian Vettel: Aston Martin driver fit for Australian GP after Covid-19 |
https://www.bbc.co.uk/sport/formula1/60879914?at_medium=RSS&at_campaign=KARANGA
|
covid |
2022-03-31 13:10:37 |
ビジネス |
不景気.com |
和心を債務超過の猶予期間入り銘柄に指定、観光需要減で - 不景気.com |
https://www.fukeiki.com/2022/03/wagokoro-caution.html
|
上場廃止 |
2022-03-31 13:05:52 |
北海道 |
北海道新聞 |
クマ襲撃の三角山「注意」 周辺住民に驚き、登山口は封鎖 |
https://www.hokkaido-np.co.jp/article/663917/
|
札幌市西区 |
2022-03-31 22:31:47 |
北海道 |
北海道新聞 |
スピード、辻が現役引退表明 女子短距離ソチ五輪代表 |
https://www.hokkaido-np.co.jp/article/663925/
|
現役引退 |
2022-03-31 22:20:00 |
北海道 |
北海道新聞 |
原油の大幅増産要請もペース維持 OPECプラス閣僚級会合 |
https://www.hokkaido-np.co.jp/article/663924/
|
石油輸出国機構 |
2022-03-31 22:20:00 |
北海道 |
北海道新聞 |
NY円、121円後半 |
https://www.hokkaido-np.co.jp/article/663923/
|
外国為替市場 |
2022-03-31 22:07:00 |
北海道 |
北海道新聞 |
ヤ3―6巨(31日) 巨人が3連勝 |
https://www.hokkaido-np.co.jp/article/663922/
|
適時打 |
2022-03-31 22:07:00 |
北海道 |
北海道新聞 |
厚岸コンキリエ12年連続1位 じゃらん道の駅食事メニュー部門 |
https://www.hokkaido-np.co.jp/article/663909/
|
旅行雑誌 |
2022-03-31 22:06:48 |
北海道 |
北海道新聞 |
子ども本人の意見を重視 道、児相に一時保護対応の「支援員」試行配置 |
https://www.hokkaido-np.co.jp/article/663891/
|
児童相談所 |
2022-03-31 22:03:19 |
コメント
コメントを投稿