equal

Hows to quick check if data transfer two objects have equal properties in C#?

I have these data transfer objects objects: public class Report { public int Id { get; set; } public int ProjectId { get; set; } //and so on for many, many properties. } I don't want to write public bool areEqual(Report a, Report b) { if (a.Id != b.Id) return false; if (a.ProjectId != b.ProjectId) return false; ...

making a object equal to another object

i know you can make two objects equal to each other when one of them is being declared. i tested this in my program. but when i went to use a assignment statement it freaked out. Can you make two objects equal to each other with a assignment statement or can you only do that when one object is being declared? ...

Creating two delegate instances to the same anonymous method are not equal

Consider the following example code: static void Main(string[] args) { bool same = CreateDelegate(1) == CreateDelegate(1); } private static Action CreateDelegate(int x) { return delegate { int z = x; }; } You would imagine that the two delegate instances would compare to be equal, just as they would when using the good old name...

Softball C++ question: How to compare two arrays for equality?

I am trying to compare two int arrays, element by element, to check for equality. I can't seem to get this to work. Basic pointer resources also welcome. Thank you! int *ints; ints = new int[10]; bool arrayEqual(const Object& obj) { bool eql = true; for(int i=0; i<10; ++i) { if(*ints[i] != obj.ints[i]) eql = ...

JS: Entering a TRUE value into a prompt box and having it alert its variable.

I'm wondering if it's possible to enter a value of a variable into a prompt box have it return to me in an alert of its original variable. Say: var myGoal = "answer"; If I enter "answer" into a prompt, what would a good method be of taking my value of "answer" ,searching, and having it return myGoal in an alert? ...

Doesn't Equal in SQL

Hi Everyone: I am wondering if there is some way to do a doesn't equal command in MYSQL. In other words, can you do a command like this: "SELECT * FROM someTitle WHERE someLabel != 'something'"? My code is returning an error when I attempt this. Thanks for any help! ...

Equal (not a token) in an ANTLR grammar. What does this mean?

What does the construct basename = in the following rule? tabname: (ID'.')? basename = ID ; There is this single occurrence of basename in the grammar. Thanks ...

Equal height divs - complicated with multiple backgrounds

Hi all, I'm trying to create a website and it's design is forcing me to use multiple backgrounds. I'm talking about a technique that looks like this <div id="left"> <div id="left_1"> <div id="left_2"> </div> </div> </div> #left{ width:235px; margin:0; padding:0; float:left; bac...

Comparing One Value To A Whole Array? (C#)

Let's say I have a C# variable and array: int variable_1 = 1; int[3] array_1 = {1,2,3}; How can I check if the value of variable_1 is equal to any of the values in array_1 without looping through array_1? ...

prolog program to find equality of two lists in any order

I wanted to write a prolog program to find equality of two lists, the order of elements doesn't matter. So I wrote following: del( _ , [ ] , [ ] ) . del( X , [ X|T ] , T ). del( X , [ H|T ] , [ H|T1 ] ) :- X \= H , del( X , T , T1 ). member( X, [ X | _ ] ) . member( X, [ _ | T ] ) :- member( X, T ). eq...

C# == operator in Immediate window behaves differently than at run-time

Try the following in the Immediate window: object a1 = "a"; object a2 = "a"; a1==a2 // outputs false and you'll see that a1 == a2 outputs false. However, at runtime in either a window app or console, you'll get true: object t1 = "a"; object t2 = "a"; MessageBox.Show((t1 == t2).ToString()); // outputs true The runtime behavior is c...

How to solve the problem: int cannot be dereferenced

Here I have some value which two of them are integer and I can't call a method on them since they are not reference. How can I solve this? String srcAddr, dstAddr, protocol; int srcPort, dstPort; public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((dstAddr == null) ? 0 : dst...

Gethashcode() function

Why aren't C1 and c2 have the same hashcode ? the code doesn't get to "Same".... ( i=0 in both classes) class myclass { public static int i; static void Main() { myclass c1 = new myclass(); myclass c2 = new myclass(); if (c1.GetHashCode() == c2.GetHashCode()) Console.Write("Same"); ...

=== vs == , whats up?

Possible Duplicate: Javascript === vs == : Does it matter which equal operator I use? In PHP and Javascript code i'm seeing more === out there as opposed to what I'm used to == for equality. Is === just a fancy way to write == ? Whats the deal with the xtra = sign? PHP Code example: <?php // Parsing Yahoo! REST Web Service ...

Is there a "not equal" in a linq join

I am trying accomplish the LINQ query below but I need a "not equal" instead of equal, so that filteredEmployees has all employees from groupA minus groupB. List<Employee> groupA = getEmployeeA(); List<Employee> groupB = getEmployeeB(); var filteredEmployees = from a in groupA join b in groupB on a.Nam...

How to calculate axis ticks at a uniform distribution?

Given a data range by its minimum and maximum value, how can one calculate the distribution of buckets on a an axis? The requirements are: - The axis ticks shall be evenly distributed (equal size). - Further, all ticks shall appear as numbers like 10, 20, 30, ... or -0.3, 0.1, 0.2, 0.4, ... - The calculation shall accept a parameter that...

What is faster in mysql, equal or greater on numeric columns?

I have numeric data with numbers representing the event that happened. Events can be public or private. I have 2 choices and I don't know which one to use (is faster). I can make 2 columns, 1 is the event column and the values are like 1...10. The other is the public/private smallint column that says if the event is public or private. ...

Question about == operator in java

public class Demo { public static void main(String[] args) { String s1 = "Hello"; String s2 = "Hello"; System.out.println("s1 == s2 " + (s1 == s2)); String s5 = "Hel" + "lo"; String s6 = "He" + "llo"; System.out.println("s5 == s6 " + (s5 == s6)); String s7 = "He"; ...