投稿時間:2022-03-31 17:37:05 RSSフィード2022-03-31 17:00 分まとめ(54件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
IT 気になる、記になる… スマートリモコン「Nature Remo」の公式アプリがApple Watchに対応 https://taisy0.com/2022/03/31/155304.html applewatch 2022-03-31 07:57:37
TECH Engadget Japanese Amazonプライムビデオ4月の新作:劇場版「名探偵コナン」一挙配信! ボクシング世界戦や「浅田家!」「SPY×FAMILY」も https://japanese.engadget.com/prime-video-new-072559251.html 目白押し 2022-03-31 07:25:59
TECH Engadget Japanese アップルとFacebook、法執行機関を装ったハッカーに顧客データを提供していたと判明 https://japanese.engadget.com/apple-facebook-gave-user-data-hackers-070038310.html facebook 2022-03-31 07:00:38
IT ITmedia 総合記事一覧 [ITmedia ビジネスオンライン] カインズ、東急ハンズの買収完了 店名・社名はしばらく「東急ハンズ」のまま https://www.itmedia.co.jp/business/articles/2203/31/news154.html itmedia 2022-03-31 16:34:00
IT ITmedia 総合記事一覧 [ITmedia ビジネスオンライン] SDGsに「関心ある」6割超 「食品ロス」など身近な問題に集中 https://www.itmedia.co.jp/business/articles/2203/31/news146.html itmedia 2022-03-31 16:30:00
IT ITmedia 総合記事一覧 [ITmedia News] スマホで入れるメタバース、ドコモが公開 アニソンで集客、ライブも開催 https://www.itmedia.co.jp/news/articles/2203/31/news148.html itmedia 2022-03-31 16:24:00
AWS AWS Architecture Blog How Net at Work built an email threat report system on AWS https://aws.amazon.com/blogs/architecture/how-net-at-work-built-an-email-threat-report-system-on-aws/ How Net at Work built an email threat report system on AWSEmails are often used as an entry point for malicious software like trojan horses rootkits or encryption based ransomware The NoSpamProxy offering developed by Net at Work tackles this threat providing secure and confidential email communication A subservice of NoSpamProxy called guards is responsible for threat reports of inbound and outbound emails With the increasing number … 2022-03-31 07:05:58
python Pythonタグが付けられた新着投稿 - Qiita spread sheet を活用したVCT JPまとめ(失敗編) https://qiita.com/kir1n/items/ba3d887e820db9a7e6bd 生じた問題点入力が面倒な上に効率が悪いMapやキャラの絞り込みが難しいキャラが追加された際、プログラムの大幅修正が必要これ以上の情報を得られないについて行がずれたことを確認しにくい。 2022-03-31 16:45:11
python Pythonタグが付けられた新着投稿 - Qiita recsys-pythonを進めていく(第3章から終わりまで) https://qiita.com/yaminabeworks/items/73d04075a23021dd252c recsyspythonを進めていく第章から終わりまで参考文献とか前回の記事やったことgooglecolabで参考文献の第章までをすべて解いた。 2022-03-31 16:16:20
python Pythonタグが付けられた新着投稿 - Qiita PythonでCSSを全力で小さくする! https://qiita.com/laddge/items/366a66cc42481f58d95d うーん、どうせなら点取りたいよなあ使ってないクラスなどの記述を削除Sassでのカスタマイズだと、分割されたファイルのうち必要なものだけインポートする感じですが、これでもまだ使ってないクラスなどの記述が残っています。 2022-03-31 16:15:03
Ruby Rubyタグが付けられた新着投稿 - Qiita QiitaのAPIを使用してRubyの最新記事を検索する https://qiita.com/KazukiOhta/items/b61fbb677f28a0064510 2022-03-31 16:38:11
Ruby Rubyタグが付けられた新着投稿 - Qiita 【初心者用】Ruby on Railsでrails db:migrateできない https://qiita.com/takao_yamasaki/items/f1a0d0011eeedcc0cd9f terminalrailsdbcreateCreateddatabasedbdevelopmentsqliteCreateddatabasedbtestsqlite参考「現場で使えるRubyonRails速習実践ガイド」configフォルダにbootrbファイルが作られないため、railssが出来ない。 2022-03-31 16:10:27
Docker dockerタグが付けられた新着投稿 - Qiita [Laravel]単体テスト(テストケース使用、自動テスト) https://qiita.com/namari/items/27bb0960f92536697f91 2022-03-31 16:24:01
Docker dockerタグが付けられた新着投稿 - Qiita DockerでFESS作成(Apache+SSL) https://qiita.com/Toru_Kubota/items/ffbcfd00e45c2ee0729f DockerでFESS作成ApacheSSL内容下記設定の備忘録です。 2022-03-31 16:17:32
Ruby Railsタグが付けられた新着投稿 - Qiita 【初心者用】Ruby on Railsでrails db:migrateできない https://qiita.com/takao_yamasaki/items/f1a0d0011eeedcc0cd9f terminalrailsdbcreateCreateddatabasedbdevelopmentsqliteCreateddatabasedbtestsqlite参考「現場で使えるRubyonRails速習実践ガイド」configフォルダにbootrbファイルが作られないため、railssが出来ない。 2022-03-31 16:10:27
技術ブログ Developers.IO UdemyのDVA講座をやってみた https://dev.classmethod.jp/articles/aws-dva-udemy-handson/ udemy 2022-03-31 07:35:18
技術ブログ Developers.IO triggerを使って.gitlab-ci.ymlを分割する https://dev.classmethod.jp/articles/gitlab-ci-yml-trigger/ getstartedwit 2022-03-31 07:24:21
技術ブログ Developers.IO SCP を利用して S3 署名付き URL の利用を HTTPS のみに制限してみた https://dev.classmethod.jp/articles/scp-s3-presign-url-https-only/ https 2022-03-31 07:13:50
海外TECH MakeUseOf What Is GTA+ and How Much Does It Cost? https://www.makeuseof.com/what-is-gta-plus-cost/ learn 2022-03-31 07:39:06
海外TECH DEV Community Anime search app built using Reactjs and Typesense https://dev.to/aviyel/anime-search-app-built-using-reactjs-and-typesense-1em1 Anime search app built using Reactjs and TypesenseCreating a search engine that are typo tolerant effective and efficient are exceedingly tough A typographical error could cause the search to fail even if the desired item is in the database By removing the requirement to build a search engine from the ground up Typesense might save a lot of time and effort Users will also be able to use the app s search tool successfully resulting in a positive user experience Typesense is a free open source typo tolerant search engine for programmers that aims to reduce the amount of time needed to execute effective and efficient searches To learn more about typesense gt What is Typesense and why is it such a great tool This tutorial will show you how to install Typesense how to create a Typesense application from the ground up how to preconfigure the Typesense client and much more This article also demonstrates how to establish a Typesense Collection Finally we ll start up our program add a new item to our collection and search our indexed data collection Let s get started The goal of this article is to create an instant search type application also known as search as you type which means that whenever you type something the results appear instantly providing a pleasant user experience So in a previous article we created a simple Typesense Booksearch javascript application and in this article we ll built an Anime search but by using Animes dataset and also by using react js with the goal of simply showing you how to do it using the most popular framework or UI library So let s get started with our React js application with Javascript To do so simply follow the instructions below Configuring our React applicationWe ll begin by using create react app to set up our frontend We ll build the user interface and its features from the ground up Let s go to work on our application right away Setting up react application bootstarpped using CRALet s start with the react part and start building it The first thing you need do is install Node js if it isn t already installed on your PC So head over to the official Node js website and download the latest version Node js is required in order to use the node package manager generally known as npm Now open the folder in your preferred code editor we ll be using VScode code editor for this article tutorial Next open the integrated terminal and type npx create react app This command will create a react application in the current directory It normally only takes a few minutes to set up Normally we would use npm to get packages into a project but in this case we ll use npx the package runner which will download and configure everything for us so that we can get started with an excellent template right away It s time to start our development server so run npm start and the browser will open react app instantly So this is how the boilerplate template appears right away Now it s time to investigate the file and folder structure provided by create react app There is a folder called node module that contains all of our node dependencies Then there s a public folder where the only thing that matters is the index html file So this appears to be a standard HTML file complete with head body and meta tags You ll notice a div with the id root inside our body tag followed by the fallback noscript tag which will be visible only if the user s browser has javascript disabled lt index html gt lt DOCTYPE html gt lt html lang en gt lt head gt lt meta charset utf gt lt link rel icon href PUBLIC URL favicon ico gt lt meta name viewport content width device width initial scale gt lt meta name theme color content gt lt meta name description content Web site created using create react app gt lt link rel apple touch icon href PUBLIC URL logo png gt lt link rel manifest href PUBLIC URL manifest json gt lt title gt React practice lt title gt lt head gt lt body gt lt noscript gt You need to enable JavaScript to run this app lt noscript gt lt div id root gt lt div gt lt body gt lt html gt So you re probably wondering where the content comes from Remember that All of our source code is contained within our source or src folder and react will inject it into the root div element Let s take a look at our src folder which contains some stylesheets javascript files and SVG files Now head over to our App js file App jsimport logo from logo svg import App css function App return lt div className App gt lt header className App header gt lt img src logo className App logo alt logo gt lt p gt Edit lt code gt src App js lt code gt and save to reload lt p gt lt a className App link href target blank rel noopener noreferrer gt Learn React lt a gt lt header gt lt div gt export default App In this case we re simply importing react from react and logo from our logo using standard javascript Following that we have a normal javascript function called APP and this function in react is known as a functional component and this function is returning a react element that looks like HTML but is actually an jsx as you can see there is a div tag with a className of APP and we can t say class by itself because the class is a reserved word in javascript so in jsx we have to use className Following that we have the header and then the image and notice on the image source that we have our logo which is actually a javascript variable that we imported at the top so in order to use the javascript within JSX we must surround it with curly brackets and then we have a paragraph an anchor tag and that is all for this component NOTE Because of the export we are able to extract the component and place it on the webpage Export appears at the bottom of the app js file indicating that we are exporting the App function So Now let s look at the index js file index jsimport React from react import ReactDOM from react dom import index css import App from App import reportWebVitals from reportWebVitals ReactDOM render lt React StrictMode gt lt App gt lt React StrictMode gt document getElementById root reportWebVitals So in this case we re importing react from react again and this time we re also importing react dom and then we re importing the CSS stylesheet file and finally we re importing App from App js which is the file we just discussed and there s service worker which is used to make your application work completely offline Then we invoke ReactDom render which accepts two parameters The first parameter is the jsx object and within jsx we can include our user defined components so react strict mode is a react defined component whereas App is a user defined component and the second parameter is document getElementById root which targets the root div in our index html file and is how we access the content in our webpage Note ReactDom renders our content into our root div located at our index html file React boilerplate files cleanupWe must first tidy up our projects by eliminating some of the files provided by create react app before we can begin creating them After you ve cleaned up your files and folder they should look like this Adding and Installing some packagesWe will need to install a few third party packages for this project so copy and paste the following command into your terminal Installing typesenseThis is going to be our primary typesense package npm install typesense Installing typesense instantsearch adapterThis package will allow us to use the instantsearch UI and this adapter will basically plug it into typesense because instantsearch js is created by algolia but typesense created this adapter to port its functionality and features into the typesense package itself npm install typesense instantsearch adapter Installing styled componentsThis package will lets you write actual CSS inside your JavaScript project npm install styled components Installing instantsearch cssInstead of creating everything from scratch this package will give pre made styles such as the search box and numerous UI styles npm install instantsearch css Installing react instantsearch domThis package is the React version of Algolia s instantsearch js library which will provides us the components that we need render it onto our projects This package wilnpm install react instantsearch domFinally your package json file should look like this once you ve installed all of your project s dependencies name anime searchapp reactjs typesense version private true dependencies testing library jest dom testing library react testing library user event instantsearch css react react dom react instantsearch dom react scripts styled components typesense typesense instantsearch adapter web vitals scripts start react scripts start build react scripts build test react scripts test eject react scripts eject eslintConfig extends react app react app jest browserslist production gt not dead not op mini all development last chrome version last firefox version last safari version Now that our project and dependencies have been set up we can get started Firstly we need to import our animes data so create a dataset folder and inside it create your own anime list json file filling it with all of the necessary product information or download the anime dataset from here Finally your folder structure and dataset should look something like this So in order to populate our Typesense index we must first start our Typesense server and there are several ways to do so There is the old programmatic way which requires you to install everything start it up and provide the configuration using code or there is this one awesome method which is the preferred method which is very steady and known to work and which is used in the docker image and run the docker container that will basically bind and give it a volume that will connect to where you ll be storing the data and that s all there is to it So that s essentially what we ll be using in this article Let s start by creating a new script and a folder called scripts because we ll have a handful of scripts loaded in here that will allow us to either index the data or start the typesense server or the docker container so you can basically put it inside the script run tag inside the package json So that every time you wish to start the server you can just open up the command prompt and fire up the npm commandInside the scripts folder create a new file called runServer js So this script will essentially run the docker command but before we do so we must first configure it Folder structure should resemble something like this The very First step is to execute command from the child process of node js runServer jsconst exec require child process Next let s set up the command We ll use docker run and detach to run the docker in the background then assign the port The most important section of this command is the volume section What we re doing here is binding the volume which is essentially a way to store the data of the typesense which by default is inside the container itself So typesense will store the data inside the container s data folder named data and it will expose and link this data folder into the folder we designate on our system which in this case will be the tmp directory This approach will assist to keep the data consistent and ensure that it is resilient and we will always preserve the data so that if the docker container is deleted stopped or something similar happens we will simply keep our data in a secure place By specifying a v volume we are just indicating where we want the data to be stored After that we need to specify which image is required to run inside our docker container so we ll use typesense typesense for now but you can use your own image and then specify the data directory and the api key which you can put anything you want and pass the listen port and finally enable CORS so we don t have any CORS related issues This is what your code should look like runServer jsconst exec require child process const command docker run d p v tmp typesense server data data typesense typesense data dir data api key animesearch listen port enable cors Finally we must run the command and simply construct an error handler in the event that an error happens while running the commands As a result your final runServer code should look like this runServer jsconst exec require child process const command docker run d p v tmp typesense server data data typesense typesense data dir data api key animesearch listen port enable cors exec command err gt if err console log Typesense Server is up and running ✰ if err console log Error running server err So now that we have our runServer js script ready to go we can simply update the script tag in our package json file Finally your package json file should look like this once you ve updated the script package json name anime searchapp reactjs typesense version private true dependencies testing library jest dom testing library react testing library user event instantsearch css react react dom react instantsearch dom react scripts styled components typesense typesense instantsearch adapter web vitals scripts start react scripts start build react scripts build test react scripts test eject react scripts eject start server node scripts runServer js eslintConfig extends react app react app jest browserslist production gt not dead not op mini all development last chrome version last firefox version last safari version Finally start the server by typing npm run start server and your docker will start running then you can proceed to the next step of indexing the data collection The next step is to actually populate or index the data inside the typesense server so now that we have the server up and running and a bunch of anime data this is the datset that we want to populate inside the typesense server so that later on in our UI we can basically query that typesense server and do an instant search that will be legit incredibly fast So to do that let s get started writing the data importing scripts We ll start by creating a file called loadData js inside the scripts folder which we previously created in which we ll initialize the typesense client Indexing data on typesense a step by step guideFirst step We need to import the Typesense library to our project loadData jsconst Typesense require typesense Seecond step Let s go ahead and make a self executing function that will run whenever we run the script and make it asynchronous so we can use the async await functionality Simply create module export and export the self executing function inside it and make it asynchronous so we can make a script that reads the data and does the collection manages the typesense server and indexes the data So the first thing we need to do is set up the typesense client so that we can connect to the server and begin managing indexing and retrieving data So first create a typesense config variable and pass the nodes properties first So what it does is it allows you to have multiple nodes for a single server for example a client can connect to multiple nodes and nodes are basically just servers so this specific nodes is actually an array that holds the actual configuration for each server that you actually want to connect into and that you want the client to access so currently we only have one server running so we are going to usitlize only one nodes Next inside the nodes array supply the host typesense port and protocol it uses as well as the api key loadData jsconst Typesense require typesense module exports async gt const TYPESENSE CONFIG nodes host localhost port protocol http apiKey animesearch Third step Let s utilize the typesense configuration to make a Typesense client loadData jsconst Typesense require typesense module exports async gt const TYPESENSE CONFIG nodes host localhost port protocol http apiKey animesearch console log Config TYPESENSE CONFIG const typesense new Typesense Client TYPESENSE CONFIG Fourth step This is a crucial stage because it is here that we provide the schema that will have our data indexed into the actual typesense database therefore schema is quite critical It s fairly basic syntax and super simple to work with Schema is basically where you describe how your data is going to be saved For our schema we have title synopsis genre aired popularity ranking score img url and links So in schema you only want to put the fields you wish to index If you re familiar with nosql databases especially mongodb it s heavily inspired by this approach If you re familiar with the mongoose ORM Object Relational Model for example how it works and how you can retrieve data and collections it basically works the same way and and typesense has this particular exact feature So it s basically like a nosql database It s a little more sophisticated than that but you may think of it like this to get a general impression of it and understand how the data flows and how it s all organized together Begin by giving the schema a name and making sure the number of documents is set to zero Next add the fields which will be an array of objects containing every single field that we want to index and store in our database so provide the name type and facet So if you re wondering what facet is it s a feature that allows you to define categories based on a subset of attributes so that users may narrow down their search results This is how your schema should look like loadData jsconst Typesense require typesense module exports async gt const TYPESENSE CONFIG nodes host localhost port protocol http apiKey animesearch console log Config TYPESENSE CONFIG const typesense new Typesense Client TYPESENSE CONFIG const schema name animes num documents fields name title type string facet false name synopsis type string facet false name genre type auto facet true name genre lvl type auto facet true optional true name genre lvl type auto facet true optional true name genre lvl type auto facet true optional true name genre lvl type auto facet true optional true name genre lvl type auto facet true optional true name genre lvl type auto facet true optional true name aired type string facet true name popularity type float facet true name ranked type float facet true name score type string facet true name img url type string facet true name link type string facet true default sorting field popularity So if you want to index all of the data in the array of genres for example you ll need to store store each level of the array on threir specific own field Let s proceed to our dataset and look at the genres section As you can see in the figure below there are four items in that array so we will make each field level for each of them items Fifth step Let s start by reading the movies from the json files and then importing the dataset Now is the time to call the Typesense client and establish a connection with a schema within it loadData jsconst Typesense require typesense module exports async gt const TYPESENSE CONFIG nodes host localhost port protocol http apiKey animesearch console log Config TYPESENSE CONFIG const typesense new Typesense Client TYPESENSE CONFIG const schema name animes num documents fields name title type string facet false name synopsis type string facet false name genre type auto facet true name genre lvl type auto facet true optional true name genre lvl type auto facet true optional true name genre lvl type auto facet true optional true name genre lvl type auto facet true optional true name genre lvl type auto facet true optional true name genre lvl type auto facet true optional true name aired type string facet true name popularity type float facet true name ranked type float facet true name score type string facet true name img url type string facet true name link type string facet true default sorting field popularity const animes require dataset animes json try const collection await typesense collections animes retrieve console log Found existing collection of animes console log JSON stringify collection null catch err console error err Sixth step If an error occurs while loading the data data duplication error simply add the following snippet of code to the loadData js file before creating schema becasue it will simply remove the existing data and populates it with the new ones if collection num documents animes length console log Collection has diff number of docs than data console log Deleting collection await typesense collections animes delete Seventh step Creating a collection named animes In Typesense a Collection is a set of related Documents that functions similarly to a table in a relational database We give a collection a name and describe the fields that will be indexed when a document is added to the collection when we create it Your final code inside loadData js file should look like this loadData jsconst Typesense require typesense module exports async gt const TYPESENSE CONFIG nodes host localhost port protocol http apiKey animesearch console log Config TYPESENSE CONFIG const typesense new Typesense Client TYPESENSE CONFIG const schema name animes num documents fields name title type string facet false name synopsis type string facet false name genre type auto facet true name genre lvl type auto facet true optional true name genre lvl type auto facet true optional true name genre lvl type auto facet true optional true name genre lvl type auto facet true optional true name genre lvl type auto facet true optional true name genre lvl type auto facet true optional true name aired type string facet true name popularity type float facet true name ranked type float facet true name score type string facet true name img url type string facet true name link type string facet true default sorting field popularity const animes require dataset animes json try const collection await typesense collections animes retrieve console log Found existing collection of animes console log JSON stringify collection null if collection num documents animes length console log Collection has diff number of docs than data console log Deleting collection await typesense collections animes delete catch err console error err console log Creating schema console log JSON stringify schema null await typesense collections create schema console log Populating collection data try const returnData await typesense collections animes documents import animes console log Return data returnData catch err console error err So now that we have our loadData js script ready to go we can simply update the script tag in our package json file Finally your package json file should look like this once you ve updated the script package json name anime searchapp reactjs typesense version private true dependencies testing library jest dom testing library react testing library user event instantsearch css react react dom react instantsearch dom react scripts styled components typesense typesense instantsearch adapter web vitals scripts start react scripts start build react scripts build test react scripts test eject react scripts eject start server node scripts runServer js indexer node scripts loadData js eslintConfig extends react app react app jest browserslist production gt not dead not op mini all development last chrome version last firefox version last safari version Finally start indexing the data in typesense server by typing npm run indexer and your data will start getting populated inside the typesense server Building a UI and retrieving the dataLet s get started by putting together the UI Our frontend or UI will need to connect to the typesense server and do queries A Typesense server is as standard and flexible as any other HTTP server You can basically send the HTTP request which we will be utilizing here as well and the client will simply submit a normal HTTP request and it will do the search for you That is basically how it will operate between a client and the actual typesense server So before we perform any UI work or display or render any components we must first connect to the server and supply the configuration that we accomplished previously We can now finally adjust the project to use Typesense We ve got our typesense instance up and running in the background To get React to use the Typesense adapter open src app js file and create a connection first Inside that create a TypesenseInstantsearchAdapter object and add server as a key Inside that pass the apiKey and nodes and inside the nodes specify the host port and protocol Finally add the additional search parameter to it and pass the query and queryByWeight which you want to display the indexed document data accordingly Remember that these parameters are passed directly to the Typesense search API endpoint As a result any parameters supported by the search endpoint can be passed through it The following is an example of what your code should look like import React useState from react import TypesenseInstantSearchAdapter from typesense instantsearch adapter const typesenseInstantsearchAdapter new TypesenseInstantSearchAdapter server apiKey animesearch nodes host localhost port protocol http additionalSearchParameters queryBy titles synopsis genre queryByWeights numTypos typoTokensThreshold const App gt return lt gt lt div gt App lt div gt lt gt export default App Now that we ve completed the configuration let s move on to creating an interface for our application To do so first import the InstantSearch component from the react instantsearch dom library and pass indexName and searchClient as props to that component app jsimport React useState from react import TypesenseInstantSearchAdapter from typesense instantsearch adapter import InstantSearch from react instantsearch dom const typesenseInstantsearchAdapter new TypesenseInstantSearchAdapter server apiKey animesearch nodes host localhost port protocol http additionalSearchParameters queryBy titles synopsis genre queryByWeights numTypos typoTokensThreshold const App gt return lt gt lt InstantSearch indexName animes searchClient typesenseInstantsearchAdapter searchClient gt lt InstantSearch gt lt gt export default App If you start your react js application it will appear empty Before we dive into integrating searchbox let s style our application and segregate the search section as well as add some style to our interface so simply follow the code below and wrap it inside the InstantSearch component const App gt return lt gt lt InstantSearch indexName animes searchClient typesenseInstantsearchAdapter searchClient gt lt div className search container gt lt aside className results section gt lt aside gt lt main gt Search result section lt main gt lt div gt lt InstantSearch gt lt gt Now let s add the SearchBox and Hits components from the react instantsearch dom library so we can directly incorporate those components inside our application import TypesenseInstantSearchAdapter from typesense instantsearch adapter import ResultTemplate from components ResultTemplate import App css import InstantSearch SearchBox Hits Configure Pagination SortBy Panel RefinementList from react instantsearch dom import instantsearch css themes satellite css const typesenseInstantsearchAdapter new TypesenseInstantSearchAdapter server apiKey animesearch nodes host localhost port protocol http additionalSearchParameters queryBy title synopsis genre queryByWeights numTypos typoTokensThreshold const App gt return lt gt lt h className super title gt ‍Anime search application built using react lt h gt lt InstantSearch indexName animes searchClient typesenseInstantsearchAdapter searchClient gt lt Configure hitsPerPage gt lt div className search container gt lt aside className results section gt lt aside gt lt main gt lt SearchBox gt lt div className searchbox gap gt lt div gt lt Hits gt lt main gt lt div gt lt InstantSearch gt lt gt export default App Simply re run the application after you ve fixed it and your application should now look like this At the moment our data is shown in json format same like it is in our index Let s present the data in a more appealing way therefore let s make a new component folder and inside that folder create another new file called ResultTemplate js and pass the the hit props Finally show the anime title by simply passing hit title and wrapping it in a simple div tag components ResultTemplateimport React from react const ResultTemplate hit gt return lt gt lt div gt hit title lt div gt lt gt export default ResultTemplate After you ve finished creating a component simply import it into the App js file and feed it to the Hit component lt Hits hitComponent ResultTemplate gt Simply re run the application after you ve fixed it and it should now appear like this So let s add some styling to our app to make the results display in a grid format so head to the app s main page and inspect the element there So the concept here with this reactInstanceSearch library is that those elements have predefined classes names as you can see each element has an ais Hits ais Hits lists and then you have ais Hits items so we just need to change the styles and because we re using vanilla css approach we ll use the grid of four columns so let s save the application and simply re run it App css ais Hits list display grid grid template columns repeat minmax fr gap rem Also don t forget to make some changes to the styles ResultTemplate before re running the application components ResultTemplateimport React from react const ResultTemplate hit gt return lt gt lt div className anime container gt lt h className anime wrapper gt hit name lt h gt lt div gt lt gt export default ResultTemplate anime container display flex flex direction column justify content center align items center margin bottom rem anime wrapper border radius rem and the application should now look something like this It s time to display some images of our anime movies so we ll use the img tag and simply pass hit image url as an image source followed by the styles components ResultTemplateimport React from react const ResultTemplate hit gt return lt gt lt div className anime container gt lt div className anime wrapper gt lt img className anime image src hit img url alt movie gt lt div gt lt h gt hit name lt h gt lt div gt lt gt export default ResultTemplate Styles App css anime container display flex flex direction column justify content center align items center margin bottom rem anime wrapper border radius rem anime image width height px object fit cover ais Hits list display grid grid template columns repeat minmax fr gap rem It s time to set up the list of hits that will appear on your page simply add the Configure component and specify the hitsPerPage option to configure the list of hits that you want to display in your page Finally use the Pagination widgets offered by the react instantsearch dom library to add pagination Also let s try adding facets To do so we ll add a widget which in the react instanctsearch dom library is named RefinementList and then define the attribute we want to take which in our instance would be genre and also for labeling add the Panel component as well so Finally re run the application As a result your completed code should look like this import TypesenseInstantSearchAdapter from typesense instantsearch adapter import ResultTemplate from components ResultTemplate import App css import InstantSearch SearchBox Hits Configure Pagination Panel RefinementList from react instantsearch dom const typesenseInstantsearchAdapter new TypesenseInstantSearchAdapter server apiKey animesearch nodes host localhost port protocol http additionalSearchParameters queryBy title synopsis genre queryByWeights numTypos typoTokensThreshold const App gt return lt gt lt h className super title gt ‍Anime search application built using react lt h gt lt InstantSearch indexName animes searchClient typesenseInstantsearchAdapter searchClient gt lt Configure hitsPerPage gt lt div className search container gt lt aside className results section gt lt Panel header Popularity gt lt Panel gt lt Panel header Genre gt lt RefinementList attribute genre transformItems items gt items map item gt item label item label slice searchable true showMore true limit showMoreText Show more showLessText Show less gt lt Panel gt lt Panel header Aired gt lt RefinementList attribute aired gt lt Panel gt lt aside gt lt main gt lt SearchBox gt lt div className searchbox gap gt lt div gt lt Hits hitComponent ResultTemplate gt lt Pagination gt lt main gt lt div gt lt InstantSearch gt lt gt export default App and the following is how your application should appear Finally using the same procedures as before we can add sorting capabilities to the application Add the items with the label default with the value animes to the SortBy widget component from react instantsearch dom and then create another label called ranked asc with the value animes sort popularity asc and another label called ranked desc with the value animes sort popularity desc lt SortBy items label Default value animes label ranked asc value animes sort popularity asc label ranked desc value animes sort popularity desc defaultRefinement animes gt Finally let s update the template for the information we want to display in our app for example title img url and genres so this is how your code should appear components ResultTemplateimport React from react const ResultTemplate hit gt return lt gt lt div className anime container gt lt div className anime wrapper gt lt a href hit link target blank gt lt img className anime image src hit img url alt movie gt lt a gt lt div gt lt a href hit link target blank gt lt h className anime title gt hit title lt h gt lt a gt lt h className anime genre gt Genres hit genre lt h gt lt p gt hit synopsis lt p gt lt div gt lt gt export default ResultTemplate Add a few more styles to the project to make it appear even better so the application s styles should look like this App css import url wght amp family Poppins ital wght amp display swap font family Poppins sans serif super title display flex justify content center search container display flex padding right px results section height vh padding left rem padding right rem padding top rem anime container display flex flex direction column justify content center align items center margin bottom rem anime wrapper border radius rem anime image width height px object fit cover searchbox gap padding px ais Hits list display grid grid template columns repeat minmax fr gap rem a link a visited text align center text decoration none display inline block Finally use the react instantsearch library s instantsearch css style and add it directly to the project Hence after you ve integrated everything your complete project s source code should look like this App jsimport TypesenseInstantSearchAdapter from typesense instantsearch adapter import ResultTemplate from components ResultTemplate import App css import InstantSearch SearchBox Hits Configure Pagination SortBy Panel RefinementList from react instantsearch dom import instantsearch css themes satellite css const typesenseInstantsearchAdapter new TypesenseInstantSearchAdapter server apiKey animesearch nodes host localhost port protocol http additionalSearchParameters queryBy title synopsis genre queryByWeights numTypos typoTokensThreshold const App gt return lt gt lt h className super title gt ‍Anime search application built using react lt h gt lt InstantSearch indexName animes searchClient typesenseInstantsearchAdapter searchClient gt lt Configure hitsPerPage gt lt div className search container gt lt aside className results section gt lt Panel header Popularity gt lt SortBy items label Default value animes label ranked asc value animes sort popularity asc label ranked desc value animes sort popularity desc defaultRefinement animes gt lt Panel gt lt Panel header Genre gt lt RefinementList attribute genre transformItems items gt items map item gt item label item label slice searchable true showMore true limit showMoreText Show more showLessText Show less gt lt Panel gt lt Panel header Aired gt lt RefinementList attribute aired gt lt Panel gt lt aside gt lt main gt lt SearchBox gt lt div className searchbox gap gt lt div gt lt Hits hitComponent ResultTemplate gt lt Pagination gt lt main gt lt div gt lt InstantSearch gt lt gt export default App Let s take a look at the final version of our typesense integrated Anime search application Entire source code of the application can be found hereJoin Aviyel s community to learn more about the open source project get tips on how to contribute and join active dev groups Aviyel is a collaborative platform that assists open source project communities in monetizing and long term sustainability To know more visit Aviyel com and find great blogs and events just like this one Sign up now for early access and don t forget to follow us on our socials Follow aviyelHQ or sign up on Aviyel for early access if you are a project maintainer contributor or just an Open Source enthusiast Join Aviyel s Discord gt Aviyel s worldTwitter gt 2022-03-31 07:46:10
海外TECH DEV Community Simple Age and Gender detection using Python and OpenCV https://dev.to/ethand91/simple-age-and-gender-detection-using-python-and-opencv-319h Simple Age and Gender detection using Python and OpenCV IntroductionHello In this tutorial I will show how to create a simple age and gender detector using Python and OpenCV RequirementsPython Creating the python virtual environmentCreating a virtualenv using python is very simple and you don t need to install any modules etc python m venv envThen we just need to activate it source env bin activateThis example requires only the opencv python so we will define this in the requirements txt file opencv pythonSave it and then install the requirements via pip install r requirements txtThis will install opencv python into the virtual environment that was created Downloading the necessary models weightsThe models and weights needed for this can be found via All you need to do is download them and put them into a directory called weights Creating the Python fileNow we can finally get started writing Python first we need to import the required modules Importing the modulesimport cvimport mathimport sys Define the model weight filesNext we need to define and load the models and weights etc Defined the model filesFACE PROTO weights opencv face detector pbtxt FACE MODEL weights opencv face detector uint pb AGE PROTO weights age deploy prototxt AGE MODEL weights age net caffemodel GENDER PROTO weights gender deploy prototxt GENDER MODEL weights gender net caffemodel Load networkFACE NET cv dnn readNet FACE MODEL FACE PROTO AGE NET cv dnn readNet AGE MODEL AGE PROTO GENDER NET cv dnn readNet GENDER MODEL GENDER PROTO MODEL MEAN VALUES AGE LIST GENDER LIST Male Female box padding Getting the bounding box coordinatesNext we need to get the face coordinates and we also draw a rectangle on the image via the following def get face box net frame conf threshold frame copy frame copy frame height frame copy shape frame width frame copy shape blob cv dnn blobFromImage frame copy True False net setInput blob detections net forward boxes for i in range detections shape confidence detections i if confidence gt conf threshold x int detections i frame width y int detections i frame height x int detections i frame width y int detections i frame height boxes append x y x y cv rectangle frame copy x y x y int round frame height return frame copy boxes Predicting age and genderNext we use the following to predict the age and gender of the person we also draw the age and gender on the image via def age gender detector input path image cv imread input path resized image cv resize image frame resized image copy frame face boxes get face box FACE NET frame for box in boxes face frame max box box padding min box box padding frame shape max box box padding min box box padding frame shape blob cv dnn blobFromImage face MODEL MEAN VALUES swapRB False GENDER NET setInput blob gender predictions GENDER NET forward gender GENDER LIST gender predictions argmax print Gender conf f format gender gender predictions max AGE NET setInput blob age predictions AGE NET forward age AGE LIST age predictions argmax print Age conf f format age age predictions max label format gender age cv putText frame face label box box cv FONT HERSHEY SIMPLEX cv LINE AA return frame face Writing mainFinally we write the starting point of the program if name main output age gender detector sys argv cv imwrite output output jpg output cv imshow Output output cv waitKey cv destroyAllWindows Here we take the file path as argv and predict the age and gender of the people in the image The output is also written to the output directory you may need to create this directory before running After this the output is shown to the user until the user presses any key Usage example python main py lena jpgIf all goes well the following should be displayed Feel free to try it with different images Github Repo Like me work I post about a variety of topics if you would like to see more please like and follow me Also I love coffee 2022-03-31 07:21:23
海外TECH DEV Community Star Admin - Open-Source Django Starter https://dev.to/sm0ke/star-admin-open-source-django-starter-3894 Star Admin Open Source Django StarterHello Coders This article presents an open source Django Starter built with basic modules authentication and Docker support on top of a modern Bootstrap Design Django Star Admin can be downloaded from Github MIT License and used in commercial projects or eLearning activities For newcomers Django is a leading web framework actively supported and versioned by programming experts Thanks for reading Star Admin Django product pageStar Admin Django LIVE deploymentMore Free Starters provided by AppSeedStar Admin Bootstrap is a beautifully designed admin template featuring a fine selection of useful Bootstrap components and elements Star Admin has impressive typography that compliments exceedingly with its colorful and elegant interface The pre built pages of the templates are intuitive and very well designed Star Admin is sure to make your development process truly enjoyable Django Codebase FeaturesDjango codebase is crafted using a simple modular structure that follows the best practices and provides authentication database configuration and deployment scripts for Docker a popular virtualization software Any developer with basic Django Python knowledge by following the product documentation should be able to compile and use the app by typing only a few lines in the terminal Up to date dependenciesSCSS compilation via GulpUI Ready app SQLite Database Django Native ORMSession Based authentication Forms validationDeployment Docker Gunicorn Nginx HEROKUSupport via Github issues tracker and Discord Sample Pages If you want to get inspiration or just show something directly to your clients you can jump start your development with our pre built example pages Thanks for reading For more resources feel free to access More Free Dashboards crafted in Django Flask and ReactMore Admin Dashboards a huge index with products 2022-03-31 07:17:32
海外TECH DEV Community How To Learn And Get Better At Web Development https://dev.to/muditwt/how-to-learn-and-get-better-at-web-development-12pi How To Learn And Get Better At Web DevelopmentFirst ask yourself what do you want to do Do you just want to know about the basics of web development or want to get really good at it If you just want to know about it you ll not face many problems learning resources are very easily accessible The real task is getting better at development If you want to get better at the development you need to do three things Keep learning new technologies ApplyTeach others and document Keep Learning New Technologies Once you choose tech as your career the one thing that is never going to stop is learning You will always be a student You can not be rigid in this space it s always changing there is always something new to learn But this should not scare you because once you learn a technology and get good at it moving to a new tech becomes easier After all the fundamentals of every tech are somewhat the same So first you need to pick a domain in our case it s web development Learn its basics i e the minimum amount of knowledge you need to get started HTML CSS JavaScript Practice what you have learned by building projectsStart with small ones and then move to bigger projects Once you get hold of the fundamentals you can switch to any new technology So first you have to learn the fundamentals and then keep an eye on the new trends and learn what excites you the most Learning Resources We have discussed how you have to learn so now lets see from where you can learn freeCodeCampYouTubeUdemyTechnical Blogs Hashnode Dev to Medium freecodecampDocumentation MDN docs freeCodeCampfreecodecamp is a non profit organization that provides quality courses on various domains including web development It s one of the best resources that are present out there they also have a YouTube channel that is full of educational videos on various topics and they provide all of this for free It s a gold mine for learners If you are a beginner then I would highly recommend you to check out their website and YouTube channel YouTubeThis is something that s obviously not new for anyone But you know what YouTube has more than just music and cute cat videos I ll list down some quality channels for you to learn web development and web designing G O A T and beginner friendlyfreecodecampTraversy MediaThe Net NinjaFireship New tech information Coder Coder Web Dev Programming with Mosh Everything Kevin Powell CSS Wes Bos New tech and tips Codevolution Code along tutorial Adrian Twarog Mostly for web design Dev Ed Web Design and Dev DesignCourse UI UX I don t think you ll need anything more than this I have listed quite a few channels to learn from but keep in mind not to get lost in these videos Just stick to one or two channels courses If you really want to grow as a developer then just watching the videos is not going to help you Learn enough to start a small project and then learn along with the project UdemyOn Udemy you can get quality paid courses to learn web development Few of these courses might be from educators you already know through YouTube The courses are on demand and self paced so you can watch them anytime and at your own pace These are a few popular courses on Udemy for full stack web development By Colt SteeleBy Angela Yu Technical BlogsTechnical blogs are not only a good resource for new tech news and trends but also a great way to learn These blogs are written by fellow learners like you Blogs will teach you a specific concept in very less time You need to have a profile on these blogging websites and have to keep them checking from time to time HashnodeDev toMediumfreecodecamp DocumentationIf you don t like learning through watching videos or you want to quickly revise then learning through documentation can be your path Some documentation websites that you need on your bookmark bar MDN Web DocswschoolsEloquent JavaScript A eBook not a documentation javaScript infoOther than these you can also refer to the tech specific documentation like react js and node js documentation Application This is the most important step and ironically most people fail here Just mugging up the information will not make you a developer If you want to get better at development then you need to practice development A developer is not someone who knows everything about tech you don t have to mug up every single concept of web development You ll forget things and that s okay You have google you don t have to memorize things You only need to retain the core concepts You have to know how exactly a certain thing works and that will only happen when you ll apply what you know Don t just make those tutorial projects work on projects that you can use in your daily life Contribute to open source There are a few websites that you can use to practice frontend web dev CSSBattleCodePen challengesFrontend mentorCodewell Teach others and document This is also a very important part and can give you an edge over other people who are at the same experience level as you Through teaching others and documenting I mean learning in public and building in public Learning a new technical skill can be tough you will face many problems and you ll need help from other people this is where learning in public will help you When you learn in public you network with people in that space people who are at the same level as you and might be facing the same problems as you people who are more experienced and have gone through those issues and know how to solve them You connect with a very supportive tech community and this community will not just help you when you get stuck it ll also be a boon to your knowledge Learning in public has huge benefits you might end up getting an internship freelancing project or even a job offer Your profile will be proof of your work There are many ways by which you can share your work and learning You can write blogs on the very website you read them as you are doing right now you can tweet about it and if you have more free time to spare you can even make videos So build learn in public Let others know what are you working on or learning Open yourself to the opportunities waiting for you Conclusion Learn enough to get started and then learn while building There are a plethora of resources to learn don t get confused pick any one or two and stick to it Try not to fall into tutorial hell and focus more on creating projects Open yourself to the world and share what you know be more discoverable If you are still here thanks for reading 2022-03-31 07:04:36
海外TECH DEV Community Dependency Injection in Spring Boot https://dev.to/coder4_life/dependency-injection-in-spring-boot-15md bootthis 2022-03-31 07:04:25
海外TECH DEV Community Instagram style stories in ReactJs https://dev.to/hannadrehman/instagram-style-stories-in-reactjs-59d9 Instagram style stories in ReactJsSince the launch of Snapchat stories every major social media platform has introduced stories format in their platform so i tried to recreate the same format in ReactJs I created a simple Stories component which allows your to add stories format to your web application in few seconds Introducing Stories React Installnpm install save stories react Usageimport React from react import Stories from stories react import stories react dist index css function ImagesStories const stories type image url duration type image duration url duration type image url type image duration url type image url duration type image duration url return lt Stories width px height px stories stories gt export default function App return lt div className App gt lt ImagesStories gt lt div gt DemoCodeSandbox demoAll Story type demos ReferencesStories React Blog post 2022-03-31 07:04:25
海外TECH DEV Community Tatum Opens Celo’s Entire NFT Ecosystem to Developers https://dev.to/tatum/tatum-opens-celos-entire-nft-ecosystem-to-developers-4k5e Tatum Opens Celo s Entire NFT Ecosystem to DevelopersWe at Tatum have been big fans of Celo for a while now What s not to love Blazing fast transaction times minimal gas fees full EVM compatibility all backed by a fantastic team and a mission statement that we can really get behind “To build a financial system that creates the conditions for prosperity ーfor everyone We love Celo so much that we ve built more features for the blockchain than any other we support in our platform And now we re partnering with Celo to help more developers build better NFT apps faster than ever before We want to make sure any developer ーand we really mean ANY developer ーcan do everything they need to build full fledged dapps on Celo We ve built a suite of tools for creating anything you need using our SDKs and API and where they really shine is for making cutting edge dapps in Celo s thriving NFT ecosystem All the NFT Tools You NeedSo let s break down exactly what we mean by this Let s say you re a developer with zero blockchain experience who wants to build an NFT app or marketplace What will you need to do on Celo to make this happen Your users need a place to hold their NFTsSo you ll need to create wallets for them You can easily do that with our SDK or API but most users won t want to be bothered with securely storing their private keys And with Tatum Key Management System KMS they won t have to KMS allows you to build full custodial solutions to locally generate wallets private keys and deposit addresses and to securely sign transactions on premise Security unlimited scalability and it s ready to go out of the box Your users can just log in with their credentials and KMS takes care of the rest Now how are you going to make those NFTs Whether you re allowing your users to mint NFTs or creating your own collections to sell in your app or marketplace you ll need some way to create NFTs If you do this yourself from scratch you ll need to learn Solidity to code your own NFT smart contract And this will take you A LOT of time and effort to get right But with Tatum you can create NFTs without ever learning Solidity We ve already created prebuilt smart contracts for you to rapidly deploy and they re ready to go with just API call You can be up and minting NFTs in minutes instead of months and you can easily build NFT features into your app for your end users to mint their own We ve got ready to go ERC smart contracts ERC s to create shared ownership NFTs and other advanced use cases and even have ERC smart contracts if you want to create your own cryptocurrency on Celo We ve also got ready to go royalty NFTs that record provenance data and can pay percentage royalties to multiple authors in any ERC token you want But that s a whole other discussion in and of itself Notifications for any token transferNow that you ve created your NFT collection you ll want to be able to send NFTs to different Celo account addresses Don t worry we ve got an endpoint for that too And what s more you can also set up webhook notifications for any account address on Celo ーfor any kind of token and for both incoming and outgoing transactions With just a couple of lines of code you can instantly notify your users when they receive NFTs CELO cUSD cEUR cREAL or any other ERC or ERC tokens This is normally really difficult but with Tatum it s just a matter of API call Instantly look up NFT dataYour app s end users will definitely want to see the awesome NFTs in their collection and you can easily let them with our Get NFT metadata endpoint But that s just the beginning You can look up NFTs by token address different transactions and a wide variety of other parameters You can show your users everything they need and create a seamless NFT app experience on Celo And That s Just a Little TasteAs we mentioned earlier we ve got more features available for Celo than any other platform and it s honestly far too much to cover in just one article But you should really check out our instant NFT marketplace smart contracts gas pump automatically pay for your users gas fees and all the insane features that come with Tatum s virtual accounts We hope this gives you an idea of the potential and we hope you re as excited as we are about building NFT apps on Celo For a full list of the features available to you on Celo head on over to our Celo Tatum page And if you re ready to start building we ve got some news for you… Build for Free and Win BountiesTo kick off our partnership in style we re offering some serious incentives to help you start building on Celo The first developers to sign up for the promo offer will have their Tatum Free Plans upgraded to Basic Plans usually month for months Our Basic plan is actually one of the least basic plans around you can use everything in Tatum and you get API requests per second and million requests per month ーway more than you re gonna need This promo is on a first come first served basis so sign up fast to get one And to top it off we re also offering some serious bounties for projects built on Celo using Tatum A joint panel of Tatum Celo judges will be evaluating every submitted project and the top will receive k worth of CELO or cUSD each For more information on the bounties head on over to the following Celo GitCoin pages and get building Create an NFT marketplace using Tatum s APIs to integrate CeloUsing NFT Express create a mobile app that allows users to mint NFTs on CeloIntegrate in game NFTs and an ERC currency into a mobile game using Tatum s SDK for CeloLearn more about Tatum visit tatum io While this Tatum plan is free use of it requires paying normal Celo mainnet gas fees About CeloCelo is a carbon negative layer protocol with a rich ecosystem of global partners building Web applications including in DeFi NFTs and payments in support of Celo s mission to create a more accessible and inclusive global financial system Accessible to anyone with a smartphone the Celo ecosystem consists of a decentralized proof of stake blockchain technology stack Celo Protocol the CELO token and stablecoins cUSD cEUR cREAL Additionally the ecosystem is supported by the Alliance for Prosperity which consists of over mission aligned Celo Foundation members around the globe including Deutsche Telekom PayU Opera Andreessen Horowitz Anchorage Coinbase GSMA Grameen Foundation Prosegur Abra and cLabs a service organization dedicated to growing and developing the Celo ecosystem For more information visit the Celo Foundation ‍We re hiring 2022-03-31 07:03:01
海外TECH DEV Community CSS NeuBrutalism Card https://dev.to/alexpaper/css-neubrutalism-card-4n45 CSS NeuBrutalism CardMaybe you already know the new UI super cool trend is neubrutalismthis is M Malewicz definition Neo brutalism ditches most of that and merges traditional layout concepts with super high contrast solid often purposefully clashing colors and simpler yet quirky typography People think I can do this myself But it s not that simple This is a super brutal first attempt VideoYou can read the full M Malewicz article here 2022-03-31 07:01:36
海外TECH DEV Community Modern REST API design principles and rules https://dev.to/digitallyrajat/modern-rest-api-design-principles-and-rules-lgd Modern REST API design principles and rulesTypically when updating or developing an API like Newsdata io which is a news API for a service to provide news data with quick response time there are lengthy discussions about the API s structure naming and functions Although over time certain rules have emerged that can be applied to the process and aid in reaching a common ground while developing Let s get started with some basics What is an API API is an abbreviation for Application Programming Interface It is a software interface that allows two applications to communicate with one another without the need for user intervention APIs enable a product or service to communicate with other products and services without requiring knowledge of how they are implemented It facilitates communication between the provider and the client It is a type of software interface that provides a service to other programs An API specification is a document or standard that describes how to build or use such a connection or interface An API is said to be implemented or exposed by a computer system that meets this standard API can refer to either the specification or the implementation What is REST REST was created to work specifically with components such as media components files or even objects on a specific hardware device A RestFul web service is any web service that adheres to the REST principles For working with the required components a Restful service would use the standard HTTP verbs GET POST PUT and DELETE REST is an acronym that stands for Representational State Transfer GET ーrequests a representation of the specified resource Requests using GET should only retrieve data POST ーsubmits data to the specified resource PUT ーreplaces all current representations of the target resource with the request data DELETE ーdeletes the specified resource PATCH ーapplies partial modifications to a resource When to use REST When designing web services one of the most contentious issues is whether REST or SOAP should be used In the following situations REST services should be used Limited resources and bandwidth ーBecause SOAP messages are heavier in content and consume far more bandwidth REST should be used when network bandwidth is limited Statelessness ーIf there is no need to keep information in a consistent state from one request to the next REST should be used If you need a proper information flow where some information from one request needs to flow into another SOAP is a better choice We can use any online shopping site as an example Typically these sites require the user to first add items that must be purchased to a cart To complete the purchase all of the cart items are transferred to the payment page This is an example of an application that would benefit from the state feature The cart items state must be transferred to the payment page for further processing Caching ーIf a large number of requests must be cached REST is the ideal solution Clients may request the same resource multiple times at times This may result in an increase in the number of requests sent to the server The most frequently used query results can be saved in an intermediate location by implementing a cache As a result whenever a client requests a resource it will first check the cache If the resources are available the process will not proceed to the server As a result caching can aid in reducing the number of trips to the web server Ease of coding ーCoding REST Services and then implementing them is far easier than SOAP So if you need a quick win solution for web services REST is the way to go REST is the most common API architecture in today s world representational state transfer When using REST you must adhere to JSON rules and format your requests in invalid JSON Aside from that a good API should adhere to the following guidelines APIs must be separated from the backend data storage client and so on Because of security and flexibility it must be a separate layer State less ーdifferent requests should have no knowledge of one another and be processed independently That also means that each request must include all of the information required for processing API should function in the same way regardless of whether a client sends a request e g is it a web server or load balancer or any other client REST APIs typically send static resources but responses can also contain executable code in rare cases such as Java applets In these cases the code should only be executed when needed Cacheability ーResources should be cacheable on the client or server side whenever possible The goal is to improve client side performance while increasing server side scalability However there are special headers such as Cache Control that can be used to control the cache behavior Handle errors and return the appropriate error codes Instead of throwing an internal error to the user handle it and send the corresponding code and message e g ーnot found Remember that API should be idempotent that means that can be invoked many times with the same result Users can sometimes send duplicate requests to the API These duplicate requests may have been made inadvertently or intentionally due to timeout or network issues As a result APIs must be fault tolerant in order for duplicate requests to yield the same results only POST request is not idempotent To create documentation for your API use swagger or another tool Documentation is a critical component if someone going to use that API someday There are also some good manners in naming endpoints as well Endpoints should be named with nouns that specify the contents of the resource rather than adding a verb for the function that is being performed e g name endpoint users and use different HTTP methods for working with the user s entity rather than creating several endpoints like get user add user etc Use clear names The name of the endpoint should be clear and intuitive do not use any shortcuts or abbreviations unless they are obvious ー ids are understandable and preferable to identification numbers Forward slashes are used to create a hierarchy by grouping endpoints into logical groups departments ids and departments managers are preferable to departments ids and departments managers Use only lowercase letters Because URIs are case sensitive according to the specification it is best to avoid using upper case unless absolutely necessary Separate words with “ different words in the endpoint name are usually separated by “ rather than underscores or camel case Avoid special characters URLs can only be sent and received using the ASCII character set so it is possible to use only characters from that set also there are some expectable but unsafe characters like “percent “ lt gt and it is better to try to avoid using them as well The majority of REST APIs are built in conjunction with microservice architecture In that case an API structure like this will allow you to change the underlying logic add or remove components and so on without changing the communication protocol with other services What are the challenges in REST API Lack of Security ー Unlike SOAP REST does not impose any type of security This is why REST is ideal for publicly accessible URLs but when it comes to passing confidential data between the client and the server REST is the worst mechanism to use for web services Lack of state ー Most web applications necessitate the use of a stateful mechanism For example if you had a purchasing site with a shopping cart mechanism it is necessary to know the number of items in the shopping cart before the actual purchase is made Unfortunately the client bears the burden of maintaining this state which makes the client application heavier and more difficult to maintain References 2022-03-31 07:00:44
金融 RSS FILE - 日本証券業協会 選択権付債券売買取引状況 https://www.jsda.or.jp/shiryoshitsu/toukei/sentaku/index.html 選択 2022-03-31 09:00:00
金融 RSS FILE - 日本証券業協会 短期社債等及び私募社債の取引状況等 https://www.jsda.or.jp/shiryoshitsu/toukei/kokunai/index.html 私募 2022-03-31 09:00:00
金融 RSS FILE - 日本証券業協会 インターネット取引に係る株式売買等データ(月次) https://www.jsda.or.jp/shiryoshitsu/toukei/datakaiji.html 株式 2022-03-31 09:00:00
金融 JPX マーケットニュース [東証]上場廃止に係る猶予期間入り:ビート・ホールディングス・リミテッド https://www.jpx.co.jp/news/1021/20220331-02.html 上場廃止 2022-03-31 17:00:00
金融 JPX マーケットニュース [東証]特設注意市場銘柄の指定解除及び監理銘柄(審査中)の指定解除:第一商品(株) https://www.jpx.co.jp/news/1023/20220331-12.html 特設注意市場銘柄 2022-03-31 17:00:00
金融 日本銀行:RSS 長期国債買入れ(利回り・価格入札方式)の四半期予定(2022年4~6月) http://www.boj.or.jp/announcements/release_2022/rel220331c.pdf 長期 2022-03-31 17:00:00
金融 日本銀行:RSS 米ドル資金供給オペレーションのオファー日程(2022年4月~6月) http://www.boj.or.jp/announcements/release_2022/rel220331b.pdf 資金供給オペレーション 2022-03-31 17:00:00
金融 日本銀行:RSS CP・社債等買入のオファー日程(2022年4月~5月) http://www.boj.or.jp/announcements/release_2022/rel220331a.pdf 買入 2022-03-31 17:00:00
金融 日本銀行:RSS 第3回LIBOR利用状況調査の結果概要について http://www.boj.or.jp/announcements/release_2022/rel220331d.htm libor 2022-03-31 17:00:00
ニュース BBC News - Home Ukraine war: Ukraine sends buses to Mariupol for rescue effort https://www.bbc.co.uk/news/world-europe-60938429?at_medium=RSS&at_campaign=KARANGA convoy 2022-03-31 07:38:13
ニュース BBC News - Home Shrewsbury maternity deaths scandal will spark change - Javid https://www.bbc.co.uk/news/uk-england-shropshire-60933936?at_medium=RSS&at_campaign=KARANGA maternity 2022-03-31 07:41:30
ニュース BBC News - Home IndiGo airlines: India man hacks into airline website to find lost luggage https://www.bbc.co.uk/news/world-asia-india-60937480?at_medium=RSS&at_campaign=KARANGA airline 2022-03-31 07:53:25
ニュース BBC News - Home Women's World Cup: England beat South Africa to book final date with Australia https://www.bbc.co.uk/sport/cricket/60936551?at_medium=RSS&at_campaign=KARANGA Women x s World Cup England beat South Africa to book final date with AustraliaEngland will face Australia in the final of the Women s World Cup after Danni Wyatt s magnificent century propels the defending champions to victory over South Africa 2022-03-31 07:53:27
ニュース BBC News - Home Fifa World Cup Qatar 2022: Can you name the teams to have qualified? https://www.bbc.co.uk/sport/football/60919718?at_medium=RSS&at_campaign=KARANGA world 2022-03-31 07:22:41
北海道 北海道新聞 旭医大病院長に古川氏が復帰へ 4月1日付 昨年1月に解任 https://www.hokkaido-np.co.jp/article/663657/ 吉田晃敏 2022-03-31 16:34:31
北海道 北海道新聞 クマに襲われ2人負傷 札幌市西区の三角山 https://www.hokkaido-np.co.jp/article/663655/ 札幌市西区 2022-03-31 16:30:19
北海道 北海道新聞 魚に囲まれ「水中入社式」 鳥羽水族館、初仕事にも挑戦 https://www.hokkaido-np.co.jp/article/663660/ 三重県鳥羽市 2022-03-31 16:18:51
北海道 北海道新聞 IEA、石油備蓄の放出協議へ 原油高抑制、日本同調か https://www.hokkaido-np.co.jp/article/663661/ 国際エネルギー機関 2022-03-31 16:17:05
北海道 北海道新聞 水道事業、4月1日から民営化 宮城県が運営権売却 https://www.hokkaido-np.co.jp/article/663674/ 上下水道 2022-03-31 16:23:00
北海道 北海道新聞 道南の143人感染 新型コロナ https://www.hokkaido-np.co.jp/article/663659/ 新型コロナウイルス 2022-03-31 16:06:00
IT 週刊アスキー 限定グルメやお得な食事券を販売、KITTE博多「6TH ANNIVERSARY」4月8日から https://weekly.ascii.jp/elem/000/004/087/4087951/ thanniversary 2022-03-31 16:45:00
IT 週刊アスキー UNI COFFEE ROASTERY MARK IS みなとみらいにてオカムラ「OC(オーシー)」を体験設置 https://weekly.ascii.jp/elem/000/004/087/4087934/ grace 2022-03-31 16:30:00
IT 週刊アスキー 初ガツオの季節! ⼤⼾屋「かつおの梅はさみ揚げ」「鰹のたたき小丼」期間限定で発売 https://weekly.ascii.jp/elem/000/004/087/4087877/ 期間限定 2022-03-31 16:15:00
マーケティング AdverTimes 日本のディスプレイ広告ビューアビリティは世界ワースト1位 IAS調査より https://www.advertimes.com/20220331/article380677/ 日本のディスプレイ広告ビューアビリティは世界ワースト位IAS調査よりアドベリフィケーションツールを提供するIntegralAdScienceインテグラルアドサイエンス、以下IASは、「メディアクオリティレポート第版」を公開した。 2022-03-31 07:35:32
マーケティング AdverTimes 前年比300%の販売を達成した、メディアコラボの裏側(ニチバン×中京テレビ) https://www.advertimes.com/20220331/article380653/ 中京テレビ 2022-03-31 07:22:52
マーケティング AdverTimes 日テレHD、ムラヤマHDを買収 イベントや不動産開発強化 https://www.advertimes.com/20220331/article380661/ 相乗効果 2022-03-31 07:07:41

コメント

このブログの人気の投稿

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

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

投稿時間:2020-12-01 09:41:49 RSSフィード2020-12-01 09:00 分まとめ(69件)