Click here to Skip to main content
15,895,142 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralRe: 558 Lines Of QuickBasic Glory Pin
Gordon Kushner27-Aug-10 2:12
Gordon Kushner27-Aug-10 2:12 
GeneralRe: 558 Lines Of QuickBasic Glory Pin
AspDotNetDev27-Aug-10 13:33
protectorAspDotNetDev27-Aug-10 13:33 
GeneralRe: 558 Lines Of QuickBasic Glory Pin
oggenok6426-Aug-10 22:24
oggenok6426-Aug-10 22:24 
GeneralRe: 558 Lines Of QuickBasic Glory Pin
leppie27-Aug-10 11:19
leppie27-Aug-10 11:19 
GeneralRe: 558 Lines Of QuickBasic Glory Pin
AspDotNetDev27-Aug-10 11:49
protectorAspDotNetDev27-Aug-10 11:49 
GeneralRe: 558 Lines Of QuickBasic Glory Pin
robertosalazar31-Aug-10 6:34
robertosalazar31-Aug-10 6:34 
GeneralRe: 558 Lines Of QuickBasic Glory Pin
AspDotNetDev31-Aug-10 8:17
protectorAspDotNetDev31-Aug-10 8:17 
GeneralYou're already late Pin
Fernando Padoan25-Aug-10 17:11
Fernando Padoan25-Aug-10 17:11 
Last week, I was asked to change an old tasks report, adding a parameter for the completion status of a task. As it was my first task on this feature, I have been advised by the project's analyst that the report was showing only the overdue tasks.
As I moved to find and change the hardcoded status to the one selected on the UI, I've seen a call to a static method Status TaskStatus.GetEnum(), which would translate the selected option to the corresponding value from a Status enum (ok, I know, it sounds obvious). Actually, it was already being applied to the report, but the query was ignoring the status parameter anyway.

Then I decided to look into that method, and found this:
public class TaskStatus
{
    public enum Status
    {
        OVERDUE,
        CLOSED,
        ON_TIME
    }
    public static Status GetEnum(string name)
    {
        switch (name)
        {
            case "":
                return Status.OVERDUE;
            default:
                return Status.OVERDUE;
        }
    }
}


Update: added some context.

modified on Thursday, August 26, 2010 11:38 PM

JokeRe: You're already late Pin
Philip.F25-Aug-10 20:37
Philip.F25-Aug-10 20:37 
GeneralRe: You're already late Pin
Richard A. Dalton26-Aug-10 0:21
Richard A. Dalton26-Aug-10 0:21 
JokeRe: You're already late Pin
Fernando Padoan26-Aug-10 2:29
Fernando Padoan26-Aug-10 2:29 
GeneralRe: You're already late Pin
peterchen27-Aug-10 21:26
peterchen27-Aug-10 21:26 
GeneralRe: You're already late Pin
BillW3326-Aug-10 5:52
professionalBillW3326-Aug-10 5:52 
GeneralRe: You're already late Pin
Dr.Walt Fair, PE26-Aug-10 8:46
professionalDr.Walt Fair, PE26-Aug-10 8:46 
GeneralRe: You're already late Pin
Fernando Padoan26-Aug-10 17:30
Fernando Padoan26-Aug-10 17:30 
GeneralRe: You're already late Pin
Matthew Dennis3-Sep-10 11:06
sysadminMatthew Dennis3-Sep-10 11:06 
GeneralCase closed: NULLs are somehow valid in strings now? Pin
djdanlib25-Aug-10 10:03
djdanlib25-Aug-10 10:03 
GeneralRe: Case closed: NULLs are somehow valid in strings now? PinPopular
AspDotNetDev25-Aug-10 10:35
protectorAspDotNetDev25-Aug-10 10:35 
GeneralRe: Case closed: NULLs are somehow valid in strings now? Pin
PIEBALDconsult25-Aug-10 15:10
mvePIEBALDconsult25-Aug-10 15:10 
GeneralRe: Case closed: NULLs are somehow valid in strings now? Pin
Luc Pattyn25-Aug-10 16:59
sitebuilderLuc Pattyn25-Aug-10 16:59 
GeneralRe: Case closed: NULLs are somehow valid in strings now? Pin
PIEBALDconsult25-Aug-10 17:44
mvePIEBALDconsult25-Aug-10 17:44 
GeneralRe: Case closed: NULLs are somehow valid in strings now? Pin
CDP180226-Aug-10 1:02
CDP180226-Aug-10 1:02 
GeneralRe: Case closed: NULLs are somehow valid in strings now? Pin
Dave Calkins26-Aug-10 11:15
Dave Calkins26-Aug-10 11:15 
GeneralRe: Case closed: NULLs are somehow valid in strings now? Pin
Stephen Hewitt27-Aug-10 20:30
Stephen Hewitt27-Aug-10 20:30 
GeneralBeginner's Shame: Manually Draw Characters Pin
AspDotNetDev25-Aug-10 8:26
protectorAspDotNetDev25-Aug-10 8:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.