compare interview questions
Top compare frequently asked interview questions
I have a collection T, with 2 fields: Grade1 and Grade2, and I want to select those with condition "Grade1 > Grade2", how can I get a query like in MySQL?
Select * from T Where Grade1 > Grade2
Source: (StackOverflow)
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
Source: (StackOverflow)
I have two arrays of JavaScript Objects that I'd like to compare to see if they are the same. The objects may not (and most likely will not) be in the same order in each array. Each array shouldn't have any more than 10 objects. I thought jQuery might have an elegant solution to this problem, but I wasn't able to find much online.
I know that a brute nested $.each(array, function(){})
solution could work, but is there any built in function that I'm not aware of?
Thanks.
Source: (StackOverflow)
I need to be able to compare some month names I have in an array.
It would be nice if there were some direct way like:
Month.toInt("January") > Month.toInt("May")
My Google searching seems to suggest the only way is to write your own method, but this seems like a common enough problem that I would think it would have been already implemented in .Net, anyone done this before?
Source: (StackOverflow)
How can I check for null values in JavaScript? I wrote the code below but it didn't work.
if (pass == null || cpass == null || email == null || cemail == null || user == null) {
alert("fill all columns");
return false;
}
And how can I find errors in my JavaScript programs?
Source: (StackOverflow)
Typical approaches recommend reading the binary via FileStream and comparing it byte-by-byte.
- Would a checksum comparison such as CRC be faster?
- Are there any .NET libraries that can generate a checksum for a file?
Source: (StackOverflow)
Consider this code:
int age = 25;
short newAge = 25;
Console.WriteLine(age == newAge); //true
Console.WriteLine(newAge.Equals(age)); //false
Console.ReadLine();
Both int
and short
are primitive types, but a comparison with ==
returns true and a comparison with Equals
returns false.
Why?
Source: (StackOverflow)
Basically I want to do this:
obj = 'str'
type ( obj ) == string
I tried:
type ( obj ) == type ( string )
and it didn't work.
Also, what about the other types? For example, I couldn't replicate NoneType
.
Source: (StackOverflow)
I need to compare large count of PDF files for it optical content. Because the PDF files was created on different platforms and with different versions of the software there are structural differences. For example:
- the chunking of text can be different
- the write order can be different
- the position can be differ some pixels
It should compare the content like a human people and not the internal structure. I want test for regressions between different versions of the PDF generator that we used.
Source: (StackOverflow)
Sorry, this might be a easy stupid question, but I need to know to be sure.
I have this if
expression,
void Foo()
{
System.Double something = GetSomething();
if (something == 0) //Comparison of floating point numbers with equality
// operator. Possible loss of precision while rounding value
{}
}
Is that expression equal with
void Foo()
{
System.Double something = GetSomething();
if (something < 1)
{}
}
? Because then I might have a problem, entering the if
with e.g. a value of 0.9.
Source: (StackOverflow)
I need a tool for comparing 2 binary files. The files are quite big. Some freeware or trial tools I found on internet are not convenient to use for big files. Can you recommend me any tools?
Source: (StackOverflow)
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
"an unordered set of name/value pairs.
An object begins with { (left brace)
and ends with } (right brace). Each
name is followed by : (colon) and the
name/value pairs are separated by ,
(comma)." -- json.org
My goal is to be able to compare 2 JSON object literals, simply put.
I am not a javascript guru so if, in javascript, these are object literals, then I suppose that's what I should call them.
I believe what I am looking for is a method capable of:
- Deep recursion to find a unique name/value pair
- Determine the length of both object literals, and compare the name/value pairs to see if a discrepancy exists in either.
Source: (StackOverflow)
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 images but one is a little bit moved, I get a bad correlation value.
Any suggestions for a better algorithm?
BTW, I'm talking about to compare thousand of imgages...
Edit:
Here is an example of my pictures (microscopic):
im1:

im2:

im3:

im1 and im2 are the same but a little bit shifted/cutted, im3 should be recognized as completly different...
Edit:
*Problem is solved with the suggestions of Peter Hansen! Works very well! Thanks to all answers! Some results can be found here
http://labtools.ipk-gatersleben.de/image%20comparison/image%20comparision.pdf*
Source: (StackOverflow)