comparison

Using InvariantCultureIgnoreCase instead of ToUpper for case-insensitive string comparisons

On this page, a commenter writes: Do NOT ever use .ToUpper to insure comparing strings is case-insensitive. Instead of this: type.Name.ToUpper() == (controllerName.ToUpper() + "Controller".ToUpper())) Do this: type.Name.Equals(controllerName + "Controller", StringComparison.InvariantCultureIgnoreCase) Why is this way p...

Package for fast determination of similarity between two bit sequences

I need to compare a query bit sequence with a database of up to a million bit sequences. All bit sequences are 100 bits long. I need the lookup to be as fast as possible. Are there any packages out there for fast determination of the similarity between two bit sequences? --Edit-- The bit sequences are position sensitive. I have seen a p...

Comparing adjacent elements in MATLAB

Does anyone know how I can compare the elements in an array with the adjacent elements? For example, if I have an array: 0 0 0 1 1 1 1 0 0 1 1 1 1 1 1 0 0 1 0 1 1 1 1 0 0 1 1 1 1 1 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 Is there a way to cycle through each element and perform a logical test of whether the elements around it are equal ...

Why does Javasript's strict comparison act the way it does?

Possible Duplicate: Is JavaScripts math broken? If the main difference between Javascript's "strict comparison" operators and the traditional ones is type coercion, why does 0.1+0.2===0.3; return false? Riddle me this, Batman. ...

What is 'Language Performance'?

I'm reading a presentation in which different programming languages are being compared. And one of characteristics which is measured is 'Language Performance'. What does it mean? ...

Efficient algorithm for finding spheres farthest apart in large collection

I've got a collection of 10000 - 100000 spheres, and I need to find the ones farthest apart. One simple way to do this is to simply compare all the spheres to each other and store the biggest distance, but this feels like a real resource hog of an algorithm. The Spheres are stored in the following way: Sphere (float x, float y, float...

Why/When in Python does `x==y` call `y.__eq__(x)`?

The Python docs clearly state that x==y calls x.__eq__(y). However it seems that under many circumstances, the opposite is true. Where is it documented when or why this happens, and how can I work out for sure whether my object's __cmp__ or __eq__ methods are going to get called. Edit: Just to clarify, I know that __eq__ is called in ...

PHP - smart, error tolerating string comparison

Hello, I'm looking either for routine or way to look for error tolerating string comparison. Let's say, we have test string Čakánka - yes, it contains CE characters. Now, I want to accept any of following strings as OK: cakanka cákanká ČaKaNKA CAKANKA CAAKNKA CKAANKA cakakNa The problem is, that I often switch letters in word, and...

Plotting of multiple comparisons in R ?

Hi all, When one wishes to compare (test) multiple groups (as is the case, for example, when doing anova), one is confronted with the issue of multiple comparisons. The same applys if we wish to plot the comparisons. My question is thus, what tools (in R) do you know of that allow plotting that reflects multiple comparisons? Currently...

Positional Comparisons in Python

(Here's a sort of hypothetical situation for everybody. I'm more looking for directions rather than straight processes, but if you can provide them, awesome!) So let's say we have a list of athletes, I'm going to use figure skaters since I'm knee deep in the Winter Olympics right now. (I'm throwing it in a dictionary since that's my fir...

What alternatives to Spring+JSF/Facelets exist for web-development in java?

Let's consider only standard MVC architecture and don't touch SOFEA. I'm actually do my web-development with JPA (Hibernate)+Spring+JSF/Faceletes. To use JSF efficiently I also use at least Apache Orchestra and some components library (like Tomahawk or RichFaces). I've already stepped on a rake several times with jsf. The worst thing ...

kdiff3 merging result

is there any way to generate a text file with merge result.Thanks a lot! Say a.txt looks like 1 2 b.txt like 1 3 and merge result output like below 1 <<2 >>3 ...

Comparing HashMaps in Java

I have two HashMaps: FOO & BAR. HashMap FOO is a superset of HashMap BAR. How do I find out what 'keys' are missing in HashMap BAR (i.e. exists in FOO but not BAR)? ...

Should compareTo and equals be consistent if the Object is mutable and will not be used in sorted Set, etc.

The Java documentation for Comparable recommends that compareTo be consistent with equals (because of the behavior in sorted sets or sorted maps). I have a Player object which is mutable. Player will not be used in any kind of sorted set or sorted map. I want to have an array of Players (Player[]) and assign each player a random ord...

How does Ruby compare strings?

Hi, maybe someone knows the technical answer to the following behaviour: s = "hello world!" s == s.upcase # =>false, because "hello world!" != "HELLO WORLD!" s == s.upcase! #=>true, because s is changed before comparison? Thanks in advance, Mathias ...

java: time comparison

I have a time in hh:mm and it has to be entered by the user in that format. However, I want to compare the time (eg. 11:22) is it between 10am to 6pm? But how do I compare it? ...

Efficient comparison of 1 million vectors containing (float, integer) tuples

I am working in a chemistry/biology project. We are building a web-application for fast matching of the user's experimental data with predicted data in a reference database. The reference database will contain up to a million entries. The data for one entry is a list (vector) of tuples containing a float value between 0.0 and 20.0 and an...

Size of C data types on different machines & sizeof(complex long double)

Hi there, does anybody know a website or a paper where the sizes of C data types were compared on different machines? I'm interested in values of some 'big' machines like a System z or the like. And: Is there an upper bound of bytes that the biggest native datatype on any machine can have and is it always of the type complex long double...

if(0 == '%') echo "WTF, Php, why can't you compare things sanely?"

I just reduced a crazy bug to what's in the title of this question. I'm sure there's a Perfectly Reasonable Explanation for why Php thinks that 0 == '%' (or any other special character, I think). I thought it would be good to get that explanation on StackOverflow! ...

Bug reports solution

Clarification/summary for the question -- we're looking for: a hosted bug tracking system, that is as convenient to use as lighthouse/github/launchpad, can deal with attachments, integrates email notifications and operations (implies operations in commit messages), has a script-friendly API, allows anonymous bug reports, or ones with a...