Click here to Skip to main content
15,884,425 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.

 
AnswerRe: Tricking Microsoft and being shamless Pin
PivotTableCell9-Aug-11 9:23
PivotTableCell9-Aug-11 9:23 
GeneralRe: Tricking Microsoft and being shamless Pin
xavier morera9-Aug-11 10:19
xavier morera9-Aug-11 10:19 
GeneralRe: Tricking Microsoft and being shamless Pin
ghle9-Aug-11 13:43
ghle9-Aug-11 13:43 
GeneralRe: Tricking Microsoft and being shamless Pin
thoiness1-Sep-11 5:01
thoiness1-Sep-11 5:01 
GeneralRe: Tricking Microsoft and being shamless Pin
xavier morera1-Sep-11 7:35
xavier morera1-Sep-11 7:35 
GeneralRe: Tricking Microsoft and being shamless Pin
thoiness1-Sep-11 7:37
thoiness1-Sep-11 7:37 
GeneralRe: Tricking Microsoft and being shamless Pin
xavier morera1-Sep-11 7:41
xavier morera1-Sep-11 7:41 
GeneralThe Perfect Loop PinPopular
Richard X Menezes5-Aug-11 11:04
Richard X Menezes5-Aug-11 11:04 
I was doing a code review last week for a simple change which I had asked one of my team member to do.

We were looping through the details of the File we downloaded and doing processing depending up whether it's type A or type B (This code was already there)

C#
foreach(MyfileInfo fil from files)
{
   switch (fil.MyFileType)
   {
      case A:
      //Do some work for file A
      break;

      case B:
      //Do some work for file B
      break; 
   }
}


All That I had asked that person to do was to to change the way File B was processed. And this is what I got. Frown | :(

C#
foreach(MyfileInfo fil from files)
{
   switch (fil.MyFileType)
   {
      case A:
      //Do some work for file A
      break;

      case B:
      foreach(MyfileInfo fil2 from files)
      {
         switch (fil2.MyFileType)
         {
            case A:
            break;

            case B:
            //Do new work for File B.
            break;
         }
      }
      break
   }
}


So if there were 50 files downloaded of type B the processing was happening 50*50= 2500 times Cry | :(( Cry | :((
- Richard Menezes

GeneralRe: The Perfect Loop Pin
Jeroen De Dauw5-Aug-11 13:20
Jeroen De Dauw5-Aug-11 13:20 
GeneralRe: The Perfect Loop Pin
BillW336-Aug-11 1:07
professionalBillW336-Aug-11 1:07 
GeneralRe: The Perfect Loop Pin
Richard X Menezes8-Aug-11 5:08
Richard X Menezes8-Aug-11 5:08 
GeneralRe: The Perfect Loop Pin
Tom Chantler9-Aug-11 2:46
professionalTom Chantler9-Aug-11 2:46 
GeneralInfinite Loop Pin
Colin Mullikin5-Aug-11 5:12
professionalColin Mullikin5-Aug-11 5:12 
GeneralRe: Infinite Loop Pin
Gary R. Wheeler7-Aug-11 0:55
Gary R. Wheeler7-Aug-11 0:55 
GeneralHopeless cases [modified] Pin
Lutosław4-Aug-11 22:44
Lutosław4-Aug-11 22:44 
GeneralRe: Hopeless cases Pin
V.4-Aug-11 23:47
professionalV.4-Aug-11 23:47 
JokeRe: Hopeless cases Pin
Freak305-Aug-11 2:43
Freak305-Aug-11 2:43 
GeneralRe: Hopeless cases PinPopular
Ian Shlasko5-Aug-11 3:24
Ian Shlasko5-Aug-11 3:24 
GeneralRe: Hopeless cases Pin
fjdiewornncalwe5-Aug-11 3:33
professionalfjdiewornncalwe5-Aug-11 3:33 
GeneralRe: Hopeless cases PinPopular
Ian Shlasko5-Aug-11 4:07
Ian Shlasko5-Aug-11 4:07 
GeneralRe: Hopeless cases Pin
Lutosław5-Aug-11 3:50
Lutosław5-Aug-11 3:50 
GeneralRe: Hopeless cases Pin
Ian Shlasko5-Aug-11 4:08
Ian Shlasko5-Aug-11 4:08 
GeneralRe: Hopeless cases [modified] Pin
John Y.17-Nov-11 7:06
John Y.17-Nov-11 7:06 
GeneralSQL between Pin
wizardzz28-Jul-11 11:42
wizardzz28-Jul-11 11:42 
GeneralRe: SQL between Pin
GuyThiebaut30-Jul-11 11:47
professionalGuyThiebaut30-Jul-11 11:47 

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.