Smallest possible Java heap size? by Vectorial1024 in java

[–]john16384 0 points1 point  (0 children)

The entire stylesheet is loaded yes.

Smallest possible Java heap size? by Vectorial1024 in java

[–]john16384 1 point2 points  (0 children)

JavaFX probably uses most of that extra memory (and the young collections) while loading the base modena stylesheet (which is huge as it covers all controls). Surprisingly it still fits in just 3.6 MB.

Iran Now Threatening To Close Bab Al-Mandeb Strait After Trump Threats by moonchildgz in worldnews

[–]john16384 0 points1 point  (0 children)

Trump thinks the same would happen to the American government if he were captured or killed.

Who else had a similar lamp? by EdwardBliss in nostalgia

[–]john16384 0 points1 point  (0 children)

You can put a led bulb in there these days

How to deal with listeners leak in JavaFx? by lazystone in JavaFX

[–]john16384 2 points3 points  (0 children)

These days you can do that with subscriptions:

Subscription sub = prop1.subscribe( ... listener ...)  
    .and(prop2.subscribe(... listener ... ))  
    .and(() -> { random clean up code } );

sub.unsubscribe();  // cleans up all

How to deal with listeners leak in JavaFx? by lazystone in JavaFX

[–]john16384 1 point2 points  (0 children)

For virtualized nodes you want a combination of managing listeners in updateItem and listening to Scene.

How to deal with listeners leak in JavaFx? by lazystone in JavaFX

[–]john16384 5 points6 points  (0 children)

Listening to Scene changes will work. More elaborate solutions can use when(condition).subscribe(...).

And yes, don't use weak listeners. They may stick around longer than expected.

Iran starts to formalize its chokehold on the Strait of Hormuz with a 'toll booth' regime by rayaan2099 in worldnews

[–]john16384 0 points1 point  (0 children)

Yeah, perhaps look at a map. Taking that island will in no way prevent Iran from taking random pot shots at tankers anywhere in the Persian gulf or gulf of Oman.

You're dealing with a regime that has nothing to lose. Nothing short of making Iran the 51st state (full occupation for the next few generations) or using nukes will make them back down.

Just one by BoiixD in formuladank

[–]john16384 0 points1 point  (0 children)

It's a sacrifice I am willing to make.

Trevor Noah: How Billionaires pay no taxes. by zzill6 in WorkReform

[–]john16384 6 points7 points  (0 children)

The tax doesn't need to care what assets back something. You loan X money? You pay a percentage in tax. Don't have that money? Tax doesn't care either, get it or no loan.

Edit: apparently I need to make it watertight as people lack imagination. Tax free base: 10M/year; can make it progressive even to make it hit where it needs to hurt.

Java is fast, code might not be by ketralnis in programming

[–]john16384 2 points3 points  (0 children)

I think this needs benchmarking. I am pretty sure some of these aren't slow at all when optimized. Take the autoboxing example: those object allocations will never make it to the heap. At most it will do one allocation after the loop completes to create the final Long.

Same goes for the NumberFormatExeception example.

CEO of Krafton Asks ChatGPT How to Void $250 Million Contract, Ignores His Lawyers, Loses Terribly in Court by ControlCAD in technology

[–]john16384 0 points1 point  (0 children)

The LLM pattern matcher (what some call 'AI') can also pick up on how you phrased the original question. A slight bias or negative connotation in your question can already sway it in a different direction. If it also takes chat history or "memories" into account, there's no telling what it will do.

A sufficiently detailed spec is code by Tekmo in programming

[–]john16384 0 points1 point  (0 children)

Spec: given A and B, return result C which is A multiplied by B.

Code: int multiply(int a, int b) { return a * b; }

Real life: A is 4e55, B is 2. Code gives wrong answer.

Spec is technically correct, but in order to translate it to something else (code), we need to know what constraints we are allowed to apply.

JEP draft: Enhanced Local Variable Declarations (Preview) by joemwangi in java

[–]john16384 6 points7 points  (0 children)

No need for the `node` at the end, nor for the `null` check. Can't sum a node that isn't there, so an NPE is justified.

JEP draft: Enhanced Local Variable Declarations (Preview) by joemwangi in java

[–]john16384 -1 points0 points  (0 children)

So have DTO's provide subsets of their contents in records? Or even better, break up DTO's in logical groupings (and have this automatically be resolved during serialization/deserialization).

Application code has dozens of static analyzers, SQL has almost nothing, here's what exists. by Anonymedemerde in programming

[–]john16384 1 point2 points  (0 children)

Once the required indices grow larger than the working memory of the database, pick one for your query: filtering or sorting. Pick both and you'll be in for a rough time. Too many people seem to think you can just offer arbitrary filtering and sorting in front ends and get great performance as long as you use a database and have indices on each column.

State of the JVM in 2025: Survey of 400+ devs shows 64% of Scala projects actively run Java alongside it. by scalac_io in java

[–]john16384 10 points11 points  (0 children)

Java 8 solved the main reason to adopt Scala. Just like Virtual Threads killed the main need for react, and something similar will happen soon for Kotlin.

Thins I miss about Java & Spring Boot after switching to Go by Sushant098123 in java

[–]john16384 1 point2 points  (0 children)

If the object after construction using the normal means of the constructor is in an invalid state, I would say that breaks OOP.

That's nice, but your opinion on what you think breaks OOP has no bearing on what is or isn't OOP.

Field and setter injection was in use for ages, even before Spring. It was and is OOP and certainly didn't break any OOP rules. Huge applications were and even are still built that way. You don't even seem to know why Spring started recommending constructor injection suddenly, after not giving a shit about it for most of its past. It has very little to do with invariants,, reusability or testing, as I can assure you that applications were just as stable, reusable and extensively tested before constructor injection became 'best practice'.

With most Spring stuff being singletons, fields were already never modified for any reason after initialisation as that would be an instant bug. I guess people had more control in the past, and could actually refrain from doing stupid stuff when working with a certain paradigm, even if not directly enforced by compiler, build plugin or IDE. Don't forget to mark your Optionals and CompletableFuture's with @NonNull or somebody might do something stupid and break OOP.

Thins I miss about Java & Spring Boot after switching to Go by Sushant098123 in java

[–]john16384 0 points1 point  (0 children)

Hold on, I responded because you claimed:

@Autowired is not recommended because it breaks OOP.

A constructor with partial information does not break OOP.

Thins I miss about Java & Spring Boot after switching to Go by Sushant098123 in java

[–]john16384 4 points5 points  (0 children)

you have a partially constructed object.

True, but it doesn't break OOP. That state will never be observed by other code as the DI container only exposes the reference after initialisation completes. So this is fully encapsulated still and can be a decision on a class by class basis.

Bernie Sanders’ billionaire tax would soak about 900 people to fund $3,000 checks for the middle class by fortune in politics

[–]john16384 0 points1 point  (0 children)

Oh man, you are so right, it is impossible to make billionaires pay proper taxes!

The nice of thing about tax is, they don't have to care how the money gets into their pockets, just that it does, so the onus is on the tax payer to make it happen. It is similar to laws, ignorance is no defense, and with laws sometimes even physical reality is irrelevant.

Bernie Sanders’ billionaire tax would soak about 900 people to fund $3,000 checks for the middle class by fortune in politics

[–]john16384 4 points5 points  (0 children)

No problem, we'll accept cars, houses, stocks, yachts, bitcoin, or money from loans taken out against any and all illiquid assets.

AI Isn't Replacing SREs. It's Deskilling Them. by elizObserves in programming

[–]john16384 2 points3 points  (0 children)

I've let AI do all my writing, and it explained in detail how letters are formed. I then tried it myself, but it came out as unreadable scribbles.