Click here to Skip to main content
15,891,951 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: OMG a "Goto" Pin
PIEBALDconsult24-Oct-08 7:09
mvePIEBALDconsult24-Oct-08 7:09 
GeneralRe: OMG a "Goto" Pin
Andrew Rissing24-Oct-08 10:19
Andrew Rissing24-Oct-08 10:19 
GeneralRe: OMG a "Goto" Pin
Paul Conrad24-Oct-08 4:19
professionalPaul Conrad24-Oct-08 4:19 
GeneralRe: OMG a "Goto" Pin
icemanind31-Oct-08 13:03
icemanind31-Oct-08 13:03 
GeneralRe: OMG a "Goto" Pin
ClementsDan1-Nov-08 18:52
ClementsDan1-Nov-08 18:52 
GeneralRe: OMG a "Goto" Pin
Johan Vorster2-Nov-08 9:31
Johan Vorster2-Nov-08 9:31 
GeneralRe: OMG a "Goto" Pin
steveb5-Nov-08 6:43
mvesteveb5-Nov-08 6:43 
GeneralIn the midst of reviewing some code my client got back from and outsourced refactoring effort... Pin
Austin Harris22-Oct-08 13:14
Austin Harris22-Oct-08 13:14 
We ran into the following nice bit of code.

public static bool UniqueAssetNo(int assetId, string assetNo)
        {
            //--string sql = @"Select Count(*) From Asset " +
            //--				@"Where ({0} = 0 Or AssetId <> {0}) " +
            //--				@"And (LoanNum Not Like '%[A-Z]%') " +
            //--				@"And (Cast('{1}' As bigint) = Cast(LoanNum As bigint))";
            //We ran into an error during testing. I think it has to do with the indexes not being created properly. In either case, this one works.
            try
            {
                string sql = @"Select Count(*) " +
                    @"From (Select AssetId, LoanNum " +
                    @"	From Asset (NOLOCK) " +
                    @"	Where ({0} = 0 Or AssetId <> {0}) " +
                    @"	And (LoanNum Not Like '%[A-Z]%') And LTrim(RTrim(LoanNum)) <> '') qry " +
                    @"Where Cast('{1}' As bigint) = Case When qry.LoanNum = '' Then 0 else Cast(qry.LoanNum as bigint) end";
...
...


What do you think? :P
GeneralRe: In the midst of reviewing some code my client got back from and outsourced refactoring effort... Pin
PIEBALDconsult22-Oct-08 14:35
mvePIEBALDconsult22-Oct-08 14:35 
GeneralRe: In the midst of reviewing some code my client got back from and outsourced refactoring effort... Pin
Andrew Rissing24-Oct-08 4:05
Andrew Rissing24-Oct-08 4:05 
GeneralRe: In the midst of reviewing some code my client got back from and outsourced refactoring effort... Pin
Paul Conrad24-Oct-08 4:21
professionalPaul Conrad24-Oct-08 4:21 
GeneralWords cannot describe my pain Pin
leppie22-Oct-08 2:48
leppie22-Oct-08 2:48 
GeneralRe: Words cannot describe my pain Pin
CPallini22-Oct-08 3:11
mveCPallini22-Oct-08 3:11 
GeneralRe: Words cannot describe my pain Pin
leppie22-Oct-08 3:16
leppie22-Oct-08 3:16 
GeneralRe: Words cannot describe my pain Pin
CPallini22-Oct-08 3:19
mveCPallini22-Oct-08 3:19 
GeneralRe: Words cannot describe my pain Pin
Scott Barbour22-Oct-08 4:56
Scott Barbour22-Oct-08 4:56 
GeneralRe: Words cannot describe my pain Pin
Eddy Vluggen22-Oct-08 23:27
professionalEddy Vluggen22-Oct-08 23:27 
GeneralRe: Words cannot describe my pain Pin
Megidolaon23-Feb-09 0:15
Megidolaon23-Feb-09 0:15 
QuestionRe: Words cannot describe my pain Pin
CPallini23-Feb-09 0:26
mveCPallini23-Feb-09 0:26 
GeneralRe: Words cannot describe my pain Pin
PIEBALDconsult22-Oct-08 4:23
mvePIEBALDconsult22-Oct-08 4:23 
GeneralRe: Words cannot describe my pain Pin
BillW3322-Oct-08 14:33
professionalBillW3322-Oct-08 14:33 
GeneralRe: Words cannot describe my pain Pin
PIEBALDconsult22-Oct-08 14:40
mvePIEBALDconsult22-Oct-08 14:40 
GeneralRe: Words cannot describe my pain Pin
Thomas Weller23-Oct-08 1:24
Thomas Weller23-Oct-08 1:24 
GeneralRe: Words cannot describe my pain Pin
adamsappel30-Oct-08 23:05
adamsappel30-Oct-08 23:05 
GeneralLocking horror: Am I going mad? Pin
ewan19-Oct-08 8:02
ewan19-Oct-08 8:02 

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.