Click here to Skip to main content
15,042,814 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: I just want to be really really sure Pin
Robert Rohde14-Oct-13 11:01
MemberRobert Rohde14-Oct-13 11:01 
GeneralRe: I just want to be really really sure Pin
Argonia14-Oct-13 20:19
professionalArgonia14-Oct-13 20:19 
GeneralRe: I just want to be really really sure Pin
contracting19909-Oct-13 4:06
Membercontracting19909-Oct-13 4:06 
GeneralRe: I just want to be really really sure Pin
Gary R. Wheeler10-Oct-13 14:51
MemberGary R. Wheeler10-Oct-13 14:51 
GeneralRe: I just want to be really really sure Pin
MacSpudster5-Nov-13 5:36
professionalMacSpudster5-Nov-13 5:36 
GeneralRe: I just want to be really really sure Pin
ian dennis18-Nov-13 13:25
Memberian dennis18-Nov-13 13:25 
GeneralA delicious bug in the September update of SQL Server 2012 Data Tools Pin
Vladimir Svyatski7-Oct-13 22:41
professionalVladimir Svyatski7-Oct-13 22:41 
GeneralThe most creative log ever PinPopular
Guy Lavi6-Oct-13 21:32
MemberGuy Lavi6-Oct-13 21:32 
When I started working in my current position four years ago, I inherited a system full of bugs and was given the task to iron out all of the bugs.

The first step i though would be to turn on the logger and try to find out where and when the crashes happen.

I turned on the logger and after a few minutes...
BIG MISTAKE!

My system crashed.

It took me 2 days to re-install everything, and turn on the logger again.
and it happened again.

The next time i was smarter, and ghosted my disk.
I also finally found the correct source code version (which was hidden among multiple copies of various
versions and test made by the person), and run it through a debugger.

and then i found out this little beauty:

public void errorCatcher(string msg)
        {
            RegistryKey key = Registry.CurrentUser.OpenSubKey(KEY_NAME_START + @"\errors", true);
            if (key != null)
            {
                key.SetValue(DateTime.Now.ToString(), msg);
                key.Close();
            }
        }


and every method in the system had the same reference in it's catch clause:

catch (Exception exception)
{
    errorCatcher(exception.ToString());
    return "";
}


I took me two weeks to rewrite the whole thing, throw away 90% of the code, and roll out a bug free system.

(I still keep the original code as proof, as no one believes me when i tell people about it.)
GeneralRe: The most creative log ever Pin
OriginalGriff6-Oct-13 22:25
mveOriginalGriff6-Oct-13 22:25 
GeneralRe: The most creative log ever Pin
Guy Lavi6-Oct-13 23:01
MemberGuy Lavi6-Oct-13 23:01 
GeneralRe: The most creative log ever Pin
OriginalGriff6-Oct-13 23:07
mveOriginalGriff6-Oct-13 23:07 
GeneralRe: The most creative log ever Pin
Guy Lavi6-Oct-13 23:54
MemberGuy Lavi6-Oct-13 23:54 
GeneralRe: The most creative log ever Pin
OriginalGriff6-Oct-13 23:57
mveOriginalGriff6-Oct-13 23:57 
GeneralRe: The most creative log ever Pin
Guy Lavi7-Oct-13 0:01
MemberGuy Lavi7-Oct-13 0:01 
GeneralRe: The most creative log ever Pin
Freak307-Oct-13 22:44
MemberFreak307-Oct-13 22:44 
GeneralRe: The most creative log ever Pin
Fredrik Bornander10-Oct-13 4:40
professionalFredrik Bornander10-Oct-13 4:40 
GeneralRe: The most creative log ever Pin
Kornfeld Eliyahu Peter7-Oct-13 1:58
professionalKornfeld Eliyahu Peter7-Oct-13 1:58 
GeneralRe: The most creative log ever Pin
Guy Lavi7-Oct-13 2:11
MemberGuy Lavi7-Oct-13 2:11 
GeneralRe: The most creative log ever Pin
Brisingr Aerowing7-Oct-13 4:36
professionalBrisingr Aerowing7-Oct-13 4:36 
GeneralRe: The most creative log ever Pin
Rage11-Oct-13 0:18
professionalRage11-Oct-13 0:18 
GeneralRe: The most creative log ever Pin
Guy Lavi12-Oct-13 20:39
MemberGuy Lavi12-Oct-13 20:39 
JokeRedundancy at its finest Pin
Edward Giles5-Oct-13 21:49
MemberEdward Giles5-Oct-13 21:49 
GeneralRe: Redundancy at its finest Pin
Kornfeld Eliyahu Peter6-Oct-13 9:03
professionalKornfeld Eliyahu Peter6-Oct-13 9:03 
GeneralRe: Redundancy at its finest Pin
Brisingr Aerowing6-Oct-13 14:33
professionalBrisingr Aerowing6-Oct-13 14:33 
GeneralRe: Redundancy at its finest Pin
ZurdoDev7-Oct-13 2:32
professionalZurdoDev7-Oct-13 2:32 

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.