Questions tagged [comparison]

Questions about data comparison and efficient ways to accomplish it. Please avoid using this tag for generic (meta) comparison of two issues or concepts.

Questions about data comparison and efficient ways to accomplish it, e.g.: "Which is the fastest algorithm to compare two recordsets and decide which one has more palindromes?", or "What is the fastest way to compare two strings and say if they have more than Y characters in common?"

There are generally six basic "comparison operators": less than, <; less than or equal to, <=; equal to, ==; not equal to, !=; greater than or equal to, >=; and greater than, >.

8118 questions
85
votes
7 answers

What is the difference between ImageMagick and GraphicsMagick?

I've found myself evaluating both of these libs. Apart from what the GraphicsMagick comparison says, I see that ImageMagick still got updates and it seems that the two are almost identical. I'm just looking to do basic image manipulation in C++…
QbProg
  • 1,675
  • 1
  • 14
  • 18
84
votes
2 answers

What's so cool about Twisted?

I'm increasingly hearing that Python's Twisted framework rocks and other frameworks pale in comparison. Can anybody shed some light on this and possibly compare Twisted with other network programming frameworks.
Anton Gogolev
  • 113,561
  • 39
  • 200
  • 288
82
votes
4 answers

What are the differences between LLVM bitcode and Java bytecode?

I don't understand the difference between LLVM bitcode and Java bytecode, what are they? -edit- by 'what are they' i mean the differences between LLVM bitcode and Java bytecode not what are LLVM and Java.
user34537
81
votes
5 answers

Differences between node.js and Tornado

Besides the fact that node.js is written in JS and Tornado in Python, what are some of the differences between the two? They're both non-blocking asynchronous web servers, right? Why choose one over the other besides the language?
coffee-grinder
  • 26,940
  • 19
  • 56
  • 82
80
votes
10 answers

Determine if two files store the same content

How would you write a java function boolean sameContent(Path file1,Path file2)which determines if the two given paths point to files which store the same content? Of course, first, I would check if the file sizes are the same. This is a necessary…
principal-ideal-domain
  • 3,998
  • 8
  • 36
  • 73
79
votes
15 answers

Comparison between Centralized and Distributed Version Control Systems

What are the benefits and drawbacks with using Centralized versus Distributed Version Control Systems (DVCS)? Have you run into any problems in DVCS and how did you safeguard against these problems? Keep the discussion tool agnostic and flaming to…
Spoike
  • 119,724
  • 44
  • 140
  • 158
78
votes
8 answers

Why does >= return false when == returns true for null values?

I have two variables of type int? (or Nullable if you will). I wanted to do a greater-than-or-equal (>=) comparison on the two variables but as it turns out, this returns false if both variables are null, while obviously the == operator returns…
Koen
  • 3,626
  • 1
  • 34
  • 55
78
votes
18 answers

Is there any use for Bash scripting anymore?

I just finished my second year as a university CS student, so my "real-world" knowledge is lacking. I learned Java my first year, continued with Java and picked up C and simple Bash scripting my second. This summer I'm trying to learn Perl (God…
Daniel Harms
  • 1,178
  • 1
  • 11
  • 20
78
votes
6 answers

what is the difference between json and xml

What is the difference between JSON and XML?
pia
  • 821
  • 1
  • 7
  • 4
77
votes
2 answers

Why is it faster to compare strings that match than strings that do not?

Here are two measurements: timeit.timeit('"toto"=="1234"', number=100000000) 1.8320042459999968 timeit.timeit('"toto"=="toto"', number=100000000) 1.4517491540000265 As you can see, comparing two strings that match is faster than comparing two…
Eric
  • 4,821
  • 6
  • 33
  • 60
77
votes
7 answers

Analogues of Java and .NET technologies/frameworks

I work in a shop that is a mix of mostly Java and .NET technologists. When discussing new solutions and architectures we often encounter impedance in trying to compare the various technologies, frameworks, APIs etc. in use between the two camps. It…
Paul Sasik
  • 79,492
  • 20
  • 149
  • 189
76
votes
0 answers

How can a Java variable be different from itself?

I've received this quiz on an online form to apply for a recent Java event in my city: //Instead of this comment what code should be written so you can get "Gotcha!" printed if( a == a ){ System.out.println("Not yet..."); } else { …
AndreDurao
  • 5,600
  • 7
  • 41
  • 61
74
votes
11 answers

Comparing NaN values for equality in Javascript

I need to compare two numeric values for equality in Javascript. The values may be NaN as well. I've come up with this code: if (val1 == val2 || isNaN(val1) && isNaN(val2)) ... which is working fine, but it looks bloated to me. I would like to make…
GOTO 0
  • 42,323
  • 22
  • 125
  • 158
74
votes
13 answers

Comparing chars in Java

I want to check a char variable is one of 21 specific chars, what is the shortest way I can do this? For example: if(symbol == ('A'|'B'|'C')){} Doesn't seem to be working. Do I need to write it like: if(symbol == 'A' || symbol == 'B' etc.)
Alex
  • 5,364
  • 9
  • 54
  • 69
74
votes
7 answers

obj.nil? vs. obj == nil

Is it better to use obj.nil? or obj == nil and what are the benefits of both?
Danish Khan
  • 1,230
  • 1
  • 10
  • 13