Category Archives: Blog

Academic Papers Artwork baby names Blog blogging democracy Design ethics Facebook firefox Flickr folksonomies Google Google Docs Google Spreadsheets how-to information-architecture information-retrieval information design internet iphone journalism listserv mailing list maps mass media Online News Papers Photography plugin poll social-bookmarking social networking social software spam tagging trust Twitter Usability web-development Web2.0 webspam web standards WordPress Writing

The most difficult problems you will ever face as a programmer

Niagara Falls and city lights at night I was given a problem to solve at work earlier this week and I pretty much totally choked.  To be honest it wasn’t that hard of a problem – I obviously can’t share it with you here, but I will say that (among other things) I completely, totally blanked on how to find if two lines on a plain intersect and didn’t have a laptop handy to look it up.

This bothered me all week and got me thinking about my career as a programmer and the kinds of problems I’ve been asked to solve.  Everything we do as programmers, developers, or software engineers boils down to solving problems–so what have I been doing all these years?  Finally I realized that of all the difficult problems I’ve worked on in my professional career, most of them were difficult because of:

  • Imposed constraints;
  • Convoluted business rules and vague requirements;
  • Political or organizational issues; or
  • Human factors.

That last type of problem I actually really enjoy working on, but let’s put that aside for the moment.  Notice anything missing from that list?  Only rarely have I encountered problems that required really complex logic, difficult algorithms, or lateral thinking.

Why is this?  Have I shied away from those sorts of problems, or been unable to hack it?  I don’t think this is the case.  I did well enough on the SAT and GRE, and I can usually get myself back up to speed for solving logic puzzles in a week or two.  My guess is that my career is pretty typical, and that most of the problems that most companies face are due to constraints, vague business rules, organizational issues, and human factors.

This flies in the face of the kind of education most of us get as programmers.  At OWU the computer science department always erred on the side of math – we spent more time on concepts than practical applications.  I really, really value the kind of coursework I had in college but when it comes down to it, I learned just two things that I use on a regular basis:

  • Basic concepts and common programming paradigms; and
  • How to learn new languages, programming paradigms, etc.

I really enjoyed discrete math, but have rarely needed all the combinatorics.  Hacking scheme in my AI class was very cool but that’s the last time I’ve done any alpha-beta pruning.  I have successfully solved problems with some relatively mundane insights:

  • Don’t rely on memory, take notes and find references.
  • Look for low-hanging fruit.  Does the database even have indexes?  Do you really need to debug 2,000 lines of Javascript that essentially reimplement the concept of linking?
  • If you ever have a technical quandry, you’re probably not the only on in the world with the same question.  Chances are one of those other people has already asked the question somewhere on the web, and with a little luck someone else has already posted the answer.
  • Don’t get involved in political struggles between teams and don’t play the blame game.  Be unerringly pleasent in contentious situations, and if someone agrees to something in a meeting follow up with and email or some kind of documentation.
  • Prototype and iterate, people tend to use vague terminology and don’t always want exactly what they think they want.

So, if you’re going to end up implementing shopping carts or interfaces between large internal systems most of your career, why bother with brain teasers and algorithm interview questions?  Does this mean all that fancy book learning should be thrown out the window?

No!  Of course not!  If you do, when a really juicey problem does come along you’ll choke like me.

I’ve come to the conclusion that I need to make a concerted effort to look for problems that are difficult not because I don’t have enough time to do them, or because the two teams involved hate each other, or because the business analyst said “X is always Y” when he meant X is usually Y.  My guess is I’ll be hit with some soon at work.

In the mean time, got any good logic puzzles?  Textbook problems?  Favorite websites?  Feel free to post them in the comments below to get me started.

Creating a Favicon

My site's favicon, blown up to ridiculous proportions Nelson reminded me today that I didn’t have a favicon for this site. I took a few moments and created the amazing little pencil that’s sitting in the address bar above.

For all the non-techies and new webmasters out there who have stumbled across this page, a favicon is the little icon that show up next to a web site’s URL and next to the page’s title in your bookmarks. They’re very small (16 by 16 pixels) but they can add a dash of branding to your site and are a helpful visual signal for bookmark navigation, increasing the information scent.

Want to create your own favicon? You can draw one pixel-by-pixel at this site, but I’d recommend busting out Photoshop and creating one yourself. Try to pick initials, a logo, or an object that can be expressed very simply – I used an apple for Mealographer, for example. You can go as simple as a couple of squares that fit your site’s color scheme and still create a memorable association for your users.

Modern browsers like Firefox allow you to use .gif and .png files directly, with some code like this:

<link rel="shortcut icon" type="image/png href="http://www.jasonmorrison.net/favicon.png" />

That means you can have an animated favicon… just make sure you’re doing it for some useful or artistic purpose, otherwise you will annoy your users.

From what I’ve heard Internet Explorer still has some issues, so you may want to use the older .ico format. This site will convert the image for you.

<link rel="shortcut icon" type="image/ico" href="http://www.jasonmorrison.net/favicon.ico" />

If you want to get really crazy, you can use Javascript to dynamically alter the favicon, which is great if you want to play Defender on the smallest display ever.

Problem with WordPress 2.6 upgrade – 404 errors

Just a quick note – if you’re about to install the WordPress 2.6 upgrade, make sure you don’t just check your homepage and then call it a night. On a site I help manage for some friends I ran into a huge bug – the upgrade went smoothly, the homepage looked fine, but all the posts returned 404 errors.

It’s apparently very common if you are using “index.php” in your URL structure, which many sites use because IIS doesn’t have an equivalent of Apache’s mod_rewrite or because their host doesn’t allow mod_rewrite for some reason.

The solution can be found in this thread on the WordPress support forums. Basically the solution is to get the latest copy of rewrite.php and copy over the version for 2.6. Here’s another post with a technique for category and tag pages.

There’s a lot to like about WordPress… the open-source codebase, the templating system, the extensible plugin architecture. But I’m starting to feel like I’m squeezed between a rock and a hard place – delay an upgrade and you run the risk of getting hacked; go forward with an upgrade and you run the risk of throwing 404s for your entire site.