timer

VBA: How do I really stop Application.onTime()?

断了今生、忘了曾经 提交于 2019-12-19 09:27:28
问题 [SOLVED]: Please see answers for solution. Thanks @DaveU. I have already read some questions/threads (eg this or this) about how to stop the VBA Application.OnTime procedure, but I just can't get it to stop! I am using it to pull some data every x seconds. I understand that when I call the OnTime() method I need to pass to it the same time value that was used to schedule the event. I have also tried to introduce multiple commands (that try to cause an error for example) to stop the execution

Swing timer - time fluctuating

纵然是瞬间 提交于 2019-12-19 09:24:00
问题 I am using a Swing Timer in my game but when the game is running it appears to have moments when it runs smoothly and moments when it slows down. Why is the time fluctuating? And how do I fix it? import java.awt.Color; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.Timer; public class Main extends JFrame { public Main() { super("JFrame"); // you can set the content pane

Execute a method every x seconds in C

橙三吉。 提交于 2019-12-19 07:53:39
问题 Is there an example of a working timer that executes some function every x amount seconds using C. I'd appreciate an example working code. 回答1: You could spawn a new thread: void *threadproc(void *arg) { while(!done) { sleep(delay_in_seconds); call_function(); } return 0; } ... pthread_t tid; pthread_create(&tid, NULL, &threadproc, NULL); Or, you could set an alarm with alarm(2) or setitimer(2): void on_alarm(int signum) { call_function(); if(!done) alarm(delay_in_seconds); // Reschedule

Execute a method every x seconds in C

别说谁变了你拦得住时间么 提交于 2019-12-19 07:53:07
问题 Is there an example of a working timer that executes some function every x amount seconds using C. I'd appreciate an example working code. 回答1: You could spawn a new thread: void *threadproc(void *arg) { while(!done) { sleep(delay_in_seconds); call_function(); } return 0; } ... pthread_t tid; pthread_create(&tid, NULL, &threadproc, NULL); Or, you could set an alarm with alarm(2) or setitimer(2): void on_alarm(int signum) { call_function(); if(!done) alarm(delay_in_seconds); // Reschedule

Why does System.Timer.Timer still fire events when Enabled is set to false?

Deadly 提交于 2019-12-19 06:41:15
问题 I have attempted to create a derived class of Timer that allows for a 'Pause' latch to be set to keep the worker thread from reactivating the timer. However, Elapsed events are continued to be raised when AutoReset is set to false and the Enabled accessor appears to be doing it's job in preventing the Enabled property of the base class from being modified once the Paused variable is set. Why is this happening or what strategies should I use to further understand what interactions are actually

python threading.timer set time limit when program runs out of time

◇◆丶佛笑我妖孽 提交于 2019-12-19 04:47:26
问题 I have some questions related to setting the maximum running time of a function in Python. In fact, I would like to use pdfminer to convert the .pdf files to .txt . The problem is that very often, some files are not possible to decode and take extremely long time. So I want to set threading.Timer() to limit the conversion time for each file to 5 seconds. In addition, I run under windows so I cannot use the signal module for this. I succeeded in running the conversion code with pdfminer

How to use a timer inside a vertex shader to animate point sizes in OpenGL

随声附和 提交于 2019-12-19 04:22:25
问题 I'm trying to implement a point cloud where the different points shall vary in size based on an uncertainty value associated with them. Let's say, if this value is zero, the size should be constant, if it's approaching 1, the radius of those points should vary more and more. First, the points should gain in size and after reaching a maximum, they should decrease until a minimum, and so on. A function to describe this phenomenon could be: pointSize = x +/- c * pointUncertainty, where x =

CountDownTimer- that the user increments. Issues

女生的网名这么多〃 提交于 2019-12-19 04:12:48
问题 I have a question about CountDownTimer. I have to make an application that allows the user to increment the time time by +1, for every click of the button. Then after the button stops being clicked it waits for three seconds, then starts to countdown. I pasted my code below. My Issue is: I can't seem to get the Incrementing of the number working correctly, however it seems that after I stop Incrementing the number (onStop()) it directly goes to (onFinish()). Instead of going to the OnTick()

Equivalent to javax.swing.Timer in Android

拥有回忆 提交于 2019-12-19 03:37:15
问题 Is there something that looks like the javax.swing.Timer on Android. I know how to create own Threads, but is there something that is like the swing-timer? 回答1: There is also Java's TimerTask. Here's an example from my code where I'm playing audio samples: import java.util.Timer; import java.util.TimerTask; // from constructor, shown here out of place timer = new Timer(); // and in method, again, shown out of place: INTERVAL_MILLISECONDS = (int)((double)(bufSize) / (double)(nativeSampleRate *

Call repaint from another class in Java?

走远了吗. 提交于 2019-12-19 03:37:11
问题 I'm probably doing this wrong, so please be nice. I'm developing a Java game, and I'm at the stage of testing character movement / animation. The "person" can move up down left and right on a grid. The class the grid is drawn in is the gamePanel class. The buttons are in the gameControlPanel class. I have a button which spawns a person on the grid. I then have a button to move the person up down left and right. When the move up button is pressed, it calls the move up method from the person