Posts Tagged ‘java’

How does matlab’s popularity stack up in a PYPL google trends comparison?

Thursday, February 27th, 2014

Java still reins as the most popular programming language according to many metrics including PYPL. This compares [language] tutorial searching trends on google. Matlab sits comfortably at the level of Ruby, below Python but above the decling Perl.

Workaround for broken pdftk burst

Friday, August 23rd, 2013

The macports version of pdftk seems to be broken when using the burst command:

pdftk input.pdf burst output page-%02d.pdf

Is supposed to split apart a multipage pdf into single pages but instead produces a Java runtime exception:

Unhandled Java Exception:
   at com.lowagie.text.pdf.PdfCopy.copyIndirect(pdftk)
   at com.lowagie.text.pdf.PdfCopy.copyObject(pdftk)
   at com.lowagie.text.pdf.PdfCopy.copyDictionary(pdftk)

To get around this I wrote a short script. Save the following in a file called

if [ $# -eq 0 ]
    echo "Usage:"
    echo "  pdftkburst input.pdf output-%04d.pdf"
    return 1

NUM_PAGES=`pdfinfo $1 | grep Pages: | sed -e "s/ *Pages: *//g"`
for i in $(seq 1 ${NUM_PAGES})
  #echo "printf \"$2\" $i"
  PAGE_NAME=`printf "$2" $i`
  pdftk $1 cat $i output $PAGE_NAME
  #echo "Creating $PAGE_NAME"

Then you can burst your pdfs using:

./ input.pdf page-%02d.pdf

Which indeed creates page-01.pdf, pages-02.pdf etc.

AJX MassMailer source

Monday, March 26th, 2012

ajx mass mailer splash
I decided to release the source code of an old project of mine. It’s a simple Java app that handles batch/scripted emails to large numbers of recipients using your gmail/yahoo/etc. account.
The idea is you load/fill in a table where each row is a recipient and each column is a piece of corresponding data about that recipient. Then you can write a template email that gets sent to each recipient, pulling the relevant data from each row of the table.
ajx mass mailer screen shot
Project page
Source as zip

Real time tester

Thursday, July 22nd, 2010

I’ve adapted an old applet to function as a real time tester. The idea being that you hear a new graphics algorithm is “real-time” or “interactive” because it runs in only “59ms” per frame, but your internal clock isn’t accurate enough to really know what that feels like. Here you can specify the simulated “solve” time and drag around the bezier curve as if hard-core math is going on between frames.

Letter and character frequencies of Faulkner and Hemingway

Tuesday, April 6th, 2010

As a freshman at college I took a class called, Randomness and Chaos taught by Mark Nelkin. During the section on power law probability distributions, I remember becoming obsessed with trying to find these in nature. Later when a learned only a little Java programming, I wrote a (albeit horribly inefficient) character frequency counter program that I ran over plain text versions of William Faulkner’s The Sound and the Fury and Ernest Hemingway’s The Old Man and the Sea. I made some charts with the intention of adding the to the letter frequency wikipedia article, but the wikimilitia users removed them citing that they were “original research”. Hardly, I thought. Hardly more than snapping a picture of John Kerry holding a baby is original research.

Anyway I repost them here, so at least I know where to find them and because I think they are an interesting seed to the discussion of recognizing authorship by certain frequencies in their writings (probably not of characters). Also, it is nice to examine these distributions “in nature”.

Latin letter frequency in The Old Man and the Sea

relative letter frequency of the old man and the sea

Latin letter frequency in The Sound and the Fury

relative letter frequency of the sound and the fury

Latin letter frequency in English

relative letter frequency of English
from wikipedia.

Character frequency in The Old Man and the Sea

relative Character frequency of the old man and the sea

Latin Character frequency in The Sound and the Fury

relative Character frequency of the sound and the fury

The character frequencies exhibit much more of a power-law distribution than the letters, mostly because of the space character and the uncommon punctuation marks and digits.

Bézier Curve editor applet

Thursday, February 4th, 2010

B├ęzier curve editor
This Bézier curve editor is the first applet I’ve written for my Geometric Modeling class. It implements De Casteljau’s algorithm to render the curve recursively and the Graham scan method for determining the convex hull of the control points. I also implement elevating the degree (by adding another control point) of the Bézier curve without changing the curve.

Compile and run applet with just java file, bash script

Monday, February 1st, 2010

I had the habit of creating little bash scripts for each java applet I worked on. These were such boilerplate, not to mention the boilerplate html for each applet. So here’s a script the takes the main applet file as a parameter and compiles the code, creates some html on the fly and runs the applet:

# Usage:
#   ./

base=`echo $1 | sed "s/\.java$//g"`;
if javac -source 1.5 -target 1.5 $; then
  if [ ! -e $base.html ]
    echo "<applet code=$base width=600 height=600></applet>" | cat > $base.html
  appletviewer $base.html

Clock design take 2

Saturday, January 9th, 2010

After a friend showed me the Raphaël javascript library, I immediately wanted to rewrite my
old java geometric clock prototype applet into a new javascript version.

Here it is:

New Clock Design

Wednesday, December 2nd, 2009

I’ve made a new digital design prototype for a physical clock I plan to build.
Here’s a preview of my geometric clock prototype in action:

Here’s a preview of my geometric clock prototype frozen:
geometric clock design prototype

Image of close packing of spheres, ray tracer screenshot

Monday, November 9th, 2009

Thought there’s no point keeping this image to myself. I rather like. It’s just a screenshot of my sphere packing ray-tracer applet taken on a big monitor connected to my new mac (I of course went fullscreen). Someday I’d like to let my CPU run at an even higher resolution picture (not bother with the video output, just save a file). When that day comes, I will surely post the results.

Anyway, here’s a nice picture of close packed spheres with smaller spheres filling the voids between:
spheres packed with smaller spheres filling voids

Update: I was thinking, also, it would be nice someday to add an opacity slider. It would be interesting to see the packing with translucent spheres…or maybe just really confusing.