Prototype code used to compute fractional month difference between two dates.
String[][] tests = {
{"2024-04-14", "2024-04-04"}, //<1 month (10 days or 0.333)
{"2024-04-04", "2024-04-14"}, //<1 month (10 days or 0.333)
I've been using Netbeans for longer than I care to admit. I use it almost everyday for Java and JavaScript development. Here are some small tweaks I use to make Netbeans a little easier to use.
When I first started using Netbeans, there was an option to select a project as a "Main Project". Visually, the main project is highlighted in bold in the Projects
tree. When you have a main project selected, the build buttons in the main toolbar will apply to the selected project.
Newer versions of Netbeans don't have a "Set as Main Project" menu option when you right click on a project in the Projects
tree.
To re-enable this feature, simply go to Run
-> Set Main Project
-> Select a project
Nashorn used to be bundled with Java between versions 8 to 14. It no longer ships starting with Java 15 and needs to be downloaded as a seperate JAR via OpenJDK.
https://github.com/openjdk/nashorn
Migrating to the OpenJDK version of Nashorn is pretty straightforward.
//Scripting includes
JConsole is a free program that is part of the JDK distribution that you can use to debug performance issues. It is especailly useful with the topthreads plugin.
To launch JConsole with topthreads:
"C:\Program Files\Java\jdk-11.0.12\bin\jconsole.exe" -pluginpath C:\temp\topthreads-1.1.jar
Personal notes on how to do basic stuff in D3
Basic example using a 1d array of data
//**************************************************************************
//** getTiles
//**************************************************************************
/** Demostrates how to iterate through all the tiles in a layer
*/
var getTiles = function(layer){
var renderer = layer.getRenderer();
Creates a polygon around a linestring. Provides an option to vary the thickness. Usage:
var path = [ [0, 0], [25, 25], [13, 13] ];
var width = 5; //or an array for each line segment [ 5, 10, 15 ]
var poly = line2Polygon(path, width);
Credit: https://gist.github.com/kekscom/4194148
When copying geometry data into PostgreSQL using COPY FROM STDIN
it is a good idea to use the PostGIS HEXEWKB format.
Here's how to create HEXEWKB using Java and JTS:
import com.vividsolutions.jts.geom.*;
import com.vividsolutions.jts.io.WKBWriter;
import com.vividsolutions.jts.io.WKTReader;
import com.vividsolutions.jts.io.ByteOrderValues;