Search Results

Search found 4921 results on 197 pages for 'conditional execution'.

Page 4/197 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Jquery if visible conditional not working

    - by Wade D Ouellet
    Hey, I have a page going here that uses jQuery: http://treethink.com/services What I am trying to do is, if a slide or sub-page is shown in there, change the background colour and colour of the button. To do this I tried saying, if a certain div is shown, the background colour of a certain button changes. However, you can see there that it isn't working properly, it is changing the colour for the web one but not removing the colour change and adding a colour change on a different button when you change pages. Here is the overall code: /* Hide all pages except for web */ $("#services #web-block").show(); $("#services #print-block").hide(); $("#services #branding-block").hide(); /* When a button is clicked, show that page and hide others */ $("#services #web-button").click(function() { $("#services #web-block").show(); $("#services #print-block").hide(); $("#services #branding-block").hide(); }); $("#services #print-button").click(function() { $("#services #print-block").show(); $("#services #web-block").hide(); $("#services #branding-block").hide(); }); $("#services #branding-button").click(function() { $("#services #branding-block").show(); $("#services #web-block").hide(); $("#services #print-block").hide(); }); /* If buttons are active, disable hovering */ if ($('#services #web-block').is(":visible")) { $("#services #web-button").css("background", "#444444"); $("#services #web-button").css("color", "#999999"); } if ($('#services #print-block').is(":visible")) { $("#services #print-button").css("background", "#444444"); $("#services #print-button").css("color", "#999999"); } if ($('#services #branding-block').is(":visible")) { $("#services #branding-button").css("background", "#444444"); $("#services #branding-button").css("color", "#999999"); } Thanks, Wade

    Read the article

  • Jquery hasClass conditional not working

    - by Wade D Ouellet
    Hey, I have my site going here: http://www.treethink.com I am trying to make it so when a navigation item is clicked, it retracts the news ticker on the right and then doesn't run any of the extracting/timer functions anymore. I got it to retract but it still extracts. How I am doing it is I am adding a "noTicker" class with the nav buttons and removing it with colorbox's close button. The function runs on the page initially and if there isn't a "noTicker" class it runs the news ticker as planned. When a nav or close button is clicked it runs the function again which checks again to see if it has that class. So if it has the class it should retract (which it is so that must mean it's adding the class properly) and then not run any of the timer functions, but it still runs the timer functions for some reason. Here is my jQuery. /* Initially hide all news items */ $('#ticker1').hide(); $('#ticker2').hide(); $('#ticker3').hide(); var randomNum = Math.floor(Math.random()*3); /* Pick random number */ newsTicker(); function newsTicker() { if (!$("#ticker").hasClass("noTicker")) { $("#ticker").oneTime(2000,function(i) { /* Do the first pull out once */ $('div#ticker div:eq(' + randomNum + ')').show(); /* Select div with random number */ $("#ticker").animate({right: "0"}, {duration: 800 }); /* Pull out ticker with random div */ }); $("#ticker").oneTime(15000,function(i) { /* Do the first retract once */ $("#ticker").animate({right: "-450"}, {duration: 800}); /* Retract ticker */ $("#ticker").oneTime(1000,function(i) { /* Afterwards */ $('div#ticker div:eq(' + (randomNum) + ')').hide(); /* Hide that div */ }); }); $("#ticker").everyTime(16500,function(i) { /* Everytime timer gets to certain point */ /* Show next div */ randomNum = (randomNum+1)%3; $('div#ticker div:eq(' + (randomNum) + ')').show(); $("#ticker").animate({right: "0"}, {duration: 800}); /* Pull out right away */ $("#ticker").oneTime(15000,function(i) { /* Afterwards */ $("#ticker").animate({right: "-450"}, {duration: 800});/* Retract ticker */ }); $("#ticker").oneTime(16000,function(i) { /* Afterwards */ /* Hide all divs */ $('#ticker1').hide(); $('#ticker2').hide(); $('#ticker3').hide(); }); }); } else { $("#ticker").animate({right: "-450"}, {duration: 800}); /* Retract ticker */ $("#ticker").oneTime(1000,function(i) { /* Afterwards */ $('div#ticker div:eq(' + (randomNum) + ')').hide(); /* Hide that div */ }); } } /* when nav item is clicked re-run news ticker function but give it new class to prevent activity */ $("#nav li").click(function() { $("#ticker").addClass("noTicker"); newsTicker(); }); /* when close button is clicked re-run news ticker function but take away new class so activity can start again */ $("#cboxClose").click(function() { $("#ticker").removeClass("noTicker"); newsTicker(); }); Thanks, Wade

    Read the article

  • Conditional Validation using JQuery Validation Plugin

    - by Steve Kemp
    I have a simple html form that I've added validation to using the JQuery Validation plugin. I have it working for single fields that require a value. I now need to extend that so that if a user answers Yes to a question they must enter something in the Details field, otherwise the Details field can be left blank. I'm using radio buttons to display the Yes/No. Here's my complete html form - I'm not sure where to go from here: <script type="text/javascript" charset="utf-8"> $.metadata.setType("attr", "validate"); $(document).ready(function() { $("#editRecord").validate(); }); </script> <style type="text/css"> .block { display: block; } form.cmxform label.error { display: none; } </style> </head> <body> <div id="header"> <h1> Questions</h1> </div> <div id="content"> <h1> Questions Page 1 </h1> </div> <div id="content"> <h1> </h1> <form class="cmxform" method="post" action="editrecord.php" id="editRecord"> <input type="hidden" name="-action" value="edit"> <h1> Questions </h1> <table width="46%" class="record"> <tr> <td width="21%" valign="top" class="field_name_left"><p>Question 1</p></td> <td width="15%" valign="top" class="field_data"> <label for="Yes"> <input type="radio" name="Question1" value="Yes" validate = "required:true" /> Yes </label> <label for="No"> <input type="radio" name="Question1" value="No" /> No </label> <label for="Question1" class="error">You must answer this question to proceed</label> </td> <td width="64%" valign="top" class="field_data"><strong>Details:</strong> <textarea id = "Details1" class="where" name="Details1" cols="25" rows="2"></textarea></td> </tr> <tr> <td valign="top" class="field_name_left">Question 2</td> <td valign="top" class="field_data"> <label for="Yes"> <input type="radio" name="Question2" value="Yes" validate = "required:true" /> Yes </label> <label for="No"> <input type="radio" name="Question2" value="No" /> No </label> <label for="Question2" class="error">You must answer this question to proceed</label> </td> <td valign="top" class="field_data"><strong>Details:</strong> <textarea id = "Details2" class="where" name="Details2" cols="25" rows="2"></textarea> </td> </tr> <tr class="submit_btn"> <td colspan="3"> <input type="submit" name="-edit" value="Finish"> <input type="reset" name="reset" value="Reset"> </td> </tr> </table> </form> </div> </body> </html>

    Read the article

  • conditional update records mysql query

    - by Shakti Singh
    Hi, Is there any single msql query which can update customer DOB? I want to update the DOB of those customers which have DOB greater than current date. example:- if a customer have dob 2034 update it to 1934 , if have 2068 updated with 1968. There was a bug in my system if you enter date less than 1970 it was storing it as 2070. The bug is solved now but what about the customers which have wrong DOB. So I have to update their DOB. All customers are stored in customer_entity table and the entity_id is the customer_id Details is as follows:- desc customer_entity -> ; +------------------+----------------------+------+-----+---------------------+----------------+ | Field | Type | Null | Key | Default | Extra | +------------------+----------------------+------+-----+---------------------+----------------+ | entity_id | int(10) unsigned | NO | PRI | NULL | auto_increment | | entity_type_id | smallint(8) unsigned | NO | MUL | 0 | | | attribute_set_id | smallint(5) unsigned | NO | | 0 | | | website_id | smallint(5) unsigned | YES | MUL | NULL | | | email | varchar(255) | NO | MUL | | | | group_id | smallint(3) unsigned | NO | | 0 | | | increment_id | varchar(50) | NO | | | | | store_id | smallint(5) unsigned | YES | MUL | 0 | | | created_at | datetime | NO | | 0000-00-00 00:00:00 | | | updated_at | datetime | NO | | 0000-00-00 00:00:00 | | | is_active | tinyint(1) unsigned | NO | | 1 | | +------------------+----------------------+------+-----+---------------------+----------------+ 11 rows in set (0.00 sec) And the DOB is stored in the customer_entity_datetime table the column value contain the DOB. but in this table values of all other attribute are also stored such as fname,lname etc. So the attribute_id with value 11 is DOB attribute. mysql> desc customer_entity_datetime; +----------------+----------------------+------+-----+---------------------+----------------+ | Field | Type | Null | Key | Default | Extra | +----------------+----------------------+------+-----+---------------------+----------------+ | value_id | int(11) | NO | PRI | NULL | auto_increment | | entity_type_id | smallint(8) unsigned | NO | MUL | 0 | | | attribute_id | smallint(5) unsigned | NO | MUL | 0 | | | entity_id | int(10) unsigned | NO | MUL | 0 | | | value | datetime | NO | | 0000-00-00 00:00:00 | | +----------------+----------------------+------+-----+---------------------+----------------+ 5 rows in set (0.01 sec) Thanks.

    Read the article

  • Conditional XAML

    - by Nicholas
    For easy of development I'm using a ViewBox to wrap all content inside a Window. This is because my development machine has a smaller screen than the deployment machine so using a ViewBox allows for better realisation of proportion. Obviously there is no reason for it to be there on Release versions of the code. Is there an easy method to conditionally include/exclude that 'wrapping' ViewBox in XAML? E.g. <Window> <Viewbox> <UserControl /*Content*/> </Viewbox> </Window>

    Read the article

  • What does MSSQL execution plan show?

    - by tim
    There is the following code: declare @XmlData xml = '<Locations> <Location rid="1"/> </Locations>' declare @LocationList table (RID char(32)); insert into @LocationList(RID) select Location.RID.value('@rid','CHAR(32)') from @XmlData.nodes('/Locations/Location') Location(RID) insert into @LocationList(RID) select A2RID from tblCdbA2 Table tblCdbA2 has 172810 rows. I have executed the batch in SSMS with “Include Actual execution plan “ and having Profiler running. The plan shows that the first query cost is 88% relative to the batch and the second is 12%, but the profiler says that durations of the first and second query are 17ms and 210 ms respectively, the overall time is 229, which is not 12 and 88.. What is going on? Is there a way how I can determine in the execution plan which is the slowest part of the query?

    Read the article

  • iphone sdk conditional in switch function

    - by Oliver
    I'm trying to make a random image appear on the press of a button. So it generates a random number, and the switch algorithm swaps the chosen image with the one in the imgview. but I want a switch in the settings app to toggle which set of images to use. I know pretty much how to do it...it's just that it doesn't work. I'm missing some syntax thing...Please help, stackoverflow? it's my birthday. int Number = rand() %30; NSString *toggleValue = [[NSUserDefaults standardUserDefaults] stringForKey:@"enabled_preference"]; switch (Number) { if (*toggleValue == 0) { case 0: picture.image = [UIImage imageNamed:@"1.png"]; break; case 1: picture.image = [UIImage imageNamed:@"2.png"]; break;} else { case 0: picture.image = [UIImage imageNamed:@"3.png"]; break; case 1: picture.image = [UIImage imageNamed:@"4.png"]; break;} }

    Read the article

  • Javascript for conditional URL append or redirect based on window.location.href

    - by Wintermute
    ::Hi all:: I am trying to make a bookmarklet that when clicked will check the URL of the current tab\window to see if it contains 'char1' and\or 'char2' (a given character). If both chars are present it redirects to another URL, for the other two it will append the current URL respectively. I believe there must be a more elegant way of stating this than the following (which has so far worked perfectly for me) but I don't have great knowledge of Javascript. My (unwieldy & repetitive) working code (apologies): if (window.location.href.indexOf('char1')!=-1 && window.location.href.indexOf('char2')!=-1) {window.location="https://website.com/";} else if (window.location.href.indexOf('char1')!=-1) {window.location.assign(window.location.href+='append1');} else if (window.location.href.indexOf('char2')!=-1) {window.location.assign(window.location.href+='append2');} Does exactly what I need it to but, well... not very graceful to say the least. Is there a simpler way to do this, perhaps with vars or a pseudo-object? Or better code :D

    Read the article

  • PHP: Coding long-running scripts when servers impose an execution time limit

    - by thomasrutter
    FastCGI servers, for example, impose an execution time limit on PHP scripts which cannot be altered using set_time_limit() in PHP. IIS does this too I believe. I wrote an import script for a PHP application that works well under mod_php but fails under FastCGI (mod_fcgid) because the script is killed after a certain number of seconds. I don't yet know of a way of detecting what your time limit is in this case, and haven't decided how I'm going to get around it. Doing it in small chunks with redirects seems like one kludge, but how? What techniques would you use when coding a long-running task such as an import or export task, where an individual PHP script may be terminated by the server after a certain number of seconds? Please assume you're creating a portable script, so you don't necessarily know whether PHP will eventually be run under mod_php, FastCGI or IIS or whether a maximum execution time is enforced at the server level.

    Read the article

  • What does SQL Server execution plan show?

    - by tim
    There is the following code: declare @XmlData xml = '<Locations> <Location rid="1"/> </Locations>' declare @LocationList table (RID char(32)); insert into @LocationList(RID) select Location.RID.value('@rid','CHAR(32)') from @XmlData.nodes('/Locations/Location') Location(RID) insert into @LocationList(RID) select A2RID from tblCdbA2 Table tblCdbA2 has 172810 rows. I have executed the batch in SSMS with “Include Actual execution plan “ and having Profiler running. The plan shows that the first query cost is 88% relative to the batch and the second is 12%, but the profiler says that durations of the first and second query are 17ms and 210 ms respectively, the overall time is 229, which is not 12 and 88.. What is going on? Is there a way how I can determine in the execution plan which is the slowest part of the query?

    Read the article

  • PHP conditional loop help

    - by sea_1987
    Hi there in my database I have 3 columns, is_contract, is_permenant and is_temporary. Within these columns there is either a Y or N value. I am using these columns to echo onto the page what kind of work someone is looking for, my problem is that the user can be looking for more than one type of work, I am currently running 3 if statements to determine what to echo to the page, however I am struggling to add a comma if more than one of the statemnts returns as true, below is my code so far, <?php if($rslt['is_contract'] == 'Y') { echo "Contract "; } if($rslt['is_permanent'] == 'Y') { echo "Permanent "; } if($rslt['is_temporary'] == 'Y') { echo "Temporary"; } ?>

    Read the article

  • Need help with a conditional SELECT statement

    - by Ethan
    I've got a stored procedure with a select statement, like this: `SELECT author_ID, author_name, author_bio FROM Authors WHERE author_ID in (SELECT author_ID from Books) ` This limits results to authors who have book records. This is the Books table: Books book_ID INT author_ID INT book_title NVARCHAR featured_book BIT What I want to do is conditionally select the ID of the featured book by each author as part of the select statement above, and if none of the books for a given author are featured, select the ID of the first (top 1) book by the author from the books table. How do I approach this?

    Read the article

  • Optimize conditional operators branching in C#

    - by abatishchev
    Hello. I have next code: return this.AllowChooseAny.Value ? radioSpecific.Checked ? UserManager.CurrentUser.IsClient ? txtSubject.Text : subjectDropDownList.SelectedItem.Text : String.Empty : UserManager.CurrentUser.IsClient ? txtSubject.Text : subjectDropDownList.SelectedItem.Text; or in less complex form: return any ? specified ? isClient ? textbox : dropdown : empty : isClient ? textbox : dropdown; or in schematic form: | any / \ specified isClient / \ / \ isClient empty textbox dropdown / \ textbox dropdown Evidently I have a duplicated block on two different levels. Is it possible to optimize this code to probably split them to one? Or something like that..

    Read the article

  • Conditional operator in if-statement?

    - by Pindatjuh
    I've written the following if-statement in Java: if(methodName.equals("set" + this.name) || isBoolean() ? methodName.equals("is" + this.name) : methodName.equals("get" + this.name)) { ... } Is this a good practice to write such expressions in if, to separate state from condition? And can this expression be simplified?

    Read the article

  • How does this If conditional work in Python?

    - by Sergio Boombastic
    from google.appengine.api import users from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app class MainPage(webapp.RequestHandler): def get(self): user = users.get_current_user() if user: self.response.headers['Content-Type'] = 'text/plain' self.response.out.write('Hello, ' + user.nickname()) else: self.redirect(users.create_login_url(self.request.uri)) application = webapp.WSGIApplication( [('/', MainPage)], debug=True) def main(): run_wsgi_app(application) if __name__ == "__main__": main() I don't understand how this line works: if user: self.response.headers['Content-Type'] = 'text/plain' self.response.out.write('Hello, ' + user.nickname()) else: self.redirect(users.create_login_url(self.request.uri)) I'm guessing the users.get_current_user() return a boolean? Then, if that is the case how can it get a .nickname() method? Thanks for the guidance.

    Read the article

  • Inline Conditional Statement in Stored Procedure

    - by Jason
    Here is the pseudo-code for my inline query in my code: select columnOne from myTable where columnOne = '#variableOne#' if len(variableTwo) gt 0 and columnTwo = '#variableTwo#' end I would like to move this into a stored procedure but am having trouble building the query correctly. I assume it would be something like select columnOne from myTable where columnOne = @variableOne CASE WHEN len(@variableTwo) <> 0 THEN and columnTwo = @variableTwo END This is giving me a syntax error. Could someone tell me what I've got wrong. Also, I would like to keep it to only one query and not just have one if statement. Also, I do not want to build the sql in the stored procedure and run Exec() on it.

    Read the article

  • .NET Conditional Callback on a type.

    - by Mahesh
    I have a stock price which changes by nature all the time. And, there will be many users who wants to buy that stock. Let's say that the stock price is started at 10 and let's say, 30 people bid for 10.98, 20 people bid for 7.45, 100 people bid for 8.99. During the day, the stock price can touch any of these values, and if that happens, I want to execute all the orders for users who quoted that price. Technically, I am storing in a List. Whenever the price changes, I am checking against all the values in the list and executing those that satisfy the quoted price. Class Bids { string stockname; double quote; } Is there any better alternative way to callback the satisfied items in the list rather than checking all the items whenever there is a change?? If storing in a list is not right way of doing it, let me know the best way.

    Read the article

  • Basic Conditional Checking for IF statements in C

    - by ZaZu
    Hi there, Can someone please explain what really goes on in this code ? If I put the AND statement, the message wont show if values are less than 0 or greater than 10 ... I think I must use 1 0 logic to work this out right ? I just need someone to briefly explain it please. #include<stdio.h> main(){ puts("enter number"); scanf("%d",num); if(num<0 || num >10) puts("yay"); } How is that IF statement different when AND is put : #include<stdio.h> main(){ puts("enter number"); scanf("%d",num); if(num<0 && num >10) puts("yay"); } Thanks !!

    Read the article

  • Impromptu conditional display of dtpicker

    - by pritisolanki
    Hi, I have two checkbox on prompt box i.e If user click yes I have to show dtpicker and user click no hidden the dtpicker. I tried following $('#yes').click(function(){$('#dtpickerdiv').css("display","block");}); but the hidden div doesn't appear on prompt box? I tried alerting following alert -$(‘#dtpickerdiv’).css(“display”) : This alert “undefined” alert – $(‘#dtpickerdiv’)) : “object object Any idea how to resolve this? Regards, Priti

    Read the article

  • Display data FROM Sheet1 on Sheet2 based on conditional value

    - by Shawn
    Imagine a worksheet with 30 pieces of information, such as: A1= Start Date A2 = End Date A3 = Resource Name A4 = Cost .... A30 = Whatever B1 = 1/1/2010 B2 = 2/15/2010 B3 = Joe Smith B4 = $10,000.00 ... B30 = Blah Blah Now imagine a third column, C. The purpose of the third column is to determine WHICH report that row of data needs to appear in. C1 = Report 1 C2 = Report 1 and Report 2 C3 = Report 4 and Report 7 C4 = Report 1 and Report 5 ... C30 = Report 2 Each report is on Sheets 2, 3, 4, 5 and so on (depending on how many I decide to create). As you can see form my example above, some data may need to appear in multiple reports. For example, the data in Row 3 (Resource Name: Joe Smith) needs to appear in Report 4 and Report 7. That is to say, it needs to DYNAMICALLY appear on two additional worksheets. If I change the values in column C, then the reports need to update automatically. How can I create the worksheets which will serve as the reports such that they only diaplay the rows which have been "flagged" to be displayed in that report? Thanks!

    Read the article

  • c++ simple conditional logging

    - by Sunny
    Disclaimer: I'm not a c++ developer, I can only do basic things. (I understand pointers, just my knowledge is so rusty, I haven't touch c/c++ for about 20 years :) ) The setup: I have an Outlook addin, written in C#/.Net 1.1. It uses a c++ shim to load. Usually, this works pretty well, and I use in my c# code nlog for logging purposes. But sometimes, the addin fails to load, i.t. it does not hit the managed code at all for me to be able to investigate the problem from the log files. So, I need to hook some basic logging into the c++ shim - just writing in a file. I need to make it as simple as possible for our users to enable. Actually I would prefer not to ship it by default. I was thinking about something, which will check if a specific dll is present (the logging dll), and if so, to use it. Otherwise, it will just not log anything. That way, when I have a user with such a problems, I can send him only the logging dll, the user will save it in the runtime directory, and I'll have the file. I guess this have to be done with some form a factory solution, which returns either a dummy logger, or if the dll is found, a real one. Another option would be to make some simple logger, and rebuild the shim with or w/o using it, based on directives. This is not the desirable approach, because the shim needs to be signed, and I have to instruct the user to make a backup copy of the "real" one, then restore when done, etc., instead of just saving and deleting a dll. I'd appreciate any good suggestion how to approach it, together with links or sample code how to go after this. Cheers

    Read the article

  • Conditional Counting in Mathematica

    - by 500
    Considering the following list : dalist = {{1, a, 1}, {2, s, 0}, {1, d, 0}, {2, f, 0}, {1, g, 1}} I would like to count the number of times a certain value in the first column takes a certain value in column 3. So in this example my desired output would be: {{1,1,2}, {1,0,1}, {2,1,0}, {2,0,2}} Where the latest sublist {2,0,2} being read as: When the value is 2 in the first column, a corresponding value (same row in matrices world) in column 3 of 0 is present twice. I hope this is not to confusing. I added the second Column to convey the fact that the columns are distant to each other. If possible, no reordering should happen. EDIT : {1,2,3,4,5} {1,0} are the exact values taken by the columns I am actually dealing with in my data. I know I am missing the correct description. Please edit if you can and know it. Thank you

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >