Archive for September, 2004

ICFP Results

Tuesday, September 21st, 2004

As I mentioned previously, I made an entry for ICFP 2004 and today the results were announced. My best result put me in 195th place which I don’t consider too bad for a solo effort (ok, I’m rationalizing, here).

What I did find interesting, however, was the distribution of languages used. Besides the functional programming languages, which you’d expect to find in this competition (such as OCaml and Haskell), it’s interesting to note a few things.

  • C++ is still very popular
  • Java is popular too. Who said it wasn’t used by hackers?
  • Java looks to be more popular than C# in this population
  • Somebody used bash – what a legend

Ok, it’s not a statistically significant sample, of course, and I’ve just highlighted the relative standings of the languages with which I’m most familiar (all you Python and Lisp fans can draw your own conclusions), but it is interesting to see the language choices of a group where I think most of the entrants would consider themselves hackers (or at least people who code for enjoyment)

Java Quiz – Variable and Package Names

Wednesday, September 8th, 2004

Does the following code compile?

public class Test
{
    private String java = "a test";

    public static void main(String[] args) {
        java.lang.System.out.println("hello");
    }
}

(more…)

Orwellian Politics – Australian Style

Wednesday, September 8th, 2004

According to the Sydney Morning Herald, our prime minister, John Howard is quoted thus:

“We are a bare four-and-a-bit weeks out from the election so every statement you make, every claim you put forward to the Australian people has to be accurate,”

War is Peace

Freedom is Slavery

Ignorance is Strength

Changing Ant Log Levels

Monday, September 6th, 2004

I’ve never been a user of Ant’s <record> task. It has a few issues and I don’t find it convenient to use. Record does fill a definite need, however, where you want to debug just a small section of a build file.

I decided to approach this in a different way, with the following small Task

package com.codefeed.cmtasks;

import org.apache.tools.ant.Task;
import org.apache.tools.ant.BuildListener;
import org.apache.tools.ant.BuildLogger;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.taskdefs.Echo;

import java.util.Vector;
import java.util.Iterator;

public class SetLogLevel extends Task {
    private int logLevel = -1;

    public void execute()
    {
        if (logLevel == -1) {
            throw new BuildException("You must specify a log level");
        }

        Vector listeners = this.getProject().getBuildListeners();
        for (Iterator i = listeners.iterator(); i.hasNext(); ) {
            BuildListener listener = (BuildListener) i.next();

            if (listener instanceof BuildLogger) {
                BuildLogger logger = (BuildLogger) listener;
                logger.setMessageOutputLevel(logLevel);
            }
        }
    }

    public void setLevel(Echo.EchoLevel level) {
        this.logLevel = level.getLevel();
    }
}

This code simply finds any loggers listening to the build and changes their logging level. You can use it like this

    <setloglevel level="debug"/>
    <javac srcdir="${src.dir}"
           destdir="${build.dir}/classes"
           debug="on"/>
    <setloglevel level="info"/>

This sets the logging level to debug for the compilation and then back to info. Note that there is currently no way to know what level was in effect when Ant is started, so if someone is running a quiet build you may not be popular.

I don’t know if there is anything out there that already does this but I don’t recall seeing it. I’ll probably put together a few of these utility tasks into a jar and make it available at some time in the future – mainly because I needed to play with the antlib feature in Ant.

Hail Storm

Monday, September 6th, 2004

We had an amazing hail storm in Sydney yesterday afternoon. I’ve never seen anything like it in Sydney, having thankfully been missed by the really damaging storm of a few years ago. At one point, as the hail increased in size we went out to put something over our car and copped a few hailstones to the head. Man, they really hurt. I think this just serves to confirm my feelings about the changes to the climate.

I think that I, like many Sydneysiders, reached for the camera to record the oddity. As I’m still living in the age of film, I won’t get my shots for a little while, so I thought I’d point you all at James’ site which has a nice picture. Time to go digital?