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: Found this today Pin
Bernhard Hiller21-Jan-14 21:10
Bernhard Hiller21-Jan-14 21:10 
GeneralRe: Found this today Pin
PIEBALDconsult22-Jan-14 2:45
mvePIEBALDconsult22-Jan-14 2:45 
GeneralRe: Found this today Pin
Vladimir Svyatski22-Jan-14 4:05
professionalVladimir Svyatski22-Jan-14 4:05 
GeneralRe: Found this today Pin
Middle Manager22-Jan-14 4:10
Middle Manager22-Jan-14 4:10 
GeneralRe: Found this today Pin
Super Lloyd22-Jan-14 13:10
Super Lloyd22-Jan-14 13:10 
GeneralMessage Closed Pin
21-Jan-14 2:34
Sampath Lokuge21-Jan-14 2:34 
GeneralMessage Removed Pin
21-Jan-14 2:47
professionalArgonia21-Jan-14 2:47 
GeneralAh the joys of working in a team Pin
Argonia21-Jan-14 1:49
professionalArgonia21-Jan-14 1:49 
After long though i decided to share this wonderful gem in c#
Today cannot get "better".

C#
/// Get value that corresponds to menu name or menu id.
/// <param name="name"> Menu name. </param>
/// <param name="id"> Menu id. </param>
/// <returns> enum value. </returns>
public enumType GetValueByInfo(string name, string id)
{
    enumType result = enumDictionary[id];
    return result;
}


And the enumDictionary is just declared Dictionary<string, enumtype=""> with (string, enumType) pairs
The names are changed.
This beautiful thing is written in c# from someone else than me, a colleague who worked longer than me in the firm. He is working mainly with c# projects i am working mainly with vc++ and MFC(oh the joy) When i have to change something my boss always says to me to write it in the same manner like the things are done in the project.
The worst part is this gem is written in my dll (the dll i should be working but all other are adding things but me)
I hate when someone else is touching my code.
Microsoft ... the only place where VARIANT_TRUE != true

GeneralRe: Ah the joys of working in a team Pin
JMK8921-Jan-14 2:03
professionalJMK8921-Jan-14 2:03 
GeneralRe: Ah the joys of working in a team Pin
Argonia21-Jan-14 2:14
professionalArgonia21-Jan-14 2:14 
GeneralRe: Ah the joys of working in a team Pin
Freak3022-Jan-14 1:25
Freak3022-Jan-14 1:25 
GeneralRe: Ah the joys of working in a team Pin
Ravi Bhavnani21-Jan-14 2:37
professionalRavi Bhavnani21-Jan-14 2:37 
GeneralRe: Ah the joys of working in a team Pin
Shameel21-Jan-14 3:23
professionalShameel21-Jan-14 3:23 
GeneralRe: Ah the joys of working in a team Pin
Ravi Bhavnani21-Jan-14 4:58
professionalRavi Bhavnani21-Jan-14 4:58 
GeneralAnother gem from the VB6 code I'm "porting" Pin
Rob Grainger16-Jan-14 23:25
Rob Grainger16-Jan-14 23:25 
GeneralRe: Another gem from the VB6 code I'm "porting" Pin
NormDroid16-Jan-14 23:51
professionalNormDroid16-Jan-14 23:51 
GeneralRe: Another gem from the VB6 code I'm "porting" Pin
Rob Grainger17-Jan-14 0:01
Rob Grainger17-Jan-14 0:01 
GeneralRe: Another gem from the VB6 code I'm "porting" Pin
Chris Quinn17-Jan-14 3:11
Chris Quinn17-Jan-14 3:11 
GeneralRe: Another gem from the VB6 code I'm "porting" Pin
Rob Grainger17-Jan-14 3:16
Rob Grainger17-Jan-14 3:16 
GeneralRe: Another gem from the VB6 code I'm "porting" Pin
Richard Deeming17-Jan-14 1:33
mveRichard Deeming17-Jan-14 1:33 
GeneralRe: Another gem from the VB6 code I'm "porting" Pin
Rob Grainger17-Jan-14 3:10
Rob Grainger17-Jan-14 3:10 
GeneralRe: Another gem from the VB6 code I'm "porting" Pin
Richard Deeming17-Jan-14 3:35
mveRichard Deeming17-Jan-14 3:35 
GeneralRe: Another gem from the VB6 code I'm "porting" Pin
Ron Beyer17-Jan-14 4:48
professionalRon Beyer17-Jan-14 4:48 
GeneralRe: Another gem from the VB6 code I'm "porting" Pin
Freak3019-Jan-14 23:41
Freak3019-Jan-14 23:41 
GeneralRe: Another gem from the VB6 code I'm "porting" Pin
Sentenryu20-Jan-14 4:00
Sentenryu20-Jan-14 4:00 

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.