frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Bahtiarbeck95 Gmail.com

https://blog.cloudflare.com/deploy-planetscale-postgres-with-workers/
1•korikorikori•16s ago•0 comments

What if the universe isn't expanding, but stabilizing?

https://archive.org/details/tenants-of-the-long-sunday
1•voxsignals•1m ago•0 comments

Thoughts on the Boiling Frogs 2026 conference

https://blog.allegro.tech/2026/04/thoughts-on-boiling-frogs-2026.html
1•karmazyn•1m ago•0 comments

The AI Productivity Scorecard Is Broken

https://engineeredinsight.substack.com/p/the-ai-productivity-scorecard-is
1•hacked_brain•1m ago•0 comments

Show HN: Iso.me – Open-source, on-device iOS location tracker

https://github.com/CodyBontecou/isome
1•codybontecou•2m ago•0 comments

Coding Stats

https://github.com/Chrisiisx/Coding-Stats
1•chrisiisx•2m ago•0 comments

Microsoft open-sources "the earliest DOS source code discovered to date"

https://arstechnica.com/gadgets/2026/04/microsoft-open-sources-the-earliest-dos-source-code-disco...
1•DamnInteresting•2m ago•0 comments

Octopus 'krakens' as large as semi-trucks stalked ancient seas

https://www.science.org/content/article/octopus-krakens-large-semi-trucks-stalked-ancient-seas
1•gmays•3m ago•0 comments

Exp-Minus-Log made practical for RPN calculators

https://tangentsoft.com/rpn/wiki?name=R47%3A+Programming+Project+-+EML
1•wyoung2•4m ago•1 comments

Top Best Business Books for Entrepreneurs to Read in 2026

https://1-pagedigitalmarketingplan.com/top-19-best-business-books-for-entrepreneurs-to-read-in-2026/
2•TechOnionKing•4m ago•0 comments

I scraped 1.94M Airbnb photos for opium dens, pet cameos, and messy kitchens

https://burla-cloud.github.io/examples/airbnb-burla-demo/
3•jmp1062•4m ago•0 comments

Restraining AI development for the sake of safety

https://joecarlsmith.com/2026/03/19/on-restraining-ai-development-for-the-sake-of-safety/
1•speckx•4m ago•0 comments

StupidStackLanguage

https://esolangs.org/wiki/StupidStackLanguage
1•optimalsolver•4m ago•0 comments

I over-engineered my simple AI backend: distillation, router, embedding etc.

https://sisyphusconsulting.org/case-studies/2026/04/01/scaling-llms-at-the-edge/
1•bhagyeshsp•5m ago•1 comments

Finding a RCE in my old TP-Link router

https://mrbruh.com/tplink/
2•MrBruh•5m ago•0 comments

Neo Factory – Building Your Neo

https://www.1x.tech/discover/neo-factory
1•denysvitali•5m ago•0 comments

Nothing Is Broken. So Why Does Everything Feel Off?

https://therealitydrift.substack.com/p/nothing-is-broken-so-why-does-everything-feel-wrong
1•realitydrift•9m ago•1 comments

Show HN: Agent-recall-AI – Auto-save for AI agents that die mid-task

https://github.com/srinathsankara/agent-recall-ai
1•SrinathSankara•10m ago•1 comments

OpenHabitat v0.1: open-source Health Automation Systems

https://www.openhabitat.build/habitat/intro/
1•michaelrm•11m ago•1 comments

Rich People Didn't Used to Look Like This

https://www.nytimes.com/2026/04/30/opinion/plastic-surgery-rich-face.html
5•prmph•12m ago•3 comments

AI, Tractors, and the Productivity Paradox

https://read.technically.dev/p/the-ai-productivity-paradox
3•dkrevitt7•13m ago•0 comments

Noisemaker, a shader art engine for the browser (WebGL2/WebGPU)

https://noisemaker.app/
4•aayars•13m ago•1 comments

Lina Lapelytė Fills Hamburger Bahnhof with 400k Blocks for Communal Building

https://www.thisiscolossal.com/2026/04/lina-lapelyte-we-make-years-out-of-hours/
1•cainxinth•13m ago•0 comments

PostgreSQL 19 features I'm excited about

https://www.bytebase.com/blog/postgres-19-features-im-excited-about/
3•tianzhou•16m ago•0 comments

Knee surgery for cartilage damage does not benefit patients, study suggests

https://www.theguardian.com/science/2026/apr/29/knee-surgery-cartilage-damage-patients-study
2•bookofjoe•16m ago•1 comments

Show HN: Golang binaries built for your users depending on their arch and system

https://goblin.run
1•aliezsid•17m ago•0 comments

French companies fund 100% of AI training in 2026 via OPCO subsidies

https://businessdigital.fr/articles/top-organismes-formation-ia-opco-2026
1•FranckPARIENTI•18m ago•2 comments

Early Impressions of Chrome from a Firefox User

https://www.abefehr.com/posts/early-impressions-of-chrome
1•speckx•18m ago•0 comments

March in Servo: keyboard navigation, better debugging, FreeBSD support, and more

https://servo.org/blog/2026/04/30/march-in-servo/
2•silotis•19m ago•0 comments

GitByBit: Practice Git in VSCode or Cursor

https://gitbybit.com/
1•dzhgenti•19m ago•0 comments
Open in hackernews

Understanding Java's Asynchronous Journey

https://amritpandey.io/understanding-javas-asynchronous-journey/
17•hardasspunk•11mo ago

Comments

Neywiny•11mo ago
I don't get it. The first example in JS vs Java looks very similar. Now all those other code blocks, they certainly have more going on but idk how that compares to JS. And to answer the questions:

A completable future is something that in the future may complete. I think that's self explanatory. A promise seems equally vague.

Boilerplate looks the same. JS is just a function, Java they put a class around it. Java requires exception handling which is annoying but having fought errors in async JS, I'll take all I can get.

API is eh. Sure. But that's not even shown in this example so I have no idea.

So JS saves like 3 lines? Is that really so much better?

cogman10•11mo ago
> A completable future is something that in the future may complete. I think that's self explanatory.

But not the reason for the name :).

It's called "completable" because these futures have a method on them `future.complete("value")`. Before their introduction, there was a `Future` API that java had.

nogridbag•11mo ago
Yeah that first example is rather poor. And it uses the word boilerpate to seemingly refer to the stuff unrelated to the async code (class declaration, exception handling, main method).

I don't use Java async much, but I guess if you have a utility method named "setTimeout" than the example can simply be:

    public CompletableFuture<String> fetchData() {
        return setTimeout(() -> "Data Fetched", 10000);
    }

    public void loadData() {
        fetchData().thenAccept(System.out::println);
    }
Which is simpler or equivalent to the JS example.
stevoski•11mo ago
The Java 1 example uses lambdas, which were introduced in Java 8.

It’s probably intentional, because it allows showing the Java 1 Thread approach succinctly.

But as long-term Java person, I find it jarring.

philipwhiuk•11mo ago
Java's had `var` since Java 10 but apparently the author deliberately ignored that to make the example as wordy as possible.

It's a little tiring to read a Java example with an entry-point (the public-static-void bit) and then a JavaScript example without one.

If you strip that out the original Java is:

  var future = CompletableFuture.supplyAsync(() -> {
        try {
                Thread.sleep(10000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            return "Data Fetched";
        });
  future.thenAccept(result -> System.out.println(result));
  System.out.println("Prints first"); // prints before the async result
which is only obtuse due to checked exceptions.

Arguably it's still a different thing you're doing, because it's not scheduling a task on a pool, it's creating a thread which sleeps for 10 seconds.

elric•11mo ago
`var` is very unhelpful in situations where the reader might not be entirely familiar with the context, especially when using factory methods.

I don't think the author was trying to make the example "wordy" so much as "clear".

cogman10•11mo ago
Also, arguably, the wrong way to do something like this.

The author uses `setTimeout` for javascript. The equivalent for Java is either the `Timer` class or a `ScheduledExecutorService`. Doing a `Thread.sleep` simply isn't how you should approach this.

With that in mind, if you want to use both these things and keep the completable future interface you'd have to do soemthing like this.

    ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
    var future = new CompletableFuture<String>();
    scheduler.schedule(()->future.complete("Data Fetched"), 10, TimeUnit.SECONDS);
    future.thenAccept(result -> System.out.println(result));
    System.out.println("Prints first"); // prints before the async result
    scheduler.shutdown();
wpollock•11mo ago
In Java 24, new features support educational and demonstration use. You don't need a class to wrap your main method, which also has a simpler signature. To compare JavaScript with Java examples, one should make use of these features.

While the examples may need some work, I enjoyed this post, it nicely shows the evolution of Java concurrency.

AtlasBarfed•11mo ago
Does no.js still limit you to a single core/CPU use?

Or as a node successfully been able to start utilizing more cores underneath its JavaScript single thread model. It presents the programmer?

I just remember early node.js from like 15 years ago and the single background task limitation of JavaScript running in a web page.

Cuz you got async code is nice, but what you really wanted to be able to harness in modern CPUs is multi-core

That said, I've been looking for an article like this for a while, although I think there are other associated libraries that also had steps in here. I do think the jvm adopted a lot of those, but I'm not sure if they actually are better than the original extension libraries.

msgilligan•11mo ago
I simplified the first example to:

  void main() {
      CompletableFuture<String> future = CompletableFuture.supplyAsync(this::asyncMethod);
      future.thenAccept(result -> IO.println(result));
      IO.println("Prints first");             // prints before the async result
      future.join();                          // Wait for future to complete
  }

  String asyncMethod() {
      try {
          Thread.sleep(10000);
      } catch (InterruptedException e) {
          return "Interrupted";
      }
      return "Data Fetched";
  }
I made the following changes:

1. Move the asynchronous function called in the CompletableFuture to its own method

2. Use Java 25 "instance main method" (see JEP 25: https://openjdk.org/jeps/512)

3. Use Java 25 IO.println() to simplify console output

4. Instead of throwing a fatal exception on interruption, return "Interrupted" immediately.

5. Use future.join() so the main method waits for the future to complete and the "Data fetched" output is printed.

This program can be run directly from source with `java Example.java`. (If you're using Java 24 or a version of Java 25 prior to EA 22, you need to use `java --enable-preview Example.java`)

Here is a modified version of the example that interrupts the thread:

  void main() {
      ExecutorService executor = Executors.newSingleThreadExecutor();
      CompletableFuture<String> future = CompletableFuture.supplyAsync(this::asyncMethod, executor);
      future.thenAccept(result -> IO.println(result));
      IO.println("Prints first");             // prints before the async result
      executor.shutdownNow();
      future.join();                          // Wait for future to complete
  }

  String asyncMethod() {
      try {
          Thread.sleep(10000);
      } catch (InterruptedException e) {
          return "Interrrupted";
      }
      return "Data Fetched";
  }