Skip to main content
Filter by
Sorted by
Tagged with
0 votes
2 answers
9k views

I am facing an issue while comparing boolean values, I want the loop to enter inside the block but its not entering the block. else if (!(keyCompare.contains(compareKey)) || (save == true)) { //do ...
73 votes
4 answers
43k views

-1 == true; // false -1 == false // false -1 ? true : false; // true Can anyone explain the above output? I know I could work round this by comparing to 0 but I'm interested. I'd expect ...
0 votes
0 answers
35 views

I am working on a function that takes the domain name from the respective prefixes such as www, .com, etc. and am a little confused on what the difference between calling my alias to be true and ...
106 votes
9 answers
10k views

I can't understand the logic behind the terms intersection types and union types in TypeScript. I'm thinking of interfaces (or classes) as sets of properties. The logical conjunction operator & is ...
1 vote
1 answer
124 views

I'm working with a Pandas DataFrame where I need to track a boolean flag (in_position) that becomes True after an entry_signal and resets to False only after an exit_signal. This must be done ...
4 votes
2 answers
500 views

How can I check if all values of a polars DataFrame, containing only boolean columns, are True? Example df: df = pl.DataFrame({"a": [True, True, None], "b": [...
3 votes
2 answers
120 views

Refactoring some old code, I found the following: someVar == !otherVar That doesn't look that legible, I thought that could be written as: someVar != otherVar It seems logic to do so. But, since this ...
0 votes
2 answers
184 views

I'm currently working on tranforming logical queries for database systems from a DNF form into a CNF form, focussed on queries which have a similar form to (a and b and c and d and e1) or (a and b and ...
2 votes
3 answers
2k views

I have a graph which has 5 vertexes. Graph g1 = new Graph(5); g1.addEdge(0, 1); g1.addEdge(0, 2); g1.addEdge(1, 2); g1.addEdge(1, 3); g1.addEdge(3, 2); ...
0 votes
1 answer
45 views

I am trying to set up an Excel conditional formula with both AND and OR criteria. However, the last 2 criteria OR(Table1[Col5]=$J$4,Table1[Col5]=$K$4) and OR(Table1[Col6]=Pivot!$J$5,Table1[Col6]=Pivot!...
1 vote
2 answers
256 views

I am working on solving a system of boolean equations. Specifically, I am trying to find the values of bit vectors S1...S3 and/or C1...C3 such that their XOR results are given in the table below (in ...
28 votes
3 answers
197k views

How do you chain multiple sets conditions together when you want either one set or the other set of 2 conditions to be true? To be more precise, I want to do: If User is logged in AND Operating system ...
0 votes
0 answers
58 views

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
5 answers
2k views

I am new to programming and I just started learning Python by doing online classes at work. I am currently on the topic of writing a function. I thought that it will be useful to have a function that ...
9 votes
0 answers
321 views

I am given a Boolean expression of arbitrary depth, like (A or (B and (C or (~D and E) or F) or (G and H))). There can be any number of terms at each level. I want to limit the depth of the ...
1 vote
2 answers
285 views

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, ...
-2 votes
1 answer
162 views

I'm updating somebody else's code. They did the following : bool a(); bool b(); a() || b() || std::clog << "whine about something" << std::endl; I'm replacing the std::clog bit ...
0 votes
1 answer
58 views

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^...
615 votes
65 answers
208k views

An interviewer recently asked me this question: given three boolean variables, a, b, and c, return true if at least two out of the three are true. My solution follows: boolean atLeastTwo(boolean a, ...
25 votes
3 answers
126k views

So it ended up that the bug that had kept me on for days, was a section of code that should have evaluated to False evaluating to True. My initial code went something like: if(~x && ~y) begin ...
2 votes
4 answers
11k views

I am trying to wrap my mind around how to do this. For what I understand is that a set of logic gates is called "functionally complete" if some combination of the gates can be used to do ...
6 votes
5 answers
13k views

This is a bit tricky, it's a nice challenge for those up to the task I think. And I did search through all the questions previously asked, but I couldn't find what I want. The aim here is, given 2 ...
38 votes
10 answers
25k views

Currently I have a web application where a user can use dropdown lists to generate SQL SELECT statements like so: Column Select Dropdown | Operator Dropdown (= != > < <= >=) | Value select ...
-2 votes
1 answer
145 views

I need a counter that displays a custom number sequence instead of counting up or down. I know I'm gonna need 3 JKs, meaning 2 ICs with 2 flip-flops. a few logic gates, but I don't really get how I ...
5 votes
4 answers
386 views

I'm working on a complex rule parser that has the following properties: A space character separates rules A "+" character indicates an "AND" operator A "," character ...

1
2 3 4 5
39