Blog

All Posts (92)

The Facebook Like Bug

I'll be honest - there are certain kinds of debugging that stress me out - such as when the bug is intermittent. One example is a bug that I've been looking at for the past day and a half: for quite a while, our users have been finding that Facebook Like buttons aren't working on their sites. They click Like and the popup appears for a second before disappearing. And it doesn't happen all of the time.

Well, we finally carved out some time this week to take a look at the issue. And yes, I could reproduce it yesterday. So I did my tried and true method of "deconstruction", in which I keep taking things away from the page until the problem stops. Well, I whittled the page down to just the Facebook Like snippet and it was still happening. So it was something to do with the URL we were giving to the Like button.

And then I couldn't reproduce it anymore.

Anyway, I was able to reproduce it again today. I put a bunch of Like buttons on a page: some that worked, some that didn't. And I eventually got it so that the only difference was that the Like buttons that didn't work had URLs that redirected to another URL.

By the way, throughout this saga, I was trawling the Facebook Bug Database and Stack Overflow for a silver bullet - someone who fixed the problem and here are the steps. I couldn't find any silver bullet, but it was still valuable because I heard mention of the Facebook Debugger, which sometimes fixes things when you put a URL through it because it clears Facebook's cache.

I tried putting my URL into Facebook's Debugger but it didn't fix my Like button. But I took a second look at the debugger results, and 'lo, there were some warnings about missing OpenGraph tags. I browsed around a bit and found that three of those tags are required (og:type, og:url, and og:title). So I put those tags on my page and...

yes...

the problem was fixed! Yay!

Read more…

What's on your dock?

Tell me what's on your Mac OSX dock. These are the apps that you value the most.

Here's what's on my dock right now:

  • Finder
  • PostBox
  • Calendar
  • Adium
  • Notational Velocity
  • jEdit
  • iTerm2
  • Safari
  • Firefox
  • 1Password
  • Network Connect
  • Colors
  • Clock Chimes
  • iTunes
  • App Store
  • System Preferences
  • Microsoft Excel
Read more…

Useful Git tool: tig

Here's a great article describing a useful Git tool called tig.

One thing it doesn't mention is that you can actually press comma (,) when doing a tig blame, to do a blame on the parent commit. This is useful if the blame on the current commit isn't showing who really changed the line. You can do blame on the line all the way up the parent tree.

Other tig tips:

  • Use this to browse the tree of another branch: tig origin/rel-1.5.
  • If while browsing the commits on another branch you press Shift+C on a commit, it will cherry-pick it into your current branch.
Read more…

Design email newsletter for programmers

Here's a great weekly email newsletter about design for programmers: Hack Design.

I was reading one of the newsletter articles today, called Making the Transition from Development to Design. It had some good quotes, such as these ones:

I think the future designer is going to look and act a lot more like a design technologist.

Avoid pixel-pushing at all costs – your job is to solve problems.

Our ideas should be bigger than reality, but our execution should be married to it.

Read more…

Today's bug hunt

Today I worked on finding and fixing a bug that is difficult to reproduce. In fact, I couldn't reproduce it. So I had to look at the code and reason where the bug could possibly be located. From the error message in the bug report, I narrowed it down to a particular JavaScript file. And it sort of looked impossible that the bug could ever occur. Basically, the error message said that a variable was undefined, but we were clearly defining the variable before we were using it.

Or were we? It turns out that one of the places that used the variable was in a public method. So after thinking about it for a bit, it dawned on me that this method could be called before the object finished getting fully initialized. To prevent this, we always make sure to put all JavaScript that must run on page load in an "addOnRequire" callback. Anyway, the team that wrote this code doesn't work on this product much so they didn't do that.

So I thought about emailing the team to make them aware that they should use addOnRequire(). But then, they are not currently working on the product, and might not be for weeks or months, so how would they remember? So then I thought, I'll write a test that scans the JavaScript files to catch this pattern. Since our tests run frequently, we'll catch this problem any time it arises in the future. Cool!

Read more…

An unobtrusive break reminder, for Mac

I was having trouble finding something to remind me to take an exercise break every hour or two. A lot of the break timers out there dim the screen and force you to press a button if you want to postpone it. This is problematic for programmers like me - you get into the "flow", and interruptions like that break your concentration, which is Not Good.

It turns out that it's not terribly hard to create your own (unobtrusive) break timer. Here's one that simply shows a Growl notification and makes a sound every hour, on a Mac with growlnotify installed:

breaktimer.sh

#!/bin/bash
while true
do
growlnotify -m "Take a break"
afplay /System/Library/Sounds/Blow.aiff
sleep 3600
done
Read more…

On the importance of leisure

Likewise, your question refers to the classical notion of leisure, to the question, as I like to ask it: “What do we ‘do’ when all else is done?” As Pieper pointed out in his famous book, the Greek word for leisure, skole, is the origin of our word for school. The denial of leisure becomes the classical word for “business,” both in Greek and Latin. Thus, the time we devote to keeping alive, to making a living, while necessary and important, is not primarily time “for its own sake.” This latter time is the time beyond business. It is in this latter time that we should be “free” to think of the highest things. Not to have such time is to be a kind of slave to this world.

From an Interview with Fr. James V. Schall, S. J.

Read more…

Soy Sauce Puzzle

So this is something that happened to me a few days ago, and it makes for a nice puzzle.

My wife asked me to pour soy sauce and vinegar into two saucers, equal parts (1:1 ratio).

I poured the vinegar into each saucer. But then I poured twice as much soy sauce as was needed into the first saucer.

Question: How do you fix this easily?

My wife solved it without thinking.

Read more…

Using Ning for my blog

A while ago, Gina (Ning CEO) asked me to consider switching my blog from Blogger to Ning. Well, it's a number of years later and here I am trying it out. Ning sites are really complete social networks, so I am just using a fraction of what it can do. Anyway, I work for Ning, so it is good to finally be using the product I am building. 

Read more…

Did you know?

I'm a software engineering consultant. This means I can help your company with your software engineering needs:

  • providing temporary manpower for short-staffed software projects

  • helping new software projects get off to a good architectural start

  • improving the performance and reliability of old, legacy software systems

  • doing an important investigation or small project that you've always wanted to do but haven't had time for

Since 1999, I have done software engineering projects for the Canadian government, for Silicon Valley startups, and for established Bay Area companies, for small companies and medium-sized companies, for successful commercial projects and open-source projects. 

Currently accepting small projects. If you have one, email or call me.