The Sweet Spot
On software, engineering leadership, and anything shiny.

Tales from the crypt

Now I remember why I love and hate assembling computers.

You’ve got to love the rush of building something cool. The anticipation of the new BIOS screen–blue letters on black indicating some really high memory size and clock frequency. You are your very own Dr. Frankenstein and the monster is about to liiiiiive…

But more frequently than not, it plays out like this: after scanning the electronics ads (Slickdeals, Dealnews, the ever-present Fry’s ads on the back of the San Jose Mercury) for what seems like years, you finally get the courage to splurge a couple hundred bucks on assorted parts. You’ve done your research; the heatsink fan doesn’t collide with the on-board capacitors, your brand of memory doesn’t have any motherboard compatibility errors, your motherboard manufacturer is of good repute and doesn’t, for the first time, have parts from some no-name Chinese manufacturer (okay, so this is me speaking here).

You get your parts, and spend a couple of hours putting it all together. You painstakingly push clips into place, apply thermal grease as needed, silently curse the motherboard powers-that-be that pack front panel pin connectors so closely together. Your fingers grow raw from turning the screwdriver so many times. You wonder to yourself whether you’ll somehow accidentally fry some component by putting it on the table, or whether if by accidentally scraping your screwdriver across the PCB you’ve just junked your expensive toy.

I’ll spare you the gory details. But essentially, what usually happens is you get it all Assembled Together after an hour or so and then comes the Moment of Truth: you push the power button to witness your machine come gloriously to life and, in a wonderful demonstration of Murphy’s Law, one or more of the following will happen:

  1. You witness a bright flash of light, then smoke rises out from the PCB.

  2. Your computer will beep at you. Continuously. The screen will stay off, just for dramatic effect.

  3. Midway through the OS installation, your computer will freeze.

  4. Your hard drive gets corrupted from a rogue reboot.

  5. Nothing.

By the way, these have all happened to me at some point(s) in time.

After aforementioned catastrophe, you exhale deeply, clench your fists and then proceed to Pinpoint The Problem.

Remember the Scientific Method? Remember how you had to isolate one variable–the independent variable–while keeping everything else at a “control”? Well here’s the part where you scrounge up all available parts and start switching them in and out, testing each component one by one to see which part the problem resides in.

I hate the Scientific Method.

Here’s where you begin the Gradual Spiral Into Despair. It’s the sinking feeling you get after a couple of days you realize that you still don’t know what the problem is. Look at you, a loner in your room surrounded by junky computer parts all over the place. You’ve got red eyes from lack of sleep and staring at monitors. You haven’t seen a human being in two days. And when was the last time you showered?

But it’s all worth it when you emerge on the other side, bruised and broken but victorious.

Here’s to the ones who nevertheless press on. Here’s to the ones who will rather take a bullet than give up on your rig. Here’s to the ones who scoff at light and food and warmth and human companionship. Here’s to you, True Geek. You’ve got your scars, now here’s your reward: Dual Cores of Computing Sweetness. It’s rather worth it, won’t you say? Right?

Hey, you still there?

After site duplication, an .htaccess redirect for old Wordpress posts

I think I must preface this post with a bit of context:

A month ago I added a new blog (blog.andrewhao.com). I wanted that blog to become my personal blog and let this blog (blog.g9labs.com) transition into a technical blog.

Here comes a technical post about transforming a personal blog into a technical blog.

So here were the problem(s) I faced:

  • Most of my posts here at blog.g9labs.com were of personal nature, many which dated all the way back to 2002, my sophomore year of high school!

  • However, I had begun to write technical posts for a year or two–some thoughts on interface design, an occasional programming trick, cool regex expressions, et cetera.

  • Many of my posts have been linked all around the Internet.

Essentially, I wanted to:

  • Move the personal contents of the g9labs blog to the andrewhao blog,

  • While keeping all in-links to old g9labs content alive.

My solution was two-fold:

  1. I made a copy of my g9Labs* blog to the andrewhao blog. This was harder than I anticipated–I initially expected to simply use the WP export plugin to dump data from g9Labs* and import into andrewhao. However, this lost much of my metadata–comments, categories, tags. So I just decided to completely copy my g9Labs* WP database and WP directory into andrewhao. Yeah, hacky, I know. I’m not very proud of it.

  2. I added an .htaccess file to blog.g9labs.com that did some magic. It identifies requests for posts that are earlier than the date of the blog fork and redirects those requests to andrewhao.com, which is hosting a mirror of the post.

# redirecting requests to posts older than 2008-02-02 to blog.andrewhao.com
# pass the requester a 301 code (permanently removed)
# @author: Andrew Hao

# Lexically compare regex groups $1-$3 with the date: Feb. 03, 2008.
# Note that the RewriteRule below is reached only if the condition is true.
# Finally, note that $1-$3 are regex groups from the RewriteRule regex below.
RewriteCond $1$2$3 <20080203

# Match the incoming request: /YYYY/MM/DD/post-title and redirect the browser
# to http://blog.andrewhao.com/YYYY/MM/DD/post-title
RewriteRule ^([0-9]+)/([0-9]+)/([0-9]+)/([^/]+)/*$ http://blog.andrewhao.com/$1
/$2/$3/$4/ [L,R=301]
... rest of .htaccess ...

Quad Core and the Nerd

My apartmentmate Mike just upgraded his computer to an Intel Core 2 Quad-core processor. Once he got it up and running, he opened up Task Manager and summoned me over to gaze at the beauty of four CPU utilization graphs, one for each core. We had to fight the urge to beat our chests and make low, guttural grunts.

Welcome to 2008, may he who has the most cores win.

Today's Geek Hijinks

Morning: Woke up and attempted to mount a Samba file share under Ubuntu.

My Gutsy server in the living room is getting a second life as a backup file server. I need to mount it in my filesystem so I can rsync certain directories on my desktop over to the server.

mount -t //my_server_ip/share_folder /media/mount_folder

Alas! I couldn’t get write access into the mount point! At first I thought this was a chmod problem, so I added myself as the mount_folder owner.

sudo chown username mount_folder/

To no avail. So then I attempted to use the “permit all” chmod sledgehammer:

sudo chmod 777 mount_folder/

Argh! STILL no good!

So then I went back to the drawing board and did some investigating. I could, 50% of the time, gain write access to child subfolders on the Samba share via GNOME Nautilus interface (smb://my_server_ip). Weird! Was this a Samba config problem? I didn’t have the cajones to find out.

As a last-ditch attempt, I tried to modify my fstab file to mount the Samba share (I read somewhere that the uid and gid option flags give you the win). Side note: you can find your username’s uid and gid numbers from the /etc/passwd file.

# TEMPORARY SAMBA SHARE FROM LIVINGROOM SERVER

# @author Andrew

//my_server_ip/archive /media/archive smbfs noauto,rw,uid=1000,gid=1000 0 0

Still no good! Arghs! At this point, I gave up and simply SFTP-ed in to dump my files. Admitting defeat is a sad, sad thing.

Afternoon: Designed some logo comps for a Web company.

Logo I started on.

I’m working under contract from Ryan Waliany. This site should be doing some cool things. Unfortunately, I can’t reveal too much. All this to say that I’ve taken a long hiatus from design and I really miss it.

Late Afternoon: Set up Google Apps for g9labs.com

I gave in to the hype, and began setting up a Google Apps For Your Domain (GFYD) account for this g9labs site, primarily so I can hook into the awesome GMail interface instead of being chained to the Thunderbird client.

This was a multi-step process of:

  1. **Verifying ownership of your domain. **Google has you modify a CNAME entry on your domain so they can ping it to check that it’s changed. I marched happily over to the Dreamhost panel where I found the DNS page for g9labs.com. There I added a CNAME value of googlexxxxxxxxx (a unique value given to you) and set its CNAME value to “google.com”.

  2. While Google takes 48 hours to verify you’ve done the right steps, you can go ahead and **modify the MX records for your domain **so mail gets sent on over to Google instead of your Dreamhost server. This was easily set in the Dreamhost panel under Mail » MX Records. You change your MX records to Google’s special MX server, and you’re on your way!

  3. I’m waiting for verification to go through, then I’ll talk about how to get IMAP for GFYD working.

Noam Chomsky is The Man

Why?

The man is a respected thinker, theorist and activist. I’ve had several Mass Communications classes devote a couple of sections to his thoughts about mass media and its effect in forming dissent and complacency in the masses.

The man took a period of his life in the 50’s devoted to formalizing computer languages (he is by profession, a linguist). We just went over Chomsky normal form in my CS164 (compilers) course–a recursive method for generating languages from a set of rules.

My CS and humanities world collide, but this man has done it way before. How stunning. Noam Chomsky is The Man.

(Disclaimer: I don’t agree with very many of his views, but the purpose of this post is to point out that Mr. Chomsky is a man who’s pretty much Done It All).