AWS |
AWS Compute Blog |
Operating Lambda: Performance optimization – Part 2 |
https://aws.amazon.com/blogs/compute/operating-lambda-performance-optimization-part-2/
|
Operating Lambda Performance optimization Part This post is the second in a part series on performance optimization in Lambda It explains the effect of the memory configuration on Lambda performance and why the memory setting also controls the compute power and networking I O available to a function |
2021-05-04 13:37:21 |
AWS |
AWS Open Source Blog |
Creating a custom Lambda authorizer using Open Policy Agent |
https://aws.amazon.com/blogs/opensource/creating-a-custom-lambda-authorizer-using-open-policy-agent/
|
Creating a custom Lambda authorizer using Open Policy AgentOrganizations have complex infrastructure and need common tooling to make decisions about the system as a whole In such scenarios policy based decision making could be implemented using Open Policy Agent OPA OPA is an open source general purpose policy engine which decouples policy decision making from policy enforcement When a web based application needs to make a policy … |
2021-05-04 13:24:37 |
js |
JavaScriptタグが付けられた新着投稿 - Qiita |
レンダリングブロックに配慮したリソースの読み込み(CSS編) |
https://qiita.com/mt877/items/a0bb42f6823cfed78395
|
CSSを非同期で読み込みCSSを非同期で読み込むとCSSOMの構築も非同期になり、JavaScriptの実行やレンダリングがブロックされるといった問題が解消されます。 |
2021-05-04 22:58:33 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
プライマリモニターより左上のモニターでフォームの挙動がおかしい |
https://teratail.com/questions/336600?rss=all
|
プライマリモニターより左上のモニターでフォームの挙動がおかしい前提・実現したいことマルチモニター環境にて、プライマリモニターより左上のモニターでフォームのどの位置にマウスカーソルがあってもサイズ変更ができてしまう。 |
2021-05-04 22:52:03 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
Vue.jsで表作成しているがaxiosで取得するデータがループする |
https://teratail.com/questions/336599?rss=all
|
Vuejsで表作成しているがaxiosで取得するデータがループする実現したいこと米国の特許検索サイトのAPIを利用して特許の検索結果と件数を取得しています。 |
2021-05-04 22:41:44 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
シェルスクリプトが期待通りに動作しない |
https://teratail.com/questions/336598?rss=all
|
シェルスクリプトが期待通りに動作しないmacのターミナルzshで以下のシェルスクリプトを実行しましたが、期待通りの出力にならない理由がわかりません。 |
2021-05-04 22:38:26 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
WordPressで画像が枠からはみ出る |
https://teratail.com/questions/336597?rss=all
|
WordPressで画像が枠からはみ出る前提・実現したいこと画像を枠内におさめたい。 |
2021-05-04 22:35:28 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
oculusビルド時にEventTriggerが反応しない |
https://teratail.com/questions/336596?rss=all
|
発生している問題・エラーメッセージエディタ上でプレイするとホバーを検出できますが、実機で行った場合、コントローラーをクリックしないと反応しません。 |
2021-05-04 22:34:14 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
Visual Studio for mac でForm画面を表示できない |
https://teratail.com/questions/336595?rss=all
|
VisualStudioformacでForm画面を表示できないVisualnbspStudionbspfornbspmacnbspでusingSystemWindowsFormsclassSamplepublicstaticvoidMainFormfmfmnewFormfmTextようこそApplicationRunfm以上のようなコードを実行したいのですが、monoが予期しない理由で終了しました。 |
2021-05-04 22:32:06 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
MAYA 選択したオブジェクトの名前[A]を参照して、新しく生成したロケーターの名前をリネームしたい |
https://teratail.com/questions/336594?rss=all
|
MAYA選択したオブジェクトの名前Aを参照して、新しく生成したロケーターの名前をリネームしたい前提・実現したいことpythonの勉強を始めて日目です。 |
2021-05-04 22:12:19 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
正規表現にfor文は使えない? |
https://teratail.com/questions/336593?rss=all
|
正規表現にfor文は使えない問題ABCnbspB問題より方針本来であれば部分文字列は高々制約上個までしか発生しないので、これを全探索すれば良いのですが、正規表現を用いた解法も無理ではなさそうと思い、やってみます。 |
2021-05-04 22:11:23 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
android studio。multidexの有効化がアプリパフォーマンスに及ぼす影響について。 |
https://teratail.com/questions/336592?rss=all
|
android |
2021-05-04 22:06:40 |
Ruby |
Rubyタグが付けられた新着投稿 - Qiita |
Rails6でカスタムフォントを使用する方法 |
https://qiita.com/kamataku/items/69df48ee04878c773d73
|
無事反映ができていれば、コマンドの結果にコンパイルされたカスタムフォントのファイル名が表示されます。 |
2021-05-04 22:39:11 |
Ruby |
Rubyタグが付けられた新着投稿 - Qiita |
【rails6】結合テストコードでBASIC認証を通す方法 |
https://qiita.com/Takahiro_Ito/items/ec35c98f053160ecd27c
|
【rails】結合テストコードでBASIC認証を通す方法こんばんは引き続きテストコードについて記載していきます今日は結合テストコードです。 |
2021-05-04 22:12:24 |
海外TECH |
DEV Community |
✔||🤢 Commit or Vomit | nested ternary operator |
https://dev.to/jmdejager/commit-or-vomit-nested-ternary-operator-1d02
|
Commit or Vomit nested ternary operator The ternary operatorIt s a delight to use them but should we use them as much as possible what do you think about the next example H C null V r g b C V g b r C r g C nested ternary operators Commit I d commit something like this Vomit we all know unicorns don t vomit Like your post please continue this series Let s vote Photo by Science in HD on Unsplash |
2021-05-04 13:52:52 |
海外TECH |
DEV Community |
Using JavaScript Symbol.toStringTag for objects types description |
https://dev.to/cherif_b/using-javascript-tostringtag-for-objects-types-description-15hc
|
Using JavaScript Symbol toStringTag for objects types descriptionA day ago I asked my developers friends How to know a JavaScript object literal type Most of the answers of the answers suggested to use instanceof while this answer works for objects created by using a constructor it can not work with objects literals or maybe for some reasons developers don t export the object constructor from the module but they provide a factory with object initializer instead The use case The question was about the following use case const user username johndoe firstname John lastname Doe It is hard to determine if the object above is in certain type without checking the presence of all the properties imagine if we have a more than properties or more it would be exhausting right It is obvious it would be good if we can know that the object is indeed in User type just by a single call Using Object prototype toString gives the object type inside square brackets for the built in console log Object prototype toString call gt object Number console log Object prototype toString call Cherif gt object String Or const one const name Cherif console log one toString gt object Number console log name toString gt object String But for a developer defined objects it gives a object Object result a generic object const user username johndoe firstname John lastname Doe console log user toString gt object Object console log Object prototype toString call user gt object Object Symbol toStringTag to the rescueFortunately with the introduction of ES Symbols a number of built in symbols had seen the day make it possible to describe custom objects type by overriding Object prototype toString using Symbol toStringTag so to describe a type for our user object we can do the following const user username johndoe firstname John lastname Doe get Symbol toStringTag return User The string tag description console log user toString user gt object User console log Object prototype toString call user gt object User Read the string using Symbol toStringTag I would advice to make the check using the Symbol property by using user Symbol toStringTag like this we have the possibility to override toString function for other purposes and we can just have User string from the string tag instead of object User example const user username johndoe firstname John lastname Doe get Symbol toStringTag return User The string tag description toString return this firstname this lastname console log user Symbol toStringTag gt User console log user toString gt John Doe All the code example are in the following CodePen See the Pen Symbol stringTag by Mohamed Cherif Bouchelaghem cherifGsoul on CodePen I hope you find this article useful and helpful let me your thoughts in the comments below |
2021-05-04 13:42:10 |
海外TECH |
DEV Community |
A Guide to Eslint |
https://dev.to/laurieontech/a-guide-to-eslint-4mj7
|
A Guide to EslintI spent the last week working on ESLint configuration and ensuring that syntax checks were built into the developer workflow In the process I read a bunch of different docs which is usually my signal that an all in one blog post needs to be written So here we go What is Eslint For starters ESLint is a tool that statically analyzes your code Typically it s used to ensure consistent syntax across a project with multiple collaborators You ve likely used ESLint without realizing it because it was already configured in your project Ever seen those red squiggly lines in VS code Those are often courtesy of Eslint One thing to keep in mind is that ESLint is incredibly powerful It has the ability to not only analyze code but transform it We ll get to that later ConfigurationESLint allows you to set project level rules using an eslintrc file Since every team and project are slightly different the control you have over your ruleset is quite extensive RulesFor every rule let s say you re setting the no console rule you can decide whether the rule should be off or set to warn or error Like this module exports rules no console warn In the above example the no console rule determines whether console log statements should exist in the codebase If the rule is set to off then console log can be littered through your code and the linter won t care If it s set to warn the linter will let you know the there are console log statements in the code but it won t be a showstopper But if the rule is set to error linting will fail if a console log statement shows up in the code While this is helpful some rules need to get more specific For example ESLint has a rule called import no extraneous dependencies The goal of this rule is to catch situations in which you ve imported a dependency into your file that is not included in your project s package json While you could use off warn or error it s not as helpful as it could be That s because there are different types of dependencies like devDependencies and peerDependencies A more nuanced configuration of the rule would look like this module exports rules import no extraneous dependencies error devDependencies false optionalDependencies false peerDependencies false The above code will only show a linting error when core dependencies are imported but not included Any other dependency type can be safely ignored ExtendsYou may be thinking that this seems a bit tedious Do you really want to go through and determine your preferences for all of these individual rules You may but probably not In fact in most cases you ll only need to configure a handful of individual rules the rules that differ from the ruleset you re extending Many projects use the core ESLint rules as shown here module exports extends eslint recommended highlight line rules no console warn However ESLint also allows you to extend rulesets that are exported by other projects So you may opt to use the React recommendations for example RootAnother interesting thing about ESLint is that it follows a cascade model Suppose you re using a monorepo structure with multiple packages that each have their own eslintrc file You can include a configuration file in the root of your repo In that case ESLint will check the configuration file closest to a given line of code first and move up the tree merging as it goes Typically the top level directory will include root true so ESLint knows it can stop looking for additional config files module exports root true highlight line extends eslint recommended rules no console warn However this rule can exist in any eslintrc So if you wanted to include a standalone package in your monorepo that should not comply with the top level eslintrc you can do that This is a great trick so that you don t need to supersede all of the rules at the top level OverridesAlternatively you may want to supersede individual files that wouldn t have their own eslintrc In that case you can use overrides like this module exports root true rules no console warn highlight start overrides files example js rules no console error highlight end CLINow that you have ESLint configured what can it actually do If you run an ESLint command it will go through the files in your project and spit out all the warnings and errors to the command line eslint You may remember that I mentioned up top that ESLint can perform transforms Running ESLint with the fix flag means it will attempt to change any syntax that errors out It s worth noting that it can t fix every error it finds but it can handle some of them You can also use the debug flag which will show you what rules ESLint is using This is helpful if you re attempting to determine why something is failing passing that shouldn t be ScriptsWhile running ESLint locally is helpful the point of ESLint is repeatability and consistency in your project To get that you likely want to add ESLint commands to your package json scripts scripts lint eslint packages js jsx ts tsx When you do that you can make use of things like husky We ll talk about that next time WowThere is a lot in this post but there is even more I didn t cover In the scripts example I used a glob there are flags like quiet you can even ignore certain files throughout your project But this is a good start towards helping you understand the setup of an existing project or how to start setting up your own And who knows an ESLinterror may lead to finding and solving a bug It did for me |
2021-05-04 13:41:23 |
海外TECH |
DEV Community |
Introduction to NextJS |
https://dev.to/olenadrugalya/introduction-to-nextjs-3gi4
|
Introduction to NextJSThis blog post is an easy introduction to NextJS and it s features However before starting to read this blog post you must be familiar with React library What is NextJS NextJS is a React framework which means is a platform for developing software applications by using React library It has a lot of features which make development of React applications easier As a programmer we don t need to start from scratch when there are already tools designed to help us with our projects Frameworks are software that is developed and used by developers to build applications so NextJS is one of them Why to Use NextJS This question appeared in my head many times before I wasn t familiar with NextJS I was pretty sure that React library itself is enough to build an application But as I was developing my web developer s skills and started to build highly scaled large applications I had to import many additional libraries together with React for example for routing NextJS makes the development of large React application easier since it provides many additional features which we will discuss below in details This framework solves many common problems and simply makes the life of React developer easier We still write React code and use React features but also together with that we are provided by lots of built in features to solve common problems and clear instructions how to use them Key Features of NextJSNextJS offers many benefits for the React developers page based routing system with support for dynamic routes With NextJS we don t need to care about writing a code for routers for the pages we just create a page in a special folder and NextJS provides it with routing simple as that pre rendering both static generation SSG and server side rendering SSR are supportedServer side rendering SSR is preparing of content of a page on a server while one page React application uses client side rendering CSR The problem with CSR is that it s not actually SEO friendly because search engines will not see the actual content of the page By using SSR in NextJS we can avoid such issues as flickering page while data fetching and our website content will be SEO friendly built in CSS and Sass support and support for any CSS in JS librarydevelopment environment with Fast Refresh supportfull stack capabilitiesNextJS makes it easier for React developers to add back end code to the project It very easy here to add our own code for storing data getting data authentication etc With all that being said I highly recommend you to consider using this framework and if you have already decided to learn it congratulations you made a good choice Thank you for reading my blog Feel free to connect on LinkedIn or Twitter |
2021-05-04 13:20:09 |
海外TECH |
DEV Community |
Building GraphQL APIs on Ethereum |
https://dev.to/dabit3/building-graphql-apis-on-ethereum-4poa
|
Building GraphQL APIs on EthereumThe number of production Dapps continues to explode and the demand for developers building with Solidity and other blockchain languages continues to outpace supply moving wages higher and higher As a developer getting into this space I quickly learned there are a lot of differences in the way that we interact with and build on top of blockchains versus what I was used to in the traditional web With Ethereum and other blockchains data isn t stored in a format that can efficiently or easily be consumed directly from other applications or front ends The problem is that you need to have the data indexed and organized for efficient retrieval Traditionally that s the work that databases do in the centralized tech stack but that indexing layer was missing in the Web stack In the traditional web stack databases servers and APIs query filter sort paginate group and join data before it is returned to an application usually via some type of http request These types of data transformations are not possible when reading data directly from Ethereum or other blockchains In the past developers were getting around this by building their own centralized indexing servers pulling data from blockchains storing it in a database and exposing it over an API This required significant engineering and hardware resources broke the important security properties required for decentralization How can we build an API on top of blockchain data that can easily be deployed to a decentralized web infrastructure Let s find out Decentralizing web infrastructureThe vision of and movement towards a decentralized internet is commonly referred to as Web Web enhances the internet as we know it today with these added characteristics DecentralizedVerifiableTrustlessAnonymousSelf governingFor a great overview of what Web is check out this video by Juan BenetTo achieve decentralization protocols define networks that offer a range of digital services such as compute storage bandwidth identity and other pieces of web infrastructure with no intermediaries These protocols are usually distributed across multiple nodes servers that enable the participation of anyone looking to be part of the network and provide a service The network participants are incentivized to provide the highest quality services to anyone consuming them Rules are also put in place to ensure the security and the integrity of the network itself This is usually accomplished using a combination of consensus mechanisms programmed into smart contracts implementing various types of game theory and cryptoeconomic design What makes a service truly decentralized Yaniv Tal yanivgraph BernFeitosa It s operated by a permissionless network of nodes The service is verifiable Trust minimized Market based pricing Censorship resistance AM Apr Building on The GraphIn this post we will be looking at one such protocol The Graph and how to build and deploy our own GraphQL API using data stored in the Ethereum blockchain The Graph is an indexing protocol for querying blockchains like Ethereum and networks like IPFS Anyone can build and publish open APIs called subgraphs making data easily accessible Subgraphs define the data data sources and data access patterns that you would like to have made available via a GraphQL API You as a developer can choose either to use a subgraph already deployed by another developer or define and deploy your own subgraph and use it Developers can create open APIs by deploying their subgraphs either to the hosted service or to the network enabling them to earn money based on the amount of usage of their API Subgraphs are made up of a few main parts GraphQL SchemaThe GraphQL Schema defines the data types entities you would like to save and query for You can also define configuration like relationships and full text search capabilities in your schema Subgraph Manifest yaml configuration from the docs The manifest defines the smart contracts your subgraph indexes their ABIs which events from these contracts to pay attention to and how to map event data to entities that Graph Node stores and allows to query AssemblyScript MappingsAssemblyScript Mappings allow you to save data to be indexed using the entity types defined in your schema The Graph CLI also generates AssemblyScript types using a combination of the subgraph s schema along with a smart contract s ABIs Let s start buildingNow that we have a good understanding of The Graph and how it works let s start writing some code In this tutorial we ll build a subgraph for querying NTF data from the Zora subgraph implementing queries for fetching NFTs as well as their owners and building relationships between them PrerequisitesTo be successful in this tutorial you should have Node js installed on your machine These days I recommend using either nvm or fnm to manage Node js versions Creating the Graph project in the Graph consoleTo get started open the Graph Console and either sign in or create a new account Next go to the dashboard and click on Add Subgraph to create a new subgraph Configure your subgraph with the following properties Subgraph Name ZoranftsubgraphSubtitle A subgraph for querying NFTsOptional Fill the description and GITHUB URL propertiesOnce the subgraph is created we will initialize the subgraph locally using the Graph CLI Initializing a new subgraph using the Graph CLINext install the Graph CLI npm install g graphprotocol graph cli or yarn global add graphprotocol graph cliOnce the Graph CLI has been installed you can initialize a new subgraph with the Graph CLI init command There are two ways to initialize a new subgraph From an example subgraph graph init from example lt GITHUB USERNAME gt lt SUBGRAPH NAME gt lt DIRECTORY gt From an existing smart contractIf you already have a smart contract deployed to Ethereum mainnet or one of the testnets initializing a new subgraph from this contract is an easy way to get up and running graph init from contract lt CONTRACT ADDRESS gt network lt ETHEREUM NETWORK gt abi lt FILE gt lt GITHUB USER gt lt SUBGRAPH NAME gt lt DIRECTORY gt In our case we ll be using the Zora Token Contract so we can initilize from that contract address by passing in the contract address using the from contract flag graph init from contract xabEFBcfDFbfCdbDABcac network mainnet contract name Token index events Subgraph name ›your username Zoranftsubgraph Directory to create the subgraph in ›Zoranftsubgraph Ethereum network ›Mainnet Contract address ›xabEFBcfDFbfCdbDABcac Contract Name ·TokenThis command will generate a basic subgraph based off of the contract address passed in as the argument to from contract By using this contract address the CLI will initialize a few things in your project to get you started including fetching the abis and saving them in the abis directory By passing in index events the CLI will automatically populate some code for us both in schema graphql as well as src mapping ts based on the events emitted from the contract The main configuration and definition for the subgraph lives in the subgraph yaml file The subgraph codebase consists of a few files subgraph yaml a YAML file containing the subgraph manifestschema graphql a GraphQL schema that defines what data is stored for your subgraph and how to query it via GraphQLAssemblyScript Mappings AssemblyScript code that translates from the event data in Ethereum to the entities defined in your schema e g mapping ts in this tutorial The entries in subgraph yaml that we will be working with are description optional a human readable description of what the subgraph is This description is displayed by the Graph Explorer when the subgraph is deployed to the Hosted Service repository optional the URL of the repository where the subgraph manifest can be found This is also displayed by the Graph Explorer dataSources source the address of the smart contract the subgraph sources and the abi of the smart contract to use The address is optional omitting it allows to index matching events from all contracts dataSources source startBlock optional the number of the block that the data source starts indexing from In most cases we suggest using the block in which the contract was created dataSources mapping entities the entities that the data source writes to the store The schema for each entity is defined in the the schema graphql file dataSources mapping abis one or more named ABI files for the source contract as well as any other smart contracts that you interact with from within the mappings dataSources mapping eventHandlers lists the smart contract events this subgraph reacts to and the handlers in the mapping ー src mapping ts in the example ーthat transform these events into entities in the store Defining the entitiesWith The Graph you define entity types in schema graphql and Graph Node will generate top level fields for querying single instances and collections of that entity type Each type that should be an entity is required to be annotated with an entity directive The entities data we will be indexing are the Token and User This way we can index the Tokens created by the users as well as the users themselves To do this update schema graphql with the following code type Token entity id ID tokenID BigInt contentURI String metadataURI String creator User owner User type User entity id ID tokens Token derivedFrom field owner created Token derivedFrom field creator On Relationships via derivedFrom from the docs Reverse lookups can be defined on an entity through the derivedFrom field This creates a virtual field on the entity that may be queried but cannot be set manually through the mappings API Rather it is derived from the relationship defined on the other entity For such relationships it rarely makes sense to store both sides of the relationship and both indexing and query performance will be better when only one side is stored and the other is derived For one to many relationships the relationship should always be stored on the one side and the many side should always be derived Storing the relationship this way rather than storing an array of entities on the many side will result in dramatically better performance for both indexing and querying the subgraph In general storing arrays of entities should be avoided as much as is practical Now that we have created the GraphQL schema for our app we can generate the entities locally to start using in the mappings created by the CLI graph codegenIn order to make working smart contracts events and entities easy and type safe the Graph CLI generates AssemblyScript types from a combination of the subgraph s GraphQL schema and the contract ABIs included in the data sources Updating the subgraph with the entities and mappingsNow we can configure the subgraph yaml to use the entities that we have just created and configure their mappings To do so first update the dataSources mapping entities field with the User and Token entities entities Token UserNext update the dataSources mapping eventHandlers to include only the following two event handlers eventHandlers event TokenURIUpdated indexed uint address string handler handleTokenURIUpdated event Transfer indexed address indexed address indexed uint handler handleTransferFinally update the configuration to add the startBlock source address xabEFBcfDFbfCdbDABcac abi Token startBlock Assemblyscript mappingsNext open src mappings ts to write the mappings that we defined in our subgraph subgraph eventHandlers Update the file with the following code import TokenURIUpdated as TokenURIUpdatedEvent Transfer as TransferEvent Token as TokenContract from generated Token Token import Token User from generated schema export function handleTokenURIUpdated event TokenURIUpdatedEvent void let token Token load event params tokenId toString token contentURI event params uri token save export function handleTransfer event TransferEvent void let token Token load event params tokenId toString if token token new Token event params tokenId toString token creator event params to toHexString token tokenID event params tokenId let tokenContract TokenContract bind event address token contentURI tokenContract tokenURI event params tokenId token metadataURI tokenContract tokenMetadataURI event params tokenId token owner event params to toHexString token save let user User load event params to toHexString if user user new User event params to toHexString user save These mappings will handle events for when a new token is created transfered or updated When these events fire the mappings will save the data into the subgraph Running a buildNext let s run a build to make sure that everything is configured properly To do so run the build command graph buildIf the build is successful you should see a new build folder generated in your root directory Deploying the subgraphTo deploy we can run the deploy command using the Graph CLI To deploy you will first need to copy the Access token for the subgraph you created in the Graph console Next run the following command graph auth lt ACCESS TOKEN gt yarn deployOnce the subgraph is deployed you should see it show up in your dashboard When you click on the subgraph it should open the Graph explorer Querying for dataNow that we are in the dashboard we should be able to start querying for data Run the following query to get a list of tokens and their metadata tokens id tokenID contentURI metadataURI We can also configure the order direction tokens orderBy id orderDirection desc id tokenID contentURI metadataURI Or choose to skip forward a certain number of results to implement some basic pagination tokens skip orderBy id orderDirection desc id tokenID contentURI metadataURI Or query for users and their associated content users id tokens id contentURI Updating the subgraphWhat if we want to make some changes to the subgraph and then redeploy This is pretty easy so let s learn how to do it Let s say that we want to add a new feature to our subgraph In addition to our existing querying capabilities let s say that we wanted to add the capabilities to sort by the timestamp that the NFT was created To do so we need to first add a new createdAtTimestamp field to the Token entity type Token entity id ID tokenID BigInt contentURI String metadataURI String creator User owner User Add new createdAtTimesamp field createdAtTimestamp BigInt Now we can re run the codegen graph codegenNext we need to update the mapping to save this new field update the handleTransfer function to add the createdAtTimestamp to the token objectexport function handleTransfer event TransferEvent void let token Token load event params tokenId toString if token token new Token event params tokenId toString token creator event params to toHexString token tokenID event params tokenId Add the createdAtTimestamp to the token object token createdAtTimestamp event block timestamp let tokenContract TokenContract bind event address token contentURI tokenContract tokenURI event params tokenId token metadataURI tokenContract tokenMetadataURI event params tokenId token owner event params to toHexString token save let user User load event params to toHexString if user user new User event params to toHexString user save Now we can re deploy the subgraph yarn deployOnce the subgraph has been redeployed we can now query by timestamp to view the most recently created NFTS tokens orderBy createdAtTimestamp orderDirection desc id tokenID contentURI metadataURI The codebase for this project is located here Next stepsIf you are interested in learning more about Web building Dapps or building subgraphs check out the following resources The Graph on Twitter graphprotocolThe Complete Guide to Full Stack Ethereum DevelopmentThe Graph DiscordSolidity DocsEthereum Developer DocumentationAustin Griffith on Twitter austingriffith amp Scaffold EthCrypto Zombies |
2021-05-04 13:16:25 |
海外TECH |
DEV Community |
New keyword, under the hood |
https://dev.to/omamazainab/new-keyword-under-the-hood-4dhe
|
New keyword under the hoodWe all know JavaScript is an object oriented language but the truth is the object oriented JavaScript is not same as other object oriented languages such as Java C or C JavaScript is an object oriented language but it is not a class based object oriented language the features of object oriented programming are implemented in JavaScript using it s prototypal features However ES has provided us many features to make JavaScript look more like a class based object oriented language which makes development easy using a easier syntax but under the hood JavaScript is doing nothing like object oriented languages do Among all of these features we have a new keyword to make Objects having certain properties we want This is a typical example of how we use the new keyword in JavaScript function User name age this name name this age age const mike new User Mike But as I have mentioned above it is a syntactic sugar so what happens under the hood It does the following things Creates a new empty object Sets the newly created object s proto property s reference to the constructor function s prototype property Bind this keyword to the newly created object and then execute the constructor function Return that object Let s study these steps closely to understand more about new keyword Creates a new empty object The new keyword makes a new empty object Sets the object s proto property s reference to constructor function s prototype property Break this sentence into two parts let s understand what is proto property You might have seen objects having a property proto lightly colored with respect to other properties Every object in JavaScript has a property proto it is the reference to some object which is linked to our object For example in our case proto in mike object references to the prototype property of the constructor function User But what is meant by prototype property of a function Do functions have properties Here is a thing in JavaScript functions are first class objects A first class object is an entity that can be dynamically created destroyed passed to a function returned as a value and have all the rights as other variables in the programming language have So the functions in JavaScript can have properties and methods both so we can say each function is an object as well as a function Let s take a look at an example function addNumbers a b return a b addNumbers returns addNumbers description Adds two numbers addNumbers description Adds two numbersWe might think by assigning a new property description to addNumber addNumber might be overridden Let s call addNumber again addNumbers returns So the thing is addNumber did not get overridden it is still a function and the property description got stored in the object of the function addNumber we can say addumber is both function and an object As soon as we use the keyword function JavaScript attaches an object with that function Each function object has a built in property prototype on it which is automatically an object we usually store the things that are needed only once for example any method if we add it to each object we create we will have many copies of that method which will be a waste of space so we store methods on prototype property of a constructor function so we only have a single copy of that method and all the objects use the same method Now let s get back to the main point and talk about the User function called with new function User name age this name name this age age const mike new User Mike the new empty object created by new keyword had a property proto new keyword puts the reference of prototype property of the User function s object into the hidden property proto of newly created empty object so now both newly created object and the constructor function s object are linked Bind this keyword to the newly created object and then execute the constructor function Bind this keyword to the newly created object means that now all the references to this in the constructor function will now refer to the newly created object In our example see the constructor when doing new User Mike after step and step this will be bound to newly created object and constructor will get executed setting properties name and age into newly created object because these properties were set on this in the constructor function and this was referring to the newly created object Return that newly created object The last functionality of this keyword is to return the newly created object and it will be assigned to variable mike |
2021-05-04 13:06:07 |
海外TECH |
DEV Community |
#30DaysOfAppwrite : Appwrite Dashboard |
https://dev.to/appwrite/30daysofappwrite-appwrite-dashboard-15cc
|
DaysOfAppwrite Appwrite Dashboard IntroAppwrite is an open source self hosted Backend as a Service that makes app development easier with a suite of SDKs and APIs to accelerate app development DaysOfAppwrite is a month long event focused on giving developers a walkthrough of all of Appwrite s features starting from the basics to more advanced features like Cloud Functions Alongside we will also be building a fully featured Medium Clone to demonstrate how these concepts can be applied when building a real world app We also have some exciting prizes for developers who follow along with us Appwrite DashboardWelcome to Day It s time to finally take a look at Appwrite s shiny dashboard and look at all of Appwrite s features This will only be a high level overview as we will be going through each section in detail in our later tutorials WelcomeAfter logging into your Appwrite console you will be greeted with a getting started page This is where you can create your first project Once you create a new project or select a project you will be taken to the project home page HomeOn the home page you will be greeted with some pretty graphs that highlight your project s usage stats Here you can find the total number of requests that Appwrite has handled the total bandwidth consumed the total number of documents in your collections the total number of users in your project and more Below this you will find the Platforms section This is where you can add a Web or Flutter project to Appwrite Stay tuned for more platforms coming soon Adding a Platform is important because it tells Appwrite about trusted domains and restricts requests coming in from domains that are not listed here This also fixes those nasty CORS issues Let s start with the first item on the sidebar Database DatabaseThe database section allows you to view create and edit your collections It also allows you to view all the documents in your project The main screen is where you can create your collection Once you create a collection you can then click on it to configure it further Under the Settings tab you will find the options to change the collection name add rules to your collection change the read and write permissions for your collection delete your collection etc We will cover these concepts in detail in the upcoming days For now you just need to know where to find them Think of a rule as a column in a relational database Click the Add Rule button and you can create your first rule You can give your rule ahem column a name and give it a type The interesting rule here is the Document rule type The Document rule type allows your collection to have nested documents from other collections Below the rules section is the permissions section This is where you can set permissions at a collection level This permission controls who can read create or update documents in this collection StorageThe second option in the sidebar is Storage This is where you can manage all the files uploaded to your server You can upload files using the button at the bottom right This dialog also allows you to set read and write permissions for your file You can definitely use an SDK to upload your files This is just the console way of doing it Once you are done uploading your file you can always update its permissions or delete it UsersThis is the third section in the sidebar and where you manage all your projects users You can use this section to create delete or even block certain users This is also where you can create and manage teams and enable OAuth providers We have a total of different OAuth providers most of which was contributed by the community So if there is still a provider that we are missing feel free to take a look at how you can help add a new OAuth Provider FunctionsThe fourth option on the sidebar is Cloud Functions one of Appwrite s most powerful features As the name suggests Cloud Functions allows you and your users to execute serverless functions As of writing this tutorial we support different environments for languages including Node PHP Python Ruby Deno Dart and NET You can find more information about Cloud Functions here Once you create a function you can configure much of its behavior You can add new code versions of your functions which we refer to as a tag Each tag gets its own ID and exclusive container for executing its code Under the Monitors section you will find visualizations that highlight executions CPU utilization and failures Under the Logs section you will find execution logs for each execution of the function Finally under the Settings section you can set permissions for executing your function or set up CRON schedules for triggering the function You can also set up listeners to execute functions triggered by system events System Events are emitted when certain actions take place on the server like the creation of a user creation of a collection document etc which can be used to trigger your cloud function An example use case you would like to send a welcome email when a user signs up with your app We have covered this usecase in depth and more over at dev to Finally in the Settings section of your Cloud Function you can also add environment variables that this function may require This could include API keys for third party APIs that you may be using TasksThe next option in the sidebar is Tasks Tasks can be thought of as a precursor to Cloud Functions Instead of running your functions on the Appwrite server Tasks allows you to schedule HTTP requests to any external endpoint that you may have This could be some of your other backend servers where you may have some additional business logic setup WebhooksThe next item on our list is Webhooks Webhooks allow you to hit rd party endpoints when server events take place inside Appwrite They are similar to tasks in that they can be used to hit external HTTP endpoints but they are triggered differently from tasks which use a CRON schedule API KeysThe next section on our list is API Keys API Keys are required to interact with Appwrite from a Server SDK Each API key is scoped to restrict access to only the selected features and prevent misuse To create an API Key simply select Add API Key select the required scopes give your key a name and click Create You can now use this API key in your Server Side Integration SettingsThe Settings tab is where you will find the options to manage your project You will find options to invite members to your project set up custom domains change the project name delete the project etc Oh and I almost forgot Here s a fun little treat for your eyes Flip this switch and enter the dark side CreditsWe hope you liked this write up You can follow DaysOfAppwrite on Social Media to keep up with all of our posts The complete event timeline can be found hereDiscord ServerAppwrite HomepageAppwrite s GithubFeel free to reach out to us on Discord if you would like to learn more about Appwrite Aliens or Unicorns Stay tuned for tomorrow s article Until then |
2021-05-04 13:05:33 |
Apple |
AppleInsider - Frontpage News |
App Store growth will slow more than expected in June quarter, analyst says |
https://appleinsider.com/articles/21/05/04/app-store-growth-will-slow-more-than-expected-in-june-quarter-analyst-says?utm_medium=rss
|
App Store growth will slow more than expected in June quarter analyst saysMorgan Stanley Katy Huberty expects Apple App Store revenue will grow less than expected in the June quarter though its long term outlook remains unchanged Credit AppleCredit AppleIn a note to investors seen by AppleInsider lead analyst Katy Huberty says she has tweaked her near term Services estimates after analyzing post April data for the App Store Read more |
2021-05-04 13:57:52 |
Apple |
AppleInsider - Frontpage News |
Emergency Broadband Benefit Program gives $50 discount per month to homes in need |
https://appleinsider.com/articles/21/05/04/emergency-broadband-benefit-program-gives-50-discount-per-month-to-homes-in-need?utm_medium=rss
|
Emergency Broadband Benefit Program gives discount per month to homes in needBroadband providers will be able to provide up to per month in savings to low income consumers or those who have been financially affected by COVID starting May EBB enrollment begins on May The Emergency Broadband Benefit Program EBB is a billion federal initiative created by Congress to help lower the cost of high speed internet for eligible households The program is temporary but aims to help those in need during the COVID pandemic Read more |
2021-05-04 13:56:00 |
Apple |
AppleInsider - Frontpage News |
Apple profiles childcare app Winnie for Mother's Day |
https://appleinsider.com/articles/21/05/04/apple-profiles-childcare-app-winnie-for-mothers-day?utm_medium=rss
|
Apple profiles childcare app Winnie for Mother x s DayTo mark Mother s Day on May Apple has published a profile of the developers behind Winnie an iOS app designed to help mothers find childcare for their kids Winnie connects users to over licensed childcare providers across the United States It has also helped more than million parents in their searches for childcare offering up information about license statuses for providers as well as reviews images and forums for discussions The app is considered an App Store success story for Apple with its profile pointing out Winnie is close to celebrating its five year anniversary Created by CEO Sara Mauskopf and CPO Anne Halsall the app now employs staff across states with the team consisting of women and people of color Read more |
2021-05-04 13:44:44 |
Apple |
AppleInsider - Frontpage News |
Microsoft Discord deal dead, as Sony buys minority stake in the company |
https://appleinsider.com/articles/21/05/04/microsoft-discord-deal-dead-as-sony-buys-minority-stake-in-the-company?utm_medium=rss
|
Microsoft Discord deal dead as Sony buys minority stake in the companyFollowing Discord s negotiations with Microsoft Sony has swooped in with an investment in the gaming focused chat service effectively shutting the door on any full acquisition by the Xbox manufacturer Sony acquires minor stake in DiscordDiscord is a chat service for gamers with voice text and video capabilities built in The service is widely popular amongst younger audiences and would be ripe for acquisition ーif it were for sale Read more |
2021-05-04 13:15:45 |
Apple |
AppleInsider - Frontpage News |
Five more TSMC chip plants planned in U.S. expansion |
https://appleinsider.com/articles/21/05/04/five-more-tsmc-chip-plants-planned-in-us-expansion?utm_medium=rss
|
Five more TSMC chip plants planned in U S expansionApple chip partner TSMC is considering expanding its existing plans to open up a chip foundry in Arizona with the Taiwanese firm apparently planning to open up to a further five more locations in the state TSMC has been working to build a billion chip factory in Arizona one that was originally announced in May and that the company has been busy raising funds to construct However it may not be the only project TSMC is planning to build in the United States According to three sources of Reuters TSMC is looking into potentially adding another five facilities in Arizona alongside the existing project in Phoenix Read more |
2021-05-04 13:01:09 |
海外TECH |
Engadget |
The best gifts for grads under $50 |
https://www.engadget.com/best-gifts-for-grads-under-50-114506320.html
|
engadget |
2021-05-04 13:30:42 |
海外TECH |
Engadget |
Apple TV+ snaps up another Tom Hanks movie |
https://www.engadget.com/apple-tv-plus-tom-hanks-finch-movie-131022786.html
|
chances |
2021-05-04 13:10:22 |
海外TECH |
Engadget |
‘The Bad Batch’ is the eighth season of ‘Clone Wars’ we didn’t ask for |
https://www.engadget.com/star-wars-the-bad-batch-clone-wars-sequel-130115963.html
|
disney |
2021-05-04 13:01:15 |
海外TECH |
Network World |
Weekly internet health check, US and worldwide |
https://www.networkworld.com/article/3534130/covid-19-weekly-health-check-of-isps-cloud-providers-and-conferencing-services.html#tk.rss_all
|
Weekly internet health check US and worldwide The reliability of services delivered by ISPs cloud providers and conferencing services a k a unified communications as a service UCaaS is an indication of how well served businesses are via the internet ThousandEyes is monitoring how these providers are handling the performance challenges they face It will provide Network World a roundup of interesting events of the week in the delivery of these services and Network World will provide a summary here Stop back next week for another update and see more details here Get regularly scheduled insights by signing up for Network World newsletters To read this article in full please click here |
2021-05-04 13:54:00 |
Cisco |
Cisco Blog |
Democratizing Enterprise IoT with Cisco Smart Building Architecture |
https://blogs.cisco.com/networking/democratizing-enterprise-iot-with-cisco-smart-building-architecture
|
Democratizing Enterprise IoT with Cisco Smart Building ArchitectureLearn how the integration of IoT Gateways on Cisco Catalyst Switches and Wi Fi Access Points with Cisco DNA Spaces creates a foundation for creating and managing smart buildings |
2021-05-04 13:21:47 |
海外科学 |
NYT > Science |
Life and Death on Stromboli Volcano, Lighthouse of the Mediterranean |
https://www.nytimes.com/2021/05/04/science/stromboli-volcano-photos.html
|
Life and Death on Stromboli Volcano Lighthouse of the MediterraneanStromboli s volcano is always active always at the brink of devastating paroxysms For those who visit the island as tourists or scientists it is a spectacle like no other |
2021-05-04 13:35:45 |
海外科学 |
NYT > Science |
Helen Murray Free Dies at 98; Chemist Developed Diabetes Test |
https://www.nytimes.com/2021/05/03/science/helen-murray-free-dead.html
|
Helen Murray Free Dies at Chemist Developed Diabetes TestShe and her husband invented a dip and read paper strip that greatly simplified the diagnosis of the disease and paved the way for home test kits |
2021-05-04 13:25:51 |
海外ニュース |
Japan Times latest articles |
Europe recalibrates on China as Merkel’s term nears end and trans-Atlantic tensions ease |
https://www.japantimes.co.jp/news/2021/05/04/asia-pacific/china-europe-tension-biden/
|
Europe recalibrates on China as Merkel s term nears end and trans Atlantic tensions easeA major investment deal reached in December between the EU and Beijing may end up being the high water mark for ties |
2021-05-04 23:16:05 |
海外ニュース |
Japan Times latest articles |
Australia’s probe of Chinese firm’s port in Darwin signals trouble for Beijing |
https://www.japantimes.co.jp/news/2021/05/04/asia-pacific/australia-port-china-trouble/
|
Australia s probe of Chinese firm s port in Darwin signals trouble for BeijingThe investigation risks further hurting China Australia ties which have plummeted since Prime Minister Scott Morrison called for an independent investigation into the origin of COVID |
2021-05-04 22:15:03 |
海外ニュース |
Japan Times latest articles |
Swimmer calls for expulsion of junta-led Myanmar from Olympics |
https://www.japantimes.co.jp/sports/2021/05/04/olympics/summer-olympics/myanmar-swimmer-olympic-boycott/
|
Swimmer calls for expulsion of junta led Myanmar from OlympicsWin Htet Oo who posted an Olympic eligible meter freestyle time at the SEA Games is boycotting the Tokyo Olympics in protest of the military |
2021-05-04 23:50:32 |
海外ニュース |
Japan Times latest articles |
Rui Hachimura scores 27 in 100th NBA game as Wizards outgun Pacers |
https://www.japantimes.co.jp/sports/2021/05/04/basketball/nba/wizards-hachimura-100th-game/
|
Rui Hachimura scores in th NBA game as Wizards outgun PacersThe win moved Washington closer to ninth place Indiana in the Eastern Conference standings led by Russell Westbrook s nd triple double of the season |
2021-05-04 22:52:00 |
海外ニュース |
Japan Times latest articles |
NFL looks to score touchdown with Olympic flag football |
https://www.japantimes.co.jp/sports/2021/05/04/more-sports/football/flag-football-nfl-olympics/
|
angeles |
2021-05-04 22:18:29 |
ニュース |
BBC News - Home |
Joe McCann: Trial of two soldiers collapses |
https://www.bbc.co.uk/news/uk-northern-ireland-56942056
|
belfast |
2021-05-04 13:44:58 |
ニュース |
BBC News - Home |
Seven hurt in Willesborough house explosion |
https://www.bbc.co.uk/news/uk-england-kent-56978578
|
explosionthe |
2021-05-04 13:16:09 |
ニュース |
BBC News - Home |
Covid-19: Care home residents can go on outdoor trips without isolating |
https://www.bbc.co.uk/news/uk-56977779
|
trips |
2021-05-04 13:39:55 |
ニュース |
BBC News - Home |
Jose Mourinho named Roma boss from start of next season |
https://www.bbc.co.uk/sport/football/56983649
|
mourinho |
2021-05-04 13:44:33 |
ニュース |
BBC News - Home |
Covid: When and how could social distancing stop? |
https://www.bbc.co.uk/news/uk-51506729
|
england |
2021-05-04 13:41:10 |
LifeHuck |
ライフハッカー[日本版] |
MacBookのマイクを調整して、Web会議で活用する方法 |
https://www.lifehacker.jp/2021/05/how-to-use-microphone-mac.html
|
MacBookのマイクを調整して、Web会議で活用する方法ここ年でWeb会議もぐっと増えましたよね。 |
2021-05-04 22:05:00 |
コメント
コメントを投稿