Skip to content

Convert a Julian Date to an Instant

I’m running into a situation where I would like to convert from a Julian date to an java.time.Instant (if that makes sense), or some Java time that can be more easily understood. My understanding of what a Julian date is comes from reading the Wikipedia page. There are bunch of different variants, and t…

Guava Resources.readLines() for Zip/Gzip files

I’ve found the Resources.readLines() and Files.readLines() to be helpfull in simplifiying my code. The problem is that I often read gzip-compressed txt-files or txt-files in zip archives from URL’s (HTTP and FTP). Is there a way to use Guava’s methods to read from these URL’s too? Or i…

How do I load a texture in LWJGL from a PNG without Slick?

I’m wondering how I would render a cube with a different PNG Texture on each side, and I’d like to stay away from other Third-Party Libraries other than LWJGL. Answer As of LWJGL3 bindings for the STB library have been included. This is a small single-file utility library that does things like loa…

Translucent blurred background in JavaFx

I want blurred translucent background effect in my JavaFx app like in the following image. But I cannot find any satisfactory answer anywhere. This answer provides some workaround, it takes screenshot of background and sets it as background image. But the problem is, if background changes, it remain as it is.…

Force warning when class is not closed

When I work with IO classes like java.util.Scanner or java.io.BufferedReader, Eclipse displays a warning Resource leak: ‘suchAndSuch’ is never closed. How can I make Eclipse display this warning for …

Java collection like c# KeyedColllection

Is there a Java collection that has the same behavior as the c# abstract KeyedCollection class (that is items can be retrieved by both key and index)? I have looked around but can’t find anything similar. Thanks, Nick Answer I think you can develop Your own class by extending a HashMap

Java array manipulation, invert an int[][] array

I am trying to flip each col in this array to invert the image. However, when I run my code, I get a mirror image of the second half of the image, for some ridiculous reason, that I cannot figure out. Can someone please tell me why this only works half-way? someArray is an int[][] array defined elsewhere in m…