Click here to Skip to main content
15,881,092 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: 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 
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 
Got your insert right here.
C#
// Format month
var sbMonth = new StringBuilder();
sbMonth.Append(month);
if (month.Length == 1)
{
    sbMonth.Insert(0, "0");
}


I'm sure if the genius who wrote this was aware of Insert and string builders, it would have been used.

Can't complain too much. At least the code actually produces the required outcome. I can't always claim that. Smile | :)
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 
GeneralMessage Closed Pin
14-Aug-12 9:10
WebMaster14-Aug-12 9:10 
GeneralRe: Ran across my old code... Must have been tired... Pin
Shameel16-Aug-12 4:18
professionalShameel16-Aug-12 4:18 
GeneralRe: Ran across my old code... Must have been tired... Pin
ekolis30-Aug-12 12:56
ekolis30-Aug-12 12:56 
GeneralAdmin Scripts Pin
bulg14-Aug-12 6:19
bulg14-Aug-12 6:19 

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.