Archive - Nov 21, 2006

Date
  • All
  • Jan
  • Feb
  • Mar
  • Apr
  • May
  • Jun
  • Jul
  • Aug
  • Sep
  • Oct
  • Nov
  • Dec

Google Apps for Your Domain

Google Applications are known to be fast, efficient and useful. A Google like Email, IM and calender service for a small site is desirable but unthinkable because of the amount of work involved. Webmasters have times wishing Google just open source everything it got and they can feast on the codes for years. Unfortunately, Google did not open source all it's product, but it offers it's applications to all webmasters with a domain, includes the most popular Gmail and Google Talk. Go to the Google Apps for Your Domain page and sign up for yourself.

Editor Comment:

Extreme Useful! Provided by Google! what more do I have to say to let you click the link?

Some math functions

Some Math Functions might be helpful

//greatest common denominator of 2 numbers
// thx to xJeff at lifelesspeople.com
function gcd($a, $b) {
  if ($b == 0) return $a;
  else return gcd($b, $a % $b);
}
//greatest common denominator of an array
//thx to pterodactyl at lifelesspeople.com
//for the use of array_splice(smart)
function math_gcd_array($array){
   while (count($array) > 1) {
       array_splice($array, 0, 2, gcd($array[0], $array[1]));
   }
   return $array[0];
}
//Least Common Multiple
//Thx to Wikipedia

log() VS log10()

here is the code

 $i = 0;
  $timeparts = explode(' ',microtime());
  $starttime = $timeparts[1].substr($timeparts[0],1);
while ($i< 100000){
	++$i;
	log(3);
	log(3.14324);
}
  $timeparts = explode(' ',microtime());
  $endtime = $timeparts[1].substr($timeparts[0],1);
  echo 'Time for log()',bcsub($endtime,$starttime,6),'<br />';
 
 
$i = 0;
  $timeparts = explode(' ',microtime());
  $starttime = $timeparts[1].substr($timeparts[0],1);
while ($i< 100000){
	++$i;
	log10(3);
	log10(3.14324);
}
  $timeparts = explode(' ',microtime());
  $endtime = $timeparts[1].substr($timeparts[0],1);
  echo 'Time for log10()',bcsub($endtime,$starttime,6),'<br />';

Result sometime showing that log10() is slightly faster than log(). other times, log() tops log10(). and it is happening on the same server. This means to find log$base$number, either log($number)/log($base) is about the same with log10($number)/log10($base).

Editor Comment:

Maybe we need a better testing machine, because looks like this server got some problem. and my computer got strange problem too. So all my benchmarks are not 100% accurate. what's the real result? :useless:

Honey Pot that kill bots