Quick Javadoc Reference

I write most of my code in Ultraedit and when I’m writing java I really want to be able to access javadoc documentation for the Sun API as quick as possible. This is a description of the evolution of a little utility to look up javadoc documentation very quickly.

I know that IDEs like IntelliJ and Eclipse offer in-window documentation tooltips (this is actually executed best in Microsoft’s Visual Studio.NET of all the IDEs I have used). But these horking great programs put me off because they feel clunky and tend to specialise in one language. I prefer to use the tricks I learn with my text editor with everything I am working on rather than learning a set of shortcuts, etc. for every language. I know Emacs has tagfiles for every language and is on zillions of platforms but it doesn’t feel like a native Windows app and as that’s where I spend 99% of my time it just doesn’t cut it. Ultraedit makes me feel nimble and encourages cross-application serendipity.

I used to bring up a Run box with Win-R and write the full path to file I needed. So to get the docs on java.util.HashSet I’d do:

Win-R, "c:docsapijavautilHashSet.html", Enter

(obviously autocomplete would make it a little bit quicker than that). This was far too slow – interrupting your train of thought to look up documentation.

To speed things up I dropped a copy of every HTML file into the docs folder. So to get the HashSet documentation I need only type:

Win-R, "c:docsHashSet.html", Enter

(again with autocomplete speeding me up). This wasn’t too bad speedwise but all the links in the file launched would not work. So if you wanted to look at the docs of a superclass or of a method’s return value you had to go back to the Run box. Not ideal.

It seemed the only answer was to write a little utility. I chose Perl as it’s filehandling is simple and the language itself pretty fast. The code I ended up with after a first pass was:

#!c:perlinperl.exe

use strict;
use warnings;

$ARGV[0] || die "No arg supplied.
";

my $look_for = "/" . $ARGV[0] . ".html";
my @found;
my @files = search_dir("c:/docs/api");
if (@files == 1) {
    print "c:/progra~1/intern~1/IEXPLORE.EXE " . $files[0];
    exec("c:/progra~1/intern~1/iexplore " . $files[0]);
} else {
    # FIXME
}

sub search_dir {
    
    my $dir = pop;
    my @list = glob($dir . "/*");
    foreach (@list) {
        if (-d && $_ ne $dir && ! /class-use/) {
            search_dir($_);
        } elsif (/$look_for/) {
            push @found, $_;
        }
    }
    return @found;
}

I had to put in special cases so that one directory was not traversed indefinitely and to avoid the class-use directories that are not of interest (they contain links to classes that used the class).

This worked just fine (excluding the failure to handle multiple matches) but had a noticeable delay. The time I saved typing:

Win-R, docs.pl HashSet, Enter 

compared to the longer version was lost in the searching of the filesystem. Worse the time was now idle time instead of active time and that seems longer (think of waiting for a bus).

What was taking the time was traversing the filesystem looking at filenames.
So I decided that work could be done just once and cached. I ran “find” at a Cygwin bash prompt from the api directory and put the output in a quickref.txt file. I used “grep -v class-use” to remove the class-use directories and replaced /c/ (my symlink to the root of the C: drive under Cygwin) with c:/ to produce a list of paths to all the relevant files.

Now all I needed was code to read this file and find the correct entry.

#!c:/perl/bin/perl.exe

use strict;
use warnings;

$ARGV[0] || die "No arg supplied.
";

my $look_for = "/" . $ARGV[0] . ".html";
open(FILE, "<quickref.txt");

while (<FILE>) {
    if (/$look_for/) {
        exec("c:/progra~1/intern~1/iexplore " . $_);
    }
}

This code was a good deal shorter (the work’s largely been done in creating quickref.txt) and faster. I speeded it up even more by forcing Internet Explorer (quicker startup time than the otherwise superior Firefox) and short-circuiting at the first match (only conflict that occurs often is java.sql.Date and java.util.Date anyway).

All that remained was to create a shortcut on my path to the file called ‘d’ allowing me to launch (for example) fully linked HashSet documentation with:

Win-R, "d Hashset", Enter

A future version could generate the quickref.txt file if it is not present. But as this is such a simple utility I doubt it will have a future version. Other javadocs can be simply added by appending their paths to quickref.txt. Obviously the browser commandline should not be hardcoded and I could consider respecting ESR’s $BROWSER attribute. If you think this is overkill or have suggestions for improvements or just simply think I’m a nutter please comment below.

Lawrence Lessig Launches Creative Commons UK

Lawrence Lessig spoke at UCL on Monday 4th October to launch
the UK version of Creative Commons. This is an
initiative designed to work alongside copyright to help
authors of content to mark their content available for reuse.

The talk was very modern, in the sense that it was closer to
entertainment than your average lecture.
There were hundreds of
slides that Lawrence flicked
through with a thumb switch while he was talking (many containing just a single
word that he said simultaneously with its appearance). And also
plenty of sound
and video
. Some of my favourites were the Peanuts video with Hey Ya!
running over the top of it and the contest-winning
video explaining Creative Commons
(7MB MPEG).

Lawrence discussed the many advantages of Creative Commons licensing with
particular reference to his own book, ‘Free
Culture
‘. He cited the Free Culture Wiki where
people are free to make changes and annotations to copy of the book and also the
fact that people had recorded an Audiobook version
within a few days of its release. He is certain that these activities have
ultimately raised his profile and increased sales of the book.

Another interesting part of the talk was the discussion of the component
parts of Creative Commons licenses. The licenses come in three
formats
: a human
-readable description of their intentions; a lawyer-readable legal document; and
a computer-readable RDF that display intentions electronically. This last one
is the most interesting, making a search engine of reusable
content
posssible (his example was photographs of the Empire State Building
with no royalties payable for use; the possibilities are enormous). Also
interesting was the Creative Commons wrapping of the GNU Public License to create
human and computer readable versions and international lawyer readable
versions.

Lawrence was a very entertaining speaker and also (perhaps surprisingly)
showed little of the zealot. When questions of dismantling corporations or
copyright law altogether came up he was quick to point out the moderation of his
position and that he was only seeking a way for those who wished to
make content
available to do so
. That could well be the key to his success.

Update 2004-10-10 Audio of the talk (80MB).

Decemberists at Brighton Freebutt

I can’t remember how I heard about The
Decemberists
. But they are one of the truly original bands recording in the
world right now. I’ve made it something of a mission to get other people
listening to them. Especially as they seem to be quite SO unfamous – the
closest thing they have to a world tour is a handful of dates in the UK.

The Freebutt in Brighton where I saw them is not a large or famous venue. The
level of advertising given over to them was verging on the nonexistent –
standing outside the venue I couldn’t tell that they were on that night. I
missed them at the Water Rats in King’s Cross on Friday (that will teach me to
have so many different email addresses) so I couldn’t miss out on their next
nearest gig. I just couldn’t miss renditions of lyrics like:

“We will remember this when we are old and ancient.
Though the specifics might be vague
and I’ll say your camisole was a sprightly light magenta
when in fact it was a nappy blueish grey.”

The lead singer (Colin Meloy) wouldn’t look out of place in Weezer but
the rest of the band would have. The tiny drummer (Ezra Holbrook) who (I think)
supplies the voice of the widow in ‘The Chimbley Sweep’, the burly beer-sipping
guitarist (Chris Funk) and a double bassist (Nate Query) so gentle he had
trouble getting back to the stage through the crowd
for the encore. And seated
somewhere I couldn’t see but only hear due to the crowd was Jenny Conlee on
accordion.

They played note-perfect renditions of a selection of their songs changing
things only to add a wry twist. Even the atmospheric screams and falsetto
voices were inch-perfect. The one significant change from the recordings was
during the climactic rendition of The Chimbley Sweep when a series of traded
riffs between Meloy and Funk turned into a tongue-in-cheek Hendrix-like playing
of the guitar behind the head
and string snapping crescendo.

Meloy supplied a little banter between songs. After playing the new song he
said with a tiny hint of self-congratulation, “That was about a Spanish princess
on her way to her coronation, this is about architects” and introduced The
Chimbley Sweep as being, “about my childhood.”

After much clapping from the crowd Meloy returned for an encore, being joined by
the rest of the band in fits and starts through the three songs. He sang
Morrissey’s Everyday is Like Sunday (sounding strange with his so very American
accent wrapped around it) and two Decemberists tracks with perhaps even more
vigour than in the main show.

If you’re reading this for a recommendation then go see them and get their
albums too
. Great band.

Set list (from memory, missing some and bound to be wrong):

  • This Soldiering Life
  • Infanza
  • Here I Dreamt I was an Architect
  • Grace Cathedral Hill
  • July, July
  • Billy Liar
  • Los Angeles, I’m Yours
  • Legionnaire’s Lament

Encore:

  • Every Day is Like Sunday
  • Red Right Ankle
  • I Was Meant For the Stage

Network/Internet Boggle

I’ve expanded Boggle to take text entry, be playable over a LAN/the internet and do all the scoring, etc.

List of the most important added features:

  • Network or internet play for an unlimited number of players.
  • Full scrabble words type dictionary.
  • Results so far totalled and displayed.
  • Alter the size, font and colour of the dice and save as themes.
  • Alter length of a game.
  • Computer opponents (actually they are far too good to really play but they tell you what words you could have got).

Fit But You Know It (Remix)

Been listening to the b side version of “Fit But You Know It” by the Streets a lot (featuring Kano, Donnae’o, Lady Sovereign, Tinchy Stryder). Check it out, I think it actually might be better than the a side. Can’t find the lyrics anywhere on the web so here’s my best stab, mail any corrections to streets@bluebones.net:

Updated 19 July with the correct lyrics from Funmilola Thomas.

Fit But You Know It

You’re just too damn vain for me girl
Playing in a different league from me girl
I ain’t even trying to speak girl
You ain’t playing right

You’re just too damn vain for me girl
Playing in a different league from me girl
I ain’t even trying to speak girl
You ain’t playing right

Kano:
Once upon a time I was on a chick
She was on ‘im but I knew that she was full of shit
She knew she was fine, she knew she was fit
I linked her, she said she was on, but she was on my dick

It was all a game, it was all a trick
I’ll never fall for it again, that’s out of order b’
I should’a cooled it, but now I’m cool
I boom, bounce back but a fool, old school, watch her come running back

I ain’t a player, I crush a lot
I’m like pull a lot
Plus I got like a hundred gash
And you ain’t one of em

I like to have fun when I’m done with em
Plus I knows you like my songs cos you was humming em
But you’re a teaser playing games cuz im a cheater
You really think you’re the 2004 Mona Lisa

You ain’t Beyonce
You ain’t either
Come down from cloud nine
You really think you’re a diva

You’re just too damn vain for me girl
Playing in a different league from me girl
I ain’t even trying to speak girl
You ain’t playing right

You’re just too damn vain for me girl
Playing in a different league from me girl
I ain’t even trying to speak girl
You ain’t playing right

Donae’o:
Yeah uh
You might be buff and all that
Doing your stuff and all that
But I don’t care enough and all that
Cos I got a girl

And the reason for me being so stush is easily reasoned
Cos for me being heathen, simply it ain’t needed

And just because you got double Ds
Don’t mean you can trouble me
Those sausage lips they’ve got to get, get got some girls not with it
But the guy there he’s hot for it
Go check for him he’s next to kim
He’s into airhead, skin and bone
But that’s not for me I like big and bold

Mike Skinner:
Since I’ve been thinking deeply
I might try to see
About maybe going down to get my ears pierced
It’s a slightly different result for me
Than the one I was unroathed and like usually
I’m told it will prepare my mind surely
For having a wifey four timely a week
You know know how to deal with pain like I fought see
And of course you’re required to buy jewelry

You’re just too damn vain for me girl
Playing in a different league from me girl
I ain’t even trying to speak girl
You ain’t playing right

You’re just too damn vain for me girl
Playing in a different league from me girl
I ain’t even trying to speak girl
You ain’t playing right

Lady Sovereign:
<spoken>
I saw u lookin at me Oi what are you turning away for man diz is shite ur
lyk a sparrow dat dnt work u dnt chirps ur a boy</spoken>

Anyway, yo,

And I fink I’m nice
I know I’m nice
Cos your eyes look twice
Up down left right
Left right left right

Was wearing baggy jeans and a tight top
Cleavage tryin to show im den i saw sumfin in his trousers growin
And I know you was looking at me
Cos the girls behind me were looking off key
Don’ I know this
You’re just a sparrow
That really don’t work cos u not chirps, boy you’re hopeless

Tinchy Stryder:
She’s one of them girls who knows she’s looking more than nice
Even on a bad day I’m looking more than twice
Her eyes – it’s like they’re hypnotising all these guys
Meanwhile although she’s calling shots – no surprise
In her head she knows it – that cos of her they fantasize
So she controls it those mind games with other guys
But I don’t care if she’s buff and that
She ain’t gonna get no love from me
She’s just another girl to me
I’m Strider man thats that

You’re just too damn vain for me girl
Playing in a different league from me girl
I ain’t even trying to speak girl
You ain’t playing right

You’re just too damn vain for me girl
Playing in a different league from me girl
I ain’t even trying to speak girl
You ain’t playing right

Internet Explorer 5 HTTP 500 Error on Ampersand entity in Query String

I’ve got zillions of 500 errors in my log files (well, a handful each day). All are from Internet Explorer 5 on Windows NT (specifically the User-Agent is “Mozilla/4.0+(compatible;+MSIE+5.0;+Windows+NT)”. I’m pretty certain that the problem is ampersand character entities in anchor tag href attributes. It seems that IE5 is barfing on &amp; being used in querystrings rather than just an ampersand. But of course the W3C’s HTML validator won’t have anything but the character entity without telling me off. Is there an answer?

Pixies Live At Brixton Academy

Fucking fantastic. Mind you they could have played a bunch of Wham! covers and I think I would have enjoyed it.

Set list (NOT in order):

  • Caribou
  • Nimrod’s Son
  • Holiday Song
  • Bone Machine
  • Broken Face
  • Something Against You
  • Gigantic
  • River Euphrates
  • Cactus
  • Vamos
  • Debaser
  • Tame
  • Wave Of Mutilation (LP)
  • I Bleed
  • Here Comes Your Man
  • Dead
  • Monkey Gone To Heaven
  • No. 13 Baby
  • Hey
  • Gouge Away
  • Velouria
  • Subbacultcha
  • Winterlong
  • In Heaven/Wave (UK Surf)
  • Into The White

That’s 8/18 from my perfect Pixies setlist. Plenty enough to keep me grinning all night.

Not since Elvis has one for the money been so good.

Richard Stallman and Cory Doctorow at Ravensbourne College

As part of their “Copyright versus Community” event I saw Richard Stallman and Cory Doctorow talking (separately) about various copyright issues.

Stallman lived up to his reputation as an uncompromising proponent of free software (he invented/popularised most of its basic ideas, after all). He gave a simple but effective critique of “Open Source” as opposed to “Free Software”: in a nutshell, that Open Source advocates claim open source is the best way to develop software but that they do not have any ethical objection to closed source. On the other hand, Free Software advocates see closed source software as inherently wrong. So if you develop some closed source software and it is better than the open source software then the Open Source advocates have no objections.

He managed to fit all the cranky behaviours he has become famous for into a two hour stretch: talking about how GNU/Linux should always be called “GNU plus Linux” and not just Linux; correcting each and every use of the phrase “open source” where the speaker meant “free software”; that “piracy” is not the right word for “sharing” or “helping your neighbour”. He even managed to get in a row with Cory Doctorow before his speech about whether it was useful to umbrella patent and copyright issues (he thinks not, Cory thinks so). This is a man that will not bend, even a little, from what he sees as right. You could say that’s unreasonable, but have you given us Emacs, gcc and all the rest?

Cory Doctorow was full of energy despite having jumped off a plane from Barcelona an hour before. He has a great turn of phrase and peppered his speech with neologisms, refusing to talk down to his audience. You could tell he was a writer from the delight he took in really using language. He gave a very interesting speech largely about the history of the “copyfights”. A copyfight being defined here as a situation in which a new democratising technology comes up against the power of vested interests (the printing press versus the Church, player pianos versus US government, VCRs and later P2P filesharing versus the entertainment industry).

The speech was full of vivid anecdote and with real detail behing the arguments. He is clearly a great force for the EFF and I’m glad that he is now their “man in London”. He also showed a real sense of humour. He reminded me of the page in Paul Arden’s It’s Not About How Good You Are, It’s About How Good You Want To Be: “Energy. It’s 75% of it. If you haven’t got it, be nice.”

Ravensbourne College is some kind of “design school” and I think very technically slanted. One guy was drawing a desert nightscape in Photoshop on his laptop while listening to one of the talks. Their domain is rave.ac.uk which shows some kind of “trendy” thinking. Quite how they managed to get these guys down there I don’t know but it was a worthwhile afternoon.

Java Versus C# (Jobs)

A colleague of mine last Summer decided he would learn C# rather than Java because, “that’s where all the jobs are.” I disagreed and showed him the jobserve listings for that day that seemed to prove him wrong. “Well, that’s where all the jobs WILL be.” he replied. Thus was born jobfight.

I think enough time has gone by (10 and a half months) to have a look and see if we can discern any trends. The graph belows shows the statistics I have gathered on UK programming jobs for the keywords “C#” and “Java”:

Graph of C# jobs versus Java jobs advertised on jobserve.com June 2003 to April 2004

It seems that Java is growing faster in terms of total number of jobs and at nearly the same rate as a percentage of the existing jobs.