Click here to Skip to main content
15,887,596 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: Why oh why??? Pin
Marc A. Brown6-May-11 4:50
Marc A. Brown6-May-11 4:50 
GeneralRe: Why oh why??? Pin
emartinho6-May-11 5:56
emartinho6-May-11 5:56 
GeneralRe: Why oh why??? PinPopular
Luc Pattyn6-May-11 4:04
sitebuilderLuc Pattyn6-May-11 4:04 
GeneralRe: Why oh why??? Pin
Marc A. Brown6-May-11 4:50
Marc A. Brown6-May-11 4:50 
GeneralRe: Why oh why??? Pin
emartinho6-May-11 5:53
emartinho6-May-11 5:53 
GeneralRe: Why oh why??? Pin
Blake Miller6-May-11 7:17
Blake Miller6-May-11 7:17 
GeneralRe: Why oh why??? Pin
Pong D. Panda6-May-11 22:06
Pong D. Panda6-May-11 22:06 
GeneralThe mysteriously deleted file PinPopular
Joe Woodbury4-May-11 7:22
professionalJoe Woodbury4-May-11 7:22 
For our remote embedded system, we have a convoluted patching mechanism. For our latest release, to solve another problem with large archives I rewrote our unzipper. It worked great except a critical file would get deleted. We threw more logging, changed the organzation of the zip files to no avail. Another developer added some logging which identified when the file in question was getting deleted and asked me what circumstances led to that error condition. I looked over his shoulder, my eyes went up a few lines and I saw it.

To take care of a very rare edge case, I added a check. Problem is that if the file being unzipped was exactly the same size as the unzip buffer, that check would erroneously fail. To make it worse, I realized that the check would have never failed (aside from the above) unless the zip file was deliberately corrupted, including adding fake CRCs and even then it would be very difficult. Point being, I added a test for an edge case that would never happen causing an edge case that did!
GeneralBrilliant Logic PinPopular
Roman_wolf3-May-11 21:59
Roman_wolf3-May-11 21:59 
GeneralRe: Brilliant Logic PinPopular
musefan4-May-11 3:00
musefan4-May-11 3:00 
GeneralRe: Brilliant Logic Pin
BillW334-May-11 3:05
professionalBillW334-May-11 3:05 
JokeRe: Brilliant Logic Pin
Manfred Rudolf Bihy4-May-11 3:19
professionalManfred Rudolf Bihy4-May-11 3:19 
GeneralRe: Brilliant Logic....for checking NANs Pin
Kevin Drzycimski4-May-11 4:08
Kevin Drzycimski4-May-11 4:08 
GeneralRe: Brilliant Logic....for checking NANs [modified] Pin
BobJanova4-May-11 6:03
BobJanova4-May-11 6:03 
GeneralRe: Brilliant Logic....for checking NANs Pin
AspDotNetDev4-May-11 6:39
protectorAspDotNetDev4-May-11 6:39 
GeneralRe: Brilliant Logic....for checking NANs <- portable Pin
Kevin Drzycimski8-May-11 6:53
Kevin Drzycimski8-May-11 6:53 
GeneralRe: Brilliant Logic....for checking NANs Pin
AspDotNetDev4-May-11 6:44
protectorAspDotNetDev4-May-11 6:44 
JokeRe: Brilliant Logic Pin
Marc A. Brown4-May-11 5:20
Marc A. Brown4-May-11 5:20 
GeneralRe: Brilliant Logic Pin
gavindon4-May-11 12:00
gavindon4-May-11 12:00 
GeneralRe: Brilliant Logic Pin
RobCroll6-May-11 3:17
RobCroll6-May-11 3:17 
JokeRe: Brilliant Logic Pin
Dr.Luiji6-May-11 5:47
professionalDr.Luiji6-May-11 5:47 
GeneralRe: Brilliant Logic for the UN and bankers PinPopular
Bob10006-May-11 5:56
professionalBob10006-May-11 5:56 
GeneralRe: Brilliant Logic Pin
Marbry Hardin6-May-11 6:52
Marbry Hardin6-May-11 6:52 
GeneralRe: Brilliant Logic Pin
Sterling Camden / independent consultant6-May-11 7:36
Sterling Camden / independent consultant6-May-11 7:36 
GeneralRe: Brilliant Logic [modified] Pin
R. Erasmus8-May-11 21:37
R. Erasmus8-May-11 21:37 

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.