Search Results

Search found 5 results on 1 pages for 'oneminute'.

Page 1/1 | 1 

  • Add leading zeros to this javascript countdown script?

    - by eddjedi
    I am using the following countdown script which works great, but I can't figure out how to add leading zeros to the numbers (eg so it displays 09 instead of 9.) Can anybody help me out please? Here's the current script: function countDown(id, end, cur){ this.container = document.getElementById(id); this.endDate = new Date(end); this.curDate = new Date(cur); var context = this; var formatResults = function(day, hour, minute, second){ var displayString = [ '<div class="stat statBig">',day,'</div>', '<div class="stat statBig">',hour,'</div>', '<div class="stat statBig">',minute,'</div>', '<div class="stat statBig">',second,'</div>' ]; return displayString.join(""); } var update = function(){ context.curDate.setSeconds(context.curDate.getSeconds()+1); var timediff = (context.endDate-context.curDate)/1000; // Check if timer expired: if (timediff<0){ return context.container.innerHTML = formatResults(0,0,0,0); } var oneMinute=60; //minute unit in seconds var oneHour=60*60; //hour unit in seconds var oneDay=60*60*24; //day unit in seconds var dayfield=Math.floor(timediff/oneDay); var hourfield=Math.floor((timediff-dayfield*oneDay)/oneHour); var minutefield=Math.floor((timediff-dayfield*oneDay-hourfield*oneHour)/oneMinute); var secondfield=Math.floor((timediff-dayfield*oneDay-hourfield*oneHour-minutefield*oneMinute)); context.container.innerHTML = formatResults(dayfield, hourfield, minutefield, secondfield); // Call recursively setTimeout(update, 1000); }; // Call the recursive loop update(); }

    Read the article

  • How to get user input for 2 digit data

    - by oneMinute
    In a HTML form user is expect to fill / select some data and trigger an action probably a http-post. If your only requested data field is a "2 digit" you can use html text input element get some data. Then you want to make it useful; enable user easily select data from a 'html select' But not all of your data is well-ordered so eye-searching within these data is somehow cumbersome. Because your data is meaningful with its relations. If there is no primary key for foreign key "12" it should not be shown. Vice versa if this foreign key occurs a lot, then it has some weight and could be displayed with more importance. So, what will be your way? a) Use text input to get data and validate it with regex, javascript, ... b) Use some dropdown select. c) Any other way ? Any answer will appreciated :)

    Read the article

  • UILocalNotification crash

    - by Miky Mike
    Hi everyone, could you please help me ? I'm setting up an UILocalNotification and It crashes when I try to set its userInfo dictionary. My dictionary is not empty (It contains 88 objects). Here is the code : NSDictionary* myUserInfo = [NSDictionary dictionaryWithObject: fetchedObjects forKey: @"textbody"]; UILocalNotification *localNotif = [[UILocalNotification alloc] init]; if (localNotif == nil) return; // défining the interval NSTimeInterval oneMinute = 60; localNotif.timeZone = [NSTimeZone localTimeZone]; NSDate *fireDate = [[NSDate alloc]initWithTimeIntervalSinceNow:oneMinute]; localNotif.fireDate = fireDate; localNotif.userInfo = myUserInfo; [fetchedObjects release]; and the console gives me this : Property list invalid for format: 200 *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'unable to serialize userInfo: (null)' Any idea ?

    Read the article

  • javascript error : periodLookup[periodStr] is undefined, why is it throwing this error?

    - by Mo
    Hi i have this method: set_period_help_text: function(periodInput){ var metric = MonitorMetric.getSelectedMetric(); var periodStr = $('select[name=metric_period]').val(); var datapoints = Number(periodInput.attr("value")); var period = datapoints * periodLookup[periodStr][0]; } var periodLookup = { "OneMinute": [1, "minute"], "FiveMinute": [5, "minute"], "OneHour": [1, "hour"], "OneDay": [1, "day"], "OneWeek": [1, "week"] }; where var periodStr is being retrived from a dropdown menue that only has the values: "OneMinute" "FiveMinute" "OneHour" "OneDay" "OneWeek" i get a java script error when the page loads: periodLookup[periodStr] is undefined [Break on this error] var period = datapoints * periodLookup[periodStr][0];

    Read the article

  • How to 'hide' spurious "declared but never used" warnings?

    - by Roddy
    I'm using the C++Builder compiler which has a minor bug that certain static const items from system header files can cause spurious "xyzzy is declared but never used" warnings. I'm trying to get my code 100% warning free, so want a way of masking these particular warnings (note - but not by simply turning off the warning!) Also, I can't modify the header files. I need a way of 'faking' the use of the items, preferably without even knowing their type. As an example, adding this function to my .cpp modules fixes warnings for these four items, but it seems a bit 'ad-hoc'. Is there a better and preferably self-documenting way of doing this? static int fakeUse() { return OneHour + OneMinute + OneSecond + OneMillisecond; }

    Read the article

1