並び順

ブックマーク数

期間指定

  • から
  • まで

161 - 200 件 / 773件

新着順 人気順

asyncの検索結果161 - 200 件 / 773件

  • Kivyとtkinterでasync/await - Qiita

    2018年は私にとって衝撃でした。よくGUI FrameworkのKivyを使って遊んでいたのですがgeneratorを用いる事でcallback関数だらけの醜いcodeを驚くほど読みやすくできると知ったからです。そして色々と試している内にそれまで私にとって得体の知れない魔法であったasync/awaitによる非同期処理が理解できるようになり、ちょっとした非同期処理libraryを作れるようにもなりました。この記事では今更ですが generatorとそこから生まれたnative coroutineの素晴らしさに私が気付くまでの過程と それを用いてKivyとtkinterでasync/awaitを実現する過程を 書き綴りたいと思います。(文章量を減らすため、以後はgeneratorはgenと、coroutineはcoroと略す。) genの秘めたる力 値を生み出す物としてのgen 多くの入門

      Kivyとtkinterでasync/await - Qiita
    • In-depth Guide to ActiveRecord load_async in Rails 7

      The In-depth Guide to ActiveRecord load_async in Rails 7 Updated Mar 1, 2022 17 minute read Rails 7 introduces ActiveRecord load_async method that runs SQL queries asynchronously in the background thread. This seemingly simple change of just adding a single new method that takes no arguments has profound implications for database layer interactions. In this tutorial, we’ll deep dive into the intri

        In-depth Guide to ActiveRecord load_async in Rails 7
      • async-profilerによるスタックトレースタイムトラベル - Kafkaのパフォーマンス問題調査での応用例

        async-profilerはJavaアプリケーションのパフォーマンス調査でよく用いられる低オーバーヘッドのサンプリングプロファイラーですが、 wallclockプロファイルをJFR形式で出力することで、任意のスレッドの任意時点のスタックトレース解析も可能です。 これは、flamegraph…

          async-profilerによるスタックトレースタイムトラベル - Kafkaのパフォーマンス問題調査での応用例
        • How Async Functions in Traits could Work in Rustc

          One of the major goals for the Rust Async Working Group is to allow async fn everywhere fn is allowed, especially in traits. In this post, I'd like to distill some of the proposed designs and show how async functions in traits could be implemented. We'll look at one possible way this could work, although I'd like to emphasize that this is not the only way, and many details of the design that we'll

          • [Javascript]コールバックヘルからの帰還。Promise/Async/Awaitを考えるよ。 - Qiita

            Deleted articles cannot be recovered. Draft of this article would be also deleted. Are you sure you want to delete this article?

              [Javascript]コールバックヘルからの帰還。Promise/Async/Awaitを考えるよ。 - Qiita
            • [JavaScript] forEachでasync/awaitは使える

              JavaScript の forEach で async/await は使える JavaScrript の forEach で async/await が使えないという誤解が一部あるようですが、全く問題なく使えます。そういう誤解が何故発生してしまうかと言えば、非同期を同期させるための管理を行っていないからです。プログラムは思った通りではなく書いたとおりに動きます。同期させるようにプログラムを書かなければ、その通りの結果が返ってきます。使えないのではなく使っていないのが原因です。 forEach で非同期を同期させるプログラムを作る 配列の内容を 1 秒ごとに一つ表示させるプログラムを forEach で作ってみます。 こちらに実行環境を用意しました プログラム内容 // 疑似セマフォによるスケジューラ const semaphore = ( limit = 1, count = 0, rs

                [JavaScript] forEachでasync/awaitは使える
              • Vue 3 UX Wins with Async Components & Suspense

                Lazy loading components is a easy way to improve the user experience of your app especially if your code bundle is big or if users are on slow connections. Vue 3 has introduced several new features to help you achieve this easily and with great UX through the improvements to the async component API and the new Suspense component. Why lazy load components?Some parts of your UI don't need to be load

                  Vue 3 UX Wins with Async Components & Suspense
                • 非同期処理の裏側を覗き見 ~Rustのasync/awaitの場合~

                  イントロダクション 非同期処理は、タスクの完了を待つことなく多くのタスクをプログラム上で実行することができる強力なツールです。例えば、Webサーバーのリクエスト処理やファイルの読み書きなど、I/Oバウンドタスクの効率的な処理に非常に有用です。 この記事では、Rust公式のAsynchronous Programming in Rustの第1章と第2章を参考にし、並行プログラミングモデルや非同期処理の実装例、非同期ランタイムの内部構造までまとめました。 並行プログラミングモデルの比較 並行プログラミングにはさまざまなモデルがあり、それぞれに特有の利点と欠点があります。Asynchronous Programming in Rust 第1章の内容に基づき、OSスレッド、イベント駆動、コルーチン、アクターモデルの各モデルについて例を交えながら説明します。 OSスレッド OSスレッドは、オペレーテ

                    非同期処理の裏側を覗き見 ~Rustのasync/awaitの場合~
                  • TypeScriptで学ぶ!asyncとawait、Promiseの分かりやすい解説 | TekRog

                    モダンなJavaScriptの開発ではPromiseやasync、awaitの活用が書かせません。今回はこれらの意味について極限まで簡単にして説明します。3〜5分もあれば理解できる内容です。この内容を理解すれば、今後出くわすであろう、応用的なコードについても理解できるはずです。

                      TypeScriptで学ぶ!asyncとawait、Promiseの分かりやすい解説 | TekRog
                    • Introduction - The Node Experiment - Exploring Async Basics with Rust

                      Introduction Don't block the event loop! Don't poll in a busy loop! Increase throughput! Use async I/O! Concurrency is not parallelism! You've most likely heard and read claims like these many times before, and maybe, at some point you've thought you understood everything only to find yourself confused a moment later. Especially when you want to understand how it works on a fundamental level. Me t

                      • 【2024最新版】traitにasync fnを含める方法

                        公約[1]通り、2023年内で async fn in trait が stable Rust (1.75.0) にやってきました。 (本当にめでたい。本当にありがとうございます。) この記事では async fn in trait は何が嬉しいのかを書きます。 ついでにモックについての話もします。 これまでの async trait これまで trait 内で async fn を定義すると、以下のように async-trait crate を使う必要がありました。 言語側に async fn を trait 内に書く仕組みがないので、Box<dyn Future>を返すような関数に変換されていました。 これからの async trait これからは async fn を trait 内で定義できるようになりました。 async trait は、おそらく正式名称ではなく、"async f

                          【2024最新版】traitにasync fnを含める方法
                        • n8s.site | Async Rust Isn't Bad: You Are

                          There have been quite a few articles in the past year or so about the downsides of using Rust and introducing the async keyword into your code base: Why asynchronous Rust doesn't work Mixing Sync and Async Rust Async Rust Is A Bad Language Avoid Async Rust at All Cost ...too lazy to continue searching, but you get the idea It generally boils down to two things: async is invasive. The path of least

                            n8s.site | Async Rust Isn't Bad: You Are
                          • GitHub - zio/zio: ZIO — A type-safe, composable library for async and concurrent programming in Scala

                            You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert

                              GitHub - zio/zio: ZIO — A type-safe, composable library for async and concurrent programming in Scala
                            • Express 4 はミドルウェア内で async が書けるが、ラッパー関数はあった方が良い - Neo's World

                              Express 4 はミドルウェア内で async が書けるが、ラッパー関数はあった方が良い Express 4 系だと、次のように async が書けるようだ。 // async を使用 app.use('/', async (req, res) => { // await を使用 const result = await something( req.body.id ); res.send(result); }); ただし上のコードだと、await 部分でエラーが発生した時に next() が実行されないので、エラーハンドリングミドルウェアに処理が移らない。 キャッチされないエラーが発生するといつまでもレスポンスされず、おかしな動きになる。 次のように書けば、エラー時にエラーハンドリングミドルウェアに処理を流せる。 app.use('/', async (req, res) => {

                                Express 4 はミドルウェア内で async が書けるが、ラッパー関数はあった方が良い - Neo's World
                              • 良いbotを作るためのasync/awaitとイベントループの基本(前編) - Qiita

                                こんにちは。暗号通貨のボッターとして活動している黒枝と申します。 Advent Calendarの7日目と8日目の枠をお借りしています。 この記事ではPythonやNodejsで利用することのできるasync/awaitを用いた非同期処理について、その背景や実際のところ何を実現したいのかについて考えてみたいと思います。 この記事の目標は次のような状態を、根っこの部分を知ることで抜け出すことです。 「あれ、なんでこれ動かないんだろう…あ、await取ったら動いた。よくわからないけどまあいいか」 シングルスレッドで扱う非同期処理は安定したウェブアプリケーションを書くために非常に有効ですが、理解が浅いとアプリケーションの動きを阻害してしまいます。 本稿では、この機能をイベントループという仕組みに触れながら、前編と、後編の二回に分けて解説を試みています。 コンセプトの掘り下げを本題のため、どのよう

                                  良いbotを作るためのasync/awaitとイベントループの基本(前編) - Qiita
                                • 【JavaScript】async/awaitとaxios、非同期通信について - Qiita

                                  axiosとは HTTP通信(データの更新・取得)など、HTTPリクエストのやり取りを簡単に行うことができる、JavaScriptのライブラリです。Node.jsで記述されています。APIを提供するクラウドサービスに対して、データを送受信することができます。 非同期にHTTPメソッド(GET・POST・PUT・DELETE通信など)を取り扱えます。 非同期処理とは 時間の掛かる処理の結果を待たずにすぐ次の処理を実行できる仕組みです。Promiseを使うと簡単に実現できます。 Promiseとは、非同期処理の状態を監視するためのオブジェクトで、非同期処理を同期処理のように扱える書き方です。 使う場面 JSONデータを提供しているAPIと接続して、データを取得することが多いです。 Webの場合、サーバーの中で外部にデータを提供している機能(またはそnページ)のことをAPIとよびます。 asyn

                                    【JavaScript】async/awaitとaxios、非同期通信について - Qiita
                                  • 君だけのオリジナル async / await を作ろう - susisu / TSKaigi2025

                                    TSKaigi 2025について 2024年に産声をあげ、大盛況のうちに幕を閉じた TSKaigi を今年も開催します! 私たちは、誰かの発表を聞くだけでなく、他の誰かに向けて発表することもまた学びの一つだと考えています。 参加者、登壇者、スタッフ、スポンサーをはじめ、TSKaigi に関わるすべての人たちが互いに学び合い、新たな繋がりを生み出し、型にとらわれないエンジニアとして生き生きと活躍できる世界を目指します。 その実現に向け、今年は会場を中野から神田へ移し、2日間開催とすることで、大幅にパワーアップしました。 TypeScript に関するあらゆるテーマを扱う国内最大級のカンファレンスとして、まさに「型破り」なイベントを目指し成長を続ける TSKaigi にご期待ください。 公式サイト - https://2025.tskaigi.org/ 一般社団法人TSKaigi As

                                      君だけのオリジナル async / await を作ろう - susisu / TSKaigi2025
                                    • jsの「非同期」という言葉に違和感を感じます。async/await文は1 → 2 → 3と順序通り処理されることを可能にするので語感的には「同期」処理のように感じますが、なぜ非同期なのでしょうか? - Quora

                                      • JavaScriptのasync/awaitはPromiseの糖衣構文か

                                        Q. JavaScriptのasync/awaitはPromiseの糖衣構文か? A. 糖衣構文ではありません。 Q. なぜ? A. async function構文で作られた関数オブジェクトに対してFunction.prototype.toStringメソッドを呼び出すと、async functionで始まる文字列が得られます。これはPromiseだけでは不可能で、async function構文を用いないと不可能です。 async function foo() {} // "async function foo() {}" console.log(Function.prototype.toString.call(foo));

                                          JavaScriptのasync/awaitはPromiseの糖衣構文か
                                        • fetch呼び出しでasync/awaitを使わないパターン、使うパターン - Qiita

                                          // Promiseのまま扱う際のfetchの使い方 function fetchNormal(){ // 気象庁の今日の東京の天気API(JSON) const url = 'https://www.jma.go.jp/bosai/forecast/data/overview_forecast/130000.json'; const promise = fetch(url); promise .then(response => response.json()) .then(jsondata => { showResult("result: " + JSON.stringify(jsondata)); }); } ポイント fetchの戻り値はPromiseです。 Promiseは、fetch呼び出しの直後に(urlへの非同期通信が完了する前に)戻されます。 その戻り値のPromiseに対

                                            fetch呼び出しでasync/awaitを使わないパターン、使うパターン - Qiita
                                          • Swift 5.5からのSwift Concurrencyのasync/awaitの使い方

                                            非同期処理、並行処理を不具合なく実装することはとても難しいです。 クロージャーはどんどんネストされ読みにくくなり、複数のスレッドが同じデータを書き込めばデータ競合が起こります。 Swift 5.5からはSwiftの言語機能としてConcurrencyが登場しました。 これは非同期処理、並行処理のコードを簡潔かつ安全に記述できる機能です。 async/awaitを使えば、同期処理と同じような書き方で非同期処理を記述できます。 またactor型を使えばデータ競合を防ぐことができます。 actor型に関してはSwift 5.5から登場したActorについてをご覧ください。 この記事ではSwift 5.5からのSwift Concurrencyの機能の一つasync/awaitの使い方を解説します。 サンプルコード https://github.com/SatoTakeshiX/first-ste

                                              Swift 5.5からのSwift Concurrencyのasync/awaitの使い方
                                            • BPF and async Rust

                                              With libbpf-rs, bindings to libbpf (canonical C BPF library), building BPF applications in Rust is easy. However, libbpf-rs doesn't work with async/await. Say, to send information from kernel with BPF over protocols like gRPC, you have to implement lots instead of using the existing async libraries. To address the above problem, I implemented libbpf-async, complementary to libbpf-rs, providing API

                                                BPF and async Rust
                                              • GitHub - Iceber/iouring-go: Provides easy-to-use async IO interface with io_uring

                                                You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert

                                                  GitHub - Iceber/iouring-go: Provides easy-to-use async IO interface with io_uring
                                                • Explaining the internals of async-task from the ground up

                                                  async-task is one of the most complicated crates in the smol ecosystem. But, fundamentally, it’s just a future on the heap. I pride myself on smol packages being very easy to parse for anyone with a beginner’s level of experience in Rust. By that I mean, if you want to know how smol works, it should be very easy to pick up the source code, read through it, and understand how each individual part w

                                                    Explaining the internals of async-task from the ground up
                                                  • JavaScriptの非同期処理はasync/awaitとpromiseで制御しよう|Playground発!アプリ開発会社の技術ブログ

                                                    「APIでデータを取得したのに受け取れていない?」 「どうやら非同期処理というものが原因らしい」 「非同期処理を待ってから次の処理を実行したい!」 JavaScriptでプログラムを書いていると必ず対応しなければいけない問題が「非同期処理」です。 この記事では、非同期処理を伴う関数を正しく扱うための方法を、例となるコード付きで解説していきます。 JavaScriptにおける非同期処理と同期処理JavaScriptで関数やメソッドを実行した場合、以下の2パターンに分かれます。 同期的に処理される非同期的に処理されるJavaScriptにおける同期処理とは同期処理を一言で要約すると「実行完了を待つ処理」です。 例えば以下のような関数は同期処理となります。 // 同期処理をおこなう関数を宣言 const synchronousFunc = (value) => { console.log("これ

                                                    • rust-magic-patterns/visual-journey-through-async-rust/Readme.md at master · alexpusch/rust-magic-patterns

                                                      You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert

                                                        rust-magic-patterns/visual-journey-through-async-rust/Readme.md at master · alexpusch/rust-magic-patterns
                                                      • JavaScript のasync/awaitで再帰呼び出しのような長時間かかる処理の途中経過を表示する方法 - Qiita

                                                        1.はじめに javascriptに限らず長い処理をフロントエンドで実行すると画面がフリーズします。長い処理をしながら画面フリーズを回避するいろいろな仕組みがあります。本記事では、javaacriptでPromise,await,asyncを使って、長い処理(例として巡回セールスマン問題を再帰呼び出しで全経路計算)の、処理途中経過をプログレスバーで表示して、ボタンにより処理中の計算を中断するにはどのようにプログラミングすればよいのかを調べてゆきます。 以下の例は都市数を入力すると、総当たりで最短経路を求める計算をフロントエンドだけで実行し、途中経過と最終結果(10都市で10!=約360万経路のパスコスト計算)を表示するコード例です。リンクコストは接続される都市番号の相乗平均としています。どうやって、途中経過を画面に表示させているのかが本記事の主題です。 See the Pen Factor

                                                          JavaScript のasync/awaitで再帰呼び出しのような長時間かかる処理の途中経過を表示する方法 - Qiita
                                                        • </> htmx ~ Examples ~ Async Authentication

                                                          This example shows how to implement an an async auth token flow for htmx. The technique we will use here will take advantage of the fact that you can delay requests using the htmx:confirm event. We first have a button that should not issue a request until an auth token has been retrieved: <button hx-post="/example" hx-target="next output"> An htmx-Powered button </button> <output> -- </output> Nex

                                                          • Exploring Node.js Async Hooks | AppSignal Blog

                                                            Have you ever heard of Node.js async hooks module? If the answer is no, then you should get familiar with it. Even though it’s new stuff (released along with Node.js 9) and the module is still in experimental mode, which means it’s not recommended for production, you should still get to know it a bit better. In short, Node.js async hooks, more specifically the async_hooks module, provides a clear

                                                              Exploring Node.js Async Hooks | AppSignal Blog
                                                            • Python behind the scenes #12: how async/await works in Python

                                                              Mark functions as async. Call them with await. All of a sudden, your program becomes asynchronous – it can do useful things while it waits for other things, such as I/O operations, to complete. Code written in the async/await style looks like regular synchronous code but works very differently. To understand how it works, one should be familiar with many non-trivial concepts including concurrency,

                                                              • Async Views in Django

                                                                Writing asynchronous code gives you the ability to speed up your application with little effort. Django versions >= 3.1 support async views, middleware, and tests. If you haven't already experimented with async views, now's a great time to get them under your belt. This tutorial looks at how to get started with Django's asynchronous views. If you're interested in learning more about the power behi

                                                                  Async Views in Django
                                                                • The ultimate async setup: FastAPI, SQLModel, Alembic, Pytest

                                                                  FastAPI is a popular topic nowadays and I have decided to share my setup for an async web-server using this framework. Here is a short description of python packages used in the article (just to make a whole picture to save your time): Poetry (https://python-poetry.org) — is a tool for dependency management and packaging in Python. It allows you to declare the libraries your project depends on and

                                                                    The ultimate async setup: FastAPI, SQLModel, Alembic, Pytest
                                                                  • Unlocking Performance: A Guide to Async Support in Django

                                                                    Performance optimization is a crucial aspect of building web applications, and developers are constantly seeking ways to make their applications faster and more responsive. In the world of Django, async support has emerged as a powerful tool for unlocking performance improvements. By embracing async programming, developers can take advantage of non-blocking operations, improved scalability, and en

                                                                      Unlocking Performance: A Guide to Async Support in Django
                                                                    • rust-blog/posts/restful-api-in-sync-and-async-rust.md at master · pretzelhammer/rust-blog

                                                                      Let's implement a RESTful API server in Rust for an imaginary Kanban-style project management app. A popular real-world example of such an app is Trello: On its surface Kanban is pretty simple: there's a board and cards. The board represents a project. The cards represent tasks. The position of the cards on the board represents the state and progress of the tasks. The simplest boards have 3 column

                                                                        rust-blog/posts/restful-api-in-sync-and-async-rust.md at master · pretzelhammer/rust-blog
                                                                      • 画像の遅延読み込みで表示高速化!loading=”lazy”とdecoding=”async” | ウェブスペ

                                                                        画像の遅延読み込みは、Webページのパフォーマンスを向上させるために重要なテクニックの一つです。 ほとんどのWebページには複数の画像が含まれており、一つ一つの画像は比較的大きいファイルサイズを占めています。それらを一度に読み込もうとするとページの読み込み時間が遅くなってしまうため、遅延読み込み(lazy load)というテクニックが使用されます。 「画像の遅延読み込み」は、Webサイトの表示速度を高速化する上で、最優先で取り組みたい改善の一つです。 Webサイト制作やフロントエンドで必須知識ともいえる内容なので、今まで特に意識せずにimgタグを使用していた方は、是非この記事を読んでください。 画像の遅延読み込みとは 通常、Webページが表示される時は、ページ内で使用されている画像を一度に全て読み込んでいます。 それを、ページ表示時には初期表示される領域内(ファーストビュー)の画像だけを読

                                                                          画像の遅延読み込みで表示高速化!loading=”lazy”とdecoding=”async” | ウェブスペ
                                                                        • 「async」と「await」をつけるだけ!強力なRustの非同期処理

                                                                          今月はRustの非同期処理をHTTPサーバーの開発を通して説明している。実際に手を動かすことで、Web開発の基本であるHTTPサーバーの仕組みと非同期処理の基礎を同時に学ぶことができる。 並行サーバーの実装 HTTPサーバーには、クライアントからリクエストが来た順番に処理する「反復サーバー」とイベントを切り替えながらリクエストを処理する「並行サーバー」がある。今回は、反復サーバーを基に並行サーバーを実装する。Rustでは思ったよりも手軽に非同期処理を実装できることを実感できるはずだ。 新規プロジェクトとソースコードを用意 並行サーバーを実装するために、新しいプロジェクトを用意する。 並行サーバーの実装では、非同期プログラミングを利用可能にする「tokio」というクレートを利用する。そのためには、Cargoの設定ファイルである「Cargo.toml」の[dependencies]というセクシ

                                                                            「async」と「await」をつけるだけ!強力なRustの非同期処理
                                                                          • 1時間半で克服するJavaScriptの非同期処理/async_javascript_kokufuku

                                                                            モバイルアプリで機械学習入門/introduction-to-machine-learning-in-mobile-app

                                                                              1時間半で克服するJavaScriptの非同期処理/async_javascript_kokufuku
                                                                            • scriptタグのasync/deferの使い分け

                                                                              HTMLファイルを1行目からパースして行くでー! <script src="main.js"></script>が出てきたから、HTMLファイルのパースは一時中断して、main.jsをダウンロードしてくるでー! ダウンロードしてきたmain.jsを実行するでー! HTMLファイルのパースを再開するでー! この方法だと、ページの主要コンテンツであるbodyタグの中身が描写される前に、javascriptファイルをダウンロード&実行される。 なので、ページが表示されるまでが遅くなる。ユーザーを待たせてしまう。 2.bodyタグの最後に書く 以下のように書く方法。 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge"

                                                                                scriptタグのasync/deferの使い分け
                                                                              • GitHub - danog/php-tokio: Use any async Rust library from PHP!

                                                                                You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert

                                                                                  GitHub - danog/php-tokio: Use any async Rust library from PHP!
                                                                                • Node.js v12でasync/awaitだけでファイルの読み書きをする - 動かざることバグの如し

                                                                                  結論 正式なLTSになってるわけじゃないけど、本番投入に問題ない仕上がりにはなってる Node.js v12 でfs/promisesがexperimentalでなくなった件 Node.js10からfs Promises APIが実装された。 が、実行すると、 ExperimentalWarning: The fs/promises API is experimental のようにExperimentalである旨が表示される。ファイルの読み書きはコールバックなしで読みやすく書きたいよね、とは思いつつ、実際重要な機能だしExperimentalだとちょっと本番適用厳しいなぁって感じだった。 しかし12(LTS予定)ではExperimentalが外されている。(詳しく言うとv11ですでにStableになった ってことで偶数バージョンである12で晴れてasync/awaitでfsが使える!!(念

                                                                                    Node.js v12でasync/awaitだけでファイルの読み書きをする - 動かざることバグの如し