conditional

Conditional Logic in ASP.net page

I have some code that prints out databse values into a repeater control on an asp.net page. However, some of the values returned are null/blank - and this makes the result look ugly when there are blank spaces. How do you do conditional logic in asp.net controls i.e. print out a value if one exists, else just go to next value. I sho...

Best practices of unittesting methods that contain conditional conditions

I am new to unittesting and currently have a problem with finding a decent way to test methods that contain branches. I created a small demo method I hope could be used to explain the problem. public void ExportAccounts() { int emptyAccounts = 0; int nonEmptyAccounts = 0; int errorous = 0; string outputPath = this....

Why does .NET's Conditional Attribute Cause Side-Effects to be Removed?

I read about the Conditional attribute today. According to MSDN: Applying ConditionalAttribute to a method indicates to compilers that a call to the method should not be compiled into Microsoft intermediate language (MSIL) unless the conditional compilation symbol that is associated with ConditionalAttribute is defined. OK. That's ...

Are these PHP conditionals the same or does one have an advantage

Is there any advantage to writing a PHP conditional like this: if ($variable != NULL) { versus if (!empty($variable)) { versus if ($variable) { Aren't they all same thing? It seems like the last is always the simplest if you are just trying to tell whether the variable exists or not. Thanks for helping me understand the differen...

Why is > conditional split in SSIS package returning >= result? update: (DateTime != DT_DBTIMESTAMP ?!)

I have an SSIS data flow conditional split transformation that is returning a >= result when it should be returning a > result. From the beginning... My SSIS package executes a SQL task that stores a max(date) from one table in variable User::max_date of type DateTime that has package scope. My package then proceeds to execute a Data...

How does "do something OR DIE()" work in PHP?

I'm writing a php app to access a MySQL database, and on a tutorial, it says something of the form mysql_connect($host, $user, $pass) or die("could not connect"); How does PHP know that the function failed so that it runs the die part? I guess I'm asking how the "or" part of it works. I don't think I've seen it before. ...

problem of conditional visibility and page breaks with rectangles in SSRS 2005

I am trying to insert a conditional page break, actually i had a report of 50 pages with invoices each invoice is 3 pages long so i need a paghebreak for the 2nd invoice t printon the next page as i need the whole report ot print back to back,so i inserted one page break,so this starts the next invoice to start on 4th page but i want nex...

Storing Conditional Logic (Logical Structures) in XML

I have the need to express simple conditionals as program input. The input must be human readable. Is XML suited for this? For example, I have the following conditional statement: If AnimalType = Leopard And (SourceCountry = Kenya Or TargetCountry = Kenya) Then ZooKeeper=Jack Else ZooKeeper=Jill End If Expressing the above ...

Passing a parameter to MSTests using MSBuild

I've got an issue that was wondering if could be solved in a particular way. I would like to be able to pass a parameter or set some kind of variable in an MSBuild script that will be run on a TeamBuild server. This parameter would be used as a condition in the setup of a TestFixture in MSTest to decided which concrete implementation o...

Flash if statement satisfies true and false

I have the following code: if(pickedUp == true){ trace("released and picked up" + pickedUpNum); this.storedClick = false; this.onMouseMove = null; this.onMouseDown = null; this.onMouseUp = null; this.onEnterFrame = this.refresh; pickedUpNum++; if( pickedUpNum > 60) pickedUp = false; } if(pickedUp == false){ trace("released and...

numericUpDown problem...

Hi, I want to hide some things when the value of the numericUpDown is changed so I wrote this: if (numericUpDown1.Value = 1) { Label1.Hide(); } but I get this error message: Cannot implicitly convert type 'decimal' to 'bool' Thanks ...

What is the best/easiest way to use nested switch/case statements?

What is the better practice of the following two switch/case statements? Is there an easier way (less code) to do this? switch (myValue) { case 1: { methodFor1(); break; } case 2: case 3: { methodFor2or3(); if (myValue == 2) methodFor2(); if (myValue == ...

Conditional SELECT of a column

Heyall! Maybe you can help me with a SQL Query: I have a conversion value in a secondary table and the following structure: ID PRICE_BRL PRICE_USD -- --------- --------- 1 10 5 2 12 NULL 3 NULL 3 4 14 NULL 5 NULL 4 6 NULL NULL I need a Result Set Like that prioritizes the first column, in c...

Noob SQL Q: How do I combine 2 select statements into one?

I am a noob when it comes to SQL syntax. I have a table with lots of rows and columns of course :P Lets say it looks like this: AAA BBB CCC DDD ----------------------- Row1 | 1 A D X Row2 | 2 B C X Row3 | 3 C D Z Now I want to create an advanced select statement that gives me this combined (pseudo SQLish here...

With MySQL, how do I insert into a table on condition that the value does not exist in another table?

I have a MySQL database and I would like to insert some values into one table, assuming that a particular value that I am inserting does not match a value in a different table. Here is a simplified/example structure: Table: invites id : int (auto-increment index) name : varchar message : varchar Table: donotinvite name...

PHP - Difference between if () { } and if () : endif;

Are there any differences between these? if ($value) { } if ($value): endif; I think the second way is new to PHP 5.. therefore is it better because it is newer? Update I have been informed that the second way is not new. ...

SSRS Mircosoft Reporting: Conditional grouping

Is it possible to make a group and sort conditional? If so, is it possible to somehow do this based on the value of a textbox item? I thought I could just set the Expression of the group and sort to something like =IIF(ReportItems!TheTextBox.Value = 0, 0, Fields!FieldName.Value), which would be perfect, but it doesn't allow me to use Re...

How do you get a #if conditional to work when unit testing?

this is what I would like to be able to do. /// <summary> /// Gets the session factory. /// </summary> /// <value>The session factory.</value> public ISessionFactory SessionFactory { get { if (_sessionFactory == null) { #if(NUNIT) ...

Entity Framework: Conditional foreign key

Hi all, I have the following schema in the database: BillingReferences (ReferencingType tinyint, ReferencingId tinyint, ReferencedType tinyint, ReferencedId tinyint, IsActive bit) - where all fields (except IsActive) are part of a Unique Index. BillingType (BillingTypeId tinyint, Name varchar(50)) ReferencingType and ReferencedType i...

Dynamic merging of cells in SSRS

In an SSRS Report ,I have a table which has 14 columns, 1st column is 7am and the last column is 7pm. I have 100 records with conference names and the timings, ex: 1) interenational conference 9am to 5pm 2) national conference 8 am to 11 am so the problem is these column cells must merge based on the timings and siplay as one textb...