boolean

Boolean algebra simplification

I need to reduce this boolean expression to its simplest form. Its given that the simplest form contains 3 terms and 7 literals. The expression is: x'yz + w'x'z + x'y + wxy + w'y'z We tried this in class, and even out recitation teacher could not figure it out. Any help would be appreciated. ...

Creating a database view with boolean logic

My google search skills have failed me, and I am not a database expert by any means! I have a very simple database schema that looks like this: properties_id in the CANDY table is a foreign key to id in the EXPENSIVE_PROPERTIES table. The properties_id is only set if the candy is expensive. If it is expensive, then the correspondin...

Crystal Reports Formula Workshop boolean condition to string

Hello, I'm currently trying to create a report using Crystal Reports that comes with Visual Studio 2008. I would like to include a field of type boolean on my report that shows a string rather than true or false. The string should contain either contain a € or a % sign. How would I go about doing this in the Formula Workshop? I've tr...

Does access/write to Boolean object needs synchronization

This may seem a very silly question. Consider this: I have a simple Boolean object with a getter and a setter. Now both of the methods are called from a lot of threads very frequently. Do I need to have a synchronization for this boolean? Also are Boolean assignments atomic operations? [UPDATE]: I know about Atomic Boolean already...

Is it bad to explicitly compare against boolean constants e.g. if (b == false) in Java?

Is it bad to write: if (b == false) //... while (b != true) //... Is it always better to instead write: if (!b) //... while (!b) //... Presumably there is no difference in performance (or is there?), but how do you weigh the explicitness, the conciseness, the clarity, the readability, etc between the two? Update To limit the su...

Why overload true and false instead of defining bool operator?

I've been reading about overloading true and false in C#, and I think I understand the basic difference between this and defining a bool operator. The example I see around is something like: public static bool operator true(Foo foo) { return (foo.PropA > 0); } public static bool operator false(Foo foo) { return (foo.PropA <= 0); } ...

How Oracle 10g evaluates NULL in boolean expressions

if not (i_ReLaunch = 1 and (dt_enddate is not null)) How this epression will be evaluated in Oracle 10g when the input value of the i_ReLaunch = null and the value of the dt_enddate is not null it is entering the loop. According to the rules in normal c# and all it should not enter the loop as it will be as follows with the values. ...

Can I assume (bool)true == (int)1 for any C++ compiler ?

Can I assume (bool)true == (int)1 for any C++ compiler ? ...

I cant really wrap my head around BOOLEAN logic when I use NOT together with AND and OR

Im trying to understand how boolean logic works when I use NOT. To give an example using awk I have a text file containing CORE PORT CORE PORT COREPORT CORE COREPORT And I would like to remove all COREPORT lines. The way I thought I would do it was with (NOT CORE) AND (NOT PORT) eg awk '/!CORE/&&/!PORT/{print}' But when I try it...

Odd behaviour with PHP's in_array function.

I have a function that checks multiple form items and returns either boolean(true) if the check passed or the name of the check that was run if it didn't pass. I built the function to run multiple checks at once, so it will return an array of these results (one result for each check that was run). When I run the function, I get this arra...

Constantly check for change in Java?

How can I check for a boolean to change state over a given period of time, and if a change is made over that time period perform a method? Can any help please be given in Java. Thanks. ...

floating exception using icc compiler

I'm compiling my code via the following command: icc -ltbb test.cxx -o test Then when I run the program: time ./mp6 100 > output.modified Floating exception 4.871u 0.405s 0:05.28 99.8% 0+0k 0+0io 0pf+0w I get a "Floating exception". This following is code in C++ that I had before the exception and after: // before if (j < E[i]...

How to parse a string of boolean logic in PHP

I'm building a PHP class with a private member function that returns a string value such as: 'true && true || false' to a public member function. (This string is the result of some regex matching and property lookups.) What I'd like to do is have PHP parse the returned logic and have the aforementioned public function return whether...

NSArray filled with bool objects

I have an NSArray filled with bools (expressed as a number), and I need to test to see if any object within the array is equal to 1. How can I do it? ...

In Python, are there builtin functions for elementwise boolean operators over boolean lists?

For example, if you have n lists of bools of the same length, then elementwise boolean AND should return another list of that length that has True in those positions where all the input lists have True, and False everywhere else. It's pretty easy to write, i just would prefer to use a builtin if one exists (for the sake of standardizati...

c#: can you use a boolean predicate as the parameter to an if statement?

In C#, can you use a boolean predicate on its own as the parameter for an if statement? eg: string str = "HELLO"; if (str.Equals("HELLO")) { Console.WriteLine("HELLO"); } Will this code output "HELLO", or does it need to be: string str = "HELLO"; if (str.Equals("HELLO") == true) { Console.WriteLine("HELLO"); } If there is ...

How to check a bool setting in my iphone app

I have a setting in Root.plist with Key = 'latestNews' of type PSToggleSwitchSpecifier and DefaultValue as a boolean that is checked. If I understand that correctly, it should = YES when I pull it in to my code. I'm trying to check that value and set an int var to pass it to my php script. What is happening is that my boolean is either n...

The Cash or Credit problem

If you go to a store and ask "Cash or Credit?" they might simply say "Yes." This doesn't tell you anything as you posed an OR statement. if(cash || credit) With humans it's possible that they might respond "Both" to that question, or "Only {cash | credit}." Is there a way (or operator) to force the a statement to return the TRUE portio...

SQL for sorting boolean column as true, null, false

My table has three boolean fields: f1, f2, f3. If I do SELECT * FROM table ORDER BY f1, f2, f3 the records will be sorted by these fields in the order false, true, null. I wish to order them with null in between true and false: the correct order should be true, null, false. I am using PostgreSQL. ...

What are all the modes to query a database in.

I know boolean mode, but what are the others. ...