Source Code That Allegedly Broke the Microsoft Zune

Thanks to Lawrence, Ryan, JSTN.

while (days > 365) {
    if (IsLeapYear(year)) {
        if (days > 366) {
            days -= 366;
            year += 1;
    } else {
        days -= 365;
        year += 1;

For non-programmers out there, this is what we like to call in technical terms “an infinite loop”. This code block will never finish running because on Day 366, the loop keeps checking to see if the day is greater than 365 (it is), and then checks to see if it’s a Leap Year (it is), and then checks to see if it is greater than 366 (it isn’t). So it does nothing, and then starts all over.

Perfect way to lock up your Zune every four years on the last day of the leap year.

Not sure if this is the actual code snippet or not, but a fun exercise. I could actually see this being on an introduction to programming test at some point.

My favorite quote about this fiasco (from the San Jose Mercury News):

“I’ve never heard of a consumer electronic device fail en masse like this,” said Matt Rosoff, an analyst with Directions on Microsoft, a Seattle-based research firm that focuses on the software giant.

Does anyone doubt that “Microsoft Zune” has become the “Ford Pinto” of consumer electronics?

New Years Resolution: Avoid Medical Myths

This is a fun post going into 2009.   Freakonomics pointed to a great piece at the British Medical Journal (part 1 & part 2) which goes through a fairly large number of medical myths that are widely believed, but that we now know to be false.

No sense going into 2009 repeating these falsehoods.  Although, despite being armed with the truth, no doubt many of your friends and family members will insist to the bitter end that “they know these to be true.”  (I watched a debate on #1 go on for over fifteen minutes this weekend between two family members.  I stayed out of it.)

In no particular order:

  1. Sugar does not cause hyperactivity in children.  In fact, if anything, they have proven that if you tell parents that their kids have had sugar, they will believe that they are more hyperactive.
  2. Suicide rates are not higher over the holidays. At least, not in the United States.
  3. Poinsettias are not poisonous. Chomp all you want, you won’t be able to kill yourself this way.
  4. You do not lose most of your body heat through your head. It’s only about 10%.  Wearing a hat is not the key to being warm, although it might be the key to feeling like you are.  The wonders of placebo.
  5. Eating food late at night does not make you fat. This is one of those “logical” facts that no one bothered to check out… until they did.  And found out it wasn’t true.
  6. You do not need to drink eight (8) glasses of water a day. This one surprised me.  No evidence for this at all.
  7. We do not use only 10% of our brains. Total BS from the turn of the century (last turn, that is.)  We’ll have to come up with another excuse for why everyone isn’t brilliant.
  8. Shaving hair does not make it grow back darker and thicker. So many people swear this is true.
  9. Reading in low light does not ruin your eyes. Seems like good news for the last few Americans who read.
  10. Eating turkey does not make you sleepy. Or at least, any sleepier than any other meat.  Yes, I know this gave everyone an excuse to know what tryptophan is (or at least, pretend like they do.)

Please do not take this post as some sort of challenge to pick fights with the less enlightened out there.  Believe me, they outnumber you greatly.

Instead, feel good knowing that your knowledgebase is that much cleaner now that you’ve cleaned out some of the garbage before 2009.