operators

| operator versus || operator

Simple question but what does the | operator do as opposed to the || (or) operator? ...

How to impose, in a C# generic type parameter, that some operators are supported?

Hello, I am recently working on a C# class library implementing an algorithm. The point is that I would like the users of the library to be able to choose the machine precision (single or double) the algorithm should operate with, and I'm trying to do it with generics. So, for instance: Algorithm<double> a = new Algorithm<doubl...

Why there are no ++ and -- operators in Python?

Why there are no ++/-- operators in Python? ...

MySQL greater than or equal to operator is ignoring its or equal to obligation

If a price in a row is 38.03, then the following search restrictions should all return the row containg the result. WHERE price >= '38.02' AND price <= '38.03' (This works) WHERE price >= '20' AND price <= '100' (This works) WHERE price >= '38.03' AND price <= '38.03' (This doesn't work) WHERE price >= '38.03' AND price <= '100' (Thi...

Multiple preincrement operations on a variable in C++(C ?)

Why does the following compile in C++? int phew = 53; ++++++++++phew ; The same code fails in C, why? ...

In PHP, what does "<<<" represent?

For example: $sql = <<<MySQL_QUERY Thank you! ...

Overloading << operator in C++

I want to overload << operator in a Line class so I can print an object using cout like this: cout << myLineObject << endl; but this is not working: class Line{ public: float m; float b; string operator << (Line &line){return ("y = " + line.m + "x + " + line.b);}; }; I get: Invalid operands of types 'const char [5]' an...

How to override operator << ?

hey, i have overridden operator<< and when i'm trying to use it in a print method (const) i'm getting an error : the overriden operator : ostream& operator <<(ostream& os, Date& toPrint) { return os << toPrint.GetDay() << "/" << toPrint.GetMonth() << "/" << toPrint.GetYear(); } where i'm trying to use it : void TreatmentHistory...

No increment operator (++) in Ruby?

Possible Duplicate: Why doesn't Ruby support i++ or i for fixnum? Why is there no increment operator in Ruby? e.g i++ ++i Is the ++ operator used for something else? Is there a REAL reason for this? ...

Scala $ operator

Has Scala a Haskell-like $ operator? ...

operator as template parameter

Is it possible? template<operator Op> int Calc(int a, b) { return a Op b; } int main() { cout << Calc<+>(5,3); } If not, is way to achieve this without ifs and switches? ...

What are the | and ^ operators used for?

Possible Duplicate: What are bitwise operators? Recently I came across a few samples that used the | and ^ operator. I am guessing these are or and negation operators. So what actually do these operators stands for? ...

PHP: if(!$one == $two) doesn't work always?

Yes, this is just a question i would like to get an answer on. I experienced it a couple of times, where this: if(!$one == $two){ echo "Not the same"; }else{ echo "The same"; } Will not work, and if($one == $two){ echo "The same"; }else{ echo "Not the same"; } will work. Why doesn't it work sometimes? I always need to recode like ...

how to Override operator <

I'm trying to override operator < as the following : inside Node : bool operator <(const Node* other) { return *(this->GetData()) < *(other->GetData()); } inside vehicle : bool operator <(const Vehicle &other) { return this->GetKilometersLeft() < other.GetKilometersLeft(); } invoking the operator : while (index > 0 && m_he...

C# assignment question

In the following snippet: long frameRate = (long)(_frameCounter / this._stopwatch.Elapsed.TotalSeconds); Why is there an additional (long)(...) to the right of the assignment operator? ...

calculating the number of days using strtotime returns wrong result

I have two dates stored in a mysql database (Type = date). For example - Date 1 = 2010-09-20 Date 2 = 2010-10-20 I want to calculate the number of days between these two dates. So have tried this - $number_days = (strtotime($date2) - strtotime($date1) / (60 * 60 * 24)); But this returns 49 How so? -------------------------------...

Using reverse operators in Python

I have never handled reverse operators before, so please no flaming! Just finished learning about them so wanted to try them out. But for some reason, it is not working. Here is the code: >>> class Subtract(object): def __init__(self, number): self.number = number def __rsub__(self, other): return self.number - ...

Java |= operator question

I need help about this strange operator |=. Can you explain to me what this code does ? @Override public boolean addAll(Collection<? extends E> c) { boolean result = false; for (E e : c) { result |= add(e); } return result; } ...

XQuery: Compare one value to multiple values like SQL "in" command

Hello, I need to compare one value to multiple other values (a query resulting in more than one element), therefore, if a value is included in some other values. In SQL there's the "IN" operator for that, but what about XQuery? Thanks for any hint :-) ...

Jquery - operators in if statement

Hi All, I'm trying to submit a form to a different location depending on which (of two) form fields have been filed in. It work when both fields have a value but when only one if field has a value it always submits to the suppliers/category/ URL. Here is my code. $('#suppliersForm').submit(function() { catVal = $('#category').val() k...