Goodies - This page features some of the other smaller pieces
of code I put together, available under the GPL/MIT License.
- Towards Bug-Free Code - My article published on O'Reilly
OnJava.com -
Towards Bug-Free Code, which talks about using Java 5.0 features to write easily
testable code. It covers, Unit testing with Mock Objects, a mini-framework for I18N support, a Type-safe
Registry/Factory etc.
Download Source code (256 KB):
BetterCode_v1.0.zip.
- Mozilla bookmark converter - A simple Java class to convert
your Mozilla/Netscape exported "bookmarks.htm" page into a more
readable HTML page with a Windows Explorer/Konqeror like tree structure, complete
with the folder images. See my Bookmark pages for samples. It works
by implementing a SAX DefaultHandler and spits out the transformed
HTML code. This Zip file contains the source and compiled code along with
SAX2 parser from SAX
Project and a SAX2 driver from The
GNU JAXP Project and a sample input file with the sample output file it
produced. The generated files need some manual tweaking, especially ones from
the second converter.
Download Mozilla bookmark converter (443 KB):
MozillaBookmarkConverter.zip.
Note that there are 3 versions of this file - MozillaBookmarkConverter.java
generates a non-JavaScript plain vanilla version of the bookmarks. MozillaBookmarkConverter_2.java
generates a JavaScript version of the bookmarks. This version relies on the
tutorial code provided in Webreference.com.
The input file for the DOM generator file must not have a root because the
tool adds one. The input file for the Plain HTML generator, on the other hand
needs to have a root. So, the best way to use the tool, if you are generating
both the Plain and the DOM files, is to finish the Plain file with the root
element and then comment it out for the DOM generation. There are sample input
"in_*" and output "out_*" files in the download. MozillaBookmarkConverter_3.java
generates a very simple and lightweight collapsible tree using just a few lines of JavaScript.
This scales much better than MozillaBookmarkConverter_2 because it uses HTML's BlockQuote
and text instead of images for the display. It loads much much faster than any other implementation. The
generator file was written using Java+ to
inline the entire HTML and JavaScript and then compiled using javac.
- Jext Bookmark Plugin - A plugin for the fantastic
open source Text editor - Jext.
The plugin lets you bookmark multiple lines in all the open files. Ctrl+F9
toggles the bookmark. F9 will iterate through all the bookmarks.
Download Jext Bookmark plugin (12.4 KB): Jext
Bookmark Plugin. Actually, the plugin is a measly 4.1KB :-) . This zip
file contains the Jar and the sources.
- JUnit test case generator - My first step towards
learning XP
- more specifically, Test
driven development (TDD). This Ant
job only generates a barebones TestCase and TestSuite. The necessary parameters
such as TestCase/Suite name are specified in a 'build.properties' file; and
the Ant process executed to generate the files. Am quite sure the "big" IDEs
let us create TestCases without having to leave the editor. I wrote this only
to force myself into using TDD. I'll use it just because it's mine. Smart
huh?
Download JUnit test case generator (9.9 KB): JUnit
test case generator. This needs Ant and JUnit(duh!) to run.