Search Results

Search found 7797 results on 312 pages for 'boolean operations'.

Page 1/312 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

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

    - by Bq
    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 out Im actually supposed to use OR instead of AND awk '/!CORE/||/!PORT/{print}' I would be really glad if some one could explain where my thinking is wrong and super glad if it could be visualized with a venn diagram or something like the boolean machine at kathyschrock

    Read the article

  • Dynamically evaluating simple boolean logic in Python

    - by a paid nerd
    I've got some dynamically-generated boolean logic expressions, like: (A or B) and (C or D) A or (A and B) A empty - evaluates to True The placeholders get replaced with booleans. Should I, Convert this information to a Python expression like True or (True or False) and eval it? Create a binary tree where a node is either a bool or Conjunction/Disjunction object and recursively evaluate it? Convert it into nested S-expressions and use a Lisp parser? Something else? Suggestions welcome.

    Read the article

  • Database model for saving random boolean expressions

    - by zarko.susnjar
    I have expressions like this: (cat OR cats OR kitten OR kitty) AND (dog OR dogs) NOT (pigeon OR firefly) Anyone having idea how to make tables to save those? Before I got request for usage of brackets, I limited usage of operators to avoid ambiguous situations. So only ANDs and NOTs or only ORs and saved those in this manner: operators id | name 1 | AND 2 | OR 3 | NOT keywords id | keyword 1 | cat 2 | dog 3 | firefly expressions id | operator | keywordId 1 | 0 | 1 1 | 1 | 2 1 | 3 | 3 which was: cat AND dog NOT firefly But now, I'm really puzzled...

    Read the article

  • JAXB boolean handling oddities and JSF

    - by finrod
    There is a known bug in JAXB: https://jaxb.dev.java.net/issues/show_bug.cgi?id=733 JAXB does not properly generate boolean field getters and setters, this bug is left unfixed for backwards compatibility. A JAXB plugin exists and will ensure that the following getters and setters for boolean fields are generated: setXXX(Boolean value) is generated getXXX() is generated If the boolean attribute specifies default value in the XSD, then getXXX() returns boolean, If the boolean attribute does not specify default in the XSD, then getXXX() returns Boolean. Problem: trying to edit/view the XXX field in a JSF component (such as checkbox) does not work - the component is disabled. I have not traced this in depth but the assumption (backed by the workaround below) is that JSF EL resolver (or whathaveyou) looks for Boolean getXXX() method and since it does not find it, the component is disabled. Workaround: If I change the getXXX() method to always return Boolean, then everything goes. Questions: What are your ideas to address this problem? Have I missed some customization for the boolean-getter JAXB plugin? Is it possible (does it make sense) to alter JSF resolver (or whathaveyou) so that if Boolean getXXX() is not found, it will fall back to boolean getXXX()? I would prefer not to manually intervene and change all the generated getXXX() methods to return Boolean instead of boolean.

    Read the article

  • How ca I return a value from a function

    - by Shadi Al Mahallawy
    I used a function to calculate information about certain instructions I intialized in a map,like this void get_objectcode(char*&token1,const int &y) { map<string,int> operations; operations["ADD"] = 18; operations["AND"] = 40; operations["COMP"] = 28; operations["DIV"] = 24; operations["J"] = 0X3c; operations["JEQ"] =30; operations["JGT"] =34; operations["JLT"] =38; operations["JSUB"] =48; operations["LDA"] =00; operations["LDCH"] =50; operations["LDL"] =55; operations["LDX"] =04; operations["MUL"] =20; operations["OR"] =44; operations["RD"] =0xd8; operations["RSUB"] =0x4c; operations["STA"] =0x0c; operations["STCH"] =54; operations["STL"] =14; operations["STSW"] =0xe8; operations["STX"] =10; operations["SUB"] =0x1c; operations["TD"] =0xe0; operations["TIX"] =0x2c; operations["WD"] =0xdc; if ((operations.find("ADD")->first==token1)||(operations.find("AND")->first==token1)||(operations.find("COMP")->first==token1) ||(operations.find("DIV")->first==token1)||(operations.find("J")->first==token1)||(operations.find("JEQ")->first==token1) ||(operations.find("JGT")->first==token1)||(operations.find("JLT")->first==token1)||(operations.find("JSUB")->first==token1) ||(operations.find("LDA")->first==token1)||(operations.find("LDCH")->first==token1)||(operations.find("LDL")->first==token1) ||(operations.find("LDX")->first==token1)||(operations.find("MUL")->first==token1)||(operations.find("OR")->first==token1) ||(operations.find("RD")->first==token1)||(operations.find("RSUB")->first==token1)||(operations.find("STA")->first==token1)||(operations.find("STCH")->first==token1)||(operations.find("STCH")->first==token1)||(operations.find("STL")->first==token1) ||(operations.find("STSW")->first==token1)||(operations.find("STX")->first==token1)||(operations.find("SUB")->first==token1) ||(operations.find("TD")->first==token1)||(operations.find("TIX")->first==token1)||(operations.find("WD")->first==token1)) { int y=operations.find(token1)->second; //cout<<hex<<y<<endl; } return ; } which if I cout y in the function gives me an answer just fine which is what i need but there is a problem tring to return the value from the function so that I could use it outside the function , it gives a whole different answer, what is the problem

    Read the article

  • Bitwise Operations -- Arithmetic Operations..

    - by RBA
    Hi, Can you please explain the below lines, with some good examples. A left arithmetic shift by n is equivalent to multiplying by 2n (provided the value does not overflow), while a right arithmetic shift by n of a two's complement value is equivalent to dividing by 2n(2 to the power n) and rounding toward negative infinity. If the binary number is treated as ones' complement, then the same right-shift operation results in division by 2n and rounding toward zero. Thankx..

    Read the article

  • What is the difference between the Boolean object and the Boolean data type in JavaScript?

    - by DarkLightA
    The Boolean type has two literal values: true and false. Do not confuse the primitive Boolean values true and false with the true and false values of the Boolean object. The Boolean object is a wrapper around the primitive Boolean data type. See Boolean Object for more information. What does this mean? What's the difference between the Boolean object and the Boolean data type??

    Read the article

  • Designing binary operations(AND, OR, NOT) in graphs DB's like neo4j

    - by Nicholas
    I'm trying to create a recipe website using a graph database, specifically neo4j using spring-data-neo4j, to try and see what can be done in Graph Databases. My model so far is: (Chef)-[HAS_INGREDIENT]->(Ingredient) (Chef)-[HAS_VALUE]->(Value) (Ingredient)-[HAS_INGREDIENT_VALUE]->(Value) (Recipe)-[REQUIRES_INGREDIENT]->(Ingredient) (Recipe)-[REQUIRES_VALUE]->(Value) I have this set up so I can do things like have the "chef" enter ingredients they have on hand, and suggest recipes, as well as suggest recipes that are close matches, but missing one ingredient. Some recipes can get complex, utilizing AND, OR, and NOT type logic, something like (Milk AND (Butter OR spread OR (vegetable oil OR olive oil))) and I'm wondering if it would be sane to model this in a graph using a tree type representation? An example of what I was thinking is to create three "node" types of AND, OR, and NOT and have each of them connect to the nodes value underneath. How else might this be represented in a Graph Database or is my example above a decent representation?

    Read the article

  • In which order I had to simplify this Boolean expression?

    - by user3662105
    I have to simplify this Boolean expression but i quite found it difficult since don't know in which order had to start with. the expression is: (x iff y) or (y iff z) if x found it little complicated to simplify since i don't know the order do I have to write it like: ((x iff y) or (y iff z)) if x or: (x iff y) or ((y iff z) if x) if you can give me a spot on this section of Boolean algebra. and I really will appreciate it if you gave me steps on how to simplify it. and had to say that I already tried a lot, solved a lot, tried wolfram alpha and others too even compared the results using truth tables but get different results and didn't know the right one from them. thanks in advance for your helping

    Read the article

  • JTable Boolean cell .. how to read it

    - by dimitar
    Hello guys, i have a table with a column that contains Boolean type. now when i try to run a program i have a problem: System.out.println(table.getColumnClass(5)); b= (Boolean)table.getValueAt(row, 5); It prints class java.lang.Boolean but also: Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean and i even try with b= (Boolean)table.getValueAt(row, 5); b= Boolean.parseBoolean((String)table.getValueAt(row, 5)); b= table.getValueAt(row, 5); but those show error too. So how to fix this guys?

    Read the article

  • iPhone: Save boolean into Core Data

    - by Nic Hubbard
    I have set up one of my core data attributes as a Boolean. Now, I need to set it, but XCode keeps telling me that it may not respond to setUseGPS. [ride setUseGPS: useGPS.on]; What is the method for setting a boolean in core data? All my other attributes are set this way, and they work great. So, not sure why a boolean does not work to be set this way?

    Read the article

  • Rails migration to add boolean column to Postgres on Heroku

    - by pmc255
    I'm trying to execute a simple Rails migration to add a boolean column to an existing table. Here's the add_column call: add_column :users, :soliciting, :boolean, :null => false, :default => false However, after the migration runs (successfully, with no errors), I don't see the new column. If I go into the console and list the columns on the User table, for example, with this command: >> User.columns.each { |c| puts "#{c.name} : #{c.type}" } All the other columns show up, but not the one I just added with the migration. What's even more strange is that looking up a random user object yields the Postgres version of booleans (Ruby strings) >> User.find(1).soliciting => "t" However, the existing boolean columns all show up with standard Ruby boolean values of true and false. What's going on here? Is the migration actually complete? Why doesn't the column show up, yet is accessible in the model objects?

    Read the article

  • test="" on a boolean always returns true

    - by user70448
    Why does <xsl:if test="<XPATH to boolean value here>"> ... </xsl:if> ALWAYS return true? Since boolean can be 0,1,"false" and "true" by definition, the ONLY way to test for a boolean value is to do string comparison against these. This can't be right.

    Read the article

  • JAXB - representing element as boolean?

    - by Marcus
    We have this XML: <Summary> <ValueA>xxx</ValueA> <ValueB/> </Summary> <ValueB/> will never have any attributes or inner elements. It's a boolean type element - it exists (true) or it doesn't (false). JAXB generated a Summary class with a String valueA member, which is good. But for ValueB, JAXB generated a ValueB inner class and a corresponding member: @XmlElement(name = "ValueB") protected Summary.ValueB valueB; But what I'd like is a boolean member and no inner class: @XmlElement(name = "ValueB") protected boolean valueB; How can you do this? I'm not looking to regenerate the classes, I'd like to just make the code change manually.

    Read the article

  • JAXB - representing an element as a boolean member?

    - by Marcus
    We have this XML: <Summary> <ValueA>xxx</ValueA> <ValueB/> </Summary> <ValueB/> will never have any attributes or inner elements. It's a boolean type element - it exists (true) or it doesn't (false). JAXB generated a Summary class with a String valueA member, which is good. But for ValueB, JAXB generated a ValueB inner class and a corresponding member: @XmlElement(name = "ValueB") protected Summary.ValueB valueB; But what I'd like is a boolean member and no inner class: @XmlElement(name = "ValueB") protected boolean valueB; How can you do this? I'm not looking to regenerate the classes, I'd like to just make the code change manually.

    Read the article

  • Rewrite probabilities as boolean algebra

    - by Magsol
    I'm given three binary random variables: X, Y, and Z. I'm also given the following: P(Z | X) P(Z | Y) P(X) P(Y) I'm then supposed to determine whether or not it is possible to find P(Z | Y, X). I've tried rewriting the solution in the form of Bayes' Theorem and have gotten nowhere. Given that these are boolean random variables, is it possible to rewrite the system in terms of boolean algebra? I understand that the conditionals can be mapped to boolean implications (x -> y, or !x + y), but I'm unsure how this would translate in terms of the overall problem I'm trying to solve. (yes, this is a homework problem, but here I'm much more interested in how to formally solve this problem than what the solution is...I also figured this question would be entirely too simple for MathOverflow)

    Read the article

  • Is there a boolean literal in SQLite?

    - by Benjamin Oakes
    I know about the boolean column type, but is there a boolean literal in SQLite? In other languages, this might be true or false. Obviously, I can use 0 and 1, but I tend to avoid so-called "magic numbers" where possible. From this list, it seems like it might exist in other SQL implementations, but not SQLite. (I'm using SQLite 3.6.10, for what it's worth.)

    Read the article

  • php string versus boolean speed test

    - by ae
    I'm looking at trying to optimise a particular function in a php app and foolishly assumed that a boolean lookup in a 'if' statement would be quicker than a string compare. But to check it I put together a short test (see below). To my surprise, the string lookup was quicker. Is there anything wrong with my test (I'm wired on too much coffee so I'm suspicious of my own code)? If not, I would be interested in any comments people have around string versus boolean lookups in php. The result for the first test (boolean lookup) was 0.168 The result for the second test (string lookup) was 0.005 <?php $how_many = 1000000; $counter1 = 0; $counter2 = 0; $abc = array('boolean_lookup'=>TRUE, 'string_lookup'=>'something_else'); $start = microtime(); for($i = 0; $i < $how_many; $i++) { if($abc['boolean_lookup']) { $counter1++; } } echo ($start - microtime()); echo '<hr>'; $start = microtime(); for($i = 0; $i < $how_many; $i++) { if($abc['string_lookup'] == 'something_else') { $counter2++; } } echo ($start - microtime());

    Read the article

  • boolean in java: what am I doing wrong?

    - by Cheesegraterr
    Hello, I am trying to make my boolean value work. I am new at programming java so I must be missing something simple. I am trying to make it so that if one of the tire pressures is below 35 or over 45 the system outputs "bad inflation" For class me must use a boolean which is what I tried. I cant figure out why this isnt working. No matter what I do the boolean is always true. Any tips? public class tirePressure { private static double getDoubleSystem1 () //Private routine to simply read a double in from the command line { String myInput1 = null; //Store the string that is read form the command line double numInput1 = 0; //Used to store the converted string into an double BufferedReader mySystem; //Buffer to store input mySystem = new BufferedReader (new InputStreamReader (System.in)); // creates a connection to system files or cmd try { myInput1 = mySystem.readLine (); //reads in data from console myInput1 = myInput1.trim (); //trim command cuts off unneccesary inputs } catch (IOException e) //checks for errors { System.out.println ("IOException: " + e); return -1; } numInput1 = Double.parseDouble (myInput1); //converts the string to an double return numInput1; //return double value to main program } static public void main (String[] args) { double TireFR; //double to store input from console double TireFL; double TireBR; double TireBL; boolean goodPressure; goodPressure = false; System.out.println ("Tire Pressure Checker"); System.out.println (" "); System.out.print ("Enter pressure of front left tire:"); TireFL = getDoubleSystem1 (); //read in an double from the user if (TireFL < 35 || TireFL > 45) { System.out.println ("Pressure out of range"); goodPressure = false; } System.out.print ("Enter pressure of front right tire:"); TireFR = getDoubleSystem1 (); //read in an double from the user if (TireFR < 35 || TireFR > 45) { System.out.println ("Pressure out of range"); goodPressure = false; } if (TireFL == TireFR) System.out.print (" "); else System.out.println ("Front tire pressures do not match"); System.out.println (" "); System.out.print ("Enter pressure of back left tire:"); TireBL = getDoubleSystem1 (); //read in an double from the user if (TireBL < 35 || TireBL > 45) { System.out.println ("Pressure out of range"); goodPressure = false; } System.out.print ("Enter pressure of back right tire:"); TireBR = getDoubleSystem1 (); //read in an double from the user if (TireBR < 35 || TireBR > 45) { System.out.println ("Pressure out of range"); goodPressure = false; } if (TireBL == TireBR) System.out.print (" "); else System.out.println ("Back tire pressures do not match"); if (goodPressure = true) System.out.println ("Inflation is OK."); else System.out.println ("Inflation is BAD."); System.out.println (goodPressure); } //mainmethod } // tirePressure Class

    Read the article

  • Why Use !boolean_variable Over boolean_variable == false

    - by ell
    A comment on this question: Calling A Method that returns a boolean value inside a conditional statement says that you should use !boolean instead of boolean == false when testing conditions. Why? To me boolean == false is much more natural in English and is more explicit. I apologise if this is just a matter of style, but I was wondering if there was some other reason for this preference of !boolean?

    Read the article

  • How to parse a string of boolean logic in PHP

    - by TheOddLinguist
    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 the boolean result of the parsed logic is true or false. I tried eval(), but I get no output at all. I tried typecasting the boolean returns...but there's no way to typecast operators...hehe Any ideas? (Let me know if you need more information.)

    Read the article

  • How do I parse boolean logic?

    - by d03boy
    I need to write a boolean logic parser which will translate the boolean logic language to a SQL WHERE clause. The order of the operands will always be in the correct order (with value on the right). Here is a relatively simple example. There could be nested parentheses and the use of NOT operators, etc. (CACOUNT=01 OR CACOUNT=02 OR CACOUNT=03 OR CACOUNT=05 OR CACOUNT=07 OR CACOUNT=09 OR CACOUNT=12 OR CACOUNT=13 OR CACOUNT=18) AND Q4=1 AND NAME=TIMOTHY Here is what the WHERE clause would resemble. WHERE ( EXISTS ( SELECT 1 FROM MyVerticalTable b WHERE b.Key=a.Key AND b.Key='CACOUNT' AND b.Value='01' ) )

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >