The Split Brain

Harvesting a deep furrow in his mind, where wise counsels propagate

Work like you play

I have a confession to make: All day I sit at work and program computers, then after work I go home and do the exact same thing. The programs I write at work and at home are different (right now at work I’m writing a beefy Django app with tons of client-site Backbone JavaScript, but at home I’m learning Rails); but to the untrained eye it must look like I just tap-tap-tap all my free time away.

Of course I wouldn’t program in my free time unless I thought it was fun. I pretty much only do things that I think are fun. Life’s too short to spend any time being miserable about what you do. Work is a different kind of fun though; work is stressful and high-pressure. We have customers that need features, we have bugs that need fixing yesterday. Those factors that make it stressful are also the factors that make it rewarding. I know that a good publish will make our users happier, and that a bad push will make them sad.

Hacking a Rails app in my spare time is a different beast. Most of my time is spent reading up on best-practices, reading entertaining blog posts by characters in the Rails community, and reading the works of the venerable _why. If I worked at a Rails shop would I still find it as fun? Maybe, maybe not. Maybe that’s not the point. I have more freedom to write bullet-proof high-quality code, but if I delay my publish by 2 weeks nobody is going to care (or even notice!).

Does a lawyer finish work at the office and go home to work on slightly different lawyer work? Does a doctor? What about a road-worker, a journalist, a carpenter? I don’t think so.

Who does keep working after hours? Artists. Musicians. Writers. Creators.

Doubts

The whole problem with the world is that fools and fanatics are always so certain of themselves, but wiser people so full of doubts.

- Bertrand Russell

Real-time Search and The Decentralization of Information

Often, in a spare moment alone with my laptop, I find myself watching TED talks. Today I watched a nervous looking Evan Williams talk about Twitter, how it grew out of a side project of another company, how they listened to their users in creating useful features such as the @reply.

While watching it struck me that real-time search is a monumental thing. Not just a cool distraction, but a paradigm shift in how we, as humans, might perceive ourselves. Previous to any kind of real-time search we depended on centralized media to deliver current events to us, and that same media would drop its own bias into the information payload. Now, with Twitter, we can disseminate important information instantly, globally, with no bias but our own. Twitter is the decentralization of information delivery.

People often compare Twitter to shouting into a vast emptiness, and at times it can seem that way; however, we aren’t shouting into nothingness, we are shouting at the world. Real-time search is the tool that enables us to listen to what the world is saying.

Turns out Bose headphones rock

My Life, Drum-roll Please

I haven’t posted on this blog in ages! I have neglected it like many things in my life. Things have been tumultuous for me, these past months, but I’ve emerged from the chaos and I’m doin’ fine.

So I am working at a fantastic Waterloo startup Top Hat Monocle, and we’re launching in September. The bulk of my work is top-secret at this time. We don’t want to spoil the punchline too early in the game. Trust me, though, it’s badass.

There’s not much of a point to this post, just writing for the sake of it. Hope everything is well in whatever you folks are up to!

Why I Became a Pirate

Following a small trend going around in the Pirate Party of Canada‘s forums, and specifically Scott Elcomb’s blog post, I have decided to write a small explanation of why I have elected to become a proud Pirate.

Firstly let me make it clear that by “Pirate” I mean a full-fledged, donating member of the Pirate Party of Canada. I have not become a Somalian bandit who hijacks shipping vessels. I should also clarify that the views expressed here are my own. They are not necessarily reflective of the views and opinions of the Pirate Party of Canada. I do not represent the party in any official capacity.

Don’t Pirates Pillage and Steal?

Why would anyone become a Pirate? Pirates have a nasty history of stealing, murdering, and other equally nefarious acts. It is precisely because of this history that certain people have branded information theft as piracy. They associate the negative connotations of piracy with the far less severe crime of downloading a song or movie without paying for it. This enhances the argument that information theft crimes should be met with harsher punishments as a deterrent.

The truth of the matter is that the perpetrators of these crimes are people exactly like you and me. They are not hate-filled creatures hijacking Madonna songs on the high seas. People illegally download music because it’s convenient, and it’s DRM free.

The Pirate Party is taking back the term for the common people accused of these crimes. The powers that be want to brand normal people doing things we all do every day as pirates and criminals. The Pirate Party will take that label and champion it for the very people it was meant to incarcerate.

Using Django on Dreamhost

I am in the process of migrating all my websites from Pair hosting to Dreamhost. I managed to get a deal from Dreamhost that I couldn’t refuse, and I’ve been meaning to redesign some of my projects on top of the Django framework, so the switch made sense.

Setting up Django projects on Dreamhost isn’t completely painless, however. The wiki article is very helpful, but if you’re a Django newbie like myself you may get hung up on a few things (like I did). The following is a short tutorial on how to get up and running with Django, with hosting from Dreamhost.

Getting ready

Enable FastCGI in your Dreamhost Web Panel under Domains » Manage Domains » (click the domain to be Django-ified):

Here is where you want to enable FastCGI

Here is where you want to enable FastCGI

Create a “media” subdomain under Domains » Manage Domains (ex: media.<yourdomain>.com). The media subdomain is where all of your static media files (like images or CSS files) are located. To use these in your Django templates hard-link to the location of the media subdomain (don’t worry we’ll get to this later).

SSH into your Dreamhost server and create a projects directory in your home folder.

mkdir django_projects

Getting and Installing Django

Once you have set up your environment you’re ready to go. Get the most recent stable release of Django’s source code through SVN:

svn co http://code.djangoproject.com/svn/django/trunk/ django_src

This grabs the current release of the Django source code and checks out a working copy to a newly created directory “django_src”. Next we must “install” Django by adding it’s script locations to our PATH variable. The PATH variable is checked by your shell every time you invoke a command (ex “ls” or “mkdir”). Once we add the Django scripts to our PATH we can execute them in our shell. To do this use your favourite text editor to open up ~/.bash_profile. Add the following lines at the bottom of the file:

export PATH=$PATH:$HOME/django_src/django/bin
export PYTHONPATH=$PYTHONPATH:$HOME/django_src:$HOME/django_projects

Now that we have included the new directories in our PATH (and our PYTHONPATH, Python’s own special PATH variable), you must update your current shell session to reflect the changes. To do this either close and reopen your shell session, or just type:

source ~/.bash_profile

Creating your Django project

The next step is to actually start and configure our Django project! To do this navigate to your django_projects directory created earlier, and start your Django project (replace “myproject” with your new project’s intended directory name:

cd ~/django_projects
python django-admin.py startproject myproject
chmod 600 myproject/settings.py

Writing an FCGI Dispatcher

Inside of the directory where your website lives, download this handy FCGI dispatched script written by a generous member of the Dreamhost community:

cd ~/[your domain]
wget http://svn.saddi.com/py-lib/trunk/fcgi.py

Create a new file called “dispatch.fcgi” and fill it with the following:

#!/usr/bin/python2.4
import sys
sys.path += ['/home/myuser/django_src']
sys.path += ['/home/myuser/django_projects']
from fcgi import WSGIServer
from django.core.handlers.wsgi import WSGIHandler
import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'myproject.settings'
WSGIServer(WSGIHandler()).run()

Make sure you change the paths to be the directories you defined earlier! This is very important. Next make the newly created files executable:

chmod 755 ~/mydomain.com/dispatch.fcgi ~/mydomain.com/fcgi.py

Make yourself an .htaccess file

Edit ~/[your domain]/.htaccess and add the following:

RewriteEngine On
RewriteBase /
RewriteRule ^(dispatch\.fcgi/.*)$ - [L]
RewriteRule ^(.*)$ dispatch.fcgi/$1 [L]

Initialize your Django project’s database:

~/django_projects/myproject/manage.py syncdb

Now you should be able to point your browser to www.<your domain>.com and see the “It worked!” page. You’re all set with your new Django-powered host.

Books Which Have made a Difference in my Life

I do a lot of reading and like many hackers the books I read tend to come from all different genres and eras. I don’t claim to have any profound ability to find good literature, but occasionally in my word wanderings I stumble upon a mind-blowing book which alters the way in which I view the world. Hopefully some kindred spirits will find my annotated list and be encouraged to borrow these books from their library and get reading!

Disclaimer: The order of this list is not indicative of their precedence!

Siddhartha by Hermann Hesse

Siddhartha perhaps deserves first place (in a list which I just told you had no order!) since it has so profoundly changed my thinking. The short book depicts the spiritual journey and life of a man living in India at the time of the Buddha. Hermann Hesse’s words struck such a chord that even after two years this book resonates within my thoughts and actions.

Godel Escher & Bach by Douglas Hofstadter

GEB, as it’s affectionately called by its fans, is a fascinating romp though the peculiarities of the universe. It is told through a strange sort of partially dialectic, partially ordinary style. Hofstadter’s love of language, words, riddles, and double-meanings shines though in some of the particularly involved puzzles subtly sprinkled throughout the pages of this tome. I recommend this book to any curious individual (not for the faint of heart!).

The Art of Computer Programming by Donald Knuth

How can any hacker’s library be complete without these wonderful manuals by the inventor of ‘Big O’ himself, Donald Knuth. The elegance of the intellect behind these books is evident from, among many things, the meticulous typography, the exercises, and of course the majestic content of the book itself.

I, Robot by Isaac Asimov

Science fiction literature was irrevocably changed by the publishing of I, Robot by Isaac Asimov. Previously the artificial intelligent beings would be wooden, perfectly obeying slaves to their carbon-based masters; however, I, Robot explored the concept of robots developing a personality, a soul even. In reality, I think, I, Robot is less about robot psychology and more about examining human psychology through the mirror of our own creation, but the concept that A.I could one day be as powerful, or more powerful, than man has stuck. I, Robot is absolutely required reading for any science fiction fan.

A People’s History of the United States by Howard Zinn

What a masterpiece! This book hit me at a cynical time in my life, fresh off the 2nd Bush election, where my world-view was being ransacked by consistently contrary evidence to my optimism. A People’s History did nothing to alleviate these misgivings, and indeed reinforced my completely cynical outlook on life! In A People’s History, Howard Zinn presents a history not from the perspective of generals and presidents, but from striking miners, starving farmers, blacks fighting for their rights, women fighting for equality. The anecdotal evidence may be skewed, but the recurring themes are almost impossible to ignore. The new American aristocracy desires something (cotton, farmland, oil), then they posture America into a position for war, rowl up the population, and send the poor people to die in the name of national duty. It’s a disturbing exposé of the political motivations behind conflict, and the veil pulled over the eyes of the public.

Frankenstein by Mary Shelley

This book is the ultimate gothic novel. Through Frankenstein, Shelley examines the power within man to produce his own destroyer. We arrogantly pursue our desires with no thought to their consequences, and what responsibility do we have once we have unleashed our creation onto the world? Does Frankenstein have the right to pursue the creature and destroy it? Does the creature have the right to live its life? Where does a creator’s power end over his creation?

Alias Grace by Margaret Atwood

Though many of my classmates despised this book, I believe it to be an exceptional example of superb creative writing. The great thing about Alias Grace is that each person who reads it could conclude completely different things about the book’s happens. This ambiguity touches every aspect of the book, and can have a transformative effect on the person’s opinion of its characters. Alias Grace deserves some serious thought after its conclusion.

APN settings for HTC Dream on Rogers

If any G1 or Dev phone users are trying to get data in Canada, the following is the default APN setting on my Rogers HTC Dream:

Name: Rogers
APN: rogers-core-appl1.apn
Proxy: not set
Port: not set
Username: not set
Password: not set
Server: not set
MMSC: http://mms.gprs.rogers.com
MMS proxy: 10.128.1.69
MMS port: 80
MCC: 302
MNC: 720
APN Type: not set

Microcontroller Porn

Okay, so it’s not really porn since the IC casings are still firming in place, hah. Here are some photos of my Arduino Duemilannove and its Ethernet shield.

First the Duemilannove itself. Sporting the Atmel ATMega168 microcontroller, this is one serious piece of power-efficient hardware. I am currently sketching out a really small Operating System for this board, for kicks and giggles.

The Duemilannove in all its glory

The Duemilannove in all its glory

A better view of the microcontroller IC

A better view of the microcontroller IC

Finally the Ethernet shield. My plan is to implement some fairly serious network stackage with this hardware after my OS is stable.

Networking and beyond!

Networking and beyond!

Check out the Arduino project page for details about the hardware. Check out the AVR  Libc home page for details on how to get gcc talking in AVR instructions.

Contact me if you are interested in OS design or just for interest sake.