Code that handles a condition (normally an error condition) triggered when an event fails to occur within a predefined time limit. For discussing inefficient code that takes an unreasonable amount of time to finish, use the [time-limit-exceeded] tag instead.

learn more… | top users | synonyms

3
votes
1answer
64 views

Blow the fuse if threshold exceeded

While implementing the Retry & Breaker patterns I decided that the Breaker does more then it should so I extracted two responsibilities into their own classes. Here they are. I stripped out the <...
-3
votes
1answer
49 views

Example of Callback Hell [closed]

I am trying to come up with a minimal example of what is known as callback hell in JavaScript (so this would be a bad code review I guess). This is what I have so far, and I would like it to also run ...
1
vote
1answer
43 views

TLE in APS - Amazing Prime Sequence in Python at Spoj

This series is similar to Fibonacci Series defined as : a[0] = a[1] = 0 and For n > 1, a[n] = a[n - 1] + f(n), where f(n) is ...
2
votes
1answer
49 views

Exponential backoff generator

Exponential backoff in the context of various networking protocols looks something like this: When a collision first occurs, send a “Jamming signal” to prevent further data being sent. ...
3
votes
1answer
133 views

Handling GetTickCount() overflow in timeouts

This is code which must run on XP, so no GetTickCount64, and which should correctly handle the value wrapping around after 49 days. Can it be improved? ...
0
votes
0answers
27 views

Generic Timeout Handler

In a frontend Javascript project I have to implement a generic timeout mechanism for a set of asynchronous tasks that the program needs to perform. These are the conditions: The tasks are functions ...
1
vote
1answer
207 views

Decorating a timeout function

I've picked up the timeout-function below from ActiveState's recipes for Python2 and polished it for python3.4. Is there any leaner, less clunky way to write it? ...
3
votes
2answers
2k views

Async task with timeout

I am calling a service outside of my control. My application must include a time out, so that if the call to the service takes too long, an appropriate time-out message is returned. ...
4
votes
2answers
155 views

Window timeout alert

How can I improve this window timeout alert code? I need to add it to some third-party master page and don't want to add a separate file for it. It must be JS only and IE-8 supported. jsFiddle <...
3
votes
1answer
1k views

Controlling a Windows Service from a WPF app

I have a WPF Control Panel app, where I'm trying to stay close to an MVVM architecture. The control panel (the "the CP") is for a WCF service ("the Scheduler"), hosted in a Windows Service ("the Host")...
7
votes
1answer
605 views

Batch script to start the service in a gap of 10 min

I have created a batch script to start the services in a gap of 10 min. My batch file will start the service on the local system and then will wait for 10 mins and starts the service on another system ...
1
vote
1answer
157 views

Screen timeout/lock script

This is a script I made while having trouble with xautolock and dimming of the screen right before locking it. I would like some tips for making it a bit more robust and to know of any disadvantages ...
8
votes
1answer
3k views

Web service proxy that switches endpoint URLs in the event of a TimeoutException

I am creating a service (FaultTolerantCommunication) that wraps a call to a (web) service. Its responsibility is to switch the endpoint URL in the event of a ...
10
votes
5answers
32k views

Reading from a serial port

I'm receiving data from a serial port in C, using Serial Programming Guide for POSIX Operating Systems as a guide. The data I receive should be always 10 bytes in length but I want to be sure that, ...
1
vote
1answer
86 views

Node.JS HTTP server displaying Google

I'm reading Professional Node.js: Building Javascript Based Scalable Software by Pedro Teixeira and created a web page responding with www.google.de. Could you take a look at my code and let me know ...
8
votes
1answer
4k views

QNetworkReply network reply timeout helper

Since Qt still does not support to set timeouts on QNetworkRequest objects, I wrote this little wrapper class: ...
3
votes
1answer
2k views

JavaScript “recursion” via setTimeout

I understand that because of JavaScript's single-threaded execution, long loops or recursive calls could make the browser unresponsive while they execute. I thought about simulating recursion using <...
12
votes
3answers
5k views

Timing out a method

I have created this extension method that can be used to run a function with a timeout applied to it. Is this a sensible way of doing it? ...
3
votes
1answer
1k views

Time Limit decorator

I have an interface named ICodeRunner, defined like this: ...
7
votes
1answer
554 views
17
votes
3answers
16k views

Determining if a connection has been made to a communications device

I am unsure if my use of Monitor.Wait and Monitor.Pulse is correct. It seems to work alright, but there is a nagging doubt I am ...