Click here to Skip to main content
15,880,405 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: Redundancy at its finest Pin
ZurdoDev7-Oct-13 2:32
professionalZurdoDev7-Oct-13 2:32 
GeneralRe: Redundancy at its finest Pin
Bernhard Hiller6-Oct-13 22:14
Bernhard Hiller6-Oct-13 22:14 
GeneralRe: Redundancy at its finest Pin
Edward Giles11-Nov-13 23:34
Edward Giles11-Nov-13 23:34 
GeneralRe: Redundancy at its finest Pin
OriginalGriff6-Oct-13 22:29
mveOriginalGriff6-Oct-13 22:29 
GeneralRe: Redundancy at its finest Pin
ZurdoDev7-Oct-13 2:33
professionalZurdoDev7-Oct-13 2:33 
GeneralRe: Redundancy at its finest Pin
0bx7-Oct-13 23:48
0bx7-Oct-13 23:48 
GeneralRe: Redundancy at its finest Pin
MacSpudster5-Nov-13 5:47
professionalMacSpudster5-Nov-13 5:47 
JokeHow to zero-pad a number? Pin
SortaCore1-Oct-13 0:27
SortaCore1-Oct-13 0:27 
A padded number in a file name!
C#
// Set to padded number
int fileCount = Directory.GetFiles("[censored]", "*.csv", SearchOption.AllDirectories).Length + 1;
string fileCountStr = (fileCount <= 999 ? fileCount <= 99 ? fileCount <= 9 ? "000" : "00" : "0" : "") + fileCount;


I think this should win an award for readability in a triply-nested ternary condition Roll eyes | :rolleyes: .
GeneralRe: How to zero-pad a number? Pin
Nagy Vilmos1-Oct-13 0:49
professionalNagy Vilmos1-Oct-13 0:49 
GeneralRe: How to zero-pad a number? Pin
SortaCore1-Oct-13 0:55
SortaCore1-Oct-13 0:55 
GeneralRe: How to zero-pad a number? Pin
PIEBALDconsult1-Oct-13 4:18
mvePIEBALDconsult1-Oct-13 4:18 
GeneralRe: How to zero-pad a number? Pin
Richard Deeming1-Oct-13 4:27
mveRichard Deeming1-Oct-13 4:27 
GeneralRe: How to zero-pad a number? Pin
PIEBALDconsult1-Oct-13 6:27
mvePIEBALDconsult1-Oct-13 6:27 
GeneralRe: How to zero-pad a number? Pin
Richard Deeming1-Oct-13 7:09
mveRichard Deeming1-Oct-13 7:09 
GeneralRe: How to zero-pad a number? Pin
PIEBALDconsult1-Oct-13 10:43
mvePIEBALDconsult1-Oct-13 10:43 
GeneralRe: How to zero-pad a number? Pin
Richard Deeming1-Oct-13 10:57
mveRichard Deeming1-Oct-13 10:57 
GeneralRe: How to zero-pad a number? Pin
Big Daddy Farang1-Oct-13 11:23
Big Daddy Farang1-Oct-13 11:23 
GeneralRe: How to zero-pad a number? Pin
PIEBALDconsult1-Oct-13 13:44
mvePIEBALDconsult1-Oct-13 13:44 
GeneralRe: How to zero-pad a number? Pin
Richard Deeming2-Oct-13 1:44
mveRichard Deeming2-Oct-13 1:44 
GeneralRe: How to zero-pad a number? Pin
SortaCore2-Oct-13 2:07
SortaCore2-Oct-13 2:07 
GeneralRe: How to zero-pad a number? Pin
PIEBALDconsult2-Oct-13 3:12
mvePIEBALDconsult2-Oct-13 3:12 
GeneralRe: How to zero-pad a number? Pin
Richard Deeming2-Oct-13 3:19
mveRichard Deeming2-Oct-13 3:19 
GeneralRe: How to zero-pad a number? Pin
PIEBALDconsult2-Oct-13 3:28
mvePIEBALDconsult2-Oct-13 3:28 
GeneralRe: How to zero-pad a number? Pin
SortaCore2-Oct-13 9:21
SortaCore2-Oct-13 9:21 
GeneralRe: How to zero-pad a number? Pin
SortaCore1-Oct-13 10:48
SortaCore1-Oct-13 10:48 

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.