... until the collector arrives ...

This "blog" is really just a scratchpad of mine. There is not much of general interest here. Most of the content is scribbled down "live" as I discover things I want to remember. I rarely go back to correct mistakes in older entries. You have been warned :)


Hibernate Session.isDirty()

Hibernate's Session class has the method isDirty() which tells you whether there are any changes that still need to be synchronized with the database, i.e. that there are still pending operations.  Perhaps it is obvious to some, but I was caught thinking that it meant that the current Hibernate transaction contains uncommitted changes.  It doesn't.  If you want to know that, you must keep track of it yourself (perhaps by registering some listeners within Hibernate).


Sharing Scripts in BIRT

You can share Javascript files across BIRT reports by manually editing the report layout XML.  Add lines like:

 <list-property name="includeScripts">

Relative pathnames are supported. The visual designer does not (yet) support script inclusion directly.


Mercurial and SVK Version Control

Mercurial is a new version control system that specializes in distributed development.  Its distinguishing feature is that there is no central repository -- all local repositories are peers (like Gnu arch).  Synchronization occurs through change sets.  It is growing in prominence because the Mozilla 2 team has chosen to use it in favour of CVS.

When reading up on Mercurial, I came across SVK, which is an extension of SVN to support distributed development.


Java 1.5 / Xalan XSLT Bug

Xalan XSLTC 2.6.0 (and by extension, Java 1.5 XSLT transformation) has a bug where it complains about a syntax error for a rule such as <xsl:template match="and"/>.  The issue is that and is a reserved word.  Only Xalan appears to exhibit this bug.  All of the other transformers that I tried worked (including IE, FF, Saxon, and Xalan 2.7.0).  The XSLT specification is silent on the matter, but the grammar does not appear to prohibit the case.

The workaround is to use a rule of the form <xsl:template match="*[local-name()='and']"/>.  Ugly, but it works.


Enabling SVN Log Editing

You can enable Subversion log editing by installing a pre-revprop-change hook.  Here is a minimal Windows batch file that will do the trick (converted from the template UNIX shell script that comes with SVN):

@echo off

set REPOS=%1
set REV=%2
set USER=%3
set ACTION=%5

if "%ACTION%" == "M" if "%PROPNAME%" == "svn:log" exit 0

echo Changing revision properties other than svn:log is prohibited >&2
exit 1


Empty Node Set in XPath 1.0

'/..' is an idiomatic way to express an empty node set in XPath 1.0.  In XPath 2.0, one can use the empty sequence '()'.

Event-Handling in FF and IE

The following snippet can be used in either Firefox or Internet Explorer to recover the target document node from a click event:

window.onload = function() {
    document.body.onclick = function(suppliedEvent) {
        var target;
        if (undefined != suppliedEvent) {
            target = suppliedEvent.target; // Firefox
        } else if (undefined != event) {
            target = event.srcElement; // IE
        } else {
            return; // some other browser?


Little Languages

Little languages are in the news a lot these days (under the rubric DSL or Domain Specific Language).  I came across A Pattern Language for Language Implementation.


Sun has blessed the F3 project with the new name Java FX.  It is being represented as a competitor to Flash and Silverlight.  The implication is that FX will find its way into the JRE.

Blog Archive