Click here to Skip to main content
15,887,746 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: Wondering Pin
Luc Pattyn13-Dec-07 1:38
sitebuilderLuc Pattyn13-Dec-07 1:38 
GeneralRe: Wondering Pin
darkelv13-Dec-07 21:24
darkelv13-Dec-07 21:24 
GeneralRe: Wondering Pin
Pete O'Hanlon13-Dec-07 22:53
mvePete O'Hanlon13-Dec-07 22:53 
GeneralWhat happens when a Java coder decides to explain a Red Black Tree in C#? Pin
leppie11-Dec-07 7:39
leppie11-Dec-07 7:39 
GeneralRe: What happens when a Java coder decides to explain a Red Black Tree in C#? Pin
Pete O'Hanlon11-Dec-07 10:30
mvePete O'Hanlon11-Dec-07 10:30 
GeneralRe: What happens when a Java coder decides to explain a Red Black Tree in C#? Pin
Rizwan Yasin11-Dec-07 19:04
Rizwan Yasin11-Dec-07 19:04 
GeneralRe: What happens when a Java coder decides to explain a Red Black Tree in C#? Pin
leppie11-Dec-07 19:22
leppie11-Dec-07 19:22 
GeneralRe: What happens when a Java coder decides to explain a Red Black Tree in C#? Pin
Mike Dimmick14-Dec-07 13:38
Mike Dimmick14-Dec-07 13:38 
I have to say I can't see that many problems. Discarding every other random number is a bit weird in the first example. Throughout there's a reliance on the low-precision system clock returned with DateTime.Now and TimeSpan.Milliseconds returns the milliseconds part only, you should use TotalMilliseconds if you want it to tell you how many seconds elapsed. For more accurate timing results use a System.Diagnostics.Stopwatch.

At this point any collection which doesn't support generics is pretty stupid, the whole thing should be parameterized on T with a restriction that T derives from IComparable<T> or allows you to supply an IComparer<T>.

I'd like to see a comparison with inserting into a sorted ArrayList or List<T> and using BinarySearch. A lot of emphasis is put on the computational algorithmic complexity of data structures and algorithms, but these days practical algorithm performance is based on memory speed hierarchies, and cache locality is very important. Further, an array typically represents a lower load on the garbage collector than a deeply-linked data structure (fewer pointers to follow). There is a reason why Microsoft didn't and still don't supply linked list or binary tree structures with the .NET Framework.

DoEvents: Generating unexpected recursion since 1991

Generalcss disaster PinPopular
sdix10-Dec-07 11:07
sdix10-Dec-07 11:07 
GeneralRe: css disaster Pin
Ri Qen-Sin11-Dec-07 5:00
Ri Qen-Sin11-Dec-07 5:00 
GeneralRe: css disaster Pin
leppie11-Dec-07 7:40
leppie11-Dec-07 7:40 
GeneralRe: css disaster Pin
Pete O'Hanlon11-Dec-07 10:19
mvePete O'Hanlon11-Dec-07 10:19 
GeneralConstants definitions Pin
Dr. Emmett Brown6-Dec-07 4:05
Dr. Emmett Brown6-Dec-07 4:05 
QuestionRe: Constants definitions Pin
Steve Hansen9-Dec-07 23:23
Steve Hansen9-Dec-07 23:23 
GeneralRe: Constants definitions Pin
Dr. Emmett Brown10-Dec-07 14:46
Dr. Emmett Brown10-Dec-07 14:46 
GeneralRe: Constants definitions Pin
PIEBALDconsult10-Dec-07 15:39
mvePIEBALDconsult10-Dec-07 15:39 
GeneralRe: Constants definitions Pin
KarstenK12-Dec-07 22:42
mveKarstenK12-Dec-07 22:42 
GeneralRe: Constants definitions Pin
supercat911-Dec-07 9:07
supercat911-Dec-07 9:07 
GeneralRe: Constants definitions Pin
Frank Dawson10-Dec-07 15:25
Frank Dawson10-Dec-07 15:25 
GeneralRe: Constants definitions Pin
KarstenK12-Dec-07 22:47
mveKarstenK12-Dec-07 22:47 
GeneralRe: Constants definitions Pin
CurtD13-Dec-07 13:05
CurtD13-Dec-07 13:05 
GeneralThis one made me sigh Pin
CARPETBURNER6-Dec-07 0:40
CARPETBURNER6-Dec-07 0:40 
GeneralRe: This one made me sigh Pin
Sathesh Sakthivel6-Dec-07 1:49
Sathesh Sakthivel6-Dec-07 1:49 
GeneralRe: This one made me sigh Pin
Russell Jones6-Dec-07 2:51
Russell Jones6-Dec-07 2:51 
GeneralRe: This one made me sigh Pin
Mike Dimmick6-Dec-07 22:59
Mike Dimmick6-Dec-07 22:59 

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.