How can you express X of Y are true, in boolean logic? a rule like 2 of the following must be true (A, B, C, D, E, F)
is it a form of multiplcation or set operations?
the end result is all the permutations like AB OR AC OR AD, if you said 3 of following it is like ABC, ABD, ABE, etc.. so it is like (A,B,C)^2?
thanks!
...
Since MySQL doesn't seem to have any 'boolean' datatype, which datatype do you 'abuse' for storing true/false information in MySQL? Especially in the context of writing and reading from/to a PHP-Script.
Over time I have used and seen several approaches:
tinyint, varchar fields containing the values 0/1,
varchar fields containing the...
If you have a situation where you need to know where a boolean value wasn't set (for example if that unset value should inherit from a parent value) the Java boolean primitive (and the equivalent in other languages) is clearly not adequate.
What's the best practice to achieve this? Define a new simple class that is capable of expressin...
Hi guys,
This is probably pretty basic... but I don't seem to get it:
How does
(2 & 1) = 0
(3 & 1) = 1
(4 & 1) = 0
etc..
This pattern above seems to help find even numbers
or
(0 | 1) = 1
(1 | 1) = 1
(2 | 1) = 3
(3 | 1) = 4
(4 | 1) = 5
(5 | 1) = 5
I know how boolean algebra works between bits. But I don't understand how Boolea...
Hey guys.
Got a quick question. Does anyone know how to let JAXB (marshall) render boolean fields as 1 and 0 instead of printing out "true" and "false"?
...
I have a test in Excel VBA:
If (test1) And (test2) And (test3) Then
'do something
End If
In C, Java, etc. test1 would be run first, then test2, then test3. Critically, if test1 is false the whole test is false so the remaining tests aren't run.
Does that happen in this case? If so, which order are the tests running?
...
I am totally new to XSLT and can't work out where I am going wrong with the following code.
<xsl:variable name="var" select="boolean('false')"/>
<xsl:if test="$var'">variable is true</xsl:if>
It is always returning true when it is meant to be false. Can anyone help?
...
I often want to trigger a certain function just once, but I need to trigger it from within another function that gets repeatedly called. For instance, taking a snapshot of something for later use. I usually do it by setting a global boolean.
I'm wondering whether the way I do it is actually best way?
I seem to recall reading that glob...
I keep seeing code that does checks like this
if (IsGood == false)
{
DoSomething();
}
or this
if (IsGood == true)
{
DoSomething();
}
I hate this syntax, and always use the following syntax.
if (IsGood)
{
DoSomething();
}
or
if (!IsGood)
{
DoSomething();
}
Is there any reason to use '== true' or '== false'?
Is it ...
Avast there fellow programmers!
I have the following problem:
I have two rectangles overlapping like shown on the picture below.
I want to figure out the polygon consisting of point ABCDEF.
Alternate christmas description: The red cookie cutter is cutting away a bit of the black cookie. I want to calculate the black cookie.
Each r...
When I try to make a very large boolean array using Java, such as:
boolean[] isPrime1 = new boolean[600851475144];
I get a possible loss of precision error?
Is it too big?
...
Hi, I have a problem binding booleans using mysqli_stmt::bind_param in PHP5.
The SQL query is the following: insert into nvp_notes (subject,messageid,receivedate,read) values (?,?,?,?)
Where 'read' is a tinyint, either 0 or 1, as I've had issues with bit using mysqli. So the types that I list in bind_param are:
$stmt->bind_param('sds...
I'm using a string builder to build some SQL Scripts. I have a few Boolean Properties that I would like to test and then output different text based on true/false. I've you the C# syntax below when assigning a value to a variable, but it isn't working for this particular situation. Any ideas?
What I'm used to doing:
string someText ...
I have the following line:
$this->magicQuotes = (bool) get_magic_quotes_gpc();
I am taking the get_magic_quotes_gpc() storing it in my object as it's used many times as I generate the SQL. I am also converting it to a bool.
I'm wondering if it's worth while converting it to bool. The main reason I am is for speed as the statement tha...
true.ToString()
false.toString();
Output:
True
False
Is there a valid reason for it being "True" and not "true"? It breaks when writing XML as XML's boolean type is lower case, and also isn't compatible with C#'s true/false (not sure about CLS though).
Update
Here is my very hacky way of getting around it in C# (for use with XML)
...
Hello,
I have a question about the meaning (evaluation) of Boolean variables in return statements in Java.
I know that:
if (var) { ... }
is the same as:
if (var==true) { ... }
In the second case we explicitly say var==true, but we don't need to do this, because Java evaluates var as true anyway. I hope I have understood this righ...
Hi,
I want to hide some things when the value of the numericUpDown is changed so I wrote this:
if (numericUpDown1.Value = 1)
{
Label1.Hide();
}
but I get this error message:
Cannot implicitly convert type 'decimal' to 'bool'
Thanks
...
I need to evaluate a Python expression from C++. This code seems to work:
PyObject * dict = PyDict_New();
PyObject * val = PyRun_String(expression, Py_eval_input, dict, 0);
Py_DECREF(dict);
Unfortunately, it fails horribly if expression is "True" of "False" (that is, val is 0 and PyErr_Occurred() returns true). What am I doing wrong? ...
1) On a 32-bit CPU is it faster to acccess an array of 32 boolean values or to access the 32 bits within one word? (Assume we want to check the value of the Nth element and can use either a bit-mask (Nth bit is set) or the integer N as an array index.)
It seems to me that the array would be faster because all common computer architectu...
In C++ I'd write something like this:
if (a == something && b == anotherthing)
{
foo();
}
Am I correct in thinking the Clojure equivalent is something like this:
(if (= a something)
(if (= b anotherthing)
(foo)))
Or is there another way to perform a logical "and" that I've missed? As I said the latter form seems to ...