condition

Rails -- Find with 3 conditions?

Hey, I got a find condition that is a bit lengthy and I'd like make it lengthier. SO far :conditions => ["name LIKE ? OR description LIKE ?", "%#{params[:search_keyword]}%", "%#{params[:search_keyword]}%"] Where it's searching the model for if the attribute :name or :description is like a param from a text box. Now I'd al...

jquery - select first element which doesn't have "display:none"

<td class="profile"> <% var usedColors = ViewData["usedColors"] as string[]; %> <a class="profile-color" href="#" style="background: #c00; <% if (usedColors.Contains("#c00") && Model.Color != "#c00") {%>display:none<% }%>" id="color-c00">Color1</a> <a class="profile-color" href="#" style="background: #3491c2; <% if (usedCo...

Enable or disable the next button based on a live text control value in Wix?

I created a custom dialog page in wix and it has a text box. I want to disable the next button of the installer if the text box is empty end enable it if the user has typed a value. The following code works partially. It does not disable the next button but it does not navigate to the next page unless you fill the value. The problem I ha...

Help with JQuery conditional statement

I am trying to run some JQuery script on a particular page but only if a certain page loads. The Scenario: We have one page that loads (i.e., webpage.aspx) and it loads different content based on the referring click. (i.e., webpage.aspx?contentId=1, webpage.aspx?contentId=2, webpage.aspx?contentId=3, etc). Here is my problem. I need ...

Rails -- Find condition with id's all over the place

Hello, I have this find condition pulling from my model that currently looks like this. @major_set = Interest.find(:all, :conditions => {:id => 1..21}) I'd like to add some more individual ids that I've just added which are like 120...130. I tried to do... @major_set = Interest.find(:all, :conditions => {:id => 1..21, 120..130}) ...

Do you need to reset a pthread condition variable after use?

Hi all. Just getting started with pthreads & condition variables. I have an object that has a couple of mutexes and a condition variable as members. I initialize them all in the constructor. After using the condition variable to signal waiting threads, do I need to reset it somehow if the object's state changes and the condition is n...

Pthread lost signals / slow conditions?

Hello, I'm writing a simple threadpool for some small jobs (100 to 700 microseconds). I'm working only with two threads (because there are only two jobs and the processor has only two cores). My problem is that most of the time both jobs are executed by the same thread. The problem does not occur with bigger jobs (some milliseconds). T...

OR in if condition raises "unexpected T_VARIABLE" error

I'm stuck. I just want a simple OR inside an if condition and php always raises an error: My Code: if( ($value > 0.01 || $seconds < 100) ): Error: Parse error: syntax error, unexpected T_VARIABLE ...

Output CSS only if DIV contains content

Hi, I have two gallery buttons, a next and previous, each of which is wrapped in a DIV tag, and want to apply a background image to each. However in some galleries at times the next button may not be output if we've reached the end of the available gallery images. Currently my background image would still appear, even though there is n...

CakePHP search in hasMany relations

Hello, I have a model Content which belongsTo Categories, hasMany Publishers, and Publisher belongsTo city. There is also a search form where someone selects from a drop-down box which category to view and which city. But how can I combine these two in a single paginate condition? I mean I cannot do something like: $this->paginate('Co...

Invalidating loop bounds

I've recently inherited a project primarily done in C++, so this is my first real exposure to it. I'm wondering if I may have a problem erasing a vector's elements from within a loop bounded by the vector's begin() and end(). Here's (essentially) what I've been trying to do: for (vector<double>::iterator i = distance.begin(); i < dista...

WIX: GenerateBootStrapper conditions?

I've built an installer with WIX and have packaged it with the .NET 4.0 framework using the GenerateBootstrapper task. Now .NET 4.0 cannot be installed on XP SP2, but it appears to have no precondition check for this so its installer fails halfway through. I'd like to add my own check to make sure the OS that the entire package is being...

Magento - check if cms page

hey, i want to check via php if a page is a cms_page in Magento. I need diffrent breadcrumbs for cms pages, so im trying to this with a condition, but i have no idea how to or where to look at. Heres my breadcrumbs.phtml so far. <?php if(this is a cms page): ?> <p>some content</p> <?php else: ?> <?php if($crumbs && is_array($crumbs)): ...

Using jQuery set parent element css based on condition of multiple children element

<tr> <td class="cat" CategoryId="8">NoChange*: </td> <td><span class="itm" CategoryId="8">A</span></td> </tr> <tr> <td class="cat" CategoryId="9">Row should be red*: </td> <td></td> </tr> <tr> <td class="cat">Comments:</td> <td><span class="itm"></span></td> </tr>​ I want to set Validation for Category which d...

Empty while loop not checking condition

In a multithreaded C++ program, I have the equivalent of this running in one thread: while(obj->member) { } // waiting for obj->member to be set to false in another thread and in another thread, obj->member is set to false. Even when it's set to false, however, the loop doesn't break. If I change it to this: while(obj->member) { Slee...

given a set of conditions, algorithmically determine only one can be True

Given a set of two or more logical conditions, is it possible to algorithmically determine that exactly ONE of them will evaluate to TRUE? For example: # this should pass, since for every X, only one condition is taken cond 1: (X >= 1.0) cond 2: (X < 1.0) # this should fail cond 1: (X < 1.0) cond 2: (X > 2.0) # this should also fail,...

How to config Many-to-many with condition, in Sqlalchemy

I'm use sqlalchemy 0.6.4. I have 2 classes: Question and Tag, they are many-to-many. class Question(Base): __tablename__ = "questions" id = Column(Integer, primary_key=True) deleted = Column(Boolean) ... tags = relationship('Tag', secondary=r_questions_tags) class Tag(Base): __tablename__ = "tags" id = Co...

PHP boolean to string with modification & a condition

When echoing a boolean (true or false), PHP converts it to 1 or <nothing> and displays it. e.g.: $x = true; echo $x; //displays: 1 $x = false; echo $x; //displays: <nothing> My Question: Is there a PHP function (if not how to code it) which can display exactly "true" or "false" (and not 1 or nothing), if a variable is a boolean otherw...

Task.find Conditions

Hi, I'm building my first Rails project - its a ToDo app, which are supposed to send out warnings when a Task are X minutes from its deadline. Im trying to create a variabel with the tasks that are X minutes from its deadline. The X minutes are diffrent for every Task - which means that its stored in the database. So I got two columns ...

How to use IF ELSE condition with XML by php?

Hello guys. I trying to make Blogspot.com like XML template engine with php. And I'm newbie in XML. How could make php script that read this type of XML and print out something to user's browser? I want to use too many free blogspot templates. Thank you. .... <b:if cond='data:blog.con0'> blablabla1 <b:if cond='data:b...