IT |
気になる、記になる… |
NTTドコモ、「U15はじめてスマホプラン」の月間データ容量を5GBへ増量 |
https://taisy0.com/2021/12/14/149744.html
|
利用可能 |
2021-12-14 09:10:14 |
IT |
気になる、記になる… |
「Nintendo Switch (有機ELモデル)」、両カラーモデルともAmazonで定価販売中 |
https://taisy0.com/2021/12/14/149741.html
|
amazon |
2021-12-14 09:04:41 |
TECH |
Engadget Japanese |
最大44%オフ! プロテインやサプリなど健康食品がお買い得。Amazonでセール開催中 |
https://japanese.engadget.com/sale-protein-095053297.html
|
amazon |
2021-12-14 09:50:53 |
TECH |
Engadget Japanese |
ナイキ、メタバース時代に備え商標保護とデジタル商品開発への対応着々 |
https://japanese.engadget.com/nike-acquires-virtual-sneakers-and-crypto-collectibles-startup-093022318.html
|
商品開発 |
2021-12-14 09:35:22 |
TECH |
Engadget Japanese |
『4Kナイトビデオ』を可能に。独自開発の画像+AIエンジン、MariSilicon XをOPPOが発表 |
https://japanese.engadget.com/oppo-mari-silicon-x-093538144.html
|
marisiliconx |
2021-12-14 09:31:38 |
TECH |
Engadget Japanese |
OPPOがメガネ端末 Air Glass 発表。単眼単色で軽い「アシステッドリアリティ」 |
https://japanese.engadget.com/oppo-ar-air-glass-093025989.html
|
airglass |
2021-12-14 09:30:25 |
TECH |
Engadget Japanese |
Galaxy S22 Ultra(仮)はSnapdragon 8 Gen 1を搭載するとの噂 |
https://japanese.engadget.com/galaxy-s-22-ultra-090015877.html
|
galaxysultra |
2021-12-14 09:00:15 |
ROBOT |
ロボスタ |
「空⾶ぶクルマ」のナビゲーションシステム「AirNavi」の実証実験 ドローンが自動で安全に目的地まで到着 三重県鳥羽市で実施 |
https://robotstart.info/2021/12/14/airnavi-experiment-prototype.html
|
airnavi |
2021-12-14 09:26:38 |
IT |
ITmedia 総合記事一覧 |
[ITmedia ビジネスオンライン] ドムドムバーガーの福袋 店頭とオンラインショップで、各3500円 |
https://www.itmedia.co.jp/business/articles/2112/14/news155.html
|
itmedia |
2021-12-14 18:44:00 |
IT |
ITmedia 総合記事一覧 |
[ITmedia News] トヨタ、バッテリーEVに本腰 15車種を一斉披露、2030年までに30車種展開へ |
https://www.itmedia.co.jp/news/articles/2112/14/news151.html
|
itmedia |
2021-12-14 18:37:00 |
IT |
ITmedia 総合記事一覧 |
[ITmedia ビジネスオンライン] ローソンストア100、「100円おせち」40種類を発売 累計販売数900万食を突破 |
https://www.itmedia.co.jp/business/articles/2112/14/news146.html
|
itmedia |
2021-12-14 18:14:00 |
AWS |
lambdaタグが付けられた新着投稿 - Qiita |
AWS Lambda->SNS>(chatbot)->Slack連携ができずに悩む |
https://qiita.com/sasaki_hir2/items/a93e8bceabbafe4c4958
|
AWSLambdagtSNSgtchatbotgtSlack連携ができずに悩むCloudWatchでサブスクリプションフィルタをLambda連携で作って、Lambdaで適当なsnspublishコードを書いて、Chatbotと連携済みのSNSトピックを指定してもSlackに通知されない。 |
2021-12-14 18:54:31 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
タイトル付きCSVを一行づつJSONで取り出す。 |
https://qiita.com/sugarflower/items/97a0b399cd7145ec0fcb
|
タイトル付きCSVを一行づつJSONで取り出す。 |
2021-12-14 18:58:40 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
TavernでStageごとの設定を使い分ける方法 |
https://qiita.com/atakig/items/08b34ba3d13b4e7c8377
|
|
2021-12-14 18:55:35 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
米国株式市場 将来株価予測 2位解法 |
https://qiita.com/shoji9x9/items/16d166a9ee9812069ae0
|
ラグ特徴量週分週単純移動平均とその標準偏差上場年セクター業界市場年月日年初から何週目か一部モデルにはこれ以外の特徴量も追加していますが、多くのモデルでは特徴量を追加した方がPublicLBのスコアが下がったため取りやめました。 |
2021-12-14 18:03:30 |
js |
JavaScriptタグが付けられた新着投稿 - Qiita |
【React】【Vue】 など流行りのフレームワークを使うもののためのJS基礎「グローバルオブジェクト」 |
https://qiita.com/t_109609akg/items/a8d03a2dd0cbd38e8a13
|
JavaScriptのコード内で、最も外側にある最上位のオブジェクト。 |
2021-12-14 18:24:00 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
Google Driveでフォルダ内のファイルが更新されたら通知メールを送るGoogle Apps Script(GAS) |
https://teratail.com/questions/373805?rss=all
|
GoogleDriveでフォルダ内のファイルが更新されたら通知メールを送るGoogleAppsScriptGAS前提・実現したいことGooglenbspAppsnbspScriptGASでGooglenbspDriveに新しいファイルが追加されたら通知メールが送信されるシステムを作っています。 |
2021-12-14 18:59:56 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
ExcelVBA フォーム上のボタンを押すと、エクセルファイルのシートに挿入したPDFファイルを表示させる |
https://teratail.com/questions/373804?rss=all
|
excelvba |
2021-12-14 18:57:06 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
jQery「slick」でPC時は画像3枚表示、レスポンシブでは1枚表示に変更する記述。 |
https://teratail.com/questions/373803?rss=all
|
jQery「slick」でPC時は画像枚表示、レスポンシブでは枚表示に変更する記述。 |
2021-12-14 18:49:44 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
Rails にてコメント機能を実装させたいです。 |
https://teratail.com/questions/373802?rss=all
|
Railsにてコメント機能を実装させたいです。 |
2021-12-14 18:47:22 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
[AOJ] 語数カウント問題 (ITP 1_9_A) |
https://teratail.com/questions/373801?rss=all
|
AOJ語数カウント問題ITPAAIZUnbspONLINEnbspJUDGEの問題ITPAですURLnbspnbsp問題のリンクAOJ以下問題ですlt問題gtつの単語nbspWnbspと文章nbspTnbspが与えられます。 |
2021-12-14 18:41:49 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
Tkinterでのcommandとしてのメソッド呼び出し時「selfが入力されていない」と表示される |
https://teratail.com/questions/373800?rss=all
|
Tkinterでのcommandとしてのメソッド呼び出し時「selfが入力されていない」と表示される前提・実現したいこと予め登録してある画像をTkinterを使用しランダムに表示するくじ引きガチャアプリを作ろうとしています。 |
2021-12-14 18:26:07 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
xcode13 インストール |
https://teratail.com/questions/373799?rss=all
|
gbxcodexip |
2021-12-14 18:23:54 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
クラスのメモリ解放方法 |
https://teratail.com/questions/373798?rss=all
|
クラスのメモリ解放方法一定時間の周期で複数のクラスを一時的に利用する単純なスクリプトです。 |
2021-12-14 18:21:35 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
Vue.jsで親コンポーネントからpropsで子コンポーネントにデータを送りたいです。 |
https://teratail.com/questions/373797?rss=all
|
Vuejsで親コンポーネントからpropsで子コンポーネントにデータを送りたいです。 |
2021-12-14 18:02:48 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
4つの座標からランダムで一つ選んで、キャラクターを出現させたい |
https://teratail.com/questions/373796?rss=all
|
つの座標からランダムで一つ選んで、キャラクターを出現させたい前提・実現したいことUnityでDのもぐらたたきゲームを作っています。 |
2021-12-14 18:01:48 |
GCP |
gcpタグが付けられた新着投稿 - Qiita |
Cloud Storageにアップされたファイルを検知してTopicに通知 |
https://qiita.com/xanadou/items/07138de8b00deeea3dc8
|
CloudStorageにアップされたファイルを検知してTopicに通知ミッション以前、CloudStorageにアップされたファイルを検知してCloudFunctionsを実行を記載しましたが、どこからかプルしたいので、その通知をTopicにプールしておきたくなりました。 |
2021-12-14 18:23:28 |
技術ブログ |
Developers.IO |
はじめてのAWS Snowcone – (3) AWS OpsHub for Snow Family のインストール |
https://dev.classmethod.jp/articles/my-first-snowcone-how-to-install-aws-opshub/
|
oneawsopshubforsnowfamily |
2021-12-14 09:37:43 |
技術ブログ |
Developers.IO |
[レポート] Streams, SQL, action! Real-time analytics with Materialize #reinvent |
https://dev.classmethod.jp/articles/streams-sql-action-real-time-analytics-with-materialize-reinvent/
|
action |
2021-12-14 09:02:31 |
海外TECH |
MakeUseOf |
5+ Free Virtual Tour Apps to Experience When Stuck Indoors |
https://www.makeuseof.com/free-virtual-tour-apps-when-stuck-indoors/
|
amazing |
2021-12-14 09:30:12 |
海外TECH |
DEV Community |
Advent of code day 14: A puzzle too good for me. |
https://dev.to/marcoservetto/advent-of-code-day-14-a-puzzle-too-good-for-me-440e
|
Advent of code day A puzzle too good for me Ok this was very challenging On the other side I feel like we are moving into puzzles territory and OUTSIDE of programming skill territory I just wanted some nice programming exercises not deep logical puzzles It is similar to an older puzzle where we are given a simple algorithm that would be exponentially inefficient to run directly Part works well over that algorithm part needed more brain Part one here reuse L is AdamsTowel Fs Load reuse L is FileSystem SNMap Collection map key S val Num Part Lab Data var S List product S Map map read method S map S that o map val key that if o o val else S class method mut This S string top string split S nl S nl imm product S List for s in top split add s imm map S Map for ss in top split S nl vals ss split S gt put key vals val vals This product product map map mut method Void doStep product step read method S List step product this for a in product vals I to size I b in product vals I to size c this map a b add a if c S add c add product right Main lab Lab string Fs Real of read input for i in Range I lab doStep map SNMap for e in lab product o val key e if o put key e val o val Num else put key e val Num Debug map Part is below here I m showing that in you can just group classes so that you do not clash by declaring the same class names again In my experience this is very useful when doing automated testing I tried many different solutions The main idea is that we can keep a map of chemical pairs into their current amount But at the end we have to count how many we have of the individual chemicals not the chemical pairs I naively just spitted all pairs and that does not work some elements are shared between pairs But the map is losing all the information on what order the various pairs are I was getting pretty desperate when eventually I figured out Just keep a count when you add the elements So I added a tot map and that did the trick However in order to make the strict aliasing and immutability type system of happy I had to use lent a way to mutate data while creating immutable stuff Part Lab Data mut SNMap tot var SNMap product S Map map read method S map S that o map val key that if o o val else S class method mut This S string top string split S nl S nl imm product S List for s in top split add s imm map S Map for ss in top split S nl vals ss split S gt put key vals val vals imm mP SNMap for a in product vals I to size I b in product vals I to size o val key a b if o put key a b val o val Num else put key a b val Num tot SNMap for e in product o val key e if o put key e val o val Num else put key e val Num This tot tot product mP map map mut method Void doStep product step tot this tot read method SNMap step lent SNMap tot mut res SNMap for key val in this product imm c this map val key key val imm totVal tot val key c if totVal tot put key c val totVal val val else tot put key c val val p key subString I to I c p c key subString I to I val res val key p val res val key p if val res put key p val val val val else res put key p val val if val res put key p val val val val else res put key p val val return void res Main lab Lab string Fs Real of read input for i in Range I lab doStep Debug lab tot |
2021-12-14 09:41:50 |
海外TECH |
DEV Community |
How to get early access of thirdWeb.com |
https://dev.to/azizqamar7/how-to-get-early-access-of-thirdwebcom-1de
|
How to get early access of thirdWeb comOn Dec thirdweb launches its on platform to make it possible and incredibly to build web applications thirdweb will enable you to build web projects such as NFT s marketplaces tokens and more awesome projects in few clicks You can also integrate web features into your app using SDK s widgets and interfaces To get early access of thirdweb follow below steps Step Go to this link Step Before clicking connect wallet button make sure you have Metamask wallet and Polygon Network added in your wallet P S you can connect any wallet to be safe you can use Mumbai testnet network Here how you can get your Metamask wallet and to add Polygon network add below details by clicking ADD NETWORK button in Metamask Network Name Polygon MainnetNew RPC URL ChainID Symbol MATICBlock Explorer URL Step Now you can click connect wallet buttonStep After connecting your wallet you can select polygon network from drop down Step Successfully message shall appear as below image shownNow you have minted Free early access NFT enjoy To view your thirdweb early access NFTGo to your OpenSea account if you don t have create one by connecting your Metamask wallet After creating go to your profile section and click the HIDDEN TAB you can view there By clciking bottom dots on that NFT click unhide Here s how Early access membership NFT looks click hereHurray Welcome to Web If you have any questions let me know in the comment section Happy to help here |
2021-12-14 09:32:45 |
海外TECH |
DEV Community |
Build a real-time leaderboard with D3.js and React ! |
https://dev.to/rhidra/build-a-real-time-leaderboard-with-d3js-and-react--2lmj
|
Build a real time leaderboard with D js and React As web apps are more suited for real time data processing we need more and more data visualization solutions for real time data with a responsive layout In this article I show you how to make this simple leaderboard using D js and React D js is one of the standard library for front end data visualization rendering It a declarative system to build an underlying complex SVG To bring life to your leaderboard I will show you how to make simple animations They will make real time more readable and interesting for the user Lastly we will make sure to have a responsive leaderboard which should adapt to any size of input data while staying readable on a smaller screen You already want to check out the end result Look at it here Are you ready Then let s get started Setup the project and librariesTo follow along with this tutorial you can either setup the article s project in a few commands or you can adapt it directly in your project We are going to use libraries D js and React of course but also react use measure a small librairy to easily measure React components This will be useful to have a flexible and responsive SVG component Using the tutorial projectTo follow along the article you download the article s React project using these simple commands Cloning the starter projectgit clone b setup git github com rhidra djs leaderboard gitcd djs leaderboard Install dependanciesnpm i For your own projectInstall D js npm i dInstall a small React library to measure components This will be useful when we try to make our leaderboard responsive npm i react use measure Overview of the initial setupIf you look in the App jsx file lt div className app gt lt div className leaderboard container gt lt Leaderboard data data gt lt div gt lt div className button gt lt button onClick gt refreshData gt Refresh Data lt button gt lt div gt lt div gt We have two blocks one with our future leaderboard and one with a button If you look at the rest of the file you can see that the button will update the data passed to the leaderboard in the data variable Basically we give some data to the leaderboard This data may come from the frontend as it is now but it may also come from a backend using an asynchronous function The goal of the leaderboard is to update the data in real time without refreshing the page So in the Leaderboard component we must consider possible changes to the data input Now let s take a look at the Leaderboard jsx file import useRef useState useEffect from react import as d from d function Leaderboard data const dRef useRef null useEffect gt Write D js code here dRef data return lt svg ref dRef gt export default Leaderboard In the useEffect you will write all the D js code The Leaderboard component is basically just made of a lt svg gt component In the following sections we are going to connect it to D js Then we will use the framework to draw shapes and text on the SVG canvas Finally we can take a quick look at the data It comes from the data js file and is made of a unique ID a label and a value const data id value label Indonesia id value label China id value label Germany id value label China id value label Argentina id value label China Setting a fixed width and heightFirst of all because we want a flexible and responsive design we should not use the SVG viewBox parameter Because of this we must specify a fixed width and height for the SVG component Since we will know the height of one row of the leaderboard we can easily compute the total height We can also include some margin and padding if we want to Because we want a vertical leaderboard which should take all the horizontal space the CSS width should be Unfortunately we cannot write lt svg width gt we must use a value in pixel A solution is to measure the child component from the parent In App jsx you will measure the width of the Leaderboard child Then you can pass it its width as a parameter Here is the new Leaderboard function Leaderboard data width Constant in px const rowHeight Total height of the leaderboard const height setHeight useState rowHeight data length useEffect gt Update total height to use the most up to date value setHeight rowHeight data length const height rowHeight data length dRef data width return lt svg width width height height ref dRef gt For App there is no easy one line solution to easily measure the size of a component So instead we will use a React library react use measure It is quite popular and very easy to use This makes our App look like this import useMeasure from react use measure Use React use measure to measure the Leaderboard componentconst ref width leaderboardWidth useMeasure debounce return lt div className leaderboard container ref ref gt lt Leaderboard data data width leaderboardWidth gt lt div gt One last important thing do not forget to set a constant max width and width in the CSS so that the leaderboard component does not extends its width indefinitely and it looks good on smaller devices Let s draw some SVG Now that the boring stuff is done time to have some fun useEffect gt Select the root SVG tag const svg d select dRef current Scales Get the biggest value in the set to draw all other relative to the maximum value const maxValue d max data map d gt d value const x d scaleLinear domain maxValue range width const y d scaleLinear domain data length range height Join the data We use the ID of a row to distinguish identical elements const g svg selectAll g data data d gt d id First we select the root SVG component and we draw lt g gt elements one for each data row In SVG a lt g gt element is just a group of other elements We also define a few scaling utility functions x and y using the maximum value of the dataset On the last line we are telling D js to use the ID of a row to look for identical rows Note that our code will be executed every time we change the data or the screen size so rows may already be drawn Maybe the value will be the same but the order may not so we must move it Therefore using D js we can easily decide what to do whether we are creating updating or deleting a row To recap a bit first we are going to define rows at creation then how each one should be updated the newly created but also previously modified rows and finally we will define a small animation before removing the row Create the rowsAt the initialization we will simply define the skeleton of the SVG i e creating the tags with as much static information as possible The g enter function isolate the rows that needs to be created Initializationconst gEnter g enter append g attr transform translate y data length First we define the lt g gt element of our row and we give it a transformation This transform instructions moves the group vertically to y data length In other words it moves the row beyond the bottom of the leaderboard to not be in sight This will allow us to make a small enter animation for when new rows are added More constants const fontSize rem const textColor black const bgColor dddf Background bar color grey const barColor dc Main bar color blue const barHeight const marginText Margin between the text and the bars Append background rect as childgEnter append rect attr class bg attr fill bgColor attr x attr y marginText attr rx attr ry attr height barHeight Append main rect as childgEnter append rect attr class main attr fill barColor attr x attr y marginText attr rx attr ry Rectangle border radius attr height barHeight Append label text as childgEnter append text attr class label attr font size fontSize attr fill textColor attr x attr y text d gt d label Append value text as childgEnter append text attr class value attr text anchor end attr fill textColor attr font size fontSize attr y Our row is made up of four elements The background bar in grey which should always have the same shape The main bar above the background bar which has a variable width and a color The label with a constant value found in the row data The value text with a variable value The lines are quite self explanatory we siply set color size and position attribute to the four elements Update the rowsNow that we created each necessary row we can take care of updating them if they need to Update each g row when data changesconst gUpdate g merge gEnter gUpdate transition ease d easePoly duration attr transform d i gt translate y i Because we use a parent lt g gt we can simply update its transform attribute to move the row to the right position You can see that we display the rows in order which is why we use the i index parameter instead of the value d value You can also see that we use a transition animation If you remove it you will see an ugly snap of all the row at their positions Update rect bggUpdate select rect bg attr width x maxValue Update rect maingUpdate select rect main transition ease d easePolyOut duration attr width d gt x d value Update value textgUpdate select text value text d gt d value attr x x maxValue Here we update the rest of the elements We set the correct width to the rectangles also by using a transition animation And we also update the text value As you can see since the label is constant we do not need to update it If you don t have a constant label for a same ID you will probably need to update like here Remove the rowsSome rows won t be present in the dataset after an update so we must remove them To do that we use the g exit function which isolate rows which should be removed Exit animationg exit attr opacity transition ease d easeLinear duration attr transform d i gt translate y i attr opacity remove To remove them we simply move them pixels left smoothly and we reduce slowly their opacity to You can tweak the duration if you are not happy with the exit animation duration And That s it Yup That s it You can try it with a smaller screen size and change the data input It probably does not look exactly as you want for your project so you can add more properties and tweak the parameters in the D js code You can check out the full project source code and a live demo of the leaderboard Feel free to follow me on Twitter remyhidra to get more articles and tutorial about Web development I just started writing blog posts and I am trying to build a small audience from it so there will be plenty of content coming soon Additionaly tell me in the comments what other kind of data visualization would you like to build |
2021-12-14 09:13:54 |
海外TECH |
DEV Community |
An introduction to GraphQL and how to use GraphQL APIs |
https://dev.to/whitep4nth3r/an-introduction-to-graphql-and-how-to-use-graphql-apis-13i
|
An introduction to GraphQL and how to use GraphQL APIsI ve been using the Contentful GraphQL API pretty extensively for the past year to build a variety of projects on the Jamstack and I got sucked in pretty quickly without really knowing much about the inner workings of GraphQL While it s easy to start making your first query with GraphQL with very little research I thought it would be useful to consolidate all I ve learned throughout the year and provide a high level introduction to GraphQL for anyone interested in getting started What is an API API stands for Application Programming Interface which is a way to communicate between different software services Different types of APIs are used in programming hardware and software including Web APIs ーlike the APIs that Contentful provides If you re new to development I recommend you check out this blog post ーWhat is an API ーto get a good grounding on APIs and the role they play in web development What is an API Salma Alam Naylor・Aug ・ min read webdev javascript beginners A brief history of GraphQLGraphQL is a language used to communicate with backend systems allowing you to fetch and manipulate your data It was developed by Facebook in and released to the public in In the project was moved to the non profit GraphQL Foundation with a mission to ensure that the GraphQL community is able to focus on its continued evolution on a neutral platform What does GraphQL mean GraphQL is language agnostic which means it can be used with any backend framework or programming language and is essentially an addition to a backend service that allows developers to communicate with the database and request data in a specific way To create a GraphQL server for your data source you can use specialized tools such as ApolloGraphQL which allow you to create a layer on top of your backend and database s enabling your data to be represented queried and changed via the Graph Query Language And finally GraphQL stands for “Graph Query Language Let s unpack what we mean by “graph and “query language Your data represented in a graphGraphQL creates a representation of your data that is designed to feel familiar and natural like a visual graph The Oxford Learner s Dictionary defines a graph as A diagram consisting of a line or lines showing how two or more sets of numbers are related to each other The graph part of GraphQL describes a data structure of a collection of objects ーor nodes ーthat are connected to each other through a set of links or edges Relationships between different objects can be represented in a user interface as a result of this graph structure The key concept is that the data structure is non linear meaning that one object can be connected to more than one other object and relationships can also be circular There are specialized tools available such as GraphiQL to represent the relationships between node types on a GraphQL API Here s a screenshot from another great tool ーthe GraphQL Playground app available in Contentful s app marketplace ーshowing the relationships between data in the Contentful space that powers my personal website Notice how you can drill down and inspect the data types in each content type and understand how they are related to each other In this particular example a blogPost node contains an author node which contains an image node which contains a fileName of type String Trace the relationships down the tree by following the highlighted nodes Being able to inspect all types that exist in your data is a really powerful tool with predictable results to help you build robust and scalable applications You might already be starting to realize that having this level of visibility and insight over the data structures that power your content ーall within a user interface ーis starting to look and feel pretty powerful if you re a front end developer If you want to read more about “thinking in graphs have a look at this fantastic resource from graphql org So that s the graph part of GraphQL Next let s take a look at the query language and how a type system ties everything together A type system makes things predictableYou may already be familiar with the concept of a REST API which adopts a resource based approach to data reading and writing determined by the format of the API URLs over HTTP If you re new to REST and you want some more context check out this post ーWhat is a REST API In contrast to REST the GraphQL query language allows you to request data from multiple different “resources such as blog posts pages authors and anything else in just one API call using a single URL endpoint ーusually over HTTP What is a REST API Salma Alam Naylor・Oct ・ min read webdev beginners codenewbie api When building up a web page you may need to display different types of data in different UI components Perhaps you might need to fetch a blog post an author a set of navigation links a list of related blog posts and so on ーall for a single page When using GraphQL you can request all the different data types you need to build up your UIs in a single API call instead of having to make multiple requests for different “resources Here s an example of a GraphQL query which is requesting data from four different content types or resources in Contentful a blogPost an author an event and a talk Essentially we re requesting four different objects and particular fields on those objects For example on the eventCollection object we re requesting the items field and for each of those objects in items the name field The query is prefixed with the word query ーon the GraphQL schema a query is of type Query When using a REST API you d need to make four different API calls to request data from these four different content types With GraphQL you can do it all in one go query blogPostCollection items title author name eventCollection items name talkCollection items title And here s the result of the query Notice we have all the data we requested in one response Note I added limits into the query below to be able to demonstrate this in a single page view What s also great about the GraphQL response object is that the object keys returned are exactly the same as we requested This makes GraphQL predictable and intuitive to use You get exactly what you ask for in the response ーno more no less ーin the same order with the same structure Use the keyboard shortcut ctrl space when you re building up a query in a GraphQL explorer to see the fields available to select on an object This is a handy way to get inline hints about the schema of your data as you build up your queries ーand the data type of those fields If you want to take a deeper dive into types in GraphQL take a look at the official GraphQL documentation on schemas and types You might be thinking ーhow is this graph structure generated from the GraphQL schema Let s take a look at introspection queries Introspection queries expose a GraphQL schemaGraphQL comes with an introspection query system which is a way to query the type system and data structures in your database in order to generate the documentation and provide hints in the GraphQL UI If you re not familiar with the word introspection it means to look inward and examine your own state You can actually query your GraphQL schema using GraphQL itself This root level query returns all of the data types you have in your schema query schema types name You ll see three different types of data returned in an introspection query Types defined by the schema in the case of my personal website built with Contentful these will be types such as BlogPost Asset Talk Event Project and so on Types defined by the type of field data scalar types such as String Boolean Internal introspection query types such as Schema Type Field ーand these are prefixed by a double underscore In GraphQL each field in a query acts as a function which returns the next field type and the next type and the next type until the field returned is a scalar value such as a String or a Boolean This is demonstrated in the example above from my personal website where a blogPost node contained an author node which contained an image node which contained a fileName of type String ーa scalar value ーand that s where the journey ends When any field is executed a resolver is called to produce the field value When developing your own GraphQL servers and making database changes you ll need to provide a resolver for each new field type you add to the API Learn more about resolvers from GraphQL org A great feature of the Contentful GraphQL API is that the GraphQL schema of your data is generated at request time meaning it is always up to date with the current status of your Contentful space You don t need to worry about resolvers ーwe handle it for you If you want to find out more about introspection queries and how to watch them run in the network tab of the browser when loading up a GraphQL explorer check out this video on the Contentful Youtube channel So far we ve focused on just reading data from a GraphQL API But writing to a database via GraphQL is also possible ーand this comes with another special word ーmutation Write data with GraphQL mutationsTo mutate something means to change or manipulate it You can manipulate your server side data via GraphQL using the mutation keyword that prefixes a query The Contentful GraphQL API is read only so you can t perform mutations in Contentful using GraphQL but in theory here s how it works if I wanted to create a new blog post save the title and return the new data in the response mutation CreateNewBlogPost title String createBlogPost title title title The query begins with the word mutation and in GraphQL APIs that support mutations this is of type Mutation in the same way that a read query is of type Query as described above Next we need to wrap the mutation in what looks like a function where we define the variables needed ーand their types ーto complete the mutation This is CreateNewBlogPost which takes in a variable title which is of type String The means that the variable is required in order for the mutation to happen For more information on how to use variables in GraphQL check out this blog post I wrote a little while back TIL How to use GraphQL variables to give my queries type safety Salma Alam Naylor・Oct ・ min read graphql javascript webdev security Inside the “function you would use the mutation available on the GraphQL API use introspection queries to find it In this case it s createBlogPost Inside the mutation define the variable s to pass in And finally inside the mutation define the fields you d like to return in the response In this case I m just creating a title so I just want to return the new title in the response Make a request to the API with the mutation query and variables and here s the response you ll see from the API after the mutation has completed Again the output is in the same recognizable format as the input data createBlogPost title My new blog post title To read more on GraphQL mutations check out the official documentation from GraphQL org So now we ve covered how to read from query and write to mutate a GraphQL API where supported let s take a brief look at how we can communicate with a GraphQL API to perform those actions How to communicate with a GraphQL APIGraphQL is usually served over HTTP via a GraphQL server There are other ways to communicate with GraphQL such as via WebSockets but HTTP is largely the most popular choice If you d like to read up on how to use GraphQL with cURL Python JavaScript Ruby and PHP over HTTP check out this blog post GraphQL via HTTP in five ways Here s a quick example of how to request a title and excerpt from a blog post stored in Contentful via GraphQL using JavaScript fetch You can make this same HTTP call using any language or framework as long as it supports HTTP In this example we re sending the request via HTTP POST by sending the access token in an Authorization header and the GraphQL query in the body of the request You can also make the same request via HTTP GET but you ll need to append the query and access token to the URL of the request Read more about using HTTP POST and GET on the Contentful GraphQL API in the documentation Build the GraphQL Queryconst query blogPostCollection limit items title excerpt Send a POST request via fetch to the Contentful GraphQL URL endpointconst response await fetch yourSpaceId method POST Include Authorization and Content Type HTTP headers headers Authorization Bearer yourAccessToken Content Type application json Send the GraphQL query in the body of the request body JSON stringify query then response gt console log response json And boom you ve got data from a GraphQL API Remember GraphQL is language agnostic so you can read and write to a GraphQL API using any programming language or framework ーas long as it supports the protocol you need such as HTTP Further readingGraphQL is a powerful way to organize how you communicate with your backend services and databases I ve really enjoyed exploring what s possible with GraphQL this year and I m excited to dive deeper into new projects I might even experiment with building my own GraphQL API To find out more about using GraphQL to get your Contentful data ーincluding published and preview content ーcheck out the official documentation And if you want to explore the wonderful world of GraphQL in more detail take a look at the official GraphQL specification and learning materials on graphql org Maybe it ll inspire you to build your own GraphQL API Happy querying |
2021-12-14 09:08:22 |
海外TECH |
DEV Community |
Cherry-Pick Your Teammate's Changes Without Push 'n Pull-ing To Your Repo In Android Studio |
https://dev.to/gitlive/cherry-pick-your-teammates-changes-without-push-n-pull-ing-to-your-repo-in-android-studio-3dnf
|
Cherry Pick Your Teammate x s Changes Without Push x n Pull ing To Your Repo In Android StudioYou asked your teammate for help with a piece of code and they showed you the solution in their editor Now you need to fetch those changes Usually this would mean a series of tedious Git commands for both of you not to mention that the changes will forever grace your git history but no longer GitLive allows you to cherry pick your teammate s changes straight from their local files without having to push and pull to Git In Android Studio open up the team window by clicking on the GitLive icon on the bottom tool window bar This will show a list of your teammates if they are online or away and the issue they are currently working on Click the arrow on the left hand side of the teammate that helped you to see the repositories they have cloned locate the one they made the changes to and click the arrow beside that too Here you can see the list of files changed by your teammate on their branch compared to the main branch Files with asterisks next to the file icon contain changes made locally by your teammate that have not yet been pushed to the remote repository Since we are only interested in their local changes click the filter icon at the bottom of the team window to filter to only the unpushed changes Now we can see the single file that contains the solution we want to copy Clicking on it will open a diff of the changes so we can make sure it contains only the changes we need Now all we need to do is to right click on the file and select the cherry pick option to pick the changes And voilà no need for any git push or git pull ing You can also perform the cherry pick at the level above if you want to pick all changes from multiple files at once by right clicking on the repository and selecting the cherry pick option Don t have the GitLive extension installed yet You can find GitLive here and if you want to learn more check out this blog post or the GitLive docs |
2021-12-14 09:06:36 |
海外TECH |
Engadget |
Oppo Air Glass is a modernized Google Glass for China |
https://www.engadget.com/oppo-air-glass-assisted-reality-wearable-xr-ar-095617424.html?src=rss
|
Oppo Air Glass is a modernized Google Glass for ChinaThere hasn t been much update on Google Glass since the wider availability of its Enterprise Edition back in early but on the other side of the world Oppo believes now is the time to launch a direct competitor ーalbeit in the China market only Following last year s Oppo AR Glass concept the Oppo Air Glass will become available to Chinese consumers in Q for a yet to be announced price It ll come in two parts a detachable monocle waveguide device in black or white and either a silver half frame or a black full frame And no you won t be able to attach this gram device to your own glasses Much like Google Glass Oppo Air Glass is designed to deliver simple information for use cases such as navigation translation teleprompter calendar weather fitness tracking and more Oppo calls this quot assisted reality quot which keeps the package portable yet practical and accessible This is achieved using a power efficient quot Spark Micro Projector quot which comes in at roughly the size of a single coffee bean and it houses a Micro LED chip to project a bright x image onto a waveguide display ーone that s larger than that of Google Glass OppoOppo Air Glass is driven by a Qualcomm Snapdragon Wear which is similar to the chip inside some of the latest Fossil smartwatches Once paired with an Oppo phone with ColorOS or later or smartwatch you can toggle notifications by tapping the Air Glass slim touch bar or simply by nodding your head and then tap again or shake your head to close them To switch between apps simply swipe the touch bar OppoIn the case of the teleprompter app you can upload your speech set your text size and scrolling speed via the smartphone app and then tap the touch bar to scroll manually if needed Oppo is also testing hand gesture tracking via the Oppo Watch for a supposedly more intuitive control here OppoIf you happen to have two Oppo Air Glasses and are struggling to communicate with a foreigner you can pair them up and get your partner to wear one for instant translation ーyour device will translate the other person s voice on your screen and vice versa However only Chinese English and Japanese are supported at the moment with Korean to follow soon For the navigation app Oppo worked with Baidu to integrate Baidu Walk amp Bike Navigation as well as Explore Nearby Don t expect any sophisticated AR graphics here users will simply see step by step navigation based on one s location and orientation and voice command is supported presumably only in Chinese OppoAn Oppo rep added that the Air Glass is the result of two previous designs which allowed the company to work with developers to build up an ecosystem In addition the Chinese company will soon release a Smart Glass SDK to let more developers ーpotentially those from overseas as well ーinto the party Considering how other companies such as Meta Bose Amazon Snap and Razer have been focusing on either audio or camera based smartglasses Oppo s strategy with its Air Glass is certainly a bit of a surprise For now this is all rather experimental for Oppo as the device will only be launched in China in a limited quantity with each labelled with a unique edition number on its package |
2021-12-14 09:56:17 |
海外TECH |
Engadget |
YouTube TV may lose ESPN, ABC, FX and other Disney channels this week |
https://www.engadget.com/you-tube-tv-may-lose-espn-abc-fx-and-other-disney-channels-this-week-090746003.html?src=rss
|
YouTube TV may lose ESPN ABC FX and other Disney channels this weekYouTube TV has warned viewers that channels including ABC ESPN FX and others may disappear by PM on December th if it can t come to terms with Disney over carriage fees If that happens YouTube TV will lower its price by from to while Disney content remains off the service nbsp quot Disney is an important partner for us We are in active conversations with them and are working hard to keep their content on YouTube nbsp TV quot it said in a press release quot Our ask of Disney as with all of our partners is to treat YouTube nbsp TV like any other TV provider ー nbsp by offering us the same rates that services of a similar size pay across Disney s channels for as long as we carry nbsp them If Disney offers us equitable terms we ll renew our agreement with them quot nbsp The Google owned platform said that it s quot optimistic quot it can reach a deal with Disney and that it has a quot highly successful track record of negotiating such agreements with providers quot That said YouTube TV has also seen some failed negotiations such as when it disappeared off new Roku devices in April before finally returning in December Google came to terms with Roku just before the main YouTube app disappeared so there s some hope that it can reach a deal with Disney ahead of the December deadline Just in case though YouTube TV said that users might want to sign up for the Disney Bundle to keep access to ABC and other channels nbsp YouTube TV launched only recently in April of but with four million subscribers it s become one of the top cord cutting services along with Disney s Hulu according to The Hollywood Reporter If the parties can t come to terms some channels could disappear nbsp |
2021-12-14 09:07:46 |
医療系 |
医療介護 CBnews |
「大幅な本体プラス改定は当然」、四病協-看護職賃上げなどの費用は別枠で |
https://www.cbnews.jp/news/entry/20211214183812
|
厚生労働相 |
2021-12-14 19:00:00 |
医療系 |
医療介護 CBnews |
精神障害者支援、地域包括ケア構築に向けた検討を-障害者部会で中間整理案議論、文言修正し報告書に |
https://www.cbnews.jp/news/entry/20211214174720
|
保健福祉部 |
2021-12-14 18:10:00 |
金融 |
JPX マーケットニュース |
[東証]合併等による実質的存続性の喪失に係る猶予期間入り:(株)関西スーパーマーケット |
https://www.jpx.co.jp/news/1023/20211214-12.html
|
関西スーパーマーケット |
2021-12-14 18:30:00 |
海外ニュース |
Japan Times latest articles |
Citing local needs, Kishida defends use of coupons in financial aid plan |
https://www.japantimes.co.jp/news/2021/12/14/national/kishida-coupon-handout-defense/
|
Citing local needs Kishida defends use of coupons in financial aid planOne estimate has shown that administrative costs for the central government would more than triple to billion if coupons are included in the handouts |
2021-12-14 18:21:07 |
海外ニュース |
Japan Times latest articles |
Toyota shifts gears with major investment in electric vehicles |
https://www.japantimes.co.jp/news/2021/12/14/business/corporate-business/toyota-30-ev-models-2030/
|
battery |
2021-12-14 18:20:48 |
ニュース |
BBC News - Home |
Covid: PM faces big rebellion as MPs vote on new restrictions |
https://www.bbc.co.uk/news/uk-politics-59640792?at_medium=RSS&at_campaign=KARANGA
|
labour |
2021-12-14 09:20:04 |
ニュース |
BBC News - Home |
Covid: Call for volunteers as 500k book boosters in a day |
https://www.bbc.co.uk/news/uk-59646877?at_medium=RSS&at_campaign=KARANGA
|
december |
2021-12-14 09:47:40 |
ニュース |
BBC News - Home |
Surge in part-time workers as job vacancies rise |
https://www.bbc.co.uk/news/business-59648583?at_medium=RSS&at_campaign=KARANGA
|
omicron |
2021-12-14 09:30:03 |
ニュース |
BBC News - Home |
Omicron: What are the Covid self-isolation rules now? |
https://www.bbc.co.uk/news/explainers-54239922?at_medium=RSS&at_campaign=KARANGA
|
omicron |
2021-12-14 09:14:07 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
【日本株】2021年の年末は「想定以上の変動」が起こる リスクも! 東証マザーズの「小型グロース株」は避け、 「低PER・高配当・好業績・高ROE」の大型株だけ注目を - 成り上がり投資術 |
https://diamond.jp/articles/-/290684
|
|
2021-12-14 18:05:00 |
北海道 |
北海道新聞 |
「空飛ぶ車」のナビ屋外実験 ルート2・7キロ、自動選択 |
https://www.hokkaido-np.co.jp/article/622873/
|
開発 |
2021-12-14 18:19:00 |
北海道 |
北海道新聞 |
厚岸ウイスキーチョコ第2弾販売 「立冬」使用 道の駅などで限定販売 |
https://www.hokkaido-np.co.jp/article/622872/
|
限定販売 |
2021-12-14 18:18:00 |
北海道 |
北海道新聞 |
外交ボイコット、慎重な対応を 北京五輪で同友会代表幹事 |
https://www.hokkaido-np.co.jp/article/622871/
|
北京五輪 |
2021-12-14 18:18:00 |
北海道 |
北海道新聞 |
北極圏で気温38度、最高と認定 昨年6月にロシアで観測 |
https://www.hokkaido-np.co.jp/article/622865/
|
世界気象機関 |
2021-12-14 18:11:00 |
北海道 |
北海道新聞 |
遠軽・ロックバレースキー場 18日開業目指し降雪機フル稼働 |
https://www.hokkaido-np.co.jp/article/622864/
|
降雪 |
2021-12-14 18:08:00 |
北海道 |
北海道新聞 |
東京円、113円台後半 |
https://www.hokkaido-np.co.jp/article/622863/
|
東京外国為替市場 |
2021-12-14 18:04:00 |
北海道 |
北海道新聞 |
漫画原作者、女児わいせつで有罪 雑誌なかよし連載、京都地裁 |
https://www.hokkaido-np.co.jp/article/622861/
|
京都地裁 |
2021-12-14 18:01:00 |
IT |
週刊アスキー |
「本気の雪合戦」がここに!?『レインボーシックス シージ』で期間限定イベント「Snow Brawl」が開催 |
https://weekly.ascii.jp/elem/000/004/078/4078000/
|
snowbrawl |
2021-12-14 18:50:00 |
IT |
週刊アスキー |
【出展受付開始】ASCIIのオールジャンルXTech展示会3/18に開催決定 |
https://weekly.ascii.jp/elem/000/004/077/4077535/
|
ascii |
2021-12-14 18:30:00 |
IT |
週刊アスキー |
最大300デザインを自動生成するAI年賀状アプリ「ツクルネ!年賀状」、バトン |
https://weekly.ascii.jp/elem/000/004/077/4077990/
|
自動 |
2021-12-14 18:30:00 |
IT |
週刊アスキー |
豪華3本立て!『アズールレーン』の年末特番が12月21日19時より配信決定! |
https://weekly.ascii.jp/elem/000/004/077/4077993/
|
yostar |
2021-12-14 18:20:00 |
IT |
週刊アスキー |
オンラインRPG『LOST ARK』の最新アップデート内容を紹介する生放送「Pmangのゲムづめ!#85」を本日21時に配信! |
https://weekly.ascii.jp/elem/000/004/077/4077997/
|
lostark |
2021-12-14 18:20:00 |
マーケティング |
AdverTimes |
博報堂、早期退職100人募集 |
https://www.advertimes.com/20211214/article371434/
|
早期退職 |
2021-12-14 10:00:27 |
コメント
コメントを投稿