Late the other night as I was returning alone to my car after watching Batman Begins, I noticed that the car parked next to mine had its lights left on. One of the doors was unlocked, and there was no one around, so I let myself in to turn the lights off.

Almost everyone thinks I’m nuts for doing so. Well, at least I didn’t get myself arrested or shot.

Firefox goodness

June 12, 2005 at 11:18 pm (PT) in Rants/Raves

Cool Firefox extensions I’ve recently discovered:

  • Password Composer (video demo). Generates passwords based on a master password and on the domain name of a website, so you get a unique password for each site without having to remember each one. This is a really slick, simple, and effective solution to my complaint about e-commerce sites requiring accounts. Unlike other password generators, even though it generates strong passwords, they aren’t random, so you always can derive your passwords as needed, even if you don’t have the extension installed. (My friend Lior points out that a weaker, low-tech alternative is simply to incorporate the website name directly into your password, e.g. swordfish_gmail. If you do that, though, you should make it less obvious; perhaps use only every third letter of the site name.)
  • Document Map (screenshot). Creates a nifty, navigatable outline of the current page’s headings in the sidebar. Works really well for wiki-generated pages, WordPress weblogs, and programming reference documents (such as w3.org’s HTML and CSS specs).
  • Web Developer Extension. If I still were attempting to do web development, I’d be all over this. View tag and style hierarchies, make live CSS edits, and more.
  • Keyconfig. Modify Firefox’s keybindings. I can’t count the number of times that I’ve accidentally hit backspace outside of a textbox and lost something I was in the middle of writing.

Another cool trick I discovered was how to run multiple Firefox profiles simultaneously. This can be useful if you want to have separate profiles for web development and for normal browsing and want different sets of extensions installed for each. It’s also useful if you want to try out new extensions and themes without screwing up your default profile. To do this on Windows, make a firefox.cmd script:

@echo off
setlocal
set MOZ_NO_REMOTE=1

:: Adjust the path to firefox.exe as appropriate. start "" "C:\Program Files\Mozilla Firefox\firefox.exe" -p %* endlocal

Create a new profile by running the script with no arguments. Thereafter, you can load that profile by running firefox.cmd profile-name.

Recently in a programming forum I frequent, someone posted some sample code he had written and asked for a critique. He would be providing this code to prospective employers.

If you’re trying to get a job programming, providing sample code is good. However, it’s a little surprising what some people consider to be good sample code.

Your goal should be not only to demonstrate that you can write code, but that you can write maintainable code. Write-once, read-never code is worse than useless; it’s fragile and wastes the time of anyone else who ever tries to modify it.

Quick and easy things you can do to improve your code samples:

  • Make your code readable. More whitespace is better than less. More braces are better than fewer. People judge books by covers; make your code look good.
  • Document your code. Document your functions’ contracts; what are their inputs? what are their outputs?
  • Use defensive programming techniques. Aggressively use assertions to check that inputs are valid. Enforce functions’ contracts.
  • Handle errors. (Okay, this one is neither quick nor easy.) In my opinion, handling errors well is probably one of the hardest things about programming. It complicates resource management, it makes code ugly, it’s tedious, no one wants to do it, but it has to be done. If you’re going to submit sample code, take the time to handle errors. Use SESE patterns in C and RAII patterns in C++. At the very least, use comments to acknowledge where you ignore errors.

(Of course, only do the above if you also intend to continue doing them in practice. Misrepresenting yourself is dishonest, okay?)

Revenge of the Sith impressions

May 28, 2005 at 1:11 pm (PT) in Rants/Raves, Reviews

VMware took us all to see Revenge of the Sith on opening day last week. Woo! Overall I thought it was okay; it was way better than The Phantom Menace and Attack of the Clones, and it could have been a lot worse.

Impressions (spoilers ahead):

(more…)

I am such a sucker for girls wearing glasses.

May 27, 2005 at 11:13 pm (PT) in Personal

Sigh.

Back into Palm OS programming?

April 25, 2005 at 1:10 am (PT) in Personal, Programming

I bought a Treo 650 this week, and it’s awesome. It’s even inspiring me to do some programming for Palm OS again. Unfortunately, getting back into that groove is really hard.

I wrote a lot of great code while I was at Sony, but of course all that code is Sony-owned and outside of my grasp. To do any Palm OS development work again, I’d need to rewrite everything from scratch, which is demotivating because I’d be redoing work that I had done already and—since I’m now rusty at this—work that I had done better. It makes me feel like my life is progressing backwards.

The Many Depictions of Suckitude

April 10, 2005 at 10:24 pm (PT) in Art

A themed collection of various pencil doodlings:

(Don’t forget to scroll to the right.)

I am feeling better than I was a few weeks ago, though.

I suck again.

March 17, 2005 at 8:51 pm (PT) in Personal
>_<

I am completely inept.

I guess that’s what I deserve for deluding myself into being hopeful about something.

The downward spiral

March 5, 2005 at 2:38 pm (PT) in Personal

A few days ago I had my first swig of an alcoholic drink. My coworkers and I all went to a bar to celebrate someone’s birthday. One of them ordered some mango drink, couldn’t finish it, and not wanting to see it go to waste, I drank a bit of it. It wasn’t much, but it’s probably the most alcohol I’ve ever had in my life.

Sigh. Did I sell out my (admittedly useless) principles?

This has been a landmark week of firsts for me. I wonder if I’m going through some kind of mild identity crisis due to some impending doom I’m expecting.

First time to a club

February 27, 2005 at 12:35 pm (PT) in Personal

I went to San Francisco with a few friends last night and went to a club for the first time. I think I have too many inhibitions for clubbing to be an enjoyable experience. The rod up my butt must have a rod up its butt.

Maybe I should start drinking.