timer

Timer on Wallpaper Cycler

I just added some extra functionality to a Coding4Fun project. I have my project set up with an extra option to allow it to automatically change the background after X amount of time. X is set from a ComboBox. However, I know I've done this in a terrible way, as I have created a new timer class with System.Timers.Timer as a parent so whe...

Android TextView Timer

For my Android application there is a timer that measures how much time has passed. Ever 100 milliseconds I update my TextView with some text like "Score: 10 Time: 100.10 seconds". But, I find the TextView only updates the first few times. The application is still very responsive, but the label will not update. I tried to call .invalidat...

WPF: Building a Queue in a Thread with Timers

With reference to the Software Project I am currently working on. I have the below methods that basically move a canvas with a Timer: DispatcherTimer dt = new DispatcherTimer(); //global public void Ahead(int pix) { var movx = 0; var movy = 0; dt.Interval = TimeSpan.FromMilliseconds(5); ...

WPF: Translating a Canvas at an angle

With reference to this programming game I am currently building. Important: Scroll down to see [Edit] Some of the methods that a user can call in my game will be methods that will do a Translate Transform to the Robot (just a Canvas basically). From the move method, I know the heading (angle) at which the Robot will be facing at the t...

High resolution timer with C++ and Linux?

Hi! Under Windows there are some handy functions like QueryPerformanceCounter from mmsystem.h to create a high resolution timer. Is there something similar for Linux? ...

vb.net countdown

Hi, I'm trying to make a countdown timer in my app. I already know the countdown time which is 4 minutes. I have a timer which ticks avery seconds. Now from that how can I update my textbox so that it shows the time remaining in the foirmat HHMMSS? EDIT: the problem I'm having is calculating the remaining time. What should I use? timest...

C# ISynchronizeInvoke Question

At the risk of sounding like a total noob, how do I implement ISynchronizeInvoke on a System.Timers.Timer? I have a class (no UI) that is making calls to mciSendString. I have a timer that is supposed to poll for the current status. All of the calls from the class work, but not the ones coming from the timers elapsed event. I've trac...

Basic wxWidgets Timer

Being new to wxWidgets I need some example code of how to get the wxTimer working. The reference gives 3 ways to use it but doesn't include sample code for any of them. Optimally, I'd like to get method 2 working. ...

Using Timer with For Loop to Halt Execution

for(int i=0; i<mylist.items.count; i++) { if(i==myvalue[i]) { //call Timer! Wait timer interval if timer is tick, continue for loop! } timer_click() { // application } } How can I use the for loop with timer to pause execution if the value in the conditional is a certain value? ...

How to programatically pass arguments to OnStart method of a windows service ?

Hi All, How do i programatically pass in arguments to OnStart method of a Service, which I further need to propagate to the Elapsed event of the Timer inside the service. Amit ...

Calling a aspx page from windows service - Problem

I have a windows service that calls a page after a certain interval of time. The page in turn creates some reports. The problem is that the service stops doing anything after 2-3 calls. as in it calls the page for 2-3 times and then does not do any work though it shows that the service is running...i am using timers in my service.. plea...

WPF: Best (reliable) way to translate (move) a Canvas AND monitor Every step

I have tried translating (moving) a canvas but I'm having trouble with the timers. I tried 2 different methods: First method was with the BeginAnimation function, and the second with DispatcherTimer ticks, but they're both very unreliable. I need to monitor every step of the translation. With the first method I tried (BeginAnimation)...

C++ obtaining milliseconds time on Linux -- clock() doesn't seem to work properly

On Windows, clock() returns the time in milliseconds, but on this Linux box I'm working on, it rounds it to the nearest 1000 so the precision is only to the "second" level and not to the milliseconds level. I found a solution with Qt using the QTime class, instantiating an object and calling start() on it then calling elapsed() to get t...

Start timers in Java

Hi , I want a particular piece code to be executed after 5 minutes. How can I do that using Java? out.println("<HTML>"); out.println("<head>"); //out.println("<frame>"); out.println("<frameset rows=\"80%, *\" frameborder=\"0\" border=\"0\" framespacing=\"0\">"); out.println("<frame src=\"DataCenter...

Timer cannot be stopped in C#

Hello all, I have a timer on a windows form (C# 3.0, .net 3.5 SP1, VS2008 SP1, Vista) that seems to work even after it is stoppped. The code is: using System; using System.Windows.Forms; namespace TestTimer { public partial class Form1 : Form { public Form1() { InitializeComponent(); Sta...

Flash AS3 timer question

Hi I have got a timerEvent that adds 25 movieclips to the stage and animates them from x:0,y:0, this all works fine! What i would like to do is assign each movie clip a y value of 25px more than the last movieClip added to the stage. I did a little test by trying to increment a number value each time the timer did a loop but it didnt inc...

python: how to send packets in multi thread and then the thread kill itself

Hi, I have a question. I'd like to send a continuous streams of byte to some host for certain amount of time (let's say 1 minute) using python. Here is my code so far: #! /usr/bin/env python import socket import thread import time IP = "192.168.0.2" PADDING = "a" * 1000 #assu...

Porting code from using timers to scheduledexecutorservice

I am trying to port code from using java timers to using scheduledexecutorservice I have the following use case class A { public boolean execute() { try { Timer t = new Timer(); t.schedule (new ATimerTask(), period, delay); } catch (Exception e) { return false; ...

Timer to find elapsed time in a function call in C

I want to calculate time elapsed during a function call in C, to the precision of 1 nanosecond. Is there a timer function available in C to do it? If yes please provide a sample code-snippet. Pseudo code Timer.Start() foo(); Timer.Stop() Display time elapsed in execution of foo() Environment details: - using gcc 3.4 compiler on a...

CPU clock frequency and thus QueryPerformanceCounter wrong?

I am using QueryPerformanceCounter to time some code. I was shocked when the code starting reporting times that were clearly wrong. To convert the results of QPC into "real" time you need to divide by the frequency returned from QueryPerformanceFrequency, so the elapsed time is: Time = (QPC.end - QPC.start)/QPF After a reboot, the QP...