Click here to Skip to main content
15,897,704 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: reviewing old code Pin
ekolis16-Feb-12 14:12
ekolis16-Feb-12 14:12 
GeneralRe: reviewing old code Pin
0bx16-Feb-12 23:10
0bx16-Feb-12 23:10 
GeneralRe: reviewing old code Pin
Stefan_Lang17-Feb-12 1:55
Stefan_Lang17-Feb-12 1:55 
GeneralRe: reviewing old code Pin
AspDotNetDev16-Feb-12 14:28
protectorAspDotNetDev16-Feb-12 14:28 
GeneralRe: reviewing old code Pin
0bx16-Feb-12 23:01
0bx16-Feb-12 23:01 
GeneralRe: reviewing old code Pin
AspDotNetDev17-Feb-12 7:04
protectorAspDotNetDev17-Feb-12 7:04 
GeneralRe: reviewing old code Pin
TorstenFrings16-Feb-12 23:21
TorstenFrings16-Feb-12 23:21 
GeneralRe: reviewing old code Pin
Nagy Vilmos17-Feb-12 0:28
professionalNagy Vilmos17-Feb-12 0:28 
On the no need for recursion and getting rid of the goto, can I add only doing a single shuffle:

C#
protected void Page_Load(object sender, EventArgs e)
{
    List<Node> Stuff = loadStuff();
}

/// Create a list of nodes.
/// Takes the child nodes from the current node and loads at
/// least 100 items into the list.  If there are currently 30 child nodes
/// this will return 120 items in the list.
private List<Node> loadStuff()
{
    List<Node> Stuff = new List<Node>();
    do {
        foreach (Node thing in Node.GetCurrent().Children)
        {
            Stuff.Add(thing);
        }
    } while (Stuff.Count < 100 && Stuff.Count > 0))

    return ShuffleNodeList(Stuff);
}


Nice, self contained and easy to follow.


Panic, Chaos, Destruction. My work here is done.
Drink. Get drunk. Fall over - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer
Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett

GeneralRe: reviewing old code Pin
0bx17-Feb-12 5:29
0bx17-Feb-12 5:29 
GeneralRe: reviewing old code Pin
Francis W. Porretto17-Feb-12 0:54
Francis W. Porretto17-Feb-12 0:54 
GeneralRe: reviewing old code Pin
Robert Heffernan17-Feb-12 0:55
Robert Heffernan17-Feb-12 0:55 
GeneralRe: reviewing old code Pin
PIEBALDconsult17-Feb-12 2:34
mvePIEBALDconsult17-Feb-12 2:34 
GeneralRe: reviewing old code Pin
Harley L. Pebley17-Feb-12 5:43
Harley L. Pebley17-Feb-12 5:43 
GeneralRe: reviewing old code Pin
englebart20-Feb-12 4:38
professionalenglebart20-Feb-12 4:38 
GeneralRe: reviewing old code Pin
KP Lee23-Feb-12 19:00
KP Lee23-Feb-12 19:00 
GeneralDefinition of 100% sure Pin
Lal Miah15-Feb-12 19:10
Lal Miah15-Feb-12 19:10 
GeneralRe: Definition of 100% sure Pin
krumia15-Feb-12 19:26
krumia15-Feb-12 19:26 
GeneralRe: Definition of 100% sure Pin
Mohibur Rashid15-Feb-12 19:28
professionalMohibur Rashid15-Feb-12 19:28 
GeneralChanges goes whong PinPopular
sergiogarcianinja15-Feb-12 3:32
sergiogarcianinja15-Feb-12 3:32 
GeneralRe: Changes goes whong Pin
BobJanova15-Feb-12 3:43
BobJanova15-Feb-12 3:43 
GeneralRe: Changes goes whong Pin
sergiogarcianinja15-Feb-12 3:51
sergiogarcianinja15-Feb-12 3:51 
GeneralRe: Changes goes whong Pin
TorstenFrings15-Feb-12 23:26
TorstenFrings15-Feb-12 23:26 
GeneralRe: Changes goes whong Pin
ekolis16-Feb-12 14:18
ekolis16-Feb-12 14:18 
GeneralRe: Changes goes whong Pin
BloodyBaron19-Feb-12 1:11
BloodyBaron19-Feb-12 1:11 
GeneralRe: Changes goes whong Pin
GenJerDan15-Feb-12 7:39
GenJerDan15-Feb-12 7:39 

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.