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
42
votes
12 answers

Is there an open source SQL Server DB compare tool?

I'm working on an open source project that uses SQL Server 2005 as the data store. We need a DB compare tool to generate diff scripts to be able to upgrade a DB from one version to another. Is there an open source or free SQL Server DB diff tool out…
Guy
  • 65,082
  • 97
  • 254
  • 325
39
votes
8 answers

How to compare a list of lists/sets in python?

What is the easiest way to compare the 2 lists/sets and output the differences? Are there any built in functions that will help me compare nested lists/sets? Inputs: First_list = [['Test.doc', '1a1a1a', 1111], ['Test2.doc', '2b2b2b',…
tang
  • 413
  • 1
  • 4
  • 5
39
votes
6 answers

How to compare two date values with jQuery

I have two String fields which represent Dates in my page and I would like to compare these two fields to know if my first date < second date. How can I do this? First Date:
Mercer
  • 9,736
  • 30
  • 105
  • 170
39
votes
1 answer

How to compare/show the difference between 2 videos in ffmpeg?

I am a newbie at encoding. I have read and tried x264 in lossless mode (-qp 0), however I'd like to make sure that in my new video, every single pixel contains the same information as the source file (which is in YUV 420 so the loss of color…
polarka
  • 546
  • 1
  • 5
  • 9
38
votes
6 answers

Remove duplicate CSS declarations across multiple files

I'm looking to remove duplicate CSS declarations from a number of files to make implementing changes easier. Is there a tool that can help me do that? Right now I'm faced with something like this: styles.css #content…
kotekzot
  • 1,518
  • 1
  • 14
  • 23
38
votes
7 answers

Text comparison algorithm

We have a requirement in the project that we have to compare two texts (update1, update2) and come up with an algorithm to define how many words and how many sentences have changed. Are there any algorithms that I can use? I am not even looking for…
java_mouse
  • 2,069
  • 4
  • 21
  • 30
38
votes
3 answers

How do I implement Swift's Comparable protocol?

How do I use the Comparable protocol in Swift? In the declaration it says I'd have to implement the three operations <, <= and >=. I put all those in the class but it doesn't work. Also do I need to have all three of them? Because it should be…
Kametrixom
  • 14,673
  • 7
  • 45
  • 62
38
votes
3 answers

Python - Use 'set' to find the different items in list

I need to compare two lists in Python, and I know about using the set command to find similar items, but is there a another command I could use that would automatically compare them, instead of having to code for it? I would like to find the items…
RPiAwesomeness
  • 5,009
  • 10
  • 34
  • 52
37
votes
3 answers

PHP compare two arrays and get the matched values not the difference

I'm trying to compare two arrays and get only the values that exist on both arrays but, unfortunately, I can't find the right array function to use... I found the array_diff() function: http://php.net/manual/en/function.array-diff.php But it's for…
Julian Paolo Dayag
  • 3,562
  • 3
  • 20
  • 32
37
votes
10 answers

Javascript String Compare == sometimes fails

How could the following code sometimes evaluate to false? (transport.responseText == '1' || transport.responseText == 'CARD_VALID') My JavaScript code: if (transport.responseText == '1' || transport.responseText == 'CARD_VALID') { // do…
chaimp
  • 16,897
  • 16
  • 53
  • 86
36
votes
7 answers

How to compare the content of a tarball with a folder

How can I compare a tar file (already compressed) of the original folder with the original folder? First I created archive file using tar -kzcvf directory_name.zip directory_name Then I tried to compare using tar -diff -vf directory_name.zip…
Steve
  • 361
  • 1
  • 3
  • 5
36
votes
8 answers

Compare two Images in JavaScript

I am trying to determine if two images are the same in JavaScript (even if the source URLs are different). My specific use case is within a Chrome extension (though this being a chrome extension doesn't really factor into the question). I can get…
JMH
  • 451
  • 1
  • 4
  • 8
36
votes
6 answers

How to check if two files have the same content?

I am using mocha/supertest/should.js to test REST Service GET /files/ returns file as stream. How can I assert in should.js that file contents are the same? it('should return file as stream', function (done) { var writeStream =…
hellboy
  • 1,567
  • 6
  • 21
  • 54
36
votes
5 answers

Comparing Two objects using Assert.AreEqual()

I 'm writing test cases for the first time in visual studio c# i have a method that returns a list of objects and i want to compare it with another list of objects by using the Assert.AreEqual() method. I tried doing this but the assertion fails…
Vishweshwar Kapse
  • 921
  • 6
  • 23
  • 43
35
votes
9 answers

Compare 2 images in PHP

Comparing two images to see if they are both the same files is easy: throw the files MD5. But is it possible or even plausible to determine if two images are same by using PHP GD to get the difference of the two images? If we were to get the…
Joseph
  • 383
  • 2
  • 4
  • 5