Craig Box's journeys, stories and notes...


Archive for the ‘Technical’ Category

Debugging .NET - "Common Language Runtime Debugging Services Application has generated an exception that could not be handled"

Friday, May 11th, 2007

ProfileTool doesn't work on half the machines I try it on. I get an error like:

Profiletool.exe Common Language Runtime Debugging Services
Application has generated an exception that could not be handled.
Process ID=0x14 (1300), Thread Id=0xe8(232)

Click OK to terminate the application.
Click CANCEL to debug the application.

There's no point searching Google for the process ID and thread number; they're unique to your instance.

What can you do here? You get an error suggesting that 'debugging failed' if you hit Cancel - this is correct, because you don't have a debugger installed!

First step, if you're running your .NET application off the network, stop, move it to your local disk, and try again. The default security policy doesn't let you do this - you can edit it in the Administrative Tools if you need to.

Now, if you still get the error, drop to a command line, and run the following:

ProfileTool 2>error.log

This redirects the standard error output to error.log, which you can then read. Linux/UNIX outputs this to the terminal by default; Windows hides it.

Thanks to Frank Racis, by way of Mohamed Yehia.

The actual error, in this case, was "No mapping between user accounts and security IDs was done", which really means "don't catch System.SystemException when you are throwing System.Exception". And when you're testing new builds, don't sit behind an ISA server which aggressively caches the old build.

Freeview and MythTV

Wednesday, May 2nd, 2007

With the launch of Freeview, I've decided to upgrade my TV capture setup.

I bought a TechniSat SkyStar2 from Martin at Digiview.co.nz (he has them listed for $145 on Trade Me with a 1 year warranty).  Go buy one off him and tell him I sent you.

Thanks to David Zanetti's in-depth information at pvr.geek.nz, and the always up-to-the-minute information from Steven Ellis on the mythtvnz mailing list, I found out everything I needed to know. And, as you've come to expect, processed it into an easy-to-replicate format, and wrote it up: Freeview MythTV setup. I'm running Ubuntu Edgy, and other than some DVB test utilities I chose to play with, didn't have to install anything - a complete "out of the box" experience.

I'm enjoying watching Stargate SG-1 on the TVNZ widescreen test channel. Unfortunately, I'm going to have to plug the aerial back into Sky eventually.

Next step, moving the card into my server, retiring the dedicated MythTV machine, and setting up XBMC's MythTV scripts.

Access 2003 fires up Windows Installer every time you run it

Monday, April 30th, 2007

Found an interesting problem this morning - Access 2003 fires up Windows Installer (msiexec.exe) every time you start it, and for users without administrator rights, it just doesn't go.

After looking at dozens of newsgroup posts and trying a few solutions, I finally had enough debugging information to find the solution that worked: registry keys are missing from HKLM\Software\Microsoft\Jet\4.0\Engines. Copy them from another machine (changing paths where required) and it works again!  Would of course love to know what caused a bunch of registry keys to just disappear...

For those interested, I found that msiexec was writing to a log file using Filemon, and the log file contained the error "Cannot Open Jet XL ISAM registry key" - descriptive enough to find the solution.

WordPress header bug: Chunked encoding causes some aggregators to hate you

Friday, April 27th, 2007
  • Are people telling you your WordPress site isn't aggregating properly? (Do you check the output, see the RSS is fine, and think they must be mad?
  • Do you check the feed and see a weird 4 bytes on the top of it, and possibly a 0\r\n at the end, but only with wget - not with curl, and not with feedvalidator?
  • Are you running PHP 5.2.1?

If you answered 'yes' to these questions, you have this WordPress HTTP/1.0 causing chunked encoding bug. Thanks to Phil and John for identifying it.

<kinko> write(3, "GET /blog/wp-rss2.php HTTP/1.0\r\nUser-Agent: Wget/1.10.2\r\nAccept: */*\r\nHost: craig.dubculture.co.nz\r\nConnection: Keep-Alive\r\n\r\n", 126) = 126
<kinko> so wget should at least give a warning message that it got an invalid response to a http1.0 request, instead of breaking 🙂
<alastair> I hope you didn't strace wget there, kinko...
<meanphil> strace(or ktrace on fbsd) + tcpdump are the only tools you ever need to debug anything

(Note: fixed in WordPress 2.2.)

LVM bug on Feisty

Friday, April 27th, 2007

Once upon a time, there was a race condition between udev and device-mapper (the kernel interface used for EVMS and LVM2). DM would create and destroy devices regularly, say in the action of creating an LVM snapshot, and udev would say "ooh, shiny new device created" and try and do stuff with it, only to find it had gone away.

For some time, the fix for Ubuntu was a udev rule instructing it to ignore dm-N devices, as such:

KERNEL=="dm-[0-9]*", OPTIONS+="ignore_device"

All well and good, until they fixed that bug in Feisty. Now, if you still have that option in your udev rules, you will get LVM snapshots taking 10 minutes to create, and you'll also get LVM not starting properly at boot.

Check your workarounds when you upgrade packages. Sometimes, they not only don't work around any more, they cause all new problems.

Gray boxes when viewing Java applets

Wednesday, April 25th, 2007

Do you find you get gray boxes when you're looking at a web page with a Java applet (such as the Companies Office or JavaTester)?

You know you have the Sun JVM installed correctly, there are no traces of the Microsoft JVM, the plugin exists, but you can't see it in either Firefox or IE?

I had this problem for some time, and have finally found the cause - I have a custom transform for deploying Java, which turned off automatic updates, set the default JVM, etc, and also accepted the EULA.  As of about 1.5.0 Update 6,  setting EULA to 0 means that the JVM looks for EULA.DLL, doesn't find it, and silently dies.

Don't set the EULA property to 0 anymore. Ignore it.

You also used to be able to turn off the Automatic Updates in the properties table, but you can't any more.  You have to edit the MSI to run a registry script as the last action, and even then there are reports that Java will create the links on first-run.  I don't want my workstations getting a pop-up message saying Java will update when I carefully select the version to deploy, thanks Sun!

ProfileTool beta released

Wednesday, April 25th, 2007

ProfileTool screenshotI don't often write code, but I do find it's a good complement to cricket watching. So, in honour of New Zealand playing Sri Lanka in the World Cup semi-final, I'm proud to announce the release of the first public beta of the IT Partners ProfileTool.

ProfileTool lets you take a Windows 2000 or XP user's profile and assign it to a different user, without having to copy any files or perform any manual procedures.

This is a common task for people who are taking a network of PCs that have not been on a domain, and joining them to one; or if you replace a domain controller without keeping security information, which is sometimes done on sites upgrading from a badly installed SBS 2000 installation to a nicely installed SBS 2003 installation.

It also has useful features for deleting a profile off the disk/from the registry, and changing profiles from roaming to local, replicating the features of the User Profiles capplet.

The source is available under the Mozilla Public License, with the implication of "Do what you like with this code, but if you improve it, I'd like your source to come back to me please".

The Internet gets what it wants

Friday, April 20th, 2007

Where possible, I subscribe to the Internet through Google Reader. It's online nature makes it make sense to me

Some feeds only have half of the information on them - MySpace blogs (if you're a Crowded House fan you might be interested to know their head roadie writes a diary) are cut off after about 200 characters, and web comics like Penny Arcade and the Perry Bible Foundation have RSS feeds, but without the actual comics in it.
But the Internet fixes these problems, even if the people who publish the information don't.

Props to XKCD for publishing their comics in their feed.  I guess it takes a nerd comic to get it.

T9 dictionary editor for a Smartphone

Thursday, April 19th, 2007

I have problems with my T9 on my Smartphone. For example, it seems to like the word "diem1t" rather than "didn't". Someone must have written a dictionary editor, right?

  • Pocket PC dictionary editor - runs on the device, but doesn't want to run on my iMate SP5 (crashes with an exception).
  • T9 Editor - doesn't like the T9AW.UDB my phone has (crashes with an exception).
  • msT9ed - also doesn't support the new format, but loads it with some weird looking data.

In other news, shareware authors could do to handle exceptions better.

Any suggestions?

I like bargains

Wednesday, April 18th, 2007

 Note: this is all now sold.

ServerAnd I have many to offer today.

How about an IBM X226 server, kitted out with 3GB of RAM, for $1? Or perhaps you'd be more interested in a Mac Mini, for $1?