2 posts about programming

Visualizing Human Rights with the Google Charts API

Jun 20 2008

Smartly presented information is a nonprofit's best friend. If you can't communicate the problem, no one is going to give a damn. Hash's blog just pointed me to some powerful charts Sokwanele mapping project , which I've mentioned previously. These charts are extremely important data to have in the public domain, and it's great that they appear well-executed and polished, with a high resolution of visual information.

pretty charts, not so pretty data.

Google Charts from Sokwanele and Mobile Researcher

The charts at Mobile Researcher also caught my eye recently (also pictured, at right and bottom). Turns out they were both made with Google Charts. I hadn't used it before, but I recognized their densely set labels and had some vague ideas that there was a Ruby wrapper. And I just thought that the Mobile Researcher charts were really beautiful. Turns out it's super easy. There are plenty of libraries for managing the requests to the API, and, in some simple cases you can even code it by hand, since all of the code is simply passed through a query tag on an image url.

What it does do is proved fodder for organizations inside and out to make an even stronger case against this repressive regime. - Erik Hersman @ whiteafrican.com
But in most of the cases the data is hashed somehow with javascript, since urls can only be so long. Since I was working in a Rails app, I used a great ruby library and was up and running very quickly. I wholeheartedly recommend them anytime you need simple, sharp graphics to illustrate your research. If you have a web app or with dynamic charts, it's a no-brainer, since generating images is relatively intensive memory-wise.

All this is to say that something like this:

  <img src="http://chart.apis.google.com/chart?chd=t:6,2,6,4,2,4,7,3,4,2,3,4 &chco=0077CC&chs=120x40&cht=ls" />;

Turns into this:


Or you can abstract the access to make it easier with a library like this with a method like this:

    google_pie('val1', 'val2', 'val3')
    def google_pie(*args)
    size = "250x100"
    url  = "http://chart.apis.google.com/chart?"
    return < img src=\"#{Gchart.pie_3d( :background => 'E9E7DD', :size => '300x80', :data => *args)} \" />

But the API of course is language neutral, and I am sure it would be just as easy in most any language. Oh, and it's free! (Though capped at 10k charts per day ... which would be a good problem to have, I suppose.)

In Praise of Shitty Programmers

Feb 11 2008

There's this great movie called A Beautiful Mind that I saw once, and in the last few months I've been quoting it a few times when talking about my programming career. Overall it's a great story, but the one scene that really gets me is when he (John Nash, famous mathematician) is standing in front of a class at Princeton and he puts a particularly complex problem on the board.

It's the first day of class, and he puts the problem on the board, and then explains how complicated the problem is.

"This problem will take some of you a few months to solve, ... for others, it will take the rest of your natural lives."

Assuming that I could ever even get into a Princeton math class (uh, no), this would be when I walked out. I would drop it and go back to something easier to BS, like a user experience research class.

I mean, what fun is working on things that you can never really GET? Things that you aren't born with?

Anyway, this has basically been my experience since I've moved to San Francisco. As in, totally getting my brain fried by the stuff I see other programmers doing — programmers who were just born with it. I meet guys in coffeeshops and they tell me casually about the device drivers they're writing. (Seriously, he was building an android or something.)

And thus, in spite of really really wanting to be a great programmer, and thinking that I was pretty good at it, I now realize that I am a shitty programmer, and I always will be. I mean, I think I'm probably around the 50th percentile of programmers, but the problem is that I know about 1% of there actually is to learn in Computer Science. I am the guy who spends the rest of his life trying to figure out the problem on the board. And this was not a good realization. I actually was pretty depressed when I thought about it this way. I was just so much happier when I thought I was a l33t hacker a few years ago.

I am consoled somewhat by the fact that you are probably a shitty programmer too (jk jk jk), but in the last week I had three much more useful realizations:

When it is ok to be a shitty programmer

  1. You absolutely love it. I saw this guy walking down the street with a beat up cello the other day. And I was thinking about this problem and saying something to myself like, "I'll bet he is probably in the bottom 30% of all cello players." This guy probably will never play Bach's cello suites. But of course, he was on his way to a great gig and was gonnna have an awesome time with has prog-chamber-rock outfit. With a big ass grin on his face. That's reason enough to work on some impossible problem long after everyone else has it figured out — just cause it's a fun process.
  2. You bring something else to the table. If you are a shitty programmer but you can talk to people and help them collaborate, maybe do a bit of design, or do design research, or you just have a strong creative vision — these are all qualities that are missing from some of the greatest programming minds.
  3. You are working on something important to people. This is the point I was making a month ago about all of the recent web standards fuss: Amateurs are doing more important things than you are, fancypants. And that's so rad. I mean, imagine that you are a brilliant programmer working on device drivers for some machine that counts money all day for some investment banker or something. Who cares? You can write a million programs that count a bazillion dollars and you will die really rich, but you won't DO anything. Find projects that are really important, gigs that actually impact people's lives in a positive way and you are already DOING much more important work than the most brilliant programmers (who are meanwhile busy deep in their cubicles, dying rich).

Don't get me wrong. It's not OK to write shitty programs. People deserve good software. That's part of the point: if you are a shitty programmer, fess up. Find your role on a team. But once you have crossed some basic threshold of capability, and you can build something that is useful, and usable, and you have a great time doing it ... then you can really get to work making a difference in the world with your work.

And anyway, being academically in the top 10% of your field typically produces completely perfect, completely conservative, crap. Right?