Skip to content


CheckStyle IDEA 3.0 Release

After a long long wait, I’ve finally bit the bullet and released CheckStyle-IDEA 3.0.

What is it? Integrated real-time and static CheckStyle scanning for IntelliJ IDEA 7 and 8.

What’s new in 3.0?

  • CheckStyle 5.0 support (thanks to jicken)
  • Per-module configuration support
  • Severity filtering on result list.

Please note that you will need to reconfigure the plugin, due to changes in how we store configuration information. Annoying, but it was necessary to support multiple configuration files.

As always, you can find it in the IntelliJ Plugin repository. And please throw any bugs you find into the issue tracker.

Posted in Development, Software.

Linux love for TeamCity

For far too long we’ve been running our TeamCity build agents on Windows 2003 Server. This was, originally, driven by necessity. We were using Selenium, and out client cared only for a single browser: Internet Explorer. As time progressed we decided Selenium was costing us more than we received from it, so we dropped it. And so we ended up using Windows to build for historical reasons only. And, of course, inertia.

So, over the last day or two, I’ve been building up replacements. Our build box is actually a PowerEdge 1950, split into two machines with the aid of VMWare ESXi. So I hacked together a build agent on VMWare Fusion to use as a template, copied it onto ESX, and set it spinning.

This was the point I got a kick in the arse. We were using Ubuntu 8.10 64bit – and ESX didn’t like it one bit. So I dragged a LCD and keyboard up to the server room and had a nose in the BIOS – sure enough, Dell had left VT off. Bloody Dell. I took advantage of the visit to hack SSH on in ESXi and headed downstairs.

No luck. Same error.

An hour later I stumbled on the solution. The VM had paravirtualisation turned on. Paravirtualisation, apparently, only supports 32bit hosts. Off went paravirtualisation and on went the build server. Win!

So, victory, one less Windows server, and once more a severe wish that VMWare would produce Infratructure Client for either Linux or Mac OS X.

That wasn’t all I learnt of value, however. JetBrains are good enough to tell you how to start TeamCity automatically on Windows (via a server) and the Mac (via launchd) and complete omit Linux. So I went and found out about Upstart.

End solution: create the scripts below in /etc/event.d. They’ll run on startup/shutdown, and can also be started manually using:

sudo start [start|stop]-teamcity-buildagent

/etc/event.d/start-teamcity-buildagent

start on runlevel 2
start on runlevel 3
start on runlevel 4
start on runlevel 5

console output

script
	exec su -l buildagent -c '/opt/build-agent/bin/agent.sh start'
end script

/etc/event.d/stop-teamcity-buildagent

start on shutdown

console output
script
	exec su -l buildagent -c '/opt/build-agent/bin/agent.sh stop'
end script

Posted in Development, Linux, Work.

Building Java 7 on Mac OS X

Update 26/5/9: Updated for last night’s source with the JIBX libraries, and note on the version of XCode.

So, I’ve just got my laptop back after a brief separation. What does one do?

Compile the JDK, of course!

For those unfamiliar with the situation, Apple hate Java developers. Well, one suspects they do. Apple being Apple, one never knows. We could get Java 1.6.0_12 with 32bit support tomorrow, or it could never come. You’ll never know until it appears.

Luckily, Landon Fuller loves us. Which Apple play with their iPhones, he beat the OpenJDK into submission on OS X. Only drawback – Swing is X11 based. But still, it’s JDK6 for 10.4, 10.5 and in both 32 and 64bit, and available as SoyLatte.

This work has all found its way back into the trunk, and so JDK7 is buildable on the Mac (usually). The only catch: the instructions are scattered, and often vary slightly. So I’m documenting them here for tonight’s build, mostly for my reference.

Thanks go to Landon Fuller and Stephen Bannasch for putting these together.

1. Get version 3.1 (or above, presumably) of XCode.

2. Download SoyLatte. I found the JDK7 build Landon released in 2008 did not work as a bootstrap.

3. Get Mercurial

sudo port install mercurial +bash_completion

4. Install the Forest extension

hg clone http://bitbucket.org/pmezard/hgforest-crew

You’ll need to point Mercurial at the hgforest-crew directory, by adding the following to ~/.hgrc:

[extensions]
hgext.forest=/opt/hgforest-crew/forest.py

5. Grab Kurt Miller’s BSD binary plugs:

wget http://www.intricatesoftware.com/distfiles/jdk-7-icedtea-plugs-1.6b.tar.gz

6. Get the JIBX libraries (version 1.1.5) from:

http://sourceforge.net/project/showfiles.php?group_id=69358&package_id=68290

7. Check out the OpenJDK:

hg fclone http://hg.openjdk.java.net/bsd-port/bsd-port

8. Place the following in build.sh in the bsd-port directory (modify as appropriate, depending on where you placed downloaded items):

LC_ALL=C
LANG=C
unset CLASSPATH
unset JAVA_HOME
make \
  ALT_BOOTDIR=/opt/soylatte16-i386-1.0.3/ \
  ALT_BINARY_PLUGS_PATH=/opt/jdk-7-icedtea-plugs \
  ALT_FREETYPE_HEADERS_PATH=/usr/X11R6/include \
  ALT_FREETYPE_LIB_PATH=/usr/X11R6/lib \
  ALT_JIBX_LIBS_PATH=/opt/jibx/lib \
  ALT_CUPS_HEADERS_PATH=/usr/include \
  ANT_HOME=/usr/share/ant \
  NO_DOCS=true \
  HOTSPOT_BUILD_JOBS=2

9. Run, and cross your fingers!

10. I ran into a ld error (archive has no table of contents). Should you hit this, try the following and then rerun build.sh:

ranlib build/bsd-i586/tmp/java/fdlibm/obj/*.a

11. Copy bsd-port/build/bsd-i586/j2sdk-image somewhere useful – and you’re done!

Posted in Development. Tagged with .

Pixels of Doom!

About November last year I developed the afflication that all LCDs owners fear.

Dead pixels.

But not just one. Or two. Rather, I developed a cluster below the screen centre. In my darker moments I wondered if, like the black hole it resembled, it would slowly eat up my monitor, before sucking in my phone, tea, desk, living room…

Needless to say it had to be fixed. Before it was too late.

In reality, ‘too late’ means ‘before the warranty expires’. Which is next week. And given I use my laptop for home, work and as a hot water bottle, I don’t like being separated from it. Further, I’ve heard horror stories before – Ivan in particular told me how his dead pixels had been scorned by Apple.

In any case, I bit the bullet last week and managed to get a Genius Bar appointment. Although it took some time, they agreed it required fixing and ordered the bits. I then dropped my laptop in Friday evening, which the promise it would be fixed in 3 to 4 days.

At 1500 the next day my phone rang. The laptop was ready.

So, for the price of two tube tickets and 24 hours of Windows-only living I have a brand new LCD. Thanks Apple!

Posted in Mac.

Migration

Today, the most romantic day of the year, I finally sorted out this website.

Previously I’d been running Drupal. Drupal has many good features – the problem is that it’s a better community CMS than a single-person blogging tool. Given that I seem to be slowly surrendering control over my tools to the cloud, the lack of export facilities was also a killer. And so I’ve migrated to Wordpress.

Migration did look like it would prove a headache; luckily, I realised soon enough that I could just drag & drop in ecto. I’ve lost the [few] comments, and post categories, but it was otherwise entirely painless. I’ve also given up on my own theme – I’ve just tweaked one of the many nice themes for Wordpress, and saved myself a heap of time.

Polly has had her blog go the whole mile – it’s now hosted on wordpress.com. My own is still on my A2 account, since I’ve already paid for it. However, it’s now a trivial exercise to move it off if I decide to. My photos, links and email are all farmed out – it seems silly to bugger about with web hosting.

Posted in Hosting.

Keyboard Woes

Like many programmers, I’m very picky about my input devices. Particularly about keyboards – both at home and work I use a Microsoft Natural Ergonomic Keyboard 4000. Despite the overly lengthy name, it’s a superb piece of kit and I wouldn’t work without it.

Apple, however, don’t believe in locales outside the US. And so the UK keyboard layout on my MBP is designed around the hacked-together monstrosity Apple consider a UK keyboard layout. Those who have used MacBooks will know this is essentially a slightly hacked US layout, and so it doesn’t help with the NEK4000. Luckily, unlike the rubbish that Logitech put out, Intellitype has been stable and useful for me, and sorted the problem.

Until recently…

At work we’re currently doing Swing development on Java 6. Java 6 for the Mac is 64bit only. And, unlike the 32bit Java 5, the Microsoft Keyboard driver refuses to offer keystrokes to the 64bit JVM. Hence i had to swap keyboard layouts if I wanted to do crazy things such as entering text into our application.

Luckily, Ukulele has saved me. It is a keyboard layout editor for the Mac, and I was quickly able to knock up an appropriate layout. And so I can now happily type sans-Intellitype.

I’ve also dumped LCC and will be trying ControllerMate for my mapping needs. Stay tuned!

Posted in Development, Mac.

Ghosts of the Past

I just stumbled across a misplaced comment:

Dude, can you leave a note that infernus that used to be infernus.org, i now http://infernus.o0o.nu – we lost the domain at some point and I guess it is useless to try to recover it back cheers

So, if you’ve been missing the website in question for the last 20 months, you now know where to go!

Posted in Hosting.

Checking the EDT with aspects

I am unreasonably fond of Swing. While it has plenty of foibles, and brings a new horror to UIs with Metal, it’s nevertheless quite a nice framework to use – once you’re familiar with it.

The problem is that getting familiar is a path strewn with brambles and holes full on punji sticks. One of the bigger holes is the event dispatch thread (EDT) – everything Swing related should take place on the EDT (even initialisation, under the latest Sun guidelines). When you’re trying to keep the UI fluid it’s all too easy to break the rule – hence, aspects to the rescue!

This topic has been covered by many before, including Alexander Potochkin and Anders Prisak – however, I found their solution needed a little tweaking to be used in our environment. In particular, they had missed two cases we cover – SwingUtilities and SwingWorker.

So, here’s the tweaked aspect. safeMethods now includes a few extras.

package org.infernus.swing.aspects;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;

import java.awt.*;

@Aspect
public class EDTCheck {

    @Pointcut("call (* javax.swing..*+.*(..)) || "
            + "call (javax.swing..*+.new(..))")
    public void swingMethods() {
    }

    @Pointcut("call (* javax.swing..*+.add*Listener(..)) || "
            + "call (* javax.swing..*+.remove*Listener(..)) || "
            + "call (* javax.swing..*+.getListeners(..)) || "
            + "call (* javax.swing..*+.revalidate()) || "
            + "call (* javax.swing..*+.invalidate()) || "
            + "call (* javax.swing..*+.repaint()) || "
            + "target (javax.swing.SwingWorker+) || "
            + "call (* javax.swing.SwingUtilities+.invoke*(..)) || "
            + "call (* javax.swing.SwingUtilities+.isEventDispatchThread()) || "
            + "call (void javax.swing.JComponent+.setText(java.lang.String))")
    public void safeMethods() {
    }

    @Before("swingMethods() && !safeMethods() && !within(EDTCheck)")
    public void checkCallingThread(final JoinPoint.StaticPart thisJoinPointStatic) {
        if (!EventQueue.isDispatchThread()) {
            System.err.println("Swing EDT violation: " + thisJoinPointStatic.getSignature()
                    + " (" + thisJoinPointStatic.getSourceLocation() + ")");
            Thread.dumpStack();
        }
    }
}

Once it’s built, we just need to weave it – I’ve already got compile-time weaving configured for Spring @Configurable support, so just add the JAR containing the aspect as a weaveDependency and then the magic happens.

Now, if a Swing call is made off of the EDT, you’ll get complaints:

Swing EDT violation: String javax.swing.JTextArea.getText() (YourSwingClass.java:98)
java.lang.Exception: Stack trace
        at java.lang.Thread.dumpStack(Thread.java:1224)
        at org.infernus.swing.aspects.EDTCheck.checkCallingThread(EDTCheck.java:55)
     ... and so on

Posted in Aspects, Development, Java. Tagged with , .

MPs ensure themselves a friendly recession

While we’ve all been distracted by current events, our Labour government – with the support of the Conservatives – have slipped in an Order to reverse the High Court judgement requiring them to release details of their expenses.

And why wouldn’t they, when previous requests have revealed such delights as £1600 on window cleaning (Barbara Follett, Labour) and the famous £40000 paid to an MP’s son for research (Derek Conway, Conservative).

Luckily, not all our MPs are quite so blind with power to endorse this. In particular, Jo Swinson (Liberal Democrats) today tabled a motion against it, backed by Richard Shepard (Conservatives) and David Winnick (Labour).

So, what can you do? Write to your MP. Luckily, the good people at mysociety have made this easy for you – so please, take the time to do it. And then, on Thursday, check how your MP voted.

Posted in Politics.

Ubuntu LTS scorns your initrds!

We have a number of developer boxes running Ubuntu 8.04LTS at work. For various reasons, we still have a few of the older boxes running Fedora 8, and we’re gradually moving them into the Ubuntu world.

Today we moved two more developers across. One was fine – everything worked, all was good, little elves danced their happy dances and so on. Unfortunately, the other one rebooted and kernel panicked.

Bugger.

The problem – one of the Ubuntu kernel updates didn’t bother to add an initrd line to /boot/grub/menu.lst.

title           Ubuntu 8.04, kernel 2.6.24-23-generic
root            (hd0,0)
kernel          /vmlinuz-2.6.24-23-generic root=UUID=....

The solution: bring it back!

title           Ubuntu 8.04, kernel 2.6.24-23-generic
root            (hd0,0)
kernel          /vmlinuz-2.6.24-23-generic root=UUID=....
initrd          /initrd.img-2.6.24-23-generic

Google provided the answer fairly quickly here, so it seems a reasonably common problem. I must concede I’m a little vexed that a LTS release shows such issues – but still, at least it’s not Vista.

Posted in Linux.