Colophony

by in Error'd on

Just a quick note this week: I discovered that many people have been sending in submissions for this column and designating them for CodeSod by mistakes. Consequently, there is an immense backlog of material from which to choose. An abundance of riches! We will be seeing some older items in the future. For today, a collection of colons:

Bill NoLastName , giving away clues to his banking security questions online: "If had known there was a limit, I would have changed my daughter's middle name. I've been caught by this before - my dad has only a middle initial (no middle name)."


Using the Old Bean

by in CodeSOD on

If you write a lot of Java, you're going to end up writing a lot of getters and setters. Without debating the merits of loads of getters and setters versus bare properties, ideally, getters and setters are the easiest code to write. Many IDEs will just generate them for you! How can you screw up getters and setters?

Well, Dave found someone who could.


Stop Being So ####

by in CodeSOD on

Many a network admin has turned to the siren song of Perl to help them automate managing their networks. Frank's predecessor is no exception.

They also got a bit combative about people critiquing their Perl code:


A Second Date

by in CodeSOD on

Ah, bad date handling. We've all seen it. We all know it. So when Lorenzo sent us this C# function, we almost ignored it:

private string GetTimeStamp(DateTime param)
{
    string retDate = param.Year.ToString() + "-";
    if (param.Month < 10)
        retDate = retDate + "0" + param.Month.ToString() + "-";
    else
        retDate = retDate + param.Month.ToString() + "-";

    if (param.Day < 10)
        retDate = retDate + "0" + param.Day.ToString() + " ";
    else
        retDate = retDate + param.Day.ToString() + " ";

    if (param.Hour < 10)
        retDate = retDate + "0" + param.Hour.ToString() + ":";
    else
        retDate = retDate + param.Hour.ToString() + ":";

    if (param.Minute < 10)
        retDate = retDate + "0" + param.Minute.ToString() + ":";
    else
        retDate = retDate + param.Minute.ToString() + ":";

    if (param.Second < 10)
        retDate = retDate + "0" + param.Second.ToString() + ".";
    else
        retDate = retDate + param.Second.ToString() + ".";

    if (param.Millisecond < 10)
        retDate = retDate + "0" + param.Millisecond.ToString();
    else
        retDate = retDate + param.Millisecond.ToString();

    return retDate;
}

The Firefox Fix

by in CodeSOD on

Yitzchak was going through some old web code, and found some still in-use JavaScript to handle compatibility issues with older Firefox versions.

if ($.browser.mozilla &&
    $.browser.version.slice(0, 1) == '1')
{
    …
}

Squaring the Circle

by in Error'd on

Time Lord Jason H. has lost control of his calendar. "This is from my credit card company. A major company you have definitely heard of and depending upon the size of the area you live in, they may even have a bank branch near you. I've reloaded the page and clicked the sort button multiple times to order the rows by date in both ascending and descending order. It always ends up the same. May 17th and 18th happened twice, but not in the expected order." I must say that it is more fun when we know who they are.


Gridding My Teeth

by in CodeSOD on

Dan's co-workers like passing around TDWTF stories, mostly because seeing code worse than what they're writing makes them feel less bad about how often they end up hacking things together.

One day, a co-worker told Dan: "Hey, I think I found something for that website with the bad code stories!"


Credit Card Sins

by in Feature Articles on

Our anonymous submitter, whom we'll call Carmen, embarked on her IT career with an up-and-coming firm that developed and managed eCommerce websites for their clients. After her new boss Russell walked her around the small office and introduced her to a handful of coworkers, he led her back to his desk to discuss her first project. Carmen brought her laptop along and sat down across from Russell, poised to take notes.

Russell explained that their newest client, Sharon, taught CPR classes. She wanted her customers to be able to pay and sign up for classes online. She also wanted the ability to charge customers a fee in case they cancelled on her.


Archives