Sample Map Builder 2

I’ve been building this on and off for quite some time but just don’t ever have enough time to finish it up, so rather than just letting it rot on my hard drive for a few more years i’ve put the source up on github.

There are builds available for Win and OSX here :

and a PDF manual here :

It is totally usable in its current state, but please feel free to clone the git repo and make it better, i’ll happily accept pull requests. :)

The repo is here :

OSC – Open Sound Control

For some reason, MIDI isnt dead yet, although it is indeed ‘ubiquitous and lightweight’ that doesn’t mean it should stick around. For some tasks its fine, but its definitely starting to show its age. One of the alternatives for communication between audio / video software and devices is Open Sound Control – OSC.

Im not going to go into a deep discussion of MIDI vs. OSC at this point, there are of course some benefits to MIDI which OSC should deal with in some way (e.g. a standardised namespace for representing MIDI semantics, or a discovery mechanism for that namespace..)..anyway, I just want to let you know that I’ve been working on some OSC related stuff to make using it easier from both Actionscript 3 and Max/MSP.

First up is OSCLib, this is intended as a low level set of OSC libraries which you can use in other applications. Actionscript 3 doesnt have UDP, only HTTP sockets whereas most OSC implementations (e.g. Reaktor, Bidule) are UDP based although one notable exception is SuperCollider which supports both. So to help bridge the gap there are java implementations for both HTTP and UDP clients and servers (well, the UDP server is currently missing but should be done in a day or two..)

For Max/MSP there is an MXJ object which wraps the HTTP server so you can send messages from a Flash / Flex client directly to Max/MSP.

There is some documentation on the project wiki pages for getting your dev environment setup and also a Flash / Max demo you can try out.

As a side note if anyone has a Korg Kontrol49 then i’ve also got a project based on OSCLib for working with the Kontrol49 in native mode : KontrolTools. This allows you to have full control of the lights and text displays via OSC as well as generate OSC message from all the knobs, sliders and buttons.

Java and zip files

I’ve just spent a day debugging what at first appeared to be a permissions problem. Im using the jakarta commons file upload with a tomcat / spring setup to allow users to upload zip files, which are then unpacked and the contents are processed into a database. Obviously using a zip should make it easier to upload multiple files and directory structures.

What was happening is that the directory entries I expected to be in the zip werent being created, so none of the files could be written when it was unpacked. Eventually i discovered that the problem was related to how different tools create zip files. I use winrar, which creates a seperate entry for a directory, as luck would have it the tool my client was using doesnt.

So, if you are writing java code to unpack zip files you will be better off doing something like this :

Enumeration entries = zip.entries();

    while (entries.hasMoreElements())
        ZipEntry zipEntry = (ZipEntry) entries.nextElement();
        File file = new File(outputDirectory, zipEntry.getName());

        // check the parent of this entry to see if it exists

	InputStream is = zip.getInputStream(zipEntry);
        FileOutputStream fos = new FileOutputStream(file);

	while (is.available() > 0)


rather than just checking if zipEntry.isDirectory() and then doing a mkdir.

Of course its wise to do both, because the zip may contain empty directories and you might rely on them being present later on.

SWT and Flash

I’ve been thinking about ways in which to use flash within eclipse and had considered using XML Sockets, but after reading the API docs for the SWT Browser I noticed that you can execute javascript functions by calling the execute method (funnily enough), and I already knew about the Flash / Javascript Integration Kit. So I knew i could send messages from java into flash, but how could i get information the other way?

Fortunately I noticed that the SWT browser allows you to listen for changes in the status text, so as a proof of concept I made a little project. Its nothing too exciting, but it shows how you communicate both ways and with a bit more work and some clever serialization I should be able to pass some rudimentary data types back and forth.

If you want to have a play you can download a zip file of the eclipse project here.

You’ll need to make sure the SWT library is on your build path to get it to compile. I’d be interested to hear if anyone has any problems using this, or if anyone makes any interesting additions to the code so we can do more complex java and flash communication within SWT.

Source code searcher

Im writing my first RCP application at the moment and with any new programming challenge im having to do a lot of searching through help files and on the net. As you all know, sometimes an example is worth a 1000 articles, so finding the Koders site has been a real blessing. They even have an eclipse plugin so you dont have to leave home to find out how others are using IWorkbenchWindowActionDelegate. :)

Definitely worth adding to your toolkit.

Spring 1.2.4 released and Spring IDE

Its a good week for Spring users. A new version of the framework was released, its now 1.2.4. As always its worth reading through the changelog (or is only me that finds these interesting?)
Also for Eclipse users theres a new version of the Spring IDE which features a preview of the Beans XML editor, built on top of the Eclipse Web Tools Project or WTP to add another acronym to the never ending list.
I’ve installed the WTP from the complete bundle rather than dumping the plugins into my current setup. Im just finishing a big project at the moment so I didnt want some pre V1 tool to clart my nice working setup and leave my crying over my keyboard. I havent spent much time with it yet, but its looking good and will hopefully stop the never ending search for a good and free jsp editing plugin, among other things.

Full integration of the beans xml editor file with Eclipse will be a great brain saver from switching back and forth between the code and the config file. You cant beat a bit of auto-complete. If life came with CTRL-Space (and some nice templates) it’d be a damn sight easier.

What would really sort out my server development is that kind of integration for the openamf configuration file. I’ve considered some way of using xDoclet to generate the configuration, and may well experiment with that this week. Maybe by using a combination of xDoclet and the j2as project started by Ralf Bokelberg and the whole process of keeping the value / transfer object code in sync between java and actionscript will become fully automatic. Oh, and generating the advanced gateway definition from the service facade along with an actionscript interface would be damn handy. One thing that bothers me about using remoting as it comes (i.e. without a wrapper around the service object) is that you dont get any compile time type checking on your service method calls. If i can generate the service interface in actionscript that will save a lot of flicking back and forth between the java and as code. nice.

If anyone makes one before me, please let me know.