XP and QEMU

Last week I decided to try building a virtual machine to run Windows XP. I figured I’d install XP, install all the recent patches, then make a snapshot of the virtual disk. Then I’d have a clean XP install that I could use to run various apps as needed. Several years back I purchased a copy of VMWare for this purpose, and it worked great. This time around I figured I’d try QEMU, an alternative emulator that’s free. Now, I’ll prefix this by saying that my host machine (a Debian Linux box) is somewhat underpowered to run an XP guest OS. It’s a 700mhz PIII with 512 megs of RAM. It works, and it’s usable, but it’s quite comically slow. In particular, I’d estimate that the installation process took about 12 hours (this was spread out over several days of occasional attention, so I don’t have an exact figure). The basic XP install goes something like:

  1. Install XP from CD.
  2. Install Service Pack 2.
  3. Download and install recent updates from Microsoft to bring the installation completely up to date.

And that’s essentially what I did. The process was marked by long periods of waiting and wondering if it was hung, followed by entering some info in a dialog box, follow by more long periods of waiting and wondering if it was hung, etc. etc. etc. I ran into a couple of known QEMU/XP issues:

  • After the initial install, the reboot hangs on the “Windows XP” splash screen with the message “Please Wait”. Resetting the machine at this point seems to get it moving along again.
  • After initially logging in as “Administrator”, I got a dialog box that said “A problem is preventing windows from accurately checking the license for this computer. Error Code: 0x800703e6.”. Following some advice on the qemu-devel mailing list, I booted into safe mode and installed Service Pack 2, and that fixed this problem.

After that, there was lots more waiting while it downloaded updates, installed IE7, etc. etc. etc., but it eventually finished and left me with a working system. How much use I get out of it remains to be seen, but at least all the effort wasn’t for naught. Recommendation: if you’re going to do this, use a beefier machine than I did 🙂 Also, I highly recommend building and using the kqemu kernel accelerator module. For me, this sped things up from “super mind-numbingly comically slow” to just “comically slow.” And the final tip: If you think it’s hung, go to the host OS and check for activity on the virtual disk image. I lived by this during the install.

And in other news… it’s tax time again! And, this year I’ve decided that I’m tired of getting refunds. Even a “nominal” refund (say $100-$200) is still an interest-free loan to Uncle Sam. So it occurred to me, why don’t I just estimate our 2007 taxes and adjust my withholding appropriately so that I end up owing a nominal amount, instead of getting a nominal refund. Then, with each paycheck, I’ll set the extra amount aside in an interest-bearing account. When next year’s tax season rolls around, I’ll pay the amount owed, and the remainder becomes my “refund”. Seems like a no-brainer, and I wonder why I didn’t come up with this sooner. The complicated part, of course, is estimating our 2007 taxes and avoiding the whole underpayment/penalty/interest thing. But I’m going to give it a go.

mp3act hacking

9 months or so ago, I installed mp3act, a PHP-based online MP3 streaming server. I’ve found that I really like it, but like everything else, it would be oh-so-much cooler with a few little tweaks. Development on it seems to have stagnated (no releases since mid 2005), so I’ve decided to hack on it a bit to make it do my bidding. So far, I’m really happy with the results.

Here are some of the issues I’m trying to address:

  • mp3act doesn’t deal well with albums containing multiple artists. It breaks each unique artist out into its own separate album. So for example, if you have an album called ‘great songs’ containing songs from artist a, artist b, and artist c, mp3act will create 3 albums called ‘great songs’, each containing songs from one of the three distinct artists. This is not what I want.
  • mp3act doesn’t handle artist sorting very well. If you have an album by Tom Petty and the Heartbreakers, mp3act displays it under ‘T’. If you want it correctly filed under ‘P’, the mp3 would need to be tagged ‘Petty, Tom and the Heartbreakers’, which again, is not what I want.
  • mp3act’s search and download features are a little lacking. The search results page allows you to play and/or add songs to playlists one by one, but there’s no ‘play all’ or ‘add all to playlist’ feature. And, it only allows downloads of albums. A ‘download playlist’ feature would be really useful.
  • With multiple-CD sets, if the songs on multiple discs are grouped under the same album name, mp3act will interleave the tracks together (disc 1 track 1, disc 2 track 1, disc 1 track 2, disc 2 track 2, …).

There are a few other little things, but those are the biggies. I’m taking a two-fold approach to dealing with these: tweaking the mp3act database tables for some, and tweaking the mp3act PHP code for others.

mp3act’s database schema is simple and easy to understand. It has a few quirks (biggest quirk: the year field is associated with albums, when in fact, it should be associated with songs), but I’ve found that I can get a lot done just by importing music into the database, and then going through manually and tidying things up. Specifically, I’ve corrected the multi-artist album problem and the multi-disc track interleaving problem this way.

To reconstruct a multi-artist album, first find all of its parts:

select * from mp3act_albums where album_name like '%name here%'

Note album IDs, which are typically consecutive. Then create a new artist, if necessary, for the album:

insert into mp3act_artists values(null, 'Various Artists', '')

Now create a new album:

insert into mp3act_albums values(null, 'name here', last_insert_id(), 'genre here', year, '')

Then, using the album IDs from the first query, re-associate songs with the new album:

update mp3act_songs set album_id = last_insert_id() where album_id between low id and high id

And finally, delete the old, no-longer-used albums.

delete from mp3act_albums where album_id between low id and high id

That’s it. Now, this works great, but it does introduce a couple of problems. First off, when you browse to one of these albums, it doesn’t show the artist name in the track listing. And secondly, there’s now no way to browse to the individual artists that make up the album (unless you have other albums by those artists). The first issue is a quick, easy fix to the PHP code. The second is more complicated. For this one, I added a separate ‘browse’ option that browses songs by artists, instead of albums. It was a bit of work, but not too bad.

And so it goes. Here’s a summary of all the changes I’ve made so far.

  • Fix database to deal better with multi-artist albums
  • Fix database to deal better with multi-cd track ordering
  • Show artist name in track listing for album/song browse
  • Add ‘browse for songs by artist’ feature
  • Create custom genres for some albums. This is easy to do and you are not limited to valid ID3 genres, which is nice, because they suck.
  • Modify ‘browse for albums by artist’ to not show artists with no corresponding albums
  • Fix artist sorting issue by adding ‘sort key’ field to albums table, and modifying artist entries where the sort key is different from the artist name

mp3act works very well for me with these changes, and the framework has the potential to do a lot more. Over time I’ll keep hacking on it to add features and improve its operation.

Followup… My next big “to do” is to make the album downloads more flexible. mp3act handles downloads by building a zip file on the fly, then sending this to the browser as an attachment. But the zipfile library it uses (which is included with the app) is kind of bare-bones, and it requires the mp3 library to have a certain directory structure. Looking at this library, it’s easy to see why downloads are not as flexible as I would like. Fortunately, PHP 5.2 now includes a much nicer built-in zipfile library, so the first step is to modify mp3act to use this. At that point, I should be able to greatly improve the download functionality.

Ubuntu 2 1/2 month review, etc.

I’ve been using Ubuntu now for about 2 1/2 months. The verdict so far: I like it. When I initially installed it, I was looking for a Linux distro with a reasonably well-integrated and user-friendly desktop environment, and Ubuntu (with GNOME) has lived up to those expectations. I really like the GNOME file manager with its built-in sshfs support, and the menu/taskbar integration works really well. When I install an app, it automatically shows up in my “Applications” menu, and the GNOME-aware apps also take advantage of the task bar. This works even with GNOME apps that aren’t provided with Ubuntu — for example, today I installed gSTM, which is a GUI interface for managing SSH tunnels. It’s not part of the Ubuntu “universe”, so I downloaded a .deb from Sourceforge and installed it (there’s a handy GUI for installing .debs too, which Firefox launched automatically). Once installed, gSTM showed up in my “Applications” menu and also added itself to the task bar when I launched it. Very nice.

The only thing I’m not quite happy with is my age-old gripe with all Linux distros: fonts. I’ve done all my requisite font-fiddling and I’ve got fonts I’m pretty much happy with now. But the font rendering in Firefox is just horrible. Text is always overflowing table cells and other stuff, and certain web sites just look, well, bad. It’s not bad enough to be a show stopper, but I really wish it looked nicer. I’m not sure what’s to blame: Firefox, X, GNOME, or whatever. But I will say that the fonts look pretty good in most of the other apps.

Linux GUI distros have to fight an uphill battle, because there are so many different apps (some 20+ years old) coded to all sorts of different GUI standards. There’s no way to get all of these apps to look perfect — it’s like herding cats. But the GNOME people have done a pretty admirable job fitting everything together. The user experience is about as seamless as one could hope for.

I hate Microsoft

So, I’m trying to find a nice, easy, seamless way to access data on my home Linux fileserver from XP. The goal is to have drag-and-drop access to files using the Windows GUI, as opposed to using sftp, which I’ve been doing pretty much forever and am finally getting tired of. But of course, with Windows, nothing is ever easy. My first thought was to use NFS, as I’m already using that to provide connectivity for my Mac, and Microsoft kindly provides a free toolkit (“Services for Unix”) which includes an NFS client. Nope.. our Windows PC runs XP Home Edition (which really should be called “Crippled Edition”) and SFU doesn’t work with XP Home. Of course, I didn’t find this out until I had downloaded the entire 200+ meg SFU distro, extracted it, and attempted to run the installer, which happily crapped out. Thanks guys.

With SFU ruled out, I fell back on SMB. I already run Samba on the Linux box, so I can just map my home directory to a drive letter and do it that way. That’s not quite as nice as NFS because I have to enter a username and password when I map the drive (although I might be able to work around that). But, there’s a hitch with that too — the XP box already has a couple anonymous shares mapped from the same Linux server, and for some inane reason, XP won’t let me map shares from the same server under multiple usernames. But, I outsmarted it by connecting to the server using an alternate DNS name, and that seems to work fine.

So in spite of Microsoft’s best efforts, I now have an XP box that’s actually somewhat useful on a heterogeneous network. Party on…

All’s not happy in the land of calendaring

Well, it appears I spoke too soon about backwards compatibility with the new Oracle Collaboration Suite and the old Calendar API that I’m using for my iCal downloader stuff. The first bad sign happened a couple weeks ago, when I noticed that a bunch of my Oracle Calendar entries had mysteriously disappeared from my iCal subscription. After investigating, it turned out that an entry in September 2007 was screwing it up. If I downloaded a date range up to but not including that date, it worked fine, but as soon as I included that date, about 50% of my entries disappeared. Hmmmm, not good. Then, today, I noticed that my iCal subscription was about a week out of date. When I went to run the download job manually, it bombed out with the API error code CAPI_STAT_DATA_ICAL_COMPVALUE. The docs have the following description for this code: “There was a problem with what a component contained.” Thanks guys, that’s really helpful.

So anyhow, it looks like I’m back to square one with the calendar stuff. When I get the time, I’ll rewrite it to use the newer API. Alternatively, maybe OCS has a way to do this without having to write custom code. That would sure be nice. Unfortunately though, until I get around to this, I guess I’m stuck with no Oracle Calendar data on my Palm. Bummer.

Weird mp3act streaming problem solved..

When I switched my desktop Linux box to Ubuntu recently, I was able to get everything working relatively easily except for one thing: For some reason, I couldn’t stream MP3s from my mp3act server. The playlists would download properly, but nothing would play: xmms would just ignore everything in the playlists. Well, today I finally tracked the problem down, and it turned out to have nothing to do with Ubuntu. The culprit was my web proxy configuration. I run the Privoxy ad-blocking software (ObPlug: Privoxy really makes the web a much more pleasant experience). Now, I used to run a local Privoxy on each of my Linux boxes. But when I installed Ubuntu, I elected not to run Privoxy on the Ubuntu box. Instead, I configured Firefox to proxy through the Privoxy running on my server. That way, I only have to maintain one Privoxy installation. That works fine, but it does make all of my web traffic appear to come from the server rather than the desktop. And therein lies the problem. When mp3act generates a playlist, the URLs for the MP3 streams are all keyed to the IP address that requested the playlist. When xmms requests the stream, it doesn’t go through the proxy, so the requests come directly from the desktop, and the IPs don’t match. So, mp3act refuses to serve the file.

Solution: When talking to the mp3act server, use a direct connection and don’t go through the proxy. In Firefox, this is configured under Edit->Preferences->General->Connection_Settings. Once I made that change, everything worked fine.

Very very happy to have this working again!

3 cheers for backward compatibility

Well, we finally upgraded our calendar server last night, from old-and-crusty Steltor CorporateTime to its successor, new-and-shiny Oracle Collaboration Suite. And, kudos to Oracle, as it looks like they’ve kept it backwards-compatible with the old CorporateTime API. That is, my homegrown OracleCalendar-to-iCalendar exporter thingy is still working. That’s nice, because I’ve come to depend on it, and this means that I won’t need to spend lots of time fixing it. Things are a little busy here right now, so if it had broken, it probably would have stayed broken for awhile.

Once things slow down, and I can revisit this, I bet I can make it work even better with the newer APIs now. Actually I may not need to use the APIs at all any more, as OCS supposedly supports CalDAV. In the meantime though, I’ll very happily continue to use the stuff I already have.

Oh, and a few days ago, I installed MediaWiki. I think I’m going to get a lot of use out of it. Read about my recent trials and tribulations with PHP iCalendar.

Party on…

Ubuntu fonts

I think I’ve finally got an Ubuntu font setup that I can live with. It’s not perfect, but it’s livable. Here’s what I did so I can replicate it if necessary.

  • Install msttcorefonts package.
  • Install MS “Tahoma” and “Tahoma Bold” fonts, neither of which are included with msttcorefonts.
  • Set X server to 96x96DPI.
  • Install a custom .fonts.conf that disables anti-aliasing for smaller fonts, sets some font prefs, and enables sub-pixel rendering.
  • In Firefox, go to Edit->Content->Fonts & Colors->Advanced. Set Proportional font to “Sans Serif”, Size 14pt. Set Serif font to “Times New Roman”. Set Sans-Serif font to “Verdana”. Set Monospace to “Courier New” at 12pt.

I’m pretty sure that’s it. Further references may be found in other posts in this category.

The overall result is a very Microsoft-y look, probably because of the heavy use of the Tahoma font. Some fonts are a little too small, others are a little to big (the default font in Firefox, for one). But, I can live with this until I go to a Mac on my desktop. It took a bit of tweaking, but it definitely looks nicer than my old vanilla Debian setup.

Followup 8/15.. The menu fonts in OpenOffice.org were still kinda ugly after doing all this.. I fixed this by going to Tools->Options->OpenOffice.org->View, and unchecking “Use system font for user interface.” Then when I restarted, the menus came up in Tahoma. Problem solved.

Followup 1/11/07: Installed Firefox 2 and found things required some additional tweaking. Changed Sans-Serif font from Verdana to Arial. Changed proportional font size to 16pt and fixed font size to 14pt. Re-enabled anti-aliasing for smaller fonts. Not sure I’m 100% happy with it, but it’s tolerable.

Installed Ubuntu

I tracked down a spare 8.5gig disk today (the one that came with my old P2-300 box, ironically) and installed Ubuntu on it. First problem: I installed the spare disk as an IDE slave, and the Ubuntu install totally hosed the boot loader on the master (Grub). After installation, the boot loader gave some cryptic error message and hung. So, I booted into Knoppix and reinstalled the boot loader, which allowed me to boot into my Debian OS on the master disk. I then attempted to configure my existing Grub to boot Ubuntu off the slave. But, when I booted, grub refused to recognize the slave disk. Not sure why (BIOS issue maybe?) but I ended up copying all of the Ubuntu /boot stuff into the /boot partition on my master disk, pointing grub at that, and just booting everything from there. Once I did that I was finally able to boot Ubuntu. (One hitch with this method — Kernel upgrades in Ubuntu are no longer automatic. I have to copy the kernel and initrd images into /boot on the main disk, then edit the gruf.conf there to boot the new kernel. Not a big deal, as I don’t plan on running this configuration for too long — if I like Ubuntu, I’ll install it as the main OS on the computer.)

Upon bootup, it immediately prompted me to install 160-odd megs of software updates, which mostly worked, but some of them apparently crapped out as I got this happy-fun-ball “some updates failed to install” window after the installation finished. Being that Ubuntu uses apt, this is somewhat to be expected, but I hope it doesn’t screw up further updates (as apt failures on my Debian boxes are wont to do). Followup — no further problems with apt so far. After installing the updates, I was prompted to reboot, which I did, which brings me to where I am now, writing this entry.

Ubuntu seems nice enough, but so far it doesn’t seem much different from other Linux desktop installations I’ve seen, all of which are fraught with quality-control issues such as these. Once configured, they work well, but there’s always that pain of setup and configuration. I guess I’m a little disappointed — after all the hype I’ve read, I was hoping Ubuntu would be more revolutionary — a Linux desktop that doesn’t really feel like a Linux desktop. Oh well. Off I go to a command-line to get my graphics card working and fix my fonts, just like every other Linux desktop….

[More:]

OK.. Installing the nvidia driver was easy, actually. There’s a package (nvidia-glx) that takes care of it. After installing this, I went in and copied my configuration out of my old xorg.conf, restarted X (by way of the gdm display manager), and it came right up with my dualhead configuration.

I’m now in the process of installing some other “must-have” apps such as emacs, thunderbird, etc. Oh yeah.. and OpenAFS. Uh-oh…

Well, openafs turned out to be painless. Just install the modules-source package and follow the directions in /usr/share/doc/openafs-client/README.modules. Now to work on fonts. Installing msttcorefonts package helped a lot. To do that I first needed to go into Synaptic (Ubuntu’s GUI front-end to apt) and enable the “multiverse” repository, which includes non-free packages. Then, I found that my X display was not set to 96x96dpi, which is supposedly optimal for font rendering. Based on info found here and here, I tweaked the display DPI in xorg.conf by adding the following option to my “Monitor” section:

DisplaySize 783 277 # 96 DPI @ 2960x1050

and the following to “Device”:

Option "UseEdidDpi" "false"

Next it looks like I need to tweak anti-aliasing for certain fonts (reference).

Little by little it’s coming along.

Another good font tutorial for configuring fonts under Ubuntu. This one includes instructions for installing the Tahoma family, which for some reason is not included with Microsoft’s Core fonts for the web. With the MS fonts (plus Tahoma) installed, things look much better already, and apparently I can improve the look further by tweaking anti-aliasing and other stuff… might play with that a bit tomorrow.

First impressions of Ubuntu, etc.

Last Friday I tried out the latest release of Ubuntu Linux. They provide a “live” CD, which boots and runs directly from the CD just like Knoppix. My goal is to find a nice desktop-oriented version of Linux that “just works”. On the server side, I’m sticking with Debian, but I find vanilla Debian a bit lacking in the desktop department. So as a stop-gap between cutting over to OS X completely, I thought I’d try out Ubuntu and see how I like it. Ubuntu is based on the same apt package system as Debian, so it’s familiar, and it’s touted as being very desktop-friendly.

First impressions: it looks nice. apt-get works as expected from the command line, but the default archive server has a very slow connection — I wonder if there are mirrors on Internet2 that I could use. If not, that’s a definite drawback, as I’m not sure I could give up the blazing speed I get from debian.lcs.mit.edu. I was able to install xmms easily, and my sound card was immediately recognized, and the system shares the sound card between apps. However, for some reason it didn’t work streaming MP3s from my mp3act server. Recent versions of OpenOffice and Firefox are provided. It didn’t pick up my dual-head setup, but I didn’t expect it to — I’ll need to download and install nVidia’s x.org driver manually. It looks like I’ll need to install some compilers and devel tools before I’ll be able to build the nVidia driver. But I expect it’ll work.

As with every other version of Linux, the default fonts are butt-ugly. Why can’t someone put out a Linux distro that has nice fonts out of the box? That has always been one of my biggest gripes with Linux. There are tutorials on the ‘net to improve the look of the fonts under Ubuntu, but honestly, this shouldn’t be something I have to mess with. Linux is never going to get anywhere in the desktop market until they can get past this issue.

All of that said, I think I may try out an “official” install of Ubuntu on the hard drive, and see how it goes for awhile. I’d rather not wipe out my existing Debian install, so I’ll have to scrounge around for a spare hard drive first.

In other news.. I’m thinking about finally taking the plunge and going with totally paperless bills and financial statements (where possible). My redundant disk setup gives me a more reliable place to store documents electronically, so there’s no reason not to go for it. As with everything else, I’ll see how it goes.