AWS |
AWS The Internet of Things Blog |
How to get started with the new shared subscriptions in AWS IoT Core |
https://aws.amazon.com/blogs/iot/how-to-get-started-with-the-new-shared-subscriptions-in-aws-iot-core/
|
How to get started with the new shared subscriptions in AWS IoT CoreIntroduction The new shared subscriptions feature in AWS IoT Core brings the load balancing capability to multiple subscribing MQTT sessions or consumers While non shared subscription sends all the published messages to all its subscribers shared subscription sends a published message to only one of its subscribers in a random manner In this blog post we ll … |
2023-05-02 20:59:15 |
海外TECH |
Ars Technica |
Colorado kills law that made it harder for cities to offer Internet service |
https://arstechnica.com/?p=1936108
|
broadband |
2023-05-02 20:31:50 |
海外TECH |
Ars Technica |
Here’s what caused black stains on Leonardo da Vinci’s Codex Atlanticus |
https://arstechnica.com/?p=1934263
|
crystalline |
2023-05-02 20:07:13 |
海外TECH |
DEV Community |
Custom Response Statuses and Redirection in Next.js getServerSideProps |
https://dev.to/hi_iam_chris/custom-response-statuses-and-redirection-in-nextjs-getserversideprops-b8l
|
Custom Response Statuses and Redirection in Next js getServerSidePropsNextJS is a JavaScript framework that uses ReactJS for rendering UI in web applications This framework comes with many great features like server side rendering static site generation image optimizations routing and many more But there is something that annoys me terribly and that is handling errors in server side rendering This is why we will be looking into this problem in the rest of this article Quick intro into server side rendering with the getServerSidePropsIf you export getServerSideProps in your page component on the request it will try to generate the HTML that is returned as a response export default function ServerSideProps person const firstName lastName person return lt gt Hello firstName lastName lt gt export async function getServerSideProps context return props person firstName John lastName Doe will be passed to the page component as props Take a look at the example above It is a simple component taking a person s data as props Those values are sent from the getServerSideProps When the user requests the route those data are prepared sent to the component for rendering and then the result is sent as a response to the user page not foundIn the example above you might have noticed how the getServerSideProps function returns the object and the data needed for the component is stored under the property called props That is not the only property it can return Another property it can return is called notFound which type is Boolean If you set this value as true the response status code value is and displayed is appropriate page This can be the default NextJS page or you could create your own custom page export async function getServerSideProps context const personId context params id if personId return notFound true const personData await fetchData personId return props person personData Take a look at the example above showing only the getServerSideProps method Assume we have the same ReactJS component as before and that we know a person with the id value does not exist In that case all it is returning is an object with this property set to true In other cases we could explicitly set it to false but that is the default value and there is no need for it Custom status code responsesThe previous example showed a situation when we need to return a page not found But what happens when we need to send some custom error This is where things become messy There is no return for custom status values But there are tricks we can use The getServerSideProps function receives a single argument context And among other properties it receives a response object There we can set specific status code values export async function getServerSideProps context const personId context params id if personId return notFound true if personId context res statusCode return props error status message Service unavailable const personData await fetchData personId return props person personData What you might notice above after setting the status I also set props The reason for that is that unless you are returning notFound NextJS will still try to render your original component And that means we also need to adjust our page component export default function ServerSideProps person error if error return lt div gt lt b gt error status lt b gt error message lt div gt const firstName lastName person return lt div gt Hello firstName lastName lt div gt Above the component is extended with an error and in that case it will return different content showing the error I know this is not an ideal situation but at the moment it is the best option there is Return redirectThe last item to cover is redirecting I already mentioned that the getServerSideProps function returns an object that can have properties props and notFound There is one more and that one is used for redirection if personId return redirect destination server side props errors permanent false We could add the example above to our getServerSideProps function and if you try to open the URL for the person with id value it will redirect you to the page for person with the id You may notice there is another property called permanent That one is used to select which redirect status it will return so that browsers and search engines can cache redirect forever or just this one time True means cache it and redirect forever status and false means just redirect and don t cache status ConclusionServer side rendering is a very useful feature that provides us with many benefits However sometimes in the software things just go wrong Requests fail a database connection is lost rd party API is unavailable and we need to be able to handle those situations properly I hope this article helps you with that The code used in the examples above can be found in my GitHub repository For more you can follow me on Twitter LinkedIn GitHub or Instagram |
2023-05-02 20:19:54 |
Apple |
AppleInsider - Frontpage News |
New price drops discount MacBook Pro models by up to $1,900 |
https://appleinsider.com/articles/23/05/02/new-price-drops-discount-macbook-pro-models-by-up-to-1900?utm_medium=rss
|
New price drops discount MacBook Pro models by up to AppleInsider is tracking fresh price cuts on MacBook Pro inch and inch models equipped with M Pro and M Max chips with discounts now reaching up to off Prices for upgraded models have dropped to as low as Save up to instantly A price war has erupted on closeout MacBook Pro models with the AppleInsider Mac Price Guide tracking the latest discounts this Tuesday Read more |
2023-05-02 20:30:58 |
海外TECH |
Engadget |
Twitter restores free API access for emergency, weather and transportation alerts |
https://www.engadget.com/twitter-restores-free-api-access-for-emergency-weather-and-transportation-alerts-204519574.html?src=rss
|
Twitter restores free API access for emergency weather and transportation alertsTwitter s decision to shut off its free API caused more than a few problems for public institutions that depend on the functionality and the company is clearly ready to backtrack The social network has restored free access to the app programming framework for verified government and publicly owned services that use the tool for quot critical purposes quot such as emergency notifications transportation updates and weather alerts The social media giant outlined a three tier pricing strategy for its API in March Normally free access is limited to bots and testers that only need to write posts It allows just tweets per month and one app ID which can be limiting for creators that need frequent updates Basic access costs per month with fixed caps on tweets while businesses have to use multiple enterprise level tiers to meet their needs These can cost tens of thousands of dollars per month One of the most important use cases for the Twitter API has always been public utility Verified gov or publicly owned services who tweet weather alerts transport updates and emergency notifications may use the API for these critical purposes for free ーTwitter Dev TwitterDev May The shutoff broke numerous apps and services that relied on the free API for sharing and content streams such as Flipboard s reader It also created issues for developers willing to pay for access including Echobox While Twitter had warned that a cutoff was coming at some point it didn t notify customers of the exact timing and did little to explain the impact Government services faced extra pain New York City s Metropolitan Transportation Authority said it would stop posting service alerts on Twitter after it faced a per month fee for access Microsoft also pulled Twitter from its social media tool for advertisers and disabled Twitter screenshot sharing for Windows and Xbox gamers Twitter under Elon Musk s leadership has clamped down on previously free functionality in a bid to both control more of the experience and shift more of its revenue to subscriptions It banned third party clients for example and required a Blue membership for some verified checkmarks This latest move is an acknowledgment that the strategy creates problems particularly for governments eager to provide vital information through as many channels as possible This article originally appeared on Engadget at |
2023-05-02 20:45:19 |
海外TECH |
Engadget |
Amazon expands Matter smart home support to older Echo speakers |
https://www.engadget.com/amazon-expands-matter-smart-home-support-to-older-echo-speakers-201150353.html?src=rss
|
Amazon expands Matter smart home support to older Echo speakersAmazon s Matter support is reaching some of its older speakers A new Alexa update turns the second generation Echo Echo Dot and Echo Plus into Matter controllers ーyou don t have to replace the old speaker in the basement just to use newer smart home devices The fourth generation Echo meanwhile can serve as a Thread border router to help you add Matter capable Thread devices You won t have to use Android to set up Matter gear either as iOS is now an option There s also good news if you ve been curious about Eve Systems devices but didn t want to invest in Apple products to enable HomeKit support The Matter over Thread update brings Alexa control to a range of Eve hardware Later in May you ll also get simplified Alexa setup for Eve Door amp Window Eve Energy and Eve Motion Amazon originally said Echo products would support Matter over WiFi by the end of It promised compatibility with a total of Echo and Eero models by early this year The Matter standard arrived last October and theoretically created a common connectivity format for smart home equipment You no longer need to be as picky about the products you use However the real world rollout has been slow ーonly some smart speakers apps and household devices work with Matter as of this writing Amazon s latest move closes some gaps but it may take some time before you can simply assume that everything you own will interoperate This article originally appeared on Engadget at |
2023-05-02 20:11:50 |
海外TECH |
WIRED |
10 Best Amazon Pet Day Deals: Carpet Cleaners, Dog Beds, and More |
https://www.wired.com/story/amazon-pet-day-deals-2023/
|
cameras |
2023-05-02 20:19:25 |
海外科学 |
BBC News - Science & Environment |
Climate change: life in ocean ‘twilight zone' at risk from warming |
https://www.bbc.co.uk/news/science-environment-65460128?at_medium=RSS&at_campaign=KARANGA
|
earth |
2023-05-02 20:50:52 |
ニュース |
BBC News - Home |
Man arrested outside Buckingham Palace |
https://www.bbc.co.uk/news/uk-65464885?at_medium=RSS&at_campaign=KARANGA
|
grounds |
2023-05-02 20:48:52 |
ニュース |
BBC News - Home |
Wrexham: Ryan Reynolds and Rob McElhenney join victory parade |
https://www.bbc.co.uk/news/uk-wales-65450337?at_medium=RSS&at_campaign=KARANGA
|
wrexham |
2023-05-02 20:27:48 |
ニュース |
BBC News - Home |
Sue Gray chose not to engage with Labour job inquiry, minister says |
https://www.bbc.co.uk/news/uk-politics-65461223?at_medium=RSS&at_campaign=KARANGA
|
labour |
2023-05-02 20:31:29 |
ニュース |
BBC News - Home |
US bank shares slide after First Republic rescue |
https://www.bbc.co.uk/news/business-65461930?at_medium=RSS&at_campaign=KARANGA
|
banks |
2023-05-02 20:38:28 |
ニュース |
BBC News - Home |
Arsenal 3-1 Chelsea: Martin Odegaard double helps Arsenal back to top of Premier League |
https://www.bbc.co.uk/sport/football/65382202?at_medium=RSS&at_campaign=KARANGA
|
Arsenal Chelsea Martin Odegaard double helps Arsenal back to top of Premier LeagueMartin Odegaard scores twice as Arsenal beat a sorry Chelsea at Emirates Stadium to return to the top of the Premier League |
2023-05-02 20:54:53 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
「ChatGPT関連株」に飛びつく人が儲からない理由、資産2億超の投資家らプロ3人が徹底指南 - 注目テーマをメッタ斬り! “人気株”の勝者・敗者 |
https://diamond.jp/articles/-/322200
|
chatgpt |
2023-05-03 05:25:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
快進撃のマネーフォワード社長が明かす「お金のNo.1プラットフォーム」への道筋 - 注目テーマをメッタ斬り! “人気株”の勝者・敗者 |
https://diamond.jp/articles/-/322199
|
快進撃のマネーフォワード社長が明かす「お金のNoプラットフォーム」への道筋注目テーマをメッタ斬り“人気株の勝者・敗者「SaaS×フィンテック」という成長分野で、直近年間の平均売上高成長率がと快進撃を続けるマネーフォワード。 |
2023-05-03 05:20:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
企業防衛ビジネス業界激変!IRジャパンの「凋落」でEYや外資系も続々参入、どうなる1強体制 - マッチポンプ IRジャパンの正体 |
https://diamond.jp/articles/-/321719
|
|
2023-05-03 05:15:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
富裕層の「3段階海外移住」マニュアルを公開!ポルトガルに駆け込み申請殺到の理由 - シン富裕層の投資・節税・相続 |
https://diamond.jp/articles/-/321958
|
駆け込み |
2023-05-03 05:10:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
「シン富裕層」の知られざる生態、従来の富裕層とは志向もビジネスモデルも激変! - 有料記事限定公開 |
https://diamond.jp/articles/-/321957
|
限定 |
2023-05-03 05:05:00 |
ビジネス |
東洋経済オンライン |
【アトピー肌】炎症改善後ケア、保湿剤の適量は? アトピー性患者の皮膚はなぜカサカサかも解説 | 「病気」と「症状」の対処法 | 東洋経済オンライン |
https://toyokeizai.net/articles/-/666536?utm_source=rss&utm_medium=http&utm_campaign=link_back
|
東洋経済オンライン |
2023-05-03 05:40:00 |
ビジネス |
東洋経済オンライン |
医師警告!「毎日お酒を飲む人」健康を守る3秘訣 食事も大事!「心臓を傷つけない」簡単なコツ | 健康 | 東洋経済オンライン |
https://toyokeizai.net/articles/-/665732?utm_source=rss&utm_medium=http&utm_campaign=link_back
|
東洋経済オンライン |
2023-05-03 05:20:00 |
コメント
コメントを投稿