Monday, November 10, 2008

Broken Windows Updates

This post was inspired by a folder cleanup in which I found a note to myself from earlier in the year (May 27, 2008). I'm putting it here as a quick reference, as it's the sort of thing that happens once in a while, and filtering through all the google hits can be time consuming when you just need to fix something now. *

Symptom: Neither Windows Update or Microsoft Update would complete. The machine in question in this instance was a vanilla P4 somethingorother, running XP pro. Before finding this solution I tried a bunch of things, including an install of Service Pack 3.

You can read the full thread on the techarena forums. I found it via a google search, I'm not familiar with this forum in general. The bit that I needed is from post 3 in the thread:

Start regedit.exe and delete the following key (contains the WU
service configuration):

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es\wuauserv

Do a reboot now!

Then run this command line (from a command prompt of from Start/Run, it
installs the AutoUpdate service (line will wrap in the newsreader!):

%SystemRoot%\System32\rundll32.exe setupapi,InstallHinfSection DefaultInstall
132 %SystemRoot%\inf\au.inf

(it must be a space between DefaultInstall and 132)

If it asks for your OS CD-ROM to get some files, just point it to the
folder %windir%\System32 (%windir% is typically C:\Windows).

Then run the following commands:

regsvr32.exe wuaueng.dll
regsvr32.exe wuapi.dll
regsvr32.exe wups.dll
regsvr32.exe wucltui.dll

Do a reboot again.

Then check if you can start and stop the Automatic Updates service
successfully from services.msc

These steps repaired the problem.

* Caveat: This sort of stuff does change from time to time, but it should still serve as an indication of the sorts of problems you should look for if you have similar symptoms. At the very least, you might include some of the relevant terms in your search to speed things up.

Sunday, October 12, 2008

Resizing the swap partition size after install

I just increased the amount of RAM in an Ubuntu web server from 256 MB to 1 GB. I wanted to increase the size of the swap file accordingly. There are various schools of thought as to how big the swap file should be, I went with 2 GB which is almost certainly overkill, but there you go.

My procedure was as follows:
  • Boot to using the Ubuntu8.04 live CD.
  • Use the partition editor to shrink the primary partition, and grow the the swap file partition and volume.
  • Write the changes to the disk.
  • Reboot to the server command line.
  • Determine the swap volume's new UUID using:
ls -l /dev/disk/by-uuid
  • Edit /etc/fstab and change the UUID for the swap partition to the correct value
  • reboot
  • Check that the partition is correctly mounted with the "free" command. Don't mind that you may not be using any of the swap at present, but you can at least tell that it's there for when you do need it.

Text editing with multiple files on the command line

To make my life easier, and considering that my web server doesn't have a GUI I first saved the output of the ls command to a text file, and edited that so that it contained just a single line containing the UUID
I then opened fstab
sudo vim /etc/fstab
and then, at the end of fstab, I inserted the file I'd created with the command:
:r /home/john/uuid.txt
I copied the UUID to the appropriate spot, deleted the line at the end and saved the file.

There are plenty of good tutorials and command summaries for vi / vim around on the web if you need them. (here's one, and another). I admit I'm somewhat conditioned to using graphical editors, but one doesn't always have a choice.

Wednesday, August 6, 2008

VMWare server on Ubuntu

I recently allowed my Ubuntu 8.04 desktop machine to do some upgrades, including some kernel updates. Everything went fine, except that my VMWare server would no longer run, it would start, I'd see the "Starting VMWare Server" block on the panel, but then it'd disappear.

It turns out that VMWare server installations are coupled quite closely with a particular kernel. This sounds sensible, after the fact, but all it really does is point out how shallow my *nix knowledge is in some areas.

Anyway, this fixed things just right, accepting all of the default options along the way:


Edited to fix spelling, and add that I had to repeat this exercise again after another Kernel upgrade 15/08/2008. Trivial after the last time, although still somewhat annoying.

Saturday, May 31, 2008

Amarok setup

On Susanne's PC:

Installed MySQL client from repos

Edit /etc/mysql/my.cnf, adding this line to stanzas [client] and [mysqld]:
default-character-set = utf8

sudo /etc/init.d/mysql restart

installed mysql server
had to enter password

susanne@arwen:~$ mysql -p -u root
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.0.45-Debian_1ubuntu3.3-log Debian etch distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

set password for root@localhost = password('xxxxxxx');

mysql> CREATE DATABASE amarok;
Query OK, 1 row affected (0.02 sec)

mysql> USE amarok;
Database changed
mysql> GRANT ALL ON amarok.* TO amarok@localhost IDENTIFIED BY 'PASSWORD'
-> ;
Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

mysql> Aborted

Friday, May 16, 2008

Long file names and removable media

I was recently trying to copy a bunch of files onto an SD card, and kept getting an "out of space" error message, which was kind of odd, considering the 300 or so image files added up to a grand total of just over 20 MB, and the card was en empty 1 GB card.

Much poking, prodding, trying stuff from the command line and googling resulted in me learning more about VFAT than I'd originally intended. Anyway, it turns out that the implementation for long file names in VFAT is a workaround which means that if you have too many(1) long file names in the root directory you may chew up all your allocation units and get "out of space" errors long before the media itself is full.

Files in sub folders are not implemented in the same way, and therefore don't exhibit the same behavior. Put all of the files in a subdirectory and all is well.


Wikipedia's entry on various implementations of Mr Gates' File Allocation Table.

A MEPIS forum post that really pointed me in the right direction.


(1) How many depends on how long your file names actually are, you use one extra directory entry for every 13 characters. I think it's 512 directory entries, so assuming I had 302 x some number greater than 1, I was bound to run into problems.

Wednesday, May 14, 2008

Torrents and such

I should probably do a general guide on torrent clients and sensible practices.

For reference:
I found a good description of abbreviations for TV episode torrent descriptions here, on Mininova.

Windows XP Service Pack 3

I've just completed my first trial run with XP service pack 3. I installed it on top of a fresh copy of windows XP Professional, installed i a VMWare virtual machine. It installed without a hitch, seemed faster than the SP2 installation.

I've since run a Windows update check, and there were only 3 "high priority" updates. Not perfect, but much better than the several hundred MB of downloads and several reboots required after an SP2 installation.

My plan is to install a few basics and keep a copy of this VM for use as a base for various tasks. The first one will be a Visual Studio 2008 VM. 8 GB will probably be just enough* for this, but if I can keep it to 8 GB I can burn copies to DVD. My intention is to have task specific VM's, rather than one do-everything machine.

It will require a little more discipline, but I think it will serve me better in the long run, especially as I do more and more on Linux. Launching a Windows VM on demand should be more convenient than dual booting, except perhaps for gaming. However, my computer gaming time is pretty much non-existent these days, so it's not really much of a sacrifice.

* As it turns out, 8 GB really insn't enough for Visual Studio 8. Actually, the install was OK, but I removed C#, leaving me with less than 1GB. This, unfortunately, is unsufficient to install any of the docoumentation and reference material. I'll see how this goes, I can almost certainly have the doco on a second monitor / machine in most instances. Otherwise it'll be a 10-12 GB build.

Tuesday, May 13, 2008

Music for Norm

For future reference:

The music from Norm's Tai Chi DVD is made by "The Silk Orchestra".

Here's a CC-Now link. The particular tracks on the DVD are are called "Remembrance" and "Mr Wu".

Monday, May 12, 2008

Ripping Audio from a DVD

I was recently asked to get the audio from a DVD and place it on a portable media player. Here's how I did it, using Ubuntu 7.04.

1. Installed mplayer from the repositories

2. played the various chapter until I found the one I was looking for. This can be a bit of a hit and miss process, as DVD's often have rather strange title/chapter builds. The command is:
mplayer dvd://4
Where the "4" refers to the title number. This particular DVD has 6 titles. Apart from playing the chapter, you'll see a bunch of stuff in the console window. click "x" to stop playing. The output includes the following:
Playing dvd://4.
There are 6 titles on this DVD.
There are 2 chapters in this DVD title.
There are 1 angles in this DVD title.
audio stream: 0 format: ac3 (stereo) language: en aid: 128.
audio stream: 1 format: ac3 (stereo) language: zh aid: 129.
number of audio channels on disk: 2.
number of subtitles on disk: 0
MPEG-PS file format detected.
VIDEO: MPEG2 720x480 (aspect 2) 29.970 fps 7500.0 kbps (937.5 kbyte/s)
xscreensaver_disable: Could not find XScreenSaver window.
GNOME screensaver disabled
3. The red text above shows the information I needed. There were two audio tracks for this title, I was after the english (en) version. The command to extract the audio is: (This is meant to be all on one line)
mplayer -vc null -vo null -aid 128 -ao pcm:fast:waveheader:file=output.wav dvd://4 -chapter 1-2
The "128" refers to the audio track found in step 2.
"Output.wav" is the output file name.
chapter 1-2 means I want the audio from both chapters. "2-2" would have taken only the second.

4. Import the wav file into audacity, a superb audio editor.

5. I then used audacity to crop and normalize the audio I wanted, including adding nice fade ins and outs.

6. I Again in audacity, export the audio to mp3.

All Done.


Most of this is derived from this post on the Ubuntu forums.

Wednesday, April 16, 2008

John's time sink, Issue #1

This post is essentially a copy of an email I sent to a number of deserving victims.

Rather than forward every amusing thing I come across, I saved a few for later recommendation, distilled them, lost or threw away most of them, and decided to inflict what remained on a few of you. I also cleaned out a bunch of old temporary bookmark folders, so there's all sorts of randomness up for grabs.

Feel free to read/watch whatever takes your fancy. I'd be worried if any of you found that all the stuff that amuses me did the same for you. I'm pretty sure there's nothing outright offensive here, though.

Some sciency goodness:

A super shrimp that can detect circularly polarized light and punch through crab-shells or aquarium walls. (A new edition for the monster manual, perhaps)

Colour tile illusion. I didn't believe A and B were the same colour either. I used both a web colour picker, and slid some blocks around in a drawing program to make sure. Sometimes scepticism hurts.
General humour:

Now that April 01 is long gone ,and it's as safe to surf the internet again (well, as safe as it ever is). My pick was Unusual penguins Needs sound, documentary style, work safe.

Web advertising as it should be. Music and sound, but quite work safe.

Vaguely techy / general web stuff:

I admit I'm nerdy enough to think that Tresling would be cool. Probably a great drinking game, until the day after. (Has music, oh does it it have music)
The nerd handbook. This article has quite a few cliches, but some nuggets of truth too.
A comic predicting the future of the OLPC program.
Try this real-quick online quiz. I got 9 out of 12. I'm not sure if that's good or bad. (Actually, there's about a 7% chance you could get that score with a coin toss) Porn star or my little pony?

Weird, but amusing. (But weird)

I've no idea how I came across this story/blog. It's about the tracking down of a drawing some guys dad used to do all the time. It sounds riveting, I know, but I thought it was cool. Here's the first part.

Kids / Parenting related

From the foul mouths of babes. A cool discussion of young kids and bad language. You only have to see what's on mainstream TV now to realise that we need some newer, more offensive swear words, the old ones are getting somewhat passe.

"Why I let my 9 year old kid ride the subway alone". This one is controversial, and I'm not 100% sure on where I stand on this, but I'm certainly leaning towards agreeing with the article writer. I will , of course deny that if any of you call DOCS.

In a similar vein, here's a good video titled "5 Dangerous things you should let your kids do." (TED do great talks on all sorts of things)

What your kids know about science. Real answers from 5-6th graders. " I am not sure how clouds get formed. But the clouds know how to do it, and that is the important thing. ". Sounds about right.

Done, you can go outside and play now.

Recovering photos from a dodgy XD card

I've done data recovery from portable/removable media before, but this is the first time I've done so under Linux.

I used "photorec", which is bundled with "TestDisk", the latter being the main part of the package, however I didn't actually get any images back until I used photorec itself.

It's a simple text based tool which is quite intuitive to use, and available from the repositories, so installing it was a snap. (Search for "TestDisk"). My discovery started with the results of a good old google (surprise surprise), here at

Anyway, I recovered the images from the card, and have re-formatted it, so hopefully it'll be some time before it causes any more problems. Mind you, at 128 MB, that particular card is a bit of a dinosaur, and on the small side.

I'm not sure what actually caused the data corruption. A couple of times I've had the camera lock up when shooting video when the card has been almost full. It's an Olympus C760 using XD, and been a pretty good all round camera.

Friday, April 4, 2008

Stuff to get for the kids

Note to self, inspired by Neil Gaiman's blog:

Look for:
"Odd and the Frost Giants"

Another book:
The Starry Rift (Amazon) via boing boing

Wednesday, March 5, 2008

One campaign ends ...

Gary Cygax has died.

I heard it via email from a friend and fellow gamer. As it turns out, this was about 5 minutes before reading it on a variety of news sources and forums I frequent. Not surprisingly, this news has travelled quickly, far and wide. The article originally sent to me was from slashdot:

Ask Slashdot: How has D&D (and tabletop roleplaying) touched/improved your life?

I think this is a good idea, and some of the responses make a good read. I, however,am not a slashdot poster, and figured I might as well use one of the platforms I do have. Thus the post you're reading right now.

In short, I think I'd say that D&D introduced me to genre of gaming that's got more to offer than most others, in my humble (but correct) opinion. It's fun, challenging, engaging, often unpredictable, forces me to think in areas outside of my expertise, and assume roles outside of my normal experience and/or comfort zone. That, and a chance to hang around with friends and just talk crap.

I won't make any of the obvious jokes. There are enough "failed saves" and resurrection jokes floating around now to easily fill 3d20 bags of holding. Besides, many of them are much better crafted than any I could come up with.

I didn't know Gary Gygax, so my thoughts are really about the game and it's impact, not the man himself. It turns out that he'd been of poor health for quite some time, and I honestly had no idea. He was, however, a guy largely responsible for creating a gaming genre that is a legacy few could hope to surpass. Game specific material aside, I've only read book of his, which from memory was a generic strategy / mapping guide of some sort, and a good read from memory. Google has failed me this time, I'll have to see if I can find the actual book at home.

People who enjoy the genre that is role playing, turn up almost everywhere I choose to spend my time. I find that people whom I've enjoyed discussions with in environments where we don't usually know much about each others backgrounds, or have a lot in common (thinking largely of on-line communities and the like), often turn out to be gamers.

That's not to say that I automatically like all the keen gamers that are out there, or that gamers are universally friendlier, smarter, less smelly or more amicable than any other group. They're not. There may even be empirical evidence that the converse is true for one or more of those attributes. My point is though, that of those people that I find myself getting along with, and wanting to spend time with, gamers, or at least people who are "game/gamer friendly", make up a larger proportion than would be expected statistically.

It's a matter of getting that causality/correlation deal properly sorted out. I think that bright, open minded people looking for a bit of fun are likely to end up being attracted to all that RPG's have to offer.

This is as good a reason as I'll probably ever have to resurrect an old page from a now defunct personal web-site, under the auspicious title of "games":

If you came here hoping you'd get to zap aliens or spank a monkey or some such nonsense, too bad. There are no flash/animation games here.

I'm a semi-keen gamer, mostly of the RPG (in a room with (mostly)real people) or real-time strategy (PC based) persuasion. While my busy schedule doesn't allow for much actual gaming these days (please, no flowers), I can still dream. right? If you think that my mention of RPG's makes me the spawn of Satan, you could well be right. Or not. I tell you what, roll 2d6 and consult the table below.
1: You're absolutely correct, gamers have no place in this universe.
2-10: Actually, you're just a narrow minded tool who likes nothing more than a good stereotype. You prefer games with a high probability of head injury.
11-12: You've probably run out of fingers. Please refer to the entry for results 2-10.
Have a nice day.

I thinks it's also a good time to point out a link to a great article by Garry Pellino, called "The Shame of the Game". I don't think it's as bad now as it used to be, although this could simply be the result of me being older, wiser, and less bothered by others opinions. It may still be a big deal for, say, a high school RPGer. I've got a decade or so before I have to worry about this on behalf of my kids.

Of course, wikipedia has a good article on Garry Gygax. Apparrently, he said:

"I would like the world to remember me as the guy who really enjoyed playing games and sharing his knowledge and his fun pastimes with everybody else."

Sounds like a pretty good sentiment to me.

A couple of links to related items at other places I frequent:

Pharyngula The Dungeon Master fails his saving throw. Some amusing and well composed comments below the post.

Skeptic Friends Network: RIP Gary Gygax

Boing Boing: Dungeons & Dragons Creator Gary Gygax Passes Away

The Register: Dungeons and Dragons co-creator Gary Gygax dies.

Thursday, February 28, 2008

Audio format conversion

I recorded some audio (my daughter singing), and wanted to send the audio to someone in a generic and friendly format, namely mp3. The Nokia handset records as an amr (Adaptive Multi Rate) file. A good player, like VLC will play this quite happily as-is, but a lot of people wouldn't know what to do with an amr file.

Ubuntu talks happily to my phone, so getting files off is easy. I have a USB data cable (CA-53) for the phone (Nokia 6234). Ubuntu mounts the micro SD card automatically, if you choose "Data mode" from the phone menu once plugged in. "Default mode" doesn't work. Depending on how your handset is setup, you may have to use the handset interface to copy stuff from the phone's built-in memory to the memory card.

I found a program called Mobile Media Converter, which does a great job. I simply downloaded the archive, extracted it somewhere and ran the executable from there. The interface is straightforward, and even supports drag'n'drop if you're into that sort of thing. No settings to tweak, it just works. It's based on ffmpeg, which you may or may not already have installed, but comes with it's own version, so should work regardless.

Tuesday, February 26, 2008

Fixing Microsoft Fonts

I needed to use fonts from documents from Microsoft office, as well as make available some other specialist fonts.

Essentially it's matter of copying the font files to an appropriate directory. I put them in:


After getting them there it's just a matter of reloading the font cache:

sudo fc-cache -fv

This link on another (far superior to this one) Ubuntu blog had all the info I needed.

Sunday, February 17, 2008

What's in a name?

Renaming a batch of files.

I needed to rename a bunch of images before uploading to flickr. The following worked well enough:

To preview: (Specified by the -n)

rename -n 's/Image/Saturday_/' Image*.jpg
Image000.jpg renamed as Saturday_000.jpg
Image001.jpg renamed as Saturday_001.jpg
Image003.jpg renamed as Saturday_003.jpg

To perform the task, delte the -n. or swap the -n for -v, verbose, which tells you what it's done.

rename 's/Image/Saturday_/' Image*.jpg

Essentially it's:

rename 's/old/new/' SearchFilter

Reference here.

Thursday, February 7, 2008

Roaming Multi-OS Thunderbird

Happy days.

I just managed to setup a relatively painless way to use Thunderbird as my mail client on both my Ubuntu machine, and a Windows XP laptop.


Late in 2007 my laptop had a coronary. It's had a long and fruitful life, but was suffering from a cracked mainboard, which caused the occasional instant shutdown if it was flexed at all. The LCD screen backlight was also dead, and I'd been using it with an external monitor (or KVM switch in most cases) for 6 months or more. Oh yeah, it also had a missing1 "Y" keycap. Since this time I've been using my Gmail account to check my main email address, and a handful of others.

To be honest, I didn't miss application based email all that much, the Gmail interface is pretty good. However, the ability to work off-line is nice, and I'd like to be able to randomly access archived business stuff, and a few other niceties, so I'd always intended to go back to Thunderbird at some point.

Back to the setup...

So firstly I installed Thunderbird onto a functional XP laptop I've been using, and setup Thunderbird to synch with Gmail in IMAP configuration. Gmail checks my other accounts, so I only need one account in Thunderbird. This also means if I'm at some other PC, I can still get to everything using the Gmail web interface. Good instructions for setting up Thunderbird/gmail IMAP can be found at bother lifehacker and google.

Once I was happy with the IMAP synchronisation I took the laptop home. It's worth making sure that you get all the settings just right, so that if you delete something in Thunderbird, it's available in the Gmail web trash bin, and that sort of thing. All the instructions are in the previous 2 links.

On my Ubuntu machine, I installed Thunderbird using Synaptic, and setup a default mail profile with the bare minimum to get it running. I didn't download any mail. Then I:
1. Copied everything from the Windows Thunderbird profile directory into the Ubuntu profile directory under a sensible name. (Here is where to find these directories)
2. Modified the profile.ini file to point to this directory.
3. Started Thunderbird and started using it on Ubuntu.

Actually, I did the transfer via a portable hard disk, and intend to keep doing tis, so that at any given time, there are at least 3 versions of my profile. You can never have too many backups. And, because I'm using Unison to automate all the synchronisation at the Ubuntu end, I've only got to manually copy stuff on the XP machine. I'll probably automate that using SyncBack, now that I come to think of it.

Still todo:

Settle on a contact management tool. I'm considering using my Gmail address book, I believe there are plugins to access it from Thunderbird. I'm not sure about this, I'm more inclined to do something more flexible to solve this problem. Maybe a home Zimbra server is in order.

1: Not truly missing, it's in a glassine bag in my laptop bag, somewhere.

Monday, February 4, 2008

Unplanned power disruption testing

I guess that's what you get for having a UPS on the floor under your desk, with the "test" button right about toe height. Unfortunately, the UPS in question has a battery more than a decade old, and my little test amounted to little more than pulling the mains plug straight out of the box.

Ubuntu 7.10 booted right back up, and I logged in again with no unusual messages or warnings. I pulled up firefox and restored it's crashed session, and here I am. Apart from an article I hadn't saved in Joomla, I didnt lose anything.

Note to self, I need a new UPS for the office. I should probably get one for the media centre box in the lounge room too.

Joomla is great, but . . .

Blogger is just damn too easy.

I'm messing around with a Joomla site at the moment (, and was posting thoughts as articles, thinking I'd present them in some sort of bloggish layout, but a self inflicted power outage caused me to lose the post (no fault of Joomla's) and decide to go for something quick and easy.

I may integrate this into the Joomla site, or may just keep them separate, who knows, for now, I'll use this for random posts. As I said, blogger is just too damn easy. Picking a colour scheme is not. I'm an engineer, OK. Bite me.