Coding

I am a software developer in Austin, TX with over 20 years of experience. I have a passion for high quality software that users say “just works.”

Using MyBatis to query a large table

I was querying a Postgres table with about 4 million rows and writing some of the fields to a CSV. I knew loading the rows into RAM was unacceptable, so I used the MyBatis class ResultHandler to process the records. The code ran fine locally, but in production we were having memory usage issues.

Read More »
Retrieving the SOAPAction in a CXF Provider

I was writing a WSDL-first SOAP 1.1 service (server) using Apache CXF. I needed to directly access the XML DOM of the SOAP Header and Body, so I did not want to use the standard JAXB data binding. My solution was to implement a Provider using message mode. However, retrieving the SOAPAction inside the Provider’s invoke(SOAPMessage msg) method was not intuitive to me.

Read More »
Permission to ports 80 & 443 with authbind

I prefer to not run web applications as root. authbind allows you to run the application as a user other than root, but bind to ports 80 and 443.

Read More »
Daemonize a Java service on Linux the simple way

Creating a Java-based service on Linux that will start when the operating system boots and run continuously doesn’t require any extra libraries, despite many internet posts to the contrary.

Read More »
Caution: Loops in automated tests

Be wary of loops in automated (JUnit) tests. I have written automated tests that didn’t actually verify anything because the body of the loop was never executed.

Read More »
FreeMarker put commas in my integer

FreeMarker formatted an integer with a comma when I didn’t expect it. This caused my form post to fail.

Read More »
How do I convert a Java 8 instant to UTC?

Question I was asked today, which I thought was simple: “How do I convert a java.time.Instant to UTC?”

Read More »
Coding in denial

To write an application that works, you must handle unexpected conditions.

Read More »
Configure MySQL to use UTC

A Java server I wrote was storing date/time values in MySQL incorrectly during the transition from Daylight Saving Time to Standard Time. The solution was to force MySQL to store everything in Coordinated Universal Time (UTC).

Read More »
Store timestamps in UTC

If you persistently store an instant in time (aka a timestamp), then that instant must be stored in Coordinated Universal Time (UTC)*.

Read More »