2009-04-15

Caprica Pilot: They had Linux, DocBook and Windows on Caprica! (The Cylons probably rebelled after trying DocBook)

So now that BSG is gone, we can turn to the new Caprica series for our murderous Cylon fix.

I saw the first episode tonight and although the first fifteen minutes scared me a little (Oh no! It's The OC in space!) it got a little better after that and I think it's promising; the musical score by Bear McCreary was top notch as always. I love how they finally flipped the bird at Star Trek TNG 15 years after it ended: Screw you Gene Roddenberry - if we had holodecks, sex, drugs and indulging murderous fantasies are EXACTLY what we'd use them for. Recreating Sherlock Holmes stories or a spa with mud baths staffed with creepy clowns? Not so much.

Oh and I noticed this (large version linked): they apparently had DocBook, Linux and some old version of Windows on Caprica:
They had Linux, Windows and DocBook on Caprica!

2009-04-13

CampfireJ: a Java API for posting to 37signals' Campfire

My team at work has been considering trialing the Campfire app for intra-team communication. I've played with it a bit and so far I like it (a lot), but as with anything, adoption by the team is going to be the make-or-break factor.

I found myself wishing, though, that I had a way to post messages and notifications to Campfire chatrooms from the command-line or from Ant build scripts, used by our continuous integration system. There's a Ruby Campfire API already, but that doesn't really help me. So I wrote a simple Java API this weekend that posts messages over HTTP, with the self-imposed requirement it should have ZERO external dependencies outside the JRE. It's up here on Github and called CampfireJ; license is WTFPL.

Programmatic usage should be pretty easy to figure out, and the javadocs will be generated by the build, but what I want to call attention to here are the command-line interface and the Ant task.

Command-Line

Once you have campfirej.jar, you can use it directly as a command-line app like this:

$ java -jar campfirej.jar -u user -s subdomain -p password -r "Room 1" -m "Hello world" [--paste]

This will send the message "Hello world" to the room "Room 1" on your Campfire subdomain. I'm using this from a script for Out-of-Office notifications, you can easily find other uses. I think a useful addition to the program would be to allow omitting the -m argument and reading stdin for messages, that shouldn't be too hard to add.

Ant script

The real reason for hacking this together was so I could send Campfire notifications from a CruiseControl build/CI system, so I had to support sending from Ant.

Here's a sample invocation from a build script:



<project name="campfirej-ant-test">
<taskdef
name="campfirej"
classname="ca.softwareengineering.campfirej.ant.CampfireJEcho"
classpath="_dist/campfirej.jar"/>
<target name="test">
<campfirej
user="ant@example.com"
password="mypassword"
subdomain="campfirej"
room="Room 1"
failonerror="false"
paste="false"
message="Hello from ant" />
</target>
</project>

Cheers, and contact me with desired improvements, the library is just a few hours old so obviously it's not fully-featured yet.