Category: tools

So Long Kenai

A couple of my recent posts have dealt with JSF 2 and Google’s app engine for Java. I was experimenting with this stuff in a small hobby project that was role-playing game related. It’s been benched for another role-playing game related project that I’m going to be writing in C# in XNA, but before I get to that, I want to say a fond farewell to Kenai.

This morning I had an email from the Kenai team in my inbox. Now that Sun is a part of Oracle, it has been decided by the powers that be on the Oracle side that hosting free, open source projects doesn’t help the bottom line. I think this is really unfortunate. Kenai had a really great integration story with Netbeans.

Kenai included free use of Jira, a wiki, Subversion hosting, downloads, and all of it integrated seamlessly with Netbeans. Setting up my project on Kenai was actually a joy. I simply clicked the menu in Netbeans 6.8 to “share this project on Kenai” and everything just worked. When I then went to my desktop from my laptop, I was able to “get” the project from Kenai and it checked it out, allowed me to login to Kenai and look at my jira tasks and modify them within Netbeans.

I haven’t used any other project hosting solution, but I’ve viewed plenty of projects in google code and sourceforge and have yet to see such a complete story. If I had the money to spare for a pet/hobby project I would certainly go to jira studio, but I suspect I’m going to have to find something a little more free to move my project too. I am happy that I didn’t have too much invested in Kenai, but it’s pretty sad that it’s been killed.

So long Kenai, it was good to know you while it lasted.

I just got this email from the Kenai folks. Fortunately, it looks like good news, and I think it will be a great benefit to all the projects on


In an effort to get information out to the Kenai community quickly, while trying to manage the integration of our two companies, I think we did a poor job at communicating our plans for to you. I would like to remedy that now. Our strategy is simple. We don’t believe it makes sense to continue investing in multiple hosted development sites that are basically doing the same thing. Our plan is to shut down and focus our efforts on as the hosted development community. We are in the process of migrating to the kenai technology. This means that any project currently hosted on will be able to continue as you are on We are still working out the technical details, but the goal is to make this migration as seamless as possible for the current projects. So in the meantime I suggest that you stay put on and let us work through the details and get back to you later this month.

Thanks for your feedback and patience.

Ted Farrell
Oracle Corporation

Thank you Wizards of the Coast

I have a group that is about ready to start a new Dungeons and Dragons campaign. The last time we played was somewhere between 2 and 4 years ago. Since then, Wizards of the Coast has release the 4th edition of the system. In addition to that, they have released a character creator, which has made creating and leveling up characters super easy.

I downloaded the demo of the character creator and created a sample character. I then had a look at the file that was saved. I was amazed to see that it was saved in xml format. Nice plain text. Thank you wizards of the coast for making it accessible. Even better than that, within the xml, they provide links to their online compendium of rules. For instance, here is an xml node from the saved character file, which is of the new Dragonborn class.

         <ruleselement name="Dragon Breath" type="Power" internal-id="ID_FMP_POWER_1448" url="" charelem="60bad78" legality="rules-legal"></ruleselement>

Using that URL, you can visit the compendium site and read about the power. That said, the compendium requires authentication of a paid account. I see the compendium as a great value. Wizards makes all the rules, feats, powers, etc. available in the compendium site and character creator even if you haven’t purchased the book. They have a lot of intellectual property in the compendium, and it makes sense to me that they get paid for the service.

When you view your character sheet in the character creator, there is a page or two of “power cards” at the end. I thought it would be interesting to print those on 4×6 cards, laminate them, and make them available to the players to make playing easier, especially since we have a few new players in our group for this session. The format of the cards from the character creator wasn’t quite right for me. First, because it contained character specific information, like bonuses at the current state of the character. I wanted the generic power cards that could be reused by different characters. With them laminated, they players could write the appropriate bonuses right on the cards in dry-erase marker, and update as we go.

My solution was to use the nice, open, dnd4e xml files saved by the character creator. I wrote a little jython script that uses the httpunit framework in java to login to the compendium and download the power pages. that way they don’t have any character specific information in them, and I can just open them in firefox and format them for my 4×6 cards that I can feed right through the printer.

the script took considerably longer than I hoped, partly because I haven’t done any jython/python in a few years, partly because of the compendium login session management. So, without further ado, here is the source.

from import FileInputStream
from import StreamSource
from import StreamResult
from javax.xml.parsers import DocumentBuilderFactory
from com.meterware.httpunit import *
from com.meterware.httpunit.cookies import CookieProperties
import subprocess
import codecs
import os.path
import sys


inputList = sys.argv;
del inputList[0];

nameList = []
CookieProperties.setDomainMatchingStrict( 0 );
CookieProperties.setPathMatchingStrict( 0 );
wc = WebConversation();

def getPower( url, name ):
    if name not in nameList:
        print name+"...";
        if not os.path.exists( name ):
                nameList.append( name );
                request = GetMethodWebRequest( url );
                response = wc.getResponse( request );
                form = response.getFormWithID( "form1" );
                if form is not None and "email" in form.getParameterNames():
                    print "logging in";
                    form.setParameter( "email", email );
                    form.setParameter( "password", pwd );
                    subButton = form.getSubmitButton( "InsiderSignin" );
                    response = form.submit(subButton);
                    request = GetMethodWebRequest( url );
                    response = wc.getResponse( request );
                    print "not required to login";
                outFile = name, "w", "utf-8" );
                outFile.write( response.getText());
                nameList.remove( name );
                print "ERROR: Unable to get "+name+" at "+url;

for charname in inputList:
    print "Processing "+charname
    fname = "characters/%s.dnd4e" % charname
    powerdir = "./characters/"+charname+"/powers"
        input=FileInputStream( fname )
        print "unable to load %s" % fname

        print "making directory %s" %powerdir
        os.makedirs( powerdir )
        print "uanble to make directory %s" % powerdir

    factory = DocumentBuilderFactory.newInstance()
    builder = factory.newDocumentBuilder()
    document = builder.parse(input)
    nodes = document.getElementsByTagName( "RulesElement" )
    for i in range( nodes.getLength()):
        node = nodes.item(i)
        if node.getAttributes() is not None:
            typeattr = node.getAttributes().getNamedItem( "type" )
            urlattr = node.getAttributes().getNamedItem( "url" )
            nameattr = node.getAttributes().getNamedItem( "name" )
            if typeattr.getNodeValue() ==  "Power" :
                if urlattr is not None and urlattr.getNodeValue() is not None:
                    outName = powerdir+"/"+nameattr.getNodeValue()+".html";
                    getPower( urlattr.getNodeValue(), outName );
            print "no attributes"

Ok, so this is not pretty jython code. I’m sure there are a hundred improvements that could be made to this code by someone that actually knows what they are doing in python. Here’s the batch script I use to launch the script

@echo off
set LIBPATH=.\lib

set JAR_PATH=%LIBPATH%\httpunit.jar;%LIBPATH%\js-1.6R5.jar;%LIBPATH%\nekohtml-0.9.5.jar;%LIBPATH%\xercesimpl-2.6.1.jar

..\jython2.5.1\bin\jython.bat -Dpython.path=%JAR_PATH% %*

Obviously, to run the script, you must have the above jar files, which are used to support httpunit. Also, you must have jython. Once you have that, you can modify the .bat script for your environment.

The script is expecting to have a directory named “characters” adjacent to it. Within that directory should be the dnd4e files for the characters. It would be awesome if the script would just grab all the .dnd4e files within the characters directory, but it doesn’t yet. That’s just the way it is. Part of the reason was so that I would be able to update only a single character at a time if I wanted to. In any case, I run it as follows:

jython.bat Fezzik Orlissa

where Fezzik and Orlissa are the names of the characters, and have corresponding Fezzik.dnd4e and Orlissa.dnd4e files in the characters directory.

The script will load the dnd4e file, find all the powers that have URLs, and download them. Fortunately, it will not download them if they already exist on the hard drive (we don’t want to abuse wizards’ servers) for that character.

I’ve debated whether to have it dump all the powers into the same directory or do it on a character by character basis. Right now I’ve got it on a character basis so that I know what I need to print for each character before we get started. I’ll probably modify it and just use the timestamp on the power file to know which ones to print once we get started.

Finally, to get the power file to display correctly, you must have the stylesheets within the appropriate directory so they can be read by your browser when you load the power html file. Wizards used different stylesheets for the view, and the print. The print stylesheet removes all the colors and whatnot. That’s easy enough to get around by simply saving the display stylesheet as both display and print.

I may be blogging about this earlier than I should. The script isn’t really great yet, but it’s functional for my needs, and I thought it might be a good start for anyone else looking to do the same thing.

Here’s a picture of the cards I printed.
DnD Power Cards


I found recently that my eyes were getting extremely tired at work.  After a few hours on the computer, while I wasn’t sleepy tired, my eyes would just ache, itch, droop, or water.  Some time ago my eye doctor told me to do the 20/20/20 rule for my eyes.

Every 20 minutes, look at something at least 20 feet away, for at least 20 seconds.  This is supposed to keep your eyes from focusing too hard on one thing for too long and getting fatigued.  Unfortunately, when I get deep into a programming task, it’s hard to remember to look away every 20 minutes.

Another tool I installed last week that seems to have made a significant difference is f.lux.  Someone on or slashdot or something mentioned it so I checked it out.  In the week that I have used it, I have found that my eyes are not nearly as tired as they used to be.

At first, I was a little put off by the pee-pee yellow color of the white’s on my LCD monitor, but after only a few hours I could tell a difference.  You can configure it to your liking, and disable it if you need to.  I set the daytime levels a little lower than the default.  I don’t really use the ‘daytime/nighttime’ settings, and I’m sure I could manually tweak my monitor to match the output I get from F.lux, but by simply installing the software I didn’t have to mess with that.  It also works on any monitor I hook my laptop up to, so I don’t have to manually configure each monitor.

If you find that you get dry, tired, itchy, or watery eyes after a few hours in front of the computer, give F.lux a try and see what you think.