TheDrunkenEpic - Drunken Ramblings of a Code Monkey
Filed under

The Funny

 

Shenanigans!!1

Came in to work today and found these assholes making a fucking mess of my desk.

Tsk, tsk, tsk.

Loading mentions Retweet
Filed under  //   General Nonsense   The Funny  

Comments [0]

Pedobear SIGHTED!!!

ZOMG Pedobear!!! The hunter has become the hunted! Lucky for me, I'm a bit too old for his tastes.

Bought 2 of these puppies from DesuToys. Check'em out! I'm hoping they make a Longcat soon.

Loading mentions Retweet
Filed under  //   General Nonsense   The Funny  

Comments [0]

Words To Live By, With A Visual Aide ...

I forget who the source of the following quote is as it was a pretty long time ago when I first heard it, but someone posted it in a Digg comment earlier today. I thought I'd go ahead and share it to spread the wealth:

"Morality is doing what's right, despite what you are told. Religion is doing what you're told, despite what is right."

Upon reading it, I chuckled as it reminded me of the following comic:

image source

I'm an atheist, but I like to think that if there was a god, he'd be more like the one in the strip. What say you?

Loading mentions Retweet
Filed under  //   General Nonsense   The Funny  

Comments [0]

The cause of Z2k ...

No doubt by now some of you have heard of the Z2K bug that's been affecting all 1st generation Zune 30 models the day before the new year; mine being one of them. Apparently, and the Microsoft Zune guys confirm this, there was a bug in the driver that controls the real time clock on that specific model. The problem was with how the Zune's firmware handled resetting it's internal clock for the last day of a leap year.

Bloops!

If anyone has this model of the Zune, what they saw when they tried using it was a hanging boot screen with a full progress bar.

Word from Microsoft was that the counter would reset itself exactly 24 hours after the day our Zune's failed. The fix was, basically, to do nothing but wait a day without our Zunes. Well, that day has come and gone and I can gladly say that mine is back up and running like a champ.

I was curious as to what the exact problem was with the firmware and why it would go tits up while doing something as mundane as a simple date check. Well, I wasn't the only curious coder as someone managed to post the offending source file on the internets.

Mulling about the code snippet we can traverse the library's path of execution to figure out where it all went wrong. At some point during the boot process, the kernel calls the OEMGetRealTime() function to grab the current date. This function invokes a helper function declared as GetTime() which calculates the time and day from a provided timestamp.

Everything seems fine until it calls yet another helper function named ConvertDays() which calculates the current day number of the provided year. Taking a very close look at this function reveals the problem. Here is the offending bit of code at around line 259:

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

This loop was written to execute only on the last day of the year. If we iterate through the days of a year using code, chances are we're using some sort of incrementor. So, by the time we hit 366 days, we know we're pretty close to the end of, at least, a standard year. But, what about leap years? 2008 was a leap year because it's divisible by 4. So, this means that 2008 had 366 days. If this is the case, our incrementor will stop at 367.

We can see the check for the leap year in line 3 of the code snippet above. What happens next is what killed the Zune. The code accounts for a day count of anything greater than 366, which would include 367. But, the zinger here is we're not checking if the day count IS EQUAL TO 366. Since we aren't resetting the day count to 1 and breaking the loop, the poor Zune is stuck in an infinite loop which causes the boot screen to hang.

What should have happened is something like the following:

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

If the day counter reaches 367, we now this is the first day after the new year following a leap year, January 1st, 2009. We can now exit the loop and continue booting.

Microsoft told us to wait 24 hours because then we wouldn't be in a leap year, bypassing the troublesome block of code completely. We shouldn't see this happen again for another 4 years!

Could this have been prevented? Well, of course it could have. Code review doesn't always catch all the problems because it's being reviewed by human eyes. We tend to miss things in the code, especially if we've been staring at 1,000's of lines of it all day. What could have prevented this is simple and thorough unit testing.

But, hey, I'm gonna give Microsoft a break. They've made a great product and after going through 5 5th generation iPods in ONE year, I decided it was time for a change. I picked up the white brick the week it was released and haven't had a single issue until 2 days ago. Not bad, guys, not bad at all.

Besides, how many times have we caused self-inflicted facepalm moments? 'Duh' moments like will happen to any software engineer.

One last thing before I go, you gotta hand it to the guys at Redmond, their code is quite pleasant to look at. I don't care what your coding standard is as long as you use it consistently and these guys got it juuuust the way I like it. Kudos 2 u!

Till next time!

Note: This article as been republished after being accidentally wiped from my hosting provider. Hurray for cached RSS feeds!

Also Note: This article has been partially updated to reflect a great suggestion from Nick Shepherd

Loading mentions Retweet
Filed under  //   Code Monkey   Development   General Nonsense   The Funny  

Comments [0]

People are dumb ...

As some of you might know, I currently live and work in Australia. It's been a huge change for me since I left Chicago about 2 months ago, but some things stay the same no matter where you go. People, for instance, never change. They have been and always will be completely retarded and self-important.

Case in point, this morning I was on the bus going to work. It's a pretty boring ride that lasts between 45 minutes to an hour every morning, so I try to amuse myself by watching people in traffic. Well, about 2 blocks from my current gig was a small red car trying to merge with a cross lane at an intersection. There was a guy driving a very pricey BMW directly behind this car. He wanted to pass and was impatiently honking his horn. The moment the red car budged, he hit the accelerator to take him over. Well, he put a little too much pressure on the peddle and slammed right into rear of the little red car.

What happened next? Did the guy in the BMW stop, get out, see if anyone got hurt and then assess the damage? Of course not! That would make too much sense. so instead of doing the right thing, he did the typical thing and attempted to speed off. You can guess what happened next, right? In his attempt to avoid accepting responsibility for his douche-baggery, he tried to escape by speeding off into the merging lane and ran right into another car.

What would have been a simple fender-bender and call to his insurance agency, now became that as well wreckless driving and attempted hit-and-run.

People are dumb.

Loading mentions Retweet
Filed under  //   General Nonsense   Rants and Raves   The Funny  

Comments [0]

Friday Feast #10

It's that special day of the week again ...

Appetizer

Q. When you drink soda/pop/coke, do you prefer to drink it from the bottle, a can, or after pouring it into a cup?
A. I don't like soda/pop/coke, but if I happen to drink it, it'll be in a cup... as a mixer.

Soup

Q. What television show are you willing to stay up late to watch?
A. Battlestar Galactica

Salad

Q. Name one person, place, or thing you think of as brilliant.
A. Me. I'm brilliant.

Main Course

Q. Would you be willing to work 4 10-hour days instead of 5 8-hour days in order to save gas?
A. I'd rather not work at all. Score one for me and the environment.

Dessert

Q. If you were a superhero, what would you call yourself?
A. The Man From Nantucket

Loading mentions Retweet
Filed under  //   Friday Feast   General Nonsense   The Funny  

Comments [0]

The $100 House & Essay Contest!

This is for a long-time buddy and colleague of mine who just recently got a kick ass job in Nashville, Tennessee. He currently lives in Idaho and has to move his entire family down to his new location. The guy has a house he's trying to sell before he heads out, but with the current housing market, he's having a very difficult time doing so. This somewhat dire situation has left him with little options to choose from. Thankfully, he's somewhat creative and came up with an ingenious idea!

"The $100 House & Essay Contest" is an event where if you send him $100 and a well-worded essay, you have a chance to win his house. The only real catch is before he picks a winner, he needs 2,500 submissions to cover the cost of his house. Once he receives the required amount of entries, he'll pick a winning essay and, in turn, a winner.

I think it's a very creative solution to a problem that's all too common in today's real estate market. Hats off to my buddy, James of onelotus creative fame, for being such a nutty genius!

You can read more about the contest here and Digg the entry here!

Good luck, Jim!

Loading mentions Retweet
Filed under  //   Distractions   General Nonsense   The Funny  

Comments [0]

Friday Feast #9

Haven't done one of these for close to 6 months now.

Appetizer

Q. On a scale of 1-10 (with 10 as highest), how much do you like your own handwriting?
A. 1. My own handwriting is friggin' terrible. Just ask anyone. It isn't because it's messy or anything, I just write tiny. Tiny to the point where you have to squint to see what I'm writing.

Soup

Q. Do you prefer baths or showers?
A. Definitely showers for washing, but baths for relaxing. Why the hell would you clean yourself in a tub of water? The filth stays in the tub and then sticks back on you when you get out. You can count me out of that one. Blech!

Salad

Q. What was the last bad movie you watched?
A. The Hills Have Eyes II on HBO. It's almost as if people don't even try anymore to make decent sequels. Then again, when was the last time a sequel was actually good?

Main Course

Q. Name something you are addicted to and describe how it affects your life.
A. Order. I have a small case of OCD where I simply cannot focus on work if I have to do it while my desk or personal space is messy. Everything has its own place and it MUST be there before I can start doing serious work.

Dessert

Q. Which instrument is your favorite to listen to?
A. Honestly? Please don't laugh. It's the Guqin. I'm friggin' German, born and raised and my favorite instrument is a 3000-year-old Chinese zither. It should be an accordion or something.

Loading mentions Retweet
Filed under  //   Friday Feast   General Nonsense   The Funny  

Comments [0]

My Site5 Server Needs 'Enhancement' Pills

Well, I'm not really known to have a subtle sense of humor, but I try my best to only use it among people who understand my concept of 'funny'. I think this is one of those moments where I just need share something I find hilarious.

I just got in to work at around 8:30 this morning and started getting settled in. Usually, my morning rounds consist of checking out Digg, Facebook, my favorite web comics, MSNBC, a few blogs I frequent. Well, since I've come out of hiding I've re-added my own sites to the list. So, I checked out TDE and Jaia and found that they were both down.

Now, this gets funny when you find out that my host, Site5, likes to give each and every one of their servers a fancy name. Usually some Greek or Roman diety / hero. My particular server is named Priapus.

Does that sound familiar? You might recognize the name from all those commercials that advertise Viagra or Cialis. The condition of priapism, anyone:

... a potentially harmful medical condition in which the erect penis does not return to its flaccid state (despite the absence of both physical and psychological stimulation) within about four hours ...

Now, I know my Greek and Roman mythos pretty well and realize that the word is derived from the Greek god, Priapus:

In Greek mythology, Priapus was a minor rustic fertility god, protector of livestock, fruit plants, gardens and male genitalia. His Roman equivalent was Mutinus Mutunus. He was best noted for his huge, permanently erect penis, which gave rise to the medical term priapism.

Ok, so now that we all know my server is named after a phallic god, am I the only one who finds it ironic that it's having trouble 'keeping itself up'?

Loading mentions Retweet
Filed under  //   General Nonsense   Rants and Raves   The Funny  

Comments [1]

Are You A Douche?

A buddy of mine from over at Young Go Getters threw this hilarious YouTube video my way last night. I have to say that this thing had me rolling every time I watched it, which was at least a dozen times.

If you've ever been in a high-class bar or martini / cocktail lounge in a college town or large city, you'll laugh too at how accurate this video is.

Enjoy! I know I did!

Loading mentions Retweet
Filed under  //   General Nonsense   The Funny   YooToob  

Comments [0]