Blog

eXorithm – Execute Algorithm: View / Run Algorithm xithm_world_stats_population

function xithm_world_stats_population ($country_list
{
  $connectionmysql_connect"xithmdb.aktiv.com""duppie""exorithm");
  $y = array();
  if$connection) {
    $db=@mysql_select_db"xithm"$connection);
    
    $sql = "select * from country_population"
    ifis_array$country_list)){
      ifcount$country_list) > 0) {
        $sql .= " where country in ("
        for ($ii=0; $iicount$country_list); $ii++) {
          $sql .= "'"mysql_real_escape_string$country_list$ii])."',"
        }
        $sql .= "'')"
      }
    }
    $mysql_result=@mysql_query$sql$connection);
    while ($rowmysql_fetch_array$mysql_result)) {
      $y$row[0]] = $row[1];
    }
    @mysql_close$connection);
  } else {
    throw new Exception"Could not connect.");
  }
  return $y

eXorithm – Execute Algorithm: History For Algorithm show_address

show_address     version 0.6     Given an address, show the location on a map.
Version Note Created Diff
0.6 [edit fix for new API Mar 11, 2013 09:09 am by Mike Campbell
0.5 [revert Dec 1, 2012 12:39 am by Mike Campbell
0.4 [revert Nov 28, 2012 06:41 am by harrison7042
0.3 [revert Nov 28, 2012 06:41 am by harrison7042
0.2 [revert Oct 3, 2010 11:52 pm by Mike Campbell
0.1 [revert Sep 28, 2010 05:10 pm by Mike Campbell

eXorithm – Execute Algorithm: View / Run Algorithm invert_image

function invert_image ($image
{
  $image_width = imagesx$image);
  $image_height = imagesy$image);
  
  // if the image is not true color, make it so
  if (!imageistruecolor$image)) {
    $image2 = imagecreatetruecolor$image_width$image_height);
    imagecopy$image2$image,0,0,0,0,$image_width$image_height);
    $image = $image2
  }
  
  // loop through all the pixels
  for ($h = 0; $h < $image_height$h++) {
    for ($w = 0; $w < $image_width$w++) {
      // get the color at this pixel
      $color = imagecolorsforindex$imageimagecolorat$image$w$h));
      // invert the color
      $color'red'] = 255 - $color'red'];
      $color'green'] = 255 - $color'green'];
      $color'blue'] = 255 - $color'blue'];
      // create the new color
      $new_color = imagecolorallocate$image$color'red'], $color'green'], $color'blue']);
      // set the color
      imagesetpixel$image$w$h$new_color);
    }
  }
  
  return $image