Click here to Skip to main content
15,903,385 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: Infinite for loops Pin
John R. Shaw9-Mar-07 12:29
John R. Shaw9-Mar-07 12:29 
GeneralDatabase rats nest Pin
Steve Fillingham5-Mar-07 19:26
Steve Fillingham5-Mar-07 19:26 
GeneralRe: Database rats nest Pin
Dirk Gutsche5-Mar-07 21:59
Dirk Gutsche5-Mar-07 21:59 
GeneralRe: Database rats nest Pin
Bradml6-Mar-07 0:53
Bradml6-Mar-07 0:53 
GeneralRe: Database rats nest Pin
Steve Fillingham6-Mar-07 19:32
Steve Fillingham6-Mar-07 19:32 
Generalif something then... nothing Pin
Fernando A. Gomez F.5-Mar-07 13:27
Fernando A. Gomez F.5-Mar-07 13:27 
GeneralRe: if something then... nothing Pin
John R. Shaw9-Mar-07 12:38
John R. Shaw9-Mar-07 12:38 
GeneralObject identifiers [modified] Pin
_oti5-Mar-07 13:12
_oti5-Mar-07 13:12 
Once upon a time, I was leading a team that was doing the server side of an internet banking application. Because this sort of app was in its infancy, there was little confidence, and a lot of paranoia. IIRC, the flow was that a connection would come into an external server, a session would be created and packed and sent across a serial cable to the machine that would handle authentication. This packet would be decrypted, verified and sent back, then it would move on to another machine across another serial cable for the transaction. We had essentially the same process running on each machine, but operating a bit differently depending on the role.

ANYWAY ... we had a problem in that sometimes, a session would drop out, and the service would crash. We logged, we debugged, we stepped through, and couldn't find it, until one fine day, we hit a breakpoint, and the developer said "Huh. That's funny. That should be a session object, not a data chunk."

The penny dropped. "Ah," I said. "That session ID that you're passing back and forth between machines ... is that an index into the session array, or what?"

"No," came the bemused reply. "I thought it would be quicker to just use the address of the object".

Apparently, the original object had been deleted because the session had been dropped, and the runtime had reused the space for something else. So when the session ID was cast from its session ID form (int) to its pointer form, it was pointing at something else. Don't get me wrong ... I love pointers. I just had no idea that their abuse would be extended to neighbouring machines.


-- modified at 23:41 Monday 5th March, 2007

--
All things considered, you can't really consider all things ...

Generalduplicate variable names seperated by scope Pin
Jason De Arte5-Mar-07 13:08
Jason De Arte5-Mar-07 13:08 
GeneralRe: duplicate variable names seperated by scope Pin
bluesboy847-Mar-07 1:06
bluesboy847-Mar-07 1:06 
GeneralUnnecessary try / catch block Pin
David Rush5-Mar-07 10:17
professionalDavid Rush5-Mar-07 10:17 
GeneralRe: Unnecessary try / catch block Pin
PIEBALDconsult5-Mar-07 12:52
mvePIEBALDconsult5-Mar-07 12:52 
GeneralRe: Unnecessary try / catch block Pin
DavidNohejl5-Mar-07 13:07
DavidNohejl5-Mar-07 13:07 
GeneralRe: Unnecessary try / catch block Pin
Ed.Poore5-Mar-07 21:36
Ed.Poore5-Mar-07 21:36 
GeneralRe: Unnecessary try / catch block Pin
David Rush6-Mar-07 9:26
professionalDavid Rush6-Mar-07 9:26 
GeneralRe: Unnecessary try / catch block Pin
GWB@s1c6-Mar-07 7:58
GWB@s1c6-Mar-07 7:58 
GeneralRe: Unnecessary try / catch block Pin
David Rush6-Mar-07 9:43
professionalDavid Rush6-Mar-07 9:43 
GeneralRe: Unnecessary try / catch block Pin
Brian R6-Mar-07 13:33
Brian R6-Mar-07 13:33 
GeneralUse Appropriate Development Tools Pin
Brian Leach5-Mar-07 10:16
Brian Leach5-Mar-07 10:16 
GeneralRe: Use Appropriate Development Tools Pin
Chris Losinger5-Mar-07 11:25
professionalChris Losinger5-Mar-07 11:25 
GeneralRe: Use Appropriate Development Tools [modified] Pin
PIEBALDconsult5-Mar-07 12:54
mvePIEBALDconsult5-Mar-07 12:54 
GeneralRe: Use Appropriate Development Tools Pin
Dan Neely6-Mar-07 2:18
Dan Neely6-Mar-07 2:18 
GeneralEver experienced this Pin
Rama Krishna Vavilala5-Mar-07 9:37
Rama Krishna Vavilala5-Mar-07 9:37 
GeneralRe: Ever experienced this Pin
pbraun5-Mar-07 10:00
pbraun5-Mar-07 10:00 
GeneralRe: Ever experienced this Pin
Christian Graus6-Mar-07 0:09
protectorChristian Graus6-Mar-07 0:09 

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.