Tuesday, January 20, 2009

I pity the fool!

I pity the fool... who allows users to control text output via a URL.

Nice going TV Guide!

On Not Getting It

On Slashdot today I read a post entitled "Do Nice Engineers Finish Last?" which had the best first post ever. Which then got better.

First post:
Do Nice Engineers Finish Last In Tough Times?
Why, just the other day, a coworker was in contention for a promotion that was going to a younger engineer. My coworker found the specs to the younger engineer's car online and determined the precise rate it would have to leak coolant to completely drain the reserve tank precisely when he was leaving home to make an important customer meeting the next morning. I saw him on a crawl board attaching the regulator and a valve system in the parking lot and sure enough it overheated at precisely the right time so our customer just sat their waiting.

It's a calculate-or-be-calculated world out there!
Response:
Aside from the fact that your post is a load of horseshit, I suppose that you didn't step up to the plate by telling management what you witnessed.

And, incidentally, once the youngster took his car to the shop to be repaired, the tampering would have been discovered, and your fictional coworker would have been thrown in jail (hmm just where did this after market valve and regulator come from anyway?). In most states tampering with an automobile is a felony.
I think this might have spiked the parent poster's conscience, because he replied:
Alright alright, I need to come clean ... I embellished on this story a little bit. Here's the truth:

I was going to tell my boss but when I walked in, the coworker I was ratting out was on his knees with a mouthful of my boss and I think he said, "Oh hai!" I didn't stick around to clarify, I just left.

And it wasn't a car, it was a hovercraft. And it wasn't a regulator & valve, it was a detonator & C4. And he wasn't late for a meeting, he died. And don't worry about the law, Virginia isn't a state it's a commonwealth.

I feel almost relieved to get that off my chest and to come clean with you. I think I answered all your questions truthfully and fairly. Hopefully, together you and I can keep the internet a sound unbiased source of nothing but the unadulterated truth and historic account of everything.

You've helped me help myself. I love you.

Monday, January 19, 2009

Stupid bash tricks

The following is a very stupid bash command to run.

:(){:|:};:

This is a fork bomb, so don't run it without having set process limits.

I was trying to understand how this worked, and I found the following blog that set me straight. What was tricking me was the colon... it didn't look like it should be valid but it is. Who knew? Well, certainly not me.

The site I note above helpfully suggests changing the colon to "bomb", which gives us:

bomb() {
bomb | bomb
}; bomb

Stupid slashdot tricks

Well, only one. It looks like the Slashdot crew are bigger fans of Futurama than I realised!

I got this from a slashdot sig.

chris@ubuntu:~$ echo -e "HEAD / HTTP/1.1\nHost: slashdot.org\n\n" | netcat slashdot.org 80
HTTP/1.1 200 OK
Date: Mon, 19 Jan 2009 12:23:53 GMT
Server: Apache/1.3.41 (Unix) mod_perl/1.31-rc4
SLASH_LOG_DATA: shtml
X-Powered-By: Slash 2.005001237
X-Bender: Farewell, big blue ball of idiots!
Cache-Control: private
Pragma: private
Connection: close
Content-Type: text/html; charset=iso-8859-1

chris@ubuntu:~$ echo -e "HEAD / HTTP/1.1\nHost: slashdot.org\n\n" | netcat slashdot.org 80
HTTP/1.1 200 OK
Date: Mon, 19 Jan 2009 12:24:02 GMT
Server: Apache/1.3.41 (Unix) mod_perl/1.31-rc4
SLASH_LOG_DATA: shtml
X-Powered-By: Slash 2.005001237
X-Fry: People said I was dumb but I proved them!
Cache-Control: private
Pragma: private
Connection: close
Content-Type: text/html; charset=iso-8859-1

chris@ubuntu:~$ echo -e "HEAD / HTTP/1.1\nHost: slashdot.org\n\n" | netcat slashdot.org 80
HTTP/1.1 200 OK
Date: Mon, 19 Jan 2009 12:24:07 GMT
Server: Apache/1.3.41 (Unix) mod_perl/1.31-rc4
SLASH_LOG_DATA: shtml
X-Powered-By: Slash 2.005001237
X-Leela: There's a political debate on. Quick, change the channel!
Cache-Control: private
Pragma: private
Connection: close
Content-Type: text/html; charset=iso-8859-1

chris@ubuntu:~$ echo -e "HEAD / HTTP/1.1\nHost: slashdot.org\n\n" | netcat slashdot.org 80
HTTP/1.1 200 OK
Date: Mon, 19 Jan 2009 12:24:11 GMT
Server: Apache/1.3.41 (Unix) mod_perl/1.31-rc4
SLASH_LOG_DATA: shtml
X-Powered-By: Slash 2.005001237
X-Fry: Stop abducting me!
Cache-Control: private
Pragma: private
Connection: close
Content-Type: text/html; charset=iso-8859-1

chris@ubuntu:~$

Tuesday, January 13, 2009

Dvorak and the nefarious "idle process"

While most people know that John Charles Dvorak once famously said that "the Macintosh uses an experimental pointing device called a ‘mouse’. There is no evidence that people want to use these things. I don't want one of these new fangled devices", they might not also know that he said the following in PC World about the Windows XP idle process:

This week's column is about exploring the commonly observed problems that crop up with each new release [of Windows]. Maybe Microsoft should patch the patches once in a while.

Here are a few of my gripes – most of them a result of excessive patching


IDLE-TIME PROCESS. Once in a while the system will go into an idle mode, requiring from five minutes to half an hour to unwind. It's weird, and I almost always have to reboot. When I hit Ctrl-Alt-Delete, I see that the System Idle Process is hogging all the resources and chewing up 95 percent of the processor's cycles. Doing what? Doing nothing? Once in a while, after you've clicked all over the screen trying to get the system to do something other than idle, all your clicks suddenly ignite and the screen goes crazy with activity. This is not right.

Saturday, January 10, 2009

Reply-all storms

Ah yes, the old reply-all storm. Never good, but even worse when it takes out U.S. diplomatic mail servers!

According to this report on Associated Press:

Officials said the storm started when some diplomats used the 'reply all' function to respond to a blank e-mail sent recently to many people on the department's global address list.

Most demanded to be removed from the list while others used 'reply all' to tell their co-workers, in often less than diplomatic language, to stop responding to the entire group, the officials said.

Some then compounded the problem by trying to recall their initial replies, which generated another round of messages to the group, they said.

The best email storm I've heard of though, is the one involving journalists who were accidentally sent a mass email from the Casey Journalism Center at the University of Maryland inviting them to their "Casey Medals" Awards.

According to Editor and Publisher the email snafu caused some interesting effects:
The back-and-forth sparked a circle of never-ending responses that, in some cases, kept hundreds of e-mails filling electronic mailboxes over several hours on Tuesday and Wednesday morning. But, in an unexpected surprise, it also brought many journalists in touch with old colleagues, while forging a number of new industry connections through something of an online cocktail party.

"People started chit-chatting back and forth and inviting themselves to the awards," said Kim Platicha, editor and publisher of Parentwise Austin magazine in Austin, Texas. "It really evolved from there, it was hysterical. I have already started an e-mail conversation with a couple of folks."

Saturday, January 3, 2009

What killed the Zune30?

So we've been hearing a lot about Microsoft Zune 30s crashing. Microsoft have now said that it was a leap year bug.

And indeed it is! From Pastie (start at line 249):

//------------------------------------------------------------------
//
// Function: ConvertDays
//
// Local helper function that split total days since Jan 1, ORIGINYEAR into
// year, month and day
//
// Parameters:
//
// Returns:
// Returns TRUE if successful, otherwise returns FALSE.
//
//------------------------------------------------------------------
BOOL ConvertDays(UINT32 days, SYSTEMTIME* lpTime)
{
int dayofweek, month, year;
UINT8 *month_tab;

//Calculate current day of the week
dayofweek = GetDayOfWeek(days);

year = ORIGINYEAR;

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


// Determine whether it is a leap year
month_tab = (UINT8 *)((IsLeapYear(year))? monthtable_leap : monthtable);

for (month=0; month<12;>wDay = days;
lpTime->wDayOfWeek = dayofweek;
lpTime->wMonth = month;
lpTime->wYear = year;

return TRUE;
}


Why is this bad? Well, 2008 was a leap year that has 366 days. Let's step through the lines of code that caused the problem.

//Calculate current day of the week
dayofweek = GetDayOfWeek(366);

year = 2008;

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

As you can see, the while loop condition becomes true - yes, the day is day 366 and that's greater than 365. And yes, 2008 is a leap year. But as you can see, 366 will never be greater than... 366.

Therefore, the loop condition never evaluates to false, hence an infinite loop. Thus your Zune will crash.

Guess Freescale, the makers of the Zune's processor (the MC13783), had a programmer who didn't understand about boundary conditions.

Update: Another blogger has now gone and suggested a few bug fixes for the Zune issue. Nice going :-)