Click here to Skip to main content
15,126,567 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: Not really a question of how-do-I... Pin
Member 205300623-Sep-13 2:01
MemberMember 205300623-Sep-13 2:01 
QuestionRe: Not really a question of how-do-I... Pin
Eddy Vluggen23-Sep-13 4:40
professionalEddy Vluggen23-Sep-13 4:40 
GeneralRe: Not really a question of how-do-I... Pin
Suvabrata Roy23-Sep-13 4:26
professionalSuvabrata Roy23-Sep-13 4:26 
GeneralRe: Not really a question of how-do-I... Pin
Dan Neely24-Sep-13 3:57
MemberDan Neely24-Sep-13 3:57 
GeneralRe: Not really a question of how-do-I... Pin
0bx24-Sep-13 5:07
Member0bx24-Sep-13 5:07 
GeneralRe: Not really a question of how-do-I... Pin
PIEBALDconsult24-Sep-13 16:37
professionalPIEBALDconsult24-Sep-13 16:37 
GeneralRe: Not really a question of how-do-I... Pin
Brisingr Aerowing10-Oct-13 10:21
professionalBrisingr Aerowing10-Oct-13 10:21 
GeneralRe: Not really a question of how-do-I... Pin
BuggyTimes25-Sep-13 4:38
MemberBuggyTimes25-Sep-13 4:38 
Maybe it's just my brain but the ternary expression is clearer for me Smile | :) That being the case I'd never write it this way in code. Complex conditions would most likely be moved into variables like someone has answered already, i.e.:

C#
bool tabsAreLogical = logicalTabs ? tabs_General1.cbException.Focused : tabs_General1.cbJobStatus.Focused;

if(tabsAreLogical && e.KeyCode == Keys.Up) {

}


This makes it easier to read/change later, as well as making the condition reusable later in code.
GeneralAnyone see the problem here? Pin
Mardy Git19-Sep-13 23:50
MemberMardy Git19-Sep-13 23:50 
GeneralRe: Anyone see the problem here? Pin
BotCar19-Sep-13 23:57
MemberBotCar19-Sep-13 23:57 
GeneralRe: Anyone see the problem here? Pin
Sentenryu20-Sep-13 3:30
MemberSentenryu20-Sep-13 3:30 
GeneralRe: Anyone see the problem here? Pin
BotCar20-Sep-13 3:51
MemberBotCar20-Sep-13 3:51 
GeneralRe: Anyone see the problem here? Pin
Argonia20-Sep-13 0:50
professionalArgonia20-Sep-13 0:50 
GeneralRe: Anyone see the problem here? Pin
Mardy Git20-Sep-13 0:56
MemberMardy Git20-Sep-13 0:56 
GeneralRe: Anyone see the problem here? Pin
Richard Deeming20-Sep-13 3:01
mveRichard Deeming20-Sep-13 3:01 
GeneralRe: Anyone see the problem here? Pin
PIEBALDconsult21-Sep-13 1:44
professionalPIEBALDconsult21-Sep-13 1:44 
GeneralRe: Anyone see the problem here? Pin
Bernhard Hiller22-Sep-13 23:17
MemberBernhard Hiller22-Sep-13 23:17 
GeneralStoopid me Pin
Marco Bertschi16-Sep-13 5:56
professionalMarco Bertschi16-Sep-13 5:56 
GeneralRe: Stoopid me Pin
Nicholas Marty16-Sep-13 6:29
professionalNicholas Marty16-Sep-13 6:29 
GeneralRe: Stoopid me Pin
Marco Bertschi16-Sep-13 6:32
professionalMarco Bertschi16-Sep-13 6:32 
GeneralRe: Stoopid me Pin
Freak3016-Sep-13 22:27
MemberFreak3016-Sep-13 22:27 
GeneralRe: Stoopid me Pin
Marco Bertschi16-Sep-13 23:11
professionalMarco Bertschi16-Sep-13 23:11 
GeneralRe: Stoopid me Pin
Sentenryu17-Sep-13 1:36
MemberSentenryu17-Sep-13 1:36 
GeneralRe: Stoopid me Pin
Marco Bertschi17-Sep-13 2:27
professionalMarco Bertschi17-Sep-13 2:27 
GeneralRe: Stoopid me Pin
Rob Grainger19-Sep-13 1:34
MemberRob Grainger19-Sep-13 1:34 

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.