Javascript Count Up Timer With Hours, Minutes, and Seconds

Posted: May 7th, 2012 | Author: | Filed under: javascript, web | No Comments »

Here is a script that takes a given time and increments each second to make it appear to update in realtime.

Time given, must be in hh:mm:ss format and the div id must be realtime

<span id="realtime">12:12:12</span>

12:12:12

Script that makes everything happen, needs jquery, but could be easily re-written in pure javascript.

$(document).ready (function () {
    startCount();
});
 
function startCount()
{
	timer = setInterval(count,1000);
}
function count()
{
	var time_shown = $("#realtime").text();
        var time_chunks = time_shown.split(":");
        var hour, mins, secs;
 
        hour=Number(time_chunks[0]);
        mins=Number(time_chunks[1]);
        secs=Number(time_chunks[2]);
        secs++;
            if (secs==60){
                secs = 0;
                mins=mins + 1;
               } 
              if (mins==60){
                mins=0;
                hour=hour + 1;
              }
              if (hour==13){
                hour=1;
              }
 
        $("#realtime").text(hour +":" + plz(mins) + ":" + plz(secs));
 
}
 
function plz(digit){
 
    var zpad = digit + '';
    if (digit < 10) {
        zpad = "0" + zpad;
    }
    return zpad;
}

Ubuntu 12.04 Mouse Stops or Hangs When Going To Other Monitor

Posted: April 27th, 2012 | Author: | Filed under: ubuntu, unity | 2 Comments »

After the latest update to Ubuntu you may have noticed that the mouse seems to get stuck when trying to go from one monitor to the other. The problem is the new “Sticky edges” settings. To fix this go to
System Settings->Displays
and flip the “Sticky edges” switch to “Off”

Ubuntu Display Settings Dialog - Sticky edges


MySQL First Character in a String

Posted: April 12th, 2012 | Author: | Filed under: rando | No Comments »
SUBSTRING(<STRING>,1,1)

Find Which Search Keyword For Page With Google Analytics

Posted: January 19th, 2012 | Author: | Filed under: google analytics, html | 1 Comment »

Open the ‘Traffic Sources’ drop down and click on ‘Overview’

Click on the Search Term/Keyword you are interested in

Click on the ‘Secondary Dimension’ drop down, expand ‘Traffic Sources’ and Click on ‘Landing Page’

View Glorious Data

Such Valuable Information. I really have to wonder why Google felt the need to bury so deep into the UI.