This is so true that it’s hilarious. And sad. Any time I try to do something a little nontrivial for the front-end, it goes downhill so quickly. It’s like you are at this bizarre Home Depot with a million tools and you aren’t quite sure what they do because the most of the instruction manuals…
Don’t use class literals as type-tokens
Generics were added to the Java language within J2SE 5.0, and there was much rejoicing. It was finally possible to deal with containers in a type-safe manner. Prior to the availability of generics, Java developers had to do things like this: List people = new ArrayList(); people.add(new Person("Donkey Kong")); people.add(new Person("Guybrush Threepwood")); Person pirate =…
Heroku template for Spring 4 app with Oracle Java 8 and Tomcat 7.0.54
I’ve been playing around with Heroku at work for the past week or two. Heroku is pretty awesome if you want to get an app up and running quickly. Heroku does support Java and they have a few Java templates. Their current offering for Java uses Spring 3 and Tomcat 7.0.54 with Java 7. However,…
How I got a medal from the Army for writing code
In 2005 my National Guard unit was deployed to Iraq as part of Operation Iraqi Freedom. My MOS (Military Occupational Specialty) in the Army was 92A, which is basically a logistics and supplies specialist. My job was to order parts for mechanics, pick them up, return old parts, manage HAZMAT, dispatch/return vehicles from missions, and…
Comments were broken for a while
Commenting on this blog was disabled for a while… I think it was due to Akismet misbehaving or something. I’m not sure. Either way, you should be able to comment now. I will be slowly adding anti-spam stuff back in.
The image that lied about itself
A few weeks ago, I ran into a puzzling issue at work. Someone was uploading an image which made it past our file-size checks, but caused an OutOfMemoryError and a heap dump when the code attempted to resize it. The information we had from the heap-dump was that it was trying to allocate memory for…
Maintaining a sorted array in O(1)
Yesterday, I came across an interesting question on StackOverflow. The question is as follows: assuming you have a sorted array, is it possible to increment locations by 1 (one at a time) and still ensure that the array is sorted in O(1)? Assuming you are not allowed to use any other secondary data-structures, the answer…
JavaOne
I am at JavaOne! The last time I was here was in ’08, when it was run by Sun. Of course, it’s run by Oracle now. The first day has been pretty good. I attended sessions on Garbage Collection, the Nashorn JavaScript engine, writing DSLs, and about parallelization options offered by JDK 7 and 8…
How to stop YouTube sucking on Ubuntu/Linux
Recently I’ve noticed that YouTube’s performance on my machines have been terrible. It’s constantly buffering, or it will stop randomly in the middle of a video. I’ll get a few seconds of playback and then 10-30 seconds of buffering. It’s pretty terrible. On Windows I have been able to use the helpful workaround from here…
Rendering a PDF with text-selection, using pdf.js
I have been working a project for the last few days, that deals with rendering PDF’s in-browser. Initially, I was going to parse the PDF and extract the text content, but then I ran into pdf.js, which is a library developed by Mozilla for rendering PDF’s in-browser via JavaScript. The project I am working on…