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


This is my life

For better or worse, I live with a Coke addict. If we happen upon a restaurant that serves Pepsi, it better also serve the best damn whatzits in the city or chances are we won't be back. At least she doesn't ask them in advance to screen out the Pepsi-servient restaurants before arriving.

Pepsi is the ichor


Suspend To RAM

Phew. Solved the suspend to RAM issue, after a few annoying crashes.

For details and links to required .deb packages, see this script, /etc/init.d/ibm-acpi

The above script/instructions permits suspending to RAM in response to Fn-F4 keypress and optionally, closing the lid as well.


Performance tuning the Linux lappy

Some do's and don'ts for performance tuning (disk, battery, swap) your Thinkpad with ubuntu/debian:

DO use a swap partition.

/dev/sda3 swap swap sw,pri=1 0 0

DO replace apmd with powersaved, and install kpowersave. This gives you a system tray icon for configuring cpu behaviour (throttling when running on battery), and a way to suspend to RAM ("sleep mode"). Now I just need to figure out how to map that to my Fn-F4 key.

DON'T mount your /tmp folder using tmpfs, unless you want to see the machine crash. It's not as fun as a BSOD, but it's a much bigger pain to recover from. You could also have a dedicated partition for /tmp if you want to restrict it to a given maximum size.


How to make your shell prompt prettier

It's been a long-standing kvetch on my part that when navigating deep directories in a Konsole window (or really, any xterm), when the paths get too long the line wraps on top of itself. So, today, as part of Think Fridays, I decided to solve this problem.

Step one: put the script lspathseg in your /usr/bin/ or somewhere else where your $PATH can find it.

Step two: use it in your /etc/bashrc like this:

export PS1="\$(lspathseg 2) \$ ";

Additionally, if you want to play with colour in your prompt, see my /etc/bashrc for how to do that.


Notes 7 + SimplyMEPIS 6 = one sweet lappy

Well, I've finally got my Thinkpad set up just the way I like it: running the latest SimplyMEPIS 6, KDE 3.5.3, and kernel 2.6.15-27-686. Goodbye, Windows! After a couple days of pain, I managed to not only get Notes 7 working through the IBM Lotus Workplace client (aka a bloated Eclipse RCP app), and annoyed at having to search in several places for instructions and packages, I've written an interactive installer script. Instead of being a recipe for what to do, it does it all for you! The script should work for any ubuntu-based distro, but you might have things missing from your etc/apt/sources.list, like the multiverse stuff. Anyway, it's bound to be hella easier to use than the old manual trial and error method. Drop me a line if you use it and it works for you!


And the winner is...

Ah, Scott Adams, you've entertained me again. I raise a burrito to you. I'd always thought so, and now there's "enthusiastically unscientific" proof that the USA is as weaselly a country as North Korea. Heh.


Patch & Buddy, Verminators

Another day, another dead raccoon. And two rather muddy dogs. I've lost count over the years, but I'm sure this has to be at least the 10th raccoon they've discouraged from knocking over trash and recycling bins in my neighbourhood. I've heard Toronto has the highest raccoon population of any large city in Canada, so it's a daunting task, but they do it with pride.

After a leap from the top of the bluff west of Livingston Rd., they proceeded to slide down the side of the bluff after a rather massive raccoon (wider than either of them), who as usual was no match for a pair of experienced Pointers. After a few minutes and a few yards of sliding though the mud, they were done. We walked home and they were bathed shortly thereafter. More photos here.


You'd think common sense would negate the need for a law here

This summary is not available. Please click here to view the post.


News from Google

Two items to report:

  • Google Personalized Homepage now includes tabs and collapsable modules (though there seems to be a bit of a caching bug)...
  • Just found the blog Google Operating System which is awash with tips, tricks, and insights from the world of Google's APIs and toys. A must read for the Google-obsessed.


The Wicker Man

Yowza. Got dragged out to see the remake of 1973's The Wicker Man, starring my most beloved of craptactular actors, Nicholas Cage. It was great to escape the clutches of the office for a few hours, and for that I'm grateful... but geez. I suppose I should have expected this from the cast, which includes:

* Diane Delano, whose only role in the film was to remind me of Kathy Bates in About Schmidt and worry me for nearly 90 minutes that there'd be a similar scene here - though thankfully there's nothing so scary in this flick; and

* Molly Parker, who reminds me that some Canadians should stick to Canadian films, like the highly entertaining Men With Brooms.

If you're thinking of seeing this, I recommend renting it or seeing it in a nigh-empty theatre so you can MST3K the hell out of it as you watch it - yes, it's that bad. (Or good, depending on your point of view.)

Some quotes from, which gave this remake a rather fitting 14% freshness rating.

"Watching Cage karate chop Leelee "Made-for-TV" Sobiesky into submission is almost worth the price of admission. Well, assuming admission was free."
"Nic meets his ex-fiancé, Willow, whose submarine-sized lips seem to be gradually folding around her head like a collagen Venus Flytrap."
"For viewers, the biggest challenge may be holding back screams of laughter as Summersisle is revealed to be the Island of Awful Acting. ... the original film ended with a sudden shock, this one climaxes with high hilarity."
"The plot is nonsensical but the cast and Edenic setting is worth a look."
"The most risible backwoods thriller since M. Night Shyamalan traveled to The Village."

I'm afraid I have to agre with that last one, and so, to quote Seth Green and the gang from Robot Chicken, "What a tweest!"


Picasa rocks!

I've recovered most of the photos that were online before I was hacked last fall, and posted them here. (Note the new sidebar item too.)


Testing out Picasa2 for Linux

  Still looking for a simple solution to publish pics online (instead of my old technique of running Photoshop macros and a bit of manually updated PHP). Testing, testing, one-two... Posted by Picasa

(BTW, this is a shot of Lynn Canyon taken in March 2006.)


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


Could someone explain spamvertising to me?

I just don't get spamvertising. The ones with virii, infectious attachments, or ads for viagra, sure. Hell, even the phishing scams to get me to enter my paypal or banking info make sense. Some are just plain comical. But lately I've been getting a lot like this:

Subject: Eradicate all that you are indebted for without sending an other dollar

"Man! You have got one satisfied customer here. You see I availed myself of your services to completely Abolish all of my $52,000.00 in credit card balances. I was given the opportunity to discontinue all payments at once without using insolvency, counseling, or bank counseling.

Now, I'M back in the driver's seat and ALL of my high-interest obligations, fines, and fees are gone Legally and rightfully For good.

You are reputed to be the number one nationwide I totaly agree I will be mentioning all my relatives and officemates to call you. They would be insane not to get in touch with you straight away.

I can not thank you enough,, you have made life much brighter for me". Johnn C. in Texas

xxx--yyy-zzzz (phone number removed in case it's a real one)

Thorough knowledge or to bring to an end obtaining or to view our location

Rob stirred uneasily in his sleep, and one of the Turks drew a slight but stout rope from his breast and with gentle but deft movement passed it around the boy's wrists and drew them together behind him.The action was not swift enough to arouse the power of repulsion in the Garment of Protection, but it awakened Rob effectually, so that he sat up and stared hard at his captors
What are you trying to do, anyhow? he demandedm15

Is the idea that if they can't convince me to call them based on a good customer testimonial, they'll hook me in with a little gay pr0n?

Welcome Back, Opie

Well, after a few weeks with GPE, I decided it was time for better app support, so I've switched back to OPIE. Here's the log:


  • Fix /etc/network/interfaces - set up wlan:
     # Wireless interfaces
     auto wlan0
     iface wlan0 inet dhcp
     wireless_essid %YOURSSID%
     wireless_mode managed
  • Start up the wireless network
    $ /etc/init.d/networking restart

  • Install openssh-ssh (client), openssh-sshd (server), and openssh-sftp (for use with synching later)
  •  $ ipkg install openssh-ssh openssh-sshd openssh-sftp
  • Edit /etc/ssh/sshd_config. Change the default port from 22 to something else.
  • Edit /etc/ssh/ssh_config. Add aliases to local desktop and zaurus, eg:
     Host dbz
     Port 11122
     Host zaurus
     Port 10122
  • Restart openssh:
     $ /etc/init.d/sshd restart
  • Disable dropbear - make it exit before doing anything. Can't uninstall it since it's required by task-bootstrap.
     $ /etc/init.d/dropbear stop;  mv /usr/sbin/dropbear /usr/sbin/DISABLED_dropbear;  vi /etc/init.d/dropbear 
  • SSH from remote desktop to zaurus:
     $ ssh -p %anotherPort% %zaurusUser%@%zaurusIPaddress%
     $ ssh -p 10122 nickb@
  • Create .ssh keys:
     $ ssh-keygen -t rsa -b 2048
  • Copy ~/.ssh/*.pub on machine from which you want to connect to the Zaurus keylessly into ~/.ssh/authorized_keys on the zaurus. Try reconnecting as above, should not get a password prompt.
  • Terminal tools

  • Add source for perl: create /etc/ipkg/perl-feed.conf, containing:
     src/gz x11
  • Then install:
     $ ipkg install bash less perl rsync
  • Add a new user
     $  adduser nickb;  cd /var; chmod o+w,g+w tmp;
  • NOTE: DO NOT set all files in /tmp (just tmp) to be o+w,g+w or Opie won't boot gui on reboot!!

  • Bash config: Edit /etc/passwd to make root and your other user(s) use bash instead of sh.
  • Create /etc/bashrc and /etc/alias files, then point to them with .bashrc and .bash_profile files in home folder:
     #  ~/.bash_profile
     . ~/.bashrc
     #  ~/.bashrc
     [ -f /etc/bashrc ] && . /etc/bashrc
     #  /etc/bashrc
     source /etc/alias
     # 1;34: blue, 1;33: yellow, 1;32: green, 1;31: red, 1;30: grey, etc.
     if [ $UID -eq 0 ]; then # root
       prompt="\[\033[1;31m\]\u@\h\[\033[0;39m\]:\[\033[1;31m\]\w\\[\033[0;39m\] \$ ";
       prompt="\[\033[1;30m\]\u@\h\[\033[0;39m\]:\[\033[1;34m\]\w\\[\033[0;39m\] \$ ";
     # If this is an xterm set the title to user@host:dir
     case $TERM in
         export PS1="\! "$prompt"\[\e]30;\u@\H:\w\a\]"
         export PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
         export PS1=$prompt
     #  /etc/alias
     alias   ll="ls -lA"
     alias   rm='rm -i'
     alias   cp='cp -i'
     alias   mv='mv -i'
     alias   al='vi /etc/alias'
     alias   sra='source /etc/alias'
     alias   H='history 50'
  • Sound

  • Copy an mp3 file to your SD card (or scp the file onto the hard disk. Open Opie Media Player, add the dir where you put the file, and play it. While playing, start a Console and adjust the volume - run alsamixer and adjust sliders for Bass, Treble, PCM (main volume) and Mono.
     $ alsamixer

  • Install mutt, mailx, sendmail, ssmtp, fetchmail
     $ ipkg install mutt mailx sendmail ssmtp fetchmail
  • Edit /etc/ssmtp/ssmtp.conf to enable smtp to send mail using you existing smtp setup from another machine:
     # Where will the mail seem to come from?
     # The full hostname
     # auth user must be your remote email username
     # AuthPass must be your remote email password
  • Games

  • Install games (let's be real, this is the real reason I switched to OPIE!)
     $ ipkg install task-opie-games task-opie-extra-games atomic
  • This will include: Asteroids, Atomic, Backgammon, Bounce, buzzword, fifteen (slider puzzle), go!, Kill Bill, KCheckers, KPacman, Mindbreaker, Mine Hunt (a la mine sweeper), OYatzee, ParaShoot, Patience (solitaire), SFCave, Snake, Tetrix, Tictac (toe), Word Game (a la Scrabble), ZLines (a la FivePlus, Lines, etc.), ZSame.
  • Refresh icons in Opie desktop - run Settings > Reload Icons, or the following:
     $ /opt/QtPalmtop/bin/
  • Backup/Rsync

  • Back up install using rsync from remote machine (this can be put in a script file and run in your crontab):
     # Save as ~/BIN/
     cd /home/nickb/zaurus/_RSYNC_Zaurus_SLC3200_OPIE
     for f in usr etc home; do 
      rsync -qrpogtz root@zaurus:/$f .; 
  • Edit your crontab with crontab -e. You might want something like this, to run a backup once a week at 4am:
     # m h  dom mon dow   command
     0 4 * * 6 /home/nickb/BIN/ 
Note that for this to run unassisted, the user on your desktop whose crontab this is added to much have ssh key access to root@zaurus, where "zaurus" is an alias as defined above in /etc/ssh/ssh_config on the desktop.


The Land of OZ, Days 2 - 3

Day 2 (GPE)

Problems, con't:

  • Due to suggestion in OZ wiki, set / partition to 150M; filled almost immediatly w/ files in /usr/lib (while installing gxine or something). Since busybox's find doesn't support the -maxdepth or -exec flags, got sizes of subdirs of a given folder with:

     $ alias dirsize='alias ls=ls;for f in `ls`; do du $f -sh; done'

  • Gxine dies in fullscreen mode; no sound. Found a note about alsamixer, but haven't tested that out on GPE yet.

  • Sylpheed doesn't start (probably due to lack of disk space, as per above)

  • No backup/restore - but I should be able to run rsync

Day 2 (OPIE)

Decided to try OPIE for comparison. Wasn't any better - in fact, I found it worse.

  • Gaim won't work; Gaim-Sametime won't install (missing dependency)

  • XMMS - no sound / won't play; Opie Media Player - won't play MP3

  • Eligo, ZSolitaire won't work

  • No way to resize/rotate games when really small
  • No way to change ugly default opie background
    • Update: Use Settings > Launcher > Tabs > (pick a tab) > Edit > Image > Select...
  • No way to set alphanumeric PIN for password protection (numeric only)
  • No card management applet in task tray
  • No volume applet in task tray

  • Appearance crashed

  • After reboot, sound works in XMMS and OpiePlayer, but no volume control, except by running alsamixer in a terminal.

Day 3 (GPE)

Gave up on OPIE after a day; tried CackoROM (SL-C3200-Qtopia-1.23-2125070506) but it wouldn't boot; after two tries I decided to go back to GPE. Could have been a problem with SD card being ext2; could have been a problem w/ paritions on hda (ext2 vs. ext3, ext2 vs vfat). Not sure.

  • Installed rsync on zaurus (already on desktop); worked great - used this script (running on to do the synching; will add to crontab later:
    cd /home/nickb/zaurus/BACKUP; 
    for f in etc home usr; do 
      rsync -rv zaurus:/$f .; 

  • Solved problem reported earlier about being unable to copy & paste in terminal window: use xmonobut applet!
    • tap once to activate middle button (paste)
    • tap again to activate right button (select?)
    • tap third to revert to left button

    So to copy/paste text in terminal:

    • select text to copy,
    • tap xmonobut applet icon once,
    • tap in terminal to paste at cursor location, then
    • tap twice to reset to left button.

  • 2006-07-08

    Get your red-hot bits here!

    I've offered up some bandwidth to the OpenZaurus folks so that those of you in North America can get your bits from this side of the pond. Details here:

    MIrror site here.


    OpenZaurus released!

    The latest OZ was released this week, after much anticipation. It's the first OZ to support my new C3200, and I'm happy to report that after a few hours I had nearly everything working!

    Below are a few of the gotchas I encountered:

    • Can't save wireless config settings with Network Setup: get error "No write access to network configuration"
      solution: hack /etc/network/interfaces
      # Wireless interfaces
      auto wlan0
      iface wlan0 inet dhcp
      # uncomment next three lines if want static IP, for example
      wireless_essid <YOUR_SSID>
      wireless_key s:<YOUR_STRING_BASED_PASSWORD>
      wireless_mode managed
    • Can't save Owner Information - data not written to /etc/gpe/ so login screen always defaults to "GPE User"
      solution: create file with contents like this:
    • [gpe-ownerinfo data version 2]
      Nick Boldt
    • No way to remove applets from taskbar with Applet Manager
      solution: hack ~/.matchbox/mbdock.session
    • Network Shield isn't set up to run as root
    • Login Setup doesn't respect the 'show owner information at login' checkbox (it always shows it even when unchecked)
    • Terminal has no copy/paste function (unlike opie-embeddedkonsole)
    • Package Manager should have search/filter and concurrent description display functionality
    • After first flashing (before creating filesystems for /dev/hda2 and /dev/hda3) in vi, the 4-way pad is rotated 90 degrees, but can't reproduce this bug anymore
    • Closing clamshell halts device (won't restart). Also can't reproduce this problem since a few reboots.
    • Changing default user's shell from /bin/sh to /bin/bash prevents ssh access (using dropbear) to device
      workaround: change /usr/bin/ to use bash instead of sh when launching terminal: exec /usr/bin/rxvt -e bash


    Dog Paddling Adventures - Massassauga Provincial Park

    Had a great time this weekend with K, Patch & Buddy up at Massassauga Provincial Park - only saw one snake, and it wasn't the rattler for which the park gets its name. Thanks to everyone - two- and four-legged - who joined us and pitched in to share the work and the fun! Special thanks to Donna and of course Jessie (!) for making it a memorable experience as always.

    Photos are here.


    More sleep = better life?

    OK, I get it. No sleep and and all geek make Jack a dull boy. Or dead sooner. I suppose I should add 'get more sleep' to my IDP for the year. ;-) More discussion here: Ubersleep? Hacking Sleep? Stupid!


    Something Wicked This Guild Comes?

    Found this article in the Star about some possibly paranormal activity at the Guild Inn, just down the road from my house in the 'Borough. Checking out the spirits. Eenteresting.

    No patch for human stupidity

    Pity, that. Just finished reading Greg Bear's novel 'Darwin's Radio', which suggests that at least at some point in the future, we - as a species - can look forward to an upgrade, if not a patch. In the meantime, we have to endure the ongoing barrage of idiocy out there, including all the anti-Microsoft malware out there, which has actually gotten them to the point of suggesting that recovery requires reinstallation, something I've been saying since the NT3.5 days. ;-) Well, that and that a Microsoft operating system typically has a half-life of just under 2 years before it becomes functionally useless, either just from use or from infection. kubuntu, anyone?


    A new skin

    Well, after much ado, and much better things to do, I've finally gotten around to installing a new skin for this blog, along with contact info. Very little point in resurrecting the old site, now.


    Multitouch Screen

    So very cool. Finally there's technology & software to make human-computer interaction more fluid, like it is in the real world. Have a look...