投稿時間:2021-06-07 07:14:46 RSSフィード2021-06-07 07:00 分まとめ(17件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
TECH Engadget Japanese 栄光を掴め!打撃と回避を駆使する対戦アクション『Swipe Fight!』:発掘!スマホゲーム https://japanese.engadget.com/swipe-fight-211041861.html swipefight 2021-06-06 21:10:41
Google カグア!Google Analytics 活用塾:事例や使い方 TikTokのアルゴリズムに変化が起きている https://www.kagua.biz/social/tiktok/20210607.html tiktok 2021-06-06 21:00:44
python Pythonタグが付けられた新着投稿 - Qiita Windows10でのPyMC3インストールについて:きちんとオリジナルの手順を確認しましょう https://qiita.com/shincomcom/items/241bf073970abac733c4 pipinstallpymcこうやってPyMCをインストールした後で、チュートリアルを動かすと、きちんと動きました安易に記事を探すより、オリジナルの手順に沿ってやりましょうという話でした。 2021-06-07 06:37:34
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) for文で表示させた外部APIのデータを別な場所で表示させたい https://teratail.com/questions/342564?rss=all for文で表示させた外部APIのデータを別な場所で表示させたい前提・実現したいこと取得した外部APIのデータをfor文で取り出して表示していますが、表示したデータをユーザーがクリックすると別な場所に表示されるという動作を実現したいです。 2021-06-07 06:58:12
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) javascriptでhtml内容物前後にタグ挿入する方法 https://teratail.com/questions/342563?rss=all javascriptでhtml内容物前後にタグ挿入する方法htmlを以下のように書き換えたいのですが、適切な関数があれば教えて下さい。 2021-06-07 06:17:38
Ruby Railsタグが付けられた新着投稿 - Qiita 【Rails】フォロー機能の実装(非同期) https://qiita.com/oak1331/items/765dab0c6b3ccda0e580 【Rails】iQueryの導入手順はじめにルーティングの設定Relationshipモデルの作成アソシエーション設定バリデーションの設定メソッドの定義relationshipsコントローラーの作成アクションの定義フォローボタンの表示jsファイルの作成はじめに今回はフォロー機能を実装していきます。 2021-06-07 06:04:59
技術ブログ Developers.IO 実践!AWS CDK #8 抽象化 https://dev.classmethod.jp/articles/cdk-practice-8-abstraction/ awscdk 2021-06-06 21:00:48
海外TECH Ars Technica Woman in Motion tells story of how Star Trek’s Uhura changed NASA forever https://arstechnica.com/?p=1770220 motion 2021-06-06 21:32:40
海外TECH DEV Community Supabase - Quickstart: Vue.js https://dev.to/aaronksaunders/supabase-quickstart-vue-js-5f23 Supabase Quickstart Vue jsThis is based on the quickstart example s provided by supabase using React js and Next jsJust a reminder from the Supabase Documentation what exactly supabase isSupabase is an open source Firebase alternative We are a service to Listen to database changes Query your tables including filtering pagination and deeply nested relationships like GraphQL Create update and delete rows Manage your users and their permissions Interact with your database using a simple UI IntroThis example provides the steps to build a simple user management app from scratch using Supabase and Vue js It includes Supabase Database a Postgres database for storing your user data Supabase Auth users can sign in with magic links no passwords only email Supabase Storage users can upload a photo Row Level Security data is protected so that individuals can only access their own data Instant APIs APIs will be automatically generated when you create your database tables By the end of this guide you ll have an app which allows users to login and update some basic profile details Project Set upBefore we start building we re going to set up our Database and API This is as simple as starting a new Project in Supabase and then creating a schema inside the database Create a projectGo to app supabase io Click on New Project Enter your project details Wait for the new database to launch Set up the database schemaNow we are going to set up the database schema We can use the User Management Starter quickstart in the SQL Editor or you can just copy paste the SQL from below and run it yourself Create a table for public profiles create table profiles id uuid references auth users not null updated at timestamp with time zone username text unique avatar url text website text primary key id unique username constraint username length check char length username gt alter table profiles enable row level security create policy Public profiles are viewable by everyone on profiles for select using true create policy Users can insert their own profile on profiles for insert with check auth uid id create policy Users can update own profile on profiles for update using auth uid id Set up Realtime begin drop publication if exists supabase realtime create publication supabase realtime commit alter publication supabase realtime add table profiles Set up Storage insert into storage buckets id name values avatars avatars create policy Avatar images are publicly accessible on storage objects for select using bucket id avatars create policy Anyone can upload an avatar on storage objects for insert with check bucket id avatars Get the API KeysNow that you ve created some database tables you are ready to insert data using the auto generated API We just need to get the URL and anon key from the API settings Go to the Settings section Click API in the sidebar Find your API URL in this page Find your anon and service role keys on this page Building the AppLet s start building the Vue js app from scratch Initialize a Vue AppWe can use vue cli to initialize an app called vue user management vue create vue user managementcd vue user managementThen let s install the only additional dependency supabase jsnpm install supabase supabase jsAnd finally we want to save the environment variables in a env local All we need are the API URL and the anon key that you copied earlier env localNEXT PUBLIC SUPABASE URL YOUR SUPABASE URLNEXT PUBLIC SUPABASE ANON KEY YOUR SUPABASE ANON KEYNow that we have the API credentials in place let s create a helper file to initialize the Supabase client These variables will be exposed on the browser and that s completely fine since we have Row Level Security enabled on our Database lib supabaseClient js Helper to initialize the Supabase client import createClient from supabase supabase js const supabaseUrl process env VUE APP SUPABASE URL const supabaseAnonKey process env VUE APP SUPABASE ANON KEY export const supabase createClient supabaseUrl supabaseAnonKey Set Up An Auth ComponentLet s set up a React component to manage logins and sign ups We ll use Magic Links so users can sign in with their email without using passwords New component called Auth vue lt template gt lt div class row flex flex center gt lt div class col form widget gt lt h class header gt Supabase Vue js lt h gt lt p class description gt Sign in via magic link with your email below lt p gt lt div gt lt input class inputField type email placeholder Your email v model email gt lt div gt lt div gt lt button click e gt e preventDefault handleLogin email class button block disabled loading gt lt span gt loading Loading Send Magic Link lt span gt lt button gt lt div gt lt div gt lt div gt lt template gt lt script lang ts gt import defineComponent ref from vue import supabase from supabaseClient export default defineComponent name Auth setup const loading ref false const email ref const handleLogin async email gt try loading value true const error await supabase auth signIn email if error throw error alert Check your email for the login link catch error alert error error description error message finally loading value false return email loading handleLogin lt script gt lt style scoped gt lt style gt Account PageAfter a user is signed in we can allow them to edit their profile details and manage their account Let s create a new component for that called Account vue lt template gt lt div class form widget gt lt h class header gt Supabase Vue js Account lt h gt lt avatar url avatar url onUpload handleImageUpload gt lt div gt lt label htmlFor email gt Email lt label gt lt input id email type text value session user email disabled gt lt div gt lt div gt lt label htmlFor username gt Name lt label gt lt input id username type text v model username gt lt div gt lt div gt lt label htmlFor website gt Website lt label gt lt input id website type website v model website gt lt div gt lt div gt lt button class button block primary click updateProfile username website avatar url disabled loading gt lt span gt loading Loading Update lt span gt lt button gt lt div gt lt div gt lt button class button block click supabase auth signOut gt Sign Out lt button gt lt div gt lt div gt lt template gt lt script lang ts gt import defineComponent ref from vue import Avatar from Avatar import supabase from supabaseClient export default defineComponent name Account props session components Avatar setup props const loading ref false const username ref const website ref const avatar url ref const handleImageUpload async path gt avatar url value path await updateProfile username website avatar url path const updateProfile async username website avatar url gt try debugger loading value true const user supabase auth user const updates id user id username username value website website value avatar url avatar url value avatar url updated at new Date let error await supabase from profiles upsert updates returning minimal Don t return the value after inserting if error throw error catch error alert error message finally loading value false const getProfile async session gt try loading value true const user session user let data error status await supabase from profiles select username website avatar url eq id user id single if error amp amp status throw error if data username value data username website value data website avatar url value data avatar url debugger catch error alert error message finally loading value false getProfile props session return loading username website avatar url updateProfile supabase handleImageUpload lt script gt lt style scoped gt lt style gt Bonus Profile PhotosEvery Supabase project is configured with Storage for managing large files like photos and videos Create an Avatar ComponentLet s create an avatar for the user so that they can upload a profile photo and view an image associated with the user account We can start by creating a new component Avatar vue lt template gt lt img src avatarUrl alt Avatar class avatar image style height px width px gt lt div style width px gt lt input style visibility hidden position absolute type file id single accept image change uploadAvatar disabled uploading gt lt label class button primary block htmlFor single gt lt span gt uploading UpLoading Upload lt span gt lt label gt lt div gt lt template gt lt script gt import ref watch from vue runtime core import supabase from supabaseClient import missingImage from assets no image available jpeg export default name Avatar props url String emits onUpload setup props ctx const avatarUrl ref null const uploading ref false watch gt props url cur gt downloadImage cur const downloadImage async path gt console log download path path if path avatarUrl value missingImage return const data error await supabase storage from avatars download path if error throw error avatarUrl value URL createObjectURL data async function uploadAvatar event debugger try uploading value true if event target files event target files length throw new Error You must select an image to upload const file event target files const fileExt file name split pop const fileName Math random fileExt const filePath fileName let error uploadError await supabase storage from avatars upload filePath file if uploadError throw uploadError ctx emit onUpload filePath catch error alert error message finally uploading value false return avatarUrl uploading uploadAvatar lt script gt lt Add scoped attribute to limit CSS to this component only gt lt style scoped gt lt style gt App Componenthere in the app component we are tracking the session information to determine if we should render the Auth Component or the Account component When the App Component is mounted we check for a session and we also set up a listener to track for authentication state changes in the application to once again render the appropriate component lt template gt lt div className container style padding px px gt lt template v if session gt lt account key session user id session session gt lt template gt lt template v else gt lt auth gt lt template gt lt div gt lt template gt lt script lang ts gt import defineComponent onMounted ref from vue import Auth from Auth vue import Account from Account vue import supabase from supabaseClient export default defineComponent name App components Auth Account setup const session ref null onMounted gt session value supabase auth session supabase auth onAuthStateChange gt session value supabase auth session console log session value return session lt script gt lt style gt lt style gt Launch Now that we have all the components in place let s update main js import createApp from vue import App from App vue const app createApp App app mount app VideosSee other Supabase VueJS Videos Here GitHub aaronksaunders supabase vue user management supabase io quickstart example in vuejs supabase vue user managementThis is based on the quickstart example s provided by supabase using React js and Next jsJust a reminder from the Supabase Documentation what exactly supabase isSupabase is an open source Firebase alternative We are a service to Listen to database changes Query your tables including filtering pagination and deeply nested relationships like GraphQL Create update and delete rows Manage your users and their permissions Interact with your database using a simple UI Blog Post View on GitHub 2021-06-06 21:07:53
海外TECH DEV Community Send a POST Request Containing a GraphQL Query with the Fetch API https://dev.to/jdedwards3/send-a-post-request-containing-a-graphql-query-with-the-fetch-api-8ee Send a POST Request Containing a GraphQL Query with the Fetch APIGraphQL is a query language specification that is used for Web APIs to permit the use of API clients to create data queries The queries can be specific to the client and they are sent to a GraphQL server that is able to return exactly the data that was requested A single GraphQL POST request can be used to obtain all of the data that is needed for the current context This is in contrast to RESTful APIs that might result in a chain or waterfall of requests with each request requiring data from the previous in order to retrieve all of the data from the API server Typically a GraphQL client is used to facilitate the client side query building and to send HTTP POST requests containing GraphQL queries to the GraphQL server responsible for returning the data It is not required to use a dedicated GraphQL client as it is possible to send a GraphQL query as a POST request using the Fetch API and this is similar to the process used to submit FormData using the Fetch API To show how to send a POST request containing a GraphQL query with the Fetch API data from the GraphQL API provided by WPGraphQL can be used After fetching the latest posts from the GraphQL API by sending a POST request containing the GraphQL query we can display the data as a list with each item title as a link Create HTML FileFirst create an HTML file that will link to a JavaScript file containing the code that will send the GraphQL query as a POST request with the Fetch API After sending the POST request containing the GraphQL query the result of the query will be displayed as HTML and before any data is received a no data message is displayed In the project folder add a new file named index html with the following content lt index html gt lt DOCTYPE html gt lt html lang en gt lt head gt lt meta charset utf gt lt title gt Post a GraphQL Query with the Fetch API lt title gt lt head gt lt body gt lt div id data container gt lt p gt no data yet lt p gt lt div gt lt script src script js gt lt script gt lt body gt lt html gt Add JavaScript FileIn the index html file there is a JavaScript file referenced that is named script js We can create that file in the same folder as the index html file After creating script js in the project folder add the following code const dataFetchDisplay function eventListenerSelector eventType dataFetcher displayUpdater dataTargetSelector document querySelector eventListenerSelector addEventListener eventType async gt displayUpdater dataTargetSelector await dataFetcher The dataFetchDisplay function has an options object as the parameter that contains the information needed to send the Fetch API POST request containing a GraphQL query although we have yet to call this function or define the functions displayUpdater and dataFetcher that are included in the options parameter and used within the async callback of the event listener that is instantiated when the dataFetchDisplay function is called Here is how the dataFetchDisplay function will be used dataFetchDisplay eventListenerSelector data button eventType click dataFetcher getData displayUpdater updateDisplay dataTargetSelector data container Notice that the eventListenerSelector and dataTargetSelector parameters correspond to the ID attributes that are present in the index html file created in the first step These values can be changed but the values must match the HTML document ID attributes Go ahead and add the invocation of the dataFetchDisplay function directly below the function definition previously added to script js Fetch API POST Request with GraphQL QueryNow that we have the dataFetchDisplay function defined and being called if we try to run this code it will result in an error because the helper functions to get the data and display it are not yet defined Directly above the dataFetchDisplay function add the following code to define the getData function that is referenced in the dataFetcher options object parameter key value const getData async function return await await fetch method POST headers Content Type application json body JSON stringify query posts nodes title link json data posts nodes The getData function shown above is where the POST request sent by the Fetch API containing the GraphQL query is defined For this example the GraphQL API is provided by WPGraphQL and the query will retrieve the link and title information for the ten most recent blog posts Since we know the format of the data that is returned from the GraphQL query POST request sent with the Fetch API we can return only the nodes in the getData function That way when the getData function is used the data is already formatted as an array of post objects Display GraphQL Query DataNow that we have the getData function defined and the GraphQL query data is returned after sending a POST request using the Fetch API we need to display the data once it is returned from the GraphQL API server To do this the function that is passed in as the displayUpdater parameter in the options object will be used Add this code above the dataFetchDisplay function in the script js file const updateDisplay function selector data const list document createElement ul data forEach function item const listItemLink document createElement a listItemLink textContent item title listItemLink setAttribute href item link const listItem document createElement li listItem appendChild listItemLink list appendChild listItem document querySelector selector replaceChildren list The updateDisplay accepts two parameters one to indicate the target element to insert the HTML that is generated and the second is the data array In this example a link item is created for each data object using the title The list of link elements is then used to replace the html of the target element By passing the getData and displayUpdater functions in as parameters to the dataFetchDisplay function both the query and the way it should be displayed can be changed to suit the usage context The dataFetchDisplay function is generic in that sense as the parameters determine what data to display and how based on the specific usage of the function Putting all of the code sections together should result in a script js file that looks like this script jsconst getData async function return await await fetch method POST headers Content Type application json body JSON stringify query posts nodes title link json data posts nodes const updateDisplay function selector data const list document createElement ul data forEach function item const listItemLink document createElement a listItemLink textContent item title listItemLink setAttribute href item link const listItem document createElement li listItem appendChild listItemLink list appendChild listItem document querySelector selector replaceChildren list const dataFetchDisplay function eventListenerSelector eventType dataFetcher displayUpdater dataTargetSelector document querySelector eventListenerSelector addEventListener eventType async gt displayUpdater dataTargetSelector await dataFetcher dataFetchDisplay eventListenerSelector data button eventType click dataFetcher getData displayUpdater updateDisplay dataTargetSelector data container Test GraphQL Post Request LocallyAt this point we have the index html and the script js file setup so we can make sure that it is working by testing it locally To do this we will need to install the http server npm package Before proceeding make sure to have Node js and npm installed as they are required npm init package jsonOnce installed you can open the project folder in a terminal window and run the npm init command and follow the prompts that are displayed This will set up the package json in the project folder npm install http serverAfter configuring the package json file run the command npm install http server save dev The http server npm package is now installed as a development dependency add npm scriptIn the scripts object of the package json file configuration add the following script scripts dev http server The dev script can now be run and this will start the local development environment using the http server npm package You should now have a node modules folder that was added to the project folder and the package json file should look like this name post graphql query fetch api version description main script js scripts dev http server test echo Error no test specified amp amp exit author license ISC devDependencies http server To start the local development environment with http server run the command npm run dev and navigate to the url that is displayed in the console output The development url will most likely be http localhost as this is the default setting for the local server configuration After running the npm run dev command and navigating http localhost you should see the no data yet message in your browser and the get data button we created earlier To send the GraphQL query POST request with the Fetch API click the get data button and the latest ten posts should will display on the page In some cases it might be beneficial to include a dedicated GraphQL client in your project but in others using the Fetch API to send a POST request containing a GraphQL query without a GraphQL client can be sufficient This can save time if the other more advanced features that come with GraphQL clients are not needed especially if requests to the GraphQL server are infrequent 2021-06-06 21:06:34
海外TECH Engadget Elon Musk says Tesla Model S Plaid+ is 'canceled' https://www.engadget.com/elon-musk-says-tesla-model-s-plaid-plus-canceled-211804141.html?src=rss_b2c plaid 2021-06-06 21:18:04
海外TECH CodeProject Latest Articles Inno Setup Dependency Installer https://www.codeproject.com/Articles/20868/Inno-Setup-Dependency-Installer application 2021-06-06 21:29:00
ニュース BBC News - Home Bafta TV Awards: 8 backstage bites from the ceremony https://www.bbc.co.uk/news/entertainment-arts-57376765 winners 2021-06-06 21:13:11
ニュース BBC News - Home Brownlee disqualified and faces Olympic heartbreak as GB's Yee wins in Leeds https://www.bbc.co.uk/sport/triathlon/57377569 Brownlee disqualified and faces Olympic heartbreak as GB x s Yee wins in LeedsDouble Olympic champion Alistair Brownlee is disqualified as Britain s Alex Yee wins the men s race in the World Triathlon Series event in Leeds 2021-06-06 21:16:51
北海道 北海道新聞 A級戦犯7人、太平洋に散骨 米軍将校「私がまいた」 https://www.hokkaido-np.co.jp/article/552498/ 東京裁判 2021-06-07 06:05:00
北海道 北海道新聞 サーフィン、大原が五輪出場権 世界最終予選 https://www.hokkaido-np.co.jp/article/552497/ 世界最終予選 2021-06-07 06:05:00
ビジネス 東洋経済オンライン 日本が旧日本軍「失敗の本質」繰り返す悪弊の正体 部分最適求める永遠平時国家のままでは戦えない | 新型コロナ、長期戦の混沌 | 東洋経済オンライン https://toyokeizai.net/articles/-/431672?utm_source=rss&utm_medium=http&utm_campaign=link_back 旧日本軍 2021-06-07 06:30: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件)

投稿時間:2024-02-12 22:08:06 RSSフィード2024-02-12 22:00分まとめ(7件)