frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Malicious Rust Crate Arrayref Runs a Build-Time Payload

https://safedep.io/arrayref-proc-macro1-rust-build-time-malware/
147•abhisek•1h ago•96 comments

AliExpress runs silent WebAudio fingerprinting that breaks Bluetooth multipoint

https://blog.laserphile.com/2026/08/aliexpress-webpage-keeping-multipoint.html
385•emctech•4h ago•124 comments

Harvest hikes bills by 1500% after purchased by Bending Spoons

https://www.bbc.com/news/articles/clyq011414eo
45•jonathanlydall•42m ago•24 comments

Show HN: I trained a 125M model to autocomplete piano on-device

https://simedw.com/2026/08/20/midi-autocomplete/
196•simedw•2h ago•45 comments

Stwipe Acquires OpenWouter

https://stwipe.com/
95•eatonphil•56m ago•13 comments

DiffusionGemma Technical Report

https://arxiv.org/abs/2608.00146
41•gmays•1h ago•6 comments

Hacking with Claude on a $27 Smart Watch

https://www.mikekasberg.com/blog/2026/08/19/hacking-with-claude-on-a-27-smart-watch.html
21•speckx•52m ago•9 comments

Why the Ocean Cleanup Hasn't Solved the Plastic Pollution Crisis

https://therevelator.org/why-ocean-cleanup-has-not-solved-plastic-pollution/
21•sohkamyung•2h ago•12 comments

Windows brings out the Rorschach test in everyone (2003)

https://devblogs.microsoft.com/oldnewthing/20030825-00/?p=42803
292•luu•8h ago•106 comments

Slack Code

https://www.salesforce.com/introducing-slack-code/?bc=HL
5•trollied•39m ago•0 comments

Mojo is now open source

https://www.modular.com/blog/mojo-open-source
165•visheshdembla•1d ago•47 comments

Proof of Human (YC S23) Is Hiring a Member of Technical Staff

https://www.ycombinator.com/companies/proof-of-human/jobs/ZTZHEbb-member-of-technical-staff
1•timshell•3h ago

An American Mosaic (interactive map of ancestry census data)

https://www.nytimes.com/interactive/2026/07/01/us/america-ancestry-census-data-map.html
18•cckolon•3d ago•3 comments

An elliptic curve of rank ≥ 30

https://elliptic-rank.icarm.cloud/curve/273
9•robinhouston•46m ago•2 comments

Every Model Cheats

https://dreadnode.io/research/every-model-cheats-prompt-level-mitigation-of-cheating-on-offensive...
8•vga805•1h ago•3 comments

Seeing beyond BMI: Estimating cardiometabolic risk with smartphone imagery

https://research.google/blog/seeing-beyond-bmi-estimating-cardiometabolic-risk-with-smartphone-im...
39•leanderjanssen•3h ago•17 comments

Risk Engineering

https://risk-engineering.org/
46•throwaw12•4h ago•7 comments

Xorg-Server 26.0.99.901

https://lists.x.org/archives/xorg-announce/2026-August/003741.html
13•st_goliath•2h ago•0 comments

CI jobs artifacts should not be difficult

https://deadsimpleci.sparrowhub.io/doc/job-artifacts
10•melezhik•1h ago•3 comments

Router by Ramp

https://router.com
87•zackfield•19h ago•52 comments

Turns are Better than Radians (2022)

https://www.computerenhance.com/p/turns-are-better-than-radians
295•mayoff•13h ago•156 comments

Grok.bot – the epic domain lottery ticket

https://grok.bot/
5•bogdiyan•26m ago•0 comments

Bun 1.4

https://bun.com/blog/bun-v1.4
48•meetpateltech•50m ago•16 comments

AI didn't erase the junior engineer's value, it increased it it

https://franciscotrindade.me/blog/the-kids-are-really-alright/
51•franciscomt•3h ago•80 comments

A faster way to calculate the day of the week

https://www.benjoffe.com/fast-day-of-week
223•gavide•3d ago•61 comments

Bufo pulls the andon cord

https://hatchet.run/blog/andon-cord
7•abelanger•2d ago•2 comments

Don't paste the AI, please

https://dontpastetheai.com/
901•pjerem•6h ago•470 comments

Zellij 0.45.0: nested sessions, Kitty graphics, a fresh UI

https://zellij.dev/news/nested-sessions-kitty-graphics-new-ui/
12•peterhajas•2h ago•1 comments

Canonical Backs New Project to Translate Large C Codebases into Safe Rust

https://linuxiac.com/canonical-backs-new-project-to-translate-large-c-codebases-into-safe-rust/
28•datakan•1h ago•20 comments

Sol loves to cheat

https://jumploops.com/blog/sol-loves-to-cheat/
217•jumploops•1d ago•177 comments
Open in hackernews

Understanding Java's Asynchronous Journey

https://amritpandey.io/understanding-javas-asynchronous-journey/
17•hardasspunk•1y ago

Comments

Neywiny•1y 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•1y 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•1y 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•1y 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•1y 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•1y 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•1y 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();
AtlasBarfed•1y 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•1y 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";
  }
wpollock•1y 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.