I am trying to assign two different strings to two different variables dependent on two booleans in Ant.
Pseudocode (ish):
if(condition)
if(property1 == null)
property2 = string1;
property3 = string2;
else
property2 = string2;
property3 = string1;
What I've tried is;
<if>
<and>
<not><isset propert...
I am curious to see any alternative(s) to the regular if statements such as
if(x)
do a;
if(y)
do b;
if(z)
do c;
so as you see all if statements are seperate and no else condition. Please notice that X Y Z are totally seperate conditions so switch wouldn't fit.
...
This script I'm working on is taking data from the web using python's urllib2 module and then putting it in a table. This data is basically just going to be in a table with one column and one row. How do I have it so that when I run the script it just updates the record? I don't want to make it a primary key because I'm probably going...
Hy i have this code.
{if $isModerator && $order->kind==1}
bla bla
{/if}
and $order->kind can be 1,2,3,4,6
so making 5 if is not the idea any idea?
...
Hi Guys
I'm trying to write some code to Hide columns if the first 3 characters of cells in a range equal the contents of another. I have the code for hiding columns if cells in a range are blank as this;-
Private Sub Worksheet_Change(ByVal Target As Range)
Dim r As Range, cell As Range
On Error GoTo ErrHandler
Set r = Me.Range("C8:R8...
Hello I have this query :
SELECT o.id, o.id as oid, o.id as orderId, o.cid, o.date, o.state,
o.price, o.currency, o.lastChange, o.url AS permalink, o.period,
o.bloggerId, o.bloggerShare, o.offerValidity, o.rebate, o.cid,
o.reason, o.bidReason, o.bidDate, o.bidPeriod, o.rate,
o.lastChange2, o.permalinkDate, o...
How do i write an if statement in Java that displays Goodbye! if the variable word contains a letter d?
Thanks to everyone.
...
I have an example of some code that I see often in websites that I'd like to improve and would appreciate some help. Often I see 5-10 nested if-statements in a page_load method which aim to eliminate invalid user input, but this looks ugly and is hard to read and maintain.
How would you recommend cleaning up the following code example? ...
I seem to have a problem understanding how to conditionally test a boolean value loaded from a .plist to a mutablearray. I simply dont understand what i am supposed to do and continue to receive an error: Passing argument 1 of 'numberWithBool:" makes integer from pointer without a cast. any help understanding this is appreciated!
he...
I could use some help to write a prog./sql construct for a report..
The Sql should first check for the prompt & then decide which "select" statements should run
something like (pseudo-code)
Select ACCT,LOC FROM (
IF :loc = 'MN' THEN
Select acc as ACCT,location as LOC
ELSE IF :loc = 'MA' THEN
Select accid as ACCT,loc...
Every so often on here I see someone's code and what looks to be a 'one-liner', that being a one line statement that performs in the standard way a traditional 'if' statement or 'for' loop works.
I've googled around and can't really find what kind of ones you can perform? Can anyone advise and preferably give some examples?
For example...
I recently read in Code Complete that the recommended way of handling expressions that involve numbers is to order them like a number line.
The book has 2 examples:
if ( (MIN_ELEMENTS <= i) && (i <= MAX_ELEMENTS) )
if ( (i < MIN_ELEMENTS) || (MAX_ELEMENTS < i ) )
With the first example showing that i is between the min and max elem...
I'm trying to set a class to active depending on the url. I'm trying to use the code below, but in every case, it activates the active class for the second tab.
var pathname = window.location.pathname;
if(pathname = '/learn/subsection2') {
$("ul.tabs li:eq(1)").addClass("active").show(); //Activate second tab
...
I have the following code that works correctly. However after I add an else statement anything always evaluates to else
wgetstr(inputWin, ch); //get line and store in ch variable
str = ch; //make input from char* to string
if(str=="m" || str=="M"){
showFeedback("Data Memory Updated");
}
if(str=="p" || ...
I've created the following sql statement, every thing in $() is a variable (comes from the module we're using on our site so $(varname) is the right format in this case, not @varname.
It keeps telling me there's an error near THEN... how am I supposed to format this properly?
IF ($(Shiptobilling) = 'yes') THEN
BEGIN
CardOrd...
We are trying to use the below piece of code
if (($_GET['1'] != "1") || ($_GET['1'] != "2")) {
When we try this no matter what value the variable has it will evaluate as true even when data is entered that is false. When we use
if (($_GET['1'] == "1") || ($_GET['1'] == "2")) {
and put in data that will make it return false it work...
My question might be very basic but still I think it worths to ask. I have the following code:
if(!partialHits.get(req_nr).containsKey(z) || partialHits.get(req_nr).get(z) < tmpmap.get(z)){
partialHits.get(z).put(z, tmpmap.get(z));
}
where partialHits is a HashMap. What will happen if the first statement is true? Will Java s...
I wrote some code that looks similar to the following:
String SKIP_FIRST = "foo";
String SKIP_SECOND = "foo/bar";
int skipFooBarIndex(String[] list){
int index;
if (list.length >= (index = 1) && list[0].equals(SKIP_FIRST) ||
list.length >= (index = 2) &&
(list[0] + "/" + list[1]).equals(SKIP_SECOND)){
r...
Is there an analogous form of the following code:
if(month == 4,6,9,11)
{
do something;
}
Or must it be:
if(month == 4 || month == 6 etc...)
{
do something;
}
I am trying to write an if statement that checks if this month has more than 31 days.
EDIT
I guess the real problem is I undersand some of what I am taught but every ti...
Used to develop Portlets and JPS's, so have a dilemma.
task: display <h:dataTable> only when list isn't empty
Is it possible to provide <c:if> tag for JSF page?
...