Click here to Skip to main content
15,887,083 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: Offered with no comment Pin
Freak303-Mar-14 23:31
Freak303-Mar-14 23:31 
GeneralRe: Offered with no comment Pin
_Maxxx_4-Mar-14 1:13
professional_Maxxx_4-Mar-14 1:13 
GeneralRe: Offered with no comment Pin
BobJanova4-Mar-14 5:01
BobJanova4-Mar-14 5:01 
GeneralRe: Offered with no comment Pin
Tim Carmichael4-Mar-14 5:20
Tim Carmichael4-Mar-14 5:20 
GeneralRe: Offered with no comment Pin
_Maxxx_4-Mar-14 12:37
professional_Maxxx_4-Mar-14 12:37 
GeneralRe: Offered with no comment Pin
NormDroid12-Mar-14 2:16
professionalNormDroid12-Mar-14 2:16 
JokeRe: Offered with no comment Pin
Rahul Rajat Singh3-Apr-14 1:53
professionalRahul Rajat Singh3-Apr-14 1:53 
GeneralGUIDs PinPopular
chayaphum1-Mar-14 23:47
chayaphum1-Mar-14 23:47 
Recently I looked into the source code of one of my colleges.

He wrote:


Private Sub startdestroy()
Dim th As New System.Threading.Thread(AddressOf destroy)

th.Start()

End Sub

Public Sub destroy()
Dim uuid As System.Guid = Nothing
While True
uuid = System.Guid.NewGuid()
End While
End Sub

I didn't understand what he was trying to achieve, so I asked him. Wink | ;) Wink | ;) What is this source code about? OMG | :OMG: This thread is only costing performance doing nothing.
It could cause the garbage collector to throw out of memory exceptions. WTF | :WTF: and the program will be dead Cry | :(( And anyway this strange combination of public and private seems odd to me. OMG | :OMG:

Tell me why you programmed this?

Very simple, told me my college. If I run this code on many computers, a lot of GUIDs will be created.

And capitalism relies on GUIDs . After a few years running my code on as many computers as possible, there are no GUIDs left in this world, and the capitalists cannot transfer money anymore, OMG | :OMG: because they need a way to identify each money transaction in a unique way . I fired this routine in an own thread so nobody will notice what evil thing is going on in the background. Laugh | :laugh: It's a timebomb against capitalism. Smile | :)

This is why I am running this code on many computers. Just to destroy capitalism. Poke tongue | ;-P

I agreed on the point that destroying evil captitalism is a good thing to do. But I said: If you continue your evil work, not only banks and capitalists are effected. Also good institutions like health care are effected. Rescue services can't operate anymore because they are also using GUIDs and they will certainly run out of GUIDs if you continue your evil work. Confused | :confused: Emergency numbers won't work without GUIDs.

I few hours later I got an EMAIL from my college stating rhat
he removed the code because of the great sideeffects. Yes, he agreed that rescue services need GUIDs to store medical data. And that the revenue department needs them too, so they can store financial transactions originating from the Cayman Islands and fight tax offenders.

Instead he will run for parlament in the next general elections. The good sideeffect is: He will earn tons of money , because members of parlament earn much more money than programmers do. Laugh | :laugh:
GeneralRe: GUIDs PinPopular
Duncan Edwards Jones1-Mar-14 23:55
professionalDuncan Edwards Jones1-Mar-14 23:55 
GeneralRe: GUIDs Pin
Florian Rappl1-Mar-14 23:56
professionalFlorian Rappl1-Mar-14 23:56 
GeneralRe: GUIDs Pin
chayaphum2-Mar-14 0:29
chayaphum2-Mar-14 0:29 
GeneralRe: GUIDs Pin
Florian Rappl2-Mar-14 0:40
professionalFlorian Rappl2-Mar-14 0:40 
GeneralRe: GUIDs Pin
OriginalGriff2-Mar-14 0:44
mveOriginalGriff2-Mar-14 0:44 
GeneralRe: GUIDs Pin
Adam R Harris3-Mar-14 9:40
Adam R Harris3-Mar-14 9:40 
GeneralRe: GUIDs Pin
OriginalGriff2-Mar-14 0:06
mveOriginalGriff2-Mar-14 0:06 
GeneralRe: GUIDs Pin
Kornfeld Eliyahu Peter2-Mar-14 0:31
professionalKornfeld Eliyahu Peter2-Mar-14 0:31 
GeneralRe: GUIDs Pin
OriginalGriff2-Mar-14 0:36
mveOriginalGriff2-Mar-14 0:36 
GeneralRe: GUIDs Pin
Kornfeld Eliyahu Peter2-Mar-14 0:40
professionalKornfeld Eliyahu Peter2-Mar-14 0:40 
GeneralRe: GUIDs Pin
OriginalGriff2-Mar-14 1:01
mveOriginalGriff2-Mar-14 1:01 
GeneralRe: GUIDs Pin
thatraja2-Mar-14 0:43
professionalthatraja2-Mar-14 0:43 
GeneralRe: GUIDs Pin
Jörgen Andersson2-Mar-14 0:22
professionalJörgen Andersson2-Mar-14 0:22 
GeneralRe: GUIDs Pin
OriginalGriff2-Mar-14 0:29
mveOriginalGriff2-Mar-14 0:29 
GeneralRe: GUIDs Pin
Kornfeld Eliyahu Peter2-Mar-14 0:35
professionalKornfeld Eliyahu Peter2-Mar-14 0:35 
GeneralRe: GUIDs Pin
Jörgen Andersson2-Mar-14 1:35
professionalJörgen Andersson2-Mar-14 1:35 
GeneralRe: GUIDs Pin
JimmyRopes2-Mar-14 1:11
professionalJimmyRopes2-Mar-14 1:11 

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.