Category: Uncategorized

Trying a Standup Desk

I spend most of my working time (and far too much of my personal time) working on a computer. This has traditionally meant sitting in a chair. All day. I’ve spent years thinking that someday I’ll get around to trying a standup desk. It’s the magic solution to all my physical fitness needs!

This summer I spent 6 weeks living at Children’s Hospital in Seattle. After a few weeks I needed to start working again. I mostly occupied small rooms, anywhere I could find a clear table surface. Once I was kicked out of a video conference room legally reserved for deaf users. One night we didn’t have a roommate in the hospital room and I took over use of the over-bed table from the other side of the room:

20130902-114916.jpg

This was perfect! It’s height adjustable, and just small enough to fit a laptop, coffee and 1 piece of paper. Sadly I was only able to use the table/desk for one evening before a new patient arrived. I couldn’t get the idea out of my head when we arrived back home, so I found a similar desk on amazon for only $50. Today (Labor Day ironically) is my first day using it at my office. If I stick with this, I’ll try to document how it goes!

Presenting the ballot that went through the wash

This morning Jenn carefully filled out her 2012 ballot. But before the ballot could be dropped at the county dropbox, our dog Jasper somehow opened a nice gash on the pad of his paw and tracked blood all over the house. And the blanket on our bed. I just discovered the ballot as I was moving the blanket to the dryer.

After some research, we discovered you can obtain a replacement ballot at the local County Auditors office. Even on election day itself. Which is tomorrow.

Written by Comments Off on Presenting the ballot that went through the wash Posted in Uncategorized

w00t

w00t! A few weeks ago this company emailed me through flickr asking if they could use a photo of mine in their online travel guide. I just heard back that they selected my picture. It’s from my trip last February to Copenhagen. Check it out. It’s the snowy photo of Absalon Hotel, where we stayed.

Trip to Copenhagen

Jenn and I took a 10 day trip to Copenhagen, for no reason other than cheap airfare and the idea of vacation.

Highlights:


Carlsburg Brewery
Beer Creation.

Jenn at our favorite brewery
Beer Consumption.

Man on the street
Annoying Tourists.

Helsingor Castle
Castles.

Helsingor Castle - Dungeons
Dungeons under castles.

Absalon Hotel in the snow
Snowy streets.

Man on scooter
Fearless senior citizens.

Denmark apparently collects and ships the snow somewhere
Interesting snow removal techniques.

Duckies! Giant Windows Vista Ad!
Duckies! Giant Windows Vista Ads!

Contemplating his next Rock-Paper-Scissors move
Statues honoring Rock-Paper-Scissors.

Self-Explanatory Picture
Boobs.
See the full set on flickr

Wii!!!!!!!!!

In other news, I woke up at 7:20am Sunday and bought a Wii!

I was not aware that Best Buy opened at 10. I thought getting there 30 minutes early would land mii a Wii. I guess 2.5 hours made it a pretty sure bet. The Bellingham store had 30 saved up for that morning, but had zero extra controllers. My living room will need some rearranging when wii get the multi-player on.

More on this story as the fun develops.

xkcd

If you are at all cool or have any sense of humor, this comic is for you: http://xkcd.com/. It might help if you are fairly nerdy.

xkcd comic

Extending PEAR’s DB class

This took me quite a while to figure out, so I probably should write it down. My basic goal was to have global db error handling by overloading the query method. Because of the inheritance heirarchy in the DB classes this was tough to nail down at first. Using the DB class in it’s vanila form looks like this:

require_once('DB.php');
$db =& DB::connect("mysql://user:pass@host/dbname");
$sql = "SELECT * FROM foo";
$query = $db->query($sql);
$result = $query->fetchRow();

Which is a slightly different API than the DB class I was using at ResTek for a long time:

require_once('DB.php');
$db = new db('database');
$sql = "SELECT * FROM foo";
$query = $db->query($sql);
$result = $db->fetch_assoc($query);

It was a little annoying to rewrite code / retrain my brain for PEAR’s API, but it makes things easier.

Now when you call DB::connect, you do not get a DB object back but a DB_mysql (or whatever DB you specified). I tried making my own MY_DB class to return the right objects. Disaster. I was successful with copying and renaming the classes DB, DB_common, and DB_mysql. Now I was able to insert my own code in the DB_mysql::query method. Sweet.

I eventually trimmed it down to just extending the DB_mysql class. Here’s a sniplet that works very well for me:

class DB_MIKE_mysql extends DB_mysql {

    function &query($sql) {

        $query =& DB_mysql::query($sql);

        if ($this->isError($query)) {

            /* custom error code here */

        }

        return $query;
    }
}

$db =& DB::connect("MIKE_mysql://user:pass@host/dbname");

The DB::connect function loads a class called DB_$WHATS_IN_THE_DSN, so getting the custom class name right was the tricky part. PEAR seems to like this on php4 and php5.

Written by Comments Off on Extending PEAR’s DB class Posted in Uncategorized Tagged with