compare

compare datetime in find conditions

Hi, I am trying to get all users that are updated maximum 90 seconds ago: User.find(:all, :include => { :core => :image }, :conditions => ["updated_at > ?", Time.now - 90.seconds] ) But it doesn't work. why? how can i do? thanks ...

Help matching fields between two classes

I'm not too experienced with Java yet, and I'm hoping someone can steer me in the right direction because right now I feel like I'm just beating my head against a wall... The first class is called MeasuredParams, and it's got 40+ numeric fields (height, weight, waistSize, wristSize - some int, but mostly double). The second class is a ...

JQuery: showing elements with a particular title

I am trying to show only elements that have the title attribute passed to the function: var selectservice = function(serviceStr) { $j("li.project").hide(); $j("li.project.attr('title').contains(serviceStr)").show(); }; I am not quite sure how to compare the title attribute to the passed string serviceStr? contains doesnt seem ...

Comparing NSDates

Hi, I have an NSDate object called 'dueDate'. I'm trying to work out how to display if the due date was yesterday or is tomorrow. How would I go about this? ...

Comparing two date ranges within the same table

I have a table with sales per store as follows: SQL> select * from sales; ID ID_STORE DATE TOTAL ---------- -------- ---------- ------------------------------- 1 1 2010-01-01 500.00 2 1 2010-01-02 185.00 3 1 2010-01-03 135.00 4 1 2009-01-01 165.00...

compare 2 differents chunks of text c#

Someone know an algorithm to compare 2 text and stablish a similarity percentage. Like for example say that chunk 1 is 80% similar to chunk 2, or chunk1 is entirely different from chunk 2 that means that has a 0% of similarity. ...

iPhone Problem comparing course value for cllocation

hi all, i'm writing some code for getting some values including course -(void) locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { //somecode NSString *dirString = [[NSString alloc] initWithFormat:@"%d", newLocation.course]; int myInt = [...

Comparing objects of value type N

What is the best way to compare objects of value type N? So I want to do a String, Integer, DateTime, etc comparison depending on the type of the object. ...

Need a MYSQL query to compare two tables and only output non matching results

I have two tables in my database, one contains a list of items with other information on these items. The other table is contains a list of photographs of these items. The items table gives each item a unique identifier,which is used in the photographs table to identifier which item has been photographed. I need to output a list of it...

How to std::find using a Compare object?

I am confused about the interface of std::find. Why doesn't it take a Compare object that tells it how to compare two objects? If I could pass a Compare object I could make the following code work, where I would like to compare by value, instead of just comparing the pointer values directly: typedef std::vector<std::string*> Vec; Vec...

How to compare two maps by their values

How to compare two maps by their values? I have two maps containing equal values and want to compare them by their values. Here is an example: Map a = new HashMap(); a.put("foo", "bar"+"bar"); a.put("zoo", "bar"+"bar"); Map b = new HashMap(); b.put(new String("foo"), "bar"+"bar"); b.put(new String("zoo"), "bar"+...

Are there any n-way diff tools with vertical compare?

I started using diffuse, which you can use to compare multiple files together with, but it's some what useless since you can't horizontally compare lines when you have like 20 files you need to compare together, I was thinking maybe one line from all twenty files displayed horizontally. ...

How to get NSFormatter subclass to work with NSTableColumn sort key and selector?

My setup: I have a sqlite database from which I populate a NSMutableArray of NSDictionary objects this is the DataSource for my NSTableView. One of the columns holds "time", the time is a float that holds seconds. I would like to display the values in this column as minutes:seconds. For instance my data would be 123.4329387 I want t...

Visual Studio 2010's SQL Schema & Data Compare - Can it be accesed from code?

The other day I tried out VS2010's SQL compare tools and thought they were awesome. I am wondering if there is any way to harness these tools in code written in VS 2010. ...

Shell Script - comparing lines of text, deleting matches

Hi all, I've done some searching for this but cannot find what I'm after, specifically. I have two files: "a.txt", "b.txt". Each contains a list of email addresses, separated by newlines. For all lines in "a.txt", I need to check for a match anywhere in "b.txt". If so, the email address in "a.txt" needs to be removed. (Alternativel...

PostgreSQL compare databases tool or generating migration script util

In our development we use two servers with PostgreSQL 8.4 - development and production. So, after changes were made on development server we would like to automatically generate SQL migration scripts. I found that EMS DB Comparer for PostgreSQL can do it, but it is only for Windows (our development team use Ubuntu for developing). Do you...

How can I check if contents of one file exist in another in Perl?

Requirement:- File1 has contents like - ABCD00000001,\some\some1\ABCD00000001,Y,,5 (this indicates there are 5 file in total in unit) File2 has contents as ABCD00000001 So what i need to do is check if ABCD00000001 from File2 exist in File1 - if yes{ print the output to Output.txt till it finds another ',Y,,X'} else{ No keep che...

Compare contents of two files in Dreamweaver

Is it possible to compare the contents of two files in Dreamweaver? ...

Scalability of Ruby on Rails versus PHP

Can anyone comment on which is more scalable between RoR and PHP? I have heard that RoR is less scalable than PHP since RoR has a little more overhead with its MVC framework while PHP is more low level and lighter. This is a bit vague - can anyone explain better? ...

Comparing dicts and update a list of result

Hello, I have a list of dicts and I want to compare each dict in that list with a dict in a resulting list, add it to the result list if it's not there, and if it's there, update a counter associated with that dict. At first I wanted to use the solution described at http://stackoverflow.com/questions/1692388/python-list-of-dict-if-exis...