Mobile Billing Meter

Billing Meter bit.ly link or Billing Meter tech0x20 link.

This isn't perfect. First of all, some connections are just too slow for a constant refresh rate of less than 20-30 seconds. Secondly, I think many mobile browsers have a refresh cut-off at which point they will ask you if you really want to keep refreshing.

The first page, index.php, allows you to enter parameters:

Billing Meter












Billing Rate per Hour
Update Interval (in seconds)
Press Submit to start the counter.


The second file, meter.php, does the display, calculation and refresh:
";

$netseconds = time()-$_SESSION["STARTTIME"];
$cost = sprintf("%10.2lf", round($_SESSION["BILLINGRATE"]*((double)$netseconds)/3600.0,2));
?>

Billing meter

Time spent:

".$time_counter[$i]."

";
}
?>

Your bill:

".$cost[$i]."

";
}
}
?>

$  

Two page mobile magic 8-ball

Two page mobile magic 8-ball

Had to use random numbers to prevent caching of pages by mobile web browsers. It's entirely possible that I made this workaround too complicated, as I had a file version problem on my local drive (I was updating the wrong file.)

The first page uses a random number in a hidden field with the POST method:

Magic 8-ball

Ask your question, and click the button for an answer.
";
?>

The second page appends a random number to the URL:


Magic 8-Ball

Magic 8-ball

The magic 8-ball says:

";
echo "Ask another question";

?>

Mobile Web Browser Magic 8-Ball

Magic 8-Ball.

I still want to be able to detect the whether mobile or not so that it will work (and be optimized) for where the user is coming from.

Magic 8-ball

The magic 8-ball says:

Tag Cloud for ftp blogger blogs

In the sidebar section for Blogger template, include:

The following is a modified version of tag cloud source I found.



define('PREFIX', 'labels/'); // for url
define('SEARCH_DIR', '/home/username/www/labels'); // server location of labels subdirectory

define('THIS_FILE', 'labels.php'); // name of labels file (this file)

if(file_exists(SEARCH_DIR.'_cloud_include_cache.php') &&
filemtime(SEARCH_DIR.'_cloud_include_cache.php')>(time()-(60*60)))
{
echo file_get_contents(SEARCH_DIR.'_cloud_include_cache.php');
}
else
{
build_cloud();
}

/**
* build_cloud builds a tag cloud from the labels files.
* It actually uses labels file size to determine font size... which does
* not necessarily coincide with number of posts for a given label.
*
* smallest file is assigned 100% font-size. largest file - 200%
* everything else is proportional in between.
*/
function build_cloud()
{
$output = '';
$files = array();
$dir = opendir(SEARCH_DIR);
$low_end=PHP_INT_MAX;
$high_end=0;
while($file = readdir($dir))
if($file != '.' && $file != '..' && $file != THIS_FILE && $file != CACHE_FILE)
{
$files[$file] = filesize(SEARCH_DIR."/".$file);
$low_end = min($low_end, $files[$file]);
$high_end = max($high_end, $files[$file]);
}
closedir($dir);
ksort($files);
foreach($files as $name=>$size)
{
$output .= "
"href="".PREFIX.
htmlentities($name)."">".
htmlentities(str_replace('.php','',$name))." ";
}
echo $output;

$fp = fopen(SEARCH_DIR.'_cloud_include_cache.html','w');
fwrite($fp, $output);
fclose($fp);
}
function get_style($low_end, $high_end, $size)
{
$net = $high_end - $low_end;
$font_size = (($size - $low_end) * 100) / $net + 100;

if(!$interval) $interval++;

return "font-size: ".$font_size."%;";
}
?>