TECH |
Engadget Japanese |
2020年3月14日、JR東日本・JR北海道・JR西日本による「新幹線eチケットサービス」が開始されました:今日は何の日? |
https://japanese.engadget.com/today14-203010687.html
|
予約サービス |
2022-03-13 20:30:10 |
海外TECH |
DEV Community |
Using regular expression in Azure Resource Graph queries |
https://dev.to/omiossec/using-regular-expression-in-azure-resource-graph-queries-5aei
|
Using regular expression in Azure Resource Graph queriesUsing a KQL query in Azure Resource Graph allows operators to quickly retrieve data from deployed Azure resources With a single KQL query you can list all VM currently deployed in all subscriptions of a tenant We already saw KQL in action to retrieve data from Azure Monitor you can do the same to list your resource From the portal you can access Azure Resource Graph by this URL blade HubsExtension ArgQueryBlade you will need a valid Azure Account and you can start working on a query For example if you want to get the data from all your VM in your Azure tenant you can type thisresources where type microsoft compute virtualmachines You can query also the name of the VM by using “ case sensitive or “ case insensitive or contains resources where type microsoft compute virtualmachines where name contains vm This will give you the list of all VM with a name containing the two letters vm But what if you want to list all VMs with a particular name pattern Let says you need to list all VM with a name like this vmX sqlY where X is a number between and and Y a number between and You can try all the possibilities but it can be a long and almost impossible query or you can use a regex like this resources where type microsoft compute virtualmachines where name matches regex vm sql In the same way you can a regular expression with a string pattern If you want to list backend VM vmX appY and SQL VM vmX sqlY where X and Y are numbers between and you can use thisresources where type microsoft compute virtualmachines where name matches regex vm app sql Imagine now that you want to list VMs based on the appurtenance of their IP address in a given range For example you want to list VM with a private IP between and You can use a regex for that First you will need to build this regex For that you could use this website For the giving range the regular expression look like d d d d d d Which translate to matches regex d d d d d d In KQL The second thing is to link the VM with its private IP The private IP doesn t belong to the VM object in Azure it belongs to the virtual network interface So we will need to join the two resources the VM and the virtual nic in the query Resources where type microsoft compute virtualmachines extend nics array length properties networkProfile networkInterfaces mv expand nic properties networkProfile networkInterfaces where nics or nic properties primary true project vmId id vmName name vmSize tostring properties hardwareProfile vmSize nicId tostring nic id join kind leftouter Resources where type microsoft network networkinterfaces mv expand ipconfig properties ipConfigurations project nicId id privateIP ipconfig properties privateIPAddress on nicIdAnd we can add our regex clause Resources where type microsoft compute virtualmachines extend nics array length properties networkProfile networkInterfaces mv expand nic properties networkProfile networkInterfaces where nics or nic properties primary true project vmId id vmName name vmSize tostring properties hardwareProfile vmSize nicId tostring nic id join kind leftouter Resources where type microsoft network networkinterfaces mv expand ipconfig properties ipConfigurations project nicId id privateIP ipconfig properties privateIPAddress on nicId where privateIP matches regex d d d d d d As you can see the maches regex clause is KQL can expand your possibilities to explore your resource with Azure Resource Graph by going beyond standard string operations |
2022-03-13 20:49:56 |
海外TECH |
DEV Community |
Webauthn - Server side libraries |
https://dev.to/dagnelies/webauthn-server-side-libraries-59hh
|
Webauthn Server side librariesSince manual validation verification of attestations which contain the authenticity proof of the payload let s check the ecosystem and look if good libraries are available As a reminder the attestation can be encoded into various formats each containing contain some form of cryptographic signature Therefore it is possible that a library support some of these formats and not others When looking for promising libraries on gihub the following four appear to be the most popular LanguageStarsLicenseLinkGO BSD Python BSD Java Apache PHP MITOf course there are mony more libraries This is just a little pick to illustrate that the ecosystem is already there although young and that a variety of programming languages have libraries available Python exampleThis will not be a full example with a webserver but rather a snippet to test the decoding and validation using the previously mentioned library Let us start with some JSON similar to the one produced in the previous tutorial of this series Namely the same format of the normal response of navigator credentials create with all byte buffers directly encoded as baseurl id ZoIKPJQvKdrYjbTUPJeTUsbLeFkv XxJQNrks rawId ZoIKPJQvKdrYjbTUPJeTUsbLeFkv XxJQNrks response attestationObject oNmbXRkbmuZWdhdHRTdGoGhhdXRoRGFYVkBZmWDeWIDoxodDQXDRYFuPKooYyxlcqDHZdjRQAAAAAAAAAAAAAAAAAAAAAAAAAAACBmggo UlCptiPVtNQnZNSxstWS fnElAviTqQBAwMAQAgWQEAdtHqcD hXHQV nBsTscukBLFOw VFiaKYRHZKLrJShFJ fBxpKfxyMfKZMeAVbOl wemYSXsyHSWyXm dgWhLJjZRtjfVkDPHB ssdvPwo NmoUPYMgK edgZ ehttp IhUUCnVaTvn mbjyEPReSwl wlGsabYGINUhTuhSOqG UpVVQdNJVVGmIPHCAcQpJBDZBohTMBGme feUgmsgqVCWzKkCzIKIzAIVnspLbuSulAVnSTBNxTwCLNJR voSkvphiNbmQBVQHtV psyiHMJtjVJVKMeyFDAQAB clientDataJSON eyJeXBlIjoidViYXVaGuYJlYXRlIiwiYhhbGxlbmdlIjoiQVUVnbWcwYNodWlZdUZydjhEWFhkTVpTSVFSVlpKTdhXhheVZWRWNCajBDdzNNzNaEQRmtHUUtUnJQNmhQSkpBSWzTFZpZWaFhFTGciLCJvcmlnaWiOiJodHRwOivbGjYWxobNOjUwMDAiLCJjcmzcyaWdpbiIZmFscV The exact content might differ depending on where how the registration was performed but the above content is what matters Let s parse it first import webauthnparsed credential webauthn helpers structs RegistrationCredential parse raw json Then validate it using the following method registration webauthn verify registration response credential parsed credential expected challenge webauthn baseurl to bytes CeTWogmgcchuiYuFrvDXXdMZSIQRVZJOga xayVVEcBjCwyyhDFkGSe RrPhPJJAImLVienhXELg expected origin http localhost expected rp id localhost That is the bare minimum First this validates the content including the signature but also provides the public key used later to validate authentication requests print Credential ID webauthn helpers bytes to baseurl registration credential id print Public Key webauthn helpers bytes to baseurl registration credential public key The authentication works similarly Here as well we will take the input of navigator credentials get with all byte buffers directly encoded as baseurl parsed credential webauthn helpers structs AuthenticationCredential parse raw id ZoIKPJQvKdrYjbTUPJeTUsbLeFkv XxJQNrks rawId ZoIKPJQvKdrYjbTUPJeTUsbLeFkv XxJQNrks response authenticatorData SZYNYgOjGhNBcPZHZgW krrmihjLHmVzzuoMdlMFAAAAAQ clientDataJSON eyJeXBlIjoidViYXVaGuZVIiwiYhhbGxlbmdlIjoiaVBtQWkxUHAxWEwbFncTNQVpWlBuWmExekZVRGHYmFRMFLdlZHMWxGMnMzUnRfMdVNYNMHRtYRJcFRUVDRCVTFULUkbWFhdmkalEiLCJvcmlnaWiOiJodHRwOivbGjYWxobNOjUwMDAiLCJjcmzcyaWdpbiIZmFscV signature iOHKXerU OYP r HLZ CexCEbQRrxMWmuoKTDdhAnZSeTPsjECjvjfeSMJzNArmvVHCyy FdRFfcpUPZzdZbBcmPhXPdxRwYOrIzcTLTFQUPdnU izCZtP VGwpCpdMsvCUzZdJbEcRtQuRSqUjqDaovoJhOqEBmxJnWutBi QxARbYjlfyLm EDqimzDZhyietyopXUcpKarKqVHMmMrMzTjpxfWodFCadXEJg ERZqFM UupkJNLbrCJNDYmSmHCSAlpiEiMPKUIiQZkybXLxsXwDmfOLjmDw authentication verification webauthn verify authentication response credential parsed credential expected challenge webauthn baseurl to bytes iPmAiPpXLoAgqPWZtZPnZazFUDoGbaQ KvVGlFsRt ouSzccytmcTIpTTTBUT ImaavndjQ expected rp id localhost expected origin http localhost credential public key registration credential public key credential current sign count require user verification True Before closing the topic I would like to take a step back and look at the big picture again Although the user ID and name is required during the creation of credentials it is not present in the response at all nor used in the authentication process afterwards this asymmetry is kind of bizarre IMHO Perhaps the authenticator uses it somehow for display purposes for things like sub accounts it s not very transparent This specification is also in flux and there are for example plans to add comfort functions to provide json obects directly See Nevertheless the complexity of the whole remains In the next series we will discuss how this complex functionality could be offered more conviniently |
2022-03-13 20:20:42 |
海外TECH |
DEV Community |
How to implement useMediaQuery hook in React |
https://dev.to/juhanakristian/how-to-implement-usemediaquery-hook-in-react-1lc0
|
How to implement useMediaQuery hook in React What are Media Queries Media Queries are a CSS feature that can be used to conditionally apply selected styles on an HTML element Some examples of media queries include checking for the width of the browser window checking for the media type print screen or checking for dark light mode preference The most common use case for media queries is using it to implement responsivity on a website Checking for the width of the viewport and applying styles based on it allows us to define different styles on different devices desktop mobile tablet The syntax for media queries is comprised of an optional media type and any number of media feature expressions Media types include all screen and print The default value for media type is all header font size rem media print header font size rem The media type is followed by any number of media feature expressions enclosed in parenthesis header font size rem color pink media max width px header color blue Here max width px is a media feature expression which signifies that this CSS will only be applied if the width of the viewport is equal to or less than pixels There is a number of different media features we can use to apply CSS in specific situations The most common is width because it is used when creating responsive and mobile friendly websites How to use Media Queries from JavaScript If you want to check for a media query using JavaScript you can use the window matchMedia function matchMedia takes a single parameter the query string you want to check for and returns a MediaQueryList object The MediaQuery object can be used to check for a match or to attach a change event listener The change listener is called every time the result of the media query changes const result window matchMedia max width px if result matches do something result addEventListener change event gt if event matches do something Custom React hook for Media QueriesmatcMedia makes it possible to implement a React Hook we can use to check for Media Query matches and change your application UI or behavior based on the results First let s define the API for our hook With TypeScript our hooks type definition would look like this type useMediaQuery query string gt boolean Our hook will take the query string as a parameter and return a boolean Next we ll need to add a React useEffect call which calls matchMedia and adds an event listener for change We also need a state variable to store the match function useMediaQuery query const matches setMatches React useState false React useEffect gt const matchQueryList window matchMedia query function handleChange e setMatches e matches matchQueryList addEventListener change handleChange query return matches Great This already works but we have one more important thing to add cleanup for the event handler React useEffect function can return a function used for cleanup It s commonly used to unregister event handlers or unsubscribing from external data sources Let s add a cleanup function to our useEffectfunction useMediaQuery query const matches setMatches React useState false React useEffect gt const matchQueryList window matchMedia query function handleChange e setMatches e matches matchQueryList addEventListener change handleChange return gt matchQueryList removeEventListener change handleChange query return matches Now our useMediaQuery hook is finished Here s how you would use it function SomeComponent const isMobile useMediaQuery min width px return lt h gt Browsing with isMobile phone desktop lt h gt LinksMDN on window matchMediaMDN on MediaQueryList |
2022-03-13 20:13:31 |
海外TECH |
DEV Community |
Enabling maintenance mode in Drupal 8 |
https://dev.to/vadimfilimonov/enabling-maintenance-mode-in-drupal-8-562c
|
Enabling maintenance mode in Drupal Go to Configuration →Development →Maintenance mode admin config development maintenanceClick the Put site in maintenance mode checkbox Edit the message text Click the Save Configuration button |
2022-03-13 20:12:12 |
海外TECH |
DEV Community |
Monetize your api using Stripe Mongoose Api |
https://dev.to/moscatellimarco/monetize-your-api-using-stripe-mongoose-api-4k1o
|
Monetize your api using Stripe Mongoose ApiWe live in a world so immersed in digital where a web api can create a million dollar business in this article I will show you how to monetize your api with a library called Stripe Mongoose Api Set up your project requirementsMongoDB installed on your computer or an online MongoDB clusterA Stripe accountFirst we need to install all the dependencies npm install stripe mongoose api stripe mongoose crypto express ejs colorsNow we can start building our own project I will guide you step by step Create app js and userModel jsCreate a model in userModel jsAdd mongoose connectionExpress set upBasic routingAdding Stripe Mongoose Api feauturesYou ll find the source code here Create user js and userModel jsCreate a folder using mkdir lt folderName gt Create new files in the folder app js and userModel js you can name this file whatever you want but is a convention to name this file like this Create a model in userModel jsWe will create a very simple schema with no schema fields to simplify our work but you can just add whatever field you want const mongoose require mongoose const apiSystem require stripe mongoose api const userSchema new mongoose Schema userSchema plugin apiSystem lt options gt module exports mongoose model User userSchema In the lt options gt field you must provide an object that contains stripeSecret your stripe secret key webhookSign your stripe webhook sign key priceId the price id of your product This are the must provide options but you can just check the documentation and choose what other options to add Add mongoose connectionLet s move into app js add this code to the file const mongoose require mongoose const MONGO URI Your MongoDB uri mongoose connect MONGO URI useNewUrlParser true useUnifiedTopology true const db mongoose connection db on error console error bind console connection error db once open gt console log Database connected const User require userModel And now if you try to run the file and all went well you will see in the console Database connected Express set upRequire and run express const express require express const app express app use express json verify req res buffer gt req rawBody buffer express json is a must have middleware for this project because without this Stripe Mongoose Api cannot understand the webhook requests Add the views const path require path const ejs require ejs app set view engine ejs app set views path join dirname views Create a views folder and name it views using mkdir viewsCopy this ejs file inside the folder it is a simple html page that will give you all the functionality provided by Stripe Mongoose Api Basic routingRouters are necessary for the functioning of the api as they will be able to receive and process requests made by users Just rendering the home pageapp get req res gt res render home This route will redirect the user to the stripe checkout page if you don t pass a user as first param the method will create a new one for youapp get checkout async req res gt User subscribeUser res This route listen to all requests sent by stripe it listens for completed checkout and for cancelled subscriptionsapp post webhook async req res gt const user await User findOne User webhook req res This route will listen to all requests sent by the users it checks if the apiKey provided is valid and if yes will create a usage record and then send the data in the second argumentapp get api req res gt User api res italy hi from italy req query apiKey This route will send back the customer recordsapp get usage async req res gt const user await User findById req query customer user customerRecords res This route create a new api key for the user and destroy the old oneapp get changeapikey async req res gt const user await User findById req query id const key await User changeApiKey user res send key const PORT process env PORT app listen PORT gt console log Serving on port PORT And now you are ready to run node app js and see your app working properly now you know how simple can be to create an api and monetize it using Stripe Mongoose Api ConclusionsStripe Mongoose Api is a project made by me and i put in a lot of hard work Stripe Mongoose Api will receive continuous updates so check the github repo in case of new content i hope you liked this tutorial if yes please leave me a star and why not a follow on github see you next time |
2022-03-13 20:03:29 |
Apple |
AppleInsider - Frontpage News |
Shenzhen lockdown could impact Mac Studio shipments |
https://appleinsider.com/articles/22/03/13/shenzhen-lockdown-could-impact-mac-studio-shipments?utm_medium=rss
|
Shenzhen lockdown could impact Mac Studio shipmentsApple s Mac Studio and other products may arrive with consumers later than expected with a lockdown in Shenzhen China potentially impacting manufacturers and shipments Following its introduction on March preorders for the Mac Studio started to slip from a delay of a few weeks into orders arriving in up to weeks However a new COVID lockdown may cause those orders to be further delayed A spike in infections in Hong Kong has prompted the Chinese government to place Shenzhen into lockdown reports the Associated Press Under the order everyone in the city which has a population of million people will face three rounds of testing as part of a zero tolerance strategy against the virus Read more |
2022-03-13 20:50:22 |
海外TECH |
Engadget |
A surprise PC update makes ‘Chrono Trigger’ playable on ultrawide screen displays |
https://www.engadget.com/chrono-trigger-steam-ultrawide-update-204608986.html?src=rss
|
A surprise PC update makes Chrono Trigger playable on ultrawide screen displaysFor nearly years Square Enix s Chrono Trigger has stood tall as one of the defining releases of the SNES era and JRPG genre In a medium that has dramatically evolved over the past three decades it s one of those rare games that still feels as fresh and vital today as it did in And now there s even more of a reason to revisit this gem if you own an ultrawide monitor Earlier this week Square Enix updated the Steam version of Chrono Trigger for the first time in four years Spotted by Kotaku the update adds support for resolutions “improved d pad controls and a handful of user interface improvements among other quality of life changes The addition of ultrawide screen support is particularly notable since it s a feature that s rare to find on retro ports and even some modern games Elden Ring for instance doesn t come with native support The PC version of Chrono Trigger has come a long way since Square first released it in At the time the company was rightfully criticized for releasing a lazy port At launch it included interface elements that were directly lifted from the Android and iOS releases To its credit however Square spent the next year polishing the release and following this week s update you can safely say the PC version is one of the definitive ways to play the classic |
2022-03-13 20:46:08 |
ニュース |
BBC News - Home |
Ukraine war: UK households offered £350 a month for hosting refugees |
https://www.bbc.co.uk/news/uk-60724111?at_medium=RSS&at_campaign=KARANGA
|
authorities |
2022-03-13 20:11:56 |
ニュース |
BBC News - Home |
Bafta Film Awards: Benedict Cumberbatch's The Power of the Dog wins top prize |
https://www.bbc.co.uk/news/entertainment-arts-60675263?at_medium=RSS&at_campaign=KARANGA
|
ukraine |
2022-03-13 20:49:25 |
ニュース |
BBC News - Home |
Poland feels the strain of Ukraine's refugees |
https://www.bbc.co.uk/news/world-europe-60731369?at_medium=RSS&at_campaign=KARANGA
|
locals |
2022-03-13 20:16:17 |
ニュース |
BBC News - Home |
War in Ukraine: What happened on day 18 of Russia's invasion |
https://www.bbc.co.uk/news/world-europe-60730367?at_medium=RSS&at_campaign=KARANGA
|
house |
2022-03-13 20:26:55 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
認知症予防には、結局何をすればいい?最新エビデンスで示す「16の行動の○と×」 - 決定版 後悔しない「認知症」 |
https://diamond.jp/articles/-/298624
|
調査 |
2022-03-14 05:25:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
トヨタすら一目置く地元の盟主とは?名古屋財界「最新序列」大解剖、新御三家と五摂家とは? - 名古屋大激変! 教育・マンション・産業 |
https://diamond.jp/articles/-/298606
|
一目置く |
2022-03-14 05:20:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
「お得な中高一貫校」ランキング【首都圏・中堅校】入試偏差値50未満でも名門大に進学 - わが子に最強の中高一貫校&小学校&塾 |
https://diamond.jp/articles/-/298815
|
中高一貫校 |
2022-03-14 05:15:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
DX成功に欠かせない人材、それは「ボロクソに怒るおじさん」だ!【IT業界インサイダー座談会5】 - 企業・ITベンダー・コンサル…DX狂騒曲 天国と地獄 |
https://diamond.jp/articles/-/297957
|
天国と地獄 |
2022-03-14 05:10:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
失禁し徘徊する親、追い詰められる家族…認知症介護の落とし穴【ケアマネジャー覆面座談会】 - 決定版 後悔しない「認知症」 |
https://diamond.jp/articles/-/298623
|
落とし穴 |
2022-03-14 05:05:00 |
ビジネス |
電通報 | 広告業界動向とマーケティングのコラム・ニュース |
【参加者募集】ウェビナー「Snowflake Media Data Cloud Summit〜メディア業界におけるデータを活用した新規ビジネス創出のためのヒント」4月5日開催 |
https://dentsu-ho.com/articles/8110
|
mediadatacloudsummit |
2022-03-14 06:00:00 |
ビジネス |
電通報 | 広告業界動向とマーケティングのコラム・ニュース |
データクリーンルームの可能性と活用法 |
https://dentsu-ho.com/articles/8105
|
cookie |
2022-03-14 06:00:00 |
ビジネス |
東洋経済オンライン |
「年齢への焦り」で転職した37歳の彼が迎えた結末 1社に長く勤務、「転職市場での価値」に不安も… | 戻りたくなる組織の作り方 | 東洋経済オンライン |
https://toyokeizai.net/articles/-/537141?utm_source=rss&utm_medium=http&utm_campaign=link_back
|
人手不足 |
2022-03-14 05:40:00 |
ビジネス |
東洋経済オンライン |
さらばTポイント、ヤフーLINE「楽天追撃」の秘策 統合から1年、EC首位狙うZHDのポイント戦略 | インターネット | 東洋経済オンライン |
https://toyokeizai.net/articles/-/538688?utm_source=rss&utm_medium=http&utm_campaign=link_back
|
東洋経済オンライン |
2022-03-14 05:20:00 |
コメント
コメントを投稿