Wait some seconds without blocking UI execution

I think what you are after is Task.Delay. This doesn’t block the thread like Sleep does and it means you can do this using a single thread using the async programming model. async Task PutTaskDelay() { await Task.Delay(5000); } private async void btnTaskDelay_Click(object sender, EventArgs e) { await PutTaskDelay(); MessageBox.Show(“I am back”); }

Sleep until a specific time/date

As mentioned by Outlaw Programmer, I think the solution is just to sleep for the correct number of seconds. To do this in bash, do the following: current_epoch=$(date +%s) target_epoch=$(date -d ’01/01/2010 12:00′ +%s) sleep_seconds=$(( $target_epoch – $current_epoch )) sleep $sleep_seconds To add precision down to nanoseconds (effectively more around milliseconds) use e.g. this syntax: … Read more

Excel vba refresh wait

I was working with a PowerPivot model, and I wanted to Refresh the data before I saved and closed the Model. However, excel just closed the model before the refresh was complete, and the model resumed refreshing on opening. Adding the following line right after the RefreshAll method, did the trick: ThisWorkbook.RefreshAll Application.CalculateUntilAsyncQueriesDone I hope … Read more

How to wait for a keypress in R?

As someone already wrote in a comment, you don’t have to use the cat before readline(). Simply write: readline(prompt=”Press [enter] to continue”) If you don’t want to assign it to a variable and don’t want a return printed in the console, wrap the readline() in an invisible(): invisible(readline(prompt=”Press [enter] to continue”))

How to wait until an element is present in Selenium?

You need to call ignoring with exception to ignore while the WebDriver will wait. FluentWait<WebDriver> fluentWait = new FluentWait<>(driver) .withTimeout(30, TimeUnit.SECONDS) .pollingEvery(200, TimeUnit.MILLISECONDS) .ignoring(NoSuchElementException.class); See the documentation of FluentWait for more info. But beware that this condition is already implemented in ExpectedConditions so you should use WebElement element = (new WebDriverWait(driver, 10)) .until(ExpectedConditions.elementToBeClickable(By.id(“someid”))); *Update for … Read more

How do I wait for a pressed key?

In Python 3, use input(): input(“Press Enter to continue…”) In Python 2, use raw_input(): raw_input(“Press Enter to continue…”) This only waits for the user to press enter though. On Windows/DOS, one might want to use msvcrt. The msvcrt module gives you access to a number of functions in the Microsoft Visual C/C++ Runtime Library (MSVCRT): … Read more

Is there a decent wait function in C++?

you can require the user to hit enter before closing the program… something like this works. #include <iostream> int main() { std::cout << “Hello, World\n”; std::cin.ignore(); return 0; } The cin reads in user input, and the .ignore() function of cin tells the program to just ignore the input. The program will continue once the … Read more