conditions

What is meant by "framing" another's site?

I've been given a copy of a proposed site agreement in which one of the conditions is: ...each of us may for the Term: ...frame the other's site What is meant by "framing"? I assume it might have something to do with an iframe embed or to capture part of our main page without additional logos and other such imagery? ...

How does the processor handle conditions?

So, SUPER low-level what does an IF() look like, how is it handled by an x86 processor? ...

Select rows that contain more than one condition simultaneously...

I have table structure like this: ID cond 1 5 1 2 1 6 8 2 9 1 9 5 When I want to select rows that contain one or more conditions i use OR (...WHEN cond=2 OR cond=6 GROUP BY ID...) But how to select rows that contain more than one condition simultaneously grouped by ID? E.g. when i want to find rows that contain co...

Can't define :joins conditions in has_many relationship ?

Hi, I have a relationship table : create_table "animal_friends", :force => true do |t| t.integer "animal_id" t.integer "animal_friend_id" t.datetime "created_at" t.datetime "updated_at" t.integer "status_id", :default => 1 end linking animals to others. Best way to retreive associations in SQL is : SE...

Badge system and storing conditions as variables?

I'm trying to write a piece of code that checks a users stats, be that their points, rank or num_friends and in turn awards them a badge similar to that used in SO. The system is set so when a task (vote up, comment, etc.) is completed by a user, their user_id is recorded and queued to be evaluated at 5 min intervals by a cron job. Is ...

Condition order in while loop

Hello everyone, First of all, before I begin, I am using VC++ 2008 professional, running an Intel core2 on windows OS. I also know that this code will NEVER be executed on anything other than a core2/corei7 running Windows. I have a while loop with 2 conditions that looks something like this: note: this is a much simplified version. ...

Race Condition because of multiple AJAX reqeusts

hi, my problem is the following. I wrote a class AJAXEngine, which creates in the constructor a new XMLHttpRequest object. The class contains a method called responseAnalyser, which is called when the "onreadystatechange" of the XMLHttpRequest object has changed. So now I created lets say 4 instances of AJAXEngine => 4 XMLHttpRequest ob...

Adding find condition to all Active Record Models in Rails

Is there anyway to add a find condition to all Active record models? that is I would like this query ExampleModel.find :all, :conditions=> ["status = ?", "active"] to behave the same way as ExampleModel.find :all in every model Thanks!! ...

SWI-Prolog conditional statements

I'm trying to write a function that will test to see if the word hello is contained in a list. If it is contained, i don't want it to say "true", i want it to say : "yes, the word hello is contained here", any ideas? Here's my code : contains_hello([hello|_]). contains_hello([Head|Tail]):- Head \= hello, contains_hello(Tail). ...

How to have a query with columns needing different conditions in MySQL?

For a game, I want to count the number of user sign-ups by hour (using MySQL.). Quite easy, something like that: SELECT COUNT(*), DAY(date_user), HOUR(date_user) FROM users, GROUP BY DAY(date_user), HOUR(date_user) After that, I want to only take in consideration users which have played the game at least one time. I have a second t...

CakePHP, Setting a complex/multiple find condition for a multi select box.

I have a multi-select box named Manufacturer Name that is displaying correctly, even clickable for multi search. When I run the search I am not getting any results from my database using the complex find conditions I set. I've tried to use Complex-Find-Conditions from the bakery, and other various websites but no avail. //This my in...

Objective-C Condtions operators weirdness

Okay here's the damned thing: - (void)setMinimumNumberOfSides:(NSNumber *)newMinimumNumberOfSides { if (newMinimumNumberOfSides != minimumNumberOfSides) { NSNumber *minimum = [[NSNumber alloc] initWithInt:(int)2]; if (newMinimumNumberOfSides > minimum) { [newMinimumNumberOfSides retain]; [mi...

if($ext == ('zip' || 'png')) { echo "Is it possible ?" }

Hi all :) I'm currently writing sort of a download manager and I was asking myself if that was possible: if($ext == ('zip' || 'png')) { echo "Is it possible ?" } It returns true everytime, so I guess it's not possible. But do you have an idea about how I could easily do this ? I mean, not with plenty of "if" or "switch"... Thanks an...

How to design this particular finite state machine?

Hey peeps, I am trying to get my head around how to design the following system, which I think can be defined as a finite state machine: Say we have a pile of 16 building blocks (towers, walls, gates) together forming a castle. The player can drag the blocks to 16 places on a floorplan and if done right they will see the whole castle....

Rails ActiveRecord: Is a combined :include and :conditions query possible?

Imagine I have wiki Articles, with many Revisions. I'd like to do a query with ActiveRecord through the database, which only returns those Articles which have Revisions which are updated in the past 24 hours. Is such a thing possible? I'd imagine it'd be something like: Articles.find_all(:include => :revisions, :co...

Rails ActiveRecord conditions

Is there a way to create a condition like this? @products = Product.find(:all, :limit => 5, :conditions => { :products => { :locale => 'en', :id NOT '1' }, :tags => { :name => ['a','b']}) I would like to list all products not including product 1. Thx. ...

SQL or Ruby on Rails question: Limit results from a search to the greater of two conditions

Is it possible to impose conditions on a SQL query to the greater of two conditions? For example, imagine a site that has Posts. Is there a way to request posts such that the result will be guaranteed to contain both of at least all posts made in the past 24 hours, and at least 10 posts, but not unnecessarily exceeding either limit? I...

Rails - Active Record :conditions overrides :select

I have a fairly large model and I want to retrieve only a select set of fields for each record in order to keep the JSON string I am building small. Using :select with find works great but my key goal is to use conditional logic with an associated model. Is the only way to do this really with a lamda in a named scope? I'm dreading that ...

JAVA and how to execute user-code

Hello. I am building a tool which should do a diagnosis based on some values... It should be user extensible so hardcoding the conditions isnt a solution... Suppose that we have a blood test... example ... WBC , ALDO ... And i want the user to be able to write somehow scripts if (WBC.between(4,10) && ALDO.greater(5) || SOMETHINGELESE....

Building Active Record Conditions in an array - private method 'scan' called error

Hi, I'm attempting to build a set of conditions dynamically using an array as suggested in the first answer here: http://stackoverflow.com/questions/1658990/one-or-more-params-in-model-find-conditions-with-ruby-on-rails. However I seem to be doing something incorrectly and I'm not sure if what I'm trying is fundamentally unsound or if I...