投稿時間:2021-04-22 00:44:50 RSSフィード2021-04-22 00:00 分まとめ(49件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
IT 気になる、記になる… 「iMac 24インチ」は同モデル限定のスクリーンセーバー「Hello」を搭載 − 他のMacで利用する方法も https://taisy0.com/2021/04/21/139344.html macosrc 2021-04-21 14:16:27
AWS AWS Architecture Blog Field Notes: Designing Multi-Region AWS Managed Microsoft Active Directory for Hybrid Environments https://aws.amazon.com/blogs/architecture/field-notes-designing-multi-region-aws-managed-microsoft-active-directory-for-hybrid-environments/ Field Notes Designing Multi Region AWS Managed Microsoft Active Directory for Hybrid EnvironmentsPreviously customers with large and complex Microsoft Active Directory deployments across geographies faced challenges when migrating their on premises Active Directory to AWS Integrating with AWS Managed Microsoft Active Directory also proved difficult The AWS Managed Microsoft Active Directory Multi Region feature that was released last year simplifies global deployment for these customers and mitigates their migration … 2021-04-21 14:15:50
python Pythonタグが付けられた新着投稿 - Qiita GANについての整理① https://qiita.com/STAR77/items/c7ad02b918356c5c1f63 GANによる画像生成の仕組みを簡単述べると、識別器を騙せるほど本物そっくりに生成器が画像を生成するです例えばゴッホがかいたようなリアルな絵画を生成するとします。 2021-04-21 23:15:01
python Pythonタグが付けられた新着投稿 - Qiita Pythonで座りっぱなしと水分補給不足を解消する https://qiita.com/Lulu_die_Zweite/items/2ee086dd6d2d7349f2bc また同様に水分補給を促すメッセージも画面右下に表示します。 2021-04-21 23:01:17
python Pythonタグが付けられた新着投稿 - Qiita Python 少ない点に対する近似曲線 スプライン曲線との比較 https://qiita.com/quryu/items/6800de613581e682b0d4 最後に少ない点に対する近似曲線で紹介した近似曲線を分割する方法で比較してみます。 2021-04-21 23:00:57
js JavaScriptタグが付けられた新着投稿 - Qiita 【Rails / Google Map API】APIを用いて位置情報を取得する https://qiita.com/iwasan06/items/075f3dd21a0d3769e0d8 今回使用するAPIは、・MapsJavaScriptAPI・GeolocationAPIのつです。 2021-04-21 23:17:25
js JavaScriptタグが付けられた新着投稿 - Qiita 【初学者向け】JSONの内容をJavaScriptでHTMLに反映させる https://qiita.com/RinuxJapan69/items/06338608adcb4c265b49 実現したいことJSONの内容が更新されたら、それをHTMLに自動的に反映されるようにしたい生成・出力されたHTMLにあるボタンをクリックすると、モーダルで詳細が表示される場合とアンカーリンクで別ページに遷移させるパターンがある今回の場合は、テキストや画像パスをJSONに記述し、そこからHTMLとして出力します。 2021-04-21 23:17:13
js JavaScriptタグが付けられた新着投稿 - Qiita QR忘れ物アプリ (3) メニュー [Vue,Vuetify,Firebase] https://qiita.com/rayan/items/3645506cdb10512fd87c この変化を親コンポーネントであるHeaderのshowに適用するために以下の処理を行う。 2021-04-21 23:08:57
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) Apache2.4(event MPM)とPHP7.4(php-fpm)の連携方法について https://teratail.com/questions/334508?rss=all ApacheeventMPMとPHPphpfpmの連携方法についてApachenbspeventnbspMPMnbspとPHPをphpfpmで連携させることを考えています。 2021-04-21 23:55:08
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) コマンドではつながるのにJDBCを利用したらDB接続ができない https://teratail.com/questions/334507?rss=all コマンドではつながるのにJDBCを利用したらDB接続ができない前提・実現したいこと環境ECAmazonnbspLinuxnbspRDSnbspMySQLJavaでJDBCを利用してMySQLに接続しようとしています。 2021-04-21 23:49:56
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) Railsの環境構築をしたいです。 https://teratail.com/questions/334506?rss=all Railsの環境構築をしたいです。 2021-04-21 23:43:07
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) Pythonでmediapipeのパッケージがimportできません。 https://teratail.com/questions/334505?rss=all Python で mediapipe の パッケージ が import でき ませ ん 。 2021-04-21 23:27:00
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) make_scorer()でRidgeのscoringを用意する方法 https://teratail.com/questions/334504?rss=all 2021-04-21 23:26:58
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) CSRF対策がうまくいかない https://teratail.com/questions/334503?rss=all CSRF対策がうまくいかない前提・実現したいことCSRF対策がうまくいきません。 2021-04-21 23:24:37
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) Vueで一定時間ごとにAPIを呼びたいのですが。。。 https://teratail.com/questions/334502?rss=all Vueで一定時間ごとにAPIを呼びたいのですが。 2021-04-21 23:17:16
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) rubyのプログラムでエラーがでる https://teratail.com/questions/334501?rss=all rubyのプログラムでエラーがでる前提・実現したいことここに質問の内容を詳しく書いてください。 2021-04-21 23:12:55
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) Laravel Nuxt.js セレクトボックスの作成 https://teratail.com/questions/334500?rss=all LaravelNuxtjsセレクトボックスの作成laravelnbspNuxtjsを使って、セレクトボックスを作成しています。 2021-04-21 23:09:08
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) 【AndroidStudio】ボタンのbackgroundTintを無効化したい https://teratail.com/questions/334499?rss=all なのでbackgroundTintを無効化したいのですが、調べても方法がわかりません。 2021-04-21 23:05:47
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) プログラムの処理速度 https://teratail.com/questions/334498?rss=all 2021-04-21 23:01:58
Ruby Rubyタグが付けられた新着投稿 - Qiita RSpecとFactoryBotのインストール【rails】 https://qiita.com/kimorisan/items/ba8382d587900d6e84c1 RSpecとFactoryBotのインストール【rails】はじめにrailsアプリにrspecとFactoryBotをはじめてインストールしたので参考になれば導入の手順Gemfileに記述bundleinstallRSpecのインストールその他設定Gemfileに記述Gemfilegroupdevelopmenttestdogemrspecrailsgemfactorybotrailsendテスト環境だけでなく、開発環境でもrailsconsole等で動作確認が行えるため、開発環境にも導入します。 2021-04-21 23:40:50
AWS AWSタグが付けられた新着投稿 - Qiita CloudSearchを使ってみた https://qiita.com/kazu_kazu/items/2d2fda3409e166d105a9 ブラウザからも検索できていたのは、AccessPolicyで自分のグローバルIPを許可していたからだということがはっきりと分かりました。 2021-04-21 23:48:53
Docker dockerタグが付けられた新着投稿 - Qiita 研究室でDockerを使うメリット https://qiita.com/amachi0/items/12cd8d976782d8834ef8 今まさに色々調べている段階なのですが、どういう構成で環境を構築することになったのか、また研究室でDockerを使用するとどのようないいことがあるのか、ということをお話ししていこうと思います。 2021-04-21 23:03:00
GCP gcpタグが付けられた新着投稿 - Qiita Google Kubernetes Engine(GKE)+ HTTPロードバランサでwebアプリケーションを公開する https://qiita.com/alpha083/items/0e2a847691695357a91f gcloudcomputetargetpoolscreatepoolnameマネージドインスタンスグループの作成マネージドインスタンスグループによって、先ほど作成したインスタンステンプレートに設定された通りのインスタンスを指定したsizeだけ立ち上げる。 2021-04-21 23:10:12
Azure Azureタグが付けられた新着投稿 - Qiita Microsoft Learnで学ぶ「Java on Azure」 https://qiita.com/kikutaro/items/4b327eb58f128c548f6d javajartargetjarAzureでの実行続いてサンプルアプリをAzureにデプロイします。 2021-04-21 23:57:56
Ruby Railsタグが付けられた新着投稿 - Qiita RSpecとFactoryBotのインストール【rails】 https://qiita.com/kimorisan/items/ba8382d587900d6e84c1 RSpecとFactoryBotのインストール【rails】はじめにrailsアプリにrspecとFactoryBotをはじめてインストールしたので参考になれば導入の手順Gemfileに記述bundleinstallRSpecのインストールその他設定Gemfileに記述Gemfilegroupdevelopmenttestdogemrspecrailsgemfactorybotrailsendテスト環境だけでなく、開発環境でもrailsconsole等で動作確認が行えるため、開発環境にも導入します。 2021-04-21 23:40:50
Ruby Railsタグが付けられた新着投稿 - Qiita 【Rails / Google Map API】APIを用いて位置情報を取得する https://qiita.com/iwasan06/items/075f3dd21a0d3769e0d8 今回使用するAPIは、・MapsJavaScriptAPI・GeolocationAPIのつです。 2021-04-21 23:17:25
Ruby Railsタグが付けられた新着投稿 - Qiita 出品詳細削除機能実装 https://qiita.com/takuo_maeda/items/03c1bcb09ec880bc5687 delete 2021-04-21 23:06:42
海外TECH DEV Community Why We Moved From Lambda to ECS https://dev.to/prismatic/why-we-moved-from-lambda-to-ecs-4m96 Why We Moved From Lambda to ECSAfter many months of development my team just announced the general availability of our platform That milestone seems like a perfect opportunity to look back and reflect on how the infrastructure that supports Prismatic has evolved over time Spoiler We ended up moving our most important microservice from Lambda to ECS In this post I ll dive into what went well in Lambda what challenges we faced and why we eventually made the decision to migrate some services from Lambda to AWS Elastic Container Service ECS What Problem are We Solving For some quick context our product is an integration platform for BB software companies That is we help software companies build integrations and deploy those integrations to their customers A simple integration might look something like this Step Pull down an XML document from Dropbox Step Process the XML with some custom JavaScript code Step Use some stored credentials to post the processed data to a third party API Our users can configure integrations to run on a schedule or they can trigger them via a webhook and our platform takes care of running logging and monitoring the integrations and a whole bunch of other things The Early DaysThe first incarnation of Prismatic used LocalStack We knew that we wanted to eventually host Prismatic in AWS with the possibility of moving to Azure GCP etc as needed so the ability to spin up our platform locally to simulate AWS was appealing The LocalStack service that approximates AWS Lambda was easy to iterate on and ran without any major hiccups It gave us a great development feedback loop so we could prototype and test very quickly We used Lambda to execute each step of an integration and steps leveraged SQS to pass data and trigger the next step So an integration execution would look like this Run a Dropbox fetch a file action to grab an XML file Save the contents of that XML file to SQS trigger the next step Run a customer s custom JavaScript code to process the XML Save the resulting transformed data to SQS trigger the next step Run an action to post the processed data to a third party API Save the results of the final step trigger the end of the integration Within LocalStack this was a very quick process We could define a step integration run it and see results within a couple of seconds Our Migration to Real AWS LambdaOnce we had a proof of concept working we devoted some time to moving Prismatic to an actual production environment with real Lambdas queues databases etc We were still a small team and we didn t want to dedicate a ton of time to DevOps y infrastructure problems yet We wanted to dedicate most of our time to our core product and Lambda let us do just that Lambda was attractive to us for a number of reasons We didn t need to worry about CPU or memory allocation server monitoring or autoscaling that s all built in We were able to throw zip files full of JavaScript code at Lambda and AWS took care of the rest Lambda let us compartmentalize our code into a series of microservices a service for logging a service for OAuth key renewals a service for SMS email alerting if integrations error out etc so we could keep a good mental map of what code is responsible for doing what task Costs were pretty reasonable too you just pay for compute time so rather than running servers we just paid when our prototypes were executing something After a few days monkeying with Terraform we had our second incarnation of Prismatic in AWS Our integration runners ran on real Lambda and were triggered via SQS This is the point at which we started running into performance issues with our integration runners Why Lambda Didn t Work for UsWe had a number of issues ranging from speed to SQS size limits and lack of process isolation in Lambda that caused us to reconsider its effectiveness as our integration runner Let s talk about each of those issues Speed Remember the step integration that I said took a couple of seconds to run within LocalStack It took a full minute using real Lambda and AWS The actual Lambda invocations were quick usually a few milliseconds The writing of step results to SQS and subsequent execution of the next step though ended up taking multiple seconds every step For more complex integrations like ones that looped over files that was a show stopper who wants their integrations to take minutes hours to complete We tried a number of things to get our Lambda invocations to go faster We followed guides to keep a number of Lambda instances warm and we cranked up the number of vCPUs powering our Lambdas to the highest we could at the time vCPUs GB RAM but those things only shaved single digit percentages off of our integration run times SQS Size Limits SQS limits message size to kilobytes The amount of data being passed between steps of an integration often exceeded that size after all it s totally reasonable for an integration developer to pull down a multiple megabyte JSON file to process We were able to work around this size limitation the recommended solution that we followed was to write out payloads to S and pass references to S objects via SQS but this extra API call to S only compounded our slowness issues Process Isolation This was the issue that surprised me the most At first AWS Lambda seems appealing as a stateless compute engine run a job exit run another job etc scale horizontally as needed We naively assumed that Lambda invocations were isolated from one another but that turned out to only be half true Concurrent invocations are isolated they run in distinct containers within Lambda However subsequent invocations reuse previous warm environments so an integration runner might inherit a dirty environment from a previous integration run That s especially a problem if you let customers write their own code like we do for our customers integrations It turns out that if one customer writes some bad code into their integration something like this global XMLHttpRequest null then subsequent integration runs on that same Lambda that depend on the XMLHttpRequest library error out This is a big deal since one customer could break something like axios for another customer A customer could even be malicious and execute something like global console log msg gt nefariousCode and other integrations that execute on that same Lambda will run nefariousCode whenever they invoke console log Yikes We tried a few things to get around this issue of shared execution space We toyed with forcing our Lambdas to cold start every time which was a terrible idea for obvious reasons and we tried spinning up distinct Node processes within chroot jails Neither option panned out spinning up child Node processes in a Lambda took seconds and partially defeated the purpose of being in Lambda in the first place Our Move to ECSLambda had served us well with development we were able to iterate quickly and get a prototype out the door but with the myriad issues we faced in Lambda we decided to bite the bullet and dedicate some dev time to cloud infrastructure Our team got to work expanding our existing Terraform scripts and moved our integration runner to AWS Elastic Container Service ECS Within an ECS container we could easily and quickly chroot and isolate Node processes from one another solving the process isolation issues we were seeing in Lambda To get around the SQS size limit issues we faced we swapped in a Redis backed queuing service We had to reinvent some wheels that Lambda had given us for free like logging autoscaling and health checks but in the end we had our step test integration back to running in under seconds Now ECS hasn t been perfect there are are some trade offs For one ECS doesn t seem to autoscale as quickly as Lambda A scale up seems to take about a minute or so between API call and AWS Fargate pulling down and initializing a container that s ready to accept jobs We had to pull one of our devs off of product development to work on cloud infrastructure and there s a ton more to juggle with regards to CPU and memory usage autoscaling rules and monitoring but at this point in product development the pains are worth the gains to give our customers a speedy integration runner What Remained in LambdaWe didn t move all of our microservices out of Lambda plenty still remain in the serverless ecosystem and will for the foreseeable future Our integration runner didn t fit Lambda well but there are other tasks for which Lambda seems like the clear choice We kept all important integration services that aren t critical to the actual execution of the integration in Lambda Those include A logger service that pulls logs from ECS and sends them to DataDog A service that writes metadata about integration executions to a PostgreSQL database A service that tracks and queues scheduled integrations An alerting service that sends SMS or email notifications to users if their integrations error An authorization service that renews customers OAuth keys for third party services We didn t want any of these services to block execution of an integration and for all of them it s fine if they take an additional second or two to run so services like those fit Lambda perfectly ConclusionOur infrastructure definitely changed over time but I think the decisions we made along the way were the right ones LocalStack s Lambda service let us develop and iterate very quickly and our first deployment into AWS was simple enough that our small dev team could Terraform our infrastructure without losing a ton of dev hours to it Lambda seemed like an attractive solution for hosting and scaling our microservices and for many of them especially asynchronous services that might take a second or two to run it still remains the correct choice For our integration runner though we learned that the size speed and process isolation limitations of Lambda made ECS a better option and it was worth the dev time it took to create an ECS deployment for that particular service Lambda let us concentrate on product development early on and when the time was right the transition to ECS was a fairly smooth one Even with the issues we faced in Lambda I m glad we took the path we did 2021-04-21 14:46:26
海外TECH DEV Community Create powerful and flexible forms with React Hook Form. 🪝 https://dev.to/vaibhavkhulbe/create-powerful-and-flexible-forms-with-react-hook-form-1cd1 Create powerful and flexible forms with React Hook Form 🪝Someone inputting his details and hitting that Submit button is one of the most widely used and reliable forms of getting the data from a user on any website We call such web entities forms and forms on a webpage are nothing but a collection of elements that allows a user to enter data that is then sent over to the server for further processing While the traditional approach to build code and gather information from a form in a webpage can simply be done with the power of HTML code but when the website gets complex or scales up in size say when you are on an e commerce website we need to leverage some of the external libraries that were meant to get things done easily and are able to integrate with other tech stacks quickly One such open source library to handle all things related to forms is React Form Hook and in this article we will get to know how to use this with a suitable example About the libraryReact Form Hook is a React library that is used to make performant flexible and extensible forms with easy to use validation support Sure there have been other libraries like Formik React Final Form etc that falls under similar lines but here s why it goes above all those Small in size it s a tiny library with no other dependencies to install Performance the best part is that it minimizes the re renders required and also mounts up fairly quickly thereby increasing the overall experience Uses existing HTML you can leverage the powers of HTML to work with this library Less code and more features almost every form handling scenario is covered all in fairly fewer lines of code Now that we have some information here s what the rest of the blog will tell you about InstallationAPI references with examplesA quick but powerful demoConclusion InstallationTime to make our forms powerful with the use of React Hook Forms Fire up your terminal and then execute the following commands which makes a new React project npx create react app react form hook demo cd react form hook demonpm startYour default React project should be running in your browser by now Next we need to add the library Use the following command to install npm install react hook form API ReferencesBefore we move ahead typing code carelessly we need to know how this library works or more precisely what are the different APIs it has and how they function Here are some common ones ️⃣The useForm API this is one of those functions which you will be calling first before you apply any handling logic to your existing forms It takes some optional arguments like mode defaultValues shouldFocusError etc const register useForm mode onSubmit reValidateMode onChange defaultValues resolver undefined context undefined criteriaMode firstError shouldFocusError true shouldUnregister true As for its methods take a look at how these are used register allows you to register an input select ref and apply validation rules into React Hook Form based on both HTML default and custom validations lt input name test ref register gt lt input name test ref register required true gt unregister allows you to unregister a single input or an array of inputs const unregister useForm lt button type button onClick gt unregister lastName gt unregister lt button gt errors it s an object which contains form errors and error messages corresponding to each field Note that this will get deprecated in the next major version i e v formState is likely to be the alternative const errors useForm lt input name singleErrorInput ref register required true gt errors singleErrorInput amp amp Your input is required handleSubmit it s a function that will pass the form data when form validation is successful and can be invoked remotely as well const register handleSubmit useForm const onSubmit data e gt console log data e const onError errors e gt console log errors e lt form onSubmit handleSubmit onSubmit onError gt lt input name firstName ref register gt lt input name lastName ref register gt lt button type submit gt Submit lt button gt lt form gt setError allows you to manually set one or more errors const setError errors useForm lt input name username type text onChange gt setError username type manual message Dont Forget Your Username Should Be Cool ref register gt errors username amp amp lt p gt errors username message lt p gt ️⃣The Controller API it s a wrapper component that makes it easier to work with external components from other libraries and frameworks like React Select Material UI etc lt Controller control control name test render onChange onBlur value name ref invalid isTouched isDirty gt lt Checkbox onBlur onBlur onChange e gt onChange e target checked checked value inputRef ref gt gt ️⃣The useWatch API if you want to reduce the re rendering at the component level of your form then this API watches for any changes to result in better performance function IsolateReRender control const firstName useWatch control name firstName defaultValue default return lt div gt firstName lt div gt function App const register control handleSubmit useForm return lt form onSubmit handleSubmit data gt console log data data gt lt input ref register name firstName gt lt input ref register name last gt lt IsolateReRender control control gt lt input type submit gt lt form gt A Quick but powerful DemoOkay now we know most of the APIs and functions to use from this library Let s put that into work by creating something fruitful How about we make the following form Here is what s happening in the form interface We have six basic elements in the form text fields select field and lastly a button We will be adding some important form validations in each of these elements except the select field Here are all the rules to be implemented The First Name it should not be empty and should have a minimum length of characters The Last Name it is required and has a maximum of characters The Email like others this cannot be left blank Username this also should not be blank but also we have a custom validation where only the string “John will be accepted The error will pop out asynchronously after seconds Finally when you click on the Submit button an alert is shown along with the entered details If any validation check goes wrong the error will be shown instantly and the data won t submit Okay enough of the information let s quickly begin coding all of this Code the interfaceOpen the index js file and inside the return statement start by using a lt form gt element Make sure you don t add any action or method attributes Everything will be handled by the library Our first label will be of the “First Name field Make sure you add a suitable placeholder value to its lt input gt element Here we added “John The same goes for the “Last Name field Then we have the “Email field Here we can specify that the type of the form element is “email so that it knows beforehand that a proper email syntax should be added Why not use some good old powers of HTML The “Username field is the same as the name fields So it s important to add a placeholder value here too Up next the select field is to be added with the name attribute along with multiple options you want to provide in the drop down Here we need to make sure that each of the elements must have a proper “value attribute attached to it It will be used later when we use the library After you have coded all the form interface you will have a code similar to this lt form gt lt h gt Sign Up lt h gt lt label gt First Name lt label gt lt input name name placeholder John gt lt label gt Last Name lt label gt lt input name name placeholder Doe gt lt label gt Email lt label gt lt input name email type email placeholder john doe com gt lt label gt Username lt label gt lt input name username placeholder Only John is accepted gt lt label gt How you got to know about us lt label gt lt select name info gt lt option value gt Select source lt option gt lt option value Twitter gt Twitter lt option gt lt option value Facebook gt Facebook lt option gt lt option value Other gt Other lt option gt lt select gt lt input type submit gt lt form gt Power up the form with validationWith the single useForm hook we will be doing almost all of the operations to make it functional Start by importing the hook from the library import useForm from react hook form Now it s time to register all the inputs we have used in the HTML code above For that we will be calling the imported useForm hook as const register handleSubmit errors useForm We have to handle the functioning of the data submission For that we will be using the onSubmit attribute of the lt form gt element We call the handleSubmit function passing on a new onSubmit method to it We haven t added any code to this new method so let s do that first Make this new method after you register the inputs We will pass on the data obtained from the form We use JavaScript s alert method inside which we use string interpolation so that we have a dynamic text string shown in the alert box We can also log down the data into the console just to make sure our object prints out as we are expecting const onSubmit data gt console log data alert Here are your details nName data name nEmail data email nUsername data username nSource data info With the power of refs in React we access a particular DOM node in the render method Hence for all the inputs and the select element of the form we add the ref attribute which calls the register function of the useHook API Now here comes all the goodies Everything we need to validate we can pass inside this register function This makes the form very flexible to change and each element can have similar or dissimilar validations as you like For the “First Name and the “Last Name fields we pass on the boolean true value to the required property along with a minLength of and max length of characters To apply the error messages to a specific field say name simply use the errors prop along with the property name like errors name or errors name type Then we can add any HTML element inside this check like a simple paragraph that says “First Name is required errors name amp amp errors name type required amp amp lt p gt First name is required lt p gt As for the message for the minimum length check we check the errors name type minLength and pass on the custom message errors name amp amp errors name type minLength amp amp lt p gt This requires min length of lt p gt But what about the Username field where we only want specific data to be valid For this to work as expected we need to use the validate property of the register function The value of this property can be a separate function where the actual logic of the validation can be stored We are using the sleep method so that the error is shown after seconds to the user and this will only fire if the value of the string is not equal to “John const validateUserName async value gt await sleep if value John return true return false Make sure you predefine the async event code for this to function const sleep ms gt new Promise resolve gt setTimeout resolve ms Sweet The form should now be backed by powerful validations and is equally flexible with its elements Test out your new form and you will see an alert box with all the inputs Here s the entire code along with accessibility attributes we wrote for making this form function App const register handleSubmit errors useForm const sleep ms gt new Promise resolve gt setTimeout resolve ms const onSubmit data gt console log data alert Here are your details nName data name nEmail data email nUsername data username nSource data info const validateUserName async value gt await sleep if value John return true return false return lt form className App onSubmit handleSubmit onSubmit gt lt h aria level gt Sign Up lt h gt lt label htmlFor First name gt First Name lt label gt lt input name name aria invalid errors name true false placeholder John ref register required true minLength gt errors name amp amp errors name type required amp amp lt p role alert gt First name is required lt p gt errors name amp amp errors name type minLength amp amp lt p role alert gt This requires min length of lt p gt lt label htmlFor Last name gt Last Name lt label gt lt input name name placeholder Doe aria invalid errors name true false ref register required true minLength max gt errors name amp amp errors name type minLength amp amp lt p role alert gt This requires a min length of lt p gt lt label gt Email lt label gt lt input name email type email aria invalid errors email true false placeholder john doe com ref register required true gt lt label gt Username lt label gt lt input name username aria invalid errors username true false placeholder Only John is accepted ref register required true validate validateUserName gt lt label gt How you got to know about us lt label gt lt select name info aria invalid errors info true false ref register required true gt lt option value gt Select source lt option gt lt option value Twitter gt Twitter lt option gt lt option value Facebook gt Facebook lt option gt lt option value Other gt Other lt option gt lt select gt lt input type submit gt lt form gt ConclusionThis is just the tip of an iceberg when you start making forms with React Hook Form With its easy to go syntax and great features you can also use it with TypeScript create wizard like multiple forms and even use their online form builder where you simply add the elements you want along with rules and bam You get your generated code in one click Hope you liked the information You can comment below with your thoughts about it And now as always enjoy a meme The DevHumour Corner Some of my previous articlesCreate smoking Hot toast notifications in React with React Hot Toast really cool web technologies to know quick and easy fixes to improve your React app performance Find me onTwitter Instagram LinkedIn ‍Everywhere else Subscribe to my weekly developer newsletter 2021-04-21 14:39:53
海外TECH DEV Community Publishing Android libraries to MavenCentral in 2021 https://dev.to/zsmb13/publishing-android-libraries-to-mavencentral-in-2021-44oh Publishing Android libraries to MavenCentral in IntroductionThis is an updated version of an article published two years ago on blog autsoft hu This new version supports non Android libraries uses command line GPG handling instead of a specific Windows GUI app includes new best practices and uses GitHub Actions for its CI integration Last Update April addressed new Sonatype infra moved to using AGP Maven Publish plugin integration for release components and to using the new gradle nexus publish plugin Creating a great library is hard work Coming up with the idea implementing it making sure you have a nice stable public API that you control carefully and maintain…That s already lots to do After all that you need to make your library available to the public Technically you could distribute the aar file any way you want but the norm is publishing it to a publicly available Maven repository It s a good idea to use one of the well established repositories that people are already likely to have in their projects to make getting started with your library as easy as possible The simplest choice would be JitPack which might not give you much in terms of customization or control but is very easy to get started with All you have to do is publish your project on GitHub and JitPack should be able to build and distribute it immediately If you re new to libraries this is a great choice for getting your code out there The next step up is Jcenter…Which no longer accepts new packages and will stop serving them in February Using it had its issues anyway Finally the fanciest place you can be in is The Central Repository via Sonatype OSSRH OSS Repository Hosting which I ll refer to as simply MavenCentral from here on This is the place to be if you re a Maven dependency Artifacts on MavenCentral are well trusted and their integrity can be verified as they are all required to be signed by the author The publication process however and especially automating it can be quite a headache It s easy to get stuck at many of the various steps no matter what tutorials you re following especially if they re out of date and this can get demotivating very quickly It s not uncommon to give up and just use Bintray Jcenter instead which is not an option anymore So if you feel up for a bit of a challenge and want to do things the right way here s how you can get a library into MavenCentral in OverviewHere s a quick overview of the steps we ll go through Registering a Jira account with Sonatype and verifying your ownership of the group ID you want to publish your artifact withGenerating a GPG key pair for signing your artifacts publishing your public key and exporting your private keySetting up Gradle tasks that can sign upload your artifacts to a staging repositoryManually going through the process of checking your artifacts in the staging repo and releasing them via the Sonatype web UIAutomating the close amp release flow with a Gradle pluginConfiguring CI workflows with GitHub Actions to automate all of the aboveA lot of ground to cover let s go PrerequisitesWe ll be using the following tools for this tutorial You are free to use alternatives but these are our favourites and they work well for us The command line gpg toolGPG Suite for macOS or Gpgwin for Windows are great choices which also come with helpful GUIs Many alternatives for different platforms are available here GitHub as the public host of the library s repositoryGitHub Actions as the continuous integration solutionFor this article we ll assume that you already have your library developed and have uploaded it to a public GitHub repository We ll use our very own Android Chat SDK in our examples This SDK is made up of multiple artifacts but for simplification we ll just talk about publishing the low level networking client which lives in the stream chat android client module of the GitHub repository Shameless plug if you need a chat solution in your Android app check out our documentation and our Android Chat tutorial Registering a Sonatype accountFirst things first you ll need an account in the Sonatype Jira Head over there and hit Sign up Registration is straightforward it just requires a username an email and a password After you ve logged in you ll need to open an issue asking for access to the group ID that you ll want to publish your project under For us based on our domain name getstream io our group ID is io getstream If you own a domain it s best to choose the reversed version of that as your group ID Otherwise you ll have to stick with having a GitHub based group ID see Choosing your Coordinates for more details After choosing a language and an avatar you ll end up on this landing page click on Create an issue Select Community Support Open Source Project Repository Hosting and then New Project On the next page fill out the following fields Summary Create repository for your group id hereDescription An optional quick summary of what your project is Group Id Your group ID as described a few sections earlier Project URL If your project has a webpage the URL of that page This can also be just the GitHub repository SCM url Your source control URL i e  the GitHub repository link Username s If you want additional users on top of the one you re using for this process to have deploy access for your group ID you can list them here Already Synced to Central If you re just getting started this should be No Soon after opening it your issue will get a comment telling you to verify that you own the domain corresponding to your group ID Comment requesting domain verification ixlib php To comply with this add the required TXT record to your domain how to do this will depend on where your domain is registered but it should be a fairly simple task TXT OSSRH Make sure to replace the ticket number above with your actual number When done don t forget to leave a comment on the issue so that Sonatype knows to check the record You ll eventually get a response telling you that you now have deploy rights congrats The Sonatype comment confirming domain verification Generating a GPG key pairAs we eluded to earlier artifacts published on MavenCentral have to be signed by their publishers You ll need a GPG key for this MavenCentral also has its own documentation for Working with PGP Signatures which you can reference if you get stuck along the way This part requires access to the gpg command There are several ways to install this via package managers and there are many distributions available for different platforms on gnupg org GPG Suite is an easy to use distribution for macOS and you can use Gpgwin if you re on Windows Both of these come with GUI tools that make managing keys easier We ll stick to the command line here but note that the old article shows how to use the Kleopatra GUI included in Gpgwin on Windows for generating and managing keys To generate a new key run the following command gpg full gen keyYou ll be prompted to enter a few details Kind of key Accept the default value which is RSA and RSA Key size Expiration You can input to generate a key that never expires You can also create a key that has an expiry date and then renew it periodically if you prefer to do so Real name email Should be obvious Comment Freeform text can be left empty After entering these details you ll be prompted to enter a passphrase to secure your key with Here s the full flow you ll go through with a bit of truncation Please select what kind of key you want RSA and RSA default Your selection RSA keys may be between and bits long What keysize do you want Requested keysize is bitsPlease specify how long the key should be valid key does not expire Key is valid for Key does not expire at allIs this correct y N yGnuPG needs to construct a user ID to identify your key Real name Marton BraunEmail address marton getstream ioComment Example key for tutorialYou selected this USER ID Marton Braun Example key for tutorial lt marton getstream io gt Change N ame C omment E mail or O kay Q uit Ogpg key BBEFA marked as ultimately trustedgpg revocation certificate stored as gnupg openpgp revocs d ADCFEDDDBCABBEFA rev public and secret key created and signed pub rsa SC ADCFEDDDBCABBEFAuid Marton Braun Example key for tutorial lt marton getstream io gt sub rsa E You can always check the keys you have on your system by running gpg list keys gpg checking the trustdb gnupg pubring kbx pub rsa SC ADCFEDDDBCABBEFAuid ultimate Marton Braun Example key for tutorial lt marton getstream io gt sub rsa E Your key s ID is the last eight digits of its fingerprint the long hexadecimal string above In this case this is BEFA take note of this as you ll use this later You ve generated a pair of keys a private and a public key You ll keep the private one hidden and use it to sign your artifacts The public key has to be uploaded to the server so that anyone can check that it belongs to you which you can do by running the following use your own key ID gpg keyserver hkp pool sks keyservers net send keys BEFAYour private key will need to be referenced by your project when it signs the artifacts You can export it into a file by running the following gpg export secret keys BEFA gt BEFA gpgEnter your passphrase you ve set earlier when prompted Setting up publication in your projectThat s a lot of work without touching your project but the time has come to do that now In the next few steps you will Add Gradle scripts that set up the publication plugin required to push artifacts to a repository Configure the properties of the library you re releasing Grab the necessary authentication details along with the private key you ve just exported Root project Gradle configurationTo easily automate publishing later you ll use the gradle nexus publish plugin tool This has to be added in your project level root build gradle file as a dependency You can do this either with a plugins block plugins id io github gradle nexus publish plugin version Or with the classic buildscript dependency syntax and then applying it in your project buildscript dependencies classpath io github gradle nexus publish plugin apply plugin io github gradle nexus publish plugin Check the releases page of the plugin to get the latest version Next create a new file called publish root gradle in a new scripts folder inside your project This will contain global configuration you need for publishing grabbing input values for your scripts and defining the MavenCentral repository Note that here we ll go through the contents of these scripts part by part with explanations You can always find the complete up to date files we use in production in the Stream Chat repository In this file you ll grab some configuration parameters Using the script below you ll first set all the variables to a dummy empty string This will let the project sync and build without the publication values set up which would otherwise be an issue for your contributors Create variables with empty default valuesext signing keyId ext signing password ext signing secretKeyRingFile ext ossrhUsername ext ossrhPassword ext sonatypeStagingProfileId The first three variables will be used to sign the artifacts after they re built signing keyId the ID of the GPG key pair the last eight characters of its fingerprintsigning password the passphrase of the key pairsigning secretKeyRingFile the location of the exported private key on diskosshrUsername and ossrhPassword are your account details for MavenCentral which you ve chosen at the Jira registration step We ll get back to where sonatypeStagingProfileId comes from later on Next you ll try to fetch the values of the variables from a local properties file in the root of the project if it exists otherwise you ll look for them in the environment variables The former lets you easily input these values locally on your machine while the latter will help with setting up CI File secretPropsFile project rootProject file local properties if secretPropsFile exists Read local properties file first if it exists Properties p new Properties new FileInputStream secretPropsFile withCloseable is gt p load is p each name value gt ext name value else Use system environment variables ext ossrhUsername System getenv OSSRH USERNAME ext ossrhPassword System getenv OSSRH PASSWORD ext sonatypeStagingProfileId System getenv SONATYPE STAGING PROFILE ID ext signing keyId System getenv SIGNING KEY ID ext signing password System getenv SIGNING PASSWORD ext signing secretKeyRingFile System getenv SIGNING SECRET KEY RING FILE Make sure that you ve set these variables either in the aforementioned local properties file or in your environment variables If you want to use the property file the syntax for it should look something like this replace all the data here with your own signing keyId BEFAsigning password signingPasssigning secretKeyRingFile gpg keys BEFA gpgossrhUsername yourSonatypeUserossrhPassword yourSonatypePasswordThe last piece of code to add to this file will define the MavenCentral Sonatype repository where publishing should upload the artifacts This relies on parameters fetched above to authenticate Set up Sonatype repositorynexusPublishing repositories sonatype stagingProfileId sonatypeStagingProfileId username ossrhUsername password ossrhPassword Important If you re on the new Sonatype infrastructure happens if you ve registered after or requested it specifically you have to add explicit URLs pointing to s oss sonatype org in this config block next to the existing parameters like so nexusPublishing repositories sonatype Existing params here nexusUrl set uri snapshotRepositoryUrl set uri As the last step apply this script in your root build gradle file like so apply from rootDir scripts publish root gradle This completes the configuration needed in the root project This gist contains the code blocks detailed above in a single snippet The final up to date script we use for publishing our SDK can be found in the Stream Chat repository Per module Gradle setupWith the repository defined and parameters fetched it s time to create a script that will define the artifacts in each module you want to publish Create a new file called publish module gradle in the scripts folder As its name suggests this will be applied to each module that you want to publish an artifact from In this file first you ll apply two plugins for publishing and signing apply plugin maven publish apply plugin signing Our publishing file also applies the Dokka plugin in this block which you have to configure separately if you want to use it Then you declare the sources artifact for the library This is really important it will make sure that the source files are packaged along with the executable compiled code so that your users can easily jump to the definitions that they re calling into within their IDE task androidSourcesJar type Jar archiveClassifier set sources if project plugins findPlugin com android library For Android libraries from android sourceSets main java srcDirs from android sourceSets main kotlin srcDirs else For pure Kotlin libraries in case you have them from sourceSets main java srcDirs from sourceSets main kotlin srcDirs artifacts archives androidSourcesJar Once again our real publishing file also adds an additional javadocJar task which ships Dokka generated documentation again you can skip this if you want to You ll set two properties on the Gradle project itself here the group ID and the version of the artifact You ll see where these uppercase values come from later on when you apply this publication script in the module level build gradle files group PUBLISH GROUP IDversion PUBLISH VERSIONHere comes the complicated part providing all the metadata for the library you re releasing See the inline comments for the play by play explanation afterEvaluate publishing publications release MavenPublication The coordinates of the library being set from variables that we ll set up later groupId PUBLISH GROUP ID artifactId PUBLISH ARTIFACT ID version PUBLISH VERSION Two artifacts the aar or jar and the sources if project plugins findPlugin com android library from components release else artifact buildDir libs project getName version jar artifact androidSourcesJar artifact javadocJar Mostly self explanatory metadata pom name PUBLISH ARTIFACT ID description Stream Chat official Android SDK url licenses license name Stream License url developers developer id zsmb name Márton Braun email marton getstream io Add all other devs here Version control info if you re using GitHub follow the format as seen here scm connection scm git github com getstream stream chat android git developerConnection scm git ssh github com getstream stream chat android git url Finally this piece of code grabs signing related values from the root project and then tells the signing plugin to sign the artifacts you ve defined above as a publication ext signing keyId rootProject ext signing keyId ext signing password rootProject ext signing password ext signing secretKeyRingFile rootProject ext signing secretKeyRingFile signing sign publishing publications That s the publish module gradle script all built up ready to use This gist contains the code blocks shown above in a single snippet The final up to date script we use for publishing our SDK can be found in the Stream Chat repository Time to include this script in a module Head to the build gradle file of your library module in our case this is the stream chat android client module and add the following code ext PUBLISH GROUP ID io getstream PUBLISH VERSION PUBLISH ARTIFACT ID stream chat android client apply from rootProject projectDir scripts publish module gradle Here you finally see the group ID artifact ID and version being set so that the publication script can make use of them Then the script itself is applied This is all the code you need to add per module if you are publishing your library in multiple artifacts everything else is done by the common script Your first releaseWith all of that set up you re now ready to publish the first version of your library For each repository you have defined in the publishing script a Gradle task will be created to publish to that repository In our example our first module to publish is stream chat android client and we ve named the repository sonatype Therefore we need to execute the following command to start publication replace the module name with your own here gradlew stream chat android client publishReleasePublicationToSonatypeRepositoryThis will create a so called staging repository for your library and upload your artifacts aar and sources to that repository At this point you can check that all the artifacts you wanted to upload have made it before hitting the release button To view the repository go to and log in In the menu on the left select Staging repositories Find your repository might be the only one in the list might have to scroll around a bit for it which has your group ID in its name If you select it and look at the Content tab you ll see the files that have been uploaded If everything looks good and you re done uploading files to the repository you have to Close it With the repository selected hit the Close button in the toolbar on top Confirm your action in the dialog you don t need to provide a description here This will take just a few moments you can follow along with it happening in the Activity tab With the repository closed you now have two final options available to you Drop will throw away the repository and cancel the publication process Use this if something went wrong during the upload or you ve changed your mind Release on the other hand will publish the contents of your staging repository to MavenCentral Again you get a confirmation dialog and you can choose Automatically Drop so that the staging repository is cleaned up after the release completes The time this process takes can vary a bit If you get lucky your artifact will show up on MavenCentral in minutes but it could also take an hour or more in other cases You can check whether your artifact is available by going to and browsing for it For example for our client we can keep refreshing the following page to see if the new version is there If you see the package via those links Gradle will also be able to pull it if mavenCentral is added as a repository and you add your library as a dependency Search indexing is a separate even longer process so it can take about two hours for your artifact to show up on search maven org If this was your first release you should at this point go back and comment on your original Jira issue to let them know that your repository setup and publication is working Automating Sonatype actionsThat was quite the adventure To make things smoother for subsequent releases you can automate the entire release flow with the publishing plugin that you already have configured in the project This in theory would mean that you don t have to revisit the Sonatype UI ever again In practice you ll do that more often than you d like when the plugin really the Sonatype API it calls breaks or misbehaves so it s worth being familiar with For this you ll need to set the sonatypeStagingProfileId variable in your project This value is an ID that Sonatype assigns to you which the plugin uses to make sure all the artifacts end up in the right place during the upload You can find this by going to Staging profiles selecting your profile and looking at the ID in the URL Either set this value in your local properties file or set the corresponding environment variable With this configuration done the plugin provides a new Gradle task that you can use to close and then release your staging repository with one simple call gradlew closeAndReleaseSonatypeStagingRepositoryAt this point you can upload and publish your library by just invoking these two Gradle tasks in sequence pretty convenient As a final step let s hook this into a CI pipeline Continuous integrationSince the library is hosted on GitHub anyway we use GitHub Actions for running the publication Gradle tasks automatically Whatever CI solution you re using setting up publication with it will consist of two main steps Getting your secret variables in place Invoking the two Gradle tasks Most of your secret variables for the list of these look at the publishing script again can simply go into Repository secrets Add each of these by going to Settings gt Secrets within your GitHub repository For the location of the signing key for the SIGNING SECRET KEY RING FILE secret an easy to use value is secret gpg which places the file in the root of the file system on the runner machine This makes it easy to reference it in the project independent of the working directory Your private GPG key is harder to inject into the build than the other values It needs to be present as a file for the signing task but you should not commit it into a public repository You could technically commit the private key into a public repository since it s protected by its passphrase At that point your key is only as secure as the strength of your passphrase see more discussion here and here It s much more secure to keep the key entirely private though The workaround for this is to add its contents as a secret variable and then write those contents into a temporary file during your build If you re not the only collaborator in your repository this method will expose your key to the other collaborators they could get to it by running workflows that expose it In that case you might want to stick to local publishing only Since the key is a binary file you need to first convert its contents into text form base encoding comes to the rescue Convert your secret key file into base with the following command if you re on Windows you can use a Git or Ubuntu bash for this base BEFA gpg gt BEFA txtPlace the contents of this file into yet another protected variable and name it GPG KEY CONTENTS Now let s create the GitHub Actions workflow that will put all of this together The configuration for this will go in the github workflows publish yml file of the repository This publish workflow will run every time a new release is created in the repository you can also change the triggers to run when a tag is created for example Again see the inline comments for some explanation of what each step does If you re new to GitHub Actions check out their introductory documentation first name Publishon release We ll run this workflow when a new GitHub release is created types released jobs publish name Release build and publish runs on ubuntu latest steps name Check out code uses actions checkout v name Set up JDK uses actions setup java v with java version Base decodes and pipes the GPG key content into the secret file name Prepare environment env GPG KEY CONTENTS secrets GPG KEY CONTENTS SIGNING SECRET KEY RING FILE secrets SIGNING SECRET KEY RING FILE run git fetch unshallow sudo bash c echo GPG KEY CONTENTS base d gt SIGNING SECRET KEY RING FILE Builds the release artifacts of the library name Release build run gradlew stream chat android client assembleRelease Generates other artifacts javadocJar is optional name Source jar and dokka run gradlew androidSourcesJar javadocJar Runs upload and then closes amp releases the repository name Publish to MavenCentral run gradlew publishReleasePublicationToSonatypeRepository max workers closeAndReleaseSonatypeStagingRepository env OSSRH USERNAME secrets OSSRH USERNAME OSSRH PASSWORD secrets OSSRH PASSWORD SIGNING KEY ID secrets SIGNING KEY ID SIGNING PASSWORD secrets SIGNING PASSWORD SIGNING SECRET KEY RING FILE secrets SIGNING SECRET KEY RING FILE SONATYPE STAGING PROFILE ID secrets SONATYPE STAGING PROFILE ID MavenCentral uploads tend to be…Flaky to put it nicely Here are some recommendations to have fewer issues with them Perform all your Gradle upload tasks in a single job on a single machine The max workers option used above guarantees that the upload task runs on a single thread even if parallel builds are otherwise configured It s also a good idea to put the upload task all of them if you re uploading multiple modules worth of artifacts in a different Gradle invocation than the assemble amp signing tasks as you see it done above so that they run closely together If a long time passes between your upload calls or if they originate from different CI machines you might see problems such as multiple staging repositories being created for you on Sonatype with your files scattered all over them Even if you do everything described above right you might still get random upload errors or timeouts either during the upload or while the plugin is trying to close and release the repository At this point being able to look at the staging repository on the Sonatype UI and manually closing dropping releasing repositories will come in handy to fix things up If your staging repository seems okay has correct contents and it just failed to close you can close and release it yourself If it looks messed up somehow or you ended up with multiple staging repositories it s best to drop them all and then run the upload workflow again Reminder our up to date publishing workflow is always available in our GitHub repository ConclusionWell that was quite a journey We hope that this detailed guide helped you get up and running with MavenCentral publication You can follow us on Twitter getstream io for more great technical content please tweet at us if you ve successfully set up publishing following these steps You can also reach the author zsmb if you have any questions If you re looking for a Kotlin first powerful Chat SDK to use in your Android app check out our Android documentation and our Android Chat tutorial If you re interested in library development you ll find these articles helpful as well Maintaining Compatibility in Kotlin LibrariesMastering API Visibility in Kotlin 2021-04-21 14:29:27
海外TECH DEV Community Amazing Grid Card Hover Using HTML & CSS https://dev.to/nikhil27b/amazing-grid-card-hover-using-html-css-1c3h Amazing Grid Card Hover Using HTML amp CSSHello Today I created an Amazing Grid Card Hover Using HTML amp CSS when you hover on this card image size changes to half amp also shows some information about the place we will be adding more animation in the upcoming post I hope you like this also comments about your thoughts For more content follow me on Instagram developer nikhil If you want to more support me then buy me a coffee Thank you 2021-04-21 14:20:27
海外TECH DEV Community Create a Personal Portfolio Website Using HTML CSS and JavaScript https://dev.to/foolishdeveloper/create-a-personal-portfolio-website-using-html-css-and-javascript-fam Create a Personal Portfolio Website Using HTML CSS and JavaScriptIn this article I am going to show you how to design a personal portfolio website using HTML CSS and JavaScript code I have previously designed many more websites and personal portfolio designs Hope you like this design like the others I have included in this design all the qualities that a personal portfolio website needs to have Meanwhile I have used the bootstrap programming code to make it fully responsive Video Tutorial of Responsive Personal Portfolio WebsiteIn the video you ve seen the Responsive One Page Personal Portfolio Website and I hope you ve understood the little bit codes of this design Responsive Personal Portfolio Website Source Codes To create this program One Page Personal Portfolio Website First you need to create three Files one HTML File one CSS File and the last one is JavaScript File After creating these files just paste the following codes into your file You can also download the source code files from the given download button Remember that In the source files there you also get the images of this program Download Source Code Google Drive Video Tutorial YouTube 2021-04-21 14:11:20
海外TECH DEV Community Good VS Bad – Beyond the JavaScript Console https://dev.to/khuntsr/good-vs-bad-beyond-the-javascript-console-59ak Good VS Bad Beyond the JavaScript ConsoleIn your development career you mostly know about the console log but the console API can do many things that you may don t know HERE in this article we are going to learn all about console API with Good VS Bad practice Let s start with consoling the console object Write console log console in your browser s console editor and you found the list of APIs provided by the console object Each API purpose is unique and useful in certain cases Below are my explanations of the most useful APIs in console object Assume you have an Object on the list and you show that on the JavaScript console The Bad Practice The Good Practice Assertion Sometimes we want to log only when the condition is false console assert If condition false then only give an error It eliminating the need for if condition and keep your code clean The Bad Practice The Good Practice Always use Braces to log the object with the name The Bad Practice The Good Practice Group If you have multiple logs then try log group for collapsible sections The Bad Practice The Good Practice Always console object with its properties The Bad Practice The Good Practice How to set a timer with the console We can start a timer with the console by calling time then call timeLog to measure the elapsed time It provides a simple solution for measuring performance Now lets talk about remaining APIs in console log console clear The console clear method clears the console console count Writes to the console the number of times that particular console count is called console info This method writes a message to the console console warn The console warn method writes a warning to the console console error The console error method writes an error message to the console Console trace The console trace method displays a trace that shows how the code ended up at a certain point How to apply CSS in console log We can also apply the style in the console log Use the special c character to add some style Thank you for reading this article 2021-04-21 14:02:05
Apple AppleInsider - Frontpage News EU's drafted AI policies aim to keep Big Tech in check https://appleinsider.com/articles/21/04/21/eus-drafted-ai-policies-aim-to-keep-big-tech-in-check?utm_medium=rss EU x s drafted AI policies aim to keep Big Tech in checkOn Wednesday the European Union announced new proposed artificial intelligence regulations limiting how governments and corporations can use AI s more ethically dubious aspects The European Union proposed AI policies that would limit how companies and governments can use the ethically problematic techProactively attempting to regulate AI s more nefarious uses the EU s draft rules would ban AI systems considered a clear threat to the safety livelihoods and rights of people Read more 2021-04-21 14:23:07
Apple AppleInsider - Frontpage News Tribeca Film Festival to show Apple TV+ 'Fathom' documentary https://appleinsider.com/articles/21/04/21/fathom-the-apple-tv-documentary-film-will-show-at-the-tribeca-film-festival-in-june?utm_medium=rss Tribeca Film Festival to show Apple TV x Fathom x documentaryDirector Drew Xanthopoulos film about whales headed to Apple TV June is in the competition at the Tribeca Film Festival earlier that month Apple TV s Fathom Apple announced on April that it had acquired Fathom the latest film for Apple TV s growing library of nature films The film directed by Drew Xanthopoulos follows Dr Ellen Garland and Dr Michelle Fournet a pair of scientists who research whales communications Read more 2021-04-21 14:25:38
海外TECH Engadget All about Eve: The upstart PC brand struggling to pay back jilted customers https://www.engadget.com/eve-v-pc-startup-200000-dollars-refunds-never-paid-spectrum-monitors-143035514.html All about Eve The upstart PC brand struggling to pay back jilted customersThree years after the first Eve branded computers went on sale some customers still haven t received their machines and attempts to reclaim their money have largely gone unanswered Now with a bevy of new products in the works ーincluding a follow up to that original V PC ーEve seemingly hopes its new customers will forget how much it still owes some of its earliest backers 2021-04-21 14:30:35
海外TECH Engadget Riding in the Lucid Air luxury EV https://www.engadget.com/lucid-air-grand-touring-release-candidate-vehicle-video-140041381.html Riding in the Lucid Air luxury EVAhead of beginning the deliveries of the Lucid Air to customers in the second half of this year the electric vehicle startup gave us a ride in its Grand Touring release candidate vehicle 2021-04-21 14:00:41
Cisco Cisco Blog The Need for Continuous and Dynamic Threat Modeling https://blogs.cisco.com/security/the-need-for-continuous-and-dynamic-threat-modeling The Need for Continuous and Dynamic Threat ModelingThe trend towards accelerated application development regularly updating the architecture through an agile methodology led us to strategize ways to continuously and dynamically threat model an application architecture during runtime 2021-04-21 15:00:00
金融 RSS FILE - 日本証券業協会 株主コミュニティの統計情報・取扱状況 https://www.jsda.or.jp/shiryoshitsu/toukei/kabucommunity/index.html 株主コミュニティ 2021-04-21 15:30:00
海外ニュース Japan Times latest articles Suga cancels planned India and Philippines visits as virus surges back in Japan https://www.japantimes.co.jp/news/2021/04/21/national/politics-diplomacy/suga-japan-india-philippines/ Suga cancels planned India and Philippines visits as virus surges back in JapanThe trip which had been scheduled from late April to early May was intended to reaffirm Japan s cooperation with the two countries as they look 2021-04-22 00:48:33
海外ニュース Japan Times latest articles Controversial report could deny Hakuho deserved elder stock https://www.japantimes.co.jp/sports/2021/04/21/sumo/hakuho-elder-name-report/ Controversial report could deny Hakuho deserved elder stockShould the Japan Sumo Association adopt the recommendations of the external advisors the all time great yokozuna would be prevented from using his ring name after 2021-04-22 00:41:46
海外ニュース Japan Times latest articles Modi’s war on the press https://www.japantimes.co.jp/opinion/2021/04/21/commentary/world-commentary/india-press-freedom-narendra-modi/ family 2021-04-22 00:27:46
海外ニュース Japan Times latest articles Why would anyone want to be president? https://www.japantimes.co.jp/opinion/2021/04/21/commentary/world-commentary/u-s-joe-biden-donald-trump-democrats-republicans-barack-obama/ ample 2021-04-22 00:23:30
海外ニュース Japan Times latest articles Shades of FDR: Biden’s first 100 days https://www.japantimes.co.jp/opinion/2021/04/21/commentary/world-commentary/joe-biden-u-s-2020-presidential-election-covid-19-vaccinations-democrats-republicans/ strong 2021-04-22 00:21:14
ニュース BBC News - Home Dyson lobbying row: Boris Johnson makes 'no apology' for seeking ventilators https://www.bbc.co.uk/news/uk-politics-56832486 government 2021-04-21 14:54:33
ニュース BBC News - Home US launches federal probe into Minneapolis police https://www.bbc.co.uk/news/world-us-canada-56836193 murder 2021-04-21 14:49:48
ニュース BBC News - Home Jim Steinman: Tributes paid to 'the Wagner of rock' https://www.bbc.co.uk/news/entertainment-arts-56830626 making 2021-04-21 14:50:25
ニュース BBC News - Home Fishmongers' Hall: Terror attacker shouted 'I'm going to blow you all up' https://www.bbc.co.uk/news/uk-england-london-56817533 suicide 2021-04-21 14:47:54
北海道 北海道新聞 「希望の火つなぐ」 道内聖火リレーランナー発表 6月14日 札幌3ルート、千歳1ルート https://www.hokkaido-np.co.jp/article/535842/ 実行委員会 2021-04-21 23:07:22

コメント

このブログの人気の投稿

投稿時間:2021-06-17 05:05:34 RSSフィード2021-06-17 05:00 分まとめ(1274件)

投稿時間:2021-06-20 02:06:12 RSSフィード2021-06-20 02:00 分まとめ(3871件)

投稿時間:2024-02-12 22:08:06 RSSフィード2024-02-12 22:00分まとめ(7件)