2,621 questions
0
votes
0
answers
91
views
Logic Issue In Pine Script - On Trading View Strategy
I am working on a mean reversion strategy for bitcoin to automate trades on an Indian crypto Exchange. The pine script is supposed to generate buy, sell, buy side target hit, buy side sl alerts and ...
0
votes
0
answers
25
views
How can I create routing Keys in Rabbit MQ with Not Equals, AND, OR and Equals?
I went through Rabbit MQ documentation on routing keys. I see that there are only operators * and # to define a routing key.
I have about 10,000 users whose birthday notifications are to be processed. ...
0
votes
0
answers
58
views
Logical condition equivalent with restrictions
I am developing an Azure DevOps custom task. Part of the setting of the inputs is a VisibleRule which can contain a condition which will determine if the input will be visible, if the condition is ...
1
vote
3
answers
103
views
Evaluate Postfix and Logical Operators in C with no short-circuiting approach
I came across this question when studying logical operators and conditionals in C.
#include <stdio.h>
int main() {
int x = 3;
int y = 2;
int z = 3;
printf("Result #4 = %d\n&...
0
votes
1
answer
65
views
How do I construct a boolean circuit from a boolean function when I cancelled our one of the variables?
I was given a truth table of four variables, let's call them A,B,C,D. I found every instance where the truth table was true and turned it into a function:
F = (-A^-B^-C^-D) v (-A^-B^-C^ D) v (-A^-B^ C^...
-1
votes
1
answer
102
views
Apply expanding calculations on SQL Server
I have this table in SQL server :
date
var
val
2022-2-1
A
1.1
2022-3-1
A
2.3
2022-4-1
A
1.5
2022-5-1
A
1.7
2022-09-1
B
1.8
2022-10-1
B
1.9
2022-11-1
B
2.1
2022-12-1
B
2.22
I want to group by column ...
-1
votes
1
answer
663
views
Write the Boolean Function F(A,B,C,D) using no more than 2 Nor Gates
I am working on a problem where I have to draw a logic circuit using no more than 2 Nor gates. The function F(A, B, C, D) = Σ(2,4,10,12,14) with don't care conditions Σ(0,1,5,8). After drawing the k-...
-1
votes
4
answers
127
views
Replacing a nested if statement with a single if statement that has a logical && (AND) operator to achieve the same output
Below is a code that demonstrates a nested if statement for exam marks:
public class NestIfExample {
public static void main(String[] args) {
Scanner inputDevice = new Scanner(System.in);
...
2
votes
1
answer
435
views
AND and OR logical operator shape [closed]
I was looking into logical operator diagrams to learn about that stuff and I couldn't find out why the AND operator has a straight base while the OR has a curved one. Does anyone have an answer, or a ...
1
vote
2
answers
177
views
Representing logical expressions as an Object?
How can I represent logical expressions that might or might not contain brackets as a object in Java?
I want to be able to be able to evaluate expressions that can be from only A to A AND B or more ...
0
votes
1
answer
143
views
How can the compiler affect the way logical values are represented in Fortran?
This question is based on these 2 other questions [1] [2], but I figured I'd get more progress if I asked something less specific and worked by myself from there.
According to an user in the first ...
1
vote
2
answers
290
views
Simplify a boolean expression with 4 variables to 3 variables
I'm doing some simplifications for a circuit and I ended up getting the following expression:
A.C'.D' + A.B'.C' + B.C.D' + B'.C.D + A'.B'.D'
which translates to the truth table where 0, 2, 3, 6, 8, 9, ...
-1
votes
1
answer
143
views
Precedence of pre-increment operation over post-increment operation [duplicate]
package test;
public class Test {
public static void main(String [] args) {
int a = 10;
int b = 12;
System.out.println( ++a == 11 || b++ == 12);
...
0
votes
1
answer
92
views
Power Query: Multiple Criteria Filtering with Logical Operators
I have the following table in power query:
I'm trying to return the latest files for BOTH words "RAM" and "SoCal". In this case, the return files would be:
RR RAM 2024-07-08.xlsx
...
0
votes
1
answer
70
views
How to logically extract a part of a WHERE clause condition and execute it outside of an SQL query later?
The scenario
Let's say we have a database table 'TABLE' with entities identified by 'ID'. Each entity has several features stored in columns (COLUMN_1 to COLUMN_N). There is an additional feature of ...
0
votes
1
answer
110
views
What is B supposed to turn into in this 8-bit adder?
I understand that it takes 4A and subtracts it from B but the two appended 1s that are added to B make it difficult for me to understand. What am I subtracting from 2A? 1B1?
I couldn't find any ...
2
votes
1
answer
143
views
comma, AND and vertical bar operator "|"
This may seem like a stupid question, please bear with me. I wanted to confirm what a comma evaluates to so I did the following.
xy <- c(1:10)
ab <- c(10, 2, 1, 6, 8, 6, 7, 2, 10, 6)
# I ran ...
0
votes
2
answers
88
views
Using an outer Boolean variable inside a mongodb aggregation pipe line logical operator $or
I have to check a Boolean flag and base on its condition return different data result.
for example I have a collection of books and their prices, normal result of query is prices matching 10, BUT IF ...
0
votes
1
answer
44
views
Incorrect OR evaluation of cell range
Edited
I have a custom formula in conditional fange that fails to do the expected.
The condition depends on 3 factors with AND and OR spanning on a range from line 2 to 726.
=and(X2>1000,OR(AC2=&...
-1
votes
1
answer
95
views
Is there any better way to write this piece of code? [duplicate]
I am a beginner in this, I was curious if i can write the below code
more efficiently.
I can't use loops or conditional statements, just logical operators.
double a = Double.parseDouble(args[0]...
1
vote
1
answer
143
views
Why do Ruby ERB if statements set variables to nil?
I'm using ERB to generate a set of instructions with location data, and want to accept an offset in my input. When I try to check if that offset is present however, it sets it's value to nil. If ...
1
vote
0
answers
542
views
"OR" condition between two different labels in PromQL
I am using PromQL. I have different labels that represent the same thing for different environments. For example:
http_server_request{env=~"$env"}
It works fine for the dev environment, but ...
1
vote
1
answer
65
views
Python Dataframe avoid non-NaN values dropping during <> operations
My code:
xdf = pd.DataFrame(data={'A':[-10,np.nan,-2.2],'B':[np.nan,2,1.5],'C':[3,1,-0.3]},index=['2023-05-13 08:40:00','2023-05-13 08:41:00','2023-05-13 08:42:00'])
xdf =
A ...
1
vote
3
answers
62
views
Subset by value in columnA and get the value in a columnC that corresponds to the maximum value row of columnB in R? Automate this using loop
The title is rather confusing (apologies), but I will try to explain it here.
I have a dataset with multiple names of individuals, the number of coffees they have had on a particular day of the week, ...
3
votes
0
answers
919
views
Unexpected search results: How does Gmail search interpret advanced queries, and how I can use that information to achieve precision?
Consider the following filter
Keep this filter (also provided in query form) in mind. We'll come back to it later.
from: { domain1 domain2 email1 email2 }
subject: { +"exact string 1" +"...
-3
votes
1
answer
141
views
Conditional filter javascript (react) - combining two logical operators - || and && or && and &&
Basically in my react app I want to filter an array that meets 3 conditions, but if I use && (and) two times it doesn't work, only if I use || (or) and && (and) together.
Example of ...
1
vote
1
answer
79
views
Python Logical Operations as conditions in Pandas
I have a dataframe with columns:
import pandas as pd
import numpy as np
df = pd.DataFrame({
'A': [False, True, False, False, False, False, True, True, False, True],
'B': [True, False, False, ...
0
votes
0
answers
160
views
Why does it fail to detect WAVE or RIFF?
I'm trying to load a wav file into a C++ app
I Keep getting the program to print Invalid Wav File with exit code 5. This means the program thinks the chunkID didn't match RIFF or the format didn't ...
0
votes
2
answers
135
views
R method for comparing NAs between two vectors
I am trying to compare two vectors for identical elements, say for vectors a and b below.
# vectors a and b
a <- c(1, 2, 3, NA)
b <- c(1, 3, NA, NA)
# compare for identity
a == b
## [1] TRUE ...
3
votes
5
answers
511
views
Consolidating multiple OR and AND conditions in R
I want to consolidate multiple OR and AND conditions in R. I think x1 == 1 | x1 == 2 can be consolidated as x1 %in% c(1, 2). I'm wondering how x1 == 1 | y1 == 1 and x1 == 1 & y1 == 1 can be ...
0
votes
1
answer
31
views
Why is $scope >= 0 showing true in interpolation while empty in controller?
I'm setting a $scope variable to 0 or 1 based on a successful action and showing elements with ng-show. I'm resetting the $scope variable to empty when the step is finished. However, I have discovered ...
0
votes
0
answers
185
views
Logical operator on array of bool
Given arrays of
$requiredElements = @('Valid1', 'Valid2')
$elementsGood1 = @('Valid1', 'Valid2')
$elementsBad1 = @('Valid', 'Invalid')
I can get back an array of booleans like this
$requiredElements....
0
votes
1
answer
39
views
why does the operator logic in Linq not match the results when the value is 0 or nothing in VB.NET
I'm Trying operator logic but in Linq not match the results when the value is 0 or nothing in VB.NET
Let STATUS = If(BLC < 24 And PRSOBNET Is Nothing, "NEED TO PRODUCE", "")
is ...
0
votes
0
answers
34
views
Why does painted_img always remain zero in my Python code?
I'm encountering an issue with the following code snippet in Python. Despite my efforts, the variable painted_img always remains filled with zeros (0), it is for sure that sp_intensity[seg] is not ...
0
votes
1
answer
64
views
PubMed query: priority of operations using parenthesis leads to zero results
I am using the easyPubMed package in R, but I think this applies to PubMed generally, for example using the website interface (which is perhaps simpler for debugging since we know the R package is not ...
-2
votes
1
answer
550
views
Combining & and | statements in case_when function [closed]
I have a df "DISC_CONS_Reports" with 6 columns, each with 2 or more factors.
I want to do something very simple, adding a column named 'State' with value 'Conscious_pure' when column 1 ...
0
votes
1
answer
92
views
Difference between logical "and" and bit wise & [duplicate]
I was writing a piece of code for a practice problem where I was trying the display the highest odd number. I kept running into a problem where when I was linking two statements together with a & ...
0
votes
1
answer
53
views
How can I ignore a case of a logical list throwing an error in R programming?
I'm trying to combine lists of statistics scraped from the NCAA Baseball website into a table with bind_rows. One of my tables is returning a list of logical operators because one of the teams I'm ...
0
votes
0
answers
62
views
How the logical operators works in java? [duplicate]
I executed the below java code in IDE. the first sysout prints false. where as second sysout prints true. Some websites says because of operator precedence this occurs.
System.out.println(false &&...
0
votes
1
answer
24
views
How to resolv null problems in relation tables?
I have the following situation using BigQuery Tables.
I have a table with a field containing a string with codes:
Table A
| Model | codevalues |
| -------- | ------- |
| 658 | CC(1.3),CMB(GA),ECO(...
-1
votes
1
answer
84
views
how to automate translation from operand-based expressions to function-based ones
I'm trying to re-write / translate logic statements written arithmetically, into strings of min/max functions, some of them fairly complicated. Preferably using things like sed, awk, perl, python, etc....
0
votes
0
answers
128
views
How to create an if statement with two conditions using OR operation
I'm trying to make an if statement that can take in if (input == "Cell" || "cell") so i don't have to worry about the user typing it with a capital or not. But in the console, it ...
0
votes
1
answer
71
views
error in assigning classes to values from a data.frame in R
coupe=data.frame(read.csv(file.choose()))
#UNITS AS PER GIRTH - I want to assign girth classes to each tree for further computation of value
coupe$g.class = NA
for (i in 1:(nrow(coupe))) {
if (...
0
votes
1
answer
127
views
designing a circuit with 3 3-bit inputs and 4 1-bit outputs
The inputs are A[2:0], B[2:0] and C[2:0] respectively. The outputs are E,RA,RB,RC.
If at least at one of the inputs (A,B,C) none of the bits are equal to 1 or if at least at one input the bits that ...
3
votes
4
answers
79
views
Using 'IF' operator to check if a given value in a dataframe cell belongs to a 'SET' of values
I have a data.frame with names of animals
x=data.frame(c("lion","tiger","cow","vulture","hyena","leopard","deer","gazzelle&...
-1
votes
1
answer
47
views
How to understand logic in tree node class method?
Here is the class:
class TreeNode:
def __init__(self, key, left=None, right=None, parent=None):
self.key = key
self.left_child = left
self.right_child = right
self....
0
votes
1
answer
58
views
Can python check if the first variable is true or false with other statements ? see to understand [duplicate]
I want to know if in "if complex statements" can you check if the first element is true or false, then see if either the second or third element is true or false, and if the first element is ...
0
votes
0
answers
36
views
How do I separate my data based on angle oscillation? [duplicate]
I have a dataset structured like below.
Elapsed Time (sec)
Vertical Translation (cm)
Gantry Angle (deg)
TreatmentDate
343.367
0.0454447
181.00000
Nov 2
344.065
0.0523568
184.46055
Nov 2
344.766
0....
1
vote
0
answers
59
views
Operator Associativity Test vs Operand Evaluation Order
I am trying to write a simple code structure that verifies whether the && operator in a language (not a specific language, so I can't get help of truthy/falsy values) is left-associative or ...
0
votes
1
answer
138
views
Integer Programming Constraint For NOR Gate
For a set of binary variables X = {x1, x2, ..., xn} (n>=1). Lets define sum operation for simplicity: sum(X) = x1 + x2 + ... + xn
For another binary variable y, I want to write a constraint or more ...