Friday, October 31, 2008
Candy Corn's Dirty Secret
After years of mindless doodling in the margins of my notebooks during conference calls at work, I was hit by a bolt of inspiration last night and put those doodling skills (and my scanner and Photoshop) to work.
I present to you a little comic for Halloween. Enjoy!
Thursday, October 23, 2008
Six Month House-iversary
Six months ago today I moved into my new home in the Fishtown section of Philadelphia. After ten years of watching my money go to landlords each month, last April I finally became a homeowner. Time has flown by and I don't think it has sunk in yet that this place is really mine. I suspect it won't totally sink in until I need to pay for my first major repair.
I'll admit Fishtown wasn't my first choice. I would have loved a place in Center City or University City, but they were out of my price range. Fishtown was a good compromise - relatively safe and easy access to the rest of the city via the El. If anything, I wish I had found a place closer to an El station. Walking to the El adds an extra 10-15 minutes to my commute each way. On the other hand, there is a shopping center complete with supermarket, thrift store and a Radio Shack two blocks from my house which is very convenient.
I haven't done much to the house yet, including decorating. The house was renovated a couple years ago and didn't need any work for me to move in. The biggest changes so far were adding a railing to the basement steps and installing a microwave over the stove. My dad is much more of a handyman than I am, so he's been a huge help. When I was looking at homes, I look at everything from fixer-uppers to newly remodeled homes. I'm glad I decided to go with something recently renovated. I don't see how I would have found the time and resources to do serious work on a house.
There's still quite a few boxes from my apartment I have yet to unpack and my basement is full of stuff from my storage locked that I need to go through (and probably sell a lot of it). I wanted to have a yard sale at the end of summer, but that hasn't happened. Maybe next Spring?
Some home projects I hope to tackle in the next few months:
- Install a dishwasher
- Install more shelving in the home office
- Add exterior electrical outlets to the front and back of the house
- Run a network cable from the home office down through the walls to the basement and up to the living room (for my Mac Mini media center / home server)
- Put a pond in the backyard (that will have to wait till next Spring)
- Try some basic X10 home automation
Tuesday, October 21, 2008
Don't Make Me Think (About Code)
I'm a stickler for clean, easy to read code. In fact, I'll take clean, incomplete code over working, unreadable code. It's alot easier to finish and maintain clean code than to clean up spaghetti code. One of the best compliments I've ever received in my career was from a coworker who told me that my code was a pleasure to read.
While cleaning up some old Java code at work, I came across this line in a random number generator:
seed += lastSeed++;
I had do a double-take on that line. It's short but ugly and easily confusing. Does lastSeed increment before being added to seed or after? I even checked with a coworker and he wasn't totally sure the order of operations here. (Yes, lastSeed gets incremented *after* being added to seed. I even ran some test code to confirm it.) I'm pretty sure I had questions like these on my college C programming exams.
I once read a book about web usability titled Don't Make Me Think by Steve Krug. The point of the book isn't that web sites should be dumbed down to be usable, but that their structure should flow naturally. A user shouldn't have to stop and decipher confusing or ambiguous links. Eg: Do I click "About Us" or "Support" to find a company's mailing address?
Likewise, an important aspect of clean code is that it should be obvious how it works. It shouldn't rely on obscure language features or shortcuts. You shouldn't have to stop and ask yourself "Wait, what is this doing?"
In the end, I made a simple change to the code:
seed += lastSeed;
lastSeed++;
Yes, I added an extra line of code, but I removed any possible confusion about the order of operations. Sure, it's a simple example, but imagine if this code was being used for financial calculations. It would be way to easy to introduce a bug when it was being done all in one line. Cleaning up these things isn't just a matter of making things safer for junior level programmers (as the Java Ranch Style Guide reasons) - even the most experienced programmers make dumb mistakes. Straightforward code makes life easier for everyone.
Monday, October 20, 2008
Mac Mini Memory Upgrade
After the hard drive in my iMac died, I moved the Ubuntu Linux VMware image that runs my websites to the Mac Mini I have hooked up to my TV. Since it only had 1GB of RAM, I shut off some apps and extra services (both on OS X and inside the VM itself) to save on memory. It performed fine and I decided to let it host my websites permanently, rather than move it back to the iMac or to a dedicated PC I was building. The Mini is quieter, smaller and more power efficient than any PC I could put together.
The Mini did need more RAM, so before I took my iMac out to be repaired, I removed its two 1GB sticks of RAM and put in two 512MB sticks I had leftover from previous upgrades. Last night I finally attempted to install the extra RAM into the Mini.
I found some Mac Mini disassembly videos and photos online. After upgrading the RAM but before putting the case back on, I booted up the Mini. It booted fine and saw the full two gigs, so I shut it down, snapped the case back on and hooked it back up to the TV.
I powered it on, watched it start to boot and walked over to the kitchen to start dinner, then I heard a second start-up chime. Umm, that's probably not good. The Mini finished booting up fine and I tried to pretend that reboot didn't happen. While dinner was in the oven, I fired up Front Row and started watching an HD TV show when the Mini suddenly rebooted again. There was no kernel panic, just a spontaneous reboot. Crap.
I figured it was most likely a memory problem, but it could have also been an overheated CPU. I took it back upstairs and ran the hardware diagnostic CD. No problems found. Grrr. I pried open the Mini again. (Luckily the Mini was much easier to pry open the second time.) The RAM looked like it was seated in its slots just fine, but I took it out and put it back in again. Booted the Mini (without case) and tried playing the same video I tried before. It played fine. Started up two HD videos together and still no reboots. Excellent.
As I started to put everything back together, the wire for the Airport antenna disconnected from the Airport card. Had to remove the carrier for the optical drive and hard drive again and plug it back in. I did a test boot of the Mini and it couldn't find my wireless network. Since I had run an ethernet cable down to the living room, I really didn't need Airport at the moment and considered leaving it as-is, but I didn't want to have to open this thing again later on if I did need wireless, so I removed the carrier again and disconnected then reconnected the antenna wire.
This time Airport worked so I put the cover back on and hooked it back up in my living room. Powered it on and the fan started blasting at full volume. Arggh! I didn't think a little box could make that much noise.
Took the Mini apart again and immediately noticed that another small cable had come disconnected from the motherboard. I reconnected it and did some tests without the case. Everything worked fine, so I put the case back on and tried another succesfull test before taking the Mini downstairs.
The whole mess took about two hours, and the Mini has been working fine so far. Apps are performing better now with the extra gig of RAM. I will have to go buy two more gigs of RAM to put back in the iMac after the hard drive is replaced, but I will finally be able to use it for photo editing again. Upgrading the Mini wasn't as scarry as replacing the LCD screen on my MacBook, but definitely not something I would recommend the average computer user ever attempt.
Thursday, October 9, 2008
iMac Hard Drive Failure
Well, it finally happened. The hard drive in my iMac died last night. The iMac was acting slow and flakey, so I rebooted it. When it came back on, there was a strange clicking noise and I got the Missing System Folder image on the screen. I wouldn't be so worried about the drive (AppleCare should replace it free) if it weren't for the fact that I was hosting most of my websites on an Ubuntu Linux VMware image running on the iMac.
The good news is that my system was backed up via Time Machine to an external firewire hard drive. The bad news is that, to stop my system from slowing to a crawl every time Time Machine ran, I stupidly excluded the VMware image from the regular backups. The most current VM image backup I have is from September 14th, nearly a month ago. Mostly that means a bunch of images are missing from my photolog and from my photo gallery. The original photos are safe on my MacBook so I can repost them. I can probably get recover the post titles and descriptions from Google's cache.
I did have a bootable backup of my iMac on a second partition of my Time Machine external drive, so at the moment, the iMac is booted from the backup drive. I should make a backup of my backup drive soon in case it fails too. It feels like I'm flying with one engine at the moment.
In the meantime, I'm running the VM image on the Mac Mini I have hooked up to my TV and use as a home media center. Since its usually idle most of the day, this should work fine, although its 1GB of RAM will be a little tight. I don't know how performance will be if I try to watch TV on it. I have no backups running on the Mini, so I need to dig up another external drive for that as well.
I haven't found WiFi to be very reliable, so I ran an ethernet cable from my home office down the stairs to the Mini. It's ugly, but works for the moment. Eventually I want to run a cable from the office to the basement, where I could then run it to the Mini or anything else.
I had previously purchased parts to build a cheap, plain Linux box that would then run the WM image of my websites but had problems with Ubuntu and the video card (Video card support has always been a problem with Linux for me). The box is noisy and probably eats a lot of power, so I might leave the sites on the Mini permanently once I upgrade the RAM.
I've heard tales of failed drives coming back to life one last time by thumping them, or cooling them, or smearing them with goat blood. I'm hoping if I try restarting the iMac several times that I can get the drive to come up long enough to copy over the 8GB Linux VM image. So far no luck.
Tuesday, October 7, 2008
King of Prussia Lego Store Grand Opening
Last Saturday I went to the Grand Opening of the new Lego Store in the King of Prussia Mall, although the store itself had already opened last month. I didn't expect it to be as busy as an Apple Store Grand Opening, so I got there about a half-hour after opening. Oops. The line already stretched down part of the mall and around a corner. I think I was the only lone adult I saw in line (everyone else around me were families). Luckily I had my iPhone with me and the 90 minute wait went by quickly.
The store was giving away free commemorative Lego Liberty Bell sets to the first 300 customers who spent over $35. At first I was afraid they had ran out, but they had plenty left by the time I got into the store. I filled up two cups with bricks (I saved 50 cents by reusing cups I had previously filled at another Lego store) and picked up the Cement Mixer set.
Afterwards I headed over to a section of tables where you could help build pieces of a giant Lego Yoda. I assembled a small brick, got a $5 coupon and a certificate signed by Master Builder Dan. I talked briefly with some volunteers who were members of local PA Lego clubs. I'll have to check them out.
The coupon expires at the end of the month, so I'll probably be make another trip in the next week or two. Hopefully the giant Yoda will still be there. More photos from Grand Opening are up on my photo gallery.
Subscribe to:
Posts (Atom)