comparison

How does a Python set([]) check if two objects are equal? What methods does an object need to define to customise this?

I need to create a 'container' object or class in Python, which keeps a record of other objects which I also define. One requirement of this container is that if two objects are deemed to be identical, one (either one) is removed. My first thought was to use a set([]) as the containing object, to complete this requirement. However, the...

What is the most efficient way in T-SQL to compare answer strings to answer keys for scoring an exam

These exams typically have about 120 questions. Currently, they strings are compared to the keys and a value of 1 or 0 assigned. When complete, total the 1's for a raw score. Are there any T-SQL functions like intersect or diff or something all together different that would handle this process as quickly as possible for 100,000 examinee...

Assembly Character Comparison Problem

Hi all, We are trying to implement levensteing distance algorithm in assembly and calling the assembly function from C code. But we have some char comparison problem and could not solve the problem. Function takes two char* parameters. In the first two lines i mov the these addressess to ecx and edx. iminusOne and jminusOne are indexe...

MySQL - How to use fields in 'LIKE' operator

Hi! I want to do a 'select' in MySQL using the operator 'LIKE'. But I do not want to use text as a comparison factor. I want to compare text between two fields in same table, like this: SELECT field1,field2 FROM table WHERE field2 LIKE %field1% ; Is it possible? ...

Good comparison Doctrine vs Propel

Hi! I've seen plenty of comparisons of Doctrine vs Propel, but none of them has actually convinced me to choose Doctrine over Propel. I've been using Propel for a while now and almost every comparison I read states that Propel is not well documented as the first problem and I've read Propel's docs and they're quite well. Also, most of...

Could a bored AWK master kindly convert this Python program?

I love Python but do not really care for AWK. For purposes of comparison (and to see how a Python-to-AWK master would do this), could someone rewrite the following Python program in AWK? Considering how short it is, some would think that the rewrite would be simple and easy for anyone with a little time. import os ROOT = '/Users/Zero/D...

Anyone know of a method / tool to compare ad hoc SQL queries?

Hi, I have to convert a lot of legacy SQL queries to stored procs (rewriting and tidying) and I'm looking for an efficient way to compare the results one by one to ensure I haven't modified the behaviour. I currently use SQLDelta but it requires me to pipe the results of each query into tables and transfer one to a separate server usin...

Comparison of float and double variables

Possible Duplicates: Difference between float and double strange output in comparision of float with float literal I am using visual C++ 6.0 and in a program I am comparing float and double variables For example for this program #include<stdio.h> int main() { float a = 0.7f; double b = 0.7; printf("%d %d...

Filtering based on comparisons in django

I have a django model with a field Reminder_End_Date = models.DateField(). I have to filter all records of the model which have reminder date greater than todays date. However when I try to use the following statement, it does not work: now=datetime.date.today() reminderlist=Reminder.objects.filter(Reminder_End_Date>now ) Can anyone ...

Multiple key lookup for Dictionary

I am parsing a file and I would like to store it in a lookup structure in a way that I can lookup with two keys. I have a User Entity that has name, email and id, types are irrelevant. I would like to store it in a Dictionary<User, id> so I can get the user id by looking up with User. I also want the other way around, ie : Dictionary<...

php's preg_replace() versus(vs.) ord() .

What is quicker, for camelCase to underscores; using preg_replace() or using ord() ? My guess is the method using ord will be quicker, since preg_replace can do much more then needed. <?php function __autoload($class_name){ $name = strtolower(preg_replace('/([a-z])([A-Z])/', '$1_$2', $class_name)); require_once("some_dir/".$nam...

How active is 'programming language X' or 'runtime Y'?

Suppose I want to compare Java and C#, and am interesting in how much development (or new development) is performed using these languages. Where is a good site to find this? Edit - Also interesting is to compare, say, CLR to JVM. ...

What are the pros and cons of using Java for a web site?

I had never heard that you can use Java for a web site. I just learned it today when my future employer told me. The web site in question runs @ 15,000 daily visitors and it's only the beginning, so is it faster than PHP? Why did they pick Java over PHP? What are the pro/cons for a website using java compared to PHP? What website sho...

SQL Database Comparison

I have two databases: DBTarget and DBTest. I've run several custom scripts on DBTest, so now DBTest and DBTarget should be identical in every way (Tables, Values in tables, Columns, SPROCS, etc.) Question: Is there an easy way to compare these two databases? The only strategy I can think of is: USE [DBTarget]; SELECT * FROM tblTableN...

What is the best method to compare two vectors of CString

Hi I am trying to find the most efficient, optimized and fastest way to compare to std vectors of CString. the strings in question are case-sensitive. I have tried using the == operator for the vector container but this sometimes return false positives. I mean for instance if one vector contains elements in the order (a,b,c) and the oth...

Python - Most efficient way to compare # of words sequenced in "right" order across two strings/lists

Hi experts, I was wondering what the most computationally efficient Python way of cracking this problem would be. Say you have two strings (or lists from splitting those strings--doesn't matter), "this is the right string" vs. "this is right the string." We're assuming that the first string is always right, and a score will be assigne...

Perl Need to Compare Two Data Structures and Return Differences

Hi, I have two data structures with a mix of hashes and arrays. How can I compare the two data structures and return their differences, something like perl's Test::Harness module, but I don't want to actually run a unit test. ...or is there a way to tun Test::Harness without actually running a unit test? ...

Is RabbitMQ more scalable than JMS outbound queue?

I want to know whether RabbitMQ is more scalable than other brokers or not? If yes what are the specific reasons? If not how can we scale it up? I am using rabbitmq for the first time with Spring framework. ...

How to check identical array in most efficient way?

Hi, I want to check if the two arrays are identical (not content wise, but in exact order). For example: array1 = [1,2,3,4,5] array2 = [1,2,3,4,5] array3 = [3,5,1,2,4] Array 1 and 2 are identical but 3 is not. Is there a good way to do this in JavaScript? ...

If I try to compare 2 joda-time DateTime values in Scala I get java.lang.NoClassDefFoundError. How to fix this?

Here's an example: import org.scala_tools.time.Imports._ ... val dt1 : DateTime = new DateTime ("2010-09-01T12:00Z") val dt2 : DateTime = new DateTime ("2010-10-01T12:10Z") println (dt1 < dt2) // This is the Main.scala:48 line mentioned in the stack trace below ... If I compile and run it, I get java.lang.NoClassDefFoundError: s...