... 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 :)


Grepping for static fields in Java

Here is a regular expression (Java-syntax) that will match all static non-final fields in Java source code (to a reasonable approximation):


In summary, if finds all lines that contain the word static, but not followed by  final, class, enum, or an open parenthesis (signifying a method) prior to an equals sign.  This pattern will return false positives such as when static appears after an equals sign or final precedes static.  It will also miss cases that are split over multiple lines.  Both circumstances are unusual to the point of rarity and a more elaborate pattern to find such cases will run considerably slower.

For some reason this expression works erratically within Eclipse.  Eclipse seems to occasionally search across line boundaries -- but only sometimes?!  To correct his behaviour, use this pattern instead (changes in bold):



Subversion: cannnot replace a directory from within

I tried to use TortoiseSVN to merge a particular revision of a particular file from one branch into another.  I received the message "cannot replace a directory from within".  I tried the same thing using the SVN command line tools, same result.  The problem was that I was using a command like this:

svn merge -r3023:3055 svn://myrepository/trunk/blah/blah/Blah.java c:\myworkingcopy

The solution was to specify the target filename directly:

svn merge -r3023:3055 svn://myrepository/trunk/blah/blah/Blah.java c:\myworkingcopy\blah\blah\Blah.java

You can do this from within TortoiseSVN by invoking the 'merge' command by right-clicking directly on the file in question instead of at the root of the working copy.


SQL Server SP2 vs TCP/IP

There is a problem with SQL Server SP2 that prevents its operation using TCP/IP.  Port 1433 (or the configured port) is not open.  If you check the application event log, you will find this nice message:

You are running a version of Microsoft SQL Server 2000 or Microsoft SQL Server 2000 Desktop Engine (also called MSDE) that has known security vulnerabilities when used in conjunction with this version of Windows. To reduce your computer's vulnerability to certain virus attacks, the TCP/IP and UDP network ports of Microsoft SQL Server 2000, MSDE, or both have been disabled. To enable these ports, you must install a patch, or the most recent service pack for Microsoft SQL Server 2000 or MSDE from http://www.microsoft.com/sql/downloads/default.asp

More information from this issue can be found in KB841375.



The Joda project seeks to improve on core Java functionality.  Of particular interest is the Joda Time package, which is meant to replace the Java's messy date and time handling.

Fillers in SWT GridLayouts

SWT GridLayouts require every cell to have content.  If you want an empty cell, add a blank label.  If you try to add a blank composite, the cell will likely be larger than what you want since composites seem to have a somewhat large minimum size (at least in a grid layout).

Blog Archive