Tuesday, December 29, 2009

Urban Terror

This is a fun old game I used to play a lot about 5 years ago. It kind
of fell by the wayside as I kept upgrading hardware and software.
But this new version 4.1 installs easy and runs great on my
hardware with Ubuntu 9.10. Urban Terror no longer requires an
installation of Quake 3 Arena.

Urban Terror

It's an online first-person shooter.
There are versions for Linux, the Mac, even (retch) Windows.

I must have played for about 4 hours today. This is what vacation
is all about.

Thursday, December 17, 2009

Wednesday, December 16, 2009

Using Firefox as Eclipse's external browse

My environment for this is Ubuntu 9.10, Eclipse Galileo (3.5).
I started out thinking this would be about a one minute
configuration change. Go to Window->Preferences, click on
Web Browser, select 'use external web browser' and 'default
system web browser', done, right?

Oops, that's not quite what I want. I always already have
Firefox open and when I clicked on something that used
a browser like Help->Help Contents, it would open a new
tab in one of my existing Firefox windows instead of opening
a new browser window in the same virtual desktop as
Eclipse.

I found Mozilla Command Line Options and decided what I
needed was a command like 'firefox -new-window URL'. I
tried this at the command line and it seemed to do the right
thing - bring the URL up in a new window of the existing
browser session.

Now all I needed to do was configure this in Eclipse.
I created a new web browser (Window->Preferences,
General->Web Browser) like this:

Name: Firefox
Location: /usr/bin/firefox
Parameters: -new-window %URL%

I tried that and numerous variations. It felt like Eclipse
was just ignoring whatever I put in 'Parameters'. The URL
would always open in a new tab instead of opening a new
window.

Frustrated, I finally edited 'Firefox' to this:

Name: Firefox
Location: /home/lmulcahy/bin/firefox-new-window
Parameters:

and wrote the firefox-new-window script as follows:

#!/bin/sh
echo $@ > /tmp/firefox-new-window

I tried Help->Help Contents again and found this in
the output in /tmp:

-remote openURL(http://127.0.0.1:55895/help/index.jsp)

Well, now we're getting somewhere...
Eclipse is adding '-remote' to my command line
and it's also enclosing the URL in 'openURL()'.

To make a long story short, here's my firefox-new-window script
now. This does just what I wanted:

#!/bin/sh
URL=`echo $2 | sed 's/.*(\(.*\))/\1/'`
/usr/bin/firefox -new-window $URL

Is it just me or does this seem like a pretty gross Eclipse bug?

Emacs features I miss in Eclipse

It's been about 2 years since I bit the bullet and abandoned my
beloved Emacs in favor of Eclipse for Java coding. I don't
really regret this. Eclipse's many features offering specialized
support for Java (things like Organize Imports, Generate
Getters and Setters, all the refactoring commands, etc.) make
this a no-brainer. Yet I still find myself occasionally dropping
back into Emacs for these indispensable features:
  • Defining macros on the fly with M-(, M-) for repetitive changes.
  • M-X sort-lines. If I'm working on some kind of list like a list of JAR files in a classpath where the order doesn't really matter, I like to have them in alphabetical order. Eclipse doesn't really give you any way to do this.
  • Dired (file manager)
  • Split-window (C-X 2), split-window-horizontally (C-X 3).
  • All the downcase/upcase/capitalize commands.
  • Case-smart search and replace. I'm constantly repeating the same search and replace 2 or 3 times in Eclipse because Eclipse can't figure out that if I want to change 'string1' to 'string2', then I probably also want to change 'String1' to 'String2'. Emacs just quietly Does The Right Thing.
  • Comment-dwim (M-;) Inserts end of line comments, aligned at a preconfigured column or just at the end of the line if the line is already longer than that column. If a comment is already present, aligns the comment to the appropriate column and places the cursor at the beginning of the comment. Does multiple lines if a region is selected. Works the same way in Java, Perl, C, etc. using the appropriate syntax for the language. Great for adding a short comment to every element of a list neatly aligned in the same column. DWIM stands for 'do what I mean'.
  • Indenting and filling that works for comments.
  • Ironically, Emacs' compact and lightweight memory footprint, by comparison.