Completable Futures - thenApply vs thenCompose

Let’s wrap a blocking operation in a CompletablFuture 1 2 3 4 5 6 7 public static Integer blockingCall(int x) { return x * 2; } public static CompletableFuture<Integer> asyncRunner(int x) { return CompletableFuture.supplyAsync(() -> blockingCall(x)); } Here we chain the outputs so that it prints the aggregated results. But this will print the future not the value (16) 1 2 3 4 5 public static void main(String[] args) { asyncRunner(4) ....

January 6, 2024 · 1 min · 190 words

Tf Idf Jupyter Notebook

Installing and running Jupyter notebook 1 2 3 pip install jupyter python jupyter notebook Install ML libraries 1 2 3 4 pip install -U scikit-learn pip install -U spaCy pip install -U pandas pip install gensim

March 24, 2023 · 1 min · 36 words

Sine wave generator using Golang

Let’s build a continuous sine wave generator with Go. This could be the first step into creating your ground breaking synthesizer, who knows :) But some theory first before we dive in. How digital audio works We know that sound waves are vibrations travelling through air. These vibrations cause air pressure changes from sound source (Generator in our case) to receiver (our ears) over time. It is important to note that air particles do not travel with vibrations to receiver....

March 22, 2023 · 5 min · 876 words · Thila

0 min · 0 words