Installing Ubuntu with VirtualPC

For those of you who come to my site looking for help installing Linux on VirtualPC (quite a few, as it is the second most popular post on this site), you’ll know that the big problem revolves around VirtualPC only supporting 16-bit color and most Linux distributions supporting 24-bit color by default. (Why this limitation hasn’t been lifted in VirtualPC yet, I don’t know.)

Microsoft blogger Joe Stagner (who blogs at Joe on .Net) recently posted instructions on how to get an Ubuntu installation to install with 16-bit color — instructions which he in turn found on an Ubuntu blog. Considering the growing popularity of Ubuntu and the cost of VitrualPC 2007 (it’s free), this’ll undoubtedly be helpful to those frustrated by failed Linux installs on VPC.

On disk space and defragmentation

My online baseball game, CSFBL, is a data hog to the tune of about 100GB. Yes, 100GB. That’s how much disk space it takes to store the play-by-play results of some 5 million baseball games (over 2,500 seasons) along with the related player data, historical statisics, and other fun stuff.

The server that powers this beast has three 146GB SCSI drives in a RAID5 configuration. That’s about 250GB of available disk space. Excluding data requirements for such necessities like Windows, SQL Server, tempdb files, web files, and the like, we typically have between 50GB and 100GB of free disk space.

Of course, backing up that database is another story entirely, and if I’m not diligent in keeping the disk clean (by deleting old and unneeded data files), the server can quickly run out of space. This has happened from time to time over the past few years, but a quick cleanup resolves the issue.

Over the weekend I decided to take on major maintenance, defragmenting all SQL indexes, cleaning up old data, removing unused applications, and similar fun weekend chores. During this, I checked the level of fragmentation on the SQL database file.

Over 40,000 file fragments.

Whoa! How long does it take to defragment that? About two days. Of course, a lot of that time was spent first defragmenting other files to make room for one big file. The built-in Windows defragger didn’t do the trick at all (it fails miserably unless you have gobs of free disk space or no large files to defragment). What did do the trick was an evaluation version of Raxco‘s PerfectDisk. Fortunately for my wallet, the eval version is full-featured for 30 days, and since my defrag needs are done, I don’t have to buy it — at least, not until I have to defrag the database again.

Then again, I’m planning ahead this time. I set the SQL database to have about 30GB of free space, so the only fragmentation should be internal, not external. By the time I need to worry about a fragmented SQL data file again, there will be another 1.5 million baseball games simulated, and hopefully a little more ad revenue coming in. 😉

Choosing (and installing) a better Notepad

After years of great service, I knew it was time to replace the venerable Windows Notepad witha more robust text-editor. A little search brought me to Notepad2, which brought just the right improvements with minimal increase in overhead. (I want my text editor to load quickly and easily, which excluded many more robust tools.)

To truly replace Notepad, we don’t just install a replacement — we have to make sure that replacement takes over all tasks from Notepad. In the old days, we just replaced notepad.exe with the replacement’s executable file. In the new days, with Windows file protection, we have to do a bit more.
I read a few blurbs around the Web describing various “proper” techniques to get notepad.exe to be replaced by a new executable of choice, but only one worked correctly: rewriting all existing copies of notepad.exe very quickly. In other words, run the following code in a batch file.

copy notepad.exe c:\windows\system32\dllcache /y
copy notepad.exe c:\windows\system32 /y
copy notepad.exe c:\windows\ /y

Of course, make sure you already changed the name of your Notepad replacement executable to notepad.exe and placed it in the current working directory… and be sure to thank Florian Balmer for a great Notepad replacement!

Can’t hibernate your laptop? Check running processes

Regular readers of my blog (what few there may be) will recall that some weeks ago, I had the (un)pleasant experience of a catastrophic hard drive failure. To help avert future disasters, I recently purchased an external 300GB USB/Firewire drive from Seagate. The product comes with BounceBack Express, a relatively simple backup solution that can backup files and folders to an external device. So far, the solution has worked well; I haven’t had the need to restore, and I have had peace of mind.

However, there has been one odd side effect from this new hardware/software installation: my laptop would no longer hibernate. I had the option to hibernate, but choosing it did nothing. Shutting down worked fine, as did restarting and going into standby mode.

Turns out the problem had nothing to do with BIOS settings or settings in the Power Options control panel. It had to do with BounceBack Express’s BounceBack Launcer application, which runs at login. This application tracks the last time you backed up your system and prompts you to back up your system every seven days (among other things). Once I shut down this application, my laptop went into hibernate mode without a problem.

The lesson of this? If your computer behaves strangely during any shutdown process (which includes going into hibernate or standby modes), be sure to take a close look at what applications and processes are running, particularly those running in the background. Try shutting things down in different combinations until you (hopefully) find the culprit.

Installing Linux on Virtual PC

In my pursuits to rid myself of the Microsoft beast, I’ve added a book to my collection (Setting up LAMP: Getting Linux, Apache, MySQL, and PHP Working Together), and decided to install Fedora Core 4 on a virtual machine, using Microsoft’s Virtual PC.

I’ve used Virtual PC in the past with no problems, but this was my first foray into using it to run a non-Microsoft operating system. It was intriguing, to say the least…

  • I downloaded the DVD ISO for Fedora. Virtual PC can capture ISO images — but not all ISO images — only CD-ROM ISO images. No problem, I was going to burn it to a DVD anyway.
  • I decided to run an integrity check on the DVD (this is a feature of the Fedora installer). It took about 16 hours. Fortunately, it passed.
  • The rest of the installation actually went smooth. (Note that I installed in text mode, not in graphical mode.)
  • The X Windows session wouldn’t render properly in Virtual PC. It resized the VPC window to a wacky resolution like 1600×800, and the graphics were garbled and unreadable. No amount of tweaking my monitor settings or Virtual PC’s settings fixed this.

In searching for a solution, I stumbled across What Works and What Doesn’t in Microsoft Virtual PC 2004, which turned out to be a valuable resource of information, even though none of the suggested solutions worked. What did work (and I submitted this tip to the operator of the aforementioned Web site, Jonathan Maltz) is the following, which essentially tells Linux to boot into text mode instead of GUI mode (i.e. X Windows).

  • Download the Fedora Core 4 recovery CD.
  • Boot your Fedora virtual machine with the recovery CD.
  • Let the recovery CD mount your Fedora system.
  • Edit the file /mnt/sysimage/etcinittab, by changing the line which reads id:5:initdefault: to id:3:initdefault:. The 5 tells Linux to load into GUI mode; changing this to 3 tells Linux to load into text mode. (For more information, read How do I start in text-only mode (no graphical environment)?)

I haven’t tried messing with X further on this installation, but will post more notes when I do.

One step closer to saying “Goodbye” to Microsoft (Part II)

(This is a follow-up to my previous post, One step closer to saying “Goodbye” to Microsoft, in which I describe my experience trying to rebuild my laptop.)

Well, the bootable Windows XP Pro CD provided from my Dell computer booted up fine and installed fine. This one requires you to activate the product online (within 30 days, of course). Fantastic, I figure I’m on the home stretch, as I have a valid Windows license.

I proceed to get the laptop back up to speed by installing the necessities from my MSDN subscription, Mozilla Firefox and Thunderbird, and Norton Anti-Virus. I’m starting to feel good again!

This morning, I decide to activate Windows (even though I have 29 days to go). I open the activation wizard and type the product key on that same sticker in the most inconvenient part of my laptop. This time I write it down on a piece of paper so as not to have to keep flipping the laptop over to read it.

Product id invalid.

Now come on, this is getting ridiculous. I then decide to register by phone. A call to a toll-free line gives me an automated bot that asks me to speak out loud the 54-key installation ID generated by the activation wizard. (As an aside, I absolutely hate when machines ask me to talk to them. I have no problem pressing the number keys on a phone, but I dislike having to speak to a computer.) Incredibly, the service never reads back any of the 40 numbers you say to it, so you have to assume they got it right. After speaking these 54 numbers, I hear…

The installation ID is invalid.

@#&^@*&^!! Did they hear my spoken numbers correctly? I have no way to tell that. Fine, let me talk to a human being. Sorry, there’s no option to talk to a human being.

I try again, and the installation ID is still invalid — but this time I am being transferred to a human being. Wait time: less than one minute. Time to complete the process with a human being: 4 minutes. Finally, I’m finished.

Is this whole process necessary? I understand Microsoft has a big problem with software piracy. However, putting in such controls that make it so difficult for a legitimate owner is hardly an effective solution to the problem. You don’t solve the problem of stolen cars by requiring legitimate car owners to jump through hoops to unlock their doors. The same theory should apply to computer software.

Once I get my laptop up and running, I’m off to the local Barnes & Noble to pick up some books. Technologies of interest include:

I can’t imagine the process of reindoctrinating myself into new technologies is going to be easy, especially considering I will not be able to alleviate myself from the death-grip of Microsoft, because it is a big part of my professional career. But all journeys begin with the first step…

One step closer to saying “Goodbye” to Microsoft

This morning, I turned on my laptop and heard an unpleasant grinding sound. I knew it wasn’t good; I’ve heard this sound before.

It was a hard drive failure.

The hard drive wouldn’t boot up at all. Fortunately, I do routine backups (to a server and to a 1GB USB flash drive), so I wasn’t overly concerned. I ran out to the local BestBuy, picked up a new 100GB notebook hard drive, and installed it in the laptop.

In my CD collection, I pulled out my trusty bootable Windows XP Professional CD, and proceeded to start the install…

  • Boot from CD… check
  • Create new partition… check
  • Quick format… check
  • Command install mode file copy… check
  • Reboot to GUI install mode… check
  • Type name and company… check…
  • Enter Windows XP Professional product key… PRODUCT ID INVALID.

Wait a minute… This is the Windows XP Professional product key on the laptop itself, that stupid Microsoft sticker usually placed in the most inconvenient spot for reading! I double-checked to make sure there were no typos.

PRODUCT ID INVALID.

Let’s not give up. I’ll look at the same inconveniently-placed sticker on my desktop PC and try that one. This should work.

PRODUCT ID INVALID.

@%!&#! I’m cursing now, and I’m very close to start throwing things.

I dig through my CD collection for another bootable CD. This one came with my Dell desktop, so I’ll give this a shot. (The laptop is a Toshiba, not a Dell, but it shouldn’t matter.) I start from absolute scratch — reformatting the hard drive, taking no chances. I wait to enter the product key…

No prompt. Huh? Does Dell have some magical detection scheme? I hope so… Either they know how to read the product key off the sticker, or somehow it has magically transfered itself despite the reformatting of the hard drive. Or, I’ll be asked later during the install, just to tease me by making me think I’ve survived the torture.

Time will tell, but one thing is now absolutely certain: If it wasn’t for SQL Server and Visual Studio .Net, I’d have moved beyond Microsoft by now.

Stopping unnecessary services when gaming

When playing computer games (something I don’t have nearly as much time to do as I’d like), you want to maximize the performance of your computer for the task at hand. To do so, shut down all those unnecessary services to free up memory and some processor cycles.
Dump the following code into a batch file to shut down many services which you don’t need for most games (even network games). The batch file was written for a standard Windows XP Professional build, and includes a section for disabling Norton AntiVirus. Add your own net stop commands to the list to get rid of what you don’t need. Then, run the batch file (I call it stop.bat) to shut down these services. net stop "automatic updates"

net stop "system event notification"
net stop "com+ event system"
net stop "error reporting service"
net stop iisadmin
net stop "kodak camera connection software"
net stop "licctrl service"
net stop "network connections"
net stop "network location awareness (nla)"
net stop "norton antivirus firewall monitor service"
net stop "norton antivirus auto-protect service"
net stop "pml driver hph11"
net stop "print spooler"
net stop "remote access connection manager"
net stop "security center"
net stop server
net stop workstation
net stop "shell hardware detection"
net stop "symantec core lc"
net stop "symantec event manager"
net stop "symantec network drivers service"
net stop "symantec settings manager"
net stop "symantec spbbcsvc"
net stop "system restore service"
net stop "task scheduler"
net stop "windows image acquisition (wia)"
net stop "windows management instrumentation"
net stop "windows user mode driver framework"
net stop "wireless zero configuration"
pause

To start things up again, make a copy of the batch file, and change all net stop commands to net start commands.
What kind of improvements can you get? Well, with all these services started, my memory utilization was 254MB. After stopping them it was 193MB – a savings of 61MB! That’s guaranteed to give at least a small performance boost when shooting rebel scum in Star Wars Galaxies, or fighting on the battlegrounds of World of Warcraft

Selective searching in Windows XP: When search all doesn’t search all

A company I do work for upgraded their desktops from Windows NT 4.0 to Windows XP a few weeks back. Recently, one of the workers at this firm came to me with a problem. He used to use the “Find Files” feature in Windows NT 4.0 to search for files based on file content. In Windows XP, he does the same with the “Search for a word or phrase in the file” feature… but he doesn’t find files under XP that he used to find under NT.

A quick little Google search (using the keywords "windows xp" search "word or phrase in the file" "not found") landed right on a Microsoft Knowledge Base article, 309173: Using the "A word or phrase in the file" search criterion may not work. Apparently, Windows XP “improved” the file content search feature by not actually searching for the content in all the files and file types you specify. As a result, doing a content for search in files with extensions like .SQL or .CSS will not work.

OK, I can handle a feature change, but they probably should clarify exactly what they mean when you are searching for “a word or phrase in the file” when your file criteria is *.*. Even more, the resolution to the problem (as outlined in the support article) is about the most obscure “fix” I’ve ever seen. At least they documented it!

Toggling your HOSTS file

I use my laptop (a highly-recommended Toshiba Portege M100) for most of my development work. Typically, I develop on my laptop (a sandbox environment), then push data to another server (either a staging or production server). One of the problems I run into is my ever-changing physical location. When I’m at home, certain Web sites need internal IP addresses; at other places, they need external IP addresses.

The solution to this problem is by toggling the use of your HOSTS file. I enterd all the static entries into my HOSTS file, and created a small batch file to “toggle” the HOSTS file on and off. (When the HOSTS file exists, it is used, so renaming it to something other than HOSTS – with no file extension – turns it “off”.)

The batch file for toggling the HOSTS file is:

if exist c:\windows\system32\drivers\etc\hosts goto :hosts_off
:hosts_on
ren c:\windows\system32\drivers\etc\hosts.toggle hosts
goto :end
:hosts_off
ren c:\windows\system32\drivers\etc\hosts hosts.toggle
goto :end
:end
ipconfig /flushdns

The batch file simply changes the file from hosts to hosts.toggle and back again. The command ipconfig /flushdns is executed at the end to ensure the DNS cache is flushed.