Click here to Skip to main content
15,895,606 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: Embrace the dark side - use an ORM Pin
AspDotNetDev21-Oct-10 7:16
protectorAspDotNetDev21-Oct-10 7:16 
GeneralRe: Stored Procs, Packages, Views...Pah! Pin
ohmyletmein21-Oct-10 12:47
ohmyletmein21-Oct-10 12:47 
GeneralRe: Stored Procs, Packages, Views...Pah! Pin
Richard A. Dalton21-Oct-10 23:28
Richard A. Dalton21-Oct-10 23:28 
GeneralRe: Stored Procs, Packages, Views...Pah! Pin
fjdiewornncalwe22-Oct-10 2:25
professionalfjdiewornncalwe22-Oct-10 2:25 
GeneralRe: Stored Procs, Packages, Views...Pah! Pin
Schmuli23-Oct-10 22:19
Schmuli23-Oct-10 22:19 
GeneralRe: Stored Procs, Packages, Views...Pah! Pin
richard_k26-Oct-10 21:48
richard_k26-Oct-10 21:48 
GeneralRe: Stored Procs, Packages, Views...Pah! Pin
marc_k18-Nov-10 0:22
marc_k18-Nov-10 0:22 
GeneralReturn of an old friend Pin
Rob Grainger19-Oct-10 0:02
Rob Grainger19-Oct-10 0:02 
I know I posted an example of this a while ago, but here's another classic example, and I thought some of the other bits in this snippet may amuse you ...

For j = 1 To k
    char = UCase(Mid$(myField, j, 1))

    If InStr(delims, char) <> 0 Then
        If i <> j Then
            buffer = Mid$(myField, i, j - i)
            GoSub addIndex                      ' Nooooooooooooooooooooooooooooooooooooooo
        End If
        i = j + 1
    End If
Next j

If i <> j Then
    buffer = Mid$(myField, i, j - i)
    GoSub addIndex
End If


a bit later in the same routine...

addIndex:
    
    If IsNull(buffer) Then Return
    buffer = Left$(Trim$(buffer), 20)
    
    If Len(buffer) = 0 Then Return
    wordnum = libWordNo(Trim(utilRemoveCrap(buffer)))
  
    If wordnum = 0 Then Return
    If InStr(wordsNow, ";" & CStr(wordnum) & ";") = 0 Then
        wordsNow = wordsNow & CStr(wordnum) & ";"
    End If
  
    If InStr(wordsThen, ";" & CStr(wordnum) & ";") <> 0 Then Return
  
    retSet.AddNew
    retSet![AccountNumber] = recSet![AccountNumber]
    retSet![recordNumber] = recNum
    retSet![wordNo] = wordnum
    retSet.Update
    Return


I should also mention that there's a variable in the same routine called wordNo, and one called wordNum.
Classy stuff.

That dull thudding you can hear in the distance is my head banging against the desk.
JokeRe: Return of an old friend Pin
Chris Meech19-Oct-10 1:47
Chris Meech19-Oct-10 1:47 
GeneralRe: Return of an old friend Pin
Richard A. Dalton19-Oct-10 2:11
Richard A. Dalton19-Oct-10 2:11 
GeneralRe: Return of an old friend Pin
Sauro Viti19-Oct-10 2:19
professionalSauro Viti19-Oct-10 2:19 
GeneralRe: Return of an old friend Pin
_Erik_19-Oct-10 2:53
_Erik_19-Oct-10 2:53 
GeneralRe: Return of an old friend Pin
Rob Grainger19-Oct-10 3:13
Rob Grainger19-Oct-10 3:13 
GeneralRe: Return of an old friend Pin
Richard A. Dalton19-Oct-10 3:29
Richard A. Dalton19-Oct-10 3:29 
GeneralSome more pain (the non-local local) Pin
leppie17-Oct-10 20:28
leppie17-Oct-10 20:28 
GeneralRe: Some more pain (the non-local local) Pin
Bernhard Hiller17-Oct-10 20:45
Bernhard Hiller17-Oct-10 20:45 
GeneralRe: Some more pain (the non-local local) [modified] Pin
leppie17-Oct-10 20:50
leppie17-Oct-10 20:50 
GeneralRe: Some more pain (the non-local local) Pin
BillW3318-Oct-10 5:45
professionalBillW3318-Oct-10 5:45 
GeneralI just got greeted by this PinPopular
leppie17-Oct-10 19:02
leppie17-Oct-10 19:02 
GeneralRe: I just got greeted by this Pin
Jeroen De Dauw17-Oct-10 20:20
Jeroen De Dauw17-Oct-10 20:20 
GeneralRe: I just got greeted by this Pin
leppie17-Oct-10 20:23
leppie17-Oct-10 20:23 
GeneralRe: I just got greeted by this Pin
Richard A. Dalton18-Oct-10 0:17
Richard A. Dalton18-Oct-10 0:17 
GeneralRe: I just got greeted by this Pin
BillW3318-Oct-10 5:42
professionalBillW3318-Oct-10 5:42 
GeneralRe: I just got greeted by this Pin
Jeroen De Dauw18-Oct-10 10:49
Jeroen De Dauw18-Oct-10 10:49 
GeneralRe: I just got greeted by this Pin
Keith Barrow18-Oct-10 6:28
professionalKeith Barrow18-Oct-10 6:28 

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.