New Blog Location, Please Update your links, RSS

March 29th, 2008

This blog is back at so please update your links, RSS aggregators, or whatever hullabaloo you use to read my blog.

Comments Are Enabled

March 18th, 2008

By the by, I disabled having to register to comment.

The Codebook

March 13th, 2008

I’ve been keeping a journal that I call “The Codebook” for the past four of five years. When people see it for the first time, they usually ask me something like: “So.. are you with the NSA then..?”, and I although cliche, reply with something like: “I can neither confirm nor deny my involvement with the NSA”. Anyway, The Codebook is a notebook that I write down all of my programming ideas, work through technical problems, and keep track of what I’m working on.

The content of The Codebook is intractable. It ranges from C++-pseudo code, and algorithm analysis, to mocked up maps that I plotted out when I did that Legend of Zelda clone I wrote back in college. It’s also organized very poorly. Anybody who looked at it would probably think it’s gibberish Computer Science, or some kind of nerd stream of consciousness piece. For instance, I just found an outline of what my plans for JuiceMUD were, right next to a rather large listing of UNIX programs, and then on the next page there’s some mysterious binary work surrounded by blank paper.

This all leads me to a question: how do you keep your technical thoughts organized?

Codebook Cover Codebook Example Codebook Map

Compiling libpng in Visual Studio .NET {2005}

March 1st, 2008

There is very spotty documentation on how to use libpng under Windows. I did find one site that talks about the subject, so you might want to refer to it as well.

1. Libpng Setup:

First, you’ll need to download the latest version of libpng and zlib. Extract them someplace (I placed them within my projects root, in a directory called ‘deps’). The pre-canned Visual Studio settings that come with libpng look for ‘zlib’ rather than ‘zlib-x.y.z’, so rename the directories so that they lack the version numbers.

2. Compiling libpng and zlib

Next go into <projectname>\deps\libpng\projects\visualc71 and open libpng.sln. Go to Build and run ‘Clean Solution’. Now you have a choice, you can either compile libpng as a dynamically loaded library, or a binary blob to statically link into your executable. You can compile either one as a debug or release build. Just make sure that whichever way you compile libpng (debug/release), is the same as what you compile your project. So choose an option, and go to Build -> Build Solution. This will compile both libpng and zlib.

3. Project Setup

Now you’ll need to set your project up to include the libpng and zlib files. Open your Visual Studio project, and go to Project -> <projectname> Properties. Expand Configuration Properties, and then expand C/C++. The top field on the right will read “Additional Include Directories”. Click it and add “C:\<projectname>\deps\zlib;C:\<projectname>\deps\libpng”.

Now close the C/C++ tree and expand the Linker tree, which is directly below it. Roughly 3/4 of the way down is a field called “Additional Library Directories”. Click it and add


In my case, I compiled as Win32_LIB_Debug (Statically Linked, Debug Symbols included), so that’s what I set <projecttypeyoucompiledas> to.

Next open the Input node that is in the Linker tree. Under “Additional Dependancies” add libpngd.lib zlibd.lib if you chose to statically link, or libpng13d.lib zlib1d.lib if you compiled it as a dll. If you did compile as a dll, you will then need to copy the dll’s that were generated to the same directory as your executable, or to a directory loaded in PATH.

Now you can implement PNG reading or writing into your project.

4. Troubleshooting

Q: I get a ton of linking errors!
A: Visual Studio cannot find the lib files. Double check that they are compiled (libpng{..}.lib, zlib{…}.lib), that your projects Library dependancies includes the directories that they are in, and that the lib files are included in the Additional Dependancies field.

Q: Visual Studio spits out errors about undeclared identifiers!
A: Make sure you have #include <png.h> in your source. Also make sure that png.h’s path is included under Additional Included Directories in your projects settings.


February 20th, 2008

I’ve been using Xmonad as my window manager under X11 since early December. Xmonad is written in Haskell, a purely functional programming language that compiles down to machine code. Haskell is the most different looking programming language I’ve ever seen; when I started looking at Lisp, the structures made sense, but I’ve been lost looking at Haskell code. I suppose I need to pick up a book on the subject. I digress, Xmonad builds upon a different paradigm than what most users are used to. Most Window Managers (including Windows Explorer, Gnome, Etc.) use co-ordinate based stacks of objects to represent the environment. Think of this as having Firefox or Internet Explorer fullscreen, and you press alt-tab to get to Google Talk or you drag iTunes around the screen. Xmonad deviates from this by implementing what’s known as a tiling window manager. Instead of stacking objects, Xmonad gives applications non-overlapping regions of your monitor. This has the handy effect of putting what you’re using right in front of your eyes.

The way Xmonad handles where it puts the applications is terrific. If you have one window open, it will take up your whole monitor. If you have two, each will get half. But what about if you have three, or more? Xmonad solves this by declaring the left half of your screen as the main workspace, displaying one window there, and divides the right half in twain. Hence your attention can be given fully to your main application, while you switch to the other programs for support. This is quite handy if you’re a programmer and you have GNU Emacs or gVim open as your main application and two terminals open to test your project stacked one on top of the other to the right of it.

There is the obvious issue of “Most of my applications are designed as WIMP interfaces and this will break them!”. Don’t worry, other tiling window managers such as Ion force you into strict tiling, but you can configure Xmonad in its settings file to allow certain applications to float on top of other windows. Everything in Xmonad can also be controlled by the keyboard. Switching between windows is as simple at hitting alt-k. You can switch virtual desktops by pressing alt-<screen_num>(I switched mine to alt-f1 … f9 so as to not interfere with Irssi). There’s also multi-monitor support.

You can find out more about Xmonad at They also have a directory of interesting screenshots, and a wiki full of configurations.

Xmonad In Action

Logitech Wave Keyboard

February 6th, 2008

I purchased a Logitech Wave Keyboard a little over a month ago. My old keyboard, an original Microsoft Natural that I had been using since 1999 was so old that parts of it stopped working, and then started again. Since when I purchase things like this, I tend to make them long term investments, I went to a couple stores and tried typing phantom paragraphs on each and every keyboard that they had on display. The Wave felt the most comfortable to me, and I nearly purchased it on the spot, but two exceptions were thrown: 1) It was cordless, and I don’t like the idea of having to replace batteries in a keyboard, something which probably won’t be moved, and 2) keyboards in stores these days come bundled with a mouse, which raises the price about $60. So I turned to Newegg, who had a cord version without a mouse. With shipping it cost approximately $40.

I had been using an ergonomic keyboard for roughly nine years. The kind with the gigantic split in the middle so that your hands allign with the keys more naturally (at about a 40 degree angle, rather than straight on). The Logitech Wave is able to accomplish this same feat without a split. Instead Logitech spent a couple years engineering the keyboard into a wave shape. The Wave also has a built in wristpad that keeps the head of your Ulna obtaining a pinkish hue due to all the sliding around. It also features a number of macro keys for volume, and standard applications. Luckily all of those features are rebindable, so I can launch Emacs instead of Word, and Gimp instead of Photoshop.

To keep this brief (I don’t want to mull too long about a keyboard) , the Logitech Wave is a worthy buy if you’re looking for a new keyboard.

Blife Ports

February 2nd, 2008

Stock and I got blife running on Mac OS X yesterday. We figured that in theory it should compile out-of-the-box since I had OS X’s OpenGL and GLUT headers in their own #ifdef clause. However, we found that linking to libraries works a bit different on OS X as opposed to the other Unix’s. On Linux, FreeBSD, etc., executables are linked to libraries by passing “-l<libraryname>” to the linker. So in this case, GLUT is linked to blife by passing “-lglut” to he linker. However, on OS X, you need to use “-framework <libraryname>”, so”-framework OpenGL -framework GLUT” gets used.

When blife 0.2.5 is released, there will be a OS X specific section in the Makefile, so OS X users can simply “make osx” and have the proper binary built.

With that said, blife has been compiled and works properly in GNU/Linux, FreeBSD, Windows, and OS X. :)

Bike Routes

January 29th, 2008

I mapped out my two favorite routes for cycling on Google Earth. The Kittitas route is what I used to ride when I was a student at Central Washington University. It’s about 24 miles, and has a nice rolling profile. The only caveat of that ride was that there was almost no shade. Oh, and I was almost dispatched by some Rottweilers and Black labs.

The Redmond to Seattle route uses both the Sammamish River Trail, and Burke-Gillman trail. Really it’s just one trail, but changes names in Bothell. It used to be a rail line for timber before being converted.

The Ironhorse route was a leg of the Ironhorse Trail (aka John Wayne Trail), that I used to ride my Mountain Bike on. The trail extends from North Bend, to Spokane and used to be a railroad. It’s an unpaved trail, but has a thick layer of gravel on it which makes riding feel mushy. I used to see a lot of wild life on it: birds such as Cranes, and I once saw a Rubber Boa, our indigenousness constrictor.

Google Earth Paths:

Apples in Syrup

January 18th, 2008

Here’s a tasty treat that I hacked up.


1 Granny Smith Apple
1 Tbs. Butter
1/4 C. Brown Sugar
1 Tsp. Cinnamon
1/4 C. Apple Juice


1. Peel the Apple, cut it in half, and then quarter it. Now core the apple with your knife. Next cut it into eighths, and cut each of the resulting Apple crescents in half so that you have sixteen Apple chunks.

2. Heat your skillet over Medium-High heat and melt the butter.

3. Put the Apple in the skillet and coat in the melted butter. Cook for approximately five minutes, tossing every couple of minutes.

4. Sprinkle the Brown Sugar and Cinnamon on the Apple and toss the Apple around. Cook until juice is drawn out of the apple and a thick syrup starts forming on the bottom of the skillet.

5. Once the Apple is just barely fork tender, pour the Apple Juice into the pan and deglaze the bottom of the pan with your spatula. Cook until the liquid thickens into a gooey syrup.

It’s a Mad Mad Mad Mad Trail

January 14th, 2008

I just got back from my first outdoor ride of the year. It’s one of those sunny weekends in January, where the nine months of cloudiness has given way, and the warm rays I hear they enjoy in California poke through and make Washington almost bearable. Along with the Sun comes a certain ‘phenomena ‘ on trails that I’ll call “clueless pedestrians”. A horde of indignant neophytes, if you will. These are people that tend to walk three or four abreast, have dogs on leashes that are wandering around the trail, and of course the unattended toddlers who define keeping a riding line something like a sinusoidal wave.

So when I started my ride from Marymoor Park blissfully unaware of what was in store, as I was as happy as could be. With all the training I’ve done indoors since November, my legs feel better than they ever have before. I took yesterday off, so my energy level was as high as I could want. Pardon the expression, but I was bright eyed and bushy tailed.

The first mile which was mostly flat and required little steering was terrific. My bicycle felt smooth, and as one would hope, there weren’t any strange noises. It was slightly chilly, so I was wearing my new winter gloves (Pearl Izumi Gavia). I noticed rather quickly that they were interfering with my ability to shift, brake, and to a degree, steer. It was like a surgeon having his hands wrapped in gauze before a surgery. So I took those off and put on my summer gloves, which I was carrying in my back pocket. Lo and behold, my hands were actually warmer in them!

So I got going again, and all through Redmond’s portion of the trail, I had to keep unclipping a foot from my pedals and use a leg to walk around these groups of people that were hogging the trail. I’m sorry walkers, but walking three to four abreast on a public trail is not okay–that’s bad trail etiquette (the worst are women with strollers who walk four abreast pushing their strollers at close to 1mph). Once I got out of Redmond, there weren’t any issues up to Woodinville (6 miles in), where I stopped, drank some Gatorade (wasn’t thirsty, but it’s easy to get dehydrated in the cold) and stretched my legs.

From Woodinville, through the I-405 knot of roads, over the soft-bridge, and through the Rooster Woods there was no trouble. The trail through the Rooster Woods were shaded from the sun, and the trail was still wet from the rain yesterday morning. In fact, parts of the trail had moss growing on it, so I slowed to a crawl and hoped my tires didn’t slip (9 miles in).

While I was in the Rooster Woods, I did witness a baby falling out of its stroller (backwards). How that worked, I’m not certain. I think it was the dad’s fault.

After the Rooster Woods, I went over the Suicide Bridge (supposedly some kid..well you know..), up the Slope, and into the deep dark tunnel. I had forgotten how dark the tunnel is, and thanks to my over performing sunglasses, I couldn’t see a darn thing.

I really don’t have anything to say about the Golf Course, the streets, or the detour, other than that I almost slipped on a sideways slope. I stopped at Log Boom park, 13 miles in, and had my delicious chocolate brownie clif bar (Clif Bar, I just gave you a plug, please send me gear ;) ). So I turned around and started back.

Everything was going fine until I got back to the western edge of the Rooster Woods, when suddenly this old ladies toy poodle charged at my bike! The lady yelled “No, <effeminate name I can’t recall>!”, and I slammed on my brakes, locking up my tires since the little rat was headed right for my front tire. I didn’t really want to clean blood and gibs off myself and my bike. The old bat didn’t even apologize to me!

My adrenalin was pumping from the incident, and as I neared the soft bridge, I started getting tired. so I slowed down, and got passed by what looked like a team of semi-professional cyclists who were keeping the tightest line I’ve seen on the Burke-Gillman.

Some kid zig-zagging around the trail was coming right at me. I slowed down to 3mph and was hugging the the right shoulder of the trail to avoid the tike.

Nothing to report on the way to Woodinville, I stopped and took a swig of Gatorade. I hopped back on, and decided to sprint back to Marymoor for as long as I could. So I went into my drops and cruised at 19mph, which isn’t bad considering the trail congestion. When I got back to the Redmond Bridge (near 520), I noticed as I was rounding the switchback that there was this gigantic dog turd in the middle of the trail. The crap was everywhere. It was by far the most disgusting pile of shit I’ve ever seen. There was one gigantic plop of crap, and then a trail of logs that spanned the bridge.

Feeling jaded at that point, I solemnly rode back to my car, drank the rest of my Gatorade, and went home.

Total miles: 26
Chances for Carnage: 2