conditional

WordPress Conditional: Only show if current page title is equal to post meta

Hey, I am calling a bunch of posts under a certain post type in WordPress which works but I am trying to add a conditional that will check first if those post's custom meta field (labeled "disc") is equal to the current post's title. Here is what I have but this conditional does not seem to work: <?php $pages = get_posts('numberpos...

filling array gradually with data from user

I'm trying to fill an array with words inputted by user. Each word must be one letter longer than previous and one letter shorter than next one. Their length is equal to table row index, counting from 2. Words will finally create a one sided pyramid, like : A AB ABC ABCD Scanner sc = new Scanner(System.in); System.out.println("Give the ...

R question. Create new data set that meets all of 4 conditions.

Hello, I would like to create a new dataset where the following four conditions are all met. rowSums(is.na(UNCA[,11:23]))<12 rowSums(is.na(UNCA[,27:39]))<12 rowSums(is.na(UNCA[,40:52]))<12 rowSums(is.na(UNCA[,53:65]))<12 Thanks! ...

SQL: Return "true" if list of records exists?

An alternative title might be: Check for existence of multiple rows? Using a combination of SQL and C# I want a method to return true if all products in a list exist in a table. If it can be done all in SQL that would be preferable. I have written a method that returns whether a single productID exists using the following SQL: SELECT...

Conditional Validation using JQuery Validation Plugin

I have a simple html form that I've added validation to using the JQuery Validation plugin. I have it working for single fields that require a value. I now need to extend that so that if a user answers Yes to a question they must enter something in the Details field, otherwise the Details field can be left blank. I'm using radio buttons ...

conditional operator in C question

I just have a quick question about the conditional operator. Still a budding programmer here. I am given x = 1, y = 2, and z = 3. I want to know, why after this statement: y += x-- ? z++ : --z; That y is 5. The values after the statement are x = 0, y = 5, and z = 4. I know the way the conditional operator works is that it is formatte...

Is this a valid jquery conditional statement?

if (tag == 'td' && $(this).hasClass('status')) { // I am clearing everything inside the td with class status $(this).html('') } But it doesn't seem to clear... Any suggestion... I am customizing a form plugin, $.fn.clearForm = function() { return this.each(function() { var type = this.type, tag = this...

Disabling normal link behaviour on click with an if statement in Jquery?

I've been banging my head with this all day, trying anything and everything I can think of to no gain. I'm no Jquery guru, so am hoping someone here can help me out. What I'm trying to do in pseudo code (concept) seems practical and easy to implement, but obviously not so =D What I have is a navigation sidebar, with sub menu's within so...

Should conditional expressions go inside or outside of classes?

It seems that often I will want to execute some methods from a Class when I call it and choosing which function will depend on some condition. This leads me to write classes like in Case 1 because it allows me to rapidly include their functionality. The alternative would be Case 2 which can take a lot of time if there is a lot of code an...

Conditional regex in vim?

Is it possible to do conditional regex (like the one described in http://www.regular-expressions.info/conditional.html) in Vim? ...

Conditional XAML

For easy of development I'm using a ViewBox to wrap all content inside a Window. This is because my development machine has a smaller screen than the deployment machine so using a ViewBox allows for better realisation of proportion. Obviously there is no reason for it to be there on Release versions of the code. Is there an easy method t...

Protecting critical sections based on a condition in C#

Hello, I'm dealing with a courious scenario. I'm using EntityFramework to save (insert/update) into a SQL database in a multithreaded environment. The problem is i need to access database to see whether a register with a particular key has been already created in order to set a field value (executing) or it's new to set a different val...

Conditional validation

Hi, I have an ASP.NET web app (with C#). In it I have a form with several fields and validators. For one of the validators I only need to validate when: a certain textbox is empty and a certain record does not exist in the database (this is already handled). I know I can't enable/disable the validator on page_load because something...

Multi-dimensional array edge/border conditions

Hi, I'm iterating over a 3 dimensional array (which is an image with 3 values for each pixel) to apply a 3x3 filter to each pixel as follows: //For each value on the image for (i=0;i<3*width*height;i++){ //For each filter value for (j=0;j<9;j++){ if (notOutsideEdgesCondition){ *(**(outArray)+i)+= *(**(pix...

mysql conditional query - complicated!

i want to get distinct values for a field, let say: field1... ok this needs a query like: "select distint(field1) from table" however for some records, field1 is empty and there is another column that is an alternative to field1, which is field2. now; for the records where field1 is empty i need to use the value of field2. i think i nee...

C# and ASP.NET MVC: Using #if directive in a view

Hi all, I've got a conditional compilation symbol I'm using called "RELEASE", that I indicated in my project's properties in Visual Studio. I want some particular CSS to be applied to elements when the RELEASE symbol is defined, and I was trying to do that from the view, but it doesn't seem to be working. My view code looks like this (...

Basic Conditional Checking for IF statements in C

Hi there, Can someone please explain what really goes on in this code ? If I put the AND statement, the message wont show if values are less than 0 or greater than 10 ... I think I must use 1 0 logic to work this out right ? I just need someone to briefly explain it please. #include<stdio.h> main(){ puts("enter number"); scanf("%...

validates_associated not honoring :if

I'm totally blocked on this. See this pastie for sample code: http://pastie.org/990040 The first test will fail. The user model validates an associated address model, but is only supposed to do it if a flag is true. In practice it does it all the time. What is going on? ...

[Assembly] jnz after xor?

After using IDA Pro to disassemble a x86 dll, I found this code (Comments added by me in pusedo-c code. I hope they're correct): test ebx, ebx ; if (ebx == false) jz short loc_6385A34B ; Jump to 0x6385a34b mov eax, [ebx+84h] ; eax = *(ebx+0x84) mov ecx, [esi+84h] ; ecx = *(esi+0x84) mov al, [eax+30h] ; al ...

Declarative authorization and the if_attribute not working...

I've been having almost the same issues as Victor Martin (you can see the questions asked here). I've got declarative authorization working for just about everything that doesn't involve using conditionals. E.g. has_permission_on :users, :to => [:edit, :update, :destroy] do if_attribute :user => is { current_user } end Are there any ...