... indistinguishable from magic
effing the ineffable since 1977


Show All

Recent Posts


A day for good news


So the release date for Harry Potter and the Half-Blood Prince is officially July 16th. People who know me will realize that I consider this a momentous event. I'm so addicted to these books it's not funny. I think that if I were a crack addict shaking from withdrawal, and there were two tables in front of me - a dose of the drug on the left-hand table, and Harry Potter and the Half-Blood Prince on the right - I'd dive to the right without hesitation, and thereafter be so engrossed in the book that I'd completely forget about the drug, not to mention food and drink and sleep (until I finished the book of course). Since my birthday is July 11th, I'm getting a nice birthday present this year. Now to plan my reading regimen for June and July to make sure the first five are maximally fresh in my mind for that date, and investigate the possibility of getting to a midnight opening somewhere...

Another excellent piece of news is that Poland has once again stood up for the democratic process in the European Union and refused to let software patent advocates push their version of legislation through under the radar. Take that, patent pushers - once again, You Forgot Poland! (Yes, I'm the 47,948,368th person to make that joke, but it's still funny)

Finally, a bit of technical good news of interest to probably very few people, but it's been announced that generics in Whidbey will be CLS-compliant. This should make life for IKVM a little more interesting... it becomes far more necessary to have some level of generics support, but perhaps the new CLS restrictions will make the implementation easier. No information yet (that I can find) on whether MS gave any consideration to interoperability with Java generics - I strongly suspect that they didn't. Jeroen may need to pull off another miracle to get the mapping right. I have no doubt he's up to the task.


IE users rejoice

I figured out how to make the transparent PNGs on this site display reasonably well for IE users without needing any complex hacks like IE7, which I was previously using but seemed to be able to crash the browser entirely in some cases, killed performance in all cases, and actually made the rendering of PNG backgrounds worse. I still think IE7 is a great idea, but it needs some of the kinks worked out before I dare inflict it on people.

In case you're interested, the workaround for transparent PNGs was to realize that I do actually know in all cases what color they will be displayed against, so if I save them from the GIMP with the background color set to that value, they'll display correctly.


To Do Lists and Free Java


When faced with a large problem to solve, the only way I am ever able to successfully tackle it is to break it down into a list of smaller tasks, and work my way through that list. When the list is really long, even that seems intractable, and I need to find ways to break it down further, by identifying a subset of the list to tackle first, get all of that done, and then work on the rest.

Even though I'm not actively working on the GNU Classpath project any more (I barely ever did, to be honest - I contributed a few classes but I think they all got replaced with brand new, better versions) I figured that it's possible that some of the people who are working on it might tackle problems the same way I do, and if I could automate the creation of the list of tasks, it might help them in the same way it helps me. That's the chain of thought that led to the creation of japitools.

I've watched and cheered from the sidelines as Classpath, Kaffe and company have come from nowhere to the astonishingly high japi scores they show today. It doesn't seem so long ago that even compatibility with Java 1.1 was miles away, and completing 1.2 barely conceivable. But now the Free libraries are consistently reaching 70% of 1.4 compatibility, which is unbelievable. They're so close that it's possible to list the "big holes" (against 1.4 at least) and still have fingers left over on one hand.

1. Swing (only swing.text and swing.plaf though)
2. CORBA (the org.omg packages)
3. Imageio (Mostly done, but missing a few bits)
4. Kerberos (one single package missing from

Literally every other package in 1.4 now has at least 80% API coverage in some form of Free implementation. The last two are small, and work on filling the remaining holes in Swing is proceeding at an unbelievable rate.

Japi results with JacORB included have been produced which at first led me to believe that good coverage of the CORBA packages was within easy reach too. After all, those results have a lot of green on them. But despite JacORB's claim to be under the LGPL, people kept mentioning license problems so I decided to investigate, and the results were somewhat depressing. A little perl script I wrote to identify the license of files in JacORB led to this result:

LGPL pkgacc: 76
LGPL public class: 603
LGPL public interface: 79
Unlicensed (org.jacorb) public class: 147
Unlicensed (org.jacorb) public interface: 6
OMG public class: 199
OMG public interface: 144
Unlicensed (OMG) pkgacc: 1
Unlicensed (OMG) public class: 90
Unlicensed (OMG) public interface: 8
Unlicensed (HTTPClient) pkgacc: 23
Unlicensed (HTTPClient) public class: 23
Unlicensed (HTTPClient) public interface: 7
Unlicensed (demo) pkgacc: 7
Unlicensed (demo) public class: 102
Unlicensed (demo) public interface: 1

The "Unlicensed" files are files that the script couldn't identify an explicit license in, but the ones marked "(OMG)" seem likely to be under the OMG license based on other files in the same directories. The OMG license grants unlimited use and distribution, but does not allow modification, which renders it non-free and unacceptable for Classpath and Kaffe. So at least 290 classes and 152 interfaces are under this unacceptable license, which is small compared to the thousand or so that are or appear to be under the LGPL, but still pretty large in absolute terms.

(As an aside, I can make a strong argument that the interfaces aren't actually a problem because it's legal to generate them from japi files, since japi files don't contain any copyrightable information. The same might be true of some of the classes if they were purely abstract, but I tested for this - the vast majority aren't abstract at all.)

Things got even worse when I correlated these results against a japi file of the JDK, to get an indication of how many of the problematic files were part of the public API:

InJapi OMG public class: 168
InJapi OMG public interface: 85
InJapi Unlicensed (OMG) public class: 77
InJapi Unlicensed (OMG) public interface: 5

In other words, every single class in the public API is under an unacceptable license. Every single bit of green in the CORBA packages in those oh-so-encouraging Japi results is worthless. JacORB may still be very useful to back up the CORBA packages with some actual implementation, but as far as API coverage is concerned, it seems we're on our own.


How many template languages have you written?

It seems to be one of those programming techniques that, eventually, everyone ends up needing. You want to generate output which includes a lot of boilerplate, fixed content (which might be HTML, XML, a programming language, or something else entirely) but has some of its content substituted in by code.

To solve this you define a mini-language that consists primarily of just typing the output, but has some mechanism for substituting in values that come from the code, and you write a mini-interpreter that evaluates this language.

I've now done this 5 different times, with various levels of sophistication:
  1. dbmagic - at a previous company, I wrote scripts in a combination of awk and sh (the only scripting languages available on their ancient unix machines) which generated C code for talking to databases. The "template language" in this case was really just "cat <<EOF" though.
  2. In an early version of nrdo I generated Java code from a mini-language that supported variable-substitution, looping, and some constructs that were specific to outputting Java.
  3. Later I replaced this language with CGL, a very powerful and complex language with looping, variable declaration, lots of string manipulation operations and some interesting constructs for dealing with lists of data. A specific design goal of CGL was to be able to produce the same output as its predecessor without any Java-specific constructs, which led to a lot of required complexity. This is, by far, the most powerful template language I've written, but suffers a bit from its complexity and could use some cleanup.
  4. cmScribe uses a simple template-like syntax for its "Layouts" which involves simply adding [[Name]] constructs to HTML code to act as placeholders where active content can be placed. I'd say this counts as the least inherently powerful template language I ever wrote - but one of the most useful, as that active content can be anything, and is GUI-manageable.
  5. This last week I was faced with the need to generate PDF based on some data that's also used on a website. Of course I used Apache FOP to generate the PDF from XSL-FO, but I needed an easy way to generate the XSL-FO from the data. XSLT didn't apply because my original data wasn't in XML (so I'd have been faced with the exact same problem for generating that XML). CGL would have been overkill and also requires extra work to make the data available in the right format. What I came up with was a mini-language, simple enough that it took me less than two days to implement, with variable-substitution, looping and conditional code. A nice feature is that it automatically hooks into JavaBeans property getters meaning that it could talk to my existing object model without any glue, and the syntax is so simple that the files themselves are extremely readable (unlike CGL). This was intended as a quick hack, but I like it so much that I may try to incorporate some of its advantages into CGL to make it simpler to use.
How many template languages have you written?