boolean

Objective-C : BOOL vs bool

Hi, I'm new to Objective-C and I saw the "new type" BOOL (YES, NO). I read that this type is almost like a char. For testing I did : NSLog(@"Size of BOOL %d", sizeof(BOOL)); NSLog(@"Size of bool %d", sizeof(bool)); Good to see that both logs display "1" (sometimes in C++ bool is an int and its sizeof is 4) So I was just wondering ...

passing parameter of boolean type from SSRS to PL/SQL

Hi, Could you please tell me if there is a way to pass the parameter of boolean type from reporting services to PL/SQL. I tried using data type boolean in PL/SQL that is not allowing me to create the dataset. my report is having a radio button , asking for the sort order asc or desc. i was thinking of sorting it from the procedure sid...

Any mnemonic tip for boolean?

I guess this is trivial for most of good1 programmers, but I'm so used to programming using true and false2 that when I encounter 0 and 1, I can never remember which one means true and which one means false. Any suggestions? 1Good: I mean one who knows C, of course :) 2I am a Java developer, as you have guessed ;) ...

How do i pass a boolean type parameter from SSRS to boolean type in PL/SQL

hi, How do i pass a boolean type parameter from SSRS to boolean type in PL/SQL stored procedure. Any idea, i wanted to have the report parameter as radio button in my report design. Please help me to get an idea, if there is a way. thanks, San ...

How do you get your Fulltext boolean search to pick up the term C++ ?

So, I need to find out how to do a fulltext boolean search on a MySQL database to return a record containg the term "C++". I have my SQL search string as: SELECT * FROM mytable WHERE MATCH (field1, field2, field3) AGAINST ("C++" IN BOOLEAN MODE) Although all of my fields contain the string C++, it is never returned in the search resu...

Keyword for exclusive or in ruby?

Does Ruby have a plain-English keyword for exclusive or, like they have "and" and "or"? If not, is this because exclusive or doesn't allow evaluation short-cutting? ...

Returning values...(Edited with new code and more questions) - illegal start of expression

These are my questions: I'm getting a couple of errors on the line "public static boolean validNumCheck(String num){" - "illegal start of expression", "';' expected", and "')' expected". How can I give the user 3 tries in total for each number? I believe right now the programme asks the user for 3 numbers and gives them 3 tries in tota...

Working with MySQL booleans in python

I am querying a MySQL database in python and selecting a boolean value -- so the response from MySQL is either the string 'True' or 'False'. I would like to execute further code based on the boolean value from MySQL. E.g. data = 'False' # assume this is what was returned by MySQL. if data: print 'Success' #really this would be whe...

Easiest way to flip a boolean value?

I just want to flip a boolean based on what it already is. If it's true - make it false. If it's false - make it true. Here is my code excerpt: switch(wParam) { case VK_F11: if (flipVal == true) { flipVal = false; } else { flipVal = true; } break; case VK_F12: if (otherVal == true) { otherValVal = false; } els...

Is there a difference between YES/No,TRUE/FALSE and true/false in objective-c?

Simple question really; is there a difference between these values (and is there a difference between BOOL and bool)? A co-worker mentioned that they evaluate to different things in objective-c, but when i looked at the typedefs in their respective .h files, YES/TRUE/true were all defined to 1 and NO/FALSE/false were all defined to 0. ...

BOOL definition

Whenever BOOL datatype is not readily predefined, I used to boolean with the following definition, typedef unsigned char BOOL; (Owing to memory usage). I realized it may be better to use native bus width for performance reasons. For example, for a 32 bit processor it can be typedef unsigned int BOOL; Now, what will happen for the 64...

How can I get XmlSerializer to encode bools as yes/no?

I'm sending xml to another program, which expects boolean flags as "yes" or "no", rather than "true" or "false". I have a class defined like: [XmlRoot()] public class Foo { public bool Bar { get; set; } } When I serialize it, my output looks like this: <Foo><Bar>true</Bar></Foo> But I would like it to be this: <Foo><Bar>yes</...

Objective C Boolean Array

I need to utilize an array of booleans in objective-c. I've got it mostly set up, but the compiler throws a warning at the following statement: [updated_users replaceObjectAtIndex:index withObject:YES]; This is, I'm sure, because YES is simply not an object; it's a primitive. Regardless, I need to do this, and would greatly appreciate...

Converting an empty string into nil in Ruby

I have a string called word and a function called infinitive such that word.infinitive would return another string on some occasions and an empty string otherwise I am trying to find an elegant ruby one line expression for the code-snippet below if word.infinitive == "" return word else return word.infinitive Had infinitive re...

Declaring a boolean in JavaScript using just var

If I declare a JavaScript boolean variable like this: var IsLoggedIn; And then initialize it with either 'true' or 1, is that safe? Or will initializing it with 1 make the variable a number? ...

Any library that overloaded boolean operators?

Have you ever seen any library/code that overloaded boolean operators, which is said to be evil? and What advantages does it give to the user? ...

The ternary operator and if A, B, else C. Are there any important differences?

There are a few ways to do this in javascript. Foremost and most readable and flexible is probably: if (a){ //b } else { //c } Something else that only* works with assigning and is less readable is: var foo = 'c'; if (a){ foo = 'b'; } My main question, though, is about the last two methods I can think of: var foo = a ...

Convert complex bool condition from string to bool in .NET

I need to parse complex expresion from string to bool. It can only contain: * boolean values (true/false), * parenthesis, * AND/OR operands (&&, ||) Eg: bool.Parse("((true || false) && (false || false)) || (true || false)" Any idea how to achieve this? ...

How CPUs implement Instructions like MUL/MULT?

In different assembly languages MUL (x86)/MULT (mips) refer to multiplication. It is a black box for the programmer. I am interested in how actually a CPU accomplishes a multiplication regardless of the architecture. Lets say I have two 16-bit values in my registers and I am the cpu, so I have to implement MUL using the other bit-fiddlin...

convert bool[] to byte[] C#

I have a list. I want to convert it to a byte[]. How do i do this? .toarray() creates a bool[]. ...