Questions tagged [compare]

The analysis required to assess the differences and similarities between two or more entities.

This tag is used to classify a question as one dealing with the comparison of at least two entities. The essence of questions that are tagged should boil down to one of the following questions:

  1. How do I control when the compiler/interpreter thinks that two entities are equal? How do I control when the compiler/interpreter thinks that two entities are unequal?
  2. How do I control when the compiler/interpreter thinks that one entity is bigger than the other?
  3. How do I control when the compiler/interpreter thinks that one entity is smaller than the other?

Note that in some languages, it is possible to define asymmetric inequalities. That is, cases in which a<b does not mean that b<a. This is why in python, there exist separate functions for __gt__ (greater than) and __lt__ (less than), etc

10212 questions
60
votes
4 answers

Mysql Compare two datetime fields

I want to compare two dates with time, I want all the results from tbl where date1 > date2 Select * From temp where mydate > '2009-06-29 04:00:44'; but it is just comparing dates not time. it is giving me all the result set of today's…
MySQL DBA
  • 5,692
  • 21
  • 54
  • 71
58
votes
6 answers

Java. Ignore accents when comparing strings

The problem it's easy. Is there any function in JAVA to compare two Strings and return true ignoring the accented chars? ie String x = "Joao"; String y = "João"; return that are equal. Thanks
framara
  • 2,833
  • 5
  • 28
  • 32
57
votes
6 answers

Compare 2 directories in windows

I need to compare 2 folders "A" and "B" and get the list of files and folders newly added or modified. I tried using Winmerge software but it is not comparing the files present inside the internal folders(so i have to point to each internal folder…
user2369634
  • 897
  • 3
  • 9
  • 17
55
votes
15 answers

In Perl, is there a built in way to compare two arrays for equality?

I have two arrays of strings that I would like to compare for equality: my @array1 = ("part1", "part2", "part3", "part4"); my @array2 = ("part1", "PART2", "part3", "part4"); Is there a built-in way to compare arrays like there is for scalars? I…
Bill
  • 14,257
  • 4
  • 43
  • 55
54
votes
6 answers

An easy way to diff log files, ignoring the time stamps?

I need to diff two log files but ignore the time stamp part of each line (the first 12 characters to be exact). Is there a good tool, or a clever awk command, that could help me out?
Teflon Ted
  • 8,696
  • 19
  • 64
  • 78
53
votes
9 answers

Comparing text files with Junit

I am comparing text files in junit using: public static void assertReaders(BufferedReader expected, BufferedReader actual) throws IOException { String line; while ((line = expected.readLine()) != null) { assertEquals(line,…
jon077
  • 10,303
  • 11
  • 39
  • 37
52
votes
4 answers

How to compare time part of datetime

Let's say we have DateTime t1 = DateTime.Parse("2012/12/12 15:00:00.000"); and DateTime t2 = DateTime.Parse("2012/12/12 15:03:00.000"); How to compare it in C# and say which time is "is later than"?
NoWar
  • 36,338
  • 80
  • 323
  • 498
48
votes
1 answer

Compare 2 JSON objects

Possible Duplicate: Object comparison in JavaScript Is there any method that takes in 2 JSON objects and compares the 2 to see if any data has changed? Edit After reviewing the comments, some clarification is needed. A JSON object is defined as…
user356808
47
votes
9 answers

Image comparison algorithm

I'm trying to compare images to each other to find out whether they are different. First I tried to make a Pearson correleation of the RGB values, which works also quite good unless the pictures are a litte bit shifted. So if a have a 100% identical…
honeymoon
  • 2,400
  • 5
  • 34
  • 43
46
votes
7 answers

Comparing 2 lists consisting of dictionaries with unique keys in python

I have 2 lists, both of which contain same number of dictionaries. Each dictionary has a unique key. There is a match for each dictionary of the first list in the second list, that is a dictionary with a unique key exists in the other list. But the…
alwbtc
  • 28,057
  • 62
  • 134
  • 188
46
votes
5 answers

What is the benefit of using Spring REST Docs comparing to Swagger

Spring REST Docs was released recently and the documentation says: This approach frees you from the limitations imposed by tools like Swagger So, I wanted to ask when Spring REST Docs is preferable to use comparing to Swagger and which limitations…
evgeniy44
  • 2,862
  • 7
  • 28
  • 51
45
votes
1 answer

AngularJS vs ReactJS

I am deciding which JavaScript framework to use for my new web application. I wanted to use Angular, but recently heard about React. The problem is - I have not found a really good comparison between the both. Most of the articles which do a…
Asped
  • 3,083
  • 4
  • 31
  • 52
44
votes
6 answers

How to compare Unicode strings in Javascript?

When I wrote in JavaScript "Ł" > "Z" it returns true. In Unicode order it should be of course false. How to fix this? My site is using UTF-8.
Tomasz Wysocki
  • 11,170
  • 6
  • 47
  • 62
43
votes
12 answers

How to compare two tarball's content

I want to tell whether two tarball files contain identical files, in terms of file name and file content, not including meta-data like date, user, group. However, There are some restrictions: first, I have no control of whether the meta-data is…
myjpa
  • 433
  • 1
  • 4
  • 7
42
votes
6 answers

Git: Compare All Local Commits to Remote Repo Version

I'm somewhat new to Git and what I'm trying to do seems like it should be possible. Basically I've been working off of clone of a repo and have made quite a few local commits. Is there a way to see the diff of the 'sum' of all my changes and the…
Ian Dallas
  • 12,451
  • 19
  • 58
  • 82