timer

Periodically testing of elements that are added to the DOM after pageload

别来无恙 提交于 2020-01-06 06:42:14
问题 I've got a page where you upload videos, those videos are then encoded (much like Youtube). The encoding part can take some time and I want to automatically show the user if encoding is done by periodically polling the encoding status from within the page, if encoding is completed I want to replace the encoding icon with a "play" button so the user can play the video. Because the list of uploaded videos itself is put into the DOM using AJAX (with jQuery) I have trouble wrapping my head around

Periodically testing of elements that are added to the DOM after pageload

筅森魡賤 提交于 2020-01-06 06:42:09
问题 I've got a page where you upload videos, those videos are then encoded (much like Youtube). The encoding part can take some time and I want to automatically show the user if encoding is done by periodically polling the encoding status from within the page, if encoding is completed I want to replace the encoding icon with a "play" button so the user can play the video. Because the list of uploaded videos itself is put into the DOM using AJAX (with jQuery) I have trouble wrapping my head around

NSTimer problem

一笑奈何 提交于 2020-01-06 06:10:20
问题 In my app I used the code below with a timer of interval equal to 1.0f/30.0f which meant that it is called 30 times per second to call incrementSpeed . I notice in the log file that the value of moduloResult is equal to '0' for a second and incrementSpeed is called 30 times every 5 seconds, but I want it to call it just 1 time for every 5 seconds. - (void)move:(NSTimer *)theTimer { // ... CGFloat moduloResult = (float)((int)time % (int)5); NSLog(@"mod = %f",moduloResult); if (!moduloResult) {

Help with jQuery content slider and auto advance

断了今生、忘了曾经 提交于 2020-01-06 06:01:19
问题 I've been hammering at this for 2 days and still could not get the result I want. Basically it is a simple content slider with "dot" controls. When you click a certain dot, it will go to that slide. And it also has a auto advance timer to auto scroll when not clicked. So far I've been able to get the auto scroll to work however when you click on the dot, it just goes to the next slide in line instead of the specific one that I clicked on. It's almost as if the dots just functions as a "next"

Auto execute message every 5 seconds

若如初见. 提交于 2020-01-06 05:48:29
问题 I am new to Android. Can anyone tell me how to execute a message every 5 seconds. I have tried this code, but it's not showing anything on my emulator. What should I be doing instead? while(true) { Toast.makeText(this, "hi", Toast.LENGTH_SHORT).show(); try { Thread.sleep(5000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } 回答1: You should not call Thread.sleep() from the GUI thread. Never do this. Use a handler for such thing. private Handler

AS3 Using multiple timer to show / hide enemies

无人久伴 提交于 2020-01-06 05:39:14
问题 i have a shooting game that works with some sort of rounds, for instance, this round is gonna show 4 enemies on the screen that the user has to shoot. I show the 4 enemies at a half seconds interval of each one so it doesnt all appear on the same time. Using something like: enemiesShowTimer = new Timer(0.5 * 1000, 1); enemiesShowTimer.addEventListener(TimerEvent.TIMER, showEnemyAtTime); enemiesShowTimer.start(); The player has 2 seconds to kill each enemy after they appear, so i also use this

How can I use the J2EE Timer Service API in the Servlet startup code?

馋奶兔 提交于 2020-01-06 05:27:27
问题 For a background job which I would like to run in a J2EE container, I found the suggestion to create a startup servlet and use the Timer Service API to create a managed Timer (in the answers for What tools are there for timed batch processes in J2EE?). To create a timer, I need a context which implements the timer API. (Example) In the Servlet class, I override the init method, but it has only access to a ServletContext, but not to a SessionContext. A ServletContext does not have methods to

How can I use a static C++ method as a callback for a Poco timer?

人走茶凉 提交于 2020-01-06 05:25:36
问题 Particularly I'm talking about the constructor of this Poco class: Poco.TimerCallback I would like to use it in legacy C++ code where most of the classes I've written are "static" so that they only contain static methods and no constructors, just because I won't need multiple instances of such objects anyway, and the classes are merely for encapsulation. Well yeah, the Poco guys suggest to add a callback method like this: TimerCallback<MyClass> callback(*this, &MyClass::onTimer); timer.start

Why does my VB.NET Snake game freeze when I hold a key down?

て烟熏妆下的殇ゞ 提交于 2020-01-06 04:05:19
问题 I'm trying to make the classic Snake game in VB.NET, but if I hold a key (any key) during the game, after a few seconds the game freezes until I release the key. I've tried lots to fix this, but nothing works, maybe because I don't understand the problem. I'm assuming that when I hold down a key, the Form1_KeyDown function gets called, and when, after a few seconds, the key goes into "I'm being held down" mode, that function is constantly called, so the timers don't get a chance to update.

Why does my VB.NET Snake game freeze when I hold a key down?

笑着哭i 提交于 2020-01-06 04:05:13
问题 I'm trying to make the classic Snake game in VB.NET, but if I hold a key (any key) during the game, after a few seconds the game freezes until I release the key. I've tried lots to fix this, but nothing works, maybe because I don't understand the problem. I'm assuming that when I hold down a key, the Form1_KeyDown function gets called, and when, after a few seconds, the key goes into "I'm being held down" mode, that function is constantly called, so the timers don't get a chance to update.