Click here to Skip to main content
15,887,214 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: Things that make you go WTF... Pin
BobJanova3-Apr-13 23:29
BobJanova3-Apr-13 23:29 
GeneralRe: Things that make you go WTF... Pin
Gary Wheeler4-Apr-13 0:44
Gary Wheeler4-Apr-13 0:44 
GeneralThat was weird... Pin
Brisingr Aerowing28-Mar-13 7:57
professionalBrisingr Aerowing28-Mar-13 7:57 
GeneralRe: That was weird... Pin
Julien Villers8-Apr-13 5:10
professionalJulien Villers8-Apr-13 5:10 
GeneralRe: That was weird... Pin
Brisingr Aerowing8-Apr-13 14:06
professionalBrisingr Aerowing8-Apr-13 14:06 
GeneralExternal System's Table's View's Table's View ('s Tables?) Pin
AspDotNetDev26-Mar-13 12:38
protectorAspDotNetDev26-Mar-13 12:38 
GeneralRe: External System's Table's View's Table's View ('s Tables?) Pin
Brisingr Aerowing5-Apr-13 5:16
professionalBrisingr Aerowing5-Apr-13 5:16 
GeneralFound this a few minutes ago Pin
SomeGuyThatIsMe26-Mar-13 10:51
SomeGuyThatIsMe26-Mar-13 10:51 
Found this in a sp, not sure why it was done this way, @fileLength and @userId are passed in, and i've changed the names of the tables so i could post this, so i realize the tables may not make sense(they do in the real code).

SQL
DECLARE file_Cursor CURSOR FOR SELECT Length
                                 FROM Files f
                                INNER JOIN User p
                                   ON p.UserId    = f.UserId
                                INNER JOIN Playlist pm
                                   ON pm.ListId = p.DefaultListId
                                WHERE p.UserId  = @userId
                                  AND pm.FileNumber <> -1

-- get total length
 OPEN file_Cursor 
FETCH NEXT FROM file_Cursor INTO @length
       
   WHILE @@FETCH_STATUS = 0
   BEGIN                                           
        SET @fileLength = @fileLength + @length   
                            
        FETCH NEXT FROM file_Cursor INTO @length
   END
             
CLOSE file_Cursor 
DEALLOCATE file_Cursor 

Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

GeneralRe: Found this a few minutes ago Pin
Jan Steyn28-Mar-13 0:56
Jan Steyn28-Mar-13 0:56 
GeneralRe: Found this a few minutes ago Pin
SomeGuyThatIsMe28-Mar-13 3:34
SomeGuyThatIsMe28-Mar-13 3:34 
GeneralRe: Found this a few minutes ago Pin
agolddog29-Mar-13 3:39
agolddog29-Mar-13 3:39 
GeneralRe: Found this a few minutes ago Pin
Leng Vang29-Mar-13 6:35
Leng Vang29-Mar-13 6:35 
GeneralRe: Found this a few minutes ago Pin
jschell29-Mar-13 10:43
jschell29-Mar-13 10:43 
GeneralRe: Found this a few minutes ago Pin
SomeGuyThatIsMe1-Apr-13 2:16
SomeGuyThatIsMe1-Apr-13 2:16 
GeneralRe: Found this a few minutes ago Pin
jschell1-Apr-13 8:08
jschell1-Apr-13 8:08 
GeneralRe: Found this a few minutes ago Pin
StatementTerminator1-Apr-13 9:58
StatementTerminator1-Apr-13 9:58 
GeneralFor your next job interview PinPopular
Gary Wheeler15-Mar-13 1:02
Gary Wheeler15-Mar-13 1:02 
GeneralRe: For your next job interview Pin
Pranit Kothari15-Mar-13 1:22
Pranit Kothari15-Mar-13 1:22 
GeneralRe: For your next job interview Pin
Gary Wheeler15-Mar-13 1:26
Gary Wheeler15-Mar-13 1:26 
GeneralRe: For your next job interview Pin
Pete O'Hanlon15-Mar-13 1:34
mvePete O'Hanlon15-Mar-13 1:34 
GeneralRe: For your next job interview Pin
Gary Wheeler15-Mar-13 1:44
Gary Wheeler15-Mar-13 1:44 
GeneralRe: For your next job interview Pin
Marco Bertschi15-Mar-13 2:10
protectorMarco Bertschi15-Mar-13 2:10 
GeneralRe: For your next job interview Pin
Gary Wheeler15-Mar-13 2:19
Gary Wheeler15-Mar-13 2:19 
GeneralRe: For your next job interview Pin
SoMad28-Mar-13 22:54
professionalSoMad28-Mar-13 22:54 
GeneralRe: For your next job interview Pin
Marco Bertschi15-Mar-13 2:19
protectorMarco Bertschi15-Mar-13 2:19 

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.