timer

Java event handling with a delay

倾然丶 夕夏残阳落幕 提交于 2019-12-23 02:55:09
问题 import java.awt.Color; import java.awt.Dimension; import javax.swing.JPanel; import javax.swing.Timer; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartMouseEvent; import org.jfree.chart.ChartMouseListener; import org.jfree.chart.ChartPanel; import org.jfree.chart.JFreeChart; import org.jfree.chart.entity.ChartEntity; import org.jfree.chart.plot.PiePlot; import org.jfree.chart.plot.PiePlot3D; import org.jfree.data.general.DefaultPieDataset; import org.jfree.data.general

math quiz with a time limit (simultaneous functions) - advanced python

穿精又带淫゛_ 提交于 2019-12-23 02:32:12
问题 So I would like to run two programs, a timer and a math question. But always the input seems to be stopping the timer funtion or not even run at all. Is there any ways for it to get around that? I'll keep the example simple. import time start_time = time.time() timer=0 correct = answer answer = input("9 + 9 = ") #technically a math question here #so here until i enter the input prevents computer reading the code while True: timer = time.time() - start_time if timer > 3: #3 seconds is the

NSTimer: floating point value can not be converted to UInt8 because it is greater than UInt8.max

≯℡__Kan透↙ 提交于 2019-12-23 01:45:11
问题 My code returns the error: fatal error: floating point value can not be converted to UInt8 because it is greater than UInt8.max. The code is being called when a button is pressed (in a different swift file) but I know that the problem wasn't with calling the function so I didn't include it. code: //starts the timer func startTimer(sender: AnyObject) { if !timer.valid { timer = NSTimer.scheduledTimerWithTimeInterval(0.01, target: sender, selector: Selector(updateTime()), userInfo: nil, repeats

C# using a timer inside a Backgroundworker

假装没事ソ 提交于 2019-12-22 18:57:20
问题 I couldn't find a solution for this yet...hope someone can help me. I have a backgroundworker that runs until it is cancelled by the user (it reads data from a socket and writes it into a file). Now I want to split the output file after a certain period of time, e.g. every 2 mins create a new file. For this to happen I'd like to use a timer, something like private void bckWrkSocket_DoWork(object sender, DoWorkEventArgs e) { //create timer and set its interval to e.Argument //start timer while

Simulating movement similar to dust particles

回眸只為那壹抹淺笑 提交于 2019-12-22 18:43:00
问题 I've tried a setInterval loop with css and animate. Both ways of movement consists of tiny movement from oldpos1 -> newpos1 with no random curve movement, easing however occured with jQuery animate but only between randomly generated 1-3 pixels, which is not what I want . Does the problem lies in setInterval 's clock, where only linear time units flow? Where should I start, to make below images exist in jQuery? What I would like to do: Dodge behaviour: A, B - particle AB1 - common dodge area,

Powershell - Close form after time period

泪湿孤枕 提交于 2019-12-22 18:34:10
问题 I have a power-shell form prompting user if they would like to postpone a shutdown time (the time of the shutdown is given by another ps script as an argument which is calculated in the initial script). I'd like to close the form after 30 minutes of inactivity, how would I go about this? Powershell Code (Form): #creating the form object $form = New-Object System.Windows.Forms.Form #setting the from title $form.Text = "System warning" #setting the form dimesnions and positions $form.Size = New

countdown timer in JSP/Servlets

眉间皱痕 提交于 2019-12-22 18:18:27
问题 I am developing an online examination using servlets/jsp.I need to add a count down (hh/mm/ss) timer to the questions page that would end the exam and redirects to results page. I am done with all the other functionalities except the timer one. Can someone provide some help on this. Thanks 回答1: Have you tried a JavaScript solution. Its pretty easy to write your own. There is also a ton of examples on the net such as this one. 回答2: <html> <%@page session="false" %> <% HttpSession s=request

Ruby GTK Pixbuf timed image change

折月煮酒 提交于 2019-12-22 14:04:13
问题 I am creating an image slideshow in ruby, using gtk pixbuf to load images. I am very new to ruby & GTK, this may be an stupid question. Currently image changes are linked to the GUI button_press_event, I would like them to change /refresh automatically based on a set time, like a slideshow or animation. I saw the gtk animation using a gif method, but I would like to use individual jpeg files inline sequence, so that I can set the time to show a slide. Once the loop has gone through all the

Java color changing Graphics with Timer

两盒软妹~` 提交于 2019-12-22 13:59:20
问题 I want to draw a disc that changes colors twice a second. The disk is drawn on a DrawPanel which extends a JPanel and in the main method the DrawPanel is added to a frame. For the colorchanging I use a timer which works when I'm trying to change the background of the DrawPanel in the main method (what i commented out). Can someone tell me why it doesn't work for the Graphics g object or any other suggestions? I just copied the code from the main method and added it into the paintComponent()

Outlook VBA - Run a code every half an hour with outlook 2010 64 bits

时光怂恿深爱的人放手 提交于 2019-12-22 13:55:20
问题 This question is done (and solved) before, see Outlook VBA - Run a code every half an hour I used the code fore several years on with no trouble on several computers running Vista (32 bit), Windows 7 and Windows 8.1 (all 64 bit). A new computer with a new office 2010 installation gives some problems. The 64 bit version of outlook seems to react different as the 32 bit version. I get errors with these lines Declare Function SetTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long,