The tag has no wiki summary.

learn more… | top users | synonyms

3
votes
3answers
47 views

Why Logical operators, when there is Bitwise operators in java

I know that the Bitwise operators &, | and ^ are EITHER bitwise operators OR logical operators ... depending on the types of the operands. If the operands are integers, the operators are ...
2
votes
1answer
63 views

How do I negate this if/else comparison to just if? [on hold]

I'm trying to set the class hidden, unless two factors are met. Currently, I'm using the code below: <?php if (isset($_POST['prerequisite']) && $form == "CheckingIn") { } else { echo ...
15
votes
5answers
389 views

Behaviour of && in C programming language

I am beginner in C programming language, recently I have read about Logical AND && operator. NON-ZERO && NON-ZERO = 1 NON-ZERO && ZERO = 0 ZERO && NON-ZERO = 0 ...
-3
votes
2answers
96 views

C - Weird symbols [on hold]

i'm new to c and i've mostly dealt with writing code using loops so far but i've come across this problem which contains some symbols i've never seen before. Could you explain why these numbers are ...
1
vote
1answer
25 views

XSLT equals condtional

I have this simple test in XSLT <xsl:if test="isTrue = 'false'"> but I can't figure out how to do the logical equals operator here. I know < is "&"lt; and > is "&"gt; so what is ...
-3
votes
0answers
30 views

Excel VBA: Duplicate Removal IF ALL conditions are met [on hold]

I'm hoping someone can help cos this is driving me crazy... I want this macro to check the Name, Date of Birth, and Questionnaire Name, and then look through the sheet to see if there is a previous ...
0
votes
1answer
49 views

Compare size of change rather than number

I need to compare values from a list that represent log magnitudes of change: '1.3118 2.07985', '1.18887 0.990066', '2.63964 2.31757', '0.828566 1.03155', ...
1
vote
2answers
37 views

subset a matrix in a for loop with logical operator or (|)

I am trying to make subsets of a matrix. Each subset depends on a set of logical conditions. For example the first subset of the first list (R[[1]][[1]]) corresponds to the last column of the matrix ...
1
vote
2answers
31 views

OR logical operator in bash

I have very dumb problem but can't wrap my head around it if [[ false || false ]] ; then echo 'true' else echo 'false' fi As per http://tldp.org/LDP/abs/html/comparison-ops.html ...
3
votes
2answers
65 views

Java get bit ranges from a long

I need to extract certain bit ranges from with a long value, for example: long input = 15367 (11110000000111) What I need to then do is to extract two long values from the original long, First ...
3
votes
5answers
89 views

Do I understand correctly the way logical AND works?

I have a simple homework assignment: Write a script that prints all the numbers from 1 to N, that are not divisible by 3 and 7 at the same time. So, here is my solution. The way it works - it prints ...
2
votes
2answers
42 views

Using logical operator without any conditional statement or capturing in variable

I have seen a kind of "poetic" code in some code base. Though it looks straight forward, just want to confirm, if it's in right direction. In a very simple form: bool foo (); bool bar (); int ...
1
vote
1answer
18 views

Ternary logic in XPath for testing null

In XPath 1.0, is there a way to test the existence of the evaluated expression and modify the result on its behalf? I am trying to implement this pseudo-code: if ID is empty then 0 + 1 ...
0
votes
2answers
33 views

Check text for multiple RegEx matches

The code below reads in some text (scanned from an OCR library) a checks the text for a few simple words "the", "date", "or", "to", "and".... If it finds one of those words then this function returns ...
0
votes
0answers
26 views

how to combine the logical operator NOT together with the orientation media feature

I need to target css properties to any device which is NOT iPad and based on the device orientation. Nested media queries don't work on my simulator. Example @media not screen and (device-width: ...
1
vote
6answers
79 views

How to have both functions called with logical AND operator (&&) c++

Let's say I had two functions and a variable, int number; bool foo (void); bool footoo (void); And in each of these functions, some logic with the variable number takes place, such as: number++; ...
-1
votes
0answers
25 views

R package: Logical Minus operation between two tables

I have a large table that looks like this: Column 1 Column 2 Column 3 12 abcd Joseph 14 adsb John ... ... ... I would ...
1
vote
2answers
33 views

PHP Bizarre behaviour with switch() and logical or (XOR) in a case declaration

NOTE: I am aware that this is not acceptable code, I am seeking to understand what the interpreter is doing, not advice on how else to achieve the same result! I've since read up enough to realize ...
2
votes
2answers
64 views

logical operators or vs || (double pipe) in php [duplicate]

I've always used || (double pipe) for if (($a == $b) || ($a == $c)) { } and or for do_this() or do_that();. Why not if (($a == $b) or ($a == $c)) { } or do_this() || do_that();? Is there any reason ...
0
votes
2answers
32 views

t-SQL Aggregate Logic

Lets say we have a table with an ID and a bit column. We execute a query that returns any number of rows (for this example with ID>5). What I want to do is to have an AND aggregate operation across ...
0
votes
0answers
25 views

Visualize logical statements

I want to visualize logical expressions. An example is the following: [Statement-1] OR [ [Statement-2] AND [Statement-3] ] I can build the AST tree for such a formula. But the next step is to ...
0
votes
0answers
13 views

Can the BlueSmirf Gold bluetooth module communicate logical HIGH/LOW instead of serial?

I am wondering if the BlueSmirf Gold can set HIGH/LOW commands instead of serial communication? I am writing a small andorid app to control something via the BlueSmirf. I know how to establish serial ...
0
votes
5answers
70 views

logical operation in java

I have been trying to implement the following condition in a more sofisticated manner: if (x > 1) doSomething(); else { doSomethingElse(); } want to code it like: (x > 1) ? doSomething() ...
1
vote
4answers
112 views

Understanding shifting and logical operations

I am trying to read the 'size' of an SD card. The sample example which I am having has following lines of code: unsigned char xdata *pchar; // Pointer to external mem space for FLASH Read ...
0
votes
2answers
64 views

C++ Operator precedence for Bitwise AND and Logical OR

From this page, I got to know that operator precedence of Bitwise AND is higher than Logical OR. However, the following program gives an unexpected output. #include<iostream> using namespace ...
1
vote
3answers
69 views

Syntax error - Logical if statement

I`m just using a If statement with the logical operator. I dont know why it is showing sytax error. var divWidth = $("#columnwraper").width(); //getting the width of the div ...
-6
votes
1answer
66 views

these three questions which are similar but not same. how? [closed]

Q1: Output ? int main() { int i=-3, j=2, k=0, m; m = ++i && ++j || ++k; printf ("%d %d %d %d", i,j,k,m); return 0; } Q2: Output ? int main() { int i=-3, j=2, ...
1
vote
4answers
45 views

jQuery logical operator not working as expected [duplicate]

I have below code which is not working. var book_id = $('#indexBookSearch'); var tag_id = $('#indexTagSearch'); if((book_id.val() == "") || (tag_id.val() == "")) { ...
9
votes
4answers
307 views

Is &= guaranteed to behave like hypothetical &&= operator?

sometimes I would like to do bool success= true; success &&= dosmthing1(); success &&= dosmthing2(); success &&= dosmthing3(); if (success) Lets ignore that I could be ...
0
votes
3answers
59 views

Batch command for “list-contains” operation

I have this command that goes through all folders in a directory and deletes all of them except one: FOR /D %i IN ("Directory\*") DO IF /I NOT "%i" == "FolderToKeep" RD /S/Q "%i" Now I need it to ...
2
votes
1answer
72 views

Logical operators in if-else in R

I have the following table (5 columns and 3 rows) called mat : AC CA RES 1 0 2 2 1 3 0 0 0 1 The operation being performed is mat[1]/mat[1]+mat[2] I am testing for the following : ...
2
votes
5answers
90 views

Is there any straightforward way to apply a logical operator on a Perl array?

I'm looking for something like this: (where OR is my hypothetical built-in function) Code: @x=(1, 0, 1, 1, 1); $a=OR(@x); print $a; Expected result: 1 Is this possible with Perl?
0
votes
1answer
62 views

SELECT .. SELECT in Mysql

I am trying to write a query for mysql (Search Module) where I am facing difficulties because of the select operation to be carried out inside same table. My Query: (SELECT * FROM user WHERE ...
-1
votes
4answers
91 views

Compound relational operators in C

I am trying to convert a piece of pseudo code into a C code and I have conditions like if (-4 <= X <=8) THEN {Do Something} else {Do something else} Is the syntax in if statement valid? Can ...
1
vote
1answer
127 views

Ternary Operator in Multiple conditions

I have one if condition in c# if (item.ReporSubCategoryId == 1 || item.ReporSubCategoryId == 2 || item.ReporSubCategoryId == 3 || item.ReporSubCategoryId == 4) { <a ...
-2
votes
2answers
103 views

how to solve the postfix and prefix operator expression?

I wrote the following code: int main(){ int i=-1,j=-1,k=0,l=2,m; m = i++ && j++ && k++ || l++; printf("%d %d %d %d %d",i,j,k,l,m); i=-1,j=-1,k=0,l=2,m; m = ++i && ++j ...
0
votes
3answers
33 views

Trying to pass the user type in a condition laravel

When I grab the current user (who is a manager) like so: $user = Auth::user()->user_role; I then die and dump this: dd($user); This displays string(7) "Manager" I then want to use a ...
1
vote
2answers
70 views

Logical “Except” operator for If statements in R

FYI, I'm new to using R so my code is likely quite clunky. I've done my homework on this but haven't been able to find an "Except" logical operator for R and really need something like that in my ...
6
votes
2answers
59 views

NA, TRUE and FALSE properties

I can't logically understand the properties of TRUE, FALSE and NA. Here are some examples... NA | T [1] TRUE NA | F [1] NA NA & T [1] NA NA & F [1] FALSE Can you explain me these ...
2
votes
2answers
75 views

R: Dealing with TRUE, FALSE, NA and NaN

Here is a vector a = c(T,F,F,NA,F,T,NA,F,T) I'd like a simple function that returns TRUE everytime there is a TRUE in a and False everytime there is a False or a NA. The 3 following things do not ...
2
votes
7answers
252 views

Execution order of conditions in C# If statement

There are two if statements below that has multiple conditions using logical operators. Logically both are same but the order of check differs. The first one works and the second one fails. I ...
1
vote
0answers
76 views

Does order of parameters in logical operators matters equality?

I'm constructing some class that will contains a logical expression: public enum LogicalOperator { And, Or }; public class LogicalExpression { public LogicalOperator Operator { get; private set; ...
-10
votes
2answers
155 views

Working of Logical OR ( || ) in C?

I am a beginner C programmer and I was working with Logical Operators recently. Is the logical or (||) zero whenever both operands are zero. Or is the working somewhat different? How does it work ? ...
0
votes
3answers
47 views

Logical operators, how are these evaluated?

I'm going through past papers to revise and there was a question that wasn't explained and I can't seem to find much online in regards to this question/topic. Binary values a = 00110011 b = 10101010 ...
0
votes
0answers
145 views

Combine two Binary images

I have obtained two individual segmentations - initial and the one after splitting clumps of cells . (Original image - Initial segmentation) I'm stuck up now as I am unable to combine these two ...
-1
votes
2answers
70 views

Explanation about AND or OR operations in my C sharp code

I am trying to analyze some code in C#. I have some misunderstanding problem with converting numbers and may be with AND operations in C# code. I have the code as shown below. public void ...
0
votes
3answers
43 views

How to have multiple 'and' logical operators and an 'or' logical operator

It is slightly hard to explain but I want to do something that looks like this: if(a === 4 && b === true && c === "words" || "numbersandwords")DoSomething(); but it ends running ...
7
votes
5answers
109 views

precedence of ~ and ++ in java

consider this code snippet int j = 7; System.out.println(Integer.toBinaryString(j)); j = ~j++; System.out.println(Integer.toBinaryString(j)); prints 111 11111111111111111111111111111000 what i ...
2
votes
1answer
209 views

Is BitArray faster in C# for getting a bit value than a simple conjuction with bitwise shift?

1). var bitValue = (byteValue & (1 << bitNumber)) != 0; 2). using System.Collections.BitArray with a Get( bitNumber ) method What is faster? In what situations for the .NET projects ...
1
vote
2answers
94 views

Is there an implication logical operator in python?

I would like to write a statement in python with logical implication. Something like: if x => y: do_sth() Of course, I know I could use: if (x and y) or not x: do_sth() But is there a ...

1 2 3 4 5 7
15 30 50 per page