EzDevInfo.com

compare interview questions

Top compare frequently asked interview questions

MongoDb query condition on comparing 2 fields

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)

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


Source: (StackOverflow)

Advertisements

Using jQuery to compare two arrays of Javascript objects

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)

How to parse a month name (string) to an integer for comparison in C#?

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 do I check for null values in JavaScript?

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)

How to compare 2 files fast using .NET?

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)

What is the difference between == and Equals() for primitives in C#?

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)

How to compare type of an object in Python?

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)

Tool to compare large numbers of PDF files? [closed]

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)

The right way to compare a System.Double to '0' (a number, int?)

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)

How to compare arrays in C#? [duplicate]

Possible Duplicate:
Easiest way to compare arrays in C#

How can I compare two arrays in C#?

I use the following code, but its result is false. I was expecting it to be true.

Array.Equals(childe1,grandFatherNode);

Source: (StackOverflow)

What is best tool to compare two SQL Server databases (schema and data)? [duplicate]

Possible Duplicate:
Free Tool to compare Sql Server tables

I would like to compare two SQL Server databases including schema (table structure) and data in tables too. What is best tool to do this?


Source: (StackOverflow)

Tool for comparing 2 binary files in Windows [closed]

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)

Compare 2 JSON objects [duplicate]

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.

  1. 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

  2. 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:

  1. Deep recursion to find a unique name/value pair
  2. Determine the length of both object literals, and compare the name/value pairs to see if a discrepancy exists in either.

Source: (StackOverflow)

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 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:

enter image description here

im2:

enter image description here

im3:

enter image description here

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)