January 7th, 2009

Trajedy... for YOUUUUUUUUUUUU!!!!

On the use of your tax dollars.

I don’t even know that people inherently object to taxes - I think they object to taxes most when they feel they’re getting a bum deal. As a friend put it the other night, he gives a third of his check and in return gets a police state that could kick down his door and bust him for smoking pot at literally any moment. And he doesn’t see much other benefit from his taxes.


He forgot, "Wage unjustified wars of naked aggression, killing thousands of American soldiers and tens of thousands of innocent Iraqis."

I'm always happy to see 30% of my paycheck go towards that. Aren't you?

How to (fairly) easily play sound in Java - WITHOUT leaking memory or threads.

import javax.sound.sampled.*;

public class SoundPlayer
    static private AudioCleaner cleaner = new SoundPlayer.AudioCleaner();

    static public class AudioCleaner
        implements LineListener
        // Need to catch STOP events and close() or else we'll leak threads.
        public void update(LineEvent le)
            if(le.getType().equals(LineEvent.Type.STOP)) {

    public static void playSound(String filename)
        try {
            AudioInputStream astream = AudioSystem.getAudioInputStream(new java.io.File(filename));
            DataLine.Info info = new DataLine.Info(Clip.class, astream.getFormat());
            Clip aClip = (Clip) AudioSystem.getLine(info);
            aClip.start();          // Can also .loop()
        catch (Exception e) {

You would not believe how difficult it is to arrive at this code. It's taken me all afternoon to get it right.