Saturday, June 30, 2007

The Negotiator

A breakfast discussion with Connor:


Me
What would you like, Golden Nuggets?

Connor
Schweetie.

Me
No Connor, no sweetie for breakfast. Crispies?

Connor
OK Daddy.

Connor
Wee schweetie (holding his thumb and middle finger to indicate the size).

Linux goodness

I'm posting this using the Ubuntu Feisty Live Disk running on my work laptop. I was able to connect to my wireless connection and it Just Worked, WEP using a passphrase as well, rather than requiring the large hexadecimal keys. So colour me happy with that (for anyone that's interested, this is on a Dell Latitude D820, more details available on request) Think I'll be grabbing an XP install disk from our MSDN Universal subscription or whatever it's called these days and taking a serious look at Xen, along with possibly trying to pick Steve Loughran's brain about virtualisation on Linux.

Tuesday, June 26, 2007

Career Development

Steve Yegge's recent post about the second most important course in CS made me smile. I discovered Eric Raymond's How To Become A Hacker fairly early on in my career, and to a Mathematics graduate with a job doing Visual Basic 6.0, that was eye-opening stuff. But you always have to remember that all authors have an agenda (including this one, obviously - Ed) and it has been commented by people other than myself that esr's HOWTO could be alternatively titled 'How To Be Like Eric Raymond'. Well, so be it. It's always the journey that's the interesting part. So can we consider Steve's post to be an equivalent 'How To Be Like Steve Yegge'? Doesn't matter. Again, it's the journey that has value.

As an aside, I had an email from Amazon today.

Your order #xxx-xxxxxxx-xxxxxxx (received 27-March-2007)
-------------------------------------------------------------------------
Ordered Title Price Dispatched Subtotal
---------------------------------------------------------------------
Amazon.co.uk items (Sold by Amazon EU S.a.r.L.):

1 Compilers: Principles, Tec... £47.49 1 £47.49

Shipped via Home Delivery Network Limited (estimated arrival date:
28-June-2007).
Note the order date as well. Three months to get that book. Ouch! But at least it's given me time to read these two, and I can interpret Steve's post (and Joe's comment) as a good barometer of where I'm heading.

Thursday, June 14, 2007

Seasonal Suffering

I took the boys to the park yesterday and Callum was very chatty. He noticed that I was quite snottery* and talked about how I had B-fever, rather than hayfever. Clever!


* I must have been married to a Scot for too long to corrupt the English language so.

Jython Update - actually doing some work on UnicodeData

So I had put this on hold to finish reading Josh Bloch and Neal Gafter's Java Puzzlers. Great book; highlighted some new things for me, which is all I ask for in any book. Partly that is since I'm still not doing Java 5 apart from at home for various minor things, but it was good.

So now back to Jython, finally. Well, reasons for my procrastination first:
  1. New Job - busy as hell.

  2. New job comes with a new laptop, which I was hoping would be a big step up from my nearly six year old self-built machine. The new laptop has reasonably impressive hardware specification, but it's running Vista. What an absolute pile of shit. I honestly don't know how developers are productive using that OS. I've given it nearly two months, just to be sure that it's not the fact that I've been off Windows for three years that is causing me all of the problems, but really. It's got to the point where I'm looking seriously at Xen on Ubuntu for the odd application that I do need to run Windows for. The other alternative would be to install XP, put up with the half life cost and initial downtime of getting the laptop set up for development all over again. I'll enumerate my grievances in a separate post. I don't think XP would get in my way as much as Vista (I did knock up the xmlunit XMLSchema validation patch on my wife's XP machine over Christmas and it wasn't that painful), but I'm not a fan of Windows after using GNU/Linux exclusively for three years.

So I've been doing a little work on UnicodeData again. Since I've not touched it for so long, I wanted to get some code up and running to start seeing how many tests were failing. Until Jython goes to Java 5 and above, I can't use java.lang.Character to do parts of it, or I could do a piecemeal approach of use java.lang.Character for the BMP, and then implement a new part for supplementary characters, or try to provide behaviour based on the running JVM. All a bit more work than I wanted to do, laziness and hubris being key. Instead, go for the brute force approach of the simplest thing that will possibly work. So I wrote a Python script (what else - it's a nice way of bootstrapping this problem) to parse the UnicodeData.txt file and generate some Java classes. The initial approach was to partition the UnicodeData.txt into a class for each plane in Unicode. Anyone that knows Unicode and the assigned codepoints will know that the BMP will take up most of this, but I was interested in getting something working, and then maybe refine it once the tests are passing. Well, my first cut was to have a simple interface:


interface UnicodePlane {

/**
* Return a UnicodeCodepoint for the specified codepoint.
*
* @param codepoint the Unicode codepoint
*
* @return a UnicodeCodepoint, or null if there is no match
*/
UnicodeCodepoint getCodepoint(int codepoint);

}


I would have a class that implements this interface for each plane and a static initializer within each class that fills a Map of UnicodeCodepoint classes keyed by Integer codepoint.

Eclipse gives me this error:


The code for the static initializer is exceeding the 65535 bytes limit


Whereas ANT gave me this variation:

[javac] Compiling 2 source files to c:\Users\jabley\work\eclipse\workspaces\personal\jython-trunk\jython\build
[javac] c:\Users\jabley\work\eclipse\workspaces\personal\jython-trunk\jython\UnicodeData\generated-src\org\python\modules\unicodedata\UnicodeCharacterDataBasicMultilingualPlane
.java:11: code too large
[javac] private static final Map CODEPOINTS = new HashMap();
[javac] ^
[javac] 1 error

BUILD FAILED
c:\Users\jabley\work\eclipse\workspaces\personal\jython-trunk\jython\build.xml:456: Compile failed; see the compiler error output for details.

So I need to think a bit harder about the data structures. Turning to Bentley's Programming Pearls, the sparseness of certain items stands out, like the mirrored property.

I'll have a think. At least with the Python script that I have to cut up the UnicodeData.txt file, it's very easy to add another list comprehension to it, to see how many items in the file exhibit a certain property. The other way I'm considering is to just generate a properties file and lazily populate a Map as required. That's probably what I'll try next, rather than thinking too hard about how to compress a 1038607 bytes data file into something more reasonable.

Sleekit plumbing

Feels like Thames Water have reduced the water pressure in an effort to conserve reserves over the summer. Either that, or reserves are already low enough to cause a pressure drop. Either way, it means that the toilet can take more flushes to clear, and at nine litres a flush, I'm not sure how much water that conserves.

Happy Birthday!

Had a party for both the boys at the weekend. Knackering!