Click here to Skip to main content
15,896,154 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: useless... Pin
Jeroen De Dauw6-Jun-10 22:55
Jeroen De Dauw6-Jun-10 22:55 
GeneralRe: useless... Pin
J4amieC6-Jun-10 23:44
J4amieC6-Jun-10 23:44 
GeneralRe: useless... Pin
supercat97-Jun-10 6:08
supercat97-Jun-10 6:08 
GeneralRe: useless... PinPopular
J4amieC7-Jun-10 6:31
J4amieC7-Jun-10 6:31 
GeneralRe: useless... Pin
supercat97-Jun-10 8:52
supercat97-Jun-10 8:52 
GeneralRe: useless... Pin
PIEBALDconsult8-Jun-10 3:21
mvePIEBALDconsult8-Jun-10 3:21 
GeneralRe: useless... Pin
Hired Mind13-Jul-10 10:23
Hired Mind13-Jul-10 10:23 
GeneralWhen you got your numbers, who needs other types Pin
Yusuf3-Jun-10 8:12
Yusuf3-Jun-10 8:12 
I have being trying to modify a legecy vb com code. First of all, when it is vb you thing nothing can be right. Then you come across something that is shear madness

Public Function UpdateOrderState(ByVal oldState As Long, ByVal newState As Long)
   Dim StockDir As Long, StockChange As Boolean
   StockChange = True
   
   Select Case 10 * oldState + newState
        'Case 12, 32 added more options
        Case 12, 32, 42, 52, 62, 72
            StockDir = -1
        'Case 21, 23 added more options
        Case 21, 23, 24, 25, 26, 27
            StockDir = 1
        Case Else
            StockChange = False
    End Select

    If StockChange Then
       'Code removed
    End If
End Function


What it is doing is that, it is trying to figure out a state change from one to another. All applicable states have values. Now, what if the value of the states change? Mad | :mad:

GeneralRe: When you got your numbers, who needs other types Pin
Dan Mos3-Jun-10 9:15
Dan Mos3-Jun-10 9:15 
GeneralRe: When you got your numbers, who needs other types Pin
Ian Shlasko3-Jun-10 9:17
Ian Shlasko3-Jun-10 9:17 
GeneralRe: When you got your numbers, who needs other types Pin
Yusuf3-Jun-10 9:50
Yusuf3-Jun-10 9:50 
GeneralRe: When you got your numbers, who needs other types PinPopular
Andrew Rissing3-Jun-10 9:36
Andrew Rissing3-Jun-10 9:36 
GeneralRe: When you got your numbers, who needs other types Pin
DaveyM694-Jun-10 10:43
professionalDaveyM694-Jun-10 10:43 
GeneralRe: When you got your numbers, who needs other types PinPopular
Thomas Krojer3-Jun-10 21:56
Thomas Krojer3-Jun-10 21:56 
GeneralRe: When you got your numbers, who needs other types Pin
_Erik_3-Jun-10 23:56
_Erik_3-Jun-10 23:56 
GeneralRe: When you got your numbers, who needs other types Pin
Jeremy Hutchinson4-Jun-10 9:12
professionalJeremy Hutchinson4-Jun-10 9:12 
GeneralRe: When you got your numbers, who needs other types Pin
Yusuf4-Jun-10 10:45
Yusuf4-Jun-10 10:45 
GeneralSize Matters Take Two Pin
Paul Hooper27-May-10 3:19
Paul Hooper27-May-10 3:19 
GeneralRe: Size Matters Take Two Pin
ricmil4227-May-10 5:24
ricmil4227-May-10 5:24 
GeneralRe: Size Matters Take Two Pin
CDP180228-May-10 2:43
CDP180228-May-10 2:43 
GeneralRe: Size Matters Take Two Pin
Nagy Vilmos4-Jun-10 10:20
professionalNagy Vilmos4-Jun-10 10:20 
GeneralRe: Size Matters Take Two Pin
Luc Pattyn4-Jun-10 11:40
sitebuilderLuc Pattyn4-Jun-10 11:40 
GeneralRe: Size Matters Take Two Pin
Hired Mind13-Jul-10 10:31
Hired Mind13-Jul-10 10:31 
GeneralRe: Size Matters Take Two Pin
Jeroen De Dauw27-May-10 5:25
Jeroen De Dauw27-May-10 5:25 
GeneralRe: Size Matters Take Two Pin
Dan Mos30-May-10 6:24
Dan Mos30-May-10 6:24 

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.