condition

Is there a way to condition a CSS styling to execute only on IE quirks mode?

I want to write a cross-browser widget, to integrate both to IE standard and quirks mode pages (FF is easy of course). Since I want to write the styling only once I would like to condition some styling statemets to execute only in quirks/standard mode. Is there a way t do so? As far as I understand, both the _ hack and IE conditional ...

Checking condition inside a loop

Hi, If "flag" is true I have to perform step no. 1 otherwise skip it. Is there a way out to skip this unnecessary repetitive check within the loop. (As the value of flag is not changing while the execution of the loop) private void method(boolean flag) { while (man > woman) { if (flag) { // Step no. 1 System.ou...

Loop Until Condition Reached, iPhone

Hi there, I have a problem here... After a button is pressed I want a loop to run until a condition is reached: - (IBAction)buttonclick1 ... if ((value2ForIf - valueForIf) >= 3) { ... I would like a loop to run until ((value2ForIf - valueForIf) >= 3) and then execute the code associated with the IF statement. What I am aiming t...

Do all parts of a SQL SERVER expression using 'OR' get evaluated?

Given: WHERE (@Id Is NULL OR @Id = Table.Id) If @Id is null: the expression evaluates to true. Does the second part @Id = Table.Id still get considered? or is it sufficient that the expression evaluates to true given that the first part is (which is the case in c#). This is relevant because of some much more complex OR statements whe...

SWI Prolog - conditional NOT?

Hi, I'm trying to make a prolog function. The funtion reads in a sentance, and then tries to extract a key word. If a key word is found, it prints a message. I want it to also print a message if no keywords are found. Here is my example : contains([word1|_]) :- write('word1 contained'). contains([Head|Tail]) :- Head \= word1, contains...

Rails virtual attribute search or sql combined column search

Hello All! I have a user model with attributes 'first' and 'last' So for example User.first.first #=> "Charlie" User.first.last #=> "Brown" This User model also has a virtual attribute 'full_name' #user.rb def full_name [first,last].join(' ') end def full_name=(name) #don't know what to do with people w/ middle names split = name...

If condition issue in shell

Hi all, I'm trying to detect whether a string holds a dash but nothing seems to work for me (I'm new to shell). if [ "$m" -eq "-" ] then echo "has dash" else echo "has no dash" fi ...

gdb backtrace and pthread_cond_wait()

This is on a Redhat EL5 machine w/ a 2.6.18-164.2.1.el5 x86_64 kernel using gcc 4.1.2 and gdb 7.0. When I run my application with gdb and break in while it's running, several of my threads show the following call stack when I do a backtrace: #0 0x000000000051d7da in pthread_cond_wait () #1 0x0000000100000000 in ?? () #2 0x0000000000...

Complex date find and inject

I am building a financial reporting app with Ruby on Rails. In the app I have monthly financial statement objects (with 'revenue' as an attribute). For any single financial statement, I want show (1) year-to-date revenue, and (2) last-year-to-date revenue (calendar years are fine). Each object also has a Date (not Datetime) attribute c...

How to know if all the cells have the same value in some column

How to know if all the cells have the same value in some column (title changed) I want to have a bit scalar value that tells me if all the values in a column equal something: DECLARE @bit bit SELECT @bit = TRUEFORALL(Name IS NOT NULL) FROM Contact UPDATE I now realized that I actually don't need the TrueForAll, what I do need is to ...

Specify input() type in Python?

I'm still learning so please forgive if this sounds like a dumb question. Is it possible to define input times, like time, date, currency or that should be verified manually? Like for example: morning = input('Enter morning Time:') evening = input('Enter evening Time:') .. I need (only) time here, how do I make sure that user enters i...

Rails Date compared to Date.today

Hi I am having what seems like a very simple problem. I just can't seem to pin down what I need to do. I have a birth_date that is in the Date format. I want to compare it to Date.today as shown below. The problem is it is coming back false because it wants to compare the year as well. It is a birthday so I don't care about the year ju...

jQuery condition for animation

Hey all, am brand new to javascript and jQuery so this question might seem dumb but i couldnt find any exemple or doc on it. I got this function for a little color animation roll-over and roll-out which works fine: $(".box_nav").hover(function(){ jQuery(this).stop(true, false); $(this).animate({ backgroundColor:...

Get first unlocked row in MYSQL

When someone visits my website, he will see the page with the fewest pageviews. All pages, including a pageview counter, are stored in a MYSQL database. If a page is viewed, the pageview counter is increased by one. I now run into a Racing condition if my webserver has more than one thread: Thread 1: User A retrieves page P with pa...

linq where condition on subselect

how can we add a where condition to a linq subselect query. i.e. List<CallLog> callLog = CallLog.SampleData(); List<Contacts> contacts = Contacts.SampleData(); var q = from call in callLog where call.Incoming == true group call by call.Number into g select new contacts { contact....

Calculate width dynamically (jQuery)

HTML: <div class="parent"> <div class="one"></div> <div class="two"></div> <div class="three"></div> </div> jQuery parentWidth = $(".parent").outerWidth(true); oneWidth = $(".parent .one").outerWidth(true); twoWidth = $(".parent .two").outerWidth(true); $('.parent .three').width( parentWidth - oneWidth - twoWidth); But ...

How to use SQL conditional statements

I need to delete a row based upon the value in a column while executing an update query. Here is the code: UPDATE tag SET tag_count = tag_count - 1 WHERE tag_id = 1 IF tag_count < 1 delete from tag where tag_id = 1 This query here gives me an error. EDIT I am using inline sql with C# and sql server ...

LaTeX \newcommand default argument: is empty?

I'm trying to write a simple example command that prints nothing without an argument, but with an argument it surrounds it with something. I've read that the default value should be \@empty and the simple \ifx\@empty#1 condition should do the job: \newcommand{\optarg}[1][\@empty]{% \ifx\@empty#1 {} \else {(((#1)))} \fi } \optarg %...

Javascript Rouding in For statement

Hi I have this line: for (var j = 0; j<1; j = (j + 0.1).toPrecision(1)) I'm trying to set up this statement so I get 0, 0.1, 0.2, 0.3 up to the number 1. At the moment I get 0, 0.1 and then nothing as if the result goes straight passed 1, Simply using j = j + 0.1 produces rounding errors and I need the precise decimal place. Any s...

301 redirect match problem

Ok I am serving two domains off of one box. The domains are: www.old.org and www.new.com. As it is now, all of the files and dirs are the same on both domains. I want to make it so that IF someone goes to www.old.org/folder_a/file_b.php they are 301'ed to www.new.com/folder_a/file_b.php. I've already tried in the htaccess: Redirect...