conditional

How would I go about writing a conditional statement to check if visitor is coming from a particular site?

Hello guys, What I have in mind is this... We are going to have people come from a particular site during a acquisition campaign and was wondering how I could conditionalize a certain section of my site to display a thank you message instead of the sign up form as they would have had the opportunity to fill this out before coming to my ...

Conditional macro expansion

Heads up: This is a weird question. I've got some really useful macros that I like to use to simplify some logging. For example I can do Log(@"My message with arguments: %@, %@, %@", @"arg1", @"arg2", @"arg3"), and that will get expanded into a more complex method invocation that includes things like self, _cmd, __FILE__, __LINE__, etc...

Conditional statement, etc. organizing in gedit

Hi, I was wondering if it was possible to group/organize conditional statement blocks in gedit in much the same manner as notepad++, via a plug-in or other means. Thanks to all in advance. http://i50.tinypic.com/2vuyd5f.png (Image, for reference.) ...

What is this syntax called Bool bool = object.method() > 0 in Java

I've just seen this line of code in my housemates code. Bool bool = method() > 0; or string name = "Tony"; boolean nameIsTony = name == "Tony"; This would result in nameIsTony becoming true. So you can have an inline conditional statement? What is this called? ...

How to delay execution of a method in c#?

I have this if condition, if (sendSMS(Convert.ToInt32(DLComportNo.SelectedItem.Text), TxtDriMob.Text, TxtCliDet.Text) && sendSMS(Convert.ToInt32(DLComportNo.SelectedItem.Text), TxtCliMob.Text, TxtDriDet.Text)) { // I am inserting details to my db } and my sendSMS method looks like this, private bool sendSMS(int portNo, string m...

Process results of conditional split in SSIS

I have a Data Flow Task and am connecting to a database via an OLE DB Source component to extract data. This data feeds into a Conditional Split component to separate the data based on a simple expression. After the evaluation of this expression, the data will end up in either of two locations: LocationA or LocationB. Alright, I have ...

jQuery UI: how to run evaluation

I want to add 'Year' or Years' to the end of a string depending on the string. Like this: $("#selector").val(conditional_value_here); Using jQuery UI I have a slider that manipulates a value: $("#slider").slider({ value: 1, min: 1, max: 25, step: 1, slide: function(event, ui) { $("#amount").val(ui.value + ...

How do you put an "IF DEBUG" condition in a c# program?

How do you put an "IF DEBUG" condition in a c# program so that, at run time, it will ignore a set of code if you are running in Debug mode and yet, execute a block of code if the program is not running in debug mode? A situation where this can be used is if a time stamp is taken at the start of a block and another time stamp is taken at...

Difference between MySQL IS NOT NULL and != ''

Is there any difference between MySQL IF (myText IS NOT NULL) THEN and IF (myText != '') THEN ...

SSRS run SQL/DataSet conditionally

Hello.... I have an SSRS report that contains several subreports. The user has the ability to select/deselect which subreports they want to produce using several Boolean parameters. If a subreport is deselected then it is not rendered by setting the Visibility property. However, the DataSet associated with the de-selected subreport s...

How to use ? keyword for string

I have a simple condition and want to implement it with ?: keyword but compiler do't let me. this is the exact sample // in asp page decleration <ajaxtoolkit:FilteredTextBoxExtender id="ftbeNumeric" runat="server" TargetControlID="textbox1" FilterType="Numbers" /> <asp:TextBox ID="textbox1" runat="server" /> // in code behind decimal ...

How make {$IFNDEF DEBUG} work in lazarus/osx project

I need to disable some code when run under the debugger. So, I just imagine that doing: {$IFNDEF DEBUG} ... {$ENDIF} However, the code inside the ifndef is executed in the debugger, makin it crash. I have lazarus 0.9.29 & FPC 2.4.0 ...

One producer, Two consumers and usage of pthread_cond_signal & pthread_mutex_lock

I am fairly new to pthread programming and am trying to get my head around cond_signal & mutex_lock. I am writing a sample program which has One producer thread and Two consumer threads. There is a queue between producer and the first consumer and a different queue between producer and the second consumer. My producer is basically a co...

Conditional inline in Django admin?

I'm trying to figure out a way to display the following RelativeInline only if Person.is_member is True. Current admin.py: class RelativeInline(admin.TabularInline): model = Relative fk_name = 'member' class PersonAdmin(admin.ModelAdmin): inlines = [RelativeInline,] ordering = ('first_name',) list_filter = ('is_me...

prolog, a conditional like form

Hi, well i'm having a hard time working with prolog (gprolog). My problem is this, I've the next predicate: prob(factA,factB,X,first):- X=<50. prob(factA,factB,X,second):- X>50,X=<80. prob(factA,factB,X,none):- X>80,X=<100. that is factA have 50% of probability of occur, factB a 30%, and lastly 20% of non of the facts occur. Also ...

Do dictionaries in Python offer the best way to formulate switch-like statements?

I'm hoping there's no performance or other disadvantage in attempting to avoid long chains of conditional if/elif statements this way: errstr = {404: "404 Not Found", 405: "405 Method Not Allowed"} if code in errstr: print errstr[code]; ...

Powershell help, if process exists, stop it, else start a service??

Hi All, I'm pretty new to Powershell. I have 2 different scripts I'm running that I would like to combine into one script. Script 1 has 1 line Stop-Process -ProcessName alcore.* -force It's purpose is to end any process that begines with "alcore." Script 2 has 1 line as well Start-Service -displayname crk* It starts any service ...

Python: Looping over One Dictionary and Creating Key/Value Pairs in a New Dictionary if Conditions Are Met

I want to compare the values of one dictionary to the values of a second dictionary. If the values meet certain criteria, I want to create a third dictionary with keys and value pairs that will vary depending on the matches. Here is a contrived example that shows my problem. edit: sorry about all the returns, but stack overflow is not...

What is wrong with my do/while loop?

the following code gives me an error of: "expected ';' before '{' token". can anyone see why? do { r = rand() % numElements; } while ([questionsShown containsObject:r] && myCount < numElements) { //code here… } ...

Ternary Operator in JavaScript With Multiple Expressions?

the_styles ? the_styles.appendTo('head'); the_styles=null : the_styles = $('.stylesheet').detach(); Obviously, this isn't valid. Notice the ";" between the appendTo() and the_styles=null. How do I write it on 1 line and still have multiple expressions like that? ...