comparison

Fast file integrity verification

Is there any fast algorithm that allows to compare two files (for verification purpose) without need to read the entire contents? ...

Why is Decimal('0') > 9999.0 True in Python?

This is somehow related to my question Why is ''>0 True in Python? In Python 2.6.4: >> Decimal('0') > 9999.0 True From the answer to my original question I understand that when comparing objects of different types in Python 2.x the types are ordered by their name. But in this case: >> type(Decimal('0')).__name__ > type(9999.0).__nam...

Elegant ruby syntax to return the greater of two objects

Of course there are a thousand ways to get this done, but is the simplest (or most elegant) way to achieve this? [4,8].max That's actually not too shabby, but what would you do? ...

how does Cocoa compare to Microsoft, Qt?

I have done a few months of development with Qt (built GUI programatically only) and am now starting to work with Cocoa. I have to say, I love Cocoa. A lot of the things that seemed hard in Qt are easy with Cocoa. Obj-C seems to be far less complex than C++. This is probably just me, so: Ho do you feel about this? How does Cocoa compar...

Finding whether a value is equal to the value of any array element in MATLAB

Can anyone tell me if there is a way (in MATLAB) to check whether a certain value is equal to any of the values stored within another array? The way I intend to use it is to check whether an element index in one matrix is equal to the values stored in another array (where the stored values are the indices of the elements which meet a ce...

comparison between string literal

This very simple code: #include <iostream> using namespace std; void exec(char* option) { cout << "option is " << option << endl; if (option == "foo") cout << "option foo"; else if (option == "bar") cout << "opzion bar"; else cout << "???"; cout << endl; } int main() { char opt[] = "foo...

Comparing values from a string in a MySQL query

I'm having some trouble comparing values found in VARCHAR fields. I have a table with products and each product has volume. I store the volume in a VARCHAR field and it's usually a number (30, 40, 200..) but there are products that have multiple volumes and their data is stored separated by semicolons, like so 30;60;80. I know that sto...

PHP5 vs ASP.NET

Hi guys, I am required to write a report contrasting PHP5 and ASP.NET after building an application in both languages. I've been looking for papers and resources to reference and quote on the subject but i am running a little short. I was wondering if anyone directions as where i could find such papers / resources. Thanks in advance...

Delphi - Differences between CompareStr and CompareString

Hi all, I'm hoping someone can shed some light on this for me> What are the differences, in Delphi 2009, between the CompareStr (defined in SysUtils) and CompareString (from Windows API) functions? Both let you specify the locale to be used, is the Windows one simply more "complete", due to the available comparison flags? Is one conse...

Choosing between ExtJS and YUI based on application parameters.

Hello. I need help in taking call to choose between Ext JS and YUI libraries. Here are the key factors I have derived from my application requirements & development process: Complex, windows forms like controls Widgets, Layouts, Utilities Inter widget communication Easy to extend Easy to learn Intuitive & concise coding Strong exceptio...

C: Comparing two long integers (very strange)

Hi, I have following situation (unix) : x is a long and has value 300 y is a long and has value 50000 if (x <= y) printf("Correct."); if (x > y) printf("Ouch."); Now I always get "Ouch". That means the program keeps telling me that 300 is greater than 50000! It only works again when I do if ((int)x <=(int) y) printf("Correct."); ...

How can I sort timestamps in Perl?

I have several thousand objects with a string property in the format of "yyyy-MM-ddTHH:mm:ssZ". I want to sort these objects by time. Are there any useful packages or scripts for this? (Currently I'm just comparing individual numeric values and it seems it's not very efficient and neat.) ...

Advantages/Disadvantages of different implementations for Comparing Objects using .NET

This questions involves 2 different implementations of essentially the same code. First, using delegate to create a Comparison method that can be used as a parameter when sorting a collection of objects: class Foo { public static Comparison<Foo> BarComparison = delegate(Foo foo1, Foo foo2) { return foo1.Bar.CompareTo(fo...

Array.BinarySearch where a certain condition is met

I have an array of a certain type. Now I want to find an entry where a certain condition is met. What is the preferred way to do this with the restriction that I don't want to create a temporary object to find, but instead I only want to give a search condition. MyClass[] myArray; // fill and sort array.. MyClass item = Array.BinaryS...

iPhone SDK: NSUserDefaults or NSDictionary?

Compare the following: using NSUserDefaults saving it with synchronize using NSDictionary saving it with writeToFile in the app Documents folder What are the differences? Personally, I prefer to mantain different NSDictionary organized by topic rather than use a single NSUserDefaults. Am I thinking something wrong? Thanks ...

What is the most effective way to test for combined keyboard arrow direction in ActionScript 3.0?

I need to monitor the direction a user is indicating using the four directional arrow keys on a keyboard in ActionScript 3.0 and I want to know the most efficient and effective way to do this. I've got several ideas of how to do it, and I'm not sure which would be best. I've found that when tracking Keyboard.KEY_DOWN events, the event r...

nVelocity - Template issue when attempting 'greater than' comparison on decimal property

I have a simple object that has as one of it's properties a decimal named Amount. When I attempt a comparison on this property as part of an nVelocity template, the comparison always fails. If I change the property to be of type int the comparison works fine. Is there anything extra I need to add to the template for the comparison to wor...

Integer comparison as string

Hi I have an integer column and I want to find numbers that start with specific digits. For example they do match if I look for '123': 1234567 123456 1234 They do not match: 23456 112345 0123445 Is the only way to handle the task by converting the Integers into Strings before doing string comparison? Also I am using Postgre rege...

Non-latin-characters ordering in database with "order by"

I just found some strange behavior of database's "order by" clause. In string comparison, I expected some characters such as '[' and '_' are greater than latin characters/digits such as 'I' or '2' considering their orders in the ASCII table. However, the sorting results from database's "order by" clause is different with my expectation. ...

Testing objects for changes

I have an application that needs to determine whether a user has made a change to an object. So, when the object is first loaded, I create a deep copy (using serialization/deserialization) and save the copy to a separate field. The copy becomes myCurrentObject, and the original becomes myOriginalObject. Now I need to test myCurrentObjec...