HNHacker News
TopNewBestAskShowJobs

lbalazscs

63 karma · joined September 12, 2022

submissionscomments
lbalazscs··on Callbacks in C++ using template functors (1994)
A sentence from the article: "Given the extreme undesirability of any new language features I'd hardly propose bound-pointers now."

It shows that C++ was considered too complex already in the 90s.

lbalazscs··on Fernflower Java Decompiler
The link about Stiver has some details:

> Stiver decided to write his own decompiler as a side project. To overcome the weaknesses of existing alternatives, he took a different approach. After reading the bytecode, he constructed a control-flow graph in static single-assignment form, which is much better to express the program semantics abstracting the particular shape of bytecode. At the beginning of this project, Stiver knew little about static analysis and compiler design and had to learn a lot, but the effort was worth it. The resulting decompiler produced much better results than anything available at that time. It could even decompile the bytecode produced by some obfuscators without any explicit support.

https://blog.jetbrains.com/idea/2024/11/in-memory-of-stiver/

lbalazscs··on Byte Buddy is a code generation and manipulation library for Java
We are already living in an (almost) ideal world: https://github.com/raphw/byte-buddy/discussions/1798
lbalazscs··on LLM code generation may lead to an erosion of trust
It's naive to hope that automatic tests will find all problems. There are several types of problems that are hard to detect automatically: concurrency problems, resource management errors, security vulnerabilities, etc.

An even more important question: who tests the tests themselves? In traditional development, every piece of logic is implemented twice: once in the code and once in the tests. The tests checks the code, and in turn, the code implicitly checks the tests. It's quite common to find that a bug was actually in the tests, not the app code. You can't just blindly trust the tests, and wait until your agent finds a way to replicate a test bug in the code.

lbalazscs··on JVM statistics cause garbage collection pauses (2015)
In 2015 there was no ZGC. Today ZGC (an optional garbage collector optimized for latency) guarantees that there will be no GC pauses longer than a millisecond.
lbalazscs··on The Expert Mind [pdf] (2006)
Regarding openings, there's a trade-off between chess training and chess results. Rote memorization can improve your results (if you already have good skills), but it won't improve your skills.

Learning endgames is not about blindly memorizing moves in specific positions. You learn tricks that can be used in a large number of positions. Even the seemingly very specific positions can be mirrored left-right (not to mention black-white).

lbalazscs··on The Expert Mind [pdf] (2006)
There is a difference between memorization and rote memorization. In chess, rote memorization of master games or chess positions is not a recognized training method. Chess memory improves as a byproduct of analyzing many positions.
lbalazscs··on Null-Restricted and Nullable Types
Your link is only for value types, but this one is more general, it's for any type. Obviously the two are related, but not the same. Nullability for value types has performance implications as well.
lbalazscs··on JVM Performance Comparison for JDK 21
"Oracle GraalVM" (the former "Enterprise Edition") is now free, but (unlike "GraalVM Community Edition") not open source.
lbalazscs··on The Rust project has a burnout problem
I guess you missed the part where Linus Torvalds has apologized for years of being a jerk.

https://arstechnica.com/gadgets/2018/09/linus-torvalds-apolo...

lbalazscs··on SD4J – Stable Diffusion pipeline in Java using ONNX Runtime
The ONNX Runtime is written in C++ and it uses the GPU. And Java is certainly much faster than Python.
lbalazscs··on Compare Google, Bing, Marginalia, Kagi, Mwmbl, and ChatGPT
I often do a Google search, and then go directly to the Wikipedia result. My reasoning is that during the initial search, I don't know if there's a Wikipedia page about that topic, and I might need a fallback option.
lbalazscs··on FFM (Foreign Function and Memory API) Goes Final
I only used Launch4j on Windows, but in the downloads you can find Linux and MacOS versions as well. At the bottom of the webpage it explains that it can be built on even more platforms, if you have MinGW binutils 2.22 (windres and ld only) on those platforms.

If I remember correctly, you can't just pull out the exe created by jpackage, because it doesn't contain the runtime. The installer installs both the runtime and the exe. The exe created by Launch4j also doesn't include the runtime, but Launch4j is better at finding a system-wide runtime, and can direct the user to a specific download site (such as adoptium.net) instead of java.com. If you want to have JUST a single exe, then I think GraalVM's native image is the only option.

lbalazscs··on FFM (Foreign Function and Memory API) Goes Final
jlink only creates a runtime (the parts of the JDK that are actually used by your app), but there's a relatively new command called jpackage for creating installers: https://docs.oracle.com/en/java/javase/21/jpackage/packaging...

EDIT: I see now that you already know jpackage, but you don't want an installer. In that case you can use launch4j, which just wraps a jar in an exe: https://launch4j.sourceforge.net/

lbalazscs··on Telling GPT-4 you're scared or under pressure improves performance
I actually did that, and I asked for the first paragraph from "Great Expectations", and the answer was correct.

Of course the first paragraph of any famous novel is in itself famous, so I also asked for the first paragraph from Chapter XL, from the same novel. Interestingly the first 12 words were correct, but the rest was hallucination.

Original: It was fortunate for me that I had to take precautions to ensure (so far as I could) the safety of my dreaded visitor; for, this thought pressing on me when I awoke, held other thoughts in a confused concourse at a distance.

ChatGPT 3.5: "It was fortunate for me that I had to take precautions to ensure the safety of my treasure, for with such a boy as Compeyson on the loose, I was not likely to find much mercy at his hands. I had not told Herbert about the money, and I was glad to have the chance to count it before he came back. I found that I had still twenty-one sovereigns, six shillings, and sixpence left."

lbalazscs··on Java JEP 461: Stream Gatherers
My understanding is that Stream internals are a very complex piece of software that can have multiple different bugs. By the way, I agree with you that eager versions of the Stream methods should also be available directly on the collections.
lbalazscs··on Java JEP 461: Stream Gatherers
The latest Mockito works with Java 21; you'll just see a warning about the usage of the bytebuddy agent. In the future, you'll need to explicitly approve the loading of agents (you can call it "magic"), which will improve the security of your programs.
lbalazscs··on Java JEP 461: Stream Gatherers
I hope that 2024 will be the year when people stop pointing to duplicate or fixed bugs...
lbalazscs··on JDK 21 Release Notes
The question of "single UI or GPU bound thread" could be solved in a future release with custom virtual thread schedulers. Java 21 concentrates on solving the problem of server-side applications.
lbalazscs··on JDK 21 Release Notes
Ideally knowing "what is synchronous and what is asynchronous" shouldn't be your concern, just like freeing memory isn't your concern in a language with garbage collection. Similarly, you don't have to know the "real" memory addresses when using virtual memory.

Ask yourself why do you want to know what is asynchronous. In a typical server-side app synchronous, blocking, thread-per-task code is easy to write and read. There is only one drawback: you can run out of kernel threads. Asynchronous code solves this problem, but virtual threads solve it in a better way, because you can have three orders of magnitude more virtual threads compared to kernel threads. Ultimately, it's all about the number of threads you are allowed to use.

lbalazscs··on My mental model of Clojure transducers
Oracle's main Java product (OpenJDK) is 100% open source and free to use. If you also want extra support, then you can also use the "Oracle JDK", which is technically the same as OpenJDK. The only difference is the support, which of course was never free.
lbalazscs··on Petition to stop France from forcing browsers like Firefox to censor websites
Indeed.

> The Franco-Swiss border runs through the CERN campus and building 31 is literally just a few feet into France. However, there is no explicit border within CERN and the main entrance is in Switzerland, so the situation of which country it was invented in is actually quite a tricky one. The current commemorative plaque, which is outside a row of offices where people other than Tim Berners-Lee worked on the web, is in Switzerland. To add to the confusion, in case Tim thought of the web at home, his home was in France but he temporarily moved to rented accommodation in Switzerland, just around the time the web was developed.

https://davidgalbraith.org/uncategorized/the-exact-location-...

lbalazscs··on We reduced the cost of building Mastodon at Twitter-scale by 100x
They claim that "Reddit, Slack, Gmail, Uber, etc" could also be done with a similar level of effort.
lbalazscs··on AI to name your Java Classes
Here's a tested ChatGPT prompt:

Suggest better variable and method names in the following Java code. Don't list the new code, only the changes, in the format "oldName" => "newName". You can also suggest multiple alternatives in the format "oldName" => "newName1" or "newName2"

In my experience, 90% of the proposed changes are bad, but occasionally it does have good ideas.

Of course, you shouldn't upload your company's code to OpenAI, but you can try it out on open source or experimental projects.

lbalazscs··on Chess is just poker now
Fischer announced Fischer Random Chess in 1996, long after his retirement from competitive chess (1972). His reason for doing so in 1996 was very prosaic: he was simply no longer familiar with modern opening theory.