comparison

Need advise about compare NSDate

im developing Alarm Clock i want to compare a time now and setTime is it possible to compare in minute only. My Problem is NSDate will compare in second example 9:38:50 are not equal 9:38:00 how can i compare in minute ? is it possible thanks you for all advise. ...

DateTime Comparison Precision

I'm doing DateTime comparison but I don't want to do comparison at second, millisecond and ticks level. What's the most elegant way? If I simply compare the DateTime, then they are seldom equal due to ticks differences. ...

Search book by title, and author

I got a table with columns: author firstname, author lastname, and booktitle Multiple users are inserting in the database, through an import, and I'd like to avoid duplicates. So I'm trying to do something like this: I have a record in the db: First Name: "Isaac" Last Name: "Assimov" Title: "I, Robot" If the user tries to add it again, ...

Comparing arrays with sql

I want to perform a 'SELECT' statement with a byte array (binary) parameter as a condition. I tried to google it, but didn't find anything useful. In general, I keep information of files in the database. one of the properties is the file's hash (binary). I want to give a hash to the SELECT statement, and get all rows with the same hash...

Python - alternative to list.remove(x)?

Hi, I wish to compare two lists. Generally this is not a problem as I usually use a nested for loop and append the intersection to a new list. In this case, I need to delete the intersection of A and B from A. A = [['ab', 'cd', 'ef', '0', '567'], ['ghy5'], ['pop', 'eye']] B = [['ab'], ['hi'], ['op'], ['ej']] My objective is to com...

Comparison of Hudson, CDash, CruisonControl, TeamCity for Continuous Integration / Builder

I found most people talk about Hudson for simple and free continuous integration. Now personally I'm not fond of its interface which I find very messy, and I found almost no one talking about CDash -- I love CMake and CTest seem nice too. Could you give for your favorite continuous integration server/builder/tester/dashboard a short des...

SQL Server 2005 - Using Null in a comparison

This is more of a question to satisfy my own curiosity. Given the following statement: DECLARE @result BIT SET @result = CASE WHEN NULL <> 4 THEN 0 ELSE 1 END PRINT @result Why do i get back "1" instead of "0" Changing it to: DECLARE @result BIT SET @result = CASE WHEN NULL IS NULL ...

Most efficient way to compare a memorystream to a file C# .NET

I have a MemoryStream containing the bytes of a PNG-encoded image, and want to check if there is an exact duplicate of that image data in a directory on disk. The first obvious step is to only look for files that match the exact length, but after this I'd like to know what's the most efficient way to compare the memory against the files....

simple question on C

I have this snippet of the code char *str = “123”; if(str[0] == 1) printf("Hello\n"); why I can't receive my Hello thanks in advance! how exactly compiler does this comparison if(str[0] == 1)? ...

Designing small comparable objects

Intro Consider you have a list of key/value pairs: (0,a) (1,b) (2,c) You have a function, that inserts a new value between two current pairs, and you need to give it a key that keeps the order: (0,a) (0.5,z) (1,b) (2,c) Here the new key was chosen as the average between the average of keys of the bounding pairs. The problem is, t...

String comparison in Python: is vs. ==

I noticed a Python script I was writing was acting squirrelly, and traced it to an infinite loop, where the loop condition was "while line is not ''". Running through it in the debugger, it turned out that line was in fact ''. When I changed it to != rather than 'is not', it worked fine. I did some searching, and found this question, t...

Efficient and accurate way to compact and compare Python lists?

Hi folks, I'm trying to a somewhat sophisticated diff between individual rows in two CSV files. I need to ensure that a row from one file does not appear in the other file, but I am given no guarantee of the order of the rows in either file. As a starting point, I've been trying to compare the hashes of the string representations of the...

How does yum compare versions?

Hi, We have a web app we package into an RPM. We have a problem with the version field of the RPM. Let's say we have installed our rpm: foo-2.1.0.007 007 is our build number. Now when we try to install a newer rpm, foo-2.1.0.010, yum says "There's nothing to update". When I've remade the RPMs, but removed the leading zeroes, the pr...

ASP.NET: C# or VB.NET?

I am currently reading Beginning ASP.NET 4: in C# and VB (Wrox Programmer to Programmer) and it comes with both C# and VB.NET source code. I am definitely planning to use C# in the future for most of my projects. But VB.NET - is it really worth learning side-by-side with C#? Are there such cases when VB.NET is preferred over C#? UPDATE:...

how to compare the values inside a table in sql

how to compare the values of same table(say for eg: Order table) each and every time the record get inserted , if the record with same values get inserted already in same table i should not insert the new record with same values. how to do that exactly in sql server 2008 ...

Simplest way to match array of strings to search in perl?

What I want to do is check an array of strings against my search string and get the corresponding key so I can store it. Is there a magical way of doing this with Perl, or am I doomed to using a loop? If so, what is the most efficient way to do this? I'm relatively new to Perl (I've only written 2 other scripts), so I don't know a lot o...

Log 2 N generic comparison tree

Hey! I'm working on an algorithm for Redundant Binary Representation (RBR) where every two bits represent a digit. I designed the comparator that takes 4 bits and gives out 2 bits. I want to make the comparison in log 2 n so If I have X and Y .. I compare every 2 bits of X with every 2 bits of Y. This is smooth if the number of bits of...

C vs C++ for an almost new programmer

Between C and C++, which is easier to learn? Which is more powerful? Does either do anything special that the other doesn't? thanks! ...

jQuery DOM element creation vs innerHTML

While having one of my questions answered, cletus mentioned that when creating elements in jQuery it's better to use direct DOM element creation, instead of innerHTML. I tried googling it but I wasn't able to find a good article with comparisons. I've provided this code bellow as an example and I was wondering if someone could help me ...

Using modified date of file for comparison. Is it safe?

I want to make a procedure that does one way syncrhonization of a folder between a server and a client. I was thinking to use ModifiedDate as a criterio, provided that only the date of the server files will be used. Procedure will not use Modified dates of files on the client at all. It will read dates from the server and compare them wi...