timeout

Keyboard input with timeout?

做~自己de王妃 提交于 2019-12-11 01:51:22
问题 How would you prompt the user for some input but timing out after N seconds? Google is pointing to a mail thread about it at http://mail.python.org/pipermail/python-list/2006-January/533215.html but it seems not to work. The statement in which the timeout happens, no matter whether it is a sys.input.readline or timer.sleep() , I always get: <type 'exceptions.TypeError'>: [raw_]input expected at most 1 arguments, got 2 which somehow the except fails to catch. 回答1: The example you have linked

Timeout for blocking function call, i.e., how to stop waiting for user input after X seconds?

喜欢而已 提交于 2019-12-11 01:19:08
问题 When asking the user for input we need to call a blocking function, but I want to be able to "unblock" and resume after a specified timeout has elapsed (usually some seconds). How can I do this? std::string s; // blocking function call std::cin >> s; // how can I resume operation after timeout duration has elapsed? 回答1: You cannot do the way you dream, at least not in standard C++11 (using only standardized C++11 functions). You practically need some operating system support, and you

How to prevent Internet Explorer Connection Timeout?

无人久伴 提交于 2019-12-11 00:55:45
问题 If a website is taking more than 10 seconds to process and load of a page, Internet Explorer will do a connection timeout . It is possible for the user to prevent this by setting the default value in the registry to a higher value. But I really can't tell any of my clients to do this; so how do I prevent this to happen in the first place? I have always learned not to use a buffer and flush it, cause this will make the calculation of the data slower. Another problem with this, is that all the

MongoCursorException - Cursor not found (MongoDB PHP Driver)

江枫思渺然 提交于 2019-12-11 00:34:43
问题 Code : try { $documentsFind = $client->$db->$collection->find([ // query ]); if ($documentsFind) { foreach ($documentsFind as $product) { // code... } } catch (MongoCursorException $e) { echo "error message: ".$e->getMessage()."\n"; echo "error code: ".$e->getCode()."\n"; } Error : Fatal error: Uncaught MongoDB\Driver\Exception\RuntimeException: Cursor not found, cursor id: 31837896248 in ... It seems that the cursor does exist but times out? How can I prevent that from happening? Edited to

Handling timeout while using Ksoap2 in android

耗尽温柔 提交于 2019-12-10 23:57:08
问题 I am calling a method of another class from my activity that calls a webservice using ksoap2. I want to handle timeout for this. If the method takes more than 10 seconds to execute, then I need to show an alert dialog indicating that the process was not successful. I tried using the timeout value as follows: HttpsTransportSE transport = new HttpsTransportSE(URL,TIMEOUT); but ksoap2 is ignoring the timeout for some reason. I'm using ksoap2 2.6.5. Is there any way where in I can execute the

Why doesnt set_time_limit work as expected? [duplicate]

笑着哭i 提交于 2019-12-10 23:38:00
问题 This question already has answers here : Closed 8 years ago . Take a quick look at the following snippet: <? set_time_limit(5); sleep(30); echo 'done'; ?> When I execute this on my boxes, the script takes the full 30 seconds, and displays 'done'. Why? Shouldnt it terminate in 5 seconds and not give the script the time to display 'done'? This is NOT in CLI mode. Nginx + PHP_FPM. Any ideas? I have opted to put the 'answer' in here as there is quite a few GOOD and VALID answers below. But... It

NSURLConnection failure - 1003

喜欢而已 提交于 2019-12-10 23:19:07
问题 I try to retrive data from certain url with command: -(NSMutableData *) callUrl: (NSString *)url withData:(NSMutableDictionary *)data delegate:(id) delegate { NSURL *executeUrl = [NSURL URLWithString:<string>]; NSURLRequest *request = [NSURLRequest requestWithURL: executeUrl cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:60]; NSMutableData *receivedData = nil; NSURLConnection *theConnection=[[NSURLConnection alloc] initWithRequest:request delegate:delegate]; if

Timeout on a php Peg Puzzle solver

陌路散爱 提交于 2019-12-10 22:46:33
问题 first time here. I'm working on a Peg Puzzle php solver, using recursion. For small and simple boards, I get the desired results (the script solves the puzzle correctly), but for larger and full boards (i.e. all slots but one occupied) I get a php timeout. I need to get it to work with a 7x7 board, with the following layout: x x 1 1 1 x x x x 1 1 1 x x 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 x x 1 1 1 x x x x 1 1 1 x x Where 'x' is unusable, '1' is a slot with a peg and '0' is a free slot.

Strange timeout with PHP cURL and SSL

馋奶兔 提交于 2019-12-10 22:16:17
问题 I'm experiencing strange timeouts using cURL with PHP when trying to access Amazon Cloudfront. This seems to affect all invalidation requests, creating distributions etc. cURL either reports receiving 0 bytes, or very few bytes, and then time-out: Operation timed out after 120000 milliseconds with 88 out of 619 bytes received . Extending the timeout settings does not seem to make a difference. Putting a trace using CURLOPT_VERBOSE produces this output: * About to connect() to cloudfront

bash read timeout only for the first character entered by the user

柔情痞子 提交于 2019-12-10 21:53:07
问题 I have searched for a simple solution that will read user input with the following features: timeout after 10 seconds, if there is no user input at all the user has infinite time to finish his answer if the first character was typed within the first 10 sec. I have found a solution to a similar request (timeout after each typed character) on Linux Read - Timeout after x seconds *idle*. Still, this is not exactly the feature, I was looking for, so I have developed a two line solution as follows