comparison

Fixing VB6 Date Bug?

It seems that VB6 can't correctly compare dates in some situations. Are there any solutions to this? Private Sub CheckDate() date1 = #7/6/2010 2:00:00 PM# Debug.Print "Date 1: " + CStr(date1) date2 = DateAdd("h", -8, #7/6/2010 10:00:00 PM#) Debug.Print "Date 2: " + CStr(date2) Debug.Print "Equal? " + CStr(date1 =...

Comparing Numbers in Java

In Java, all numeric types extend from java.lang.Number. Would it be a good idea to have a method like the following: public boolean areEqual(Number first, Number second) { if (first != null && second != null) { return first.equals(second); } } I'm concerned about cases where a double 2.00000 does not equal an int 2. A...

Risk evaluation for framework selection

I'm planning on starting a new project, and am evaluating various web frameworks. There is one that I'm seriously considering, but I worry about its lasting power. When choosing a web framework, what should I look for when deciding what to go with? Here's what I have noticed with the framework I'm looking at: Small community. There...

choosing between algorithms

Hi All, I am sure there are lot of Software Testing Engineers, Algorithm Validation Engineers on Stackoverflow.Could someone please tell me how would one proceed in the following scenario. Say we have a Mammogram and 5 different algorithms which take this mammogram as input and identify if there is Cancer in the patient. If 3 out of 5 ...

MATLAB: comparison of cell arrays of string

I have two cell arrays of strings, and I want to check if they contain the same strings (they do not have to be in the same order, nor do we know if they are of the same lengths). For example: a = {'2' '4' '1' '3'}; b = {'1' '2' '4' '3'}; or a = {'2' '4' '1' '3' '5'}; b = {'1' '2' '4' '3'}; First I thought of strcmp but it would r...

Comparing generated executables for equivilance.

I need to compare 2 executables and/or shared objects, compiled using the same compiler/flags and verify that they have not changed. We work in a regulated environment, so it would be really useful for testing purposes to isolate exactly what parts of the executable has changed. Using MD5Sums/Hashes doesn't work due to the headers cont...

jQuery 'If' statement string comparison not working.

I'm having a very hard time trying to do something very simple. Here's the code: if(data == 'success') { alert('foo'); } else { alert(data); } I've simplified it, but that's all that's necessary to understand what's going on. the variable 'data' is a result of an AJAX call, if that m...

Javascript Arrays - Checking two arrays of objects for same contents, ignoring order

I have two JavaScript arrays (A and B) that contain objects that I created. I want to check that all the objects in array A are contained in array B, but not necessarily in the same order. What is the best way to do this? Edit: They are all actual objects, not primitives, so I will need to compare their contents and structure as well ...

Java string comparisions/quotations

Hi, My problem is the comparision of two objects and the strings that they return (accessed through getters). Object one parses a csv file for dates and when printed out through exampleObject.getDateTime() returns the string: "2010-03-26-10-54-06.471000" Object two has its dateTime string set by the user. When I set the dateTime on o...

Equality comparison between multiple variables

I've a situation where I need to check whether multiple variables are having same data such as var x=1; var y=1; var z=1; I want to check whether x==1 and y==1 z==1 (it may be '1' or some other value). instead of this, is there any short way I can achieve same such as below if(x==y==z==1) Is this possible in C#? ...

JavaScript Date.parse() and null dates

I'm trying to sort a list of dates, but I'm struggling with null dates which aren't being handled consistently. So I need something like: var date = Date.parse(dateString); if (!date) { date = Date.MinValue; } but I'm struggling to find the correct syntax. Thanks Update: The bug turned out to be a different problem. I have Dat...

ActiveRecord / MySQL Select Condition Comparing String Components

I have a string that is defined as one or more dot-separated integers like 12345, 543.21, 109.87.654, etc. I'm storing values in a MySQL database and then need to find the rows that compare with a provided value. What I want is to select rows by comparing each component of the string against the corresponding component of the input strin...

Finding hosting provider, basic criteria?

Hello, i am a professional in web software development but know little about hosting. I selected Bluehost because of good reviews. Every day i experience between 30 min and 2 hour downtime, which is in direct contradiction to all i read about this Hoster. My problem now, how do i find the right hoster. What are the types of Hosters? ...

Compare 2 directories and copy differences to directory 3

Hello - I have three directories. I would like to compare directory1 with directory2, then take those changes/new files and copy them over to directory3. Is there an easy way to do this, maybe by using linux diff and cp commands? I'm open to ideas. Thanks! Andrew ...

What's the most efficient way to test two integer ranges for overlap?

Given two inclusive integer ranges [x1:x2] and [y1:y2], where x1 <= x2 and y1 <= y2, what is the most efficient way to test whether there is any overlap of the two ranges? A simple implementation is as follows: bool testOverlap(int x1, int x2, int y1, int y2) { return (x1 >= y1 && x1 <= y2) || (x2 >= y1 && x2 <= y2) || ...

How does Python compare string and int?

The following snippet is annotated with the output (as seen on ideone.com): print "100" < "2" # True print "5" > "9" # False print "100" < 2 # False print 100 < "2" # True print 5 > "9" # False print "5" > 9 # True Can someone explain why the output is as such? Implementation details ...

How do I modify the Min Heap insert and delete function to accept a second comparison if the primary comparison happens to be equal?

below I have a standard insert and delete function for a Min Heap, what I need to do is add a special case to both the functions when the T.num comparison happen to be equal, I then need to then compare the T.Letter where the lower Ascii value is popped first. Without the comments is the standard insert and delete, add the commented sect...

How to get a variable to have 2 decimals

I have a variable i would like to force to have 2 and always 2 decimals. Im comparing to a currency. Often i get a comparison looking like the following. if self.price != price #do something end Where self.price = 120.00 and price = 120.0. The self.price is set with a :precision => 2 in the model, but how do i do the same with a var...

Compare two arrays or arraylists, find similar and different values

Hi all, I have two arrays (or arraylists if it is easier) of strings. I need to compare these, find which only exist in the first array, which exist in both, and which only exist in the second array. These arrays are different lengths, and may be in different orders. If necessary, I suppose I could sort them... I know I could hack th...

Comparing XML documents for changes in PHP

Currently I'm using PHP to load multiple XML files from around the web (non-local) using simplexml_load_file(). This, as you can imagine, is quite a clunky process and is slowing load time significantly (7 seconds to load 7 files), and there could possibly be more files to load. These files don't change often, but changes should be displ...