conditional

php - scope issues finding why var is empty on code excerpt.

$roidInfo = ''; $nomeDominio =''; if (isset($_GET['infoDominio'])) { $nomeDominio = filter_input(INPUT_GET, 'nomeDominio', FILTER_SANITIZE_STRING); $dominioVo->setNome($nomeDominio); try { ... $roidInfo = isset($infoDominio['roid']) ? $infoDominio['roid'] : ''; } catch (EppCommandsExcepti...

Having problems converting conditional where clause in LINQ back over to SQL

Hello all. I've got myself in a bit of a pickle! I've done a snazzy LINQ statement that does the job in my web app, but now I'd like to use this in a stored procedure: var r = (from p in getautocompleteweightsproducts.tblWeights where p.MemberId == memberid && p.LocationId == location...

sql server conditional where

select * from table where category=@categoryid I'm not sure how easy is this but I couldn't get my head around it. I want to be able to change where clause on above query so that if use 0 instead of 1-2-3 or 4 as @categoryid it would select all categories. i don't have any category with 0 in database. ...

Quartz Composer: switch video inputs with mouse.

Hello. Scenario: two Quicktime movie inputs, one plays on loop unless user clicks left mouse button, in which case second movie plays until the end, then first movie plays. Logically I can see it using a conditional. If number = 1, loop movie 1. If mouse click, number = 2, movie 2 plays. At end of play, number = 1, loop movie 1. Wh...

buttons conditioned by supported parameters

I'd like to create a list of buttons that depend on device supported parameters ; for example, if the device's camera supports setting white balance and antibanding, then 2 corresponding buttons are displayed to allow the user to changes these settings; but if I run the same App on a device that supports only setting for white balance, t...

Conditional Random Fields -- How Do They Work?

I've read the papers linked to in this question. I half get it. Can someone help me figure out how to implement it? I assume that features are generated by some heuristic. Using a POS-tagger as an example; Maybe looking at training data shows that 'bird' is tagged with NOUN in all cases, so feature f1(z_(n-1),z_n,X,n) is generated as (...

Conditional Regular Expression in Java?

I have a conditional regular expression that works on regex test websites, such as regexlib.com, but cannot get it to work in my Java application. But, http://www.regular-expressions.info/conditional.html indicates that Java doesn't support conditionals, but I've seen other posts on SO imply that it does. An example of my RegEx is:...

LINQ Conditional Sum Calculation - cannot be applied to operands of type 'int' and 'bool'

I am trying to perform to calculation. I have a donations (d) table that contains Quantity Needed (d.QtyNeeded) and I need to determine the numbers of items still needed by pulling quantity filled (qtyfilled) from the donors table. Not every donation has a donor, so I need a conditional statement to handle nulls so the sum will work. ...

Syntax or construct to simplify if() statement?

I'm looking for a semantic or language construct that will simplify some of my if statements. If I have an if statement with an or, where I 'choose' between two values, I'd like to have that chosen variable available later on in the code. I'll write this in pseudo-code: if ( x or y ) { function(z); } Where z is the value of x o...

Is there a cleaner way to add "else if" to assignment conditional in Awk, etc.?

Certain languages like awk script allow for conditional assignments. For example, say you had a list file in the format: <item name, no spaces> <price as float> e.g. Grape 4.99 JuicyFruitGum 0.45 Candles 5.99 And you wanted to tax everything over $1... you could use the awk script: awk '{a=($2>1.00)?$2*1.06:$2; print a}' prices.d...

Does the order of expression to check in boolean statement affect performance

If I have a Boolean expression to check (A && B) If A is found to be false will the language bother to check B? Does this vary from language to language? The reason I ask is that I'm wondering if it's the case that B is checked even if A is false then wouldn't if (A) { if(B) { } else { // code x } } else { // code x }...

menu control css based on childitems

Hi I need to set the css on some menu items on its hover based on whether they have childitems or not. "Home" "Manage Customer" "Manage Employee" "Customer List" "Employee List" "Customer Detail" "Employee Detail" The sample menuitems are shown above. I want "Home","...

Greater Than Condition in Linq Join

I had tried to join two table conditionally but it is giving me syntax error. I tried to find solution in the net but i cannot find how to do conditional join with condition. The only other alternative is to get the value first from one table and make a query again. I just want to confirm if there is any other way to do conditional join...

How do I conditionally add an id attribute in TAL (PHPTAL)?

I'm creating a form elements template file in PHPTAL. I would like to be able to OPTIONALLY pass in an id attribute for a field... So far the code looks like this: <xml> <tal:block metal:define-macro="text"> <label tal:condition="php: !isset(hideLabel) || isset(hideLabel) && !hideLabel">${field/label}</label> <input name="${n...

Assigning and Conditional Testing Simultaneously in C++

I have three functions that return integer error codes, e.g. int my_function_1(const int my_int_param); int my_function_2(const int my_int_param); int my_function_3(const int my_int_param); I want to assign and test for error at the same time for brevity. Will the following work and be portable? int error=0; ... if ( error || (...

Shorthand conditional to define a variable based on the existence of another variable in PHP

Essentially, I'd love to be able to define a variable as one thing unless that thing doesn't exist. I swear that somewhere I saw a shorthand conditional that looked something like this: $var=$_GET["var"] || "default"; But I can't find any documentation to do this right, and honestly it might have been JS or ASP or something where I sa...

How to DRY up a ruby conditional structure needed for Rails

I'm finding I often have to use a structure to avoid a Rails error of undefined method 'name' for nil:NilClass. The structure looks like this: if country.state country.state.name end It seems like a classic case of repeating oneself with country.state appearing twice in one simple block. Is there any way to DRY this up? ...

How to conditionally pass parameters in Java to a method that takes a variable number of arguments?

I'm using the JDO Query class and I need to conditionally pass certain parameters to the execute method, as demonstrated in the code below. I don't know how to do this in Java. query.declareParameters("String alphaP"); query.declareParameters("String bravoP"); query.declareParameters("String charlieP"); if (condition == true) { if...

jQuery conditional problem

I am trying to create a conditional statement on my dynamic product pages on my website, to aid the setting of the height of my columns (both left and right) and the center part (the #detail <div>). I have this bit of code now: $(window).load(function() { detailHeight = $('#detail').height(); columnHeight = detailHeight + 20; $...

How to refactor conditional logic in javascript?

I inherited a largish JavaScript (MooTools) application for browsing and configuring products. In it there's a function that tracks the products' configured state. Other functions are called depending on what state the product is in. I extended it to add some new features, but have ended up with a mess of nested conditionals inside a b...