Fun with probability

This graph shows the probability that there is...

Photo credit: Wikipedia

At Union Street Media, we have a support ticketing system that uses ticket IDs of the form ABC-123456. That gives a total range of 17,576,000,000 possible ticket values, roughly (I’m sure they removed some dirty words from the three-letter combo). Today, we had a ticket ID collision (where a new ticket has the same ID as an old one) and I thought, “wow, what are the odds of that happening?” Well, it struck a chord in me so I decided I’d figure out exactly what the odds were!

Essentially, this is the birthday problem on a much bigger scale. We have about 26,000 tickets in our system. Here’s the math:

\left ( \frac{17576000000 - 1}{17576000000} \right )^{26000\times (26000-1)/2} \approx 0.019

The result? At 26,000 tickets, there’s about 2% chance of a collision. Those odds may be low, but they are considerably higher than I was expecting!

The take-away here is that as a software developer, you need to know that you can’t depend on variability to prevent collision. Kayako should have been checking to see if a ticket ID exists in the database before assigning it to a new ticket*. I’m sure there are people using their software who have many more tickets in their system than we do. At 157,000 tickets, there’s a greater chance of having a collision than not having a collision.

*To be fair, we’re using an old version of Kayako’s software. I would expect that they’ve since fixed this bug.

Update: Here’s a great article about the birthday paradox in the NY Times

Stack Exchange, or “How to master a topic overnight”

The brain

Image via Wikipedia

I’ve been spending a lot of time on WordPress Stack Exchange lately and I’ve really fallen in love with it. I’ve always been a moocher of Q&A sites (always the Q and never the A) and decided it was time to give back. I also wanted to give back to the WordPress ecosystem (and along these lines, I have a few “game-changing” WordPress plugins I’ll be releasing soon as well), so I started with their forums, which are terrible — lousy organization, no “preview”, lack of alerts, etc. I then moved over to StackOverflow and then onto it’s WordPress sister site.

While my intentions going into this were selfless, I’ve found a tremendously selfish reason to continue contributing to Q&A sites like this: you learn fast. Continue reading

Apple’s new iTunes U: A critical review

English: Apple iPad Event

Image via Wikipedia

First off, a round of applause for Apple. This is a wonderful push and the world can be better from it. As you’ve shown us time and again in many industries, an idea is only so good — it’s the implementation that determines if it succeeds or not. With the initial implementation of iTunes U, I give you a B-. Call it a beta and I’d be more forgiving, perhaps, but it’s uncharacteristically unpolished for an Apple product. I’d expect this as a first release from Google1, but not you. Here’s a breakdown of what I like and what needs improvement.
Continue reading