Seeing Sound

Ernst Chladni invented a way of visualizing the vibrations on a metal plate by sprinkling sand on the plate and making it vibrate using a violin bow. The sand scatters and collects at the places where the plate is not vibrating (the nodes of vibration), creating a fascinating family of visual patterns. The images below are artistic renderings of some of the many possible patterns. See more at the U Of T Physics Department and more gory details on the math from Paul Bourke—including some visualizations of what Chladni patterns in three dimensions would look like.

[Unfortunately, I haven’t yet found a good applet which demonstrates this behaviour. (Sounds like a perfect project for proce55ing!) If anyone knows of a nice visual demonstration, please let me know and I’ll update this entry.]

Not In My Name

Today, for the first time in my life, I am deeply ashamed to be Canadian. Prime Minister Stephen Harper is publicly defending Israel’s destruction of Lebanon, so let me make one thing perfectly clear: he does not speak for me. (I sincerely hope he does not speak for most Canadians, but only time will tell.)

Any state which commits war crimes must be condemned in the strongest possible terms by all civilized nations. There are no excuses; no justifications; no rationalizations. There is no special dispensation for Israel (or America) which would permit it to systematically destroy nations, lives, and hopes in flagrant defiance of international law and common human decency. While I wish no ill on the people of Israel, they can freaking well defend their own actions without any moral cover from us.

flames >> /dev/null

Why Spring?

Mark Petrovic asks: “Can you say a bit about why you are using Spring in this overall context?”—referring to my earlier post on configuring JXTA with Spring.

I suppose the reason is that over the last few years I have written several servers, mostly experimental prototypes. I quickly got tired of writing and maintaining the large amounts of “glue” code needed in almost every situation: where and how to get application configuration constants and preferences; where and how to specify which implementations of an interface to use in some particular case; etc. Then one day I picked up Rod Johnson’s Expert One-on-One J2EE Development without EJB which, in addition to being a thoughtful critique of Java architecture-as-usual is also a good introduction to Spring.

I built my next server with Spring and have never looked back. In fact, it’s so useful that I don’t consider it only for servers anymore. It’s lightweight enough to use for just about any purpose. Also, if I have to write a web application, I prefer the design of Spring MVC to Struts. And when you throw in the fact that you get declarative transactions and aspects, caching with EHCache, and countless other goodies with virtually no effort, it’s almost too good to be true.

So…I’m writing a fairly complex JXTA application (not a prototype this time) and Spring was the natural choice to make that as pain-free as possible. I hope that answers the question. I’m not by any means a Spring expert. It solves a lot of problems I encounter again and again, but it does a lot more that I haven’t even discovered yet. I will also add that it’s the best designed and written piece of code I’ve seen in many years. Just reading through the source you can learn a lot about how to craft great software.

Configuring a JXTA Peer in Spring

Important update: This article is old and out of date. This method will no longer work with the current version of the JXTA platform. I am looking into what changes might be required to the platform and/or the example. I’ll post the results in a new entry and link to it here when it’s ready. I notice many people searching for JXTA+Spring configuration and landing here. Sorry for the inconvenience. VW, 23/07/2008

The new net.jxta.platform.NetworkConfigurator class provides a clean and straightforward way to configure an instance of the JXTA platform without a UI. It can be used programmatically (see the main() method for an example of stand-alone use) or—because it is a Java Bean—declaratively deployed inside containers like Spring.

Here is a simple example of a Spring context file, applicationContext-rdv.xml, which configures a Rendezvous Server:

            My Infrastructure Group
           com.mycompany RDV1
           Rendezvous Node


And here’s what might look like, in part:

public class MyJxtaBean {

    private NetworkConfigurator netConfig;
    private PeerGroup infrastructureGroup;
    public MyJxtaBean() {}
    public setNetConfig(NetworkConfigurator netConfig) {
        this.netConfig = netConfig;
    public synchronized void start() {

        * Simplest case, we don't overwrite an existing configuration, nor
        * do we load and alter/ammend it. Only if there is no PlatformConfig
        * available, construct a new one using the bean's properties.
        if (!netConfig.exists()) {
            try {
            } catch (IOException io) {
                System.out.println("Error saving PlatformConfig");
        try {
            infrastructureGroup = PeerGroupFactory.newNetPeerGroup();
        } catch (PeerGroupException pge) {
            System.out.println("Couldn't create NetPeerGroup");

Now all your applicaton has to do is get the MyJxtaBean from the context and call start() to start the JXTA platform.

    applicationContext = 
        new ClassPathXmlApplicationContext("applicationContext-rdv.xml");
    myPlatform = (MyJxtaBean)applicationContext.getBean("myJxtaBean");

There’s more to writing a JXTA application, of course, but I hope this example demonstrates how NetworkConfigurator takes some of the mystery out of JXTA plaform configuration, while making it easy to combine JXTA and Spring.

Update: April 10, 2007 Christopher Marsh-Bourdon points out a flaw in this example when used with Spring 2.0.1. It’s related to the specification of the JXTA home directory. You can read Christopher’s analysis of Spring’s FileEditor Anomaly and solution to the probelm here. Thanks, Christopher.

Radiohead is a Drug (Hummingbird, Take 2)

“For a minute there, I lost myself…”

The second show at the Hummingbird re-affirmed my belief that Radiohead is a drug. To be taken live. As frequently as possible.

The setlist hardly matters, since last night was not just a bunch of songs strung together, but the creation of texture and atmosphere. Which is what Radiohead does best.

In contrast to Wednesday’s show, the sound was better, the band tighter and more focussed. They seemed to be in more of a mood to rock, and blessedly this time Jonny Greenwood was anything but restrained! My inner headbanger enjoyed every second of the guitar-heavy and anthemic tunes: 2+2=5, Fake Plastic Trees, Climbing Up The Walls, Karma Police, Myxomatosis, Spooks, Paranoid Android, and Just. Even the new songs sounded more aggressive than the night before, and I was reminded that despite the usual emphasis on melody, Radiohead is all about percussion.

Spine-tingling moments:

  • Jonny bent over his keyboards like a mad scientist conjuring a monster Thom on Myxomatosis.
  • Thom’s singing. On everything. Nearly note-perfect and displaying an incredible range of both pitch and character.
  • Kid A and Let Down, the former being a live rarity and the latter I’d never even heard them do before.
  • The premiere of Down Is The New Up.
  • The crowd blissfully singing along to Karma Police—which considering the nastiness of the lyrics was more than a little creepy.
  • Spooks. (Thom Yorke: “What the hell was that?! <laughing>)
  • Jonny playing drums on a new tune as well as on There There.

Now it’s Montreal’s turn. Lucky bastards.

Radiohead at the Hummingbird, Take 1

It’s not that often (actually, it’s pretty much never) that your favourite live act of all times plays two shows literally across the street from where you live. Here’s my capsule review of the first show. (Stay tuned for Take 2, tomorrow night.)

First of all, I’ve never seen them in as small a venue as the Hummingbird (or the O’Keefe Centre for you old fogies). It suited them. The human scale was a nice change from the last show at the SkyDome. This time out, they seemed a lot more like a rock band and a lot less like a super-human machine. Their perfectionism can occassionally be painful, but this time they were pleasantly less rehearsed.

And more relaxed. Thom Yorke actually laughed out loud. Several times. At the audience being goofy. At himself, even—for completely flubbing the start of a song. Most Toronto fans still remember the tantrum he threw over forgetting the lyrics to Talk Show Host at Maple Leaf Gardens a few years ago.

The crowd was…enthusiastic. To the point that Yorke had to ask the audience to settle down so he could sing Exit Music. It was pretty funny listening to the crowd shushing and yelling at each other to shut up. Everyone was on their feet the entire night, and I’ve heard less cheering volume from much larger crowds.

As for the music…well, I don’t have a good enough memory to give a full set list. They opened with You And Whose Army, followed by National Anthem and Morning Bell. I sorta lost track after that. There were a lot of new songs, none of whose titles I can tell you, but several of them were great ensemble tunes. Jonny Greenwood is my guitar hero, so the feedback frenzy on Airbag was highly appreciated, as were those lovely god-awful crunches on Morning Bell. Jonny seemed a bit restrained tonight. He had some equipment problems, but made up for it by playing his guitar like a cello (yeah, with a bow) on Pyramid Song. Some of the other things he did with his guitar I can’t even describe. :-} Thom Yorke’s voice was in fine form as usual. For the first time ever, he played a drum kit along with Phil on one of the new songs. And his crazy stage dancing gets better every year…

They did a lot of old standby live favourites, as well as some odd ones, like a hyped up version of The Gloaming, and the ballad How To Disappear Completely. At least one old tune they rarely play, Street Spirit, was a 12-string treat. About the only thing I regret not hearing was My Iron Lung, because I love Jonny going wild on that one. They did two encores and closed with Everything In It’s Right Place. I’ve heard them do that tune much better, but it’s still a great way to end a show.

Well, I’m looking forward to doing that all over again tomorrow night. If they follow the pattern of the previous shows in Boston and Philadelphia, the set list will be completely different, and there should be fewer equipment glitches. If you’ve got a ticket, you’re gonna love it.

The Blessed Sound of Silence (Thanks, Bose!)

As the name of this blog suggests*, low-frequency machine noise drives me bug-fucking mad. Well, now I’m in (silent) heaven, having just bought a pair of Bose QuietComfort 2 noise-cancelling headphones.

photo of headphones

If low frequency background noise stresses you out, I highly recommend these gadgets. They’re designed to eliminate engine noise in aircraft cabins, but they also cancel things like: idling busses, trucks, and generators; a fair bit of machine fan noise (not all); and of course…fridge compressors. You can still hear people talking and the phone ringing and all that other stuff you don’t want blocked out (unless you’ve got them plugged into your iPod, that is.) For city-dwellers, they’re a must-have. Possibly the best—and healthiest—toy I’ve ever bought myself.

*And you thought it was a reference to Radiohead, didn’t you? Well, even though it isn’t, I am definitely a fan. See you at the Hummingbird Centre Thursday night!

Posts and pointers on software, art, math, noise, and other obsessions…