Example of Simple Retry Technique to Deal with Timeouts in Android

<div><a href="http://orderessayonlineon.com/">academic writing help online</a> – <a href="http://spyphoneapp-software.com/">software spy phone download</a> – <a href="http://iphonespyapponline.com/">iphone spy</a> – <a href="http://buyessay-onlinein.com/">coursework writing service</a> – <a href="http://cellphonespyappon.com/">spy cell phone voicemail</a> – <a href="http://orderessayonlineon.com/">do my essay for money</a> – <a href="http://cellphonespyappon.com/">cell phone spy iphone free</a></div> import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.URI; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import […]
Continue reading…

Enjoyed this post? Share it!

 
 

Create a countdown timer that counts back in Javascript

Div to show the countdown timer. <div id="showRemain"></div> Javascript code:   function countDown(){ var timeA = new Date(); var timeB = new Date("10/31/2000 03:04:05"); var timeDifference = timeB-timeA; if(timeDifference&gt;=0){ timeDifference=timeDifference/1000; timeDifference=Math.floor(timeDifference); var wan=Math.floor(timeDifference/86400); var l_wan=timeDifference%86400; var hour=Math.floor(l_wan/3600); var l_hour=l_wan%3600; var minute=Math.floor(l_hour/60); var second=l_hour%60; var showPart=document.getElementById(’showRemain’); showPart.innerHTML=wan+" hour "+hour+" minute " +minute+" Second "+second+""; if(wan==0 &amp;&amp; […]
Continue reading…

Enjoyed this post? Share it!

 
 

Using timers in c#

A simple program illustrating the usage of timers in c# using System; using System.Timers;   class TestTimer { public static void Main () { Timer timer = new Timer(); timer.Elapsed + = new ElapsedEventHandler(DisplayTimeEvent); timer.Interval = 1000; timer.Start(); timer.Enabled = true;   while (Console.Read ()! = ‘q’) { //————- } }   public static void […]
Continue reading…

Enjoyed this post? Share it!

 
 

Timing program execution in PHP using PEAR

We can use the PEAR Benchmark module to profile a program, to see how long each statement takes to execute. <?php require_once ‘Benchmark/Timer.php’; $timer =& new Benchmark_Timer(true); $timer->start();   // some program code here $timer->setMarker(’one’);   // some more program executed here $timer->setMarker(’two’);   // even yet still more program code here $timer->setmarker(’three’); // and […]
Continue reading…

Enjoyed this post? Share it!

 
 

Determine how much time a function takes to execute in PHP

To determine how much time a single function takes to execute, we can compare time in milliseconds before running the function against the time in milliseconds after running the function to see the elapsed time spent in the function. <?php $long_str = "this is a test to see how much time md5 function takes to […]
Continue reading…

Enjoyed this post? Share it!

 
 

PHP Find time ago between two times

/** * Formats a timestamp nicely with an adaptive "x units of time ago" message. * Only handles past dates. * @return string Nicely-formatted message for the timestamp. * @param $time Output of strtotime() on your choice of timestamp. */ function ago($time) { $time = strtotime($time); $delta = time() – $time; if ($delta < 60) […]
Continue reading…

Enjoyed this post? Share it!

 
 

Get file size and create time of file in PHP

All file have certain properties that can be displayed using PHP. These properties include the last access time, the last modified time, the last changed time, and the size of the file. Example: <HTML> <HEAD> <TITLE>Returning information about a file</TITLE> </HEAD> <BODY> <? print "The size of the file is "; print filesize( "samplefile.doc" ); […]
Continue reading…

Enjoyed this post? Share it!

 
 

XML-RPC Date/Time Data Type

An XML-RPC date/time data type is a primitive data type and specifies a date and a time value, up to the second. It follows the format YYYYMMDDTHH:MM:SS. using Year, month, day, hour, minute, and second conventions. The “T”, however, is a literal to separate Date and time representation. Since there is no date/time data type […]
Continue reading…

Enjoyed this post? Share it!

 
 

Calculate number of days between two given dates using PHP using strtotime?

The strtotime php function is used to parse any English textual datetime description into a Unix timestamp. This function will use the TZ environment variable (if available) to calculate the timestamp. It returns a timestamp on success, FALSE otherwise. Previous to PHP 5.1.0, this function would return -1 on failure. $date1 = date(‘Y-m-d’); $date2 = […]
Continue reading…

Enjoyed this post? Share it!

 
 

PHP time – Get current datetime as an integer

The time function is used to obtain the current time from the operating system to second accuracy. Syntax: integer time () The return value is an integer equal to the seconds since midnight before January 1, 1970. Example code: <?php   $Now = time();   echo ‘When this page was loaded, <br>’; echo "$Now seconds […]
Continue reading…

Enjoyed this post? Share it!