I’ve got an interesting (read: geeky) story to share, but first a quick status update. We’re both in Chicago for the next two-week working session, and the excitement level’s as high as it’s ever been, save for maybe the first work session where we’d code every night til 6am. This time we’re still working long hours but the schedule’s flipped around, so we’re up at 6 each morning instead. It’s been a great change - we’re still getting lots of work done while staying a lot healthier. Much of our excitement comes from the fact that we’re close to sharing a private Beta out to a large set of people. As anyone who’s ever shipped software (or anything, for that matter) can tell you, when you get close to a ship date, everything seems to conspire against you to delay things as much as possible. And so it is, our todo lists are growing each day. What’s a sample task? "Prepare for feedback: grow a thick skin."
<geek-out begins>
Onto the geek-out story. Our project focuses on certain content and includes phone numbers. We found a problem in the phone numbers database table where there were tons (figuratively, not literally a multiple of 2000lbs) of duplicate phone numbers, all of them "2147483647".  There were over 20,000 phone numbers in the table and over 2/3rds of them were all this mysterious phone number. Who was this mysterious, popular person? We had no idea - our problem was that all the numbers we were putting into the database were all unique, but somehow most of them were being transformed. Perplexed, we approached the problem like any other high-functioning partnership - we started blaming each other. :)  Â
We pored over every line of our Ruby on Rails code that handled the phone numbers, and set breakpoints at every stage of our data processing, but to no avail - the numbers seemed perfect right up til they were stored in the db, but were transformed once we pulled them back out. After an hour of frustration, we randomly googled for "2147483647" and discovered it was a Mersenne Prime, which is a prime number that is one less than a power of 2. Aha! The problem was that we were stripping all the formatting from our phone number strings and storing the resulting 10-digit value in the database in an INT type column. It just so happens that the 10-digit number 2,147,483,647 is 2^31 - 1 or 0×7FFFFFFF, the maximum signed integer value for any INT column. So, every phone number whose digits were less than that value stored fine, and all phone numbers above it were stored as this max integer value, and the fix was simply to change the type to a STRING type instead. As you’d expect, we were kicking ourselves (and each other) after discovering this. Who knew such a little type declaration could cause such a headache? I thought I’d gotten away from these problems forever when I switched out of a developer role at MS! My ex-coworkers reading this are probably shaking their heads in shame.
</geek-out ends>
-JL
Powered by Qumana




on Jul 22nd, 2006 at 4:05 pm
good ol programming errors. i always felt dumb in my easy programming classes when it was a declaration error or something like that =P
on Jul 25th, 2006 at 1:44 am
Hahahah! John, you’re an idiot!
on Jul 25th, 2006 at 1:50 am
Dang it, Cashto I knew you’d read this and make some snide comment.
on Jul 25th, 2006 at 3:06 am
Yes, I’m positive I was one of those ex-coworkers you had in mind, shaking their heads in shame.
(In case it wasn’t obvious, I in fact have lots o’ respect for you, I know how these mistakes happen even for the best devs. It’s still a pretty fucking hilarious bug though).