Monthly Archives: December 2007

Enough with the Ads Already

Today, I was writing a short email to a local TV station’s webmaster complaining the fact that they keep flashing me with pop-up ads that none of my pop-up killer can detect. It is bad enough that they put adds all over the place: top, bottom, sides, middle of the stories. Now, they flash us with pop-up ads, too. This is the last straw. I wrote that letter and made it clear that I will go elsewhere for news. I know that ads will be here to stay, and that ‘elsewhere’ might not be better, but it is time someone has to speak up.

I also notice the same phenomenon in viewing TV: ads are popping up right below or sometimes, on top of the screen. This is on top of the heavy ads they already throw in your face. I understand that local TV stations must earn a living in order to provide free services, but enough is enough.

Tell me what you think.

Blogged with Flock

Tags:

UnboundLocalError Pitfall in Python

This is one of my earliest pitfall when learning Python and I would like to share it to other novices. Consider the following short program:

testCount = 0  # a global variable

def runTest():
    testCount = testCount + 1
    # more code here

# main body, run the test twice
runTest()
runTest()

Running this program will result in the following error:

UnboundLocalError: local variable ‘testCount’ referenced before assignment

To make long story short, despite the global declaration, Python still treated testCount as a local variable inside the function runTest(). To fix this situation, I used the global statement to declare testCount as a global variable like this:

testCount = 0  # a global variable

def runTest():
    global testCount # declare testCount a global variable
    testCount = testCount + 1
    # more code here

# main body, run the test twice
runTest()
runTest()

Now the program will execute the way I intended. A note regarding global variables: use them when you absolutely need to. Before resorting to global variables, try to explore other alternatives. If you have questions or comments, feel free to post on my blog. Thank you.

Blogged with Flock

Tags: , , ,

Tcl Command Line Parsing Problem

I have this one-liner:

puts “argc = $argc”

and saved it to cmdline.tcl. If I invoke the program directly like
this:

cmdline.tcl one two three

then the result is:

argc = 0

If I invoke it as:

tclsh cmdline.tcl one two three

then the result is correct:

argc = 3

The same program works fine on my Mac OS X Leopard machine. After posting my problem on comp.lang.tcl, I received help from Cameron Laird and was able to pinpoint the problem to the following registry key: HKEY_CLASSES_ROOT\tcl_auto_file\shell\open\command whose value was:

“C:\Tcl\bin\tclsh.exe” “%1”

After making the modification below, everything worked beautifully.

“C:\Tcl\bin\tclsh.exe” “%1” %*

UPDATE: After installing ActiveTcl 8.5, I found out a couple of changes:

  1. tclsh.exe no longer exists, instead, use tclsh85.exe
  2. HKEY_CLASSES_ROOT\ActiveTclScript\shell\open\command is the new registry location, by default, it invokes wish85.exe instead of tclsh85.exe

Blogged with Flock

Tags:

Mouse Does Not Right Click?

After I upgraded to Leopard via erase and install, I discovered that my Bluetooth Mighty Mouse no longer perform the “right click” or secondary click in Apple’s terminology. After digging around in the System Preferences, I found the problem: by default, the right mouse button performs as a primary button (AKA left click). Fixing the problem was as easy as following the instruction in the picture below.

Blogged with Flock

Tags:

Tiger to Leopard Migration Tale

I have been preparing to migrate my Tiger MacBook to Leopard since October, and let me tell you right up: it has been relatively painless. In this blog, I am going to tell you my preparation steps, the actual upgrade process, and the adjustments afterward.

Background
My wife and I own two Mac laptops, I jumped in head first and install Leopard on her machine right away since she had virtually none of her personal information in her laptop. My MacBook is another story: I had so many data and applications installed that the whole system is very slow. In retrospect, I blamed myself for installing just about every software that I know of. So, I planned to erase my drive and install Leopard.

The Preparation
The first step was to take inventory of my currently installed applications and classified them into the following priorities:

  1. Priority one applications are the ones I must have: 1Password, Lightroom, ChronoSync, DevonThink, Epson scanner, EyeTV, iWork ’08, QuickSilver, SuperDuper, and VMWare Fusion.
  2. Priority two applications are the ones I found important to have, but not in the must-have category.
  3. Finally priority three are the ones that I will leave behind unless I need them down the road.

The next step is to (a) find out if my priority one applications are compatible with Leopard. If yes, then (b) download them, and (c) locate installation keys (AKA registration key, license key, license code) for them. Next, I put the installation images together with the license keys and burn them into a DVD. I also copy them to an external hard drive as a second backup.

Next, I fired up the excellent iBackup and make backup of the followings:

  • System Settings
    • Address Book
    • iCal
    • iChat
    • iSync
    • Keychains (which includes keychain for 1Password)
    • Mail
    • Stickies
    • System Preferences
  • Applications Settings (such as DevonThink, …)

I copy the back up to an external hard drive as well as burning it to CD or DVD.

I also print out my list of websites and passwords from 1Password and keep the hard copy just in case.

Finally, I use SuperDuper to make two cloned copies of my MacBook’s hard drive to two different external drives. I intent to leave my first copy alone for a while (a couple of months to a year) so if something is wrong with my Leopard setup, I can revert to this good old Tiger setup. The second copy is the one I keep with me to migrate my data files over.

Now, I am ready to erase my drive and install Leopard.

The Installation
The process is relatively uneventful that you can read about it in every blog.

The Adjustments
After installing Leopard, make sure that everything works, then I started the process of restoring applications.

The first step is to install iBackup, then use iBackup to restore my system and applications settings. Yes, I did this step before I installed my applications. Then, one by one, I install the priority-one applications from either the DVD or external hard drive. I made sure that each application worked before moving to the next. All and all, the process is relatively easy because of my preparation steps.

Conclusion
In a few hours, I had my system upgraded to Leopard with minimal fuss. The key to success is the degree of preparation I took. If you have any question or comment, feel free to enter them in the comment section below and I will try to response as quickly as I can.

Tags: , , ,