AWS |
AWS Database Blog |
AerLink is digitally transforming the aircraft leasing and financing industry using Amazon Managed Blockchain |
https://aws.amazon.com/blogs/database/aerlink-is-digitally-transforming-the-aircraft-leasing-and-financing-industry-using-amazon-managed-blockchain/
|
AerLink is digitally transforming the aircraft leasing and financing industry using Amazon Managed BlockchainThis is a guest post from Finn Mulligan and Sanjaya Krishna co founders of AerLink Ltd in partnership with Maggie Hsu WW GTM Specialist for Amazon Managed Blockchain AerLink is a Seattle based startup that is focused on transforming the aircraft leasing and financing industry Aircraft leasing and financing is currently full of manual time intensive processes and … |
2021-04-20 14:18:32 |
AWS |
AWS Open Source Blog |
FreeRTOS.org update for Q1 2021 |
https://aws.amazon.com/blogs/opensource/freertos-org-update-for-q1-2021/
|
FreeRTOS org update for Q In the first three months of the FreeRTOS org blog published several posts containing both deep technical content and FreeRTOS improvement updates Check out the roundup of article summaries below for topics of interest to you As always we would love for you to participate in the FreeRTOS Forums and contribute through FreeRTOS on GitHub … |
2021-04-20 14:39:49 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
【Python Tips】文中の数字を0にする |
https://qiita.com/takahashikaito94/items/1bc11e86ee6b12d12d02
|
【PythonTips】文中の数字をにする今回は文中の数字をに変える処理を行います。 |
2021-04-20 23:59:14 |
js |
JavaScriptタグが付けられた新着投稿 - Qiita |
Reactの基本事項の備忘録② |
https://qiita.com/anago1030/items/f13ef63ddf7abe18883b
|
propsとは引数のようなもので今回の場合はAppjsから各言語の名前と画像ファイルをLanguageコンポーネントに渡すことで言語ごとに表示を変えることができます。 |
2021-04-20 23:58:59 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
pywin32 に関して |
https://teratail.com/questions/334307?rss=all
|
pywinに関してpywinを利用してpythonでexcelを起動させて、新規シートを作成しBセルに「こんにちは」と書き込むだけのプログラミングですが、下記のようなエラーが出てしまします。 |
2021-04-20 23:53:16 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
python webサーバでのプログラム実行について |
https://teratail.com/questions/334306?rss=all
|
pythonwebサーバでのプログラム実行についてコマンドプロンプトでpynbspmnbsphttpservernbspcginbspを入力することによってwebサーバが起動しました。 |
2021-04-20 23:41:25 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
マリオカートの部品選択のようなことを変数を指定して、表示させたい |
https://teratail.com/questions/334305?rss=all
|
マリオカートの部品選択のようなことを変数を指定して、表示させたい前提・実現したいこと・Unity初心者・キメラ格闘ゲーム決めた変数が指定した値になったら出現させ、値ではないときは非表示にしたい。 |
2021-04-20 23:31:56 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
pythonのクラスのインスタンス化したときの挙動とインスタンス化方法について |
https://teratail.com/questions/334304?rss=all
|
pythonのクラスのインスタンス化したときの挙動とインスタンス化方法について上記、タイトルのことを確認しています。 |
2021-04-20 23:31:43 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
rails のバージョンアップをしようとして、bundle installした際に複数のgemでエラーが出る |
https://teratail.com/questions/334303?rss=all
|
railsのバージョンアップをしようとして、bundleinstallした際に複数のgemでエラーが出るrailsnbspにバージョンアップをしようとして、gem書き換えてbundlenbspinstallしようとしたら複数のgemでエラーが出ます。 |
2021-04-20 23:31:18 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
collecitomViewでアプリを立ち上げたときだけcellが表示されない |
https://teratail.com/questions/334302?rss=all
|
collecitomViewでアプリを立ち上げたときだけcellが表示されない前提・実現したいことcollectionViewを使ったアプリで、アプリを立ち上げたときだけcellが表示されません。 |
2021-04-20 23:28:49 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
Django inlineformset_factoryについて |
https://teratail.com/questions/334301?rss=all
|
DjangoinlineformsetfactoryについてdjangoのinlineformsetfactoryをクラスビューでCreateViewを継承して作るフォームがうまく作成されません。 |
2021-04-20 23:09:04 |
Ruby |
Rubyタグが付けられた新着投稿 - Qiita |
初投稿 aka freelance way |
https://qiita.com/ny3line/items/ddda847b8c7c9c51c765
|
akafreelanceway |
2021-04-20 23:54:53 |
Ruby |
Rubyタグが付けられた新着投稿 - Qiita |
Railsのmemberとcollectionについて |
https://qiita.com/masashikuwahara/items/a0085d718afda176897b
|
Railsのmemberとcollectionについてルーティングにはindexnewcreatedestroyeditupdateshowのつのアクションがありますが、他にもcollectionとmemberというのがあります。 |
2021-04-20 23:31:53 |
Ruby |
Rubyタグが付けられた新着投稿 - Qiita |
Rails DBに保存されていないデータの並び替え |
https://qiita.com/ayanokobayashi103/items/c96f8583005dc561b3c6
|
RailsDBに保存されていないデータの並び替えはじめにクチコミアプリを作っています。 |
2021-04-20 23:20:18 |
AWS |
AWSタグが付けられた新着投稿 - Qiita |
【AWS】VPC トラフィックミラーリング(Traffic Mirroring)で通信をミラーリングしてみた |
https://qiita.com/kowa22/items/b18cabe2a363fed47110
|
トラフィックミラーリングの場所はここ①AWSWeb②VPC③トラフィックのミラーリングVPCダッシュボード内ここから設定していくよターゲットの設定ミラーリングしたパケットの宛先と思ってください。 |
2021-04-20 23:49:59 |
AWS |
AWSタグが付けられた新着投稿 - Qiita |
AWS学習メモ |
https://qiita.com/Kassa98/items/c96e681aea8393c8cd9c
|
AWS学習メモ一般的なものでなく、人から聞いた内容を備忘録的に記載します。 |
2021-04-20 23:03:31 |
Ruby |
Railsタグが付けられた新着投稿 - Qiita |
初投稿 aka freelance way |
https://qiita.com/ny3line/items/ddda847b8c7c9c51c765
|
akafreelanceway |
2021-04-20 23:54:53 |
Ruby |
Railsタグが付けられた新着投稿 - Qiita |
Railsのmemberとcollectionについて |
https://qiita.com/masashikuwahara/items/a0085d718afda176897b
|
Railsのmemberとcollectionについてルーティングにはindexnewcreatedestroyeditupdateshowのつのアクションがありますが、他にもcollectionとmemberというのがあります。 |
2021-04-20 23:31:53 |
Ruby |
Railsタグが付けられた新着投稿 - Qiita |
Rails DBに保存されていないデータの並び替え |
https://qiita.com/ayanokobayashi103/items/c96f8583005dc561b3c6
|
RailsDBに保存されていないデータの並び替えはじめにクチコミアプリを作っています。 |
2021-04-20 23:20:18 |
技術ブログ |
Developers.IO |
Next.js で Airtable を簡易データベースとして使ってみるよ。 |
https://dev.classmethod.jp/articles/next-js-and-airtable/
|
excelg |
2021-04-20 14:50:11 |
海外TECH |
DEV Community |
What's your favorite programming newsletter? |
https://dev.to/amrutaranade/what-s-your-favorite-newsletter-2iad
|
What x s your favorite programming newsletter I start every morning with the Morning Brew for tech business news and Skimm for world news and would love to add a tech programming newsletter to the mix What s your favorite newsletter |
2021-04-20 14:42:07 |
海外TECH |
DEV Community |
Building a Professionally Designed Website Episode 2 - CSS Framework, Baseline Grid, NextJS Structure |
https://dev.to/payloadcms/building-a-professionally-designed-website-episode-2-css-framework-baseline-grid-nextjs-structure-29ci
|
Building a Professionally Designed Website Episode CSS Framework Baseline Grid NextJS Structure This is Episode in a series that takes you through how to build a high end website from a design agency s perspective using Payload CMS TypeScript and statically rendered NextJS If you missed the first episode I d highly recommend going back and watching that one before jumping in here In that first episode we covered a lot of ground including the setup of the entire Payload CMS needed to drive the content of the website In that first episode we defined all Collections and Globals necessary as well as went in depth with layout building Block definitions Now in Episode we re ready to start work on the frontend In this episode we dive into how to build a lightweight but powerful CSS framework that we ll rely on through the entire site We ll define breakpoints media queries typography colors a global reset and finally a really awesome way to build a baseline grid using rems Table of Contents Intro React JSS NextJS setup Writing our first global styles The baseline grid in CSS rems Reusable values breakpoints colors Typography CSS media queries Installing dependencies CSS grid Modal Window Info First component GridContainer Testing our grid discussing NextJS page folder Stubbing out the Template Header and Footer components Outro Give Payload a shotIf you re a JS TS developer and haven t heard of Payload yet you should give it a shot Its developer experience is second to none and it just feels right to build sites and apps with it Feedback welcomeAs always let us know what you think about the video and about Payload |
2021-04-20 14:38:04 |
海外TECH |
DEV Community |
One of my React projects |
https://dev.to/a03z/one-of-my-react-projects-2bnh
|
One of my React projects So today i ve done this poject where you enter a keyword and list of images from Unsplash appear under input I was thinking about projects for portfolio practice and then saw this article clickI ve done almost the same but with React Hook Forms Typescript and ChakraUI Here s links GitHubNetlifyTODO infinity loading when u scroll to the bottom of the app new list of images load Thanks for attentionOpen for suggestions |
2021-04-20 14:31:29 |
海外TECH |
DEV Community |
Challenge: Create a `pad` function without using loops! |
https://dev.to/_gdelgado/challenge-create-a-pad-function-without-using-loops-2id5
|
Challenge Create a pad function without using loops Photo Credit Kylie Fitts www kyliefitts com amp In any language implement a function pad that takes a value and conditionally pads it with n number of padding const padded pad value padding requiredLength console log padded gt Case do not pad a value whose length is equal to requiredLength const padded pad value padding requiredLength console log padded gt Case do not overwrite a value that is longer than requiredLength const padded pad value padding requiredLength console log padded gt Submit your solutions down below Remember your solution cannot use any sort of loop construct such as while do or for WARNING Here is my solution in typescript |
2021-04-20 14:28:32 |
海外TECH |
DEV Community |
React vs Angular comparison: Which is better for your project in 2021? |
https://dev.to/pawanbhayde/react-vs-angular-comparison-which-is-better-for-your-project-in-2021-4o5a
|
React vs Angular comparison Which is better for your project in Choosing React or Angular may be a debating issue raised by many developers Everybody from a newcomer and a freelancer to a talented architect is trying to know where to start out do you have to got to craft a technique for your project you ll need to get an experienced opinion Our experts have conducted an in depth React vs AngularJS Angular comparison to save lots of some time Comparing React vs Angular you ll be ready to understand which technology is best for your case and environment AngularJS is an open source JavaScript framework maintained by Google and community which may help developers create single page applications AngularJS which is made on top of JavaScript is making the lifetime of developers easy Is React a framework Advantages of React JSReact may be a interface library that was developed at Facebook for creating interactive stateful and reusable interface components it s used at Facebook in production ReactJS is sweet for rendering complex user interfaces with high performance the essential fundamental behind React is that the concept of virtual DOM Document Object Model ReactJS effectively uses virtual DOM which may be rendered either at the client side or server side and communicate back and forth The Virtual DOM renders subtrees of nodes based upon state changes React is lighter than Angular it s crammed with less number of conditions and eliminates the necessity to use extra elements like plugins React is against two way binding it intentionally stays faraway from it and makes use of explicit updates instead Questions to ask yourself if you can t decide between Angular popularity and React Js advantagesWhen it involves selecting the proper tool for your case you ought to ask yourself “Does it work for me “Will it s good to finish my tasks Here are more specific questions you ought to care about Is your tool mature enough and who developed it What are the features you ll need What does one realize the tool s ecosystem Which paradigms patterns and architecture does your tool employ Below are some questions for you and your team members Does a tool fit well together with your project requirements Will your team be ready to easily master this technology Have your developers had the experience of using it Why does one need answering these questions By giving the answers you ll be ready to assess the technology of your choosing and in our case to work out what s the difference between React and Angular Before beginning to compare the pros and cons React and Angular have we should always mention that it s not actually fair to contrast those And here is why React may be a UI library whereas Angular may be a sophisticated framework original post Note visit my youtube channel for frontend tutorialssubscribe to my youtube channel Resent post website to find designs for your next projects Pawan Bhayde・Apr ・ min read webdev javascript design discuss |
2021-04-20 14:21:19 |
海外TECH |
DEV Community |
Creating an API With Python Flask to Upload Files to Cloudinary |
https://dev.to/rebeccapeltz/creating-an-api-with-python-flask-to-upload-files-to-cloudinary-1a0a
|
Creating an API With Python Flask to Upload Files to CloudinaryCreating an API With Python Flask to Upload Files to CloudinaryMeta Title Creating an API With Python Flask to Upload Files to CloudinaryMeta Description Learn how to build an API with Python Flask and Cloudinary s Python SDk to upload files of any format to Cloudinary CodeCloudinary offers SDKs for many programming languages and frameworks Even though it also offers an Upload API endpoint for both back end and front end code most developers find the SDKs very helpful If you re working with a powerful back end framework like Python Flask you ll be happy to hear that a Python SDK is now available This tutorial walks you through the process of building an API to upload images to Cloudinary You can also upload other file types including video and even nonmedia files with the API Understanding the Difference Between Back End and Front EndGenerally code that runs on the server is back end and code that runs on the browser is front end However since server code can render HTML CSS and JavaScript which all run on the browser confusion sometimes results In the context of the Cloudinary SDKs the back end ones can read secret credentials which should not be shared in the front end In other words you must never expose the back end environment variables in the front end because front end SDKs cannot hide credentials that are meant to be kept secret As a solution you can upload browser code with Cloudinary s unsigned presets without revealing secret credentials A better way would be to build a back end API for secure uploads keeping your API SECRET credential hidden Read on to see how to do that with Cloudinary s Python SDK and Python Flask or Python Django Coding a Flask API to Upload to CloudinaryThe Flask framework makes it easy to define routes and their functionalities To get started first create a route named upload which accepts a POST that contains multipart form data You then package up the image file input into a FormData object in a submit handler and POST it to your own Flask API to call Cloudinary s Upload API which is configured with your full set of Cloudinary credentials Flask s request option enables you to get data from the client When submitting files such as uploading images you can call upon request to access them from flask import Flask render template requestif request method POST file to upload request files file The data retrieved from request files file is an instance of werkzeug FileStorage The object can be handed off to the Python SDK s Upload function Flask then wraps Werkzeug which handles the details of the Web Server Gateway Interface WSGI if file to upload upload result cloudinary uploader upload file to upload app logger info upload result For uploads to Cloudinary the default resource type is image To expand or create a new Flask API add resource type video or resource type raw for video or raw files respectively Raw refers to nonmedia file formats including text and JSON Finally upload result is an object that contains the upload response To complete the actions of your upload API return that response to the client like this from flask import jsonifyreturn jsonify upload result Below is the complete code of your upload API app route upload methods POST def upload file app logger info in upload route cloudinary config cloud name os getenv CLOUD NAME api key os getenv API KEY api secret os getenv API SECRET upload result None if request method POST file to upload request files file app logger info s file to upload file to upload if file to upload upload result cloudinary uploader upload file to upload app logger info upload result return jsonify upload result Setting Up the Flask AppNext follow the steps below to build the app Set Up the Virtual EnvironmentThe command below establishes your virtual environment This is an important step for encapsulating the libraries you ll be using in this app python m venv envsource env bin activateTo deactivate the environment type deactivatesource env bin activate Install FlaskInstall Flask with this command python m pip install Flask Add a requirements txt FileCreate a requirements txt file to keep track of all the versioned libraries you need for the app and to facilitate future deployment python m pip freeze gt requirements txt Upgrade the Python Package InstallerIf necessary upgrade the Python package installer called PIP with the command below The command might vary depending on your local Python installation As shown below the freeze command writes the library and version to the requirements txt file usr local opt python bin python m pip install upgrade pippython m pip freeze gt requirements txt Install CloudinaryNext install Cloudinary to gain access to its Upload API for the Python SDK python m pip install cloudinary python m pip freeze gt requirements txt Add CORS supportIf you want to access your upload API from a client served from a different host add Cross Origin Resource Sharing CORS support python m pip install flask corspython m pip freeze gt requirements txtNow you can add code to configure CORS for all the APIs and specifically the upload API The code below demonstrates both options from flask cors import CORS cross originapp Flask name After creating the Flask app you can make all APIs allow cross origin access CORS app or a specific API app route upload methods POST cross origin Work With Environment VariablesYou can easily load environment variables with Python Conveniently the python dotenv library is modeled on the Node js dotenv package You need three Cloudinary environment variables i e CLOUD NAME API KEY and API SECRET for your code but don t share API SECRET You can export those variables to the local environment When you deploy to Heroku you can add them to make them available to the app when it runs in a Heroku container from dotenv import load dotenvload dotenv In your upload API you read in the environment variables with the cloudinary config function You then access those variables with the os getenv function in the dotenv library cloudinary config cloud name os getenv CLOUD NAME api key os getenv API KEY api secret os getenv API SECRET When working locally you can create a gitignore d env file that contains your Cloudinary credentials for local testing The values for those credentials are displayed in your Cloudinary console CLOUD NAME CLOUD NAMEAPI KEY API KEYAPI SECRET API SECRETNext install the python dotenv library python m pip install python dotenvpython m pip freeze gt requirements txt Testing the API LocallyYou re now ready to test the app locally You can do end to end testing with Postman and a local form that points at a server running on localhost Create your app with an upload function by downloading cloning or copying from this GitHub repository Add your credentials to a env file and then start your server on localhost python app pyThe above command opens a server at Note that the default port is Test With PostmanIn Postman do the following Set the method to POST Set the body type to form data Establish Key Value pairs for input Set the value for the Key to file Mouse over the Key field and choose Text or File from the drop down menu Under File is a Select Files button click it to select a file from your local drive Click Send to process the request The Cloudinary Upload API response is displayed at the bottom of the page Test With a Local FormFollow these steps Open the index html file with a local HTTP server Choose a local file and click Upload Run the JavaScript code below The fetch command calls the server that runs on localhost fetch upload options then response gt return response json then data gt console log data catch error gt console log error If the process is successful the Cloudinary Upload API response is displayed in the console Don t forget to set event preventDefault for the submit handler Otherwise you ll get a page refresh and won t see your log Post a file in a submit handler by creating a FormData object and appending the file as shown in the code below const formData new FormData formData append file fileInput files const options method POST body formData The above code packages up the file you select in your form input as if you had submitted a multipart form A multipart form is important for submitting files because each input is sent as a block of data separated by boundaries The result is then displayed in your console like this Deploying the Flask App to HerokuHeroku is a platform as a service PaaS for serving prototypes or production ready apps Host the API you just built on Heroku by doing the following Create a free account on Heroku Install Gunicorn short for Green Unicorn a Python WSGI HTTP server for hosting apps python m pip install gunicorn python m pip freeze gt requirements txtCreate a file called Prodfile with instructions for Heroku to start your app with Gunicorn web gunicorn app appCreate a file called runtime txt that contains the Python version you want to use python Deploy with Git git initgit add git commit m my first commit Create a new Heroku appheroku create You will get a URL where the app will be hostedgit remote v will confirm that you have set up a remote to push to Heroku If you have an existing Heroku app that you created in the Heroku GUI you can add it with this command instead of creating a new oneheroku git remote a thawing inlet To deploy you can now just push to Herokugit push heroku master Open your server it s nice to have a GET method so you can verify like this heroku open To log in to Heroku from the command line type heroku login You ll then be prompted to open the webpage to log inYou can build the new Heroku app with the CLI However as noted above if you built it on the heroku com dashboard you can just add the link Heroku created for you to a git remote command Loading Environment Variables on HerokuTo load environment variables on Heroku open the dashboard and navigate to your new server instance Click the Settings tab and scroll down to the Config Vars section Click Reveal Config Vars where you can enter Key Value pairs This is where you load your Cloudinary environment variables CLOUD NAME API KEY and API SECRET Heroku Config Vars c fill f auto q auto dpr Web Assets blog environmentvars jpg For more options for setting up prod and dev instances see the Heroku documentation Testing the API Deployed on HerokuIf you have a GET method API like the Hello World in the app py example you can open the Heroku app in the browser For end to end testing you can POST to the Heroku server link from Postman The result is similar to that for local testing Remote Post c fill f auto q auto dpr Web Assets blog remotepost jpg Alternatively modify the index html file to post to your Heroku server Just add your Heroku server link to the fetch command like this JavaScriptfetch options Securing the AppYou might have noticed that the Heroku deployment link has been erased from the images above That s for security Deploying this app to Heroku enables you to upload data to Cloudinary If the link is not secured for use on an authenticated webpage only anyone can upload to your Cloudinary cloud Even though you are hiding your environment variables you d have created a public method to change data on your cloud This tutorial does not cover how to set up authentication Many options are available for authentication of API routes You might want to look into Auth Google or GitHub Alternatively build your own process based on your user database for this type of authentication Moving OnOnce you get this API running you can build other media APIs with the Cloudinary Python SDK by following the same pattern Have fun |
2021-04-20 14:20:40 |
海外TECH |
DEV Community |
What if? |
https://dev.to/theowlsden/what-if-36l1
|
What if Photo by Emily Morter on UnsplashMost of the time people ask What would your dream job look like Or what is the ideal company you would like to work at One thing I rarely hear people asking is this Imagine an ideal world that you didn t have to worry about money thus didn t have to work What would be the dream project you d be working on As a developer maybe there is this one side project that you always wanted to work on but never got that far What is that project and why is it important to you |
2021-04-20 14:18:40 |
海外TECH |
DEV Community |
Custom Swatch for Material App Theme – primarySwatch |
https://dev.to/rohanjsh/custom-swatch-for-material-app-theme-primaryswatch-3kic
|
Custom Swatch for Material App Theme primarySwatch Color is not a subtype of type MaterialColor ever got this kind of error at runtime most probably defining the primarySwatch for your App So let s find out how to define a custom swatch that would work as expected A color that has a small table of related colors called a “swatch ーDart DocsTo create our own small table we need some values to put it in right So where can we get them People on the earth are just awesome we have a tool Make Tints and Shades to our rescue Get any color HEX code you want paste it in that box and then click on Make tints and Shade Tip for future ーHover the shades to copy the code Create a new dart file for our new values home I have named it palette dart You guys can post your creative names in comments From Dart Documentationconst MaterialColor int primary Map lt int Color gt swatch Creates a color swatch with a variety of shades The primary argument should be the bit ARGB value of one of the values in the swatch as would be passed to the new Color constructor for that same color and as is exposed by value This is distinct from the specific index of the color in the swatch To tap into the desired value all you need to create is a Map That is exactly what we have created below with defining a class Palette for better use and scalability in the future Now we just need to import our newly created dart file in main dart for implementation When we define a primarySwatch by ourselves Theme itself takes some decision in defining colors for widgets like AppBar FAB etc And that s it we have a very own customized primarySwatch defined |
2021-04-20 14:17:20 |
海外TECH |
DEV Community |
7 self-taught coders who work full time as software developers |
https://dev.to/general42103681/7-self-taught-coders-who-work-full-time-as-software-developers-2d3m
|
self taught coders who work full time as software developersStudying web development is a path with many ups and downs It s often hard to see the light at the end of the tunnel But when you re in those tough dark spots try to find the motivation to hang in there You might have one day where you figure out a tough problem and feel absolutely amazing But then the very next day you get stuck on a seemingly easy problem for hours You end up feeling completely defeated You can also find encouragement from others who are in the same boat as you Knowing that there are people who struggle with the same issues can be hugely encouraging Read More |
2021-04-20 14:14:44 |
海外TECH |
DEV Community |
Side Effects with Combine |
https://dev.to/obscured_pixels/side-effects-with-combine-2oh3
|
Side Effects with CombineOne of the benefits of adopting Combine s publisher approach to asynchronous programing is that every operation is a stream or pipeline that we can subscribe and react to via powerful operators This works really well for situations where would like to execute code outside the scope of a publisher as certain events occur Such executions are often described as side effects What are side effects For the context of this article and within the realm of Combine we can define side effects as invocations that do not transform the output of a publisher which are triggered when certain events occur during a publisher s lifecycle Common use cases for side effects in reactive programming include but are not limited to DebuggingError handlingEvent trackingPersisting dataSo how would we go about implementing side effects in Combine Handling eventsCombine provides a useful handleEvents operator that allows us to provide closures that can be performed when certain publisher events occur This makes it possible for example to log relevant information in the event of a non fatal error todoRepository addTodo title title handleEvents receiveCompletion logger completion in switch completion case failure let error logger error error debugPrint an error occurred error case finished debugPrint addTodo publisher completed In addition to the receiveCompletion parameter the operator provides other events that we can hook into that can serve a variety of use cases receiveSubscription Executes when the publisher receives the subscription from the upstream publisher A possible use case for this would be to launch a background process experience whenever a consumer subscribes videoCallProvider acceptCall handleEvents receiveSubscription cameraManager in cameraManager startCapture receiveOutput Executes when the publisher receives a value from the upstream publisher In the pattern we put together in my previous article Managing View State Combine we could use this to keep track of Inputs as users interact with our views inputSubject handleEvents receiveOutput eventTracker input in switch input case addTodo eventTracker track todoAdded case todoRemoved eventTracker track todoRemoved receiveCancel Executes when the downstream receiver cancels publishing A good use case for this would be disposing of no longer needed processes that live outside of a publisher s lifecycle videoCallProvider acceptCall handleEvents receiveCancel cameraManager in cameraManager endCapture receiveRequest Executes when the publisher receives a request for more elements Had a hard time thinking of a good use case for this one but could come in handy during situations where we would like know the amount of outputs being requested by a subscriber Note closures passed to these parameters are escaped and as a result subject to the dangers of strong reference cycles or wrong thread executions Make sure to avoid strong references by using capture lists and insuring the closure is performed on the appropriate thread via the receive on operator A tip when handling events You might have noticed when typing handleEvents Xcode will autofill all possible parameters of the method This can be annoying to deal with especially if we find ourselves handling specific events frequently Lets try and fix that with some convenient extensions extension Publisher func handleOutput receiveOutput escaping Self Output gt Void gt Publishers HandleEvents lt Self gt handleEvents receiveOutput receiveOutput func handleError receiveError escaping Self Failure gt Void gt Publishers HandleEvents lt Self gt handleEvents receiveCompletion completion in switch completion case failure let error receiveError error case finished With the extensions above not only will interacting with the operator become more enjoyable but the end result ends ups looking more readable todoRepository addTodo title title handleOutput eventTracker in eventTracker track todoAdded handleError logger error in logger error error debugPrint an error occurred error ConclusionIn situations where we would need to execute some code along side other asynchronous code the Combine framework can serve as a good candidate given its elegant approach to performing side effects If you liked this article follow me on Twitter for more updates and content about Swift development architectural patterns and clean code |
2021-04-20 14:07:52 |
海外TECH |
DEV Community |
Excited to publish a major release of tgcf |
https://dev.to/aahnik/excited-to-publish-a-major-release-of-tgcf-55h4
|
Excited to publish a major release of tgcfrefactor code for better maintainabilitythe features of paid private repo telegram live sync is now free and merged into tgcfimplement plugin architecture to allow easy addition of featuresa shiny new READMELink to GitHub Link to PyPI Please help this repo reach stars |
2021-04-20 14:04:26 |
海外TECH |
DEV Community |
Learn JavaScript's for...of and for...in - in 2 minutes |
https://dev.to/jordienr/learn-javascript-s-for-of-and-for-in-in-2-minutes-1kk9
|
Learn JavaScript x s for of and for in in minutes The for in loopWe use for in when we want to use the keys of an Object const myObject keyOne valueOne keyTwo valueTwo keyThree valueThree for const propertyKey in myObject console log propertyKey Will result in gt keyOne gt keyTwo gt keyThree As we can see in the example propertyKey will be the key of the object You should knowfor in will ignore any Symbols in your ObjectIf we want to access the value we can still do it like thisfor const propertyKey in myObject console log myObject propertyKey But instead of doing this we could use a for of loop The for of loopThe for of loop will iterate over the values of the Iterable Object Here s an example with an Arrayconst myIterableObject valueOne valueTwo valueThree for const myValue of myIterableObject console log myValue Will result in gt valueOne gt valueTwo gt valueThree This is a good alternative to the forEach methodThis was a quick introduction to these two syntaxes of the for loop in Javascript I recommend you play around with them These two are really useful to know when you want to write short for loops Follow me on twitter for more |
2021-04-20 14:01:55 |
Apple |
AppleInsider - Frontpage News |
Future Apple devices will share and edit 3D AR images |
https://appleinsider.com/articles/21/04/20/future-apple-devices-will-share-and-edit-3d-ar-images?utm_medium=rss
|
Future Apple devices will share and edit D AR imagesRather than passively display virtual Apple AR objects Apple Glass may allow users to share D data and manipulate it in editing apps Editing shared D AR objectsApple s myriad patents and patent applications for Apple AR already include ones for displaying D data from other devices Two new patents however show that Apple wants users to be able to selectively share or retrieve objects and also edit them Read more |
2021-04-20 14:23:42 |
Apple |
AppleInsider - Frontpage News |
Samsung copies Apple in adding anti-stalking feature to SmartThings |
https://appleinsider.com/articles/21/04/20/samsung-copies-apple-in-adding-anti-stalking-feature-to-smartthings?utm_medium=rss
|
Samsung copies Apple in adding anti stalking feature to SmartThingsSamsung has updated its SmartThings Find service to include an anti stalking feature one that Apple is believed to be incorporating in the long rumored AirTags Updated on Tuesday the SmartThings changes add a number of elements to Samsung s connected device platform with the main focus being on Find its location based tool for relocating devices Similar in concept to Apple s Find My SmartThings Find can be used to locate registered Galaxy smartphones tablets smartwatches and earbuds as well as things using the Galaxy SmartTag In the list of updates Samsung includes something called the Unknown Tag Search feature which is intended to detect nearby Galaxy SmartTags and other related devices that are moving with the user but aren t registered to them Such trackers could be an attempt by someone else to secretly keep tabs on the person s movements without their knowledge Read more |
2021-04-20 14:08:13 |
Apple |
AppleInsider - Frontpage News |
Eve releases first Thread-enabled HomeKit light switch in EU |
https://appleinsider.com/articles/21/04/20/eve-releases-first-thread-enabled-homekit-light-switch-in-eu?utm_medium=rss
|
Eve releases first Thread enabled HomeKit light switch in EUEve is continuing its rollout of Thread amongst its devices with the launch of an updated version of its European HomeKit wall switch Eve light switch now supports ThreadThe new switch looks the same as the prior generation but is updated with new radios to allow Thread communication as well as Bluetooth Previously the Eve HomeKit light switch relied purely on Bluetooth Aside from Thread the switch also includes NFC setup support for HomeKit allowing users to tap the switch with their iPhone or newer for quick and easy pairing Read more |
2021-04-20 14:44:54 |
海外TECH |
Engadget |
Microsoft is reportedly building a new Windows 10 store |
https://www.engadget.com/microsoft-store-windows-10-changes-developers-144123325.html
|
features |
2021-04-20 14:41:23 |
海外TECH |
CodeProject Latest Articles |
Compact and Repair Access Database using C# and late binding |
https://www.codeproject.com/Articles/7775/Compact-and-Repair-Access-Database-using-C-and-lat
|
Compact and Repair Access Database using C and late bindingThe code compacts and repairs an MS Access database from C code using a JRO JetEngine COM object Binding occurs at runtime no references no interops Pure System Reflection |
2021-04-20 14:51:00 |
海外TECH |
CodeProject Latest Articles |
AI Language Translation With Multiple Languages |
https://www.codeproject.com/Articles/5299750/AI-Language-Translation-With-Multiple-Languages
|
additional |
2021-04-20 14:44:00 |
海外科学 |
NYT > Science |
Watch Video of NASA Mars Helicopter Ingenuity's First Flight |
https://www.nytimes.com/2021/04/19/science/nasa-mars-helicopter.html
|
Watch Video of NASA Mars Helicopter Ingenuity x s First FlightThe brief test of the experimental vehicle called Ingenuity shows how explorers can study the red planet from the sky as well as the ground |
2021-04-20 14:35:45 |
金融 |
金融庁ホームページ |
非常勤職員(専門調査員)を募集しています。 |
https://www.fsa.go.jp/common/recruit/r2/souri-24/souri-24.html
|
専門調査員 |
2021-04-20 15:23:00 |
金融 |
金融庁ホームページ |
衆議院財務金融委員会における麻生金融担当大臣の「破綻金融機関の処理のために講じた措置の内容等に関する報告」概要説明について公表しました。 |
https://www.fsa.go.jp/common/diet/houkoku/030420/20210420.html
|
財務金融委員会 |
2021-04-20 15:00:00 |
金融 |
金融庁ホームページ |
ギャンブル等依存症問題啓発週間について公表しました。 |
https://www.fsa.go.jp/policy/kashikin/gambling/20210514.html
|
週間 |
2021-04-20 15:00:00 |
海外ニュース |
Japan Times latest articles |
Japan demands release of journalist held in Myanmar |
https://www.japantimes.co.jp/news/2021/04/20/national/myanmar-japan-journalist/
|
yangon |
2021-04-21 00:35:38 |
海外ニュース |
Japan Times latest articles |
Hard-working Yuta Watanabe draws praise from Toronto media |
https://www.japantimes.co.jp/sports/2021/04/20/basketball/nba/watanabe-raptors-contract-media-reactions/
|
draws |
2021-04-21 00:54:43 |
ニュース |
BBC News - Home |
European Super League: 'No action off the table' over breakaway group - No 10 |
https://www.bbc.co.uk/news/uk-politics-56810962
|
government |
2021-04-20 14:47:35 |
ニュース |
BBC News - Home |
No new smart motorways without additional safety measures |
https://www.bbc.co.uk/news/business-56815522
|
radar |
2021-04-20 14:52:54 |
ニュース |
BBC News - Home |
Chad's President Idriss Déby dies after 'clashes with rebels' |
https://www.bbc.co.uk/news/world-africa-56815708
|
election |
2021-04-20 14:01:49 |
ニュース |
BBC News - Home |
Dungiven: Fireball bomb bid to kill policewoman and daughter |
https://www.bbc.co.uk/news/uk-northern-ireland-56814575
|
dungiven |
2021-04-20 14:39:05 |
ニュース |
BBC News - Home |
Covid-19: India red list add 'may be too late', Prof Mark Walport says |
https://www.bbc.co.uk/news/uk-56813025
|
walport |
2021-04-20 14:22:35 |
ニュース |
BBC News - Home |
Deer graze on east London housing estate |
https://www.bbc.co.uk/news/uk-england-london-56819018
|
residents |
2021-04-20 14:02:33 |
ニュース |
BBC News - Home |
Fifa says ESL clubs 'must live with consequences of their choices' while UK government will take 'necessary' action |
https://www.bbc.co.uk/sport/football/56813819
|
Fifa says ESL clubs x must live with consequences of their choices x while UK government will take x necessary x actionGianni Infantino strongly disapproves of the European Super League and says the clubs will have to live with the consequences of their actions |
2021-04-20 14:11:02 |
ニュース |
BBC News - Home |
Super League created to save football, says Real president Perez |
https://www.bbc.co.uk/sport/football/56812151
|
florentino |
2021-04-20 14:25:08 |
ニュース |
BBC News - Home |
RFU backs Jones as England coach after review |
https://www.bbc.co.uk/sport/rugby-union/56819737
|
finish |
2021-04-20 14:25:11 |
ニュース |
BBC News - Home |
'It's in my heart, my blood' - Mason named Tottenham boss until end of season |
https://www.bbc.co.uk/sport/football/56813398
|
x It x s in my heart my blood x Mason named Tottenham boss until end of seasonRyan Mason says he feels immense pride after being named head coach at Tottenham until the end of the season following Jose Mourinho s sacking |
2021-04-20 14:31:58 |
ニュース |
BBC News - Home |
European Super League: 'It's not sport if success is guaranteed' says Man City boss Pep Guardiola |
https://www.bbc.co.uk/sport/av/football/56819670
|
European Super League x It x s not sport if success is guaranteed x says Man City boss Pep GuardiolaManchester City boss Pep Guardiola says it is not a sport if success is guaranteed or if it doesn t matter when you lose when asked about proposals for a breakaway European Super League |
2021-04-20 14:23:02 |
北海道 |
北海道新聞 |
東京、緊急事態宣言要請へ 小池氏「できるだけ早く」 |
https://www.hokkaido-np.co.jp/article/535436/
|
新型コロナウイルス |
2021-04-20 23:04:31 |
北海道 |
北海道新聞 |
日米、楽天を共同監視 中国大手が出資、情報流出を警戒 |
https://www.hokkaido-np.co.jp/article/535421/
|
安全保障 |
2021-04-20 23:09:57 |
仮想通貨 |
BITPRESS(ビットプレス) |
日本銀行、「中央銀行デジタル通貨に関する連絡協議会」第1回会合の議事要旨 |
https://bitpress.jp/count2/3_9_12448
|
中央銀行 |
2021-04-20 23:31:33 |
コメント
コメントを投稿