16 November 2011 ~ 0 Comments

Installing Sun (Oracle) JDK 1.5 on an EC2 instance

TweetI’m currently working on moving a Tomcat-based application into EC2. The code was written for Java 5.0. While Java 6 would probably work, I’d like to keep everything as “same” as possible, since EC2 presents its own challenges. I spun up a couple of t1.micro instances and copied everything over, including the Java 5 JDK, [...]

Continue Reading

26 September 2011 ~ 0 Comments

Benchmarking DNS servers with Java

TweetI’m currently in the process of moving our DNS over to another provider and I was curious as to whether the old or new provider offers faster lookups. dig shows query times, but I didn’t want to just run that over and over. I decided to write something to do this, in Java since I [...]

Continue Reading

25 May 2011 ~ 0 Comments

Calculating SHA-1 sums in Java

Java code for calculating SHA-1 sums from arbitrary InputStreams, files, or Strings and printing them as strings.

Continue Reading

09 May 2010 ~ 0 Comments

Java Code: searching a Binary Search Tree for the largest value strictly less than X

Java code for creating and searching a Binary Search Tree of any element implementing the Comparable interface.

Continue Reading

17 April 2010 ~ 0 Comments

Code to flatten a list in Java, with and without recursion

TweetRecently had someone ask me to solve this problem: assume you have a list of objects, some of which may be lists of arbitrary depths. Write a function to return the list “flattened,” so sublists are all in the “main” list. I solved it recursively pretty easily, but it took some thought to do it [...]

Continue Reading

21 October 2009 ~ 0 Comments

How to install the 64-bit Sun Java plugin on 64-bit firefox on 64-bit Fedora Core 11 Linux (which happens to use 64 bits)

TweetI’m giddy! I found this post on mozdev.org which was magical. [evan@ehoffman ~]$ java -version java version “1.6.0_17″ Java(TM) SE Runtime Environment (build 1.6.0_17-b04) Java HotSpot(TM) 64-Bit Server VM (build 14.3-b01, mixed mode) [root@ehoffman plugins]# uname -a Linux ehoffman 2.6.30.8-64.fc11.x86_64 #1 SMP Fri Sep 25 04:43:32 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux [root@ehoffman plugins]# pwd [...]

Continue Reading

10 January 2008 ~ Comments Off

Java compound interest calculator

TweetI wrote a thing to calculate compound interest and print out how much you’ve accrued after each period. It’s pretty basic but I was bored and didn’t want to do it via calculator. The code is in InterestCalculator.java, sample output is below: Initial principal: 5000.00 Interest rate: 0.05 (4.93%) # of ann. periods: 4 Total [...]

Continue Reading

Tags: , ,

28 March 2007 ~ Comments Off

Java utility to reorganize photos by date taken (via EXIF metadata)

TweetEdit: I’ve moved this code to github (https://github.com/evandhoffman/JPEG-Organizer). I recently modified it so it won’t move duplicate files – if you have a file named IMG_0012.JPG in the target directory already, it will calculate the SHA-1 sum of the source & target files. If the files have the same hash (i.e., they’re identical files) it [...]

Continue Reading