Much ado about scripting, Linux & Eclipse: card subject to change


Blogger is busted

Went to check my blog tonight and found this instead. Ah, well, could have been worse, much worse... however, after a few minutes worth of 'trying again in 30 seconds' it became clear that something was serious foobared here.


Beyond CVS for Linux

Solved a long-standing annoyance this week - using the BeyondCVS Eclipse plugin on Linux.

One day, if I have time I'll try to turn this into a fragment so that it'll work without outside effort, but for now, here's the HOWTO:

0. Install WINE using yum, apt-get, etc. as appropriate for your linux distro. (Chances are this is already installed.)

1. Install beyond compare, from Scooter Software. I installed it using wine into /opt/beyondcompare2:

 $ wine beycomp.exe 
2. Create a script (eg., ~/ to handle passing commandline args. Your script might require a different drive letter prefix, depending on your wine install - I've had to use both s: and z:. chmod your script so it's executable (chmod +x ~/

# collect commandline params and turn them into wine-friendly paths
while [ "$#" -gt 0 ]; do
  opts=$opts" s:"$1; shift 1;

/usr/bin/wine /opt/beyondcompare2/BC2.exe $opts
3. Test your script by running it in a console window.
$ ~/

4. Install BeyondCVS plugin and feature into your Eclipse 3.2+ install (or using a .link file).

5. Start Eclipse. Open up Help > Window > Preferences... > External Tools Launcher > Beyond Compare. In the field Path To Beyond Compare, enter the path to your shell script, eg., /home/nickb/ Leave the Show Debugging Info? checkbox enabled.

6. Select two files or folders in your Package Explorer or Navigator. Beyond Compare should launch under WINE. If it doesn't, open a console and run your script, passing the same two parameters shown in the debug info popup in Eclipse. As noted above, you might have to change the drive letter from s: to z: or something else so that WINE can find the files you passed it. If all worked, you can remove the Show Debugging Info? checkbox in the Preferences panel.

Happy comparing!


The cow says...

Logging in today, I actually got the BOFH cow to randomly mention division by zero!

To enable this in your ~/.bashrc or /etc/bashrc, install cowsay and fortune, then add this to the end of your script. Note that on some systems you get different fortune options than the ones I've got below.

if [ "$TERM" != "dumb" ]; then
  # define some colour codes to use 
  # eg., 36: cyan, 35: purple, 34: blue, 33: yellow, 32: green, 31: red
  # can also use darker version with 0;36, 0;36, etc.

  echo -e -n $col; # change colour

  # get a fortune and pipe it to cowsay, using the apt cow
  fortune -a 20% riddles 30% literature 10% fortunes 40% excuses     | cowsay -n -f apt.cow; 
  echo -e $norm; # return to normal
If you want to create your own fortunes, have a look in /usr/share/games/fortunes, then create a text file with each line being a unique message. In the example below, I called this file BOFH_excuses.txt, sourced here. Process the file with gawk to change this:
High line impedance.
Someone set us up the bomb.
Power surges on the Underground.
into this:
The BOFH says: High line impedance.
The BOFH says: Someone set us up the bomb.
The BOFH says: Power surges on the Underground.
$ gawk -F: '{ print "The BOFH says: "$1"\n%" }'  BOFH_excuses.txt > excuses; 

Now, each entry in excuses ends with a newline and a "%". Multi-line entries are also separated by "%" - see other files in the /usr/share/games/fortunes folder for examples.

To index your new file so that fortune can use it, you must run it through strfile:

$ strfile excuses excuses.dat

Finally, to test your new fortunes, run this:

$ fortune excuses

How'd you get your Notes email address?

From the 'answered too many times to count' department:

So, why codeslave in the first place?

I used to be nboldt... until I found a badly-documented feature in Lotus Notes (circa 6.0 or 6.5, I think) that lets you request a new shortname - that is, to change from to I think the reason for its being there was so that when women got married they could change their shortname to match their new lastname, eg. jsmith -> jjones.

So I became codeslave. I've also seen fivetwelve, zx and mo.

If you're using Lotus Notes 7.0b3 (aka NUL, or Notes Under Linux, though I always picture Nibbles from the show ReBoot when I think of NUL), this feature is still available. Sorta.

  File > Security > User Security
      > Your Identity > Your Names > [Name Changes...]

  To change your names, you should contact ________________ [Send Mail]

Oddly enough, the window says "You can request changes to your Notes user name, alternate name, and aliases," but if you click Send Mail, it only prompts for the new name, not the shortname... and while there's a handy li'l tool for sending a prefilled email...

  Please change my name to 'Nick Boldt'.  My ID containing the 
  new name is attached in case it is needed.

... it doesn't provide the name of the admin to send it to in the To: field. ;-)