Monthly Archives: August 2009

Replacing My Laptop’s Hard Drive

I purchased my MacBook in the second half of 2007 with a relatively large hard drive of 60GB. Remember, 60GB is sizable in 2007. I then replaced it with a 160GB drive and even that drive now is full. My hard drive du jour is a 500BG, which should last me a couple of months while waiting for the 5TB version 🙂

Backing Up

Last night, my hard drive arrived from NewEgg and I started my upgrade process. The first order of business was to take inventory of the applications I currently have in the system and kept track of this list using a plain text file. I am not going into details on the how part–that’s another topics for later. Next, I went through my list and hunt down the product key (AKA license code) for each application. Since I use 1Password to keep track of my lincense codes, the process was fairly painless.

Next, I fired up iBackup and backed up some application settings and data I would like to carry over to the new system: Address Book, iCal, keychains, and mail. I used one of my external hard drive as backup destination. I also used iBackup to copy over the one application which the installation CD was damaged: Toast Titanium 7. Yes, that ancient version is still working with Leopard and I see no need to upgrade.

Before I turned off the laptop to perform surgery on it, I make a final back up using SuperDuper!. Upon finishing backing up, I restarted the laptop and booted from the backup drive to verify it was bootable and made a few checks to see if SuperDuper! correctly backed my files. Finally, I turned off the laptop and replace the hard drive. Again, I am not going into details of how I did it, there are plenty of help if you search the internet for it.

OS Installation

Once the new hard drive is in place, I used the Leopard installation disc to install Leopard onto the new hard drive. After installation, I immediately ran Software Update to bring my system up to date. This process required one reboot.

Restoring Mail, Address, and Other System Data

Right after the OS installation, I downloaded the latest version of iBackup and restored the data which I backed up earlier. To test how well iBackup performed, I fired up the Mail application and saw that all of my mail settings and messages were still there. I am glad that I donated to iBackup. This software is a must-have.

Another must-have I installed right away was 1Password since it stored all of my software license keys. Finally, I scanned through my application list and classify them as followed:

  • Must have. These are the applications I would need. Examples in this category includes 1Password, Aperture, Backblaze, and SuperDuper!
  • Unwanted. These are applications that either I don’t like or don’t need. For example, I don’t need the EPSON scan application because the built-in Image Capture application can scan just as well.
  • On Demand. These are applications which I rarely need and I will install them when the need arise. Applications such as the Logitech Harmony Remote Software, Garmin and RegExhibit fall into this category.

I am now in the process of installing my must-have applications, one at a time and verifying that they are working correctly. This process should take a day or two to complete.


Replacing a hard drive is not hard, but it does take some planning to reduce the risk of losing data. Imagine having to re-type 250 contacts because you forgot to make backup! I hope you enjoy this post and post any comment, correction, or questions to the blog.

Use the Right Data Type for the Job

The Problem

In one of my Tcl programming projects, I needed to keep track of a list of child process IDs: When I spawn a new process, I added that process’s ID to a list. When the process finished, I removed its ID from the list.

The Initial Solution

Due to the way I phrased my problem, I naturally chose to use Tcl’s list to keep track of the IDs. Thus, to add an ID to the list, I used the following command:

	lappend idList $id

That was easy enough. However, removing and ID from the list requires more works because Tcl does not have an remove command. I ended up with something like this:

	set index [lsearch -exact $idList $id]
	if {$index != -1} {
		set idList [lreplace $idList $index $index]

Months after I wrote that code, I looked back at my work and did not like it a bit. The code was hard to understand and error prone. There must be a better way.

The Second Solution

While browing the help file for Tcllib, I stumbled upon a package called struct::set and inspiration struck me. Yes, instead of using a list to keep track of my IDs, I could use a set data structure to greatly simplify my task. To add an ID to the “list”, I would issue the following command:

	struct::set include idList $id

Likewise, to remove an ID from the list, I would issue the following command:

	struct::set exclude idList $id

That was much better. By using the right data type, not only I simplified my tasks, enhanced readability, but also reduced chance of making error. It is time to go back to school and learn about data structure!