comparison

Basic C++ Speed (initialization vs adding) and comparison speed

I was curious if anyone knows which of the following executes faster (I know this seems like a weird question but I'm trying to shave as much time and resources as possible off my program.) int i=0; i+=1; or int i; i=1; and I also was curious about which comparison is faster: //given some integer i // X is some constant i < X+...

File Comparison Strategies

I'm searching for strategies one might use to programmatically find files which may be duplicates of each other. Specifically in this case, videos. I'm not looking for exact matches (as nice as that would be in the land of rainbows and sunshine). I'm just looking to collect pairs of video which content might be the same so that a huma...

Analogues of Java and .NET technologies/frameworks

I work in a shop that is a mix of mostly Java and .NET technologists. When discussing new solutions and architectures we often encounter impedance in trying to compare the various technologies, frameworks, APIs etc. in use between the two camps. It seems that each camp knows little about the other and we end up comparing apples to orange...

Number of elements in Python Set

I have a list of phone numbers that have been dialed (nums_dialed). I also have a set of phone numbers which are the number in a client's office (client_nums) How do I efficiently figure out how many times I've called a particular client (total) For example: >>>nums_dialed=[1,2,2,3,3] >>>client_nums=set([2,3]) >>>??? total=4 Problem ...

What are some of the best free Mercurial hosting services?

I've been having a look through Mercurial's list of Hg hosting providers but can't really distinguish much about the real quality of the services. What are other peoples' experiences with free services? Which would you recommend and why? ...

Why is the Clojure Hello World program so slow compared to Java and Python?

Update As suggested by many people, it looks like this was because of the fact that clojure code was first compiled and then executed. AOT compilation should help offset that. Given I found the practical Clojure AOT compilation process a little tricky to solve (classpath issues, directory issues et al), I've written up a small step by s...

defining < operator for map of list iterators

I'd like to use iterators from an STL list as keys in a map. For example: using namespace std; list<int> l; map<list<int>::const_iterator, int> t; int main(int argv, char * argc) { l.push_back(1); t[l.begin()] = 5; } However, list iterators do not have a comparison operator defined (in contrast to random acc...

Searching an unsorted array

What would be the smallest and largest number of comparisons in an unsorted array that could have duplicate elements as well ? I understand that finding anything in an unsorted array is a O(n) problem. But, is this true if the array contains duplicate elements as well ? By duplicate elements I mean, elements that occur more than once i...

Deriving an HTMLElement Object from jQuery Object

I'm doing a fairly exhaustive series of DOM manipulations where a few elements (specifically form elements) have some events. I am dynamically creating (actually cloning from a source element) several <select> boxes and assigning a change() event to them. The change event executes, and within the context of the event, "this" is the HTM...

MASM StrCmp Undefined?

Hi, If I try to assemble the following code, I get a A2006 error ( error A2006: undefined symbol : StrCmp). Here's my code: .386 .model flat,stdcall option casemap:none include \masm32\include\windows.inc include \masm32\include\kernel32.inc include \masm32\include\masm32.inc include \masm32\include\user32.inc includeli...

check date for variable value

I have a variable in my Java class that needs to be set based on whether today is before or after 7/1. If today is before 7/1 then we are in fiscal year that is the current year (so today we are in FY10). If today is after 7/1 our new fiscal year has started and the variable needs to be the next year (so FY11). psuedo code: if today ...

Sort Strings by first letter [C]

I have a program which places structures in a linked list based on the 'name' they have stored in them. To find their place in the list, i need to figure out if the name im inserting is earlier or later in the alphabet then those in the structures beside it. The names are inside the structures, which i have access to. I don't need a fu...

actionscript 2.0:Check TextField in flash

I have some problem in check two textfield.text comparison. One TextField.text value is come from calculation and the other textField is from user input. When I check those two text, the TextField.text value didn't show and I can't compare those two. How can I compare in actionscript 2.0. Please Help me! Thanks in advance! ...

MySQL floating point comparison issues

I ran into an issue by introducing floating point columns in the MySQL database schema that the comparisons on floating point values don't return the correct results always. 1 - 50.12 2 - 34.57 3 - 12.75 4 - ...(rest all less than 12.00) SELECT COUNT(*) FROM `users` WHERE `points` > "12.75" This returns me "3". I have read that the ...

Difference in F# and Clojure when calling redefined functions

In F#: > let f x = x + 2;; val f : int -> int > let g x = f x;; val g : int -> int > g 10;; val it : int = 12 > let f x = x + 3;; val f : int -> int > g 10;; val it : int = 12 In Clojure: 1:1 user=> (defn f [x] (+ x 2)) #'user/f 1:2 user=> (defn g [x] (f x)) #'user/g 1:3 user=> (g 10) 12 1:4 user=> (defn f [x] (+ x 3)) #'user/f...

Direct invocation vs indirect invocation in C

I am new to C and I was reading about how pointers "point" to the address of another variable. So I have tried indirect invocation and direct invocation and received the same results (as any C/C++ developer could have predicted). This is what I did: int cost; int *cost_ptr; int main() { cost_ptr = &cost; //...

Python's preferred comparison operators

Is it preferred to do: if x is y: return True or if x == y return True Same thing for "is not" ...

How to detect if 2 news articles have the same topic? (Python language-comparison)

I'm looking for ideas on recommended approach. I'm trying to scrape some headlines and body text from articles for a few specific sites, similar to what Google does with Google News. The problem is across different sites, they may have articles on the same exact subject, worded slightly differently. Can anyone point to me what I need ...

Java graph library for comparing 2 graphs

Does anyone know a good Java library for graph comparing by searching maximal common subgraph isomorphism to get information about their similarity? I do not want to compare graphs based on node labels. Or is there any other way how to topologically compare graphs with good Java libraries? Now I am using library SimPack and it is useful ...

PHP comparion doesnt work..why?

Hi, i have this code: $password_introducido = sfContext::getInstance()->getUser()->getGuardUser()->setPassword($value['password_actual']); $password_almacenado = sfContext::getInstance()->getUser()->getGuardUser()->getPassword(); var_dump("kfjsdlkjf"); var_dump($password_almacenado); var_dump($password_almacenado...