Save Yourselves!

by Dan J. in CodeSOD on 2015-08-03

Scott K was cleaning up a configuration utility used by his team when he dredged up this sanity-threatening artifact:

void Save(string path)
{  
    XmlTextWriter write = null;  
    try
    {  
        write = new XmlTextWriter(path, null);
    }  
    catch (IOException)
    {  
        write.WriteEndDocument();  
        write.Close();  
        try
        {
            write = new XmlTextWriter(path, null);
        }  
        catch (IOException)
        {
            return;
        }
    }  
 // Write stuff to the file
}  

19 Comments - Last Comment @ 2015-08-03

No Color? No Problem!

by Mark Bowytz in Error'd on 2015-07-31

"Samsung's printer technology must really be something," writes Tim, "A black and white printer able to output a full color photo?! Who knew!"

106 Comments - Last Comment @ 12:23

If You Want To

by Remy Porter in Coded Smorgasbord on 2015-07-30

We pick on date handling code a lot here, simply because there are so many ways to mess up date related code (because dates are hard). In a way, it’s almost like we’re cheating. Even smart programmers could mess that up. What about basic conditional logic? How hard could that be to mess up?

Well Jan L. came across this solution to a simple boundary check- if telegramType is between 100 and 199, it is a payment type telegram.

100 Comments - Last Comment @ 09:11

You've Got My Number

by Jane Bailey in CodeSOD on 2015-07-28

Luftballons Hannover

Today's snippet needs very little introduction. In the words of the submitter:

[My predecessor] is what I would consider, among the worst programmers in the world. While his programs actually do work and do what they should, his techniques and programming decisions are very questionable. The [below] code snippet is from a program he wrote after he spend about a year at this company.

63 Comments - Last Comment @ 2015-08-03

What is this 'Right Click' You Speak Of?

by Mark Bowytz in Error'd on 2015-07-24

"What makes this worse is that this wasn't an edge case," wrote Roger, "I only right-clicked in the body of an email."

0 Comments - Last Comment @ 11:47
View Article Archives »