TECH |
Engadget Japanese |
Amazon新生活セールで最大20%オフ! Shokzの骨伝導イヤホンで在宅ワークを快適に |
https://japanese.engadget.com/new-life-sale-shokz-080717487.html
|
aftershokz |
2022-03-26 08:07:17 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
Pybullet + Chainerを使って強化学習で歩行動作を習得する |
https://qiita.com/KProgramed/items/f256bc0d6e5d27224da2
|
次は、状態sと行動aからQ値を出力する関数についてです。 |
2022-03-26 17:15:29 |
js |
JavaScriptタグが付けられた新着投稿 - Qiita |
dアニメストアでもウォッチパーティーができるChrome拡張機能『d-party』を公開しました |
https://qiita.com/U-Not/items/bec21a113764c0fb4c1c
|
例にももれず、dpartyも初めはこうした任意コード実行を多用していたため、作っていた一部の機能が移行できないという問題が発生しました。 |
2022-03-26 17:26:02 |
AWS |
AWSタグが付けられた新着投稿 - Qiita |
IAMロールで社外の人へのアクセス権付与 |
https://qiita.com/talomina/items/5a37f8a7476f51f3c496
|
社外からアクセスされるためのロールを作成するコンソールから下記のタイプのロールを選択し別のAWSアカウントを選択してawsbのアカウントIDを指定します。 |
2022-03-26 17:45:39 |
AWS |
AWSタグが付けられた新着投稿 - Qiita |
Cloud9上のSAM CLIをアップグレードする |
https://qiita.com/Keiichi_Kinoshita/items/c154d12c4b0090c0c52c
|
Cloud環境上での各AWSリソースへのアクセス権限はAWSManagedTemporaryCredentialsという一時的な認証の仕組みで、Cloud環境を作成した環境オーナーのIAMユーザーとほぼ同等の権限IAM関連などの一部のオペレーションは制限されているがデフォルトで利用できるようになっています。 |
2022-03-26 17:35:15 |
AWS |
AWSタグが付けられた新着投稿 - Qiita |
AWS Cloud9で実行するAWS CLIの権限について |
https://qiita.com/Regryp/items/659a34f3b0e2219c9c09
|
CloudでAWSCLI等を実行する場合の権限以下の公式マニュアルに記載がありますが、どうやらCloudを呼び出している元のIAMユーザの権限をチェックし、そのユーザがリクエストされたアクションを実行する権限があるかをチェック、なおかつAWSマネージド一時認証情報なるものをチェック、許可されたアクションであれば実行が許可されるようです。 |
2022-03-26 17:03:08 |
Docker |
dockerタグが付けられた新着投稿 - Qiita |
[Docker]Nginx+PHP-FPMのコンテナのアクセスログが二重に出てハマった件 |
https://qiita.com/2done/items/7aa4833e87e0cb6fc349
|
DockerNginxPHPFPMのコンテナのアクセスログが二重に出てハマった件はじめにNginxとPHPFPMをsupervisorで起動したDockerコンテナ内にLaravel環境を作っていました。 |
2022-03-26 17:14:57 |
海外TECH |
MakeUseOf |
5 Best Sites for Pitch Deck Templates and Examples of Successful Startups |
https://www.makeuseof.com/sites-pitch-deck-templates-successful-startups/
|
Best Sites for Pitch Deck Templates and Examples of Successful StartupsThese websites collect pitch decks by successful startups and even offer some as templates so you can learn what they did right |
2022-03-26 08:30:13 |
海外TECH |
DEV Community |
Hello World |
https://dev.to/iambize/dang-ky-lap-dat-wifi-khong-day-ton-bao-nhieu-tien-1-thang-4en5
|
programmer |
2022-03-26 08:38:00 |
海外TECH |
DEV Community |
What tips will you give to a newbie JavaScript learner? |
https://dev.to/amolshelke2/what-tips-will-you-give-to-a-newbie-javascript-learner-3f09
|
javascript |
2022-03-26 08:37:43 |
海外TECH |
DEV Community |
Simple Cookies with Node.js and any frontend JavaScript framework |
https://dev.to/saranshabd/simple-cookies-with-nodejs-and-any-frontend-javascript-framework-42ph
|
Simple Cookies with Node js and any frontend JavaScript frameworkFact Elite programmers do simple things It s the idiots who complicate things just to look smart Why another one We all have come across blogs to set up HTTP cookies with Node js and React js or any other frontend framework and let s be honest it s hard to find an article with all the information we need to set up our project Out there you find a lot of ifs and buts in configurations so I ll just tell you what you need to make it work that s it I ll keep this one short and to the point AgendaLet s start with what our setup will look like Separate configurations for development and production environments that s something missing from all the blogs out there Configure the frontend axios library to allow the backend to set cookies on the browser Configure the backend API to set a cookie with the right configurations just the ones you need and care about AssumptionsI am assuming you will be hosting the frontend and the backend API on separate domains Just to clarify api example com and example com are also counted as two separate domains Frontend configurationsOn the frontend I assume you will use a third party library like axios to make requests to your server I will advise you to create a new instance of Axios with all the customised default configurations and use this instance everywhere else in your project Create Axios instance with custom default configurationsThe create function allows you to set different configurations for different types of requests that you want to make to the backend For example you could have an Axios instance for making authenticated requests and another one for making unauthenticated requests utils axios jsimport axios from axios const axiosInstance axios create baseURL optional but recommended withCredentials true to allow your API to set cookies on the browser export default axiosInstance It s just a better way of doing things You re done with frontend configurations You can now use this newly created Axios instance to make requests to the backend like you normally would For example utils api jsimport axios from utils axios function fetchProducts return axios get products all Notice how you don t have to set the base URL every single time now You re welcome Backend configurationsYou will just need to install a single library to your project CORS Environment variablesCreate an environment variable to store the frontend URL If you are running the project in the development environment then you might set it to http localhost or if you are running it in production then it might be envFRONTEND URL http localhost You can use a third party library like dotenv to load environment variables from the env file Set up Express appConfigure CORS and default response headers to be able to set cookies on the frontend browser index jsimport express from express import cors from cors async function main const app express your Express app configurations allow the frontend to make requests to your API app use cors origin process env FRONTEND URL credentials true set headers for you to be able to set cookies on the browser app use res next gt res header Access Control Allow Origin process env FRONTEND URL res header Access Control Allow Headers res header Access Control Allow Credentials true next your rest of the configurations app listen process env PORT gt console log App is up and running main again just a better way of doing thingsAnd that s all you need to set up cookies on your backend project You can now start setting cookies in your endpoint responses Set cookies with working configurationsYou can use the given format to set cookies in both development and production environments using the automatically set environment variable NODE ENV routes auth jsconst isInDevelopment process env NODE ENV development const cookieConfigs httpOnly true sameSite isInDevelopment false none secure isInDevelopment false true maxAge one year router post signIn req res gt your own login res cookie cookie name cookie value cookieConfigs res status send read about HTTP status ConclusionThat s it No more wandering from one Stackoverflow answer to another in search of workable cookies configurations with Node js Do like the article if you found this helpful and or drop a comment if there s anything I missed or anything you d like me to cover in another article Signing off |
2022-03-26 08:17:21 |
海外TECH |
DEV Community |
Dart Sort List of objects Descending |
https://dev.to/tienbku/dart-sort-list-of-objects-descending-57go
|
Dart Sort List of objects DescendingIn this tutorial we ll show you some ways and functions to sort list of Objects descending in Dart FlutterSimilar to Ascending order but you can do this with three ways using custom compare function extending Comparable abstract class override compareTo method and using reversed extending Comparable abstract class override compareTo method and using fast immutable collections library Full post Dart Flutter Sort List of objectsDart Flutter Sort List of objects Descending using custom compare functionPass a custom compare function into list s sort method with swap the places of the items class Customer String name int age Customer this name this age override String toString return this name this age main List lt Customer gt customers customers add Customer Jack customers add Customer Adam customers add Customer Katherin customers sort a b gt b age compareTo a age print Sort by Age customers toString customers sort a b gt b name compareTo a name print Sort by Name customers toString Output Sort by Age Adam Katherin Jack Sort by Name Katherin Jack Adam Dart Flutter Sort List of objects Descending using Comparable abstract classWe can sort a List of objects in Descending order using reversed property It returns an Iterable of the objects in the list class Customer extends Comparable String name int age Customer this name this age override String toString return this name this age sort by Name asc override int compareTo other return this name compareTo other name main List lt Customer gt customers customers add Customer Jack customers add Customer Adam customers add Customer Katherin customers reversed toList print customers Output Katherin Jack Adam Firstly we extend Comparable abstract class and override compareTo method then we call list reversed toList reversed does NOT reverse the list Instead it sorts the original list in Ascending order then returns a Descending Iterable SO we need toList finally However how about large lists Let s look at another approach Dart Flutter Sort List of objects Descending using a libraryWe can create our immutable collections and use Fast Immutable Collections library directly The class is the same as previous approach extends Comparable and override compareTo method But it uses sortReversed which is much faster class Customer extends Comparable override int compareTo other return this name compareTo other name main List lt Customer gt customers customers add Customer Jack customers add Customer Adam customers add Customer Katherin customers sortReversed print customers Output Katherin Jack Adam Further ReadingDart Flutter List Tutorial with ExamplesDart Flutter Constructors tutorial with examplesDart Flutter String Methods amp Operators tutorial with examplesDart Flutter Future Tutorial with ExamplesDart Flutter Map Tutorial with ExamplesDart Flutter Convert Object to JSON stringDart Flutter Convert Parse JSON string array into Object ListDart Flutter Convert List to Map amp Map to List |
2022-03-26 08:10:05 |
海外TECH |
DEV Community |
Dart sort List by two fields |
https://dev.to/tienbku/dart-sort-list-by-two-fields-21ae
|
Dart sort List by two fieldsIn this tutorial we ll show you some ways and functions to sort list by two fields in Dart FlutterFor sorting multiple fields or two fields for this tutorial I will also show you two ways using custom compare function extending Comparable abstract class and override compareTo methodFull post Dart Flutter Sort List of objectsDart Sort list by two fields using custom compare functionWe re gonna pass a more complicated custom compare function into list s sort method First we sort the list of objects by field name then field age class Customer String name int age Customer this name this age override String toString return this name this age main List lt Customer gt customers customers add Customer Jack customers add Customer Adam customers add Customer Katherin customers sort a b int nameComp a name compareTo b name if nameComp return a age compareTo b age for descending return nameComp print Sort by Name ASC then Age DESC n customers toString Output Sort by Name ASC then Age DESC Adam Jack Jack Katherin Dart Sort list by two fields using Comparable abstract classThe second approach is to extend Comparable abstract class and override compareTo method Now we don t need to pass compare function we just call list sort instead of list sort compare class Customer extends Comparable String name int age Customer this name this age override String toString return this name this age sort by Name asc override int compareTo other return this name compareTo other name main List lt Customer gt customers customers add Customer Jack customers add Customer Adam customers add Customer Katherin customers add Customer Jack customers sort print Sort by Name ASC then Age DESC n customers toString Output Sort by Name ASC then Age DESC Adam Jack Jack Katherin Further ReadingDart Flutter List Tutorial with ExamplesDart Flutter Constructors tutorial with examplesDart Flutter String Methods amp Operators tutorial with examplesDart Flutter Future Tutorial with ExamplesDart Flutter Map Tutorial with ExamplesDart Flutter Convert Object to JSON stringDart Flutter Convert Parse JSON string array into Object ListDart Flutter Convert List to Map amp Map to List |
2022-03-26 08:04:51 |
海外TECH |
DEV Community |
WN12: What is the best piece of content you found? |
https://dev.to/lorenzojkrl/wn12-what-is-the-best-piece-of-content-you-found-3h9n
|
WN What is the best piece of content you found Another week has passed and here we want to get the best pieces of content you found during the week It really can be anything videospoststweetsbooksmotivationetc Share anything that added value to your journey and could add value to other people s journey So what is the best piece of content you found this week |
2022-03-26 08:01:51 |
ニュース |
BBC News - Home |
'Fraudsters stole everything, even my house' |
https://www.bbc.co.uk/news/business-60801606?at_medium=RSS&at_campaign=KARANGA
|
graeme |
2022-03-26 08:01:51 |
ニュース |
BBC News - Home |
Michael Bisping: Former UFC star looks back on remarkable career in new documentary |
https://www.bbc.co.uk/sport/mixed-martial-arts/60838662?at_medium=RSS&at_campaign=KARANGA
|
Michael Bisping Former UFC star looks back on remarkable career in new documentaryFormer UFC middleweight champion Michael Bisping tells BBC Sport how he rebuilt his career after going blind in one eye |
2022-03-26 08:07:46 |
北海道 |
北海道新聞 |
ウィザーズ八村、先発で11得点 米NBA、ピストンズ戦 |
https://www.hokkaido-np.co.jp/article/661560/
|
得点 |
2022-03-26 17:36:00 |
北海道 |
北海道新聞 |
ソ6―3日(26日) 日本ハム五回に5失点 |
https://www.hokkaido-np.co.jp/article/661559/
|
日本ハム |
2022-03-26 17:35:00 |
北海道 |
北海道新聞 |
国際線停止2年 新千歳 国内線の充実と空港ビル利活用に力 |
https://www.hokkaido-np.co.jp/article/661558/
|
感染拡大 |
2022-03-26 17:28:53 |
北海道 |
北海道新聞 |
西5―0オ(26日) 隅田がプロ初登板勝利 |
https://www.hokkaido-np.co.jp/article/661555/
|
隅田 |
2022-03-26 17:10:00 |
コメント
コメントを投稿