compare

IEqualityComparer for class with many properties

Hi all, which is the best implementation for IEqualityComparer for this class ?? The entity has 7 properties. Thanks in advanced. [Serializable()] public class ServidorSeleccionadoDto { [XmlAttribute()] public int Id { get; set; } [XmlAttribute()] public string Nombre { get; set; } [X...

Is there a quick way to compare two equally formatted tables in SQL?

I would like to make an sql query to compare two tables with identical columns, both names and types. Each table has a unique key. I want the query to return any rows that contain unequal values. I know could do something like this select * from table_1, table_2 where table_1.key = table_2.key and ( table_1.col1 != table_2.col1 OR t...

Java: Finding how many words appear in BOTH data sources?

Hi! I'm trying to figure out if there is an easy way to count the number of words that appear in small paragraph (#1) and small paragraph (#2). Generally, Im determining how much overlap there is in these paragraphs on a word by word basis. So if (#1) contains the word "happy" and (#2) contains the word "happy" that would be like a +1...

Lift compared with Grails

Hi, Lift/Scala is getting a lot of attention lately. Having worked with Grails in the past (and finding it quite handy BTW), I'd like to know if there's anyone who has tried both and what's his/her opinion about them. Is one of them better suited for one kind of scenarios whereas the other is better for other kind, or they compete should...

want to compare a strtotime value to currenttime and output: something x min ago

Hi. I am working on a newsfeed like similar to facebook. Where I compare the time when something happened in my mysql table to the current time and output: something something happened x min ago. First i connect to mysql with this code: $conn = db_connect(); $newsfeed = $conn->query("select info, username, time from ...

Compare two dates in Java

Hi I need to compare two dates in java. I am using the code like this: Date questionDate = question.getStartDate(); Date today = new Date(); if(today.equals(questionDate)){ System.out.println("Both are equals"); } But this is not working. Results for both Dates are like this: questionDate returns like this: 2010-06-30 00:31...

Compare 2 elements of two arrays in C++

I have two arrays each array has some values for instance: int a[] = {1, 2, 3, 4}; int b[] = {0, 1, 5, 6}; now I need to compare the elements of the array (a) with elements in array (b).. if is there any match the program should return an error or print "error there is a duplicate value" etc.. in the above situation, it should retur...

How can I compare MySQL Versions in PHP?

Okay, so I'm getting my MySQL Version like so: preg_replace('#[^0-9\.]#', '', mysql_get_server_info()); Which gives me a number like: 5.1.36 That's all good. What I need to do, is compare that version with another version. I was about to attempt to write my function to compare them, when I thought of version_compare(). However, upon ...

Can't get my array numbers to compare to the other set.

I have two arrays that both hold 5 sets of random numbers. First I display a list of all the numbers in the first array; then I need to add to that list, any number that's not in the first array, and display each of those. To do that, I use another array to put the unique values in to display. I already have a function that displays the...

How to compare two wave data?

I got data measurements from image. I mean profile scan data. (image intensity values that are taken along one line) And what I want is to get data from another image's line and compare them together. I want to know if they are similar or not. For example I got: int data1[N]; int data2[N]; And I want to compare them. If they are not...

C# Sort list, Logical Compare

hello all , i have the following problem I have a list with strings for example (100_1, 100_2 .... , 100_10) I sort the list with following code extraImgsRaw.Sort((photo1, photo2) => photo1.CompareTo(photo2)); the result of this is : 100_1, 100_10, 100_2, 100_3 and so on the result that I want is a logical compare like 100_1, 100_2 ...

Ensure that objects implement Comparable

I have a litte problem and was wondering how to solve it. I have a generic class Tuple<A,B> and now I would like to sort their tuples according to A and B. It should look like this: Unsorted: (1,5) (2,8) (6,8) (1,4) (2,4) Sorted: (1,4) (1,5) (2,4) (2,8) (6,8) For that reason I thought of implementing a generic compare method (pu...

Compare two data.frames to find the rows in data.frame 1 that are not present in data.frame 2

Hi all, I have the following 2 data.frames: a1 <- data.frame(a = 1:5, b=letters[1:5]) a2 <- data.frame(a = 1:3, b=letters[1:3]) I want to find the row a1 has that a2 doesn't. Is there a built in function for this type of operation? (p.s: I did write a solution for it, I am simply curious if someone already made a more crafted code)...

Bool Variable and string value compare in C#

Hello. If I declared a bool isTrue = false; // init it to false and I can get the value from a string strVal = T; // I assumed it is the TRUE value I heard it is not a good code style to compare string in C# like if (isTrue.tostring() == strVal) {}. Some time, I covert the the string variable to enum then I can compare it more conv...

Check Arrays with different keys?

How do i check if a specific array key exist and how to compare them? 1. Array looks like this. [33] => Array ( [211] =>objectr ( [name] => Test [id]=> 211 ) ) [23] => Array ...

MySQL query rows that are in table_b and not in table_a

Hello. I'm doing this query to get rows that are in table_b and not in table_a: SELECT table_b.* FROM table_b LEFT JOIN table_a ON table_b.id = table_a.id WHERE table_a.item_id IS NULL This works ok but I need another condition to apply on table_a. I need to compare only the rows that got column X equal with the ID of 3, not to compar...

if php date is 24 hours after stored mysql date...

Hi all, I'm trying to do a function that will check the php date against what is in the database. If the current date (YYYY-MM-DD HH:MM:SS) is 24 hours after the stored database date, then it will continue, otherwise it won't do anything.. If that makes sense? Here's how I'm trying to get it to work, but not 100% sure how: $now = date...

How to see if the date is later than 8 days?

Hi all, i have a string field (and i can't change this because the date format) on mysql database that contains a date (Like: "01-03-2010"), and i wan't to make a function to compare that date and return true if today's date is newer than 8 days, and false if the date is lower or bigger than today's date... Example: 01-03-2010 < (08-06...

Find lines common to several files

I'm trying to determine which header declares a specific function. I've used grep to find instances of the function's use; now, I want to find which header is included by all the files. I'm aware of the comm utility; however, it can only compare two sorted files. Is there a Unix utility that can find the common lines between an arbitrary...

Case insensitive compare against bunch of strings.

Hi, What would be the best method to compare an NSString to a bunch of other strings case insensitive? If it is one of the strings then the method should return YES, otherwise NO. ...