Click here to Skip to main content

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, embarrasing 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.

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralHandling "Special" Cases in "Special" WaysprotectorAspDotNetDev23-Jan-13 14:14 
A sample of the code I'm working on now:
TimeZone = If(item.Descendants("DisplayableDateTime").Attributes("TimeZone").ElementAt(0).Value <> "", item.Descendants("DisplayableDateTime").Attributes("TimeZone").ElementAt(0).Value, "")
In short, set the result to the value when the value is not an empty string; otherwise, set the result to an empty string.
 
Cry | :((

GeneralRe: Handling "Special" Cases in "Special" Ways PinmemberPIEBALDconsult23-Jan-13 20:38 
What language is that?
GeneralRe: Handling "Special" Cases in "Special" Ways PinmemberRobert Rohde23-Jan-13 20:42 
VB.Net
GeneralRe: Handling "Special" Cases in "Special" Ways PinmemberPIEBALDconsult23-Jan-13 20:49 
Something similar I catch myself almost writing is along the lines of:
 
if ( x <> y ) x = y
 
Sigh | :sigh:
GeneralRe: Handling "Special" Cases in "Special" Ways Pinmemberpeterchen28-Jan-13 21:57 
Are you by chance working in a funny language where !(a<>b) does not mean b can be used instead of a in all contexts?
 
Let's say you have a language where null == "" (for simplicity, you know?) Then you have an API that does not follow that convention and throws on a null.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   


Advertise | Privacy | Mobile
Web03 | 2.6.130619.1 | Last Updated 20 Jun 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid