Search Results

Search found 184 results on 8 pages for 'countdown'.

Page 3/8 | < Previous Page | 1 2 3 4 5 6 7 8  | Next Page >

  • How do you make a precise countdown timer using clock_gettime? [migrated]

    - by Joshun
    Could somebody please explain how to make a countdown timer using clock_gettime, under Linux. I know you can use the clock() function to get cpu time, and multiply it by CLOCKS_PER_SEC to get actual time, but I'm told the clock() function is not well suited for this. So far I have attempted this (a billion is to pause for one second) #include <stdio.h> #include <time.h> #define BILLION 1000000000 int main() { struct timespec rawtime; clock_gettime(CLOCK_MONOTONIC_RAW, &rawtime); unsigned long int current = ( rawtime.tv_sec + rawtime.tv_nsec ); unsigned long int end = (( rawtime.tv_sec + rawtime.tv_nsec ) + BILLION ); while ( current < end ) { clock_gettime(CLOCK_MONOTONIC_RAW, &rawtime); current = ( rawtime.tv_sec + rawtime.tv_nsec ); } return 0; } I know this wouldn't be very useful on its own, but once I've found out how to time correctly I can use this in my projects. I know that sleep() can be used for this purpose, but I want to code the timer myself so that I can better integrate it in my projects - such as the possibility of it returning the time left, as opposed to pausing the whole program.

    Read the article

  • How the simples GUI countdown is supposed to work?

    - by Roman
    I am trying to write the simples GUI countdown. I found in Internet some code but it is already too fancy for me. I am trying to keep it as simple as possible. So, I just want to have a window saying "You have 10 second left". The number of second should decrease every second from 10 to 0. I wrote a code. And I think I am close to the working solution. But I still missing something. Could you pleas help me to find out what is wrong? Here is my code: import javax.swing.*; public class Countdown { static JLabel label; // Method which defines the appearance of the window. private static void showGUI() { JFrame frame = new JFrame("Simple Countdown"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JLabel label = new JLabel("Some Text"); frame.add(label); frame.pack(); frame.setVisible(true); } // Define a new thread in which the countdown is counting down. static Thread counter = new Thread() { public void run() { for (int i=10; i>0; i=i-1) { updateGUI(i,label); try {Thread.sleep(1000);} catch(InterruptedException e) {}; } } }; // A method which updates GUI (sets a new value of JLabel). private static void updateGUI(final int i, final JLabel label) { SwingUtilities.invokeLater(new Runnable(i,label) { public Runnable(int i, JLabel label) { this.i = i; this.label = label; } public void run() { label.setText("You have " + i + " seconds."); } }); } // The main method (entry point). public static void main(String[] args) { javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { showGUI(); //counter.start(); } }); //counter.start(); } } And I have several concrete question about this code: Where should I place the counter.start();? (In my code I put it on 2 places. Which one is correct?) Why compiler complains about the constructor for Runnable? It says that I have an invalid method declaration and I need to specify the returned type. ADDED: I made the suggested corrections. And then I execute the code and get: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at Worker.run(Worker.java:12) In the Worker.java in the line 12 I have: label.setText("You have " + i + " seconds.");.

    Read the article

  • Recursion in F#

    - by MarkPearl
    Things are slowly coming together – I was able to look at a bit of F# code and intuitively know what it was going to do (yay)… So today I saw a blog post by Bob Palmer on Fibonacci numbers in F# which inspired me to look at bit into recursion. First the C# example… class Program { public static void CountDown(int n) { switch (n) { case 0: Console.WriteLine("End of Count"); break; default: Console.WriteLine(n); CountDown(n-1); break; } } static void Main(string[] args) { CountDown(10); Console.ReadLine(); } }   In F#, the equivalent would look something like this… open System let rec CountDown n = match n with | 0 -> Console.WriteLine("End of Count"); | n -> Console.WriteLine(n); CountDown (n-1); CountDown 10 Console.ReadLine()   Pretty simple stuff. With F# you when making recursive calls you need to explicitly declare that the function is recursive with the “rec” keyword. Otherwise the code is pretty easy to read and self explanatory.

    Read the article

  • Unable to Get a Correct Time when I am Calling serverTime using jquery.countdown.js + Asp.net ?

    - by user312891
    When i am calling the below function I unable to get a correct Answer. Both var Shortly and newTime having same time one coming from the client site other sync with server. http://keith-wood.name/countdown.html I am waiting from your response. Thanks $(function() { var shortly = new Date('April 9, 2010 20:38:10'); var newTime = new Date('April 9, 2010 20:38:10'); //for loop divid /// $('#defaultCountdown').countdown({ until: shortly, onExpiry: liftOff, onTick: watchCountdown, serverSync: serverTime }); $('#div1').countdown({ until: newTime }); }); function serverTime() { var time = null; $.ajax({ type: "POST", //Page Name (in which the method should be called) and method name url: "Default.aspx/GetTime", // If you want to pass parameter or data to server side function you can try line contentType: "application/json; charset=utf-8", dataType: "json", data: "{}", async: false, //else If you don't want to pass any value to server side function leave the data to blank line below //data: "{}", success: function(msg) { //Got the response from server and render to the client time = new Date(msg.d); alert(time); }, error: function(msg) { time = new Date(); alert('1'); } }); return time; }

    Read the article

  • PASS Precon Countdown… See some of you Monday, and others on Tuesday Night

    - by drsql
    As I finish up the plans for Monday’s database design precon, I am getting pretty excited for the day. This is the third time I have done this precon, and where the base slides are very similar, I have a few new twists in mind. One of my big ideas for my Database Design Workshop precon has always been to give people to do some design. So I am even now trying to go through and whittle down the slides and make sure that we have the time for design. If you are attending, be prepared to be a team player....(read more)

    Read the article

  • How to implement a countdown clock on a product launch web page?

    - by Daniel Earwicker
    I'm asking this on behalf of a certain corporation: http://www.microsoft.com/visualstudio/en-us/watch-it-live Things to bear in mind: It's 8:30 AM at different times depending on where you are in the world. For example, where I am, it is already 10 AM, whereas in Redmond it's still only 2 AM. That's probably the main thing, I guess. Can any SO users recommend ways to improve the existing countdown page so that it works correctly for users in any timezone? (Serious question - clearly this is a pit that is easy to fall into!)

    Read the article

  • how to increment a javascript variable title that is within a php while loop

    - by steve
    I'm building multiple countdown clocks on one page. The number of countdown clocks varies from day to day so I need to call javascript several times from within "while" code in php to produce different clocks. The following code works but it's based on knowing how many clocks are needed before I start: <script language="javascript" src="countdown.js"></script> <script language="javascript"> var cd1 = new countdown('cd1'); cd1.Div = "clock1"; cd1.TargetDate = "<?php echo "$clocktime"; ?>"; cd1.DisplayFormat = "%%D%% days, %%H%% hours, %%M%% minutes, %%S%% seconds until event AAA happens"; </script> <div id="clockwrapper"><div id="clock1">[clock]</div></div> <script language="javascript" src="countdown.js"></script> <script language="javascript"> var cd2 = new countdown('cd2'); cd2.Div = "clock2"; cd2.TargetDate = "02/01/2011 5:30:30 PM"; cd2.DisplayFormat = "%%D%% days, %%H%% hours, %%M%% minutes, %%S%% seconds until event BBB happens..."; </script> <div id="clockwrapper"><div id="clock2">[clock]</div></div> So if I keep on calling the javascript above (the code with cd1 in it) all previous "cd1" clocks change to the latest clock because it is being overwritten. Somehow I need to call javascript from within my "while" loop in php and have cd1 become cd2, then cd3 so that the clocks work as they're supposed to. How do I go about doing this? I don't know how to call the javascript several times and increment the variable cd1 within the javascript. I tried something like this but couldn't get it to work. $id=mysql_result($result,$i,"id"); while($id){ $cd = ("$cd"."$id"); ?> <script language="javascript" src="countdown.js"></script> <script language="javascript"> var <?php echo "$cd"; ?> = new countdown('<?php echo "$cd"; ?>'); .... </script> <div id="clockwrapper"><div id="<?php echo "$cd"; ?>">[clock]</div></div> <?php $id=mysql_result($result,$i,"id"); } ?> Surely there is some easy way of getting around this that I don't know about. Thanks

    Read the article

  • Do really need a count lock on Multi threads with one CPU core?

    - by MrROY
    If i have some code looks like this(Please ignore the syntax, i want to understand it without a specified language): count = 0 def countDown(): count += 1 if __name__ == '__main__': thread1(countDown) thread2(countDown) thread3(countDown) Here i have a CPU with only one core, do i really need a lock to the variable count in case of it could be over-written by other threads. I don't know, but if the language cares a lot, please explain it under Java?C and Python, So many thanks.

    Read the article

  • Penny auction concept and how the timer works

    - by madi
    I am creating a penny auction site using PHP yii framework. The main consideration of the system is to update the database records of all active auctions (max 15 auctions) with the current ticker timer. I am seeking for advice on how i should design the system where every auction item will have a its own countdown timer stored in the database and when someone bids the auction item, the counter resets to 2 min. Every users who are connected to the system should see the same countdown timer for that particular auction. I am little confused on how i should design the system. Will there be a performance issue when there are frequent updates to the database (Mysql) where 15 active auctions are updated every seconds, the countdown timer decreases by a second in the database table for the particular auction. Schema Sample for auction_lots: Auction_id,startdatetime,counter_timer,status I am seeking for advice on how I should design this. Please help. Thank you!

    Read the article

  • Firebug is throwing a ' $( ' error?

    - by Kyle
    I am getting a strange error in Firebug, that I am not getting in Webkit. The error comes up as ' $( ' in firebug. Here's the code that is supposedly causing it to flip: $.getScript("http://kylehotchkiss.com/min/?g=packageHome", function() { $(".countdown").countdown({ until: new Date(2010, 6 - 1, 5), layout:'{dn} {dl}' }); }); The error isn't specific to the countdown script, it's just giving me an error trying to call any plugin I just loaded in firefox. Any ideas?

    Read the article

  • F# - This code isn't compiling for me

    - by stacker
    This code isn't compiling for me: let countDown = [5L .. -1L .. 0L];; I have a book that says it should return this: val countDown : int list = [5L; 4L; 3L; 2L; 1L; 0L] Compiler Error: Program.fs(42,24): error FS0010: Unexpected character '-' in expression > > let countDown = [5L .. -1L .. 0L];; let countDown = [5L .. -1L .. 0L];; -----------------------^

    Read the article

  • What are the best practices for unit testing properties with code in the setter?

    - by nportelli
    I'm fairly new to unit testing and we are actually attempting to use it on a project. There is a property like this. public TimeSpan CountDown { get { return _countDown; } set { long fraction = value.Ticks % 10000000; value -= TimeSpan.FromTicks(fraction); if(fraction > 5000000) value += TimeSpan.FromSeconds(1); if(_countDown != value) { _countDown = value; NotifyChanged("CountDown"); } } } My test looks like this. [TestMethod] public void CountDownTest_GetSet_PropChangedShouldFire() { ManualRafflePresenter target = new ManualRafflePresenter(); bool fired = false; string name = null; target.PropertyChanged += new PropertyChangedEventHandler((o, a) => { fired = true; name = a.PropertyName; }); TimeSpan expected = new TimeSpan(0, 1, 25); TimeSpan actual; target.CountDown = expected; actual = target.CountDown; Assert.AreEqual(expected, actual); Assert.IsTrue(fired); Assert.AreEqual("CountDown", name); } The question is how do I test the code in the setter? Do I break it out into a method? If I do it would probably be private since no one else needs to use this. But they say not to test private methods. Do make a class if this is the only case? would two uses of this code make a class worthwhile? What is wrong with this code from a design standpoint. What is correct?

    Read the article

  • here is my code in Jquery and Asp.net Unable to get a correct ANS as I am getting from jquery?

    - by ricky roy
    unable to get the correct Ans as i am getting from the Jquery I am using jquery.countdown.js here is my code [WebMethod] public static String GetTime() { DateTime dt = new DateTime(); dt = Convert.ToDateTime("April 9, 2010 22:38:10"); return dt.ToString("dddd, dd MMMM yyyy HH:mm:ss"); } html file <script type="text/javascript" src="Scripts/jquery-1.3.2.js"></script> <script type="text/javascript" src="Scripts/jquery.countdown.js"></script> <script type="text/javascript"> $(function() { var shortly = new Date('April 9, 2010 22:38:10'); var newTime = new Date('April 9, 2010 22:38:10'); //for loop divid /// $('#defaultCountdown').countdown({ until: shortly, onExpiry: liftOff, onTick: watchCountdown, serverSync: serverTime }); $('#div1').countdown({ until: newTime }); }); function serverTime() { var time = null; $.ajax({ type: "POST", //Page Name (in which the method should be called) and method name url: "Default.aspx/GetTime", // If you want to pass parameter or data to server side function you can try line contentType: "application/json; charset=utf-8", dataType: "json", data: "{}", async: false, //else If you don't want to pass any value to server side function leave the data to blank line below //data: "{}", success: function(msg) { //Got the response from server and render to the client time = new Date(msg.d); alert(time); }, error: function(msg) { time = new Date(); alert('1'); } }); return time; } function watchCountdown() { } function liftOff() { } </script>

    Read the article

  • How to place a DIV over jw player when certain condition is met?

    - by Derek
    JW player can either playback video in flash or html5. I use a countdown timer in my app between certain videos. Right now the countdown timer is being displayed in a div beneath the jw player. I need to get that timer displayed in a div that covers the entire jw player interface. I'm stuck and could use some help. Here is some of the javascript code: jwplayer("container").setup({ 'file': 'devplaylist.xml', 'flashplayer': 'js/player.swf', 'plugins': { './countdown.js': {} }, 'repeat': 'list', 'autostart': true, 'height': 390, 'width': 720, events: { onPlaylist: function(event){ ... ... } onPlaylistItem: function(event){ ... ... var minutes = (Math.floor(time/60 )); var seconds = time % 60; if (seconds < 10) seconds = "0" + seconds; var text = minutes + ":" + seconds; document.getElementById('resttimer').innerHTML = text; //I need to have a DIV display the value of text (the countdown time) //directly over the jw player time--; }, 1000); ... ...} Any help is appreciated, DK

    Read the article

  • Ruby on Rails - Send JavaScript to view

    - by Eef
    Hey, I am creating a website in Ruby on Rails. I have a controller action that renders a view like so: def show time_left = Time.now.to_i - 3.hours.to_i @character = current_user.characters.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @character } end end This is fine as it renders the show.html.erb as I like. I would like however to somehow pass time_left to the view as a Javascript variable as this value is use by a countdown JQuery plugin. I could put a javascript block on the page in the HTML and print a instance variable out like so: <script type="javascript"> $('#countdown').countdown('<%= @time_left =>')</script> But I would like to keep all my JS in a external file and off the page could anyone give some advice on how to implement this? Cheers Eef

    Read the article

  • CodePlex Daily Summary for Friday, February 26, 2010

    CodePlex Daily Summary for Friday, February 26, 2010New Projectsaion-gamecp: Aion Gamecp for aion Private server based on Aion UniqueAzure Email Queuer: Azure Email Queuer makes it easier for Developers Programming in the Cloud to Queue Emails to keep the UI Thread Clear for Requests. Developed w...BIG1: Bob and Ian's Game. Written using XNA Game Studio Express. Basically an update of David Braben and Ian Bell's classic game "Elite." This is a nonco...CMS7: CMS7 The CMS7 is composed of three module. (1)Main CMS Business (2)Process Customization (3)Role/Department CustomizationCoreSharp Networking Core: A simple to use framework to develop efficient client/server application. The framework is part of my project at school and I hope it will benefit ...Fullscreen Countdown: Small and basic countdown application. The countdown window can be resized to fit any size to display the minutes elapsed. Developped in C#, .NET F...IRC4N00bz: Learning sockets, events, delegates, SQL, and IRC commands all in one big project! It's written in C# (Csharp) and hope you find it helpfull, or ev...LjSystem: This project is a collection of my extensions to the BCLMP3 Tags Management: A software to manage the tags of MP3 filesnetone: All net in oneNext Dart (Dublin Area Rapid Transport): The shows the times of the next darts from a given station. It is a windows application that updates automatically and so is easier to use than th...PChat - An OCDotNet.Org Presentation: PChat is a multithreaded pinnable chat server and client. It is designed to be a demonstration of Visual Studio 2010 MVC 2, for ocdotnet.org Use...Pittsburgh Code Camp iPhone App: The Pittsburgh Code Camp iPhone Application is meant as a demonstration of the creation of an iPhone application while at the same time providing t...Radical: Radical is an infrastructure frameworkRadioAutomation: Windows application for radio automation.SilverSynth - Digital Audio Synthesis for Silverlight: SilverSynth is a digial audio synthesis library for Silverlight developers to create synthesized wave forms from code. It supports synthesis of sin...SkeinLibManaged: This implementation of the Skein Cryptographic Hash function is written entirely in Managed CSharp. It is posted here to share with the world at l...SpecExplorerEval: We are checking out spec explorer and presenting on its useSPOJemu: This is a SPOJ emulator. It allows you to define tests in xml and then check your application if it's working as you expected.The C# Skype Chat bot: A Skype bot in C# for managing Skype chats.VS 2010 Architecture Layers Patterns: Architecture layers patterns toolbox items for layers diagrams.Yakiimo3D: Mostly DirectX 11 programming tutorials.代码生成器: Project DetailsNew ReleasesArkSwitch: ArkSwitch v1.1.1: This release fixes a crash that occurs when certain processes with multiple primary windows are encountered.BTP Tools: CSB, CUV and HCSB e-Sword files 2010-02-26: include csb.bbl csb+.bbl csb.cmt csbc.dct cuv.bbl cuv+.bbl cuv.cmt cuvc.dct hcsb+.bbl hcsbc.dct files for e-Sword 8.0BubbleBurst: BubbleBurst v1.1: This is the second release of BubbleBurst, the subject of the book Advanced MVVM. This release contains a minor fix that was added after the book ...DevTreks -social budgeting that improves lives and livelihoods: Social Budgeting Web Software, alpha 3b: Alpha 3b simplifies and strengthens state management. With the exception of linked lists, the internal mechanics of addins have not been improved...Dragonrealms PvpStance plugin for Genie: 1.0.0.4: This updated is needed now that the DR server move broke the "profile soandso pvp" syntax. This version will capture the pvp stance out of the full...FastCode: FastCode 1.0: Definitions <integerType> : byte, sbyte, short, ushort, int, uint, long, ulond <floatType> : float, double, decimal Base types extensions Intege...Fullscreen Countdown: Fullscreen Countdown 1.0: First versionIRC4N00bz: IRC4N00bz_02252010.zip: I'm calling it a night. Here's the dll for where I'm at so far. It works, just lakcs some abilities. Anything not included can be pulled from th...Labrado: Labrado MiniTimer: Labrado MiniTimer is a convenient timer tool designed and implemented for GMAT test preparation.LINQ to VFP: LinqToVfp (v1.0.17.1): Cleaned up WCF Data Service Expression Tree. (details...) This build requires IQToolkit v0.17b.Microsoft Health Common User Interface: Release 8.0.200.000: This is version 8.0 of the Microsoft® Health Common User Interface Control Toolkit. The scope and requirements of this release are based on materia...Mini SQL Query: Mini SQL Query Funky Dev Build (RC1+): The "Funk Dev Build" bit is that I added a couple of features I think are pretty cool. It is a "dev" build but I class it as stable. Find Object...Neovolve: Neovolve.BlogEngine.Extensions 1.2: Updated extensions to work with BE 1.6. Updated Snippets extension to better handle excluded tags and fixed regex bug. Added SyntaxHighlighter exte...Neovolve: Neovolve.BlogEngine.Web 1.1: Update to support BE version 1.6 Neovolve.BlogEngine.Web 1.1 contains a redirector module that translates Community Server url formats into BlogEn...Next Dart (Dublin Area Rapid Transport): 1.0: There are 2 files NextDart 1.0.zip This contains just the files. Extract it to a folder and run NextDart.exe. NextDart 1.0 Intaller.zip This c...Powershell4SQL: Version 1.2: Changes from version 1.1 Added additional attributes to simplify syntax. Server and Database become optional. Defaulted to (local) and 'master' ...Radical: Radical (Desktop) 1.0: First stable dropRaidTracker: Raid Tracker: a few tweaksRaiser's Edge API Developer Toolkit: Alpha Release 1: This is an untested, alpha release. Contains RE API Toolkit built using 7.85 Dlls and 7.91 Dlls.SharePoint Enhanced Calendar by ArtfulBits: ArtfulBits.EnhancedCalendar v1.3: New Features: Simple to activate mechanism added (add Enhanced Calendar Web Part on the same page as standard calendar) Support for any type of S...Silverlight 4.0 Com Library for SQL Server Access: Version 1.0: This is the intial alpha release. It includes ExecuteQuery, ExecuteNonQuery and ExecuteScalar routines. See roadmap section of home page for detai...Silverlight HTML 5 Canvas: SLCanvas 1.1: This release enables <canvas renderMethod="auto" onload="runme(this)"></canvas> or <canvas renderMethod="Silverlight" onload="runme(this)"></ca...SilverSynth - Digital Audio Synthesis for Silverlight: SilverSynth 1.0: Source code including demo application.StringDefs: StringDefs Alpha Release 1.01: In this release of the Library few namespaces are added.STSDev 2008: STSDev 2008 2.1: Update to the StsDev 2008 project to correct Manifest Building issues.Text to HTML: 0.4.0.2: Cambios de la versión:Correcciones menores en el sistema de traducción. Controlada la excepción aparecida al suprimir los archivos de idioma. A...The Silverlight Hyper Video Player [http://slhvp.com]: Release 4 - Friendly User Release (Pre-Beta): Release 4 - Friendly User Release (Pre-Beta) This version of the code has much of the design that we plan to go forward with for Mix and utilizes a...TreeSizeNet: TreeSizeNet 0.10.2: - Assemblies merged in one executableVCC: Latest build, v2.1.30225.0: Automatic drop of latest buildVCC: Latest build, v2.1.30225.1: Automatic drop of latest buildVS 2010 Architecture Layers Patterns: VS 2010 RC Architecture Layers Patterns v1.0: Architecture layers patterns toolbox items based on the Microsoft Application Architecture Guide, 2nd Edition for the layer diagram designer of Vi...Yakiimo3D: DirectX11 BitonicSortCPU Source and Binary: DirectX11 BitonicSortCPU sample source and binary.Yakiimo3D: DirectX11 MandelbrotGPU Source and Binary: DirectX11 MandelbrotGPU source and binary.Most Popular ProjectsVSLabOSIS Interop TestsRawrWBFS ManagerAJAX Control ToolkitMicrosoft SQL Server Product Samples: DatabaseSilverlight ToolkitWindows Presentation Foundation (WPF)ASP.NETMicrosoft SQL Server Community & SamplesMost Active ProjectsDinnerNow.netRawrBlogEngine.NETSLARToolkit - Silverlight Augmented Reality ToolkitInfoServiceSharpMap - Geospatial Application Framework for the CLRCommon Context AdaptersNB_Store - Free DotNetNuke Ecommerce Catalog ModulejQuery Library for SharePoint Web Servicespatterns & practices – Enterprise Library

    Read the article

  • Is there a more intelligent way to do this besides a long chain of if statements or switch?

    - by Harrison Nguyen
    I'm implementing an IRC bot that receives a message and I'm checking that message to determine which functions to call. Is there a more clever way of doing this? It seems like it'd quickly get out of hand after I got up to like 20 commands. Perhaps there's a better way to abstract this? public void onMessage(String channel, String sender, String login, String hostname, String message){ if (message.equalsIgnoreCase(".np")){ // TODO: Use Last.fm API to find the now playing } else if (message.toLowerCase().startsWith(".register")) { cmd.registerLastNick(channel, sender, message); } else if (message.toLowerCase().startsWith("give us a countdown")) { cmd.countdown(channel, message); } else if (message.toLowerCase().startsWith("remember am routine")) { cmd.updateAmRoutine(channel, message, sender); } }

    Read the article

  • How to create Windows XP LiveUSB using Ubuntu to replace it

    - by Orion Clark
    I am using an Acer Aspire One netbook with no CD-disk drive, and would like to uninstall Ubuntu 12.04 LTS and install Windows XP in its place. The problem here is that I can't seem to find a program that can put the windows boot files on a USB drive from an ISO file. I have Ubuntu fully installed and have tried using unetbootin. When I tried booting from unetbootin I got a screen with a blue box that had the word "default" in it highlighted. underneath the box there was a countdown that said "will boot from default in 10" after the countdown finished the number would revert to ten and nothing would happen. Can someone tell me another program that would be useful for this please?

    Read the article

  • jquery timer plugin

    - by Hulk
    the link specified below is a jquery timer plugin. http://keith-wood.name/countdown.html Also i use the following to start a timer $('#timer').countdown({until: 12,compact: true, description: ' to Go'}); My question is how do i deduce that the timer has reached 00:00:00 or the time given has elapsed Thanks..

    Read the article

  • jquery session in asp.net

    - by boraer
    Hi everbody, I write a countdown timer in jquery and i need to keep some datas in a session when countdown ends. datas have to be sent to server to update. How can i handle this situation. I am new in jquery and asp.net so could you explain this briefly

    Read the article

  • jquery select divs with same id

    - by mark
    hei guys i want to select two divs with the same id in jquery. how do i do it? i tried this and it did not work jQuery('#xx').each(function(ind,obj){ //do stuff; }); i have jquery countdown timers in a page, and i update them via ajax. some of these countdown timers repeat and that is why i need to use the same id on the divs.

    Read the article

  • How to use javascript class from within document ready

    - by Richard
    Hi, I have this countdown script wrapped as an object located in a separate file Then when I want to setup a counter, the timeout function in the countdown class can not find the object again that I have setup within the document ready. I sort of get that everything that is setup in the document ready is convined to that scope, however it is possible to call functions within other document ready´s. Does anyone has a solution on how I could setup multiple counters slash objects. Or do those basic javascript classes have to become plugins This is some sample code on how the class begins function countdown(obj) { this.obj = obj; this.Div = "clock"; this.BackColor = "white"; this.ForeColor = "black"; this.TargetDate = "12/31/2020 5:00 AM"; this.DisplayFormat = "%%D%% Days, %%H%% Hours, %%M%% Minutes, %%S%% Seconds."; this.CountActive = true; this.DisplayStr; this.Calcage = cd_Calcage; this.CountBack = cd_CountBack; this.Setup = cd_Setup; } thanks, Richard

    Read the article

  • Can it be done in a more elegant way with the Swing Timer?

    - by Roman
    Bellow is the code for the simplest GUI countdown. Can the same be done in a shorter and more elegant way with the usage of the Swing timer? import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.SwingUtilities; public class CountdownNew { static JLabel label; // Method which defines the appearance of the window. public static void showGUI() { JFrame frame = new JFrame("Simple Countdown"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); label = new JLabel("Some Text"); frame.add(label); frame.pack(); frame.setVisible(true); } // Define a new thread in which the countdown is counting down. public static Thread counter = new Thread() { public void run() { for (int i=10; i>0; i=i-1) { updateGUI(i,label); try {Thread.sleep(1000);} catch(InterruptedException e) {}; } } }; // A method which updates GUI (sets a new value of JLabel). private static void updateGUI(final int i, final JLabel label) { SwingUtilities.invokeLater( new Runnable() { public void run() { label.setText("You have " + i + " seconds."); } } ); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { showGUI(); counter.start(); } }); } }

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8  | Next Page >