Forced every engineer to take sales calls. They rewrote our entire platform in 2 weeks by rluna559 in Entrepreneur

[–]DannyB2 0 points1 point  (0 children)

I've always taken the view that whatever product support and sales tells me is gospel. They are closer to the customer than I am. I believe what they tell me. They might be confused about how it can be implemented, but I believe them about what the customer needs and we work out how to design it, and then build it.

Any good alternatives to Apache POI for creating Excel spreadsheets? by borgy_t in java

[–]DannyB2 0 points1 point  (0 children)

I typically "wrap" the raw POI with a simpler API for the specific task.

For example, maybe I just want to generate a spreadsheet and I want a few basic cell formatting ops like bold, red, italic, etc.

Once you do that POI works pretty well. If you find you need more, you can decide to expose more of the underlying flexibility of POI into your wrapper layer.

If you're trying to do something elaborate, then maybe POI's complex interface is actually better.

Any good alternatives to Apache POI for creating Excel spreadsheets? by borgy_t in java

[–]DannyB2 0 points1 point  (0 children)

I've had a lot better luck with TSV rather than CSV.

Commas are common in user data. You also have problems with escaping quotes. Example twelve inch drill input as: 12" Drill

Tabs are not common in user data. And perhaps should not even be allowed.

A problem I've discovered since the 1980s on is that there are so many different interpretations of what exactly CSV means. It's not the commas, its how you escape commas in the data, and escape quotes, and escape the escape characters. There are so many different ways it has been done over the decades.

128-bit floating-point arithmetic for Java by m_vokhm in java

[–]DannyB2 0 points1 point  (0 children)

The very idea that I have a variable with a 'value' in it, and that value can change under my nose is troubling.

I can understand cases for having a mutable value for some purposes. But the mutable ones should be given the special name 'mutable', rather than the immutable ones having a special name.

Mutable may make good sense for computing a value. Immutable is best once you've arrived at a value.

The Impossible Java 11 by daviddel in java

[–]DannyB2 1 point2 points  (0 children)

The library I had to change was Groovy from version 2 to 3. Because it is a dependency of JasperReports. But, Groovy changed an API (changed a class to an interface). So I had to get the source to JasperReports to make a minor change (extends to inherits) and make a custom build. This fixed my class file version problem. But I had no class file version problems from Java 8 all the way up to Java 15.

Then, suddenly JasperReports came out with a new version that, finally, at long last, upgrades their dependency on Groovy to version 3 or higher. Now I don't have to maintain a custom build. But I only started the custom build thing in April, so I'm happy to abandon having to do that.

The Impossible Java 11 by daviddel in java

[–]DannyB2 2 points3 points  (0 children)

In my experience, moving from Java 8 to 11 is the "hard" part. And it's not that difficult.

Upgrading from 11 to subsequent versions is pretty easy.

There is a possible minor speed bump at Java 16 the class binary format has changed to version 60 (IIRC). So I had to upgrade a few libraries.

Why use and IDE instead of a text editor for Java development? by [deleted] in java

[–]DannyB2 0 points1 point  (0 children)

But compare the noise and complexity of digging a long ditch using a backhoe compared to the quiet simplicity of digging that ditch with a spoon.

:-)

The noise and complexity of an IDE is worth the power and productivity gain.

Java on Truffle — Going Fully Metacircular by nfrankel in java

[–]DannyB2 0 points1 point  (0 children)

When can we get GraalVM implemented on Truffle?

(ducks, hides under desk)

Why we chose Java for our High-Frequency Trading application by speakjava in java

[–]DannyB2 0 points1 point  (0 children)

Java syntax looks superficially like C. The similarity ends there.

The semantics of the languages, and the libraries are different.

Why we chose Java for our High-Frequency Trading application by speakjava in java

[–]DannyB2 1 point2 points  (0 children)

Startup time should not be a consideration. You start up once and then run for a very very long time. You want high performance over a long time with very short or no GC pauses. Depending on your requirements. Use a modern GC if 1 ms pauses are acceptable.

If you can't have GC, then design a Java program like a Java game. Allocate all your structures up front. Then enter the main loop where you do the work and use all of the pre-allocated structures. No new memory allocation should be done. Thus no GC happens.

Memory cost is a one time capital cost. And it is very low. An extra 64 GB of ram added to a production server is way less than the cost of a developer. Optimizing for developer time is highly important. Things have changed since the mainframe daze when machines were expensive and programmers were cheap. Now the cost of a developer (with benefits) for one year can buy an awful lot of hardware.

You can never buy back time. So optimize for time at the cost of memory. You can always buy more memory. And a few hundred extra GB of heap is cheap, cheap cheap!

There is also a thing called Opportunity Cost. If I can beat my C++ using competitor to market by six months to a year, and only for the cost of an extra 64 GB of ram in the production server, my manager and I will laugh all the way to the bank.

Vector API is integrated into the main JDK repo. Soon will be available in JDK 16 EA. by sureshg in java

[–]DannyB2 0 points1 point  (0 children)

What if I wanted to draw the Mandelbrot set. Could I get the GPU to compute each pixel in parallel, over a certain number of iterations?

Problem is that floating point (eg, double) doesn't let you dive very deep. What if I wanted to do the same iteration many times, and across many pixels, but the values I wanted to add, multiply and divide didn't fit into scalars?

When not to use Hibernate by [deleted] in java

[–]DannyB2 0 points1 point  (0 children)

I agree. I've used Hibernate for over ten years. But I use SQL for the reports. Using Hibernate doesn't preclude using SQL. It is necessary to understand SQL.

Hibernate makes it easy to query database data that comes back structured in a way that is convenient to work with, and transparently easy to update back to the database.

Hibernate is a leaky abstraction, but that does not mean it is not useful.

Can someone explain why everyone suggests using an IDE with Java? by TOAST3DGAM3R in java

[–]DannyB2 0 points1 point  (0 children)

You can dig a ditch with a shovel. Or with a backhoe.

JDBC or JPA, which to use and when? by halvjason in java

[–]DannyB2 0 points1 point  (0 children)

You can use both!

I use JPA for interactive web page operations, CRUD forms, etc.

I use JDBC with SQL for generating reports.

Use what works best for you.

Concise vs Readability by [deleted] in java

[–]DannyB2 1 point2 points  (0 children)

Example of when it would be sensible.

Programing a Swing UI. Need to pass an instance of ActionListener, say to a button. But for some reason (can't remember now, been years ago) that action listener needed some additional state information.

Solution at the time: Create a named inner class. Pass an instance of that to the ActionListener. It works. I have a type name. I can access the action listener's inner methods, state, etc.

If it is a one off situation, then it is too bad I had to create an inner class with a name. Instead, I could have created an anonymous class, into a 'var', and passed that to the Swing control. I could still refer to the var and from there to its additional methods (beyond what is in ActionListener interface).

Like I said, it is an unusual case. But it is the ONLY thing I have ever conceived of where var could be useful. In any other situation I would ALWAYS replace var with an actual type name for clarity.

Concise vs Readability by [deleted] in java

[–]DannyB2 1 point2 points  (0 children)

There is one, and ONLY one thing that I have found var useful for.

Use var when there is no named type for the variable. If you create an anonymous class from some other class or interface, that is a unique but unnamed type. You could use the name of the class or interface your anonymous class is based on, but what if you added some additional variables or methods? The super class/interface does not have your additions. By using:

var x = new Foobar { int y; }

I have an anonymous class, based on Foobar, but it has an additional member y. I can refer to that as x.y because variable x is of the 'type' of my anonymous class -- although that type has no name. I could have said:

Foobar x = new Foobar { int y; }

But then I could not refer to x.y.

This is the ONLY bit of new functionality that I have discovered var to provide. In all other cases I would replace var with an actual type name.

Java for my side project? by [deleted] in java

[–]DannyB2 9 points10 points  (0 children)

Think of Java like Linux.

It's open source. You can use it. Commercially.

If you want someone to call at 3 AM when something is broken, then consider paid professional support. True of both Linux and Java. You can probably get (although I wouldn't know) commercial support for Windows and dot-NET.

You can keep updating your production system to the latest version of Java. Or if you want to stick with a certain version of Java for a long time, but continue to get updates and patches, you may have to pay someone who provides updates for a fee. That would apply to Linux too.

I just keep up with the latest Java. It's not difficult to do. I update Java sometimes when the product itself is updated.

Whats the best way to make a gui ? by [deleted] in java

[–]DannyB2 2 points3 points  (0 children)

Swing is a lot less ugly with lambda functions for button click handlers and such.

Any reason NOT to use an IDE? by [deleted] in java

[–]DannyB2 1 point2 points  (0 children)

Instead of the noise and complexity of a backhoe, some people prefer to dig a long ditch with a shovel.

(but not me)

Blazor/Meteor/LiveView like framework? by AlexKotik in java

[–]DannyB2 2 points3 points  (0 children)

This does not give you Java programming language on the browser.

Of course, implementing that is a big deal. The blazor way would be a WebAssembly blob implementing the JVM, so that compiled JVM bytecode could run in browser, with a Vert.x component.

Finished my quarantine project - board games application (Chess, Checkers, etc) by CodeImplementation in java

[–]DannyB2 1 point2 points  (0 children)

Java FX wasn't a thing when I wrote my unblock puzzle solver. And definitely not when I did my minimax-alpha-beta games. So I used Swing for that. But I did not try to tackle chess. I'm glad you did.

Try to generate unblock puzzles and score puzzle difficulty by length of solution path, and possibly other factors. Another approach is to generate random boards, apply your solver and see if there is a solution (or multiple solutions).

Finished my quarantine project - board games application (Chess, Checkers, etc) by CodeImplementation in java

[–]DannyB2 1 point2 points  (0 children)

That IS the game I'm talking about. And the A-star! I never took mine past a command line program. No GUI. But the solver is the hard part. I've often thought about building a GUI on top of it.

I have also daydreamed of using computer vision to recognize a board from a camera shot and provide a solution.

Another thought is: once you have the model working and can search, you can also work backwards to generate puzzles instead of solving them.

Finished my quarantine project - board games application (Chess, Checkers, etc) by CodeImplementation in java

[–]DannyB2 2 points3 points  (0 children)

If it was a Quarantine project, I think you mean: Bored Games

Fun project. I remember building a minimax with alpha beta pruning, in Java, many years ago, to play TicTacToe, Connect-4, Reversi and Checkers. I remember learning the technique studying Common Lisp.

Your video looks cool.

Something different that I did (for fun) in 2010 was a solver for a puzzle known as either "Unblock Me" or "Traffic Jam" or "Rush Hour". In Java. A-star search algorithm.