boolean

Why is a C++ bool var true by default?

bool "bar" is by default true, but it should be false, it can not be initiliazied in the constructor. is there a way to init it as false without making it static? Simplified version of the code: foo.h class Foo{ public: void Foo(); private: bool bar; } foo.c Foo::Foo() { if(bar) { doSomethink(); } } ...

Boolean return method

Hi, i am doing computer science and in a project at the moment. I have had no code input for this as its specifically designed to mimic work i guess. I am the tester. i have stumbled across a rather complex method written by my colleague who isn't here at the moment, and the method returns a boolean. The issue is however that the method...

MVC Route Constraint for bool

What would be a valid regex for a MVC route constraint passing a bool? For example, I have the below route: routes.MapRoute("MenuRouteWithExtension", "Menu.mvc/{action}/{projectId}/{dealerId}/{isGroup}", new { controller = "Menu", action = "RedirectUrl", projectId = "", dealerId = "", isGroup = "" }, new { projectId = @"\d+", dealerId ...

How to return boolean result in named_scope?

named_scope :incomplete?, lambda { |user_id, todo_id| { :select => 1, :conditions => [ "#{user_id} not in (select user_todos.user_id from user_todos) and #{todo_id} not in (select user_todos.todo_id from user_todos)" ] } } I'm getting a nil result. I want it to return true. What I gotta do!? Also, is there a better w...

What form param values can be used for TRUE in a ruby on rails app with mysql db for a BOOLEAN field?

Hi, when contructing a http form parameter for a Boolean, what value ca be used to represent true? That is, ruby on rails database field set to BOOLEAN for a mysql database. ...

Validate a bool that must be true using xVal

I have a business requirement to enforce a check box on a HTML form to be marked as true before allowing submission of the form. I can return the user to the form if this box has not been checked with an appropriate message, but want to return all information from an xVal validation of the form data at the same time. I can't find any i...

iPhone SDK synthesizing BOOL Array

Hello, I get a compiler error when trying to synthesize a bool array like this: // .h #import <UIKit/UIKit.h> @interface SomeViewController : UIViewController { BOOL boolArray[100]; } @property (nonatomic) BOOL boolArray; @end //m #import "SomeViewController" @implementation SomeViewController @synthesize boolArray; @e...

Synthesize a BOOL to set value in Objective C

I have created a BOOL attribute in my Core Data entity called "useSystem". Additionally in order for me to get/set the data I have created an object, however whenever I try to set the synthesized BOOL I get a bus error. This is my code: @property (nonatomic) const BOOL useSystem; So I'm doing [object setUseSystem:YES]; And immediat...

Assembly mask logic question

This is very simple, but I haven't been able to figure it out yet. This question is regarding a assembly mmx, but it's pure logic. Imagine the following scenario: MM0: 04 03 02 01 04 03 02 01 <-- input MM1: 02 02 02 02 02 02 02 02 MM2: 04 03 02 01 04 03 02 01 <-- copy of input after pcmpgtw MM0, MM1 MM0: FF FF 00 00 FF FF 00 0...

How to determine whether a variable is a decimal and it is less than 0.01 in PHP?

How to determine whether a variable is a decimal and it is less than 0.01 in PHP? If I write if($balance<0.01) Will a true value be returned if $balance is not a decimal at all? ...

Flex binding in AS3 - Negate boolean value

I am binding a checkbox to a property on a control. Everything is fine, but I need to bind the checkbox to another property, and the value needs to be the opposite of chkbox.checked. BindingUtils.bindProperty(obj, "propertyBool", checkBox, "selected"); I need something like this... BindingUtils.bindProperty(obj, "propertyBool", chec...

Returning boolean instead of declaring a void type in Java?

Are there any hard and fast rules regarding returning boolean in a method signature to indicate a successful operation as opposed to declaring void? I find that for more critical operations in my calling method I want to know if an operation completed so I can log any issues. Is this an "inappropriate" use of boolean? ...

What does !! (double exclamation point) mean?

In the code below, from a blog post by Alias, I noticed the use of the double exclamation point !!. I was wondering what it meant and where I could go in the future to find explanations for Perl syntax like this. (Yes, I already searched for '!!' at perlsyn). package Foo; use vars qw{$DEBUG}; BEGIN { $DEBUG = 0 unless defined $DEBU...

Boolean Difference between text files on Linux?

Are there any command line linux utilities that will give me the boolean difference between two text files? Meaning: File-A: Apple Pear Orange Banana File-B: Pear Orange Running % program File-A File-B -o output output: Apple Banana Edit: Awesome, thanks guys! ...

How to use the double not (!!) operator in javascript

I understand what the double not operator does in javascript. I'm curious about it's use though and whether or not a recent assertion that I made is correct. I said that if (!!someVar) is never meaningful nor is (!!someVar && ... because both the if and the && will cause someVar to be evaluated as a boolean so the !! is superfluous. In...

Tool to draw logic gates from text

Is there a tool to draw out logic gates / the circuit diagram from a textual description of those gates (such as HDL)? Thank you. ...

VBScript - Create and collect value from array

Hi, I'm trying to figure out how to write a vbscript that does this: I've got a system of checkboxes which represents a type of software. And each of these checkboxes are collected into each own boolean variable. For each of these 'true's I want to send an e-mail. How can I do this using a "for each" loop or something? ...

Are these two combinators already available in Haskell?

I need binary combinators of the type (a -> Bool) -> (a -> Bool) -> a -> Bool or maybe [a -> Bool] -> a -> Bool (though this would just be the foldr1 of the first, and I usually only need to combine two boolean functions.) Are these built-in? If not, the implementation is simple: both f g x = f x && g x either f g x = f x || g...

Ruby on Rails - Checkbox not saving to database?

I've got a migration which uses a boolean value and generates a checkbox in its view. However, no matter what I click, the value saved to the database is not affected. My migration looks like this: def self.up create_table :blogposts do |t| t.string :title t.text :body t.boolean :allow_comments, :default => false...

Predicate<Bool>, pointless or useful?

I'm trying to get my head around the Predicate<T> type and I can understand it when T is anything, except for bool. If you have Predicate<bool>, I don't see how that can be used. Can someone tell me if this is a silly thing to do or if it actually serves a purpose? Predicate<T> already returns a bool, so then testing a condition on a ...