投稿時間:2021-11-04 21:41:36 RSSフィード2021-11-04 21:00 分まとめ(45件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
IT 気になる、記になる… 52audio、「AirPods (第3世代)」の分解動画を公開 https://taisy0.com/2021/11/04/148359.html 取り付け 2021-11-04 11:56:58
TECH Engadget Japanese アップル、MacBookの今期売上げが過去最高に。一方Chromebookは大幅減との調査結果 https://japanese.engadget.com/apple-sold-record-number-of-macbooks-113038191.html chromebook 2021-11-04 11:30:38
TECH Engadget Japanese Facebook、クリエイター向け「Apple税回避」用新ツール発表 https://japanese.engadget.com/facebook-sabscription-tool-110008841.html apple 2021-11-04 11:00:08
IT ITmedia 総合記事一覧 [ITmedia ビジネスオンライン] ソフトバンク宮川社長、インフラ整備計画の見直しを示唆 理由は? https://www.itmedia.co.jp/business/articles/2111/04/news152.html itmedia 2021-11-04 20:11:00
python Pythonタグが付けられた新着投稿 - Qiita PyTorchの乱数シード固定【GPU】 https://qiita.com/Myso-Skywalker/items/50049f9d74ea23f37506 PyTorchの乱数シード固定【GPU】PyTorchの乱数シード固定方法機械学習では、再現性を持たせるために、乱数のシードを固定することが多い。 2021-11-04 20:52:31
python Pythonタグが付けられた新着投稿 - Qiita djangoとwagtailのfile・folder構成の差分・違いを明確にする https://qiita.com/dsduoa31/items/af357cf67b924544d5a9 djangoとwagtailのfile・folder構成の差分・違いを明確にする背景pythonのフルスタックフレームワーク「Django」とDjangoをベースとしたCMS※に「Wagtail」があります。 2021-11-04 20:32:13
js JavaScriptタグが付けられた新着投稿 - Qiita webpack 5からurl-loader/file-loader/raw-loaderが要らなくなった https://qiita.com/Tsukina_7mochi/items/e031f12a122e05ff8d87 webpackloaderwebpackAssetModuleurlloaderassetinlinefileloaderassetresourcerawloaderassetsourceurlloaderlimitオプションasset使用方法webpackconfigjsでloaderを使用していた部分をAssetModuleの指定に書き換えます。 2021-11-04 20:45:25
js JavaScriptタグが付けられた新着投稿 - Qiita つまるところ初心忘れるべからずということです。 https://qiita.com/yui-kouy/items/b716484142bae22f1db0 つまるところ初心忘れるべからずということです。 2021-11-04 20:40:55
js JavaScriptタグが付けられた新着投稿 - Qiita 【Vue.js】v-ifとv-showの違い https://qiita.com/Yudai_35_/items/65f1b3af03ce53253bb8 【Vuejs】vifとvshowの違いはじめにこんにちは今回は【Vuejs】vifとvshowの違いについてアウトプットしていきますvifとvshowの違いvif・要素をDOMから削除・追加することで表示非表示を切り替える。 2021-11-04 20:31:36
js JavaScriptタグが付けられた新着投稿 - Qiita リアルタイム( ..)φメモメモ Vue、CSSなど https://qiita.com/xeg_yn/items/786848f596033d7e7902 リアルタイムφメモメモVue、CSSなどVUEのサクっと使えそうなところVueインスタンスの基本⇒とにかくJSONltbodygtltdividappgt子要素を記述ltdivgtltbodygtltscriptgtconstappnewVueelapp要素elementを指定する。 2021-11-04 20:11:52
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) VS CODEで設定をしようと思ったのですが「ユーザー設定に書き込めません」と表示されます。 https://teratail.com/questions/367785?rss=all VSCODEで設定をしようと思ったのですが「ユーザー設定に書き込めません」と表示されます。 2021-11-04 20:34:37
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) RPGに向いているJSのライブラリが知りたい https://teratail.com/questions/367784?rss=all RPGに向いているJSのライブラリが知りたいJSTSでRPGを作るのに向いているライブラリを知りたい学校でグループ人でJavaScriptを使いDのRPGドラクエみたいなを作ることになりました。 2021-11-04 20:08:09
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) WindowsでP12ファイルの作成したい https://teratail.com/questions/367783?rss=all surface 2021-11-04 20:00:33
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) Commitizenが動かない https://teratail.com/questions/367782?rss=all Commitizenが動かない前提・実現したいことcommitizenというツールをインストールして使える状態にしたいです。 2021-11-04 20:00:24
Docker dockerタグが付けられた新着投稿 - Qiita 【Docker】APIサーバーコンテナとDBサーバーコンテナを建ててCRUD操作【TypeORM】 https://qiita.com/scalescale/items/b48df012ef1df9068aa9 2021-11-04 20:11:01
技術ブログ Mercari Engineering Blog メルカリCTOが今、一番頭を抱える課題とは?技術と組織、その両方から振り返る https://engineering.mercari.com/blog/entry/20211104-8456a371cb/ hellip 2021-11-04 11:12:11
技術ブログ Developers.IO Deequでデータ品質をテストする https://dev.classmethod.jp/articles/deequ/ deequ 2021-11-04 11:14:26
海外TECH MakeUseOf The 5 Best Manhwa and Webtoons Apps for Android and iPhone https://www.makeuseof.com/best-manhwa-webtoons-apps-android-iphone/ android 2021-11-04 11:30:33
海外TECH MakeUseOf Why Fewer People Are Buying Chromebooks in 2021 https://www.makeuseof.com/why-fewer-people-are-buying-chromebooks/ massive 2021-11-04 11:01:04
海外TECH MakeUseOf Which Cable and Power Adapter Does My iPhone Need? https://www.makeuseof.com/which-cable-and-power-adapter-does-my-iphone-need/ adapter 2021-11-04 11:01:03
海外TECH DEV Community Installing Tailwind CSS in a Meteor project https://dev.to/fredmaiaarantes/installing-tailwind-in-a-meteor-project-2b6h Installing Tailwind CSS in a Meteor project Creating your projectStart by creating a new Meteor project if you don t have one set up already enter in the project folder and run it to make sure it is all correct By default it uses React meteor create my projectcd my projectmeteor run Install Tailwind via npmmeteor npm install tailwindcss latest postcss latest postcss load config latest autoprefixer latest Install Meteor package for postcssInstall postcss and remove the Meteor standard minifier meteor remove standard minifier cssmeteor add juliancwirko postcss Configure postcssCreate a file named postcssrc js add tailwindcss and autoprefixer to your PostCSS configuration postcssrc jsmodule exports ctx gt This flag is set when loading configuration by this package if ctx meteor const config plugins tailwindcss autoprefixer if ctx env production autoprefixer is reported to be slow so we use it only in production config plugins autoprefixer overrideBrowserslist defaults return config else return Include Tailwind in your CSSAdd Tailwind to your main css file main css tailwind base tailwind components tailwind utilities Configure Tailwind tailwind config jsmodule exports purge darkMode false or media or class theme extend variants plugins Building your CSSWhen building for production be sure to configure the purge option to remove any unused classes for the smallest file size tailwind config jsmodule exports purge imports ui js jsx ts tsx public html darkMode false or media or class theme extend variants plugins References 2021-11-04 11:50:27
海外TECH DEV Community GraphQL The Rails Way: Part 1 - Exposing your resources for querying https://dev.to/alachaum/graphql-the-rails-way-part-1-exposing-your-resources-for-querying-2mkd GraphQL The Rails Way Part Exposing your resources for queryingTL DR GraphQL is a good way of making your API more flexible and less resource consuming But if you think that type definition is cumbersome then read on With the modules we provide you ll be able to expose fully functional resources with one line of code For those who haven t followed the GraphQL trend launched by Facebook it s a fancy way of mixing API and SQL concepts together Instead of making calls to a properly structured endpoint with parameters like with REST APIs GraphQL makes you build syntactic queries that you send to one endpoint The benefit of GraphQL A properly defined standard for Making multiple queries as onceForcing consumers to select the fields they needFetching related resources as part of parent resourcesPaginating resources and sub resources using relay style pagination Strongly typing the resources you exposeDocumenting your API without the immediate need for a separate documentation websiteCouldn t a REST API do the above Of course it could But GraphQL has defined a standard for all these and many clients are already out there providing out of the box functionalities for interacting with GraphQL APIs So why not give it a try If you need more convincing you can read GitHub s blog article explaining why they switched When it comes to implementing a GraphQL server in Rails one can use the excellent GraphQL Ruby gem The gem provides all the foundations for building your API But the implementation is still very much manual with lots of boilerplate code to provide In this article I will guide you through the steps of bootstrapping GraphQL Ruby then show you how with a bit of introspection you can easily expose your resources the Rails Way with one line of code First steps with graphql rubyLet s dive into graphql ruby and see how we can go from zero to first query Installing graphql rubyFirst add the graphql gem to your Gemfile GraphQL API functionalitiesgem graphql gt Then run the install generator rails generate graphql installThe generator will create the GraphQL controller setup the base types and update your routes That s it for the install part Now let s see how we can expose resources to query Defining and exposing modelsThe first important file to look at is the Types QueryType file This class defines all the attributes which can be queried on your GraphQL API For the purpose of demonstrating how records get exposed let s generate a User and a Book model Generate a basic user modelrails g model User email string name string Generate a basic book model with an ownership link to our user modelrails g model Book name string pages integer user references Run the migrationsrake db migrateWe ll expose these two classes for querying on our GraphQL API To do so we need to define their type We ll start by defining a base type for common record attributes These kind of base classes can help keep your type classes more focused app graphql types record type rb frozen string literal truemodule Types Define common attributes used by our records module RecordType include Types BaseInterface field id ID null false description The unique identifier of the resource field created at GraphQL Types ISODateTime null false description The date and time that the resource was created field updated at GraphQL Types ISODateTime null false description The date and time that the resource was last updated endendThen let s define GraphQL types for our models This is the User type app graphql types user type rb frozen string literal truemodule Types class UserType lt Types BaseObject implements Types RecordType description A user field email String null false description The email address of the user field name String null false description The name of the user endendThis is the Book type You ll notice that the user field reuses the User type app graphql types book type rb frozen string literal truemodule Types class BookType lt Types BaseObject implements Types RecordType description A book field name String null false description The name of the book field pages Integer null false description The number of pages in the book field user UserType null false description The owner of the book endendNow that we have defined our types we need to plug them to the GraphQL Query API This plumbing happens in the Types QueryType class Here is the generated Types QueryType class that we have expanded a bit to expose our collections We use connection type instead of arrays on the Book and User types so as to automatically benefit from relay style pagination app graphql types query type rb frozen string literal truemodule Types class QueryType lt Types BaseObject Add node id ID and nodes ids ID include GraphQL Types Relay HasNodeField include GraphQL Types Relay HasNodesField Fields TODO Test field remove me field test field String null false description An example field added by the generator Record fields field books BookType connection type null false description The list of books field users UserType connection type null false description The list of users Field logic def test field Hello World end def books Book order created at end def users User order created at end endendLet s see how we can use our API now Querying the GraphQL APIThe easiest way to query your GraphQL API is to use GraphiQL Good news though the GraphQL gem generator automatically adds the graphiql rails gem to your gemfile After running bundle install you should be able to access GraphiQL on http localhost graphiqlYou might encounter a precompilation error In that case update your manifest js and add the GraphiQL assets app assets config manifest js GraphiQL assets link graphiql rails application css link graphiql rails application js Your assets link tree images link directory stylesheets cssIf you prefer you can also install GraphiQL as a standalone app See this link for more info When you open GraphiQL the first thing you should look at is the docs section You ll notice that all your models and fields are properly documented there That s neat Let s create some test records via the Rails console Create usersu User create email john doe example net name John Doe u User create email fanny blue example net name Fanny Blue Create booksBook create name The great story pages user u Book create name The awesome tale pages user u Cool Now we can perform our query Note how GraphQL allows us to perform multiple queries at once That s really sweet Adding filtering attributes to your collectionsIt would be nice to have filters on our collections The gem allows us to do that via field block definitions Here is a concrete example of adding a filter on page size app graphql types query type rb frozen string literal truemodule Types class QueryType lt Types BaseObject Add node id ID and nodes ids ID include GraphQL Types Relay HasNodeField include GraphQL Types Relay HasNodesField Fields TODO Test field remove me field test field String null false description An example field added by the generator Books field books BookType connection type null false do description The list of books We define a filter argument on the collection attribute argument size greater than Integer required false end Users field users UserType connection type null false description The list of users Field logic def test field Hello World end The filter argument is passed to our method and conditionally used to refine the query scope def books size greater than nil rel Book order created at rel rel where pages gt size greater than if size greater than rel end def users User order created at end endendNow you can easily filter on book size Nice But I m used to Rails where everything is inferred out of the box Right now it looks quite cumbersome to define all these collections and filters Isn t there a way to automatically generate those Of course there is Time to use GraphQL custom resolvers with a bit of introspection Automatically defining resources and filtersIn order to automatically build resources and their corresponding filters we ll need three things A GraphQL helper to expose Active Record resourcesA custom resolver authorizing and querying our collectionsAn Active Record helper to evaluate the query filters received from GraphQL The modules below are configured to use Pundit if present to scope access to records Pundit is really just given as an example any scoping framework would work even custom policy classes Active Record query helpersLet s start with the Active Record helper Add the following concern to your application This concern allows collections to be filtered using underscore notation e g created at gte for created at gt and sorting using dot notation e g created at desc app models concerns graphql query scopes rb frozen string literal truemodule GraphqlQueryScopes extend ActiveSupport Concern List of SQL operators supported by the with api filters scope SQL OPERATORS eq gt gt gte gt lt lt lte lt in IN nin NOT IN freeze class methods do If you use Postgres or any database storing date with millisecond precision then you might want to uncomment the body of this method Millisecond precision makes timestamp equality and less than filters almost useless Format field for SQL queries Truncate dates to second precision Used to build filtering queries based on attributes coming from the API def loose precision field wrapper field table name field if columns hash field to s type datetime date trunc second table name field else table name field end end end included do Sort by created at to have consistent pagination This is particularly important when using UUID for IDs default scope order created at asc id asc This scopes aims at being overriden in children models This scope should typically specify eager loaded associations e g scope graphql scope includes owner team scope graphql scope gt all Allow sorting using a dot syntax e g name asc Supports underscore and camelized attributes This scope is typically used on the API scope with sorting lambda sort by return all if sort by blank Extract attributes sort attr sort dir sort by split Format attributes sort attr sort attr underscore sort dir asc unless w asc desc include sort dir Order scope or return self if the attribute does not exist column names include sort attr unscope order order sort attr gt sort dir all Allow filtering using attribute level operators coming from the API E g created at gte gt created at greater than or equal to value id in gt ID in list of values The list of operators is gt gt strictly greater than gte gt greater than or equal lt gt strictly less than lte gt less than or equal in gt value in array nin gt value not in array scope with api filters lambda args hash Build a SQL fragment for each argument Array is first build as table field gt table field lt then transposed into table field gt table field lt sql fragments values args hash map do k v Capture the field and the operator if column names include k to s field k operator eq else field operator k to s rpartition end Sanitize the field and operator raise ActiveRecord StatementInvalid invalid operator k unless column names include field to s amp amp SQL OPERATORS operator to sym Build SQL fragment field fragment loose precision field wrapper field SQL OPERATORS operator to sym Return fragment and value field fragment v end compact transpose Combine regular args and SQL fragments to form the final scope where Array sql fragments join AND values endendUse this concern in your ApplicationRecord base class app models application record rb frozen string literal trueclass ApplicationRecord lt ActiveRecord Base include GraphqlQueryScopes self abstract class trueendGreat Now you can filter and sort records this way gt Book with api filters pages gte with sorting created asc Book Load ms SELECT books FROM books WHERE books pages gt ORDER BY books created at ASC books id ASC LIMIT LIMIT gt lt ActiveRecord Relation lt Book id name The awesome tale pages user id created at updated at gt gt The concern also defines a default graphql scope which is used by our resolvers This scope can be overridden on each model to define API specific eager loading strategies Here is an example with our book model app models book rb frozen string literal trueclass Book lt ApplicationRecord belongs to user Always eager load the associated user when books get queried on the API scope graphql scope gt eager load user end GraphQL custom resolvers for collection and find queriesNow let s add a custom resolver to dynamically support our collections and corresponding filters The resolver looks at all the fields defined on the model type and automatically generate filters for fields which are database queriable app graphql resolvers collection query rb frozen string literal truemodule Resolvers Parameterized Class used to generate resolvers finding multiple records via filtering attributes Example Generate resolver for Types MyClassType which is assumed to use the MyClass ActiveRecord model under the hood field my class resolver CollectionQuery for Types MyClassType Generate resolver for an association where the association name can be inferred from the type class field posts resolver CollectionQuery for Types PostType Generate resolver for an association where the association cannot be inferred from the type class passed to the resolver field published posts resolver CollectionQuery for Types MyClassType relation published posts class CollectionQuery lt GraphQL Schema Resolver Class insteance variables that can be inherited by child classes class attribute base type resolver opts Constants Define the operators accepted for each field type FILTERING OPERATORS GraphQL Types ID gt i in nin GraphQL Types String gt i in nin GraphQL Schema Enum gt i in nin GraphQL Types ISODateTime gt i gt gte lt lte in nin GraphQL Types Float gt i gt gte lt lte in nin GraphQL Types Int gt i gt gte lt lte in nin freeze Class Methods Return a child resolver class configured for the specified entity type def self for entity type args Class new self setup entity type args end Setup method used to configure the class def self setup entity type args Configure class use base type entity type use resolver opts args Set resolver type type entity type null false Define each entity field as a filtering argument filter fields each do field name field type argument field name field type required false end Sort field argument sort by String required false description Use dot notation to sort by a specific field E g createdAt asc or createdAt desc Return class for chaining self end Set the base entity type def self use base type type klass nil self base type type klass end Set the resolver options def self use resolver opts opts nil self resolver opts HashWithIndifferentAccess new opts end Return all base fields that can be used to generate filters return Hash A hash of Field Name gt GraphQL Field Type def self queriable fields native queriable fields merge association queriable fields end Return the list of native fields that can be used for filtering return Hash A hash of field name gt field type def self native queriable fields base type fields select k v model klass column names include k to s underscore select k v v type unwrap kind input amp amp v type list map k v k v type unwrap to h end Return the list of belongs to fields that can be used for filtering return Hash A hash of field name gt field type def self association queriable fields base type fields values select v v type unwrap kind object map v model klass reflect on all associations belongs to find e e name to s v name to s compact map e e foreign key GraphQL Types ID to h end Return the list of fields accepted as filters including operators def self filter fields Used queriable fields as equality filters equality fields queriable fields For each queriable field find the list of operators applicable for the field class operator fields equality fields map do field name field type Find applicable operators by looking up the field type ancestors operators FILTERING OPERATORS find klass field type lt klass amp last next unless operators Generate all operator fields operators map do o arg type i in nin include o field type field type field name underscore o to sym arg type end end compact flatten to h Return equality and operator based fields equality fields merge operator fields end Return the underlying ActiveRecord model class def self model klass model klass resolver opts model name base type to s demodulize gsub Type constantize end Return the model Pundit Policy class def self pundit scope klass pundit scope klass model klass Policy Scope constantize end Instance Methods Retrieve the current user from the GraphQL context This current user must be injected in context inside the GraphqlController def current user current user context current user end Reject request if the user is not authenticated def authorized args super amp amp defined Pundit current user raise Pundit NotAuthorizedError end Return the name of the association that should be defined on the parent object def parent association name self class resolver opts relation self class model klass to s underscore pluralize end Return the instantiated resource scope via Pundit If a parent object is defined then it is assumed that the resolver is called within the context of an association def pundit scope base scope object object send parent association name self class model klass Enforce Pundit control if the gem is present This current user must be injected in context inside the GraphqlController if defined Pundit self class pundit scope klass new current user base scope graphql scope resolve else base scope graphql scope end end Actual resolver method performing the ActiveRecord filtering query The resolver supports filtering via a range of operators gt field equal to value gt gt strictly greater than gte gt greater than or equal lt gt strictly less than lte gt less than or equal in gt value in array nin gt value not in array gt See ApplicationRecord with api filters for the underlying filtering logic The resolver supports sorting via dot syntax sortBy createdAt desc gt See ApplicationRecord with sorting for the underlying sorting logic def resolve sort by nil args pundit scope with api filters args with sorting sort by end endendLet s also add a custom resolver to support fetching model by unique attribute Any field your define as ID on your model types will be exposed as a primary key for single record fetching purpose app graphql resolvers record query rb frozen string literal truemodule Resolvers Parameterized Class used to generate resolvers finding a single record using one of its ID keys Example Generate resolver for Types MyClassType which is assumed to use the MyClass ActiveRecord model under the hood gt RecordQuery for Types MyClassType class RecordQuery lt GraphQL Schema Resolver Class insteance variables that can be inherited by child classes class attribute base type resolver opts Class Methods Return a child resolver class configured for the specified entity type def self for entity type args Class new self setup entity type args end Setup method used to configure the class def self setup entity type args Set base type use base type entity type use resolver opts args Set resolver type type entity type null false Define argument for each primary key id fields each do f argument f name GraphQL Types ID required false end Return class for chaining self end Set the base entity type def self use base type type klass nil self base type type klass end Set the resolver options def self use resolver opts opts nil self resolver opts HashWithIndifferentAccess new opts end Return the list of ID fields def self id fields base type fields values select f f type unwrap GraphQL Types ID end Return the underlying ActiveRecord model class def self entity klass entity klass base type to s demodulize gsub Type constantize end Return the model Pundit Policy class def self pundit scope klass pundit scope klass entity klass Policy Scope constantize end Instance Methods Retrieve the current user from the GraphQL context This current user must be injected in context inside the GraphqlController def current user current user context current user end Reject request if the user is not authenticated def authorized args super amp amp defined Pundit current user raise Pundit NotAuthorizedError end Return the name of the association that should be defined on the parent object def parent association name self class resolver opts relation self class entity klass to s underscore pluralize end Return the instantiated resource scope via Pundit If a parent object is defined then it is assumed that the resolver is called within the context of an association def pundit scope base scope object object send parent association name self class entity klass Enforce Pundit control if the gem is present This current user must be injected in context inside the GraphqlController if defined Pundit self class pundit scope klass new current user base scope graphql scope resolve else base scope graphql scope end end Actual resolver method performing the ActiveRecord find query def resolve args Avoid finding by nil value return nil if args hash args compact blank pundit scope find by args hash end endendIn both resolvers I ve made Pundit optional But I strongly recommend using it or any similar framework You should read the comments above each pundit method in the resolvers and adapt based on your needs For authorization purpose you can inject a current user attribute inside the GraphQL context by modifying your GraphqlController Here is an example class GraphqlController lt ApplicationController def execute variables prepare variables params variables query params query operation name params operationName gt Specify your GraphQL context here lt context current user current user result GraphqlRailsSchema execute query variables variables context context operation name operation name render json result rescue StandardError gt e raise e unless Rails env development handle error in development e end private def current user Devise or Custom logic for retrieving the current user end end GraphQL base object to define resources and has manyWe have custom resolvers to handle the GraphQL query logic and model level helpers to translate these into database compatible filters The last missing piece is a helper allowing us to declare our GraphQL resources To do this add the following helper methods to your Types BaseObject class app graphql types base object rb frozen string literal truemodule Types class BaseObject lt GraphQL Schema Object edge type class Types BaseEdge connection type class Types BaseConnection field class Types BaseField Helpers Automatically generate find and list queries for a given resource def self resource entity args entity type Types entity to s singularize classify Type constantize record resolver args delete record resolver Resolvers RecordQuery for entity type collection resolver args delete collection resolver Resolvers CollectionQuery for entity type args Generate root field for entity find field entity to s singularize to sym entity type null true resolver record resolver description Find entity to s singularize camelize Generate root field for entity list with filtering field entity to s pluralize to sym entity type connection type null false resolver collection resolver description Query entity to s pluralize camelize with filters end Define a has many relationship E g inferred type has many posts E g explicit type has many published posts type Type PostType def self has many rel name args inferred type rel name to s singularize camelize model klass name args delete model name inferred type classify entity type args type Types inferred type Type constantize relation name args delete relation rel name resolver klass args delete resolver class Resolvers CollectionQuery Generate root field for entity list with filtering field rel name entity type connection type null false resolver resolver klass for entity type relation relation name model name model klass name description Query related rel name to s pluralize camelize with filters end endendThese helpers provide resource a helper to be used inside Types QueryType to expose an Active Record model for collection querying and record fetching has many a way to define sub collections on a type You can now rewrite your Types QueryType class the following way app graphql types query type rb frozen string literal truemodule Types class QueryType lt Types BaseObject Add node id ID and nodes ids ID include GraphQL Types Relay HasNodeField include GraphQL Types Relay HasNodesField resource books resource users endendAlso let s add a has many books on our User model and type Active Record Model app models user rbclass User lt ApplicationRecord has many booksend GraphQL type app graphql types user type rbmodule Types class UserType lt Types BaseObject implements Types RecordType description A book field email String null false description The email address of the user field name String null false description The name of the user has many books endend Querying our newly implemented resourcesWe re ready Let s see how this works now As you can see on the right hand side all our collection filters are properly generated We can also fetch records individually by ID field id or any other ID field on the type Finally we can fetch sub resources on parent records such as user books Wrapping upA bit of metaprogramming makes the whole GraphQL Rails experience way easier than it was originally advertised Now all we need to do is define model types and declare resources in our Types QueryType But there is more we can do In the next episodes we ll see how to do similar things for mutations create update delete and subscriptions via Pusher as a specific example 2021-11-04 11:22:00
海外TECH DEV Community How to sync EFS and S3 every 5 min in AWS https://dev.to/fanmixco/how-to-sync-efs-and-s3-every-5-min-in-aws-1712 How to sync EFS and S every min in AWSDataSync is a powerful tool to move data between different AWS storage options like S EFS and EFx However there is a catch the minimum time you can schedule a task is one per hour you cannot create a custom cron expression for a lower time like My guessing about this restriction is that this feature was planned for Data Warehousing not for active synchronization My challenge started when I had to read some XMLs using RDS for SQL Server RDS for SQL Server can read the files from S natively but my files came from several micro services running in Fargate that have only access to EFS as a volume These files came from external services at different times of the day and represented several gigas to transfer In the beginning I was trying to find a way to read the EFS from SQL Server but it didn t work RDS doesn t have an option to read EFS because it runs in Windows and there is not a Linux option available yet which could potentially give us access to EFS However you cannot do it without a plugin that requires your container to run as privileged and this is not authorized After several failed attempts I created a workaround that involves A DataSync task for creating the basic task and synchronizing the data A Lambda function for running the task A EventBridge rule for triggering the Lambda function every min DataSyncStep Configure your data source EFS for instance Step Choose the destination S for instance Step Configure what you want to move Step Review your new task and create it LambdaThis is the Python script that I wrote import botoclient boto client datasync region name YOUR REGION def lambda handler event context response client start task execution TaskArn arn aws datasync YOUR REGION YOUR USER ID task YOUR TASK ID Where YOUR REGION is the location where you want to run it like eu west YOUR USER ID is the user that is going to run the task YOUR TASK ID is the task ID created in the DataSync EventBridgeCreate a new rule that runs in your expected schedule Step Create a new rule Step Configure your schedule Step Choose your lambda function Step Review your new rule and create it And that s all Now you can run your task DataSync in your required schedule 2021-11-04 11:10:54
Apple AppleInsider - Frontpage News Apple could see record-breaking iPhone sales in Europe - if it can keep up https://appleinsider.com/articles/21/11/04/apple-could-see-record-breaking-iphone-sales-in-europe---if-it-can-keep-up?utm_medium=rss Apple could see record breaking iPhone sales in Europe if it can keep upIf Apple can meet demand it s predicted to have record breaking iPhone sales in Europe as the market returns to normal after the pandemic Apple s iPhone rangeGlobally Apple has continued to dominate with the iPhone taking a full three quarters of all smartphone profits in the second quarter of Now that success appears to be continuing with new research predicting a record breaking fourth quarter in Europe ーdepending on the global chip shortages Read more 2021-11-04 11:54:28
Apple AppleInsider - Frontpage News Apple hints at future plans for Magic Keyboard for iPad https://appleinsider.com/articles/21/11/04/apple-hints-at-future-plans-for-magic-keyboard-for-ipad?utm_medium=rss Apple hints at future plans for Magic Keyboard for iPadThe strong but flexible Magic Keyboard and case for the iPad Pro is described in a new patent application that suggests some variations could be coming Magic Keyboard for iPad ProApple launched the Magic Keyboard for iPad Pro in and has since followed it with a minor redesign to fit s iPad Pro models Read more 2021-11-04 11:29:31
海外TECH Engadget The Morning After: Ford electrified a classic truck to show off its EV motor kit https://www.engadget.com/the-morning-after-ford-electrified-a-classic-truck-to-show-off-its-ev-motor-kit-113525635.html?src=rss The Morning After Ford electrified a classic truck to show off its EV motor kitBoth small bespoke auto customization businesses and major car manufacturers like Chevy are pulling out the old and putting in the new when it comes to vintage car engines Now Ford is making a similar statement with its F Eluminator concept It s an upgraded pickup truck with two of the company s new Eluminator electric crate motor kits The power plants are the same as the Mustang Mach E GT Performance Edition giving the F a total HP and lb ft of torque Ford didn t discuss performance benchmarks or range ーit s likely the car body is heavier due to the era it comes from And yes it s a concept Ford is hoping however that you d buy the Eluminator motor for your project car The automaker eventually hopes to supply everything you might need for an EV retrofit including batteries For now however just the engine is available making it a high level project that is probably beyond the abilities of most of us ーMat SmithAmazon s Ring Alarm Pro is now availableThe system starts at AmazonIt combines an Eero WiFi with a home security system As with most of its security devices you can buy the system as part of several bundles That said if you want the router on its own it s Another option is to buy it as part of a eight piece kit that comes with a keypad and multiple sensors Keep in mind you ll need a Ring Protect subscription to take advantage of many of its features That adds cloud video storage and backup internet for your security devices via an LTE module in the Ring Pro base station There s also Eero s cybersecurity subscription thrown in for fair measure too Continue reading Sponsored by UserTestingTest your game early and often Uncover the key principles of user testing Get the guide The best board games to gift this holiday seasonHave some screen free fun with your family this year EngadgetOn the lookout for analog gifts Board games are a great gift for anyone who wants to spend time with friends and family without the need for pixels But keep the divorce bating Monopoly in the cupboard we have some new titles to try Continue reading HBO Max teases post apocalyptic series Station Eleven Watch the teaser for the limited series launching December th HBO Max has released the first teaser video for its adaptation of Emily St John Mandel s post apocalyptic novel Station Eleven In the short video you ll get glimpses of most of the main characters of the story as they face a pandemic that ravaged most of the planet Ulp relevant Continue reading Nintendo releases big Animal Crossing New Horizons update earlier than expectedIt s the game s last free major content update NintendoNintendo has released its last free major content update for Animal Crossing New Horizons over a day earlier than planned The update is now live to download to your Switch Version adds several characters from old Animal Crossing titles One of those characters is Brewster the quiet pigeon proprietor who ll open up the Roost Caféat the museum after you do a certain favor for museum director Blathers Kapp n the singing sailor kappa is also back and will take you to remote islands on his boat Only once a day however If you re waiting on that paid DLC Happy Home Paradise is still scheduled to come out tomorrow Continue reading nbsp The biggest news stories you might have missedZipCharge Go is a suitcase size power bank for EVsAdidas made Xbox sneakers you can actually buyApple sold a record number of MacBooks last quarterASUS Vivobook Slate is a in laptop with an OLED display for Amazon s Alexa powered indoor air quality monitor alerts you to pollution Metroid Dread reminded me why Metroid is an essential seriesThe best smartwatches fitness trackers and wearables to gift 2021-11-04 11:35:25
海外科学 BBC News - Science & Environment COP26: More than 40 countries pledge to quit coal https://www.bbc.co.uk/news/science-environment-59159018?at_medium=RSS&at_campaign=KARANGA china 2021-11-04 11:03:31
ニュース BBC News - Home Owen Paterson: Government U-turn over MPs' conduct plan https://www.bbc.co.uk/news/uk-politics-59163961?at_medium=RSS&at_campaign=KARANGA suspension 2021-11-04 11:43:30
ニュース BBC News - Home Cleo Smith: Australian man charged over four-year-old's abduction https://www.bbc.co.uk/news/world-australia-59162188?at_medium=RSS&at_campaign=KARANGA abductionthe 2021-11-04 11:05:53
ニュース BBC News - Home Insulate Britain blocks roads around Parliament https://www.bbc.co.uk/news/uk-england-london-59163068?at_medium=RSS&at_campaign=KARANGA campaigns 2021-11-04 11:13:09
ニュース BBC News - Home COP26: More than 40 countries pledge to quit coal https://www.bbc.co.uk/news/science-environment-59159018?at_medium=RSS&at_campaign=KARANGA china 2021-11-04 11:03:31
ニュース BBC News - Home COP26: Has the Glasgow climate summit been poorly organised? https://www.bbc.co.uk/news/uk-scotland-59150987?at_medium=RSS&at_campaign=KARANGA delegates 2021-11-04 11:28:41
ニュース BBC News - Home England support staff member tests positive for Covid-19 https://www.bbc.co.uk/sport/rugby-union/59163406?at_medium=RSS&at_campaign=KARANGA twickenham 2021-11-04 11:35:58
ニュース BBC News - Home T20 World Cup - Australia v Bangladesh: Adam Zampa takes 5-19 https://www.bbc.co.uk/sport/av/cricket/59164724?at_medium=RSS&at_campaign=KARANGA dubai 2021-11-04 11:44:07
LifeHuck ライフハッカー[日本版] 売れてる「ライフハックツール」TOP10|今月はコクヨが大人気! https://www.lifehacker.jp/2021/11/245341lht-matome-2021-10.html 大人気 2021-11-04 21:00:00
GCP Google Cloud Platform Japan 公式ブログ 新しい Network Connectivity Center パートナーとともに築くオープンで柔軟性の高いクラウド ネットワークへの道 https://cloud.google.com/blog/ja/products/networking/google-cloud-network-connectivity-center-networking-partnerships/ NetworkConnectivityCenterは統合されたネットワーク接続管理ソリューションです。 2021-11-04 12:00:00
北海道 北海道新聞 新篠津グライダー落下事故、運輸安全委が調査開始 https://www.hokkaido-np.co.jp/article/607990/ 新篠津村 2021-11-04 20:12:30
北海道 北海道新聞 大阪建設石綿訴訟で集団和解 屋根工含む33人 https://www.hokkaido-np.co.jp/article/607992/ 建設現場 2021-11-04 20:06:00
北海道 北海道新聞 野間文芸賞に作家リービ英雄さん 出版文化賞は諫山さんら https://www.hokkaido-np.co.jp/article/607991/ 野間文化財団 2021-11-04 20:02:00
北海道 北海道新聞 積雪の深さや降雪量、6時間先まで予測 気象庁、HPリニューアル https://www.hokkaido-np.co.jp/article/607993/ 降雪 2021-11-04 20:07:00
北海道 北海道新聞 京都で色づく紅葉、ライトアップ 左京区の永観堂で試験点灯 https://www.hokkaido-np.co.jp/article/607989/ 京都市左京区 2021-11-04 20:02:00
海外TECH reddit 日本のアニメから「中国要素」が減っていることを気にする中国人 https://www.reddit.com/r/newsokunomoral/comments/qmi8t7/日本のアニメから中国要素が減っていることを気にする中国人/ ewsokunomorallinkcomments 2021-11-04 11:10:34
海外TECH reddit 「勝手に手紙読んだろ」郵便局コントがプチ炎上 陣内智則謝罪・説明「ネタなのよ」「難しいね」 https://www.reddit.com/r/newsokunomoral/comments/qmi4pa/勝手に手紙読んだろ郵便局コントがプチ炎上_陣内智則謝罪説明ネタなのよ難しいね/ ewsokunomorallinkcomments 2021-11-04 11:03:01
海外TECH reddit 2021年新語・流行語大賞のノミネート語が発表 「ウマ娘」「うっせぇわ」「親ガチャ」など https://www.reddit.com/r/newsokunomoral/comments/qmidc1/2021年新語流行語大賞のノミネート語が発表_ウマ娘うっせぇわ親ガチャなど/ ewsokunomorallinkcomments 2021-11-04 11:19:17
GCP Cloud Blog JA 新しい Network Connectivity Center パートナーとともに築くオープンで柔軟性の高いクラウド ネットワークへの道 https://cloud.google.com/blog/ja/products/networking/google-cloud-network-connectivity-center-networking-partnerships/ NetworkConnectivityCenterは統合されたネットワーク接続管理ソリューションです。 2021-11-04 12: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件)