Click here to Skip to main content
15,889,877 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: Date sting formatting, the easy way. Pin
Teuz2-Mar-10 2:22
Teuz2-Mar-10 2:22 
Generalif and if not do it anyway Pin
TorstenH.17-Dec-09 23:57
TorstenH.17-Dec-09 23:57 
GeneralRe: if and if not do it anyway Pin
KarstenK18-Dec-09 1:28
mveKarstenK18-Dec-09 1:28 
GeneralRe: if and if not do it anyway Pin
Lutosław20-Dec-09 2:21
Lutosław20-Dec-09 2:21 
GeneralRe: if and if not do it anyway Pin
David Skelly18-Dec-09 1:38
David Skelly18-Dec-09 1:38 
GeneralRe: if and if not do it anyway Pin
TorstenH.18-Dec-09 4:25
TorstenH.18-Dec-09 4:25 
GeneralRe: if and if not do it anyway Pin
PanchoM18-Dec-09 7:52
PanchoM18-Dec-09 7:52 
GeneralRe: if and if not do it anyway Pin
supercat918-Dec-09 8:22
supercat918-Dec-09 8:22 
TorstenH. wrote:
yes, think so too. unfortunatly he managed to compare one boolean with itself, which makes it nonfunctional.


It looks like he's comparing two similarly-named but different properties (bKVSatzInklSonderbeitragProperty and bKVSatzInklSonderbeitrag). The code is redundant in that it would be more efficient to say:
if (a && !b)
  action1();
else if (b && !a)
  action2();

than to say
if (!!(a) != !!(b))
{
  if (a)
    action1();
  else
    action2();
}

which is what the latter effectively does. On the other hand, the latter formulation would allow code to be executed before or after action1/action2 any time either was executed (e.g. if action1 or action2 set a visual property for a control, one could use common code to force a refresh).
GeneralRe: if and if not do it anyway Pin
TorstenH.20-Dec-09 20:19
TorstenH.20-Dec-09 20:19 
GeneralRe: if and if not do it anyway Pin
supercat921-Dec-09 4:33
supercat921-Dec-09 4:33 
GeneralRe: if and if not do it anyway Pin
RichardM130-Dec-09 10:49
RichardM130-Dec-09 10:49 
GeneralWho needs childNodes when you have innerHTML? Pin
ClementsDan17-Dec-09 13:55
ClementsDan17-Dec-09 13:55 
GeneralNullabilityatastic Pin
Keith Barrow15-Dec-09 5:29
professionalKeith Barrow15-Dec-09 5:29 
JokeRe: Nullabilityatastic Pin
Jeroen De Dauw15-Dec-09 6:26
Jeroen De Dauw15-Dec-09 6:26 
JokeRe: Nullabilityatastic Pin
Ian Shlasko15-Dec-09 6:29
Ian Shlasko15-Dec-09 6:29 
GeneralRe: Nullabilityatastic [modified] Pin
Don Kackman16-Dec-09 8:57
Don Kackman16-Dec-09 8:57 
GeneralRe: Nullabilityatastic Pin
Super Lloyd16-Dec-09 10:53
Super Lloyd16-Dec-09 10:53 
JokeRe: Nullabilityatastic Pin
Jeremy Tierman17-Dec-09 5:49
Jeremy Tierman17-Dec-09 5:49 
GeneralRe: Nullabilityatastic Pin
BillW3319-Jan-10 10:45
professionalBillW3319-Jan-10 10:45 
GeneralRe: Nullabilityatastic Pin
Camilo Sanchez6-Feb-10 20:39
Camilo Sanchez6-Feb-10 20:39 
GeneralLet's just make sure? Pin
_Maxxx_14-Dec-09 18:54
professional_Maxxx_14-Dec-09 18:54 
GeneralRe: Let's just make sure? Pin
Peter_in_278014-Dec-09 19:09
professionalPeter_in_278014-Dec-09 19:09 
GeneralRe: Let's just make sure? Pin
Jeroen De Dauw15-Dec-09 4:22
Jeroen De Dauw15-Dec-09 4:22 
GeneralRe: Let's just make sure? Pin
Super Lloyd15-Dec-09 17:39
Super Lloyd15-Dec-09 17:39 
GeneralRe: Let's just make sure? Pin
Member 35753716-Dec-09 8:30
Member 35753716-Dec-09 8:30 

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.