conditional

Conditional column for query based on other columns in MySQL

I'm pretty sure I've seen this somewhere, but I can't find the right terminology so I'm having trouble... Let's say I have a table with user info (let's also assume that it was created by someone who gets paid more than me, so modifying the schema is not an option.) Among the various columns of user info are columns for DOB and job titl...

WiX condition properties passed from command line don't work?

I have a property for whether to install shortcuts that need to be passed via command line arguments. The conditions seem to work when I set the properties within the wxs file, but they seem to be ignored when setting them through the command line. From the log I see that they are being set: MSI (s) (24:C8) [11:01:32:234]: PROPERTY CH...

Determining if a variable is within range? (Ruby)

I need to write a loop that does something like: if i (1..10) do thing 1 elsif i (11..20) do thing 2 elsif i (21..30) do thing 3 etc... But so far have gone down the wrong paths in terms of syntax. Any help would be much appreciated. ...

Simple PHP Condition help: if($Var1 = in list($List) and $Cond2) - Is this posslbe?

Hey is this a possible funtion? I need to check if a variable is existent in a list of ones I need to check against and also that cond2 is true eg if($row['name'] == ("1" || "2" || "3") && $Cond2){ doThis(); } It's not working for me and all I changed in the copy paste was my list and the variable names ...

MySQL Conditional Insert

I am having a difficult time forming a conditional INSERT I have x_table with columns (instance, user, item) where instance ID is unique. I want to insert a new row only if the user already does not have a given item. For example trying to insert instance=919191 user=123 item=456 Insert into x_table (instance, user, item) values (919...

Database design for conditional actions

I'm working on something of a wizard-type application to allow users to build simple "scripts" that basically perform actions based on certain conditions. Scripts that they build will be stored in a database, and modification will be common, so some sort of forward-only text generation is not an option. My program converts this internal ...

Activating OnBeforeUnload ONLY when field values have changed

Hey guys, What I'm trying to achieve is to Warn the user of unsaved changes if he/she tries to close a page or navigate away from it without saving first. I've managed to get the OnBeforeUnload() dialog to pop-up... but I don't want it to be displayed at all if the user hasn't modified any field values. For this, I'm using this hidd...

Conditional compilation based on a compiler directive in Delphi 2009

Is there a way in Delphi 2009 to have a section of code conditionally compiled based on a compiler directive. Specifically, I'd like to have code in place that is only included if the range-check compiler directive is turned on. Something like this: {$ifdef RANGECHECKINGISON} [do range checking code here] {$endif} ...

WiX Show Dialog Based on Feature to be Installed

Let me be upfront I am novice with WiX. I have a custom dialog CustomSetupTypeDlg.wxs that changes the Typical/Custom/Complete to Desktop/Server/Suite. It sets WixUI_InstallMode to InstallDesktop, InstallServer and InstallSuite appropriately. I need to have the user browse for an installation folder depending upon what feature is to b...

Conditional Formatting for background color and text based another cell value

Hello, I want to be able to test the value in cell $A$3 and determine if it has the text "YES" entered. IF $A$3 is "YES" then the cell $D$3 background should be set to a color and the text for cell $D$3 should say "NA". I've tried using the following for Microsoft Excel 2003, but does not work. Any guidance would be appreciated. Thank...

Conditional Group By statement using LINQ

I have what seems to be a fairly simple requirement, but looking around I'm not able to get a simple answer for this. I have looked on MSDN forums, Exper Exchange and nothing substantial was given to me. I have the following LINQ code Dim SummaryLog As IQueryable(Of clPartCountSummary) SummaryLog = From Inventory In db.tblPartCount...

Better way to write this

Hi I just got hung up on this: if ( !(cmd === 'JustifyLeft' || cmd === 'JustifyRight' || cmd === 'JustifyCenter' || cmd === 'JustifyFull') ) (JavaScript) Any suggestions to do it better? thanks ...

Django conditional aggregation

Does anyone know of how I would, through the django ORM, produce a query that conditionally aggregated related models? Let's say, for example, that you run a site that sells stuff, and you want to know how much each employee has sold in the last seven days. It's simple enough to do this over all sales: q = Employee.objects.filter(type...

Show Additional Content Based on Selection

Is this also the Risk Address: <select name="InsuredSALicense2" id="InsuredSALicense2"> <option>Please Select</option> <option>Yes</option> <option>No</option> </select> If the answer here is "No" then a hidden drop down must be created. If No, Please give details: <textarea name="InsuredOther License2" id="InsuredOt...

Conditional install/uninstall of Windows Service

Using VS2008 TFS I have created a setup application that installs two Window Services. The first service is always installed and uninstalled (and works fine--I'm using the installer class). The second service is optional. Depending a custom condition I set up determines whether the 2nd service is installed. If requested the install w...

C#: Using Conditional-attribute for tests

Are there any good way to use the Conditional-attribute in the context of testing? My thoughts were that if you can do this: [Conditional("Debug")] public void DebugMethod() { //... } Maybe you could have some use for: (?) [Conditional("Test")] public void TestableMethod() { //... } ...

Conditional dialogs in Setup application in VS2008

I have added two dialogs to the install user interface. The first dialog prompts the user for the type of install (two radio buttons). Based on the answer it drives what components get installed (all working well), but I also want it to conditionally display the 2nd dialog based on the answer. I would have thought there would be a CO...

Using If in JQuery

I'm using the jQuery Clean Calendar Plugin, and it's working well. However, in my jQuery code, I want to check whether any '/' is present in textbox.val(). Then I want to do some operations. How do I check if the value contains '/' in it? ...

Conditional where clause in Select statement

I am using a stored procedure to generate a report based on parameters to SP. I have to join different where conditions depending upon parameters passed. For ex. ALTER PROCEDURE [dbo].[sp_Report_InventoryAging] @TitleFlag int=0, /*0-All veh, 1-Clear Title, 2-Without Clear Title*/ @CompName varchar(100) = 'ALL COMPANIES', @CompBran...

SQL: selective subqueries

Hi, I'm having an SQL query (MSSQLSERVER) where I add columns to the resultset using subselects: SELECT P.name, (select count(*) from cars C where C.type = 'sports') AS sportscars, (select count(*) from cars C where C.type = 'family') AS familycars, (select count(*) from cars C where C.type = 'business') AS businesscars FROM people P ...