comparison

Comparing two LinkedList<String> with ListIterator versus for loop and get(int index)

I have two LinkedList objects that are always of the same size. I want to compare them to see if they are identical in content. What are the general performance and style implications of creating a ListIterator for each list and using a while hasNext loop versus using a counter (int i) and iterating from 0 to linkedlist.size() using li...

Comparing folder current state with saved prior state (C#)

I want to make a winform application that tells you whenever you open it all the changes that have been made since last opening, and maybe record a log of it, such as: File/folder creations File/folder renamings File/folder exclusions I've figured i have to do four tasks: Save the folder state (tree) in a reloadable format Load thi...

Python: Why is comparison between lists and tuples not supported?

When comparing a tuple with a list like ... >>> [1,2,3] == (1,2,3) False >>> [1,2,3].__eq__((1,2,3)) NotImplemented >>> (1,2,3).__eq__([1,2,3]) NotImplemented ... Python does not deep-compare them as done with (1,2,3) == (1,2,3). So what is the reason for this? Is it because the mutable list can be changed at any time (thread-safety ...

PHP How to compare date and date?

I have this value from database: '2009-1-1 00:00:00', okay, let me paste my code: $fetch = mysql_fetch_assoc($result); $db_value = $fetch['date'];//'2009-1-1 00:00:00' $today = date('Y-m-d H:i:s'); // Todays date If I want to compare the two values, what should I do: if($db_value < $today){ // Do something } or method 2, conv...

VBScript implicit conversion in IF statement different from variable to literals ?

We are currently having an issue due to implicit conversion in an IF statement in VBScript (Classic ASP) that don't do implicit conversion the same way when dealing with a variable or a literal. Can someone explain this behavior to me, why do VBScript acts this way ? Here is a sample of what I mean : Const c_test = 3 Dim iId : iId = 3 ...

Vaadin vs Apache Click which one to choose for my webapp development

Vaadin and Apache Click seem to be equally good, which one should I choose for developing my web application. Or rather, what are the Pros and Cons of each framework. ...

Java UUID string representation natural ordering.

Say I have two UUID instances: uuid1 = UUID.randomUUID(); uuid2 = UUID.randomUUID(); If those two compare such that uuid1 is less than uuid2 i.e., uuid1.compareTo(uuid2) // -1 is it always true that their string representations will compare to give the same result, i.e., uuid1.toString().compareTo(uuid2.toString()) // -1 ???? ...

Fast 64 bit comparison

Hi I'm working on a GUI framework, where I want all the elements to be identified by ascii strings of up to 8 characters (or 7 would be ok). Every time an event is triggered (some are just clicks, but some are continuous), the framework would callback to the client code with the id and its value. I could use actual strings and strcm...

compare two arrays except element x,y,z (ruby)

is there any other simple,nicer way? require 'pp' a1 = ["02/28/10","Webinars","131","0","26 Feb 2010","0","3d, 8h, 49m, 18s"] a2 = ["02/20/10","Webinars","131","9","26 Feb 2010","0","3d, 8h, 49m, 18s"] def compare(array1,array2,ignore) tmp1 = Array.new tmp2 = Array.new 0.upto(array1.length-1) {|index| if !ignore.include?(in...

Performance Comparison of HTML Added via Javascript vs. Normal HTML Markup

Has anyone ever tested, or does anyone know, the performance differences of these two different ways of rendering the same html content (other than the fact that one has imported the jquery library and the other hasn't, and that there are two requests in the Ajax version versus one)? Add HTML via Ajax <html> <head> <script src="jav...

Which key value store is the most promising/stable?

I'm looking to start using a key/value store for some side projects (mostly as a learning experience), but so many have popped up in the recent past that I've got no idea where to begin. Just listing from memory, I can think of: CouchDB MongoDB Riak Redis Tokyo Cabinet Berkeley DB Cassandra MemcacheDB And I'm sure that there are mor...

Jackson Vs. Gson

After searching through some existing libraries for JSON, I have finally ended up with these two: Jackson Google GSon I am a bit partial towards GSON, but word on the net is that GSon suffers from certain celestial performance issue. I am continuing my comparison, in the meanwhile I was looking for help to make up my mind. ...

Pythonic way to compare two lists and print out the differences

I have two lists which are guaranteed to be the same length. I want to compare the corresponding values in the list (except the first item) and print out the ones which dont match. The way I am doing it is like this i = len(list1) if i == 1: print 'Nothing to compare' else: for i in range(i): if not (i == 0): ...

How to tell if an object supports scalar comparisons?

Does anyone have a quick snippet or direction of how i would check to see if a given class supports the >, = and < operators? Given an object passed in, I am looking for code that implements the following logic: If GetType(someObj).SupportsScalarComparisons() Then ... I don't know if this is a case for Reflection, or ? Thanks in ad...

Calculate number of differences between two NSStrings

How can I calculate the number of differences between two NSStrings. Example: NSString 1 = this is a string NSString 2 = Tihs isa string should return: 4 (one for the capital "T", one for the "i", the "h" and for the missing space) ...

How do I get characters common to two vectors in C++?

I am trying to compare two vector objects, and return a single vector containing all the chars which appear in both vectors. How would I go about this without writing some horribly complex manual method which compares every char in the first vector to every char in the second vector and using an if to add it to a third vector (which wou...

Is there a way to add methods to GregorianCalendar in Java?

I'd like to make a method called "isBetween" returning a boolean, seeing if a GregorianCalendar date falls between two others. Alternatively, I'd like to just define operators of < and > for the class. I'm pretty new to Java, so I'm not sure....can I even do either of those? If so, how? ...

List of Dicts comparision to match between lists and detect value change in python

I have a list of dictionaries that I get back from a web service call. listA = [{'name':'foo', 'val':'x'}, {'name':'bar', 'val':'1'}, {'name':'alice','val':'2'}] I need to compare results from the previous call to the service and pull out changes. so on next call I may get: listB = [{'name':'foo', 'val':'y'}, ...

A better way to compare XML docs?

In my current project we have a large repository of content that was originally published in book form. Much of this content was published in both English and many foreign languages, using mostly Quark Express and later InDesign. This content was exported into a custom XML structure for storage and future use. The issue is that the Engli...

Faster/better way to compare .NET References' properties?

I am in the process of upgrading an older component which shares references to custom assemblies of differing versions. To compare the properties of references from two different projects I have been copying and pasting the property values individually from the two different references to a text file for easier overview and comparison....