Click here to Skip to main content
15,880,891 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.

 
GeneralMySQL: A Horror Pin
Dan Sutton24-Aug-12 7:33
Dan Sutton24-Aug-12 7:33 
GeneralRe: A MySQL horror Pin
Dan Metheus24-Aug-12 12:44
Dan Metheus24-Aug-12 12:44 
GeneralRe: A MySQL horror Pin
Bernhard Hiller26-Aug-12 21:01
Bernhard Hiller26-Aug-12 21:01 
GeneralRe: A MySQL horror Pin
englebart27-Aug-12 5:12
professionalenglebart27-Aug-12 5:12 
GeneralRe: A MySQL horror Pin
Michael Kingsford Gray24-Aug-12 22:47
Michael Kingsford Gray24-Aug-12 22:47 
GeneralRe: A MySQL horror Pin
Florin Jurcovici27-Aug-12 1:56
Florin Jurcovici27-Aug-12 1:56 
GeneralRe: A MySQL horror Pin
englebart27-Aug-12 5:17
professionalenglebart27-Aug-12 5:17 
GeneralString.Format - I'm sure there must be a worse way to do this. PinPopular
RCoate15-Aug-12 16:08
RCoate15-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.
C#
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
egenis15-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
RCoate15-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
mvePIEBALDconsult16-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
RCoate16-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
professionalSlacker00716-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
0bx19-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
RCoate19-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
0bx22-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
Sentenryu21-Aug-12 0:28 
GeneralRe: String.Format - I'm sure there must be a worse way to do this. Pin
Brisingr Aerowing20-Sep-12 17:34
professionalBrisingr Aerowing20-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
Sentenryu20-Sep-12 23:51 
GeneralRe: String.Format - I'm sure there must be a worse way to do this. Pin
Brisingr Aerowing21-Sep-12 11:34
professionalBrisingr Aerowing21-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
professionalMario 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
BobJanova23-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
professionalMario 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
BobJanova23-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
Joe_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.