I am writing a game in which I need to know whether or not a user preforms an action in one second or less. I can not use time() because it measures time in seconds. If the user starts the action half-way through a second it would mess with accuracy. I am experimenting with clock(). I have got clock to work with some programs to make a delay, but not in this way to measure time: [CODE] #include <iostream> #include <ctime> using namespace std; int main() { clock_t start = clock(); cout << "press enter..."; cin.ignore(); clock_t finish = clock(); …

Member Avatar
Member Avatar
+0 forum 12

Hi, I am having a Timer control like this: [CODE]asp:Timer ID="Timer1" runat="server" Enabled="False" Interval="1000" OnTick="Timer1_Tick"> </asp:Timer>[/CODE] In an UppdatePanel with AJAX enabled. So everything works fine to the point where on each refresh of the panel a JS is inserted in the header: [CODE]<script type="text/javascript">Sys.Application.add_init(function() { $create(Sys.UI._Timer, {"enabled":true,"interval":1000,"uniqueID":"Timer1"}, null, null, $get("Timer1")); });</script>[/CODE] So you can imagine in 10 min the page is increased by 600 lines. Any ideas on how to make the timer not register itself every time or at least not stack up ? Thanks!

Member Avatar
Member Avatar
+0 forum 3

hello, Using Python 2.7, PyQt4, Qt Designer, and used pyuic4... I think thats it... windows 7? I have a GUI i created in Qt Designer. It has one button and one LCD number. I was trying to get the button to start and reset a timer, and have the elapsed time displayed as value on the LCD number in hh:mm:ss format. I have done numberous searches online, and found examples in other languages except for python? I have found examples that print time, but nothing in python which links to the LCD number from Qt Designer? Maybe it cant be …

Member Avatar
Member Avatar
+0 forum 2

hi i just want to ask and ask your help . can you guys help to make timer in my quiz page. seriously i have no idea how to do it. plus im still new in this field around 7 month , so i dont know where to put the code and what i need to write in the code . kindly hope your help.sorry for my broken english this is my code <style> html { font-family:tahoma; } </style> <?php function gettitle($id) { $q="SELECT title FROM elearning_title WHERE title_id='$id'"; list($name)=mysql_fetch_row(mysql_query($q)); return $name; } ?> <?php if(isset($_POST['submit'])) { $title_id = $_GET['cid']; …

Member Avatar
Member Avatar
+0 forum 5

hi, I am new to C programming. I want to program a running LED on my PIC24 (PIC24HJ256GP206) I have 5 LED on my PORT G and have input PORTB (RB0) My program should, if RB0 is grounded (I put jumper on my circuit) the LED will be running faster, else the LED will running slower. But, there is problem , the LED is not running. here my code : // PIC24HJ256GP206 Configuration Bit Settings // 'C' sourc#include <p24Hxxxx.h>e line config statements #include <p24Hxxxx.h> int FBS __attribute__((space(prog), address(0xF80000))) = 0xCF ; //_FBS( // BWRP_WRPROTECT_OFF & // Boot Segment Write Protect …

Member Avatar
+0 forum 0

I have a code for countdown timer and it works perfectly fine.. <html> <title>project prelim</title> <head> <script type="text/javascript"> var ss = 10; function countdown() { ss = ss-1; if (ss<0) { window.location="testover.html"; } else { document.getElementById("countdown").innerHTML=ss; window.setTimeout("countdown()", 1000); } } </script> </head> <body onload="countdown()"> <center> <table width="100%" height="600px" style="text-align:center;"> <tr><td valign="center"><h3>Redirecting to testover <h2 id="countdown"></h2></h3></td></tr> </table> </center> </body> </html> Now if I am implementing it in a form which has a button like <form action="batman.php" method="post"> <button id="submit" type="submit" >Submit</button> </form> The code which I have does not do the form submit action. How can I make the form submit …

Member Avatar
Member Avatar
+0 forum 5

Programming is such a customizable duty. I would like to ask some approaches (not solutions) to coding a program that has a GUI that functions as a cooking timer for hamburgers, steaks, cookies, etc. Call it reasoning or planning assistance for software development. I am having a tad bit of trouble coming up with things to proceed towards implementation. Any ideas are welcome and would be greatly appreciated. (NO CODE PLEASE JUST IDEAS)

Member Avatar
Member Avatar
+0 forum 2

Group, I'm trying to write some code that will read the clocktime. When it hits a predetermined time, I want it to run a routine. I know how to do this in VB.net. It would be done like this: Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick If TimeOfDay = "10:01:00 PM" Then 'Go do something important End If End Sub Unfortunately I don't know the equivalent to the same in vbScript (if there is something like it). I did find a "timer" online that counts the number of seconds from midnight. It looks like this: Function TimeIt(N) …

Member Avatar
Member Avatar
+0 forum 4

Hi Team, So I am working on this project where I have 5 comboboxes that loads data from an .accdb file and Displays the result as per selection in a Text Box. I need to add Timers(as many as Required) to capture the Text-Box Data **"10 seconds After"** the fifth combobox option is selected. Please Help!

Member Avatar
Member Avatar
+0 forum 1

Hello group! I've created a short program to open an application at a specific time. It's working but is attempting to open the application multiple times. What should I be doing to control the number of times it is opening? It only needs to open one time. Here's my code: Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick Label7.Text = TimeOfDay If TimeOfDay = "12:02:00 AM" Then Process.Start("C:\Program Files (x86)\TestProgram\ftw.exe") End If End Sub How do I fix this? Any thoughts? FYI... I'm using Visual Studio 2010/Visual Basic.net In advance, thanks for the help! Don Wilson

Member Avatar
Member Avatar
+0 forum 6

I'm trying to set up a timer that counts up to ten and starts/resets when the left mouse button is clicked (anywhere on the screen even when the application is in the background). I'm struggling to find a code that suggests it is possible and now I am starting to wonder even if it is possible in VB? Any help would be much appriciated. Thank you.

Member Avatar
Member Avatar
+0 forum 5

Hey guys, I have a script that switches between tabs..It works perfectly, but what i am needing is a way for the script to stop when I have my mouse on the tab or content for the tab. I am using bootstrap and here is my [fiddle](http://jsfiddle.net/patk570/5hk6R/) with the working tab switch.

Member Avatar
Member Avatar
+0 forum 6

hey guys, i'm currently working on a project, i have a tabbed panel and i've put a timer on the 1st tab panel. what i want to do is for the timer to remain enable even if i change tabs. what could i possibly do for this problem? thanks

Member Avatar
+0 forum 0

This is a timer class that I wrote a while ago (cleaned up a bit for the snippet) for adding delays in some of the games I have written over the years. Note: I normally have the class functions in a .cpp file but since it looks like I can only post in one "file" I merged them together in what would be a .h file. The timer basically counts up in miliseconds and can be paused/resumed while maintaining the amount of miliseconds elapsed while the timer was active. Here is a basic example of counting from 1 to 10 …

Member Avatar
Member Avatar
+0 forum 10

Hello friend i am developing a new web portal in this portal one thing is also one user is visible online for another user which a user is add friend list but issu is that i have a worked on logout but what i will do when user close a browser where a profile is open. give me tip for doing this work.

Member Avatar
Member Avatar
+0 forum 1

I am an amateur python coder and i was wondering if it is possible to put a timer into my times table game and if possible where i could put it. Here's my code for my game help would be appreciated , thanks :) import random import time print ("Hello , this is the mental maths game") time.sleep(0.25) print ("You will have to answer 50 questions on each different level and get 45 or more correct to proceed") name = input("What is your name?") print ("Okey, ",name," lets begin.") difficulty = "bronze" correct_answer = 0 points = 0 def get_int(prompt=""): …

Member Avatar
Member Avatar
+0 forum 2

protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { UpdateTime(); } } protected void Timer1_Tick(object sender, EventArgs e) { UpdateTime(); } public void UpdateTime() { try { int hour = 00, min = 00, sec = Int32.Parse(Session["tleft"].ToString()); // min = Int32.Parse(Session["tleft"].ToString()) / TimeSpan span = new TimeSpan(TimeSpan.TicksPerSecond * sec); string str = span.Hours.ToString("00") + ":" + span.Minutes.ToString("00") + ":" + span.Seconds.ToString("00"); int tleft = Int32.Parse(Session["tleft"].ToString()) - 1; if (tleft <= 0) { Response.Redirect("result.aspx"); } // timeleft.Text = tleft.ToString(); timeleft.Text = str.ToString(); Session["tleft"] = tleft.ToString(); } catch (Exception ex) { Response.Write(ex.Message.ToString()); } } ----------------------------------------------------------------------- <%@ Page Language="C#" AutoEventWireup="true" CodeFile="TickTock.aspx.cs" Inherits="TickTock" …

Member Avatar
Member Avatar
+0 forum 3

I want to maximize and minimize windows form on Timer Tick evebt. I placed the code this.WindowState = FormWindowState.Minimized; into the timer tick event. but actually its not working. Suggest me some code snippet for the same. Regards, Manthan

Member Avatar
Member Avatar
+0 forum 6

I want to do a down counter using 74ls193 .i want to start from 159 to 0 .my problem is that, i cannot make the second 7segment count from 9 to 0 because it always load 5.

Member Avatar
Member Avatar
+0 forum 1

Hello friends, I had done some questions regarding function call. I had done an console application that can run a particular set of code every minute. For that i used System.Threading.Thread.Sleep(60000); That worked well too. But now i stuck in another problem. Now I dont wanna use the above code.Because of the reason the thread.sleep() makes the entire application to sleep for a minute. But I am having a code that must be executed in the mean time. Any suggestions or help? TIA...

Member Avatar
Member Avatar
+0 forum 6

I have java code that uses Java's `java.util.Timer.schedule()` method. **Method Description:** *The `schedule(TimerTask task,long delay,long period)` method is used to schedule the specified task for repeated fixed-delay execution, beginning after the specified delay.* public void schedule(TimerTask task,long delay,long period)java.util.Timer.schedule() Is there an equivalent method in C#? If NOT, how can I implement it in C# ?

Member Avatar
Member Avatar
+0 forum 1

A simple timer for Excel VBA Excel VBA does not have a timer control. The alternative is to use the Timer() Function, and that leaves much to be desired. This code should be placed in a code module. My need was to tend to an abandoned program that was waiting for user input. I used this timer so that, if time elapsed, dummy data could be entered and the application saved and closed. The problem(s) with using Timer Function is that each call starts a new timer. If the timer times out after the application has closed, the application will/can …

Member Avatar
Member Avatar
+0 forum 1

Hey there! I'm currently trying to get my first text-adventure-game in python started,and I wanted to import some features that are totally unnecessary. just for the lulz. So,I want to start a timer,that starts when the game starts,and ends,when the player is dead or won the game. I want it to be like print "You won the game, %s ! You escaped in X seconds/minutes!" OR for the death function print "You lost the game, %s. You died after X seconds/minutes!" NOTE: I DO NOT NEED THE FUNCTION FOR THE DEATH OR SUCH, I JUST NEED THE TIMER FUNCTION

Member Avatar
Member Avatar
+0 forum 3

I am making an examination system desktop application in Java Swing. I have a frame named 'show_class_question' frame. This frame is used to display questions and four options from database. Whenever user clicks 'Next' button I am calling this same frame (show_class_question) again and agian from itself (self - refrencing) upto total number of questions (say 20). **show_class_question --**(user clicks next button on it)**--> show_class_question** Now I would like to add a countdown timer, whose value will be retrieved from database. I have stored minutes in database in an int column. And whenever user clicks next button the remaining time …

Member Avatar
Member Avatar
+0 forum 7

Hello everyone. I am working on creating a stub that would allow me to swap out various sorting algorithms so that I can "plug in" the algorithms and run the various sorts. The below code is for Insertion Sort (yes, I know it is the slowest possible sort), but once I get it to work, I plan on doing Heap Sort, Merge Sort, Quick Sort, Radix Sort, and TimSort while collecting times from each one. The input file I am using has approximately 1/2 million values in order to give a better example of the variences in time. I have …

Member Avatar
Member Avatar
+0 forum 3

I needed a 5 minute countdown for a project I was working on so I hacked this up, It does nothing more and nothing less. Figured I would post it while I was here to save someone else the trouble. (Not that it's in anyway difficult to do.)

Member Avatar
Member Avatar
+1 forum 4

Hello generous java coders!I am really in a desperate situation now. I have a working gui code here: import java.awt.event.*; import java.awt.*; import javax.swing.*; public class CountdownTimer extends JFrame { JLabel promptLabel, timerLabel; int counter; JTextField tf; JButton button; Timer timer; public CountdownTimer() { setLayout(new GridLayout(2, 2, 5, 5)); promptLabel = new JLabel("Enter time: ", SwingConstants.CENTER); add(promptLabel); tf = new JTextField(5); add(tf); button = new JButton("Start timing"); add(button); timerLabel = new JLabel("Waiting...", SwingConstants.CENTER); add(timerLabel); event e = new event(); button.addActionListener(e); } public void actionPerformed(ActionEvent e) { throw new UnsupportedOperationException("Not supported yet."); } public void run() { throw new UnsupportedOperationException("Not supported …

Member Avatar
Member Avatar
+0 forum 4

I need a solution for a small problem in my project and I'll make it as simple as possible: At one of the forms in my project, user should be able to add a panel to the form and that form should contain 2 controls ... a label and a (stopwatch or timer). The problem is after creating the stopwatch dynamically, I can't set a name for the stopwatch. Later in that form when user clicks on the panel stopwatch must start. How can I set the name for created stopwatch? or any other solution if my way is too …

Member Avatar
Member Avatar
+0 forum 6

No bells and whistles, just a quickie millisecond timer showing an alternative to the far less portable clock_t method. A test main() is included, just define TEST_DRIVER as a macro or remove the conditional compilation at the end.

Member Avatar
Member Avatar
+0 forum 1

namespace play_stop { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button4_Click(object sender, EventArgs e) { timer1.Interval = 1000; timer1.Start(); Counter = 0; } public void circles() { Graphics g = panel1.CreateGraphics(); g.DrawEllipse( new Pen(Color.Red),panel1.Width / 2, panel1.Height / 2,75, 75); Graphics h = panel1.CreateGraphics(); h.DrawEllipse( new Pen(Color.Blue), panel1.Width / 2, panel1.Height / 2, 50, 50); Graphics j = panel1.CreateGraphics(); j.DrawEllipse( new Pen(Color.Yellow), panel1.Width / 2, panel1.Height / 2, 80,80); Graphics k = panel1.CreateGraphics(); k.DrawEllipse( new Pen(Color.Green), panel1.Width / 2, panel1.Height / 2, 100,100); } public int counter; public int Counter { get { …

Member Avatar
Member Avatar
+0 forum 6

The End.