wait

jQuery - Wait till end of SlideUp()

懵懂的女人 提交于 2019-12-29 07:22:08
问题 How can I wait till the end of the jQuery function slideUp() before continuing the script? <script type="text/javascript"> $(document).ready(function() { $("div[class=item]").click(function() { var id = $(this).attr("id"); $("#content").slideUp(); switch(id) { // Applications case "rampro": $("#content").css("text-align", "left"); $("#content").load("inc/pages/rampro.html"); $("#content").slideDown(); break case "diskman": $("#content").css("text-align", "left"); $("#content").load("inc/pages

I need a slow C# function

非 Y 不嫁゛ 提交于 2019-12-28 05:37:28
问题 For some testing I'm doing I need a C# function that takes around 10 seconds to execute. It will be called from an ASPX page, but I need the function to eat up CPU time on the server, not rendering time. A slow query into the Northwinds database would work, or some very slow calculations. Any ideas? 回答1: Try to calculate nth prime number to simulate CPU intensive work - public void Slow() { long nthPrime = FindPrimeNumber(1000); //set higher value for more time } public long FindPrimeNumber

What is the internal working difference between Implicit Wait and Explicit Wait

独自空忆成欢 提交于 2019-12-28 04:34:06
问题 Explicit wait example WebDriverWait wait = new WebDriverWait(driver, 10); WebElement myDynamicElement= wait.until(ExpectedConditions.elementToBeClickable(By.id("someid"))); Implicit wait example WebDriver driver = new FirefoxDriver(); driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); driver.get("http://somedomain/url_that_delays_loading"); WebElement myDynamicElement = driver.findElement(By.id("myDynamicElement")); Let say myDynamicElement is visible at 6th second, So in both

Java threads: wait and notify methods

倖福魔咒の 提交于 2019-12-28 04:28:11
问题 I have a thread that calls the wait method and can only be awoken when the notify method called from some other class: class ThreadA { public static void main(String [] args) { ThreadB b = new ThreadB(); b.start(); synchronized(b) { try { System.out.println("Waiting for b to complete..."); b.wait(); } catch (InterruptedException e) {} System.out.println("Total is: " + b.total); } } } class ThreadB extends Thread { int total; public void run() { synchronized(this) { for(int i=0;i<100;i++) {

Sending one AJAX request at a time from a loop

ⅰ亾dé卋堺 提交于 2019-12-28 04:14:25
问题 I know this question has been asked countless times, but I cant figure out for the life of me how to make this answer work in my case: wait for async javascript function to return I'm looping through some "tv channels" in the outerloop and then looping through dates in the week in the innerloop. In the inner loop I make a ajax request to a server to fetch the data and I then store/cache it for later use like so var dates = []; //<-- Contains a list of dates for the coming week var baseUrl =

How can I make a program wait for a variable change in javascript?

自闭症网瘾萝莉.ら 提交于 2019-12-28 02:39:58
问题 I want to force a JavaScript program to wait in some particular points of its execution until a variable has changed. Is there a way to do it? I have already found an extension that is called "narrative JavaScript" that force the program to wait until an event to happen. Is there a way to create a new event, a "variable change event" for example that behaves like onclick event.. 回答1: Edit 2018: Please look into Object getters and setters and Proxies . Old answer below: a quick and easy

Java Wait for thread to finish

自作多情 提交于 2019-12-27 11:25:50
问题 I have a thread downloading data and I want to wait until the download is finished before I load the data. Is there a standard way of doing this? More Info: I have a Download class that gets data from a URL (Serialized POJOs). Download is Runnable and Observable. It keeps track of the bytes downloaded and download size. I have a progress bar that displays the progress to the User. The GUI observes Download to update the progress bar. When the POJO is downloaded I want to get it and move to

Java Wait for thread to finish

别说谁变了你拦得住时间么 提交于 2019-12-27 11:25:10
问题 I have a thread downloading data and I want to wait until the download is finished before I load the data. Is there a standard way of doing this? More Info: I have a Download class that gets data from a URL (Serialized POJOs). Download is Runnable and Observable. It keeps track of the bytes downloaded and download size. I have a progress bar that displays the progress to the User. The GUI observes Download to update the progress bar. When the POJO is downloaded I want to get it and move to

Repeatedly update contents of a list box while maintaining user control

荒凉一梦 提交于 2019-12-25 17:48:05
问题 In VBA, I am repeatedly updating the contents of a list box with the text of a steadily growing text file. Is there any way to let the user maintain control (scroll the list box, press a button) while the loop that I'm in to update the list box is running? An alternative to application.wait would also work; as in, update -> wait x seconds (where the user can still do stuff -> update again -> repeat. 回答1: Here's a start. In a regular module, paste this code: Sub ShowUserForm() UserForm1.Show

Python waiting error

吃可爱长大的小学妹 提交于 2019-12-25 16:46:13
问题 I tried to find a good code line for making python wait before executing the next code block, but nothing I found worked. Here is a sample of the code below: #This is the eighth Question. print "Q8. What is one of the main bosses in 'Super Smash Brothers Brawl' that is also a boss in 'Kirby the Amazing Mirror?'" print "1) Krazy hand." print "2) Mister hand." print "3) Ganondorf." print "4) Yoshi." choice = input("Answer=") if choice ==1: print "THAT IS INCORRECT! 'Krazy hand' is SUPPOSED to