conditional

Conditionally parsing XML attributes with PHP

Hi, I am really hoping somebody can help me with this. Basically, I am trying to parse certain XML attributes in an XML tree based on other attributes in that branch. As an example of the type of XML I am working with: - <root> <employees> <team id="1643"> <member id ="153461" jobtype="permament" division="cleaning" rollnumber=...

How to implement conditional encapsulation in C#

I was wondering how one can conditionally hide data in class. For instance , lets say I have a class called Car which has three fields : Engine , MeterReading and Mileage. I have three other entities called : Driver , Mechanic and Passenger. Now what I want is that : A Driver should only be able to access Mileage ( and not Engine an...

Conditional form using jQuery and cookies

Hi everybody! I've got two different forms on my website: one for submitting a general inquiry and another one to order stuff. By clicking a radio button the user can choose the form he/she needs. I created the form in a content management system which checks if the textfield-data is entered correctly after submitting the form. If the ...

Awk conditional sum from a CSV file

I have a CSV file from which I would like to extract some pieces of information: for each distinct value in one colum, I would like to compute the sum of the corresponding values in another column. Eventually, I may do it in Python, but I believe there could be a simple solution using awk. This could be the CSV file: 2 1:2010-1-bla:...

C# Dual Conditional Performance

Which of these would be faster for a static method called billions of times per nanosecond: Method 1: static bool DualConditional(int value) { return A(value) && B(value); } Method 2: static bool DualConditional(int value) { if(!A(value) return false; if(!B(value) return false; } ...

Writing a javascript conditional - active/inactive button

Hi there, I have this script, which works great at the moment to navigate window.uicontrols.createTabBarItem("home", "Tab 1", "icon1.png", { onSelect: function() { jQT.goTo("#home", "slide"); } }); window.uicontrols.createTabBarItem("tab2", "Tab 2", "icon2.png", { onSelect: function() { jQT.goTo("#tab2", "slide"); } })...

Generate script Insert in .net

Hi all, I have problem when trying generate script insert with specific condition. So far I am already trying this step. Add references Microsoft.SqlServer.ConnectionInfo and Microsoft.SqlServer.Smo Add reference in code Microsoft.SqlServer.Management.Smo Add this to script. var srv = new Server(@"localhost\SQLEXPRESS"); var db ...

How can I conditionally use a module in Perl?

I want to do something like this in Perl: $Module1="ReportHashFile1"; # ReportHashFile1.pm $Module2="ReportHashFile2"; # ReportHashFile2.pm if(Condition1) { use $Module1; } elsif(Condition2) { use $Module2; } ReportHashFile*.pm contains a package ReportHashFile* . Also how to reference an array inside module based on dynamic mod...

Is an If branch that does nothing a code smell or good practice?

I've responded to threads here (or at least commented) with answers containing code like this, but I'm wondering if it's good or bad form to write a series of if branches with one (or more) of the branches doing nothing in them, generally to eliminate checking for null in every branch. An example (C# code): if (str == null) { /* Do not...

What's the point of using "while (true) {...}" ?

Why do some people use while(true){} blocks in their code? How does it work? ...

jQuery onclick if then conditional window.location.href problem

OK, so I'm trying a to use a cool image loader/gallery I found here called ShineTime. I want to adopt it to resemble a product viewer on my homepage where you can view the blank space I have reserved for it. Now, since I need to adapt it to be a product viewer, I would like to have links to products or services I'm previewing. I have ...

My Regular Expression will not Match Conditional Statement

Can anyone tell me why, even when my alert shows that my regular expression strings match, the if statement is not triggered? I have sample code below. Thanks in advance. $(document).ready(function () { $('div#primaryNavigation').find('a').each(function () { var pattern = /my-link1|my-link2|my-link3|my-link4/; var my...

conditional display of html element forms

Hello, Well, after a one hour introduction to javascript, I ve come up with the following code. It did what I wanted alright, but then I wanted something else and it wont work. I wanted that upon clicking on a button, a certain field would hide and on clicking on another yes, another one would hide too, BUT, of course, it had to make t...

MSBuild conditional Exec?

Hi, I am building various projects using the <MSBuild Projects="... markup. I am then executing some command line tools after the project is built. E.g <Target Name="Name"> <MSBuild Projects="" /> <Exec Command="" /> </Target> I notice that the project is only built as required and get the following output when the build scr...

Access conditional formatting - adding text instead of color?

I have an Access 2003 report and some of the fields within the report are NULL. I can use conditional formatting to change the color and other aspects of the text-box control but what I want to do is to display "XXXXXXXXXXXXXX" in fields where there is no data (i.e. NULL). Can this be done using conditional formatting? ...

conditional query mysql

hi, i have this mysql schema: comments: ----------------------------- |id|pageid|userid| members: ----------------------------- |username|userid| sometimes the userid from comments is blank, cause anon comment. how i can get the username from members if userid from comments isn't blank. i need to get something like t...

sql server conditional select into temp table

I'm working in SQL Server 2008, and I'm trying to select into a temp table based on a certain condition...for a report, I need up to 18% of the records to be of a certain product type. if ((@totalRecords * .18) > @productTypeCount) select * into #tmpLP_REIT from myTable where productType = @productType else select top 18 per...

Mysql query help

My system consists of two user types - Students and Tutors. - Tutors can create classes and packs - Both Students and tutors can purchase classes and packs Following are the tables involved Groups Users- Contains common fields of both user types Tutor_Details- Tutor specific fields WebClasses - Classes created by tutors Learning_...

<!--[if gte IE 8]--> not behaving as I expect

using the following code to prevent any version of IE prior to IE8 from loading a couple of scripts. The problem is the script is still loaded in IE7, and the conditional tags (which are within the header of the document) are actually being rendered out and displayed on the page!! <!--[if gte IE 8]--> <script src="<?php bloginf...

conditional statements inside php heredocs syntax?

i was wondering if you can have conditional statments inside a heredocs, this is my script but it deosnt parse out the $username properly? php code: function doSomething($username) { if (isset($_SESSION['u_name'])){ $reply ='<a class ="reply" href="viewtopic.php?replyto=@$username.&status_id=$id&reply_name=$username"> reply </a>'; re...