Click here to Skip to main content
15,895,011 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: Funny Javascript Pin
Michael Sync9-Jul-07 15:57
Michael Sync9-Jul-07 15:57 
GeneralRe: Funny Javascript Pin
Sylvester george10-Jul-07 1:05
Sylvester george10-Jul-07 1:05 
GeneralRe: Funny Javascript Pin
Sathesh Sakthivel10-Jul-07 17:48
Sathesh Sakthivel10-Jul-07 17:48 
GeneralRe: Funny Javascript Pin
dekart_roo11-Jul-07 9:04
dekart_roo11-Jul-07 9:04 
GeneralRe: Funny Javascript Pin
javaJones23-Jul-07 10:50
javaJones23-Jul-07 10:50 
GeneralThreads Pin
Rama Krishna Vavilala8-Jul-07 7:29
Rama Krishna Vavilala8-Jul-07 7:29 
GeneralRe: Threads Pin
Nemanja Trifunovic8-Jul-07 8:07
Nemanja Trifunovic8-Jul-07 8:07 
GeneralRe: Threads Pin
El Corazon10-Jul-07 4:25
El Corazon10-Jul-07 4:25 
As mentioned the termination of a thread should be internal, not with a Terminate command. Set a flag and wait for self-termination. You never know if a thread has a socket or file open, or any other resources. You can't simply say, no thread can ever aquire resources, and with multi-core and multi-processor allowing two simultaneous operations, it is even more difficult to judge if a terminate signal will work without memory leak even with back-to-back aquire()/release() because the terminate can occur in the middle of aquiring, before releasing, or in the middle of releasing. Terminates should all be handled gracefully from inside. The "code that does something" needs to check for a terminate early flag and release resources (if any) and go on. Simply putting aquire/release back to back will not save you. This is a common failure even with experts on threading thinking that back-to-back operations will not be interrupted. It's all a roll of the dice, back to back operations may make you think everything is okay because chances are reduced, but eventually it will show up as a problem, and then it will be difficult to repeat it for debugging.

remember the core premise of threading: thou shalt not commit murder, all threads should be directed to suicide. Wink | ;)

_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)

GeneralRe: Threads Pin
Rama Krishna Vavilala10-Jul-07 4:29
Rama Krishna Vavilala10-Jul-07 4:29 
GeneralRe: Threads Pin
codemunkeh12-Jul-07 4:10
codemunkeh12-Jul-07 4:10 
GeneralBest practices for transaction management, Pin
Pete O'Hanlon5-Jul-07 23:10
mvePete O'Hanlon5-Jul-07 23:10 
GeneralRe: Best practices for transaction management, Pin
Sylvester george5-Jul-07 23:57
Sylvester george5-Jul-07 23:57 
GeneralRe: Best practices for transaction management, Pin
Vikram A Punathambekar6-Jul-07 1:00
Vikram A Punathambekar6-Jul-07 1:00 
GeneralRe: Best practices for transaction management, Pin
_Damian S_6-Jul-07 2:16
professional_Damian S_6-Jul-07 2:16 
GeneralRe: Best practices for transaction management, Pin
Dan Neely6-Jul-07 2:56
Dan Neely6-Jul-07 2:56 
GeneralRe: Best practices for transaction management, Pin
Pete O'Hanlon6-Jul-07 3:34
mvePete O'Hanlon6-Jul-07 3:34 
GeneralRe: Best practices for transaction management, Pin
KarstenK10-Jul-07 4:26
mveKarstenK10-Jul-07 4:26 
GeneralRe: Best practices for transaction management, Pin
Russell Jones17-Jul-07 3:07
Russell Jones17-Jul-07 3:07 
GeneralOut of memory? Keep going! Pin
Gavin Kendall4-Jul-07 20:12
professionalGavin Kendall4-Jul-07 20:12 
GeneralRe: Out of memory? Keep going! Pin
M Harris4-Jul-07 20:14
M Harris4-Jul-07 20:14 
GeneralRe: Out of memory? Keep going! Pin
Vasudevan Deepak Kumar4-Jul-07 20:18
Vasudevan Deepak Kumar4-Jul-07 20:18 
GeneralRe: Out of memory? Keep going! Pin
Vasudevan Deepak Kumar4-Jul-07 20:18
Vasudevan Deepak Kumar4-Jul-07 20:18 
GeneralRe: Out of memory? Keep going! Pin
jhwurmbach4-Jul-07 21:27
jhwurmbach4-Jul-07 21:27 
GeneralRe: Out of memory? Keep going! Pin
ruanr4-Jul-07 23:38
ruanr4-Jul-07 23:38 
GeneralRe: Out of memory? Keep going! Pin
Sylvester george5-Jul-07 23:51
Sylvester george5-Jul-07 23:51 

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.