DreamHost migrated me to a 64-bit server about a week ago, which broke the Mercurial build I was using to host some repositories. Just got it up and running again (and upgraded to 1.6.4 along the way), and now that it looks like I’m actually keeping some momentum with this blog, I’ve added a link to the repositories in the sidebar.

Now that I look at it… wow, there’s some old, crufty, ugly stuff there.

Well, anyway, now there’s a link. :)

Leave a Comment

Editing comfort

Emacs is on my long list of things that I love in theory, but in practice have only the most tenuous of grips on. (See also: Go, wine tasting, Fourier analysis. Also, I know I ended a sentence with a preposition. Suck it up.)

So – and I say this with all love and in spite of my new year’s resolution – Eclipse with Counterclockwise? So much easier to use than Emacs with SLIME. Almost certainly less powerful, but for the purposes of learning a language, I do not care.

Comments (615)

Closures in Java (as opposed to Clojure, which… nevermind)

Last time I worked with Java was before my Lisp days (or at least various attempts to get into Lisp), so I’m looking at it again now with a different context. So when I came across this use of an anonymous class in Effective Java (comments removed for brevity – bad practice shut up shut up):

static List<Integer> intArrayAsList(final int[] a) {
    if (a == null)
        throw new NullPointerException();

    return new AbstractList<Integer>() {
        public Integer get(int i) {
            return a[i];

        @Override public Integer set(int i, Integer val) {
            int oldVal = a[i];
            a[i] = val;
            return oldVal;

        public int size() {
            return a.length;

…my first thought was “waaaitaminute… Java has closures?

Now, it took a while for my memory of these things to come back, and a bit of searching to fill in the gaps… it turns out Java doesn’t quite do closures (it doesn’t work with non-final variables because it actually copies them behind the scenes), and at any rate there’s still the whole anonymous class mess instead of first-class functions (which I’ve always found annoying).

Then, it turns out that there’s a proposal to get first-class functions and lambda expressions in Java. And not from some random functional programming fanboy, but taken seriously by Sun and at one point planned for inclusion in Java 7 (it’s now deferred to Java 8).

All of this makes me wonder though… How does Clojure implement closures? Does it have some roundabout way of doing it that could mess up performance in opaque ways? Or is the JVM really that much more flexible than the Java language lets on? Or is Clojure a completely degenerate Lisp dialect?

Apparently I’ve got more reading to do.

Leave a Comment

If you’re going to throw peanuts, throw them at me

We don’t always talk about who comes up with what behind the scenes for Darths & Droids – and in fact I haven’t been as involved in writing lately anyway – but I do feel the need to claim credit accept blame for the atrocious pun in strip 475. (Click here to ruin the joke.)

According to our wiki, I suggested it on March 11, 2008. So the guys have had over 2½ years to veto it. I consider that a failure on their part.

Leave a Comment

Perlin noise applet

Here, have some Perlin noise.

Drag to rotate and change the rate of bubblyness.

This is just some random stuff that I’ve been messing with to get back into the swing (pun intended?) of Java. The code is embarrassingly ugly so I’m not going to put it up it in its current state.

(Note: Java 6 update 21 doesn’t play nicely with something in a non-obvious way.)

(Note 2: In fact it seems to be not working on a wide variety of machines. There could be multiple issues here. Hmm.)

(Note 3: Possibly it just needs a newer version of Java than I’m using at work. I’m starting to re-discover my old impression that OpenGL in applets is more trouble than it’s worth.)

(Note 4: You know what, I’m sick of this asking for security permissions and whatnot every time the front page loads. The applet is moved below the fold. Continue at your own risk.)

» Continue reading “Perlin noise applet”

Leave a Comment

Java and whatnot

It’s been about six years now since the last time I had a job that involved writing Java. Since then I’ve pulled it out occasionally for toy projects, but that role has been taken over lately by Python (although not for anything heavily numerical).

In the last couple of weeks I’ve started playing around with it again, for a confluence (pun partially intended) of minor reasons:

  • Android. When I got my HTC Hero last year, I’d always planned to dabble in app development, but never got around to it. Now that Tina has a Samsung Galaxy S (a genuinely awe-inspiring phone, by the way), it’s become interesting again; that, and I actually have an idea for a project (more on that later).
  • When I started looking into Lisp, I read a bit about Clojure, a Lisp dialect that compiles to the JVM. At the time, it seemed like a bit of a fringe project, albeit a cool one. Now that I’ve gone through the Common Lisp thing and concluded that its biggest problem is the available compilers, a more modern take on a well-supported platform with solid standard libraries is starting to sound appealling.
  • Other stuff that I won’t talk about yet. Ssshhhh!!!

Leave a Comment


Haven’t been blogging much because we’ve just moved, and before that we were on our honeymoon, and before that we were getting married, and before that we were planning a wedding and a honeymoon, all of which was a bit of a time sink. As a result I haven’t done much programming, apart from work, which as usual I can’t talk about.

Although, today I implemented a heap from scratch in C for the first time in a while. It was therapeutic, somehow, to be doing low-level algorithmic stuff.

Leave a Comment

Vye Mini-v S37

So my Vye S37 just arrived. It came with Vista on it; I booted it once (actually about three times, after it did all its setup-reboot-repeat shenanigans… sheesh) to check that it worked, then booted Ubuntu 9.10 Netbook Remix from a USB drive.

Here’s a list of what works in UNR out of the box:

  • Everything.

Okay, technically I don’t know that everything works – I haven’t tried Bluetooth or the card reader or most of the buttons on the display (in fact I suspect that at least the screen rotation button will need some custom fiddling), but the two main things that other people seemed to have trouble with in older versions of Ubuntu – WiFi and the touchscreen – work beautifully. Well, I haven’t tried to use WiFi yet, ’cause all the routers around me are locked, but it can see them.

I am well pleased. I’ll post some thoughts on UNR after I’ve played with it for a while.

Ah… Just noticed that the touchscreen doesn’t quite go to the edge of the screen. I can live with that. If that’s what everyone else is complaining about then, frankly, what a bunch of whingers.

Edit: Oh, I see, menus and whatnot are at the edge of the screen, which makes the touchscreen thing important. Well, I found the touchscreen maker’s site the other day and they seemed to have well-maintained Linux drivers (there’s an installer for the last several Ubuntu versions, including 9.10), so I’ll see what can be done about it later.

Comments (268)

iPad Substitute

I seem to have developed a pattern of buying alternatives to Apple’s flagship products.

Instead of getting an iPod, I bought an iriver. Part of the rationale was that it supported Ogg Vorbis. It also turned out to be chunky and awful and churn through AA batteries, but meh.

I deliberated for a while about getting an iPhone, but on the verge of making the decision there was some controversy or other about the app store, which pushed me over the line to go for the Android-powered HTC Hero instead. The idea of an open platform for app development appealed to me enormously. So far I haven’t actually done any of said development, but it’s nice to know that I could in theory.

I don’t actually have a problem with Apple, and in fact I think their focus on a simple, seamless UI is something that should be imitated far more often. But being a geek, I actually like something with a few visible seams, because they can be picked apart. Like Shamus, I’m not really their target market.

Anyway, less than a week after the iPad announcement, I find myself having bought a Vye Mini-v S37 at auction. Notionally the idea is to have something small and light to travel with, especially on our honeymoon in May – an argument supported by its the fact that it has a CF card reader, will let me dump photos onto it. But really I just thought it was cool. Obviously I’m planning to put Linux on it (probably Xubuntu)… although I can’t find anywhere that explicitly says that someone’s tried that and everything works, which means that it could be… interesting. It’ll be disappointing if I’m stuck with Vista.

So the relevance of this to a blog about software and stuff (other than the fact that I’ve been otherwise occupied with work and wedding plans and the box set of Buffy and am struggling a bit to find something to write to break the silence) is that I’ll be posting some updates on how Linux holds up in the tablet-netbook-thing niche.

Update: Apparently the Vye S37 is also sold as the Kohjinsha SH8. That link is to a blog describing an attempt to get Ubuntu 7.10 working on said Kohjinsha (and I thought this blog was too topic-specific :) ). So it looks like the problems, if I have them, will be WiFi and the touch screen… although I’m also quite optimistic about Ubuntu’s progress over the intervening two years.

Update 2: The Ralink RT73 WiFi adapter allegedly works out of the box in 9.10. Should be okay on that front.

Comments (8)

n-queens Mexican Standoff

The first day back at work has proved fruitful in the form of someone coming up with the opposite of the traditional n-queens problem: the n-queens Mexican standoff. Instead of minimising the number of mutually attacking queens (to zero), the objective of the standoff version is to maximise the number of attacks.

We haven’t done an exhaustive search yet, but I’ve been running a simulated-annealing-ish script for a while, and it looks like the most attacks is 34 (17 pairs of mutual attacks), in two configurations:

QQ.    .QQ.
QQQ    .QQ.

…either of which can be expanded by adding gaps between the queens, or rotating by multiples of 45 degrees.

Q.Q..   .Q.Q.   Q...Q..
.....   Q.Q.Q   .......
Q.Q.Q   .Q.Q.   ..Q...Q
.....   ..Q..   .......
Q.Q.Q           Q...Q..

Update: Python code below the fold.

» Continue reading “n-queens Mexican Standoff”

Leave a Comment