投稿時間:2021-04-13 00:38:27 RSSフィード2021-04-13 00:00 分まとめ(49件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
TECH Engadget Japanese アップル、HomePod一体型の新Apple TVを開発中?スマートディスプレイ型も検討 (うわさ) https://japanese.engadget.com/homepod-apple-tv-smart-display-141541457.html appletv 2021-04-12 14:15:41
AWS AWS Compute Blog Getting started with serverless for developers: Part 1 https://aws.amazon.com/blogs/compute/getting-started-with-serverless-for-developers-part-1/ Getting started with serverless for developers Part Developers around the world are already running serverless applications in production without worrying about servers This new getting started series is for developers who want to join them Follow along with blog posts code examples and practical exercises to learn how to build serverless applications from your local integrated development environment IDE In this post … 2021-04-12 14:49:07
AWS AWS Compute Blog Operating Lambda: Isolating and resolving issues https://aws.amazon.com/blogs/compute/operating-lambda-isolating-and-resolving-issues/ Operating Lambda Isolating and resolving issuesThis blog post outlines a general approach to debugging Lambda performance issues and errors This provides a repeatable process for isolating and resolving problems in your serverless workloads Using the walkthrough of the Coffee Lookup application I show how to reproduce a production bug isolate the cause of errors and then isolate the performance issue 2021-04-12 14:33:06
python Pythonタグが付けられた新着投稿 - Qiita Djangoチュートリアル⑦(静的ファイル) https://qiita.com/honda28/items/bd0bfe8731a17609907c 静的ファイルのプロジェクト構成チュートリアルでは、各アプリケーション単位で静的ファイルディレクトリstaticを作成している。 2021-04-12 23:08:35
js JavaScriptタグが付けられた新着投稿 - Qiita webプログラミングで作る最初の題材は掲示板だよね、本気で作った結果 https://qiita.com/NIERU_NET/items/61384fb3b2b325d26b03 2021-04-12 23:34:34
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) laravelで画像を表示したい https://teratail.com/questions/332895?rss=all laravelで画像を表示したい前提・実現したいことlaravelで画像を表示したい。 2021-04-12 23:55:03
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) powershellのバックグラウンド実行について https://teratail.com/questions/332894?rss=all powershellのバックグラウンド実行についてPowerShellのコマンドプログラム実行やcmdから実行できる形を実行したいのですが、実行時にシェルのウィンドウが出るのに困っております。 2021-04-12 23:54:18
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) データベースにユーザの新規登録ができない https://teratail.com/questions/332893?rss=all データベースにユーザの新規登録ができない前提・実現したいことユーザの新規登録を実装したいPHPで自作アプリを作成しています。 2021-04-12 23:53:35
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) jQuery: イベントの追加 https://teratail.com/questions/332892?rss=all disable 2021-04-12 23:49:47
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) ページネーションを詳細ページで実装したい https://teratail.com/questions/332891?rss=all ページネーションを詳細ページで実装したい現状・実現したいこと現在掲示板アプリを作成中で、Gemのaposkaminariaposでページネーションを投稿機能の詳細ページで表示したいと考えています。 2021-04-12 23:41:20
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) ゲームサーバーは何にすればいいですか? https://teratail.com/questions/332890?rss=all 自作 2021-04-12 23:40:32
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) 指定したサイトでjavascriptの操作(自動クリックとタグ取得)を行うには? https://teratail.com/questions/332889?rss=all javascript 2021-04-12 23:35:44
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) ハンバーガーメニューを完成させたい https://teratail.com/questions/332888?rss=all inputとlabelタブでメニューバーを作り、クリックしたらメニューが消えたり出てきたりさせようとしたのですが、うまく行きません。 2021-04-12 23:24:54
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) Tobii pro グラス3の視線計測の履歴を画面上に描画したいです。 https://teratail.com/questions/332887?rss=all Tobiiproグラスの視線計測の履歴を画面上に描画したいです。 2021-04-12 23:11:06
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) gulp-ejsでhtmlファイルがコンパイルできない https://teratail.com/questions/332886?rss=all gulpejsでhtmlファイルがコンパイルできないご質問をお願いいたします。 2021-04-12 23:10:40
Ruby Rubyタグが付けられた新着投稿 - Qiita (Ubuntu)Ruby on Rails6 環境構築のやり方【自分用メモ】 https://qiita.com/KobayashiYu/items/95424bf0fa31b7a27f01 UbuntuRubyonRails環境構築のやり方【自分用メモ】はじめに本記事はRubyonRailsをgeminstallrailsコマンドを使わない方法で環境構築を行っていくものです。 2021-04-12 23:02:57
AWS AWSタグが付けられた新着投稿 - Qiita [Symbol] XYM未保有でもNode構築で収穫祭 https://qiita.com/nobu_kyutech/items/beb5e05992c926e9f6ac 下記NodeはVoting設定も追加していますあとは委譲とハーベスティングされるのをゆっくり待つのみです。 2021-04-12 23:28:59
Docker dockerタグが付けられた新着投稿 - Qiita Docker/React初心者が半日で構築するReact環境(1週間だけ頑張る Day3of9) https://qiita.com/tagawa0525/items/b7a0ffb6e3ff8a04952b 前回作ったFastAPIに対して、CRUDする予定だったのですが、まずは、Reactの環境をDocker上に構築しました。 2021-04-12 23:17:03
Ruby Railsタグが付けられた新着投稿 - Qiita React + Rails のSPAでshowアクションを実装する https://qiita.com/tanutanu/items/e5d031a8bf8e2148f006 では で は 。 2021-04-12 23:08:19
Ruby Railsタグが付けられた新着投稿 - Qiita (Ubuntu)Ruby on Rails6 環境構築のやり方【自分用メモ】 https://qiita.com/KobayashiYu/items/95424bf0fa31b7a27f01 UbuntuRubyonRails環境構築のやり方【自分用メモ】はじめに本記事はRubyonRailsをgeminstallrailsコマンドを使わない方法で環境構築を行っていくものです。 2021-04-12 23:02:57
海外TECH Ars Technica France bans air travel that could be done by train in under 2.5 hours https://arstechnica.com/?p=1756250 network 2021-04-12 14:45:09
海外TECH DEV Community Make Your React Apps Responsive with a Custom Hook https://dev.to/reedbarger/make-your-react-apps-responsive-with-a-custom-hook-2e0g Make Your React Apps Responsive with a Custom HookThis post originally appeared on ReedBarger com How do you make your React applications responsive for any sized device Let s see how to do so by making our own custom React hook At the top of my React site is a Header component As I decrease the size of the page I want to show less links To do this we could use a media query with CSS or we could use a custom React hook to give us the current size of the page and hide or show the links in our JSX Previously I was using a hook from the a library called react use to add this functionality Instead of bringing an entire third party library however I decided to create my own hook that would that provide the dimensions of the window both the width and height I called this hook useWindowSize Interested in creating impressive React apps that use custom React hooks like this one Check out The React Bootcamp Creating the hookFirst we ll create a new file js in our utilities utils folder the same name as the hook useWindowSize and I ll import React to use hooks while exporting the custom hook utils useWindowSize jsimport React from react export default function useWindowSize Now since I m using this within a Gatsby site which is server rendered I need to get the size of the window but we may not have access to it because we re on the server To check and make sure we re not on the server we can see if type of window is not equal to the string undefined In which case we can return to a default width and height for a browser say and within an object utils useWindowSize jsimport React from react export default function useWindowSize if typeof window undefined return width height Getting the width and height from windowAnd assuming we are on the client and can get the window we can take the useEffect hook to perform a side effect by interacting with window We ll include an empty dependencies array to make sure the effect function is called only once the component that this hook is called in is mounted To find out the window width and height we can add an event listener and listen for the resize event And whenever the browser sizes change we can update a piece of state created with useState which we ll call windowSize and the setter to update it will be setWindowSize utils useWindowSize jsimport React from react export default function useWindowSize if typeof window undefined return width height const windowSize setWindowSize React useState React useEffect gt window addEventListener resize gt setWindowSize width window innerWidth height window innerHeight When the window is resized the callback will be called and the windowSize state will be updated with the current window dimensions To get that we set the width to window innerWidth and height window innerHeight Adding SSR supportHowever the code as we have it here will not work And the reason is because a key rule of hooks is that they cannot be called conditionally As a result we cannot have a conditional above our useState or useEffect hook before they are called So to fix this we ll set the initial value of useState conditionally We ll create a variable called isSSR which will perform the same check to see if the window is not equal to the string undefined And we ll use a ternary to set the width and height by first checking to see if we re on the server If we are we ll use the default value and if not we ll use window innerWidth and window innerHeight utils useWindowSize jsimport React from react export default function useWindowSize if typeof window undefined return width height const isSSR typeof window undefined const windowSize setWindowSize React useState width isSSR window innerWidth height isSSR window innerHeight React useEffect gt window addEventListener resize gt setWindowSize width window innerWidth height window innerHeight Then finally we need to think about when our components unmount What do we need to do We need to remove our resize listener Removing resize event listenerYou can do that by returning a function from useEffectand we will remove the listener with window removeEventListener utils useWindowSize jsimport React from react export default function useWindowSize if typeof window undefined return width height const isSSR typeof window undefined const windowSize setWindowSize React useState width isSSR window innerWidth height isSSR window innerHeight React useEffect gt window addEventListener resize gt setWindowSize width window innerWidth height window innerHeight return gt window removeEventListener resize gt setWindowSize width window innerWidth height window innerHeight But since we need a reference to the same function not two different ones as we have here To do that we ll create a shared callback function to both of the listeners called changeWindowSize And finally at the end of the hook we will return our windowSize state And that s it utils useWindowSize jsimport React from react export default function useWindowSize const isSSR typeof window undefined const windowSize setWindowSize React useState width isSSR window innerWidth height isSSR window innerHeight function changeWindowSize setWindowSize width window innerWidth height window innerHeight React useEffect gt window addEventListener resize changeWindowSize return gt window removeEventListener resize changeWindowSize return windowSize UsageTo use the hook we just need to import it where we need call it and use the width wherever we want to hide or show certain elements In my case this is at the px mark There I want to hide all of the other links and only show the Join Now button like you see in the example above components StickyHeader jsimport React from react import useWindowSize from utils useWindowSize function StickyHeader const width useWindowSize return lt div gt visible only when window greater than px width gt amp amp lt gt lt div onClick onTestimonialsClick role button gt lt span gt Testimonials lt span gt lt div gt lt div onClick onPriceClick role button gt lt span gt Price lt span gt lt div gt lt div gt lt span onClick onQuestionClick role button gt Question lt span gt lt div gt lt gt visible at any window size lt div gt lt span className primary button onClick onPriceClick role button gt Join Now lt span gt lt div gt lt div gt This hook will work on any server rendered React app such as Gatsby and Next js Enjoy this post Join The React BootcampThe React Bootcamp takes everything you should know about learning React and bundles it into one comprehensive package including videos cheatsheets plus special bonuses Gain the insider information hundreds of developers have already used to master React find their dream jobs and take control of their future Click here to be notified when it opens 2021-04-12 14:19:30
海外TECH DEV Community Are you satisfied with the current state of online courses? https://dev.to/andi23rosca/are-you-satisfied-with-the-current-state-of-online-courses-35ok Are you satisfied with the current state of online courses Personally I m not at least not fully Whenever I start looking into a new subject there are always tutorials that explain the basics and follow up guides on how to make an app or a website or something But to me at least it seems that there s this whole missing gap that would help you go from intermediate ish to advanced Luckily i ve already had to go through this process with frontend development and I picked up a few tricks along the way on how to learn advanced concepts and gain mastery like reading source code looking through github issues and a lot of trial and error in my day job But even if I can use the previous experience and knowledge to guide me when learning something new like game dev for example it still feels like you have to hunt down great resources when you want to move up from beginner concepts What do you guys think what has your experience been like 2021-04-12 14:11:57
海外TECH DEV Community How to install Github Desktop for Ubuntu & Debian? https://dev.to/danyson/how-to-install-github-desktop-for-ubuntu-debian-4hko How to install Github Desktop for Ubuntu amp Debian Step Use the wget command followed by the URL of deb file of GitHub desktop from the shiftkey Github repo Shifykey is maintained by Brendan Forster one of the staff member of Github sudo wget Step Install gdebi using the following command which helps you to install local deb packages resolving and installing its dependencies sudo apt get install gdebi core Step After installing gdebi using gdebi install the GitHubDesktop client using the following command sudo gdebi GitHubDesktop linux linux deb 2021-04-12 14:11:42
海外TECH DEV Community Progressive Web Apps https://dev.to/rubenbase/progressive-web-apps-4j96 Progressive Web AppsWith home broadband and smart phones we are increasingly relient on the internet but sometimes the internet isn t there That feeling of being abandoned by connectivity is just terrible You could be watching your video of funny cats in a row but all you get is the loading icon Total failure of connectivity is a worst case scenario that s why we are going to cover how to create apps that work great what ever connection the user has ussing the Service Worker to intercept network traffic We should approach the application from an offline first point of view this means showing many things on the screen as possible using stuff already on the user s device in caches and such  What is the Service Worker So this Service Worker thing is really good and I mean REALLY good it s just a simple JavaScript file that sits between you and network requests it can t access the DOM and the user doesn t see it What it does is it intercepts requests as the browser makes them From there you can send the request off the network as per usual or you can skip the network run some cache stuff or code a custom response whatever you wish You register for a Service Worker giving in the location of your service work a script and it returns a promise if navigator serviceWorker return For old browsersnavigator serviceWorker register sw js then reg gt console log Registered catch err gt console log Whoopss You can give it a scope too and it will control any page at that URL and also anything with a deeper URL but not anything with a shallower URL navigator serviceWorker register sw js scope app And what does the Service Worker do Well it listens to events like self addEventListener install event gt self addEventListener activate event gt self addEventListener fetch event gt The event response contains information about all the requests made by controlled pages as CSS images fonts and you can mess around with requests changing headers or responding with something entirely different That s why Service Workers are limited to HTTPS because when you re serving across plain unencrypted HTTP through the network any one in the middle can remove modify or add content Malicious scripts could also capture the data you input read cookies modify databases… Service Worker LifecycleIn a refresh of a page there is an overlap between the old page and the new page With the new request the Service Worker is registered The Service Worker only takes control of pages when they re loaded that means any additional requests by this page will bypass the Service Worker Refreshing the page makes the Service Worker that was up and running take control of the window client now the request did pass through it That explain why does it take two refreshes to see logs request What happens if we change the thing we are logging We still see our old request being logged our old code that is because if a page loads by its Service Worker it will check for an update to the Service Worker in the background In the case of finding it has changed it becomes the next version but it doesn t take control until all pages using the current version are gone to make sure there s only one version of our site running at the same time like native apps Thats why a refresh doesn t let the new version take over Because the window clients are overlapping when refreshing the Service Worker doesn t stop controlling it In order to let the new waiting Service Worker take place we need to close the actual window client When we do that the new Service Worker takes over and future page loads will go through the new one This update process is the same as browsers such as Chrome use Chrome downloads the update in the background and it doesn t take over until the browser closes and opens again It notifies you with an icon changing the color When the browser refetches a service worker looking for updates it will go through the browser cache that s why it is important to keep cache time on the Service Workers short as zero Also in case of setting the Service Worker script to cache for more than a day the browser will just set the cache to hours that means the update checks will bypass the browser cache if the Service Worker is over a day old Hijacking RequestsHow to catch the request so nothing goes to the network and respond ourselves is really easy we just need to call event respondWith It takes a response object or a promise that resolves with a response The first parameter is the body of the response which can be a buffer blob and other things like in this case a simple string We can add headers too to create some HTML response self addEventListener fetch function event event respondWith new Response Hi my name is lt b gt Ruben lt b gt headers Content Type text html Now that we know how to respond to a hijack request let s go to the network for the response and with the API Fetch we will make a network request and respond to requests if their URL ends with “ png with our own image self addEventListener fetch function event if event request url endsWith png event respondWith fetch imgs sample image jpg Right know we only showed something based on the request URL but in the real world we need to be more dynamic like for example the page can send a request which we intercept and send it to the network but instead of sending the response back we are going to look at it and do another stuff The fetch method can take an URL or all the request and returns a promise so we can use then and catch and if the responses are Not Found we could respond with our own message self addEventListener fetch function event event respondWith fetch event request then function response if response status return new Response Not Found return response catch function return new Response Something went reeeaally wrong Now if we go to a page that doesn t exists we get our message and if we turn our page offline we get our custom message too We could use this technique to get a response from multiple sources and act based on them you can even go to the network and if that fails…get another thing from the network Caching AssetsIf we want to load our app without using the network we need somewhere to store the HTML CSS JavaScript images fonts…and we can do that thanks to the cache API The cache API give us this caches object on the global so if I want to create or open a cache we can use caches open passing the name of the cache That returns a promise for a cache of that name and if is not yet created it will create one and return it caches open my cache then function cache The cache box contains request and response pairs We can use to store anything from both our own origin or from elsewhere on the web We can add cache items using cache put and pass a request or a URL and the response or we can use cache addAll this takes an array of requests or URLs then fetches them and puts the request and its response pair into the cache cache put request response cache addAll thing thing The operation addAll is atomic that means if any of these fail to cache non of them will be added to the cache addAll uses fetch under the hood so understand that requests will be going via browser cache If we want to get something out of the cache we can use cache match passing in a request or a URL This will return a promise when there is a match or null otherwise Caches match is the same but it tries to find a match in any cache starting with the oldest cache match request caches match request If we now want to start storing things we can use another Service Worker event The install event is fired after a Service Worker is runned by a browser for the first time self addEventListener install function event event waitUntil Event waitUntil lets us control the progress of the install We pass in a promise and if the promise resolves then the browser knows the install is complete and if the promise rejects then it will know it failed and this Service Worker should be discarded Let s use cache to cache our stuff then Event waitUntil takes a promise and cache open returns one so we can create the cache inside de waitUntil event and use addAll to cache all the URLs of our site self addEventListener install function event event waitUntil We open a cache named example static v then we add cache the urls we want caches open example static v then function cache return cache addAll js main js css main css imgs example png Now if we run our site we can go to the Application panel and we can see the resources we stored inside the Cache Storage It s time to put this in practise and know that we have resources in the cache we can delete the previous code handling the response in the fetch event and use it to respond with an entry for the cache if there is one and if there isn t fetch it from the network self addEventListener fetch function event event respondWith caches match event request then function response if response return response return fetch event request Now if we refresh the page seems like we didn t do any change but if we go offline we get our content still thanks to the cache and if we get a low connection we will get out content a lot faster now To have this cycle working better now we need to update our content in the cache This is because we cached the HTML once at install time so we are stuck with the same content in the cache So to have the perfect offline experience we need to do Unobtrusive app updates Give the latest version to the user Keep updated the cache of the content Cache photos avatars etc Updating The Static CacheSay we wanted to change the CSS of the app if we refresh our app we won t see any changes because our cache still contains the old CSS Our cached CSS is updated in the install event but we are changing the CSS not making any changes in the Service Worker so the install event is not being called We need to work with the Service Worker to get it to pick up changes To make the CSS to update we need to make a change to the Service Worker so the browser knows there is a new version of it and we ll have an installing Service Worker because is new so it ll fetch the JavaScript HTML and the updated CSS and store them in the new cache This doesn t happens automatically we must change the name of our cache to make this happen Then after the new Service Worker takes control we should delete the old cache so when we refresh the page we can get the latest CSS To make that change in the Service Worker we could just rename the name of the cache from v to v To get rid of the old cache we are going to use another Service Worker event activate The activate event will be fired when the Service Worker becomes active when it s ready to control pages and the previous one is gone self addEventListener activate function event This is the perfect time to delete old caches too In this event we can also use event waitUntil to control the process While you are activating the browser will queue other Service Worker events such as fetch so we can delete the old cache because the new one are coming To delete the old cache we can use caches delete caches delete cacheName and you can get the name of all of your caches using caches keys caches keys both methods return promises The easy way to do that would be to change the version name and call caches delete passing in the old name in the activate event but this is not scalable To make it scalable we should store the name of the actual cache in a variable let staticCacheName example static v and refactor the code so we ll place the variable instead of the actual name Then in the activate event we can get all the names of the caches that exist and filter them because I m only interested in the caches that start with example but that they are not staticCacheName So in that way we will have a list of caches that we don t need anymore that we can delete We can put this logic inside a Promise that looks like this self addEventListener activate function event event waitUntil caches keys then function cacheNames return Promise all cacheNames filter function cacheName return cacheName startsWith example amp amp cacheName staticCacheName map function cacheName return cache delete cacheName We have now completed the Unobtrusive app updates of our to do list Give the latest version to the userWhen a new Service Worker is discovered it waits until all pages using the current version go away before it can take over and that might take a long time instead we can warn the user there is a new version of the app and give him a button to dismiss the update or another one to take the new version To achieve this we need the update notification Thankfully we have APIs that give us insight of the Service Worker lifecycle When we register the Service Worker it returns a promise That promise will give us a Service Worker registration object which has properties and methods related to the Service Worker registration We get methods to unregister or trigger an update on the Service Worker and free properties installing waiting active that will point to a Service Worker object or be null Also the registration object will emit an event when a new update is found called updatefound of course classic navigator serviceWorker register sw js then function reg reg unregister reg update reg installing reg waiting reg active reg addEventListener updatefound function reg installing has changed On the Service Worker objects themselves we can look at their statelet sw reg installing console log sw state Logs the stateand it could be installing the install event has fired but hasn t yet completed installed installation completed successfully but hasn t yet activated activating the activate event has fired but not yet completed activated the Service Worker is ready and it can receive fetch events redundant the Service Worker has been thrown away being replaced by a new one or by a fail of an install The Service Worker fires an event when the value of the state property changes sw addEventListener statechange function sw state has changed Also navigator serviceWorker controller refers to the Service Worker that controls this page so if you want to tell the user there s an update ready we need to look at the state of things when the page loads and listen for future changes For instance if there is no controller it means the page didn t load using a Service Worker so the content we see is from the network if navigator serviceWorker controller page didn t load using a service worker Otherwise we need to look at the registration if reg waiting there s an update ready we tell the user about it otherwise if there is a installing worker there s an update in progressif reg installing there s an update in progress this update might fail so we listen to the state changes to track it reg installing addEventListener statechange function if this state installed there s an update ready we tell the user about it otherwise we listen for the update found event when that fires we track the state of the installing worker and if it reaches the installed state we tell the user reg addEventListener updatefound function reg installing addEventListener statechange function if this state installed there s an update ready we tell the user about it In conclusion when there s an update ready we could call a method that prompts an alert to the users telling them there s a new version Something like a toast for example MainController prototype updateReady function let toast this toastView show New version of the app available buttons exampleButton Now if we make any changes to the Service Worker for example bumping the version up the user will get a notification The notification doesn t do anything yet it s useless right now we have to make it work so it actually updates the app version for the user Triggering an updateWe have a notification with an useless button that we need to make it work Clicking this button needs to tell the waiting Service Worker that it should take over straight away bypassing the usual life cycle Then we want to refresh the page so it reloads with the latest assets from the newest cache There are three components that let us accomplish this A Service Worker can call skipWaiting while it s waiting or installing self skipWaiting This tells it shouldn t queue behind another Service Worker it should take over straight away We want to call this when the user hits the Update button in our update notification But how do we send the action from the page to the waiting Service Worker We can send messages to any Service Worker using postMessage reg installing postMessage foo bar from a pageand we can listen to messages in the Service Worker using the message event self addEventListener message function event in the SW event data foo bar so we will send a message to our Service Worker telling it to call skip waiting Finally we ve already seen navigator serviceWorker controller but the page gets an event when its value changes meaning the new Service Worker has taken over We ll use this as an action to refresh the page navigator serviceWorker addEventListener controllerchange function navigator serviceWorker controller has changed We ll apply this to our previous mentioned method updateReady MainController prototype updateReady function let toast this toastView show New version of the app available buttons update dismiss toast answer then function answer if answer update return If he clicks on dismiss return Otherwise tell the Service Worker to skipWaiting worker postMessage action skipWaiting And in the Service Worker file we are going to listen for the message event and call skipWaiting if we get the appropriate message to make this Service Worker take over pages self addEventListener message function event if event data action skipWaiting self skipWaiting Now we need to react to skipWaiting being called so back in the page controller MainController im going to listen for the controlling Service Worker changing and reload the page navigator serviceWorker addEventListener controllerchange function window location reload You can use this in any way you wish If the update has minor things maybe don t bother the user at all let them get the update naturally or for example if the update contains an urgent security fix maybe refresh the page directly no matter what the user is doing That wouldn t be a nice experience but it s better that the user using an app with a major security flaw We have now completed the Give the latest version to the user of our to do list Now we need to keep updated the cache of the content Caching The Page ContentFinally instead of caching the root page we will cache the skeleton and bump the version of the cache self addEventListener install function event event waitUntil We open a cache named example static v then we add cache the urls we want caches open example static v then function cache return cache addAll lt We change the root skeleton js main js css main css imgs example png Now in the fetch event we are going to respond to requests for the root page with the page skeleton from the cache self addEventListener fetch function event let requestUrl new URL event request url if requestUrl origin location origin if requestUrl pathname event respondWith caches match skeleton return event respondWith caches match event request then function response if response return response return fetch event request In this case we only want to intercept route requests from the same origin that s why if it s the root we respond with the skeleton from the cache we don t need to go to the network as a fallback because whe have skeleton cached as part of the install step At this point we have a pretty good product something that we could launch It doesn t change a lot if we have perfect connection but perfect doesn t exist On a slow connection we get to render the top bar and content much quicker because our JavaScript is arriving sooner and with offline we are showing something at least better than the no connection message of the browser Even at this point we can really improve the user experience by caching the posts of the content and to do that we can use one of the most hated APIs Tense music IndexedDB But that will be in another post we ll try to use the good things of it maybe it won t be that bad right Maybe 2021-04-12 14:11:01
海外TECH DEV Community Lets make a simple API! https://dev.to/sigfualt/lets-make-a-simple-api-9jp Lets make a simple API We are going to create a simple REST API using a compiled language In this example we will use asp net core to create an API Server We will cover the post get put and delete actions There are a lot of options to create an API Python JavaScript Java and many others In this example we will drink the asp net kool aid This ecosystem has great project generation and in the midwest it is the dominant choice for many companies In this post I ll walk through building Store API style functionality For those following along at home all the code is in a GitHub repository Each commit in the repo corresponds to a step in this post Step Generate the projectThis assumes you have the NET Core SDK or Visual Studio Community installed If you have Visual Studio Community do the following Go to File gt New gt Project…Select the Visual C project category and then select ASP NET Web Application NET Framework Name your project AspNetWebApiRest and click OKSelect the Empty project template and click OK don t check any boxes to add core references dotnet new webapi o StoreApicd StoreApidotnet add package Microsoft EntityFrameworkCore InMemorycode r StoreApiThis generates a simple ASP NET API website We are using an InMemory database for speedy development This would not be a proper set up for a live site it is not complicated to add one later Step Build out the Domain ModelIn this step we build a few simple classes Models Products cspublic class Products public int Id get set public string Sku get set public string Name get set public string Description get set public decimal Price get set public bool IsAvailable get set public int CategoryId get set lt summary gt This is to stop a circular reference lt summary gt JsonIgnore public virtual Category Category get set Models User cspublic class User public int Id get set public string Email get set public virtual List lt Order gt Orders get set Models Category cspublic class Category public int Id get set public string Name get set public virtual List lt Product gt Products get set Models Order cspublic class Order public int Id get set public DateTime OrderDate get set public int UserId get set lt summary gt This is to stop a circular reference lt summary gt JsonIgnore public virtual User User get set public virtual List lt Product gt Products get set Step Build out Entity Framework CoreWe will install two nuget packages to get the ball rolling Install Package Microsoft EntityFrameworkCore InMemory Version AndInstall Package Microsoft EntityFrameworkCore Version In this section we will first create the ShopContext class Here we will add entity framework core into the project and seed the database Models ShopContext cspublic class ShopContext DbContext public ShopContext DbContextOptions lt ShopContext gt options base options protected override void OnModelCreating ModelBuilder modelBuilder modelBuilder Entity lt Category gt HasMany c gt c Products WithOne a gt a Category HasForeignKey a gt a CategoryId modelBuilder Entity lt Order gt HasMany o gt o Products modelBuilder Entity lt Order gt HasOne o gt o User modelBuilder Entity lt User gt HasMany u gt u Orders WithOne o gt o User HasForeignKey o gt o UserId modelBuilder Seed public DbSet lt Product gt Products get set public DbSet lt Category gt Categories get set public DbSet lt Order gt Orders get set public DbSet lt User gt Users get set Let us explore what is going on in this class We will use the documentation to configure the DbContext After that we had to tell Entity Framework the relation between those model classes We are using the Fluent API in Entity Framework Core for our mappings mappings You can dive deeper into how to use them here but going into detail about that concept is outside the scope of this writing We will also add an extension method to seed the database with values Models ModelBuilderExtensions csThis file is too long to give a preview for so just copy it using the link above With all of that the project is now set up for us to start working on some crud operations So let s get to it Step Build out the GETHere we are going to create the GetAllProducts and GetProduct int id methods As the name implies the get all products will all of the products The get product will use the product id to pull back that specific product public class ProductsController ControllerBase private readonly ShopContext context public ProductsController ShopContext context context context context Database EnsureCreated HttpGet public IActionResult GetAllProducts return Ok context Products ToArray HttpGet id public IActionResult GetProduct int id var product context Products Find id return Ok product We have already created our Context class The context object is how we interact with the runtime database Using the Find and ToArray call from the context object are the backbone of our methods That s it for the GET calls Step Build out the POSTHere we will need some extra software to implement this I use Insomnia but there is nothing wrong with anything else We will use the following json to test our new code name Old Skater Jeans sku AWMGSYYJ price isAavailable true categoryId Using the api client of your choice we will put that json in the body of your PUT call We will add the following method to now receive PUTs HttpPost public ActionResult lt Product gt PostProduct FromBody Product product context Products Add product context SaveChanges return CreatedAtAction GetProduct new id product Id product With this in our controller we can accept a call and we can test this and see the update in the system In this method we are using EF core and CreatedAtAction call The EF is just an add for the moment and the CreatedAtAction returns a created response with a location header In another post we will add to this but for now this is a simple example Step Build out the PUTIn this section we will work on the update portion of the api We will use similar json but with some changes name Super Old Skater Jeans sku AWMGSYYZZ price isAavailable true categoryId There are just a few updates to the name sku and price We will have to use the correct path to trigger a put https localhost your port number products the id of the product you want to update Now just so we are on the same page there should not be curly braces in your actual url That s just for us We will add the new put method now HttpPut id public IActionResult PutProduct FromRoute int id FromBody Product product if id product Id return BadRequest context Entry product State EntityState Modified try context SaveChanges catch DbUpdateConcurrencyException if context Products Find id null return NotFound throw return NoContent Here we are working with many of the same objects nothing new or fancy We are using BadRequest NotFound and NoContent Using EntityState we have a lot of options but it is too much to go over in this small section From the documentation it is Modified the entity is being tracked by the context and exists in the database and some or all of its property values have been modified That should be enough to keep us going Step Build out the DELETEOk we are at the home stretch The delete will act the same way as our put method Except in our tool we will select delete instead of put to see some action HttpDelete id public async Task lt ActionResult lt Product gt gt DeleteProduct int id var product await context Products FindAsync id if product null return NotFound context Products Remove product await context SaveChangesAsync return product This is it for our basic api We will add some more changes to this project in a later post Some of the things we will cover will be adding a full database to this paging filtering searching and sorting and more Thank you for reading And we re done You can see all the changes in order by looking at the commits in order Or just see the final result at 2021-04-12 14:07:21
海外TECH DEV Community Nuxt.js and Vercel Functions without using `vercel dev` https://dev.to/deeja/nuxt-js-and-vercel-functions-without-using-vercel-dev-4dgf Nuxt js and Vercel Functions without using vercel dev I d recently being having issues using Vercel s serverless functions with SSG Although I haven t been able to fix that just yet I realised I could run vercel functions without using the dev proxy NOTE I wasn t able to consistently get the correct data from the body of the request Not sure why but res read was skipping the first line of the request body when toString was called This means with my current code ONLY GET requests are supported Shouldn t be hard to get it working with POST if you can spare the troubleshooting time Nuxt serverMiddleware to the rescue In production Vercel uses serverless functions to handle the calls to the functions found at api These functions are not available using the standard yarn dev serverMiddleware allows any call to the dev server be intercepted For us that means allowing requests to captured and redirected to Vercel functions directly The only issue there is handle data in a way that the functions expect The vercel node package has the file vercel node dist helpers js which contains the js that normally runs via the vercel dev command Putting it together middleware server vercel tsimport ServerMiddleware from nuxt types import VercelResponse VercelRequest VercelApiHandler from vercel node const vercel ServerMiddleware req res next gt const apiNameRegex w g const matches apiNameRegex exec req url if matches matches res statusCode res end return const apiName matches const moduleName api apiName allow dynamic code change reloads possibly detect changes and remove that way delete require cache require moduleName const requestedApi require moduleName default as VercelApiHandler const helpers require helpers const body req read this should work but it s being very strange const body Buffer from dummy content POST not working const vercelRequest VercelRequest helpers httpToVercelRequest req body const vercelResponse VercelResponse helpers httpToVercelResponse req res try requestedApi vercelRequest vercelResponse catch err console error err helpers sendError res err export default vercel middleware server helper ts The file is a copy of vercel node dist helpers js ADDED AT LINE function httpToVercelRequest req body setLazyProp req cookies getCookieParser req setLazyProp req query getQueryParser req setLazyProp req body getBodyParser req body return req function httpToVercelResponse req res res status statusCode gt status res statusCode res redirect statusOrUrl url gt redirect res statusOrUrl url res send body gt send req res body res json jsonBody gt json req res jsonBody return res exports httpToVercelRequest httpToVercelRequest exports httpToVercelResponse httpToVercelResponse nuxt config js Added property serverMiddleware path api handler middleware server vercel ConclusionWhen not running vercel dev calls to any url starting with api should now be handled by nuxt itself If running with vercel dev or on a server then the functions will be handled by Vercel 2021-04-12 14:06:04
Apple AppleInsider - Frontpage News Apple drops 'far beyond HDR' claim for UK Pro Display XDR marketing https://appleinsider.com/articles/21/04/12/apple-drops-far-beyond-hdr-claim-for-uk-pro-display-xdr-marketing Apple drops x far beyond HDR x claim for UK Pro Display XDR marketingApple has changed how it markets the Pro Display XDR in the United Kingdom following complaints to an advertising regulator with it no longer using the words Far beyond HDR to describe the screen Apple s Pro Display XDR is an impressively powerful monitor capable of displaying HDR content as well as Dolby Vision and HLG playback While Apple routinely proclaims the display s virtues it s had to modify its messaging in the United Kingdom at least Following complaints made to the Advertising Standards Authority Apple has updated its website to remove the phrase Far beyond HDR from descriptions of the Pro Display XDR The second paragraph on the page eliminates the terms from the final statement which previously read Far beyond HDR it s Extreme Dynamic Range XDR Read more 2021-04-12 14:43:32
Apple AppleInsider - Frontpage News Apple TV+ launches new 'Mythic Quest' season 2 trailer https://appleinsider.com/articles/21/04/12/apple-tv-launches-new-mythic-quest-season-2-trailer Apple TV launches new x Mythic Quest x season trailerContinuing its build up to the May premiere of hit comedy Mythic Quest Apple TV has released a new two minute trailer Charlotte Nicdao and Rob McElhenney in Mythic Quest season two on Apple TV Apple has already released a teaser video a Testers promo and even a special bonus episode Now though Apple TV has unveiled the official trailer for season two of Mythic Quest Read more 2021-04-12 14:42:52
Apple AppleInsider - Frontpage News Apple Mac shipments grew more than 110% year-over-year in Q1 2021 https://appleinsider.com/articles/21/04/12/apple-mac-shipments-grew-more-than-110-year-over-year-in-q1-2021 Apple Mac shipments grew more than year over year in Q Apple s Mac is continuing to see a surge in growth with the company shipping more than double the number of units in the first quarter of than the year ago quarter Credit Andrew O Hara AppleInsiderThe Cupertino tech giant shipped an estimated million Mac models in Q up from an estimated million shipments in Q according to new data from analysis firm IDC The surge represents growth of year over year Read more 2021-04-12 14:09:41
海外TECH Engadget Domino’s starts making autonomous pizza deliveries https://www.engadget.com/dominos-autonomous-pizza-delivery-houston-143052956.html autonomous 2021-04-12 14:30:52
海外TECH Engadget Intel's Mobileye will power driverless 'last-mile' deliveries starting in 2023 https://www.engadget.com/intel-mobileye-udelv-self-driving-delivery-service-140443942.html Intel x s Mobileye will power driverless x last mile x deliveries starting in Intel s self driving technology company Mobileye has just announced a partnership with Udelv to build a fleet of autonomous delivery vehicles 2021-04-12 14:04:43
海外科学 NYT > Science The Fairy Circles Mystery Gets a New Suspect https://www.nytimes.com/2021/04/12/science/fairy-circles-australia.html wilderness 2021-04-12 14:36:45
金融 RSS FILE - 日本証券業協会 公社債発行額・償還額等 https://www.jsda.or.jp/shiryoshitsu/toukei/hakkou/index.html 発行 2021-04-12 15:00:00
金融 RSS FILE - 日本証券業協会 株主コミュニティ・株式投資型クラウドファンディングに関する記事広告 https://market.jsda.or.jp/shijyo/kabucommunity/seido/kabukomyukijikoukoku.html 記事広告 2021-04-12 15:00:00
金融 RSS FILE - 日本証券業協会 J-IRISS https://www.jsda.or.jp/anshin/j-iriss/index.html iriss 2021-04-12 15:33:00
金融 金融庁ホームページ 金融事業者における顧客本位の業務運営のさらなる浸透・定着に向けた取組みについて公表しました。 https://www.fsa.go.jp/news/r2/kokyakuhoni/202104/fd_2021.html 金融事業 2021-04-12 16:00:00
海外ニュース Japan Times latest articles After delay, Japan begins COVID-19 vaccinations for older people https://www.japantimes.co.jp/news/2021/04/12/national/coronavirus-japan-vaccines-elderly/ centers 2021-04-13 00:03:55
海外ニュース Japan Times latest articles Wealthy Japanese flying private in greater numbers, ANA says https://www.japantimes.co.jp/news/2021/04/12/business/corporate-business/ana-private-flights/ business 2021-04-12 23:57:15
海外ニュース Japan Times latest articles Japan’s slow vaccine rollout pushes back recovery time frame https://www.japantimes.co.jp/news/2021/04/12/national/japan-slow-vaccine-rollout/ Japan s slow vaccine rollout pushes back recovery time frameThe slow rollout means struggling businesses and fearful shoppers will have to hold out for longer as the economy s recovery is delayed by as much 2021-04-12 23:54:02
海外ニュース Japan Times latest articles Hideki Matsuyama wins Masters to become first Japanese man to claim major title https://www.japantimes.co.jp/sports/2021/04/12/more-sports/golf/matsuyama-wins-masters/ Hideki Matsuyama wins Masters to become first Japanese man to claim major titleMatsuyama survived some late slip ups and a determined challenge down the back nine from Xander Schauffele who finished under to claim the iconic green jacket 2021-04-13 00:14:05
ニュース BBC News - Home Prince Philip: William and Harry pay tribute to grandfather https://www.bbc.co.uk/news/uk-56721559 harry 2021-04-12 14:37:30
ニュース BBC News - Home Baroness Shirley Williams: Former cabinet minister dies aged 90 https://www.bbc.co.uk/news/uk-politics-56720985 baroness 2021-04-12 14:55:32
ニュース BBC News - Home Minneapolis: Daunte Wright killing by police near city sparks unrest https://www.bbc.co.uk/news/world-us-canada-56714346 daunte 2021-04-12 14:40:36
ニュース BBC News - Home Prince Philip funeral: Premier League, EFL, Premiership Rugby, racing schedules moved https://www.bbc.co.uk/sport/football/56705816 Prince Philip funeral Premier League EFL Premiership Rugby racing schedules movedThe Premier League EFL Premiership Rugby and British Horseracing change schedules on Saturday to avoid clashing with Prince Philip s funeral 2021-04-12 14:22:07
ニュース BBC News - Home Covid: What is the rule of six and what are the social distancing rules? https://www.bbc.co.uk/news/uk-51506729 wales 2021-04-12 14:17:31
ニュース BBC News - Home Lockdown rules: What are the restrictions in your area? https://www.bbc.co.uk/news/uk-54373904 coronavirus 2021-04-12 14:37:11
ビジネス ダイヤモンド・オンライン - 新着記事 アリババ傘下アント、金融持ち株会社に移行へ 人民銀の監督下に - WSJ発 https://diamond.jp/articles/-/268327 持ち株会社 2021-04-12 23:18:00
GCP Cloud Blog Introducing SAP Integration with Cloud Data Fusion https://cloud.google.com/blog/products/data-analytics/introducing-sap-integration-cloud-data-fusion/ Introducing SAP Integration with Cloud Data FusionBusinesses today have a growing demand for data analysis and insight based action More often than not the valuable data driving these actions is in mission critical operational systems Among all the applications that are in the market today SAP is the leading provider of ERP software and Google Cloud is introducing integration with SAP to help unlock the value of SAP data quickly and easily  Google Cloud native data integration platform Cloud Data Fusion now offers the capability to seamlessly get data out of SAP Business Suite SAP ERP and S HANA Cloud Data Fusion is a fully managed cloud native data integration and ingestion service that helps ETL developers data engineers and business analysts efficiently build and manage ETL ELT pipelines that accelerate the building of data warehouses data marts and data lakes on BigQuery or operational reporting systems on CloudSQL Spanner or other systems To simplify the unlocking of SAP data today we re announcing the public launch of the SAP Table Batch Source With this capability you can now use Cloud Data Fusion to easily integrate SAP application data to gain invaluable insights via Looker You can also leverage the best in class machine learning products on Google Cloud to help you gain insight into your business by combining SAP data with other datasets Some examples include running machine learning on IoT data joined with ERP transactional data to do predictive maintenance application to application integration with SAP and CloudSQL based applications fraud detection spend analytics demand forecasting etc Let s take a closer look at the benefits of the SAP Table Batch Source in Cloud Data Fusion Developer ProductivityAs Cloud Data Fusion is a complete visual environment users can use the Pipeline Studio to quickly design pipelines that read from SAP ECC or S HANA With Data Fusion s prebuilt transformations you can easily join data from SAP and non SAP systems and perform complex transformations like data cleansing aggregations data preparation and lookups to rapidly get insights from the data  Time to ValueIn traditional approaches users are forced to define models on data warehousing systems In Cloud Data Fusion this is automatically performed for the users when using BigQuery After you design and execute a data pipeline that writes to BigQuery Data Fusion auto generates the schema in BigQuery for you As users don t need to pre build models you get insight into your data faster which results in improved productivity for your organization Performance and ScalabilityCloud Data Fusion scales horizontally to execute pipelines Users can leverage the ephemeral clusters or dedicated clusters to run the pipelines The SAP Batch Source plugin automatically tunes the data pipelines for optimal performance when it extracts data from your SAP systems based on both SAP application server resources and Cloud Data Fusion runtime resources If parallelism is misconfigured a failsafe mechanism in the plugin prevents any issues in your source system How does SAP Table Batch Source work Transfer full table data from SAP to BigQuery or other systemsIn the Pipeline Studio you can add multiple SAP source tables to a data pipeline and then join the other SAP source tables with joiner transformations As the joiner is executed in the Cloud Data Fusion processing layer there is no additional impact on the SAP system  For example To create a Customer Master data mart you can join all relevant tables from SAP using the plugin and then build complex pipelines for that data in Cloud Data Fusion s Pipeline Studio  Extract table records in parallelTo extract records in parallel you can configure the SAP Table Batch Source plugin using the Number of Splits to Generate property If this property is left blank the system determines the appropriate value for optimal performance  Extract records based on conditionsThe SAP Table Batch source plugin allows you to specify filter conditions by using the property Filter Options  You specify the conditions in OpenSQL syntax The plugin uses the SQL WHERE clause to filter the tables Records can be extracted based on conditions like certain columns having a defined set of values or a range of values  You can also specify complex conditions that combine multiple conditions with AND or OR clauses e g TIMESTAMP gt AND TIMESTAMP lt Limit the number of records to be extractedUsers can also limit the number for records extracted from the specified table by using the property Number of Rows to Fetch This is particularly useful in development and testing scenarios Maximizing the returns on dataWith Google Cloud Platform you can already scale and process huge amounts of social operational transaction and IoT data to extract value and gain rapid insights Cloud Data Fusion provides many connectors to existing enterprise applications and data warehouses With the native capabilities to unlock SAP data with Cloud Data Fusion into BigQuery you can now go a step further and get more by driving rapid and intelligent decision making Ready to try out the SAP Table Batch connector Create a new instance of Data Fusion and deploy the SAP plugin from the Hub Please refer to the SAP Table Batch Source user guide for additional details To learn more about how leading companies are powering innovation with our data solutions including data integration check out Google Cloud s Data Cloud Summit on May th 2021-04-12 15:00:00

コメント

このブログの人気の投稿

投稿時間: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件)