comparison

comparing/intersecting compare criteria

If there's any open source code that does this already I'm interested in hearing about it. But I haven't seen it yet so I'm trying to roll my own. Example: variable x = compareCriteriaBetween 3 and 6 variable y = compareCriteriaLesserThanOrEqual 5 The difficult part for me is finding an elegant way to compare the compareCriteria and ...

What are some good methods to find the "relatedness" of two bodies of text?

Here's the problem -- I have a few thousand small text snippets, anywhere from a few words to a few sentences - the largest snippet is about 2k on disk. I want to be able to compare each to each, and calculate a relatedness factor so that I can show users related information. What are some good ways to do this? Are there known algorit...

MySQL Comparisons and '%'

Will the following query evaluate to true (1), false (0), or NULL? SELECT '%' LIKE ' % '; the answer provided is The '%' character is matched by '%', but not by the space characters surrounding it, so the expression evaluates to false. +----------------+ | '%' LIKE ' % ' | +----------------+ | 0 | +----------------+ b...

How to show a comparison of 2 html text blocks

I need to take two text blocks with html tags and render a comparison - merge the two text blocks and then highlight what was added or removed from one version to the next. I have used the PEAR Text_Diff class to successfully render comparisons of plain text, but when I try to throw text with html tags in it, it gets UGLY. Because of t...

Why do we need RESTful Web Services?

I'm going to learn RESTful web services (it's better to say that I'll have to do this because it's a part of CS master degree program). I've read some info in Wikipedia and I've also read an article about REST at Sun Developer Network and I see that it's not easy technology, there are special frameworks for building RESTful apps, and i...

How to store IP address list in C# List to make it searchable for subnets too?

Hello, how should I correctly store IP address list with addresses which are subnets to make it searchable? There are two examples: I have IP address 1.2.3.4 and in my C# List there is 1.2.3.4 entry so here we have no problems. I have IP address 3.4.5.6 and in my C# List I have subnet 3.4.0.0/24. Here is my problem. How to store IP...

What is the correct way to compare char ignoring case?

I'm wondering what the correct way to compare two characters ignoring case that will work for all cultures. Also, is Comparer<char>.Default the best way to test two characters without ignoring case? Does this work for surrogate-pairs? EDIT: Added sample IComparer<char> implementation If this helps anyone this is what I've decided to us...

DotNET String comparisons

After a few harsh lessons I now always use OrdinalIgnoreCase when comparing Strings in DotNET. I've run into maybe 5 different problems to do with numerics, weird alphabets and localisations. Does anyone know of a good site that explains in depth a lot of the problems with culture specific Strings, preferably with a bunch of good example...

What is the fastest Ruby logger implementation?

I want to find the fastest logger Ruby has to offer. My intuition tells me that syslog would win in this race. But my intuition seems to be wrong. Syslog turns out to be the slowest out of the three loggers I've tested. I'm using my MacBook Pro, OSX 10.6 (Snow Leopard), Intel Core2 Duo, 4GB of RAM and Ruby 1.8.7 built from MacPorts. ...

Is there any difference in using smtps instead of smtp ?

Or is it transparent for the application layer ? I ask this because I'm trying to connect to a smtps and no success (smtp is working fine) ...

Compare two Java objects with a check for null

I feel like such a novice for asking this question, but is there a method in the JDK that compares two objects for equality, accounting for nulls? Something like this: public static boolean equals(Object o1, Object o2) { if (o1 == null) { return o2 == null; // Two nulls are considered equal } else if (o2 == null...

asp.net mvc vs spring mvc

Hi, Can anyone please make a comparison of "asp.net mvc" vs "spring mvc (java)". Which technology is better in performance, productivity, maintenance, features,... Regards, sirmak ...

Comparison Query to Compare Two SQL Server Tables

I would like to know how to compare two different database table records. What I mean is I will compare two database tables which may have different column names but same data. But one of them may have more records than the other one so I want to see what the difference is between those two tables. To do that how to write the sql query ?...

Interview question: In php, is 123==0123?

I have answered it is false. then he asked why? i couldn't answer. Can anyone make the answer? I am very interested to learn it. ...

How to display the results of multiple comparisons

If you compare two sets of data (such as two files), the differences between these sets can be displayed in two columns, or two panes, such as WinMerge does. But are there any visual paradigms to display the differences between multiple data sets? Update The starting point of my question was the assumption that displaying differences ...

Comparison Efficiency

What is generally faster: if (num >= 10) or: if (!(num < 10)) ...

air flash comparison core

What are the differences in developing for AIR versus flash? why should i choose one over the other in a given situation? ...

Weird result comparing property values using reflection

Can someone explain why this is occurring? The code below was executed in the immediate window in vs2008. The prop is an Int32 property (id column) on an object created by the entity framework. The objects entity and defaultEntity were created using Activator.CreateInstance(); Convert.ChangeType(prop.GetValue(entity, null), prop.Prop...

Eclipse 'Compare' menu options are all disabled

Hello, I recently upgraded my Subversion repository to version 1.6 and I'm connecting to it with Eclipse. However, when I check out a project branch and try to compare it with a different revision, (or any other circumstances for that matter) all of the options for comparison are disabled except for comparing with the base revision of ...

Java Hashmap Iteration: Look at two values at once?

I have this loop: for (Map.Entry<Integer, String> entry: collection.entrySet()) { } I'd like to compare entry and the next one after that. How would I do it? ...