Search Results

Search found 6988 results on 280 pages for 'if else statement'.

Page 18/280 | < Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >

  • Conditional Statement as Hierarchy jQuery

    - by Jacob Lowe
    Is there a way to make jQuery use objects in a conditional statement as an object in a hierarchy. For Example, I want to validate that something exist then tell it to do something just using the this selector. Like this if ($(".tnImg").length) { //i have to declare what object I am targeting here to get this to work $(this).animate({ opacity: 0.5, }, 200 ); } Is there a way to get jQuery to do this? I guess theres not a huge benefit but i still am curious

    Read the article

  • SQLite is the CASE statement expensive?

    - by galford13x
    I'm wondering if using a CASE statement in SQLite (or other SQL engines) to replace data is not advised. For example lets say I have a query. SELECT Users, CASE WHEN Active = 0 THEN 'Inactive' WHEN Active = 1 THEN 'Active' WHEN Active = 2 THEN 'Processing' ELSE 'ERROR' AS Active FROM UsersTable; When is it better to create a reference table and perform a JOIN. In this case I would create a Table 'ActiveStatesTable' with ActiveID, ActiveDescription and perform the JOIN.

    Read the article

  • SQL select statement filtering

    - by cc0
    Ok, so I'm trying to select an amount of rows from a column that holds the value 3, but only if there are no rows containing 10 or 4, if there are rows containing 10 or 4 I only want to show those. What would be a good syntax to do that? So far I've been attempting a CASE WHEN statement, but I can't seem to figure it out. Any help would be greatly appreciated. (My database is in an MS SQL 2008 server)

    Read the article

  • Why JavaScript Statement "ga = ga || []" Works?

    - by Morgan Cheng
    Below javascript statements will cause error, if ga is not declared. if (ga) { alert(ga); } The error is: ga is not defined It looks undeclared variable cannot be recognized in bool expression. So, why below statement works? var ga = ga || []; To me, the ga is treated as bool value before "||". If it is false, expression after "||" is assigned to final ga.

    Read the article

  • javascript AOP statement trace

    - by Paul
    Some javascript libraries, such as JQuery and Dolo, provide AOP APIs that can trace a function. Just wondering whether there is any javascript AOP libraries can trace an individual statement?

    Read the article

  • Stepping over a yield statement

    - by EoghanM
    When in the Python debugger (pdb) I want to step over a yield statement, but hitting (n) for next brings me to the destination of the yield i.e. the consumer of the generator. I want to go to the next line that is executed within the generator. Is there any way to do this? I'm using Python 2.6

    Read the article

  • A question about complex SQL statement

    - by william
    Table A has columns ID and AName, Table B has columns BName and ID. B.ID is foreign key of A.ID. Write a SQL statement to show data like: print column AName and C which describe whether Table B has ID in Table A, if exists 1 or else 0. So if A is: 1 aaa 2 bbb B is: something,2 output is: aaa,0 bbb,1

    Read the article

  • PHP Help with "if" statement to dynamically include files

    - by Adrian M.
    Hello, I have these files: "id_1_1.php", "id_1_2.php", "id_1_3.php" etc "id_2_1.php", "id_2_2.php", "id_2_3.php" etc the number of files is not known because will always grow.. all the files are in same directory.. I want to make a if statement: to include the files only if their name ends with "_1" another function to load all the files that start with "id_1" How can I do this? Thank you!

    Read the article

  • complex if statement in python

    - by Neverland
    I need to realize a complex if-elif-else statement in Python but I don't get it working. The elif line I need has to check a variable for this conditions: 80, 443 or 1024-65535 inclusive I tried if ... # several checks ... elif (var1 > 65535) or ((var1 < 1024) and (var1 != 80) and (var1 != 443)): # fail else ...

    Read the article

  • php URI troube with if statement,

    - by sea_1987
    I am running an if statement, that looks like this, if($this->uri->segment(1) !== 'search' || $this->uri->segment(1) !== 'employment') { //dome something } My problem is that first condition works, if the uri segment 1 equals search then the method do not run however if I on the page employment, and the first segment of the uri is employment then the condition still runs, why is this?

    Read the article

  • If/Then in SQL Embedded in VBA

    - by Daniel
    I've got a string like this in my Excel VBA: strSQL = "SELECT * FROM Total WHERE (SimulationID = (" & TextBox1.Text & ") And Test1 = (" & Example & "))" However, sometimes Test will be 'is null', which makes the query And Example = is NULL How can I change it to add an if/then statement or something to make it say And Example is null when Example has a value of "is null"?

    Read the article

  • What is the Fastest Way to Check for a Keyword in a List of Keywords in Delphi?

    - by lkessler
    I have a small list of keywords. What I'd really like to do is akin to: case MyKeyword of 'CHIL': (code for CHIL); 'HUSB': (code for HUSB); 'WIFE': (code for WIFE); 'SEX': (code for SEX); else (code for everything else); end; Unfortunately the CASE statement can't be used like that for strings. I could use the straight IF THEN ELSE IF construct, e.g.: if MyKeyword = 'CHIL' then (code for CHIL) else if MyKeyword = 'HUSB' then (code for HUSB) else if MyKeyword = 'WIFE' then (code for WIFE) else if MyKeyword = 'SEX' then (code for SEX) else (code for everything else); but I've heard this is relatively inefficient. What I had been doing instead is: P := pos(' ' + MyKeyword + ' ', ' CHIL HUSB WIFE SEX '); case P of 1: (code for CHIL); 6: (code for HUSB); 11: (code for WIFE); 17: (code for SEX); else (code for everything else); end; This, of course is not the best programming style, but it works fine for me and up to now didn't make a difference. So what is the best way to rewrite this in Delphi so that it is both simple, understandable but also fast? (For reference, I am using Delphi 2009 with Unicode strings.) Followup: Toby recommended I simply use the If Then Else construct. Looking back at my examples that used a CASE statement, I can see how that is a viable answer. Unfortunately, my inclusion of the CASE inadvertently hid my real question. I actually don't care which keyword it is. That is just a bonus if the particular method can identify it like the POS method can. What I need is to know whether or not the keyword is in the set of keywords. So really I want to know if there is anything better than: if pos(' ' + MyKeyword + ' ', ' CHIL HUSB WIFE SEX ') > 0 then The If Then Else equivalent does not seem better in this case being: if (MyKeyword = 'CHIL') or (MyKeyword = 'HUSB') or (MyKeyword = 'WIFE') or (MyKeyword = 'SEX') then In Barry's comment to Kornel's question, he mentions the TDictionary Generic. I've not yet picked up on the new Generic collections and it looks like I should delve into them. My question here would be whether they are built for efficiency and how would using TDictionary compare in looks and in speed to the above two lines? In later profiling, I have found that the concatenation of strings as in: (' ' + MyKeyword + ' ') is VERY expensive time-wise and should be avoided whenever possible. Almost any other solution is better than doing this.

    Read the article

  • Me.Invoke in VB.NET doesn't actually "Invoke" - threads stall on Invoke statement

    - by rwmnau
    I've got the following code: Public Delegate Sub SetStatusBarTextDelegate(ByVal StatusText As String) Private Sub SetStatusBarText(ByVal StatusText As String) If Me.InvokeRequired Then Me.Invoke(New SetStatusBarTextDelegate(AddressOf SetStatusBarText), StatusText) Else Me.labelScanningProgress.Text = StatusText End If End Sub The problem is that, when I call the "SetStatusBarText" sub from another thread, InvokeRequired is True (as it should be), but then my threads stall on the Me.Invoke statement - pausing execution shows them all just sitting there, not actually invoking anything. Any thoughts about why the threads seem to be afraid of the Invoke?

    Read the article

  • SQL SELECT Statement

    - by mouthpiec
    I have a table with the following columns: id, teamA_id, teamB_id Will it be possible to write a SELECT statement that gives both teamA_id and teamB_id in the same column? EDIT: Consider this example From id, teamA_id, teamB_id 1, 21, 45 2, 34, 67 I need Teams 21 45 34 67

    Read the article

  • Using an object in an if statement... (Android)

    - by James Rattray
    I have an object variable Object test = Spinner.getSelectedItem(); -It gets the selected item from the Spinner (called spinner) and names the item 'test' I want to do an if statement related to that object e.g: 'if (test = "hello") { //do something }' But it appears not to work.... Can someone give me some help? -Do I have to use a different if? or convert the object to string etc.? Thanks alot... James

    Read the article

  • Python: try statement single line

    - by Brant
    Is there a way in python to turn a try/except into a single line? something like... b = 'some variable' a = c | b #try statement goes here Where b is a declared variable and c is not... so c would throw an error and a would become b...

    Read the article

  • SQL Join Statement

    - by mouthpiec
    Hi I have the following SQL SELECT statement SELECT bar_id, bar_name, town_name, advert_text FROM bar, towns, baradverts WHERE town_id = town_id_fk AND bar_id = bar_id_fk My problem is that since not every bar has an advert in table "baradverts", these bars are not coming up in the results. In other words I need a NULL for those bars that do not have an advert string.

    Read the article

< Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >