Click here to Skip to main content
12,253,139 members (52,818 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.

 
GeneralMySQL: A Horror Pin
Dan Sutton24-Aug-12 7:33
memberDan Sutton24-Aug-12 7:33 
GeneralRe: A MySQL horror Pin
Member 372084224-Aug-12 12:44
memberMember 372084224-Aug-12 12:44 
GeneralRe: A MySQL horror Pin
Bernhard Hiller26-Aug-12 21:01
memberBernhard Hiller26-Aug-12 21:01 
GeneralRe: A MySQL horror Pin
englebart27-Aug-12 5:12
memberenglebart27-Aug-12 5:12 
GeneralRe: A MySQL horror Pin
Michael K Gray24-Aug-12 22:47
memberMichael K Gray24-Aug-12 22:47 
GeneralRe: A MySQL horror Pin
Florin Jurcovici27-Aug-12 1:56
memberFlorin Jurcovici27-Aug-12 1:56 
GeneralRe: A MySQL horror Pin
englebart27-Aug-12 5:17
memberenglebart27-Aug-12 5:17 
GeneralString.Format - I'm sure there must be a worse way to do this. PinPopular
RCoate15-Aug-12 16:08
memberRCoate15-Aug-12 16: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 18:36
memberegenis15-Aug-12 18:36 
GeneralRe: String.Format - I'm sure there must be a worse way to do this. Pin
RCoate15-Aug-12 18:56
memberRCoate15-Aug-12 18:56 
GeneralRe: String.Format - I'm sure there must be a worse way to do this. Pin
PIEBALDconsult16-Aug-12 3:43
memberPIEBALDconsult16-Aug-12 3:43 
GeneralRe: String.Format - I'm sure there must be a worse way to do this. Pin
RCoate16-Aug-12 12:25
memberRCoate16-Aug-12 12:25 
GeneralRe: String.Format - I'm sure there must be a worse way to do this. Pin
Slacker00716-Aug-12 22:53
memberSlacker00716-Aug-12 22:53 
GeneralRe: String.Format - I'm sure there must be a worse way to do this. Pin
0bx19-Aug-12 8:50
member0bx19-Aug-12 8:50 
GeneralRe: String.Format - I'm sure there must be a worse way to do this. Pin
RCoate19-Aug-12 13:06
memberRCoate19-Aug-12 13:06 
GeneralRe: String.Format - I'm sure there must be a worse way to do this. Pin
0bx22-Aug-12 23:38
member0bx22-Aug-12 23:38 
GeneralRe: String.Format - I'm sure there must be a worse way to do this. Pin
Sentenryu21-Aug-12 0:28
memberSentenryu21-Aug-12 0:28 
GeneralRe: String.Format - I'm sure there must be a worse way to do this. Pin
Zac Greve20-Sep-12 17:34
memberZac Greve20-Sep-12 17:34 
GeneralRe: String.Format - I'm sure there must be a worse way to do this. Pin
Sentenryu20-Sep-12 23:51
memberSentenryu20-Sep-12 23:51 
GeneralRe: String.Format - I'm sure there must be a worse way to do this. Pin
Zac Greve21-Sep-12 11:34
memberZac Greve21-Sep-12 11:34 
JokeRe: String.Format - I'm sure there must be a worse way to do this. Pin
Mario Majčica23-Aug-12 20:47
memberMario Majčica23-Aug-12 20:47 
GeneralRe: String.Format - I'm sure there must be a worse way to do this. Pin
BobJanova23-Aug-12 22:43
memberBobJanova23-Aug-12 22:43 
AnswerRe: String.Format - I'm sure there must be a worse way to do this. Pin
Mario Majčica23-Aug-12 22:43
memberMario Majčica23-Aug-12 22:43 
GeneralRe: String.Format - I'm sure there must be a worse way to do this. Pin
BobJanova23-Aug-12 22:56
memberBobJanova23-Aug-12 22:56 
GeneralRe: String.Format - I'm sure there must be a worse way to do this. Pin
Joe_Dert20-Oct-12 23:12
memberJoe_Dert20-Oct-12 23:12 

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.160426.1 | Last Updated 5 May 2016
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid