wait

sh screen - Wait for screen to terminate

本秂侑毒 提交于 2019-12-01 05:04:22
问题 I'm writing on a little script that does send a command to a running screen session. This command stops the screen but not instantly. I need to wait for it to finish in order to continue with the rest of the script. This is how I stop the screen: screen -S $SCREEN_NAME -p 0 -X stuff "`printf "stop\r"`" How could I do this? 回答1: I found an solution: You just simply check if the screen is still running and wait ( sleep ) for one second. Like this: while screen -list | grep -q $SCREEN_NAME do

Selenium wait.until to check ajax request finished is throw error

孤者浪人 提交于 2019-12-01 03:57:55
in selenium Webdriver with Python, i want to wait for an Ajax request to completed(jquery library). i use wait.until() function of Selenium. Ajax request is start after click on submitJquery button. wait.until(self.driver.execute_script("return jQuery.active == 0")) but i got following error: E ====================================================================== ERROR: test_MahsumAkbasNet_Pass (__main__.TestClass) ---------------------------------------------------------------------- Traceback (most recent call last): File "D:\xxx\src\unittestpackage\JavaScriptExec.py", line 24, in test

Python time.sleep vs busy wait accuracy

ⅰ亾dé卋堺 提交于 2019-12-01 03:52:41
I was playing around with the time.sleep function from python's standard library and found it inadequate for sub-ms delays. From testing I found it to actually wait 1.1-1.2 ms for a 1ms wait. Implementing a busy wait got the accuracy to within 1%. I used: def busy_wait(dt): current_time = time.time() while (time.time() < current_time+dt): pass and could get down to 0.0001 seconds before breaking 1% accuracy. The main questions I have are: Why is the sleep function so inaccurate (possibly a C issue)? Will getting a better CPU with a higher clock speed change this? Why would anyone use sleep?

wait for each jQuery

心不动则不痛 提交于 2019-12-01 03:51:29
I'm trying to make a div fade in/out that's within an each statement. The problem is that next item is called before the fade in/out is complete. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js" type="text/javascript"></script> <div id='one'>one</div> <div id='two'>two</div> <div id='three'>three</div> <script> $.each([ "one", "two", "three"], function() { console.log( 'start - ' + this ); animate( this ); console.log( 'end - ' + this ); }); function animate( id ) { box = '#' + id; $(box).fadeOut( 500, function( ) { console.log('showing - ' + id); $(box).fadeIn(

How to pause for 5 seconds before drawing the next thing on Android?

喜欢而已 提交于 2019-12-01 03:43:56
问题 Say I want to draw a line, then wait five seconds, then draw another line. I have a method like this: public void onDraw(Canvas canvas) { int w = canvas.getWidth(); int h = canvas.getHeight(); canvas.drawLine(w/2, 0, w/2, h-1, paint); // PAUSE FIVE SECONDS canvas.drawLine(0, h/2, w-1, h/2, paint); } How do I pause? 回答1: Don't wait in onDraw method it's called in the UI thread and you'll block it. Use flags to handle which line will be drawn boolean shouldDrawSecondLine = false; public void

Using Task.wait() application hangs and never returns

▼魔方 西西 提交于 2019-12-01 03:25:51
I am new to C# and using Task . I was trying to run this application but my application hangs every time. When I am adding task.wait() , it keeps waiting and never returns. Any help is much appreciated. EDIT: I want to call DownloadString Asynchronously. And when I am doing task.Start() as suggested by "Austin Salonen" I don't get the address of location but default value in location string from returnVal. It means that location got value assigned before task got completed. How can I make sure that after task is completed only then location gets assigned returnVal. public class

Start-Process -wait doesn't work when script is launched from command prompt opened with runas or as a scheduled task

最后都变了- 提交于 2019-12-01 03:25:21
I've got a script that's I want to run as a scheduled task, but it's not doing the thing it's supposed to. I'm trying to call an executable with Start-Process and the -Wait switch before continuing. Line is Start-Process -FilePath "C:\Pfx Engagement\Admin\Utilities\Backup Restore\BackupRestoreUtil.exe" -ArgumentList "/f "$backup_directory "" -Wait If I call it from a command prompt, ie: powershell .\script.ps1 it works. It runs the command and waits for it to finish before moving on. There's more to the script that has to be run after that command is finished. The problem is that when it's a

make PHP wait until a function completes?

最后都变了- 提交于 2019-12-01 03:15:42
问题 Is there any way to make PHP wait until a function returns before continuing? This is my code: <?php set_time_limit(0); function waitforchange($nof) { $lfilemod=filemtime($nof); while(filemtime($nof) == $lfilemod) { clearstatcache(); usleep(10000); } } waitforchange('./blahblah.txt') sleep(5); echo 'done'; ?> It is supposed to wait until blahblah.txt changes, wait another five seconds after that, then print out "done", however, it prints out "done" after five seconds, regardless whether the

Java Threads waiting value

£可爱£侵袭症+ 提交于 2019-12-01 02:11:42
I have the following situation: In order to run a algorithm, i must run several threads and each thread will set a instance variable x, right before it dies. The problem is that these threads dont return immediately: public Foo myAlgorithm() { //create n Runnables (n is big) //start these runnables (may take long time do die) //i need the x value of each runnable here, but they havent finished yet! //get average x from all the runnables return new Foo(averageX); } Should i use wait notify ? Or should i just embed a while loop and check for termination ? Thanks everyone! Create some shared

Selenium wait.until to check ajax request finished is throw error

最后都变了- 提交于 2019-12-01 00:27:37
问题 in selenium Webdriver with Python, i want to wait for an Ajax request to completed(jquery library). i use wait.until() function of Selenium. Ajax request is start after click on submitJquery button. wait.until(self.driver.execute_script("return jQuery.active == 0")) but i got following error: E ====================================================================== ERROR: test_MahsumAkbasNet_Pass (__main__.TestClass) ----------------------------------------------------------------------