投稿時間:2023-06-10 19:08:12 RSSフィード2023-06-10 19:00 分まとめ(15件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
AWS AWS Japan Blog AWS AppSync Merged API の紹介 https://aws.amazon.com/jp/blogs/news/introducing-merged-apis-on-aws-appsync/ MergedAPIにより、チームは複数のSourceAppSyncAPIから型、データソース、関数、リゾルバなどのリソースを単一の統一されたAppSyncエンドポイントにマージすることができます。 2023-06-10 09:43:33
js JavaScriptタグが付けられた新着投稿 - Qiita Vis Networkを使って「コラッツの問題」を視覚化してみた https://qiita.com/ishi720/items/e4272a8df95baafc6d14 visnetwork 2023-06-10 18:32:06
js JavaScriptタグが付けられた新着投稿 - Qiita Laravel、ajaxを用いて、非同期のメール送信APIを作成し、問い合わせ内容をgmailで送信する。 https://qiita.com/xionfortune/items/220ed5076775717955cc gmail 2023-06-10 18:19:51
Docker dockerタグが付けられた新着投稿 - Qiita docker on WSL2 で postgres お遊び環境構築 https://qiita.com/hatsumi3/items/1928425a3cc47370f5bc wsldo 2023-06-10 18:49:09
golang Goタグが付けられた新着投稿 - Qiita A Tour of Go:Exercise: Loops and Functionsの平方根計算の実装メモ https://qiita.com/mitsuaki1229/items/5c608feb27d113a5d10e exerciseloopsandfunction 2023-06-10 18:58:38
golang Goタグが付けられた新着投稿 - Qiita gin.Contextをcontext.Contextとして利用するときはgin.EngineのContextWithFallbackをtrueにする https://qiita.com/hum_op/items/901093b8bc3078b8077b defaultrcontextwithfallba 2023-06-10 18:42:33
Ruby Railsタグが付けられた新着投稿 - Qiita BEMとは https://qiita.com/sa109/items/9775b5cae77eeb5bd738 block 2023-06-10 18:40:22
Ruby Railsタグが付けられた新着投稿 - Qiita 登録フォーム上でアップロードされた画像のプレビューを表示する(Rails) https://qiita.com/AttAtD/items/c2077d3bd3d0f1be3268 imageprocecce 2023-06-10 18:37:53
海外TECH MakeUseOf What Is Adobe Express Beta, and What Can You Do With It? https://www.makeuseof.com/what-is-adobe-express-beta/ adobe 2023-06-10 09:12:29
海外TECH DEV Community Query Real-time Data With GraphQL And Streaming Database https://dev.to/bobur/query-real-time-data-with-graphql-and-streaming-database-2efl Query Real time Data With GraphQL And Streaming DatabaseIn modern application development efficiently querying and retrieving real time data is crucial to building robust and performant systems Using materialized views we can improve query performance When it is combined with GraphQL and a steaming database developers can define their queries to leverage these materialized views for the data that constantly changes allowing them to build highly responsive and interactive applications For example social media platforms like Twitter produce a massive volume of data every second This data is valuable for analyzing trends and user behavior In this article we will explore how integrating GraphQL materialized views and streaming databases such RisingWave can enable us to efficiently query tweets and discover the hottest hashtags in real time Before diving into implementation it is important to understand these concepts GraphQL materialized view and streaming database I believe you are smart enough to use Google or ChatGPT to find out this information However I am going to explain shortly why this integration can be beneficial and the role of each in the next section Materialized views as precomputed cachesWith a materialized view we can precompute and store the results of frequently executed SQL queries It is a denormalized representation of the data which means that complex joins and aggregations are already performed and stored in a database like PostgreSQL This simplifies the query logic required to retrieve data and eliminates the need for us to manually handle join operations In Twitter s case materialized views can be used to compute summaries of user activity such as the number of followers a hashtag used likes or comments GraphQL to retrieve exactly what data we needGraphQL allows us to specify exactly what data we need and receive it in a single request without using an additional programming language specific data processing framework or defining a bunch of entity objects and endpoints in the case of REST Representational State Transfer Unlike REST GraphQL significantly reduces the number of round trips resulting in faster data fetching With GraphQL we can directly access the materialized views in the database through the defined schema abstracting away the complexities of the underlying database structure A social media analytics platform can leverage GraphQL to offer a flexible API for querying and analyzing user generated content There are several popular GraphQL builders and frameworks available that can assist in building GraphQL APIs You can connect to different data sources and integrate with popular databases like PostgreSQL and MySQL Here are some of the widely used ones Apollo ServerGraphQL YogaHasuraNexusCubeStepzenStepZen is a platform to build and deploy GraphQL APIs that integrates and aggregate data from various sources In the demo section I will show how to build a GraphQL API in declarative code using StepZen Streaming database to process real time dataTo leverage the full potential of real time data querying with GraphQL a streaming database can be utilized Materialized views may not always contain the most up to date data since they depend on when and how often the view is refreshed Traditional databases such as PostgreSQL support materialized views but to see the query over time you need to rerun the same query and again To get updated results you need to execute queries repeatedly While a streaming database like RisingWave does almost all of its work at write time This post explains how a streaming database differs from a traditional database When data flows into the streaming database it s processed and immediately used to update the existing materialized views It can ingest data from various data sources like Kafka or Pulsar By combining GraphQL with a streaming database we can continuously ingest incoming Tweet posts and update the materialized views in real time and query changes in data instantly RisingWave is wire compatible with PostgreSQL you can use the existing StepZen support for a Postgres database as a data source for your GraphQL API You can query Source Table and Materialized View from RisingWave Query Twitter events demoOnce we understand the importance of GraphQL materialized views and a streaming database we can use this combination to create a new way to access tweet data By pre calculating summaries of the data and exposing them through a GraphQL endpoint we can quickly get valuable insights from the tweets Before you beginIn the tutorial we will leverage the existing use case demo of RisingWave on the website called fast Twitter events processing Make sure you completed the tutorial by cloning launching the demo project there using Docker connecting RisingWave to Kafka data streams and defining a materialized view as the tutorial guides you Other prerequisites to install are ngrok accountngrok installed Mac Windows When you are readyNow I assume that you configured RisingWave and we have a materialized view named hot hashtags processed by the RisingWave that tracks how often each hashtag is used daily on Twitter In the next steps we install and set up StepZen design the GraphQL schema map GraphQL queries to the actual data in the materialized view and finally expose the GraphQL Endpoint Step Install StepZen CLINote that you can also follow the instructions on StepZen website to install and run it The StepZen command line interface CLI provides commands to set up and manage StepZen Run the following command to install the StepZen CLI npm install g stepzen Step Run StepZen in DockerNext we run StepZen service on your local machine using the StepZen CLI we installed in the previous step stepzen service startTo use the StepZen CLI for local development you must log in by pointing the CLI to the local configuration Simply run the following command after StepZen service started stepzen login config stepzen stepzen config local yaml Step Clone the graphql stepzen risingwave demo projectFind my repository called graphql stepzen risingwave demo on GitHub Git clone this repository onto your machine This project already has everything you need There is written schema code in a postgresql graphql  GraphQL Schema Definition Language SDL file with types and queries defined for the materialized view hot hashtags in the RisingWave database It has also a stepzen config json file with our GraphQL endpoint git clone cd graphql stepzen risingwave demo Step Create a ngrok account and install ngrok Optional Note that it is just an additional step if you are running StepZen and RisingWave in your local environment In the case of cloud or running instances in your server that are accessible via the internet you can set a direct address of RisingWave in the StepZen database configuration If you are running both StepZen and RisingWave within Docker containers you can specify the address of host docker internal Ngrok is a tool that creates a secure tunnel between a public internet address and a local server running on your machine Create an account for ngrok and make sure that you can access it by setting authtoken To make the Risingwave database available to other services outside your private network you need to create a TCP tunnel For this ngrok will be used on the port where RisingWave is running ngrok tcp After you run the command Ngrok will return the forwarding address for the local RisingWave database which will look something like this   tcp eu ngrok io You need to add this to the file  config yaml in the demo project where you need to replace  ngrok tunnel  with your address  tcp ngrok io configurationset configuration name postgresql config uri postgresql root tcp eu ngrok io dev Step Run GraphQL EndpointBy running the command stepzen start you can deploy the GraphQL schema we have in postgresql graphql file to StepZen This instantly creates a GraphQL API in the localhost accessible through the configured endpoint api twitter in stepzen config json file If you navigate to http localhost api twitter you will the StepZen dashboard explorer on your browser Step Query the materialized viewStepZen explorer shows available queries with their attributes When you run the following query getHotHashtags it will pull data from the RisingWave materialized view and shows returned data in the explorer query MyQuery getHotHashtags hashtag hashtag occurrences window start See the output If you open the postgresql graphql file you will see how I used the GraphQL directive  dbquery to connect the database and write an SQL query to select the TOP popular hashtags type Query getHotHashtags hot hashtags dbquery type postgresql query SELECT FROM hot hashtags ORDER BY hashtag occurrences DESC LIMIT configuration postgresql config Next stepsSo far we have built and deployed a GraphQL API api twitter with the database backend Next you can observe how to consume real time data from other sources than Kafka with RisingWave combine multiple streams of data create materialized views on joined streams and create a sequence of queries with StepZen ConclusionWith StepZen GraphQL API we simplified data access without introducing a backend service to do this work and we combined it with the real time updates provided by RisingWave In summary querying real time data with GraphQL and the streaming database opens up new possibilities for creating highly responsive and interactive applications Related resourcesQuery Real Time Data in Kafka Using SQL How Streaming database differs from a Traditional database Querying Microservices in Real Time with Materialized Views Recommended contentIs RisingWave the Right Streaming Database Community Join the Risingwave Community About the authorVisit my personal blog  www iambobur comFollow me on Twitter  BoburUmurzokov 2023-06-10 09:11:37
海外TECH DEV Community How to Create a Custom useFetch Hook in React https://dev.to/adetutu/how-to-create-a-custom-usefetch-hook-in-react-4p7 How to Create a Custom useFetch Hook in React OUTLINEIntroductionCreating a custom useFetch hook in ReactHow to use the useFetch Hook in a React componentConclusion IntroductionCustom hooks are reusable functions that contain logic and can be used in functional components A useFetch hook is a reusable function in React that abstracts the process of fetching data from an API provides an efficient way to manage HTTP requests and handles the loading and error states In this article we ll walk through the process of creating a custom useFetch hook in React Let s dive in Creating a custom useFetch hook in ReactAfter setting up your react project go to the src directory and create a folder called hooks In this folder create a new file called useFetch js which will contain the useFetch logic Here is the code below import useState useEffect from react const useFetch url gt const data setData useState null const isLoading setIsLoading useState true const error setError useState null useEffect gt fetch url then response gt if response ok error coming back from server throw Error could not fetch the data for that resource return response json then data gt setIsLoading false setData data setError null catch err gt setIsLoading false setError err message url return data isLoading error export default useFetch Code explanationFirstly import the necessary dependencies inside the useFetch jsfile We import the useState and useEffect hooks from the react library We declare the useFetch custom hook which takes a url parameter which represents the API endpoint we want to fetch data from We declare three state variables using the useState hook imported from the react library The data state variable is the fetched data and is set to null The isLoading state variable indicates whether the data is currently being fetched and is set to true The error state variable represents errors that could occur during the data fetching process and it is initially set to null Next we declare the useEffect hook which will be triggered whenever the url dependency changes We define a fetch function inside the useEffect callback and this function sends a GET request to the specified url The then callback function is used to handle the response from the server We use response ok to check for errors from the API and If an error is detected an error message is thrown using the throw statement And if there are no errors the response is converted to JSON format using response json We store the resulting data in the setData state variable isLoading is set to false and the error state variable is also set to null Next we define a catch callback function to handle any errors that occurred during the fetch request The isLoading state variable to false indicating that the data loading has been completed and the error message is stored in the setError state variable Finally the useFetch custom hook returns an object containing the data isLoading and error state variables for components to access these values Then we export the useFetch custom hook as the default export of the module so it can be imported into other files How to use the useFetch Hook in a React componentTo utilize the useFetch Hook create the functional component and import the hook into your React component Code sampleimport useFetch from hooks useFetch const BlogPosts gt const data blogs isLoading error useFetch http localhost blogposts return lt div gt isLoading amp amp lt div gt Loading blog posts lt div gt error amp amp lt div gt error lt div gt Render the fetched data blogs amp amp blogs map blog gt lt p key blog id gt blog name lt p gt lt div gt export default BlogPosts In the above component we re using the useFetch hook to fetch data from the http localhost blogposts endpoint The data isLoading and error state variables returned by the hook are then used to conditionally render the content If isLoading is true then a loading message will be displayed and If an error occurs an error message will be displayed otherwise the fetched data will be rendered in the component Lastly import the functional component lt BlogPosts gt inside the App component in the React project directory ConclusionWe have successfully created a useFetch Hook in React and utilize it in a functional component A custom useFetch hook contains a data fetching logic which can be used across different components in a React project allowing us to write a clean and maintainable code 2023-06-10 09:01:19
海外科学 NYT > Science Arizona, Low on Water, Weighs Taking It From the Sea. In Mexico. https://www.nytimes.com/2023/06/10/climate/arizona-desalination-water-climate.html Arizona Low on Water Weighs Taking It From the Sea In Mexico A billion plan to desalinate seawater in Mexico and pipe it to Phoenix is testing the notion that desert cities can keep growing as the Earth warm 2023-06-10 09:01:07
海外科学 NYT > Science Hospice Is a Profitable Business, but Nonprofits Mostly Do a Better Job https://www.nytimes.com/2023/06/10/health/hospice-profits.html complaints 2023-06-10 09:00:36
ニュース BBC News - Home Watch: How Colombia children jungle rescue unfolded https://www.bbc.co.uk/news/world-latin-america-65865902?at_medium=RSS&at_campaign=KARANGA amazon 2023-06-10 09:37:24
ビジネス 東洋経済オンライン 「少子化が深刻な韓国が日本より経済成長」のナゼ 岸田政権下でも年3%の経済成長は十分可能だ | インフレが日本を救う | 東洋経済オンライン https://toyokeizai.net/articles/-/678636?utm_source=rss&utm_medium=http&utm_campaign=link_back topix 2023-06-10 18:30:00

コメント

このブログの人気の投稿

投稿時間:2021-06-17 05:05:34 RSSフィード2021-06-17 05:00 分まとめ(1274件)

投稿時間:2021-06-20 02:06:12 RSSフィード2021-06-20 02:00 分まとめ(3871件)

投稿時間:2020-12-01 09:41:49 RSSフィード2020-12-01 09:00 分まとめ(69件)