timer

C# timer issue

Hello I'm currently having an issue with a timer in a program I'm developing. The timer runs and calls methods which retrieve Windows Management Information from remote PC's after a set period of time and repeat this. The first time the timer calls these all is well, however the second time, after the timer has completed its task, it lo...

Threads, subprocess & zombies

Hi, I need to launch several remote jobs each at a precise moment using threads and SSH. So I write: def dojob(hostname): command = "echo Done" p = Popen(['ssh','%s@%s' % (user, hostname), command], stdout=PIPE, shell=False) output = p.communicate()[0].strip() print output [...] fire_starter = [Timer(t, dojob, [y]) f...

Why does my setTimeout speed up when I have multiple tabs open to my site?

I have a timer that counts down every second. It works great until the user opens up 3 or 4 tabs of the my site, at which point the newest tab's timer goes double or triple speed. I can currently only reproduce the bug in IE8. I was previously using setInterval, and could reproduce the bug in Firefox as well. I'm actually using FBJS (...

Winforms Timer for Dummies

I'm trying to get a timer to tick once a second in a winform, when I look for advice on how to do this I find loads of stuff about threads. Well I don't care about threads, because all I'm trying to do is make a value count down from 60 to 0 in one minute, then stop. I don't think we need to go into cloud computing to solve this one, but...

Timer Interrupt Service Routine on a host computer running at a rate of 10 microseconds or faster

I am trying to run the following pseudocode at a rate of 10 microseconds or faster on a host computer (512 mb RAM, Intel 2.5 GHz Pentium 4 processor, etc.) running on a Windows XP operating system: int main(void) { while(1){}; } Interrupt service routine: every 10 microseconds, printf("Hello World"); I'm aware that there are MFC ...

Is KillTimer necessary?

Hi All! I use SetTimer API and I see a lot of code like this: case WM_DESTROY: // Destroy the timer. KillTimer(hwnd, IDT_TIMER); PostQuitMessage(0); break; Do I have to call KillTimer or the system will automatically free resources on the process exit? Does forgetting to call KillTimer lead to resource leaks? I u...

Windows 2003 Service and Timer issues causing Tick not to be called?

Hi there, Having a few problems with Timers within a service on Win2k3... Basically, creating a service that every X minutes/seconds, checks for a certain process and whether it is running. I figured the easiest way to get this done was via a Timer, and so I coded all that in, and it seemed to be working OK. Have managed to install the...

Code for a simple JavaScript countdown timer?

I want to use a simple countdown timer starting at 30 seconds from when the function is run and ending at 0. No milliseconds. How can it be coded? ...

C++ Timers in Unix

We have an API that handles event timers. This API says that it uses OS callbacks to handle timed events (using select(), apparently). The api claims this order of execution as well: readable events writable events timer events This works by creating a point to a Timer object, but passing the create function a function callback: Some...

Accessing main thread from a Timers.Timer in .NET

Hi there, I have a Timer that monitors certain conditions (like if a Process is running) and when those conditions are met I must create a hook (SetWinEventHook). The problem is that the hook must be created on the main thread, otherwise my callback doesn't return. How to do that? I've tried everything, and the only way that this worked...

Is Java's Timer task guarenteed not to run concurrently?

new Timer(...).schedule(task) Is task guaranteed to be run by a single thread at any given time? ...

Excel mouse focus weirdness

I have a class based on CSocket in a DLL which has various threaded buffers for holding the incoming stream. I have a couple of applications with which this works perfectly, using a timer to poll the buffer to see if anything is there to be pulled out and then displayed. Now I've got the timer in some VBA code, a macro if you will, in a...

Hide the WinForms cursor 'persistently'?

Hi, I am developing a full-screen application which contains some animated Forms controls (basically, labels which move). I want to hide the cursor after a period of inactivity, and I have tried using the method given in this thread: http://stackoverflow.com/questions/744980/hide-mouse-cursor-after-an-idle-time While this works in a s...

Timer accuracy in java

I'm timing some things, which I can't just put in a long loop. And I need to time them to see how long they take to complete, but it seems like the timer has a 15-16 ms accuracy in java? How can i get around this? ...

python: slow timeit() function

When I run the code below outside of timeit(), it appears to complete instantaneously. However when I run it within the timeit() function, it takes much longer. Why? >>> import timeit >>> t = timeit.Timer("3**4**5") >>> t.timeit() 16.55522028637718 Using: Python 3.1 (x86) - AMD Athlon 64 X2 - WinXP (32 bit) ...

asp.net trigger events on the server at intervals

Hi, I'm building a site that runs on a timed competition. Every n amount of hours, the competition ends. Where would I put code that runs on a timed interval? I was thinking of checking each time a page request is made, but I was looking for another way. Thanks for your time. ...

Asynchronous HttpWebRequest Issue with Timer

The situation: I was using HttpWebRequest.BeginGetResponse as documented in msdn. I had a timer sending the request every ten seconds. I received xml-structured information, when I tested it. The result: Being at the customers place and having that tool running I received incomplete (and therefore unparsable) xmls (each about 4KB). I c...

Mutiple client webrequests - object structure approach needed (edited)

I'm seeking for a approach for the following problem: I'm doing gps tracking. The data is being provided over http post requests by a gps data provider. The application should handle about one hundred trackings and poll each position max every second. My approach so far: Out of a collection every object sets off async web requests trig...

boost timer binding

Hi, I'm trying to set up a timer using the boost library. Basically, this is what I wrote: class ContactList { public: ContactList(); virtual ~ContactList(); int Start(); int readFromFile(); int dumpList(); void checkContacts(const boost::system::error_code& error); void initializeTimer(); private: std...

CListCtrl WM_TIMER event ids 42 and 43?

I have a CListCtrl derived class that provides subitem editing by creating a CEdit starting at the correct offset of the subitem. Sometimes the subitem is only partially visible so I scroll the CListCtrl to the offset location to gain more space for the CEdit. Now something very weird happens: On Windows Vista and Windows 7 the CListCtr...