Humor

There are 2 articles in this category.

Something funny I encountered today

Posted on 2008-04-03 22:18:00

Today, while improving the error handling of an application at work, I came upon a rather interesting piece of (C#) code. The application is a Windows service used for scheduling “plugins” that process documents or generate them and whatnot. Anyway, if a fatal error has occurred during the execution of a plugin, the following bit of code is executed after logging the event to a text file:

// dt = timestamp of error
// id = origin of the error
// text = error message
// Always send email in following case
if (type == SchedulerInfoType.FatalError)
{
  Mailer mailer = new Mailer();
  try
  {
    mailer.SendEmail(ConfigurationSettings.AppSettings["BugEmailAddress"],
      "scheduler@xxxxxx.xxx",
      "A fatal error has occurred " + dt.ToString(),
      String.Format(dt.ToString() + "-" + type.ToString() +
        "-" + id + "-" + text ),
      MailFormat.Html,
      MailPriority.Normal );
  }
  catch(Exception ex)
  {
    mailer.SendEmail(ConfigurationSettings.AppSettings["BugEmailAddress"],
      "scheduler@xxxxxx.xxx",
      "An error occurred while sending the error email " + dt.ToString(),
      String.Format(dt.ToString() + "-" + id + "-" + text + "\r\n") + 
      String.Format(ex.Message)
      , MailFormat.Html,
      MailPriority.Normal);
  }
}

Also note that the use of String.Format is rather superfluous in this case as there’s nothing to format…

Posted in: Humor, Work

Hardware vs. software: same difference

Posted on 2008-01-15 21:25:30

Yesterday, one of my colleagues arrived at work and immediately noticed something wrong: his phone had stopped working. The irony starts here: “Who do I call to get my phone fixed?”

Anyway, a couple of hours later a guy from the “hardware” department shows up and goes through the standard checks: plug another phone to the same cord, check if it works, check the phone on another outlet, etc. After a while he determines that the cable running from the phone to the outlet (in the floor) is bust and needs to be replaced.

Now, those phone cables are bundled with the computer’s ethernet cable and power cord to keep it all neat and tidy and prevent a wire mess. The disadvantage of this is that it’s potentially difficult to replace one of those cables.

Anyway, the repair guy returned with a new cable, and installs it: he has to tug hard to get the old cable out, and plugs in the new one. After checking that the phone works, he packs up his stuff and leaves.

The affected colleague was getting some coffee while this all took place, so when he returned, the first thing he saw: “hey, they fixed my phone!”. And the second thing he saw: “hey, they broke my internet!” Second irony: “who do I email to get my internet fixed?”

What happened? While replacing the phone cable, the guy had pulled the ethernet cable apart. And in such a way that the “head” you put in the ethernet “hole” was still in there, with only some loose wires sticking out of it. An hour later, the same guy showed up again to replace the ethernet cable. Let’s hope he didn’t break anything else.

Makes me think a lot of the software development process: you fix one bug, and inadvertently create another in a different place…

Posted in: Humor, Work