conditional

How to display the <div> as per data count displayed below?

Hi I have to display below snippet according to data available in DB <div id="testimonial-row"> <div id="testimonial"> <ul> <li>"Hello World"</li> </ul> </div> <div id="testimonial"> <ul> <li>"Hello World"</li>...

objected returned as boolean inside if clause

I don't know enough about when and how various variables are returned. Considering I have an conditional statement with an object to validate inside of this. Am I right that this is returned as a boolean value. if($id = $oE->validate($_POST, $_FILES)){ ... } What I really want is for this to return an array of errors if there are any ...

Conditional Comment to run for all browsers except IE 8 and below

how can i write a conditional comment for scripts that should run for all browsers except IE 8 and below? i saw Conditional comment for 'Except IE8' ? but how do i adapt it to include scripts files not inline scripts? ...

Check if a column is a certain value otherwise require value input in Excel.

I have an Excel document that contains 8 columns for testing at work like so: Name | First Try | Second Try | Final Score | P/F (Last, First) | Points | Percent | Points | Percent | Points | Percent | --------------------------------------------------------------------------------- I have the percent...

Is ConditionalAttribute supposed to strip out entire lines, or just method calls?

According to the documentation on the ConditionalAttribute class: Applying ConditionalAttribute to a method indicates to compilers that a call to the method should not be compiled into Microsoft intermediate language (MSIL) unless the conditional compilation symbol that is associated with ConditionalAttribute is defined. ...

Is if(var == true) faster than if(var != false)?

Pretty simple question. I know it would probably be a tiny optimization, but eventually you'll use enough if statements for it to matter. EDIT: Thank you to those of you who have provided answers. To those of you who feel a need to bash me, know that curiosity and a thirst for knowledge do not translate to stupidity. And many thanks t...

Cython conditional compile based on external value

I try to conditionally compile (or generate) to c code from a Cython pxd. I read that I can DEF to define aa value and IF to conditionally generate based on its value, but how can I get this value to get from outside of the pxd file? Specifically these two cases are interesting for me now: give some command-line define to Cython, pref...

Clean up after nant build failures.

I'm looking for my nant build script to be able to clean up after itself if a build goes wrong. I'm looking for something resembling the following execution: Target= Software.Build Target= Software.Build.Success *(depends on Software.Build succeeding)* Target= Software.Build.Failed I am looking for a solution that if the Software.Bu...

Any mental technique to quickly deduce the required ifs/elses in a program with A LOT of conditional logic?

Often in programming, it is a very common requirement that some piece of functionality will require a lot of conditional logic, but not quite enough to warrant a rules engine. For example, testing a number is divisible by x but also a multiple of something, a factor of something else, a square root of something, etc. As you can imagine,...

Refactoring long statement in Python

I have a very long conditional statement for deciding what action to take for a pair of variables a and b. action = 0 if (a==0) else 1 if (a>1 and b==1) else 2 if (a==1 and b>1) else 3 if (a>1 and b>1) else -1 While it is nice with the compactness (in lines;) ) of this statement, it must exist a more elegant way to do this? ...

how to make a xaml control with different view modes

I'm trying to learn how to separate a view from its associated viewmodel, while making the view have as little or no code-behind as possible. my control has a textblock when the object is in a display mode, and a textbox when the user wants to edit that field. In both cases, these controls must bind to the same string in the modelview,...

Conditional SQL ORDER BY ASC/DESC for alpha columns

Writing a stored procedure in MS SQL Server 2008 R2, I want to avoid using DSQL... I would like the sort method (ASC or DESC) to be conditional. Now, with a numeric column I would simply use a case statement and negate the value to emulate ASC or DESC... That is: ... ORDER BY CASE @OrderAscOrDesc WHEN 0 THEN [NumericColumn] ELSE -[Num...

VS IDE Conditional Break Points

I'm using VS 2k8 SP1 (on Win2k8 x64 server), and I notice that a breakpoint with a condition set can produce quite flaky behavior, depending on how deep in the call stack the conditioned-breakpoint is found. So if I place it on a routine deep in my code, the program execution breaks at the right time (I can tell because of console outpu...

Help with foreach loop PHP

Hi. Currently producing a Wordpress plugin that allows for multiple image sliders. At the moment, to make sure that the code is valid I am having to load each sliders dynamic styling into the tags. This is fine, however it loads the styling for all the sliders, which can really start to add a lot of code to the pages source if the users...

jQuery/Javascript: What's wrong with my 'If'?

I have a little hunk of my code here: if(".level-0.find('.children').length == 1"){ $(".level-0 > a").attr("href", ""); }; Basically I'm saying "If Level 0 has a class of '.children', don't rewrite the HREF in it's link!" The problem is that it ALWAYS overwrites the HREF, as if there were no conditional. I've changed that "== ...

Should I use Perl's conditional ? : operator as a switch / case statement or instead of if elsif?

Perl has a conditional operator that is the same a C's conditional operator. To refresh, the conditional operator in C and in Perl is: (test) ? (if test was true) : (if test was false) and if used with an lvalue you can assign and test with one action: my $x= $n==0 ? "n is 0" : "n is not 0"; I was reading Igor Ostrovsky's blog o...

Actionscript 3 Conditional

Hello. I have what I think should be an easy problem. I read through an array and count the occurrences of the values in it, I then write these to some variables, which I want to compare in a conditional. My conditional should trace which number occurs more. Array code: ActionScript Code: private function runCount(scoreArray:Array, c...

PHP behavior of include/require inside conditional

If I place an include or require statement inside a conditional that evaluates to false, will the PHP interpreter skip the include file altogether, or will it load it just in case? An example would be: if ($some_user_var) { require 'this.php'; } else { //do stuff } I read somewhere that require will always be included by the ...

Restrict a method call to a specific page in a .net application (in C#)

Hei, I have a method from a class in a custom library which I would like to restrict to be called only on a specific page, somehow using conditional methods. The problem is that I need a return value and conditional methods do not allow return other than void or 'out' parameters. Using a void method it works fine, but is there a way to a...

What would be an example of an anaphoric conditional in Lisp?

Please explain the code as well. Thanks! ...