boolean

objected returned as boolean inside if clause

I don't know enough about when and how various variables are returned. Considering I have an conditional statement with an object to validate inside of this. Am I right that this is returned as a boolean value. if($id = $oE->validate($_POST, $_FILES)){ ... } What I really want is for this to return an array of errors if there are any ...

Java: volatile boolean vs AtomicBoolean

What does AtomicBoolean do that a volatile boolean cannot achieve? ...

What is the favorable naming convention for methods or properties returning a boolean value in Ruby?

I've seen all of these: is_valid is_valid? valid? Is there a preferred one? EDIT: More conditionals: has_comment has_comment? comment? was_full was_full? full? Please do add more descriptive examples. ...

Convert boolean to int in Java

What is the most accepted way to convert a boolean to an int in Java? ...

What is the order of evaluating boolean sentence?

Possible Duplicate: Is short-circuiting boolean operators mandated in C/C++? And evaluation order? Is there any defined by standard or math rules order of eveluating boolean sentences? For example: if (firstTrue && secondTrue) { } can I be sure that firstTrue will be checked first? ...

Handling BOOlen resultset in java

Dear All, I have one query that returns string value, my query is select case when (select count (distinct style_packing_spec_id) from packing_spec_uses_pack p,style_pack sp where sp.style_pack_id=p.style_pack_id and sp.style_id=1701) != (select count (distinct style_packing_spec_id) from style_packing_spec where style_id=1701) then 'D...

Bool issue - changing value

Morning all. I have the following method that I use to to try and bring back a bool: public static bool GetShowCatSubProdStatus(string memberid, string username) { MyEnts showcatsubprodstatus = new MyEnts.PDC_VDSOREntities35(); var r = from p in showcatsubprodstatus.tblKeyAccountInfoes where p.Membe...

How to write Boolean to a plist file

I'm trying to write Boolean to a plist file. My code is: NSString *filePath = [self dataFilePath]; if (filePath) { if (check) { NSLog(@"Clear"); [item setObject:[NSNumber numberWithBool:NO] forKey:@"check"]; [item writeToFile:filePath atomically: YES]; }else{ NSLog(@"Green"); [item setObject:[NSNumber numberWit...

Is if(var == true) faster than if(var != false)?

Pretty simple question. I know it would probably be a tiny optimization, but eventually you'll use enough if statements for it to matter. EDIT: Thank you to those of you who have provided answers. To those of you who feel a need to bash me, know that curiosity and a thirst for knowledge do not translate to stupidity. And many thanks t...

Restoring a BOOL inside an NSDictionary from a plist file

I have a plist file which contains an array of dictionaries. Here is one of them: Fred Dictionary Name Fred isMale [box is checked] So now I am initializing my Person object with the dictionary I read from the plist file: -(id) initWithDictionary: (NSDictionary *) dictionary { if (self = [super init]) self.name =...

JavaScript false/null var inside if clause

Hello! What kind of variables will NOT pass through this: if(myVar){//code} Boolean false? NULL? Boolean false and NULL? Anything else? Thank you. ...

Java Beginner Boolean Question

Ok so lets say I have boolean x = false. If I have a loop that says while (!x) does this mean while x is NOT false (true) or while x is NOT true (false)? EDIT: Ok I'm a bit confused, I think Im getting different answers. So if I have int x=0; boolean add1=false; while (!add1){ x=1; } What is the final value of x in this ca...

HaXe -- compare two strings ignoring case?

I'm working on a string-to-bool parsing function for HaXe (somehow the devs got by until now without one >.<) and i figured the best way to check the string would be ignoring case. I'm not sure how to do that though, can someone help me? ...

How to use a boolean in NSUserDefaults

When the root view controller of my application is loaded, I want to be able to check whether or not the users login credentials have been saved to NSUserDefaults. Basically, when the user loads the application and he/she doesn't have her login credentials saved, a modalAlertView will be pushed and the user will be able to save their cr...

How can I Scan file to search for value

I need to scan an input file and search for a specific value. How do I do that? ...

Is using char as a bool in C bad practice?

Is there any downside to using typedef char bool; enum boolean { false, true }; in C to provide a semantic boolean type? ...

Regex c# shouldnt match Boolean Operators

Hi, I'm trying to write a regex which should be able to identify boolean expressions. I need to avoid cases like IF(AND AND AND). The name of the variable shouldn't be one of the following operators (OR;AND;XOR). I tried to use [^(OR)] but this wasn't helpful. My Regex looks like this: (?:<Name> [A-Za-z0-9]) Is there any chance t...

Android boolean preference problem

I want to have the status of a checkbox be saved into my prefs. I set a listener on the checkbox, and if it is checked I do a prefs.putBoolean("cbstatus", true), and it is it unchecked i do a prefs.putBoolean("cbstatus", false); Trouble is, in my onStart() when I get prefs, my Boolean getcbstatus = prefs.getBoolean("cbstatus", false); ...

Booleans, conditional operators and autoboxing

Why does this throw NPE public static void main(String[] args) throws Exception { Boolean b = true ? returnsNull() : false; // NPE on this line. System.out.println(b); } public static Boolean returnsNull() { return null; } while this doesn't public static void main(String[] args) throws Exception { Boolean b = true ?...

How do you desearialize a bool from Xml with custom true and false values?

I am trying to deserialize an Xml document to a C# class. The Xml looks something like this: <response> <result>Success</result> </response> That result can be only "Success" or "Failed". When I deserialize it I want to put the value into a bool with "Success" = true and "Failed" = false. I can't quite figure out how to set the tr...