Click here to Skip to main content
12,078,259 members (46,085 online)

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.

 
GeneralA MySQL horror PinPopular
Bernhard Hiller21-Aug-12 4:25
memberBernhard Hiller21-Aug-12 4:25 
GeneralRe: A MySQL horror Pin
Zac Greve21-Aug-12 9:54
memberZac Greve21-Aug-12 9:54 
GeneralRe: A MySQL horror Pin
Brady Kelly23-Aug-12 22:21
memberBrady Kelly23-Aug-12 22:21 
GeneralRe: A MySQL horror Pin
hussainnagri24-Aug-12 1:55
memberhussainnagri24-Aug-12 1:55 
GeneralRe: A MySQL horror Pin
Frans_5512924-Aug-12 2:49
memberFrans_5512924-Aug-12 2:49 
GeneralRe: A MySQL horror Pin
RafagaX24-Aug-12 5:18
memberRafagaX24-Aug-12 5:18 
GeneralMySQL: A Horror Pin
Dan Sutton24-Aug-12 8:33
memberDan Sutton24-Aug-12 8:33 
GeneralRe: A MySQL horror Pin
Member 372084224-Aug-12 13:44
memberMember 372084224-Aug-12 13:44 
GeneralRe: A MySQL horror Pin
Bernhard Hiller26-Aug-12 22:01
memberBernhard Hiller26-Aug-12 22:01 
GeneralRe: A MySQL horror Pin
englebart27-Aug-12 6:12
memberenglebart27-Aug-12 6:12 
GeneralRe: A MySQL horror Pin
Michael K Gray24-Aug-12 23:47
memberMichael K Gray24-Aug-12 23:47 
GeneralRe: A MySQL horror Pin
Florin Jurcovici27-Aug-12 2:56
memberFlorin Jurcovici27-Aug-12 2:56 
GeneralRe: A MySQL horror Pin
englebart27-Aug-12 6:17
memberenglebart27-Aug-12 6:17 
GeneralString.Format - I'm sure there must be a worse way to do this. Pin
RCoate15-Aug-12 17:08
memberRCoate15-Aug-12 17:08 
I'm a bit surprised there isn't an embedded String.Concatenate call in there as well.

DateTime dt = DateTime.Now;
 
// Get year, month, and day
string year = dt.Year.ToString();
string month = dt.Month.ToString();
string day = dt.Day.ToString();
 
// Format month
if (month.Length == 1){ month = "0" + month; }
 
// Format day
if (day.Length == 1){ day = "0" + day; }
 
string DocumentName = string.Format("Application - [{0}] - " + year + month + day, this.Person.RegistrationNo.ToString());

I'm thinking that there is a ToString() call missing just before the final ; too.

Oh - and this one too.
TRIMSDK.Location trimLocation = trimLocation = trimManager.FindLocationFromNickname(string.Format("{0}", this.Person.RegistrationNo.GetValueOrDefault(0).ToString()));

I think I need a Rum! WTF | :WTF:

modified 15-Aug-12 23:47pm.

GeneralRe: String.Format - I'm sure there must be a worse way to do this. Pin
egenis15-Aug-12 19:36
memberegenis15-Aug-12 19:36 
GeneralRe: String.Format - I'm sure there must be a worse way to do this. Pin
RCoate15-Aug-12 19:56
memberRCoate15-Aug-12 19:56 
GeneralRe: String.Format - I'm sure there must be a worse way to do this. Pin
PIEBALDconsult16-Aug-12 4:43
memberPIEBALDconsult16-Aug-12 4:43 
GeneralRe: String.Format - I'm sure there must be a worse way to do this. Pin
RCoate16-Aug-12 13:25
memberRCoate16-Aug-12 13:25 
GeneralRe: String.Format - I'm sure there must be a worse way to do this. Pin
Slacker00716-Aug-12 23:53
memberSlacker00716-Aug-12 23:53 
GeneralRe: String.Format - I'm sure there must be a worse way to do this. Pin
0bx19-Aug-12 9:50
member0bx19-Aug-12 9:50 
GeneralRe: String.Format - I'm sure there must be a worse way to do this. Pin
RCoate19-Aug-12 14:06
memberRCoate19-Aug-12 14:06 
GeneralRe: String.Format - I'm sure there must be a worse way to do this. Pin
0bx23-Aug-12 0:38
member0bx23-Aug-12 0:38 
GeneralRe: String.Format - I'm sure there must be a worse way to do this. Pin
Sentenryu21-Aug-12 1:28
memberSentenryu21-Aug-12 1:28 
GeneralRe: String.Format - I'm sure there must be a worse way to do this. Pin
Zac Greve20-Sep-12 18:34
memberZac Greve20-Sep-12 18:34 
GeneralRe: String.Format - I'm sure there must be a worse way to do this. Pin
Sentenryu21-Sep-12 0:51
memberSentenryu21-Sep-12 0:51 
GeneralRe: String.Format - I'm sure there must be a worse way to do this. Pin
Zac Greve21-Sep-12 12:34
memberZac Greve21-Sep-12 12:34 
JokeRe: String.Format - I'm sure there must be a worse way to do this. Pin
Mario Majčica23-Aug-12 21:47
memberMario Majčica23-Aug-12 21:47 
GeneralRe: String.Format - I'm sure there must be a worse way to do this. Pin
BobJanova23-Aug-12 23:43
memberBobJanova23-Aug-12 23:43 
AnswerRe: String.Format - I'm sure there must be a worse way to do this. Pin
Mario Majčica23-Aug-12 23:43
memberMario Majčica23-Aug-12 23:43 
GeneralRe: String.Format - I'm sure there must be a worse way to do this. Pin
BobJanova23-Aug-12 23:56
memberBobJanova23-Aug-12 23:56 
GeneralRe: String.Format - I'm sure there must be a worse way to do this. Pin
Joe_Dert21-Oct-12 0:12
memberJoe_Dert21-Oct-12 0:12 
GeneralMessage Removed Pin
LiveFreeCodeHard14-Aug-12 10:10
memberLiveFreeCodeHard14-Aug-12 10:10 
GeneralRe: Ran across my old code... Must have been tired... Pin
Shameel16-Aug-12 5:18
memberShameel16-Aug-12 5:18 
GeneralRe: Ran across my old code... Must have been tired... Pin
ekolis30-Aug-12 13:56
memberekolis30-Aug-12 13:56 
GeneralAdmin Scripts Pin
bulg14-Aug-12 7:19
memberbulg14-Aug-12 7:19 
QuestionRe: Admin Scripts Pin
AspDotNetDev14-Aug-12 8:06
protectorAspDotNetDev14-Aug-12 8:06 
AnswerRe: Admin Scripts Pin
bulg14-Aug-12 20:18
memberbulg14-Aug-12 20:18 
GeneralRe: Admin Scripts Pin
AspDotNetDev14-Aug-12 20:30
protectorAspDotNetDev14-Aug-12 20:30 
GeneralRe: Admin Scripts Pin
bulg15-Aug-12 10:29
memberbulg15-Aug-12 10:29 
GeneralRe: Admin Scripts Pin
Gary Huck21-Aug-12 4:13
memberGary Huck21-Aug-12 4:13 
GeneralRe: Admin Scripts Pin
KbrKnight25-Aug-12 20:30
memberKbrKnight25-Aug-12 20:30 
GeneralAlcatraz ~ the tourist website Pin
0bx10-Aug-12 13:11
member0bx10-Aug-12 13:11 
GeneralRe: Alcatraz ~ the tourist website Pin
mark merrens10-Aug-12 13:33
membermark merrens10-Aug-12 13:33 
GeneralRe: Alcatraz ~ the tourist website Pin
Zac Greve10-Aug-12 15:13
memberZac Greve10-Aug-12 15:13 
JokeRe: Alcatraz ~ the tourist website Pin
krumia13-Aug-12 1:03
memberkrumia13-Aug-12 1:03 
GeneralRe: Alcatraz ~ the tourist website Pin
Andrei Straut13-Aug-12 5:57
memberAndrei Straut13-Aug-12 5:57 
GeneralRe: Alcatraz ~ the tourist website Pin
BobJanova13-Aug-12 3:16
memberBobJanova13-Aug-12 3:16 
GeneralRe: Alcatraz ~ the tourist website Pin
enhzflep13-Aug-12 5:46
memberenhzflep13-Aug-12 5:46 
GeneralRe: Alcatraz ~ the tourist website Pin
Andrei Straut13-Aug-12 5:59
memberAndrei Straut13-Aug-12 5:59 
GeneralRe: Alcatraz ~ the tourist website Pin
enhzflep13-Aug-12 6:14
memberenhzflep13-Aug-12 6:14 

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.


Advertise | Privacy | Mobile
Web02 | 2.8.160212.1 | Last Updated 13 Feb 2016
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid