8.30.09: Any side of the track is better than straight down the middle… maybe?

-
PHP: Dancing with the cURL
HTTP Authentication with cURL in the event I’m overdrawn at the memory bank.
$ch = curl_init(); $url = "http://myurl.com/plah.php?foo=value"; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_HEADER, 1); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY); curl_setopt($ch, CURLOPT_USERPWD, "user:pass"); curl_exec ($ch); curl_close ($ch);
-
Photos: Day #1
8.27.09:
Neglect. I’m going to attempt to make a visual catalog of daily experiences after having been inspired by my good friend, Nataline. -
PHP: Locator script
When asked to write a store location program in less than an hour, I developed this little utility. It uses my own MySQL class and clean() function which parses the POST/GET variables for any nastiness that might have occurred.
include('includes/class.mysql.php'); include('includes/functions.php'); clean(); // Clean up $_REQUEST for SQL injection $mysql = new mysql(); $zip = $_REQUEST[zip]; $city = $_REQUEST[city]; $digits = strlen($zip); //echo "Count: $digits
"; echo "\n\n"; echo " \n";\n"; while($i<1) { $q = ($zip) ? $mysql->query("SELECT * FROM stores WHERE zip LIKE '$zip%'") : $mysql->query("SELECT * FROM stores WHERE state = '$_REQUEST[state]' AND city LIKE '%$city%' ORDER BY zip ASC"); if(mysql_num_rows($q)) { while($r = mysql_fetch_assoc($q)) { echo "\t \n"; echo "- \n"; echo "\t\t
\n"; } $i++; } else if (strlen($zip) > 1) { $zip = substr($zip, 0, strlen($zip) - 1); } else { $i = 1; } } echo "".trim($r[chain])." \n"; echo "\t\t".trim($r[store])." \n"; echo "\t\t".trim($r[location])." \n"; echo "\t\t".trim($r[city])." \n"; echo "\t\t".trim($r[state])." \n"; echo "\t\t".trim($r[zip])." \n"; echo "\t - \n"; echo "\t\t
-
BASH: deleting files older than X number of days
find /path/to/folder -mtime +5 -exec rm -f {} \;A handy utility to stick into the old brain. Thank you, internet, for providing me such a vast and available resource so that I know longer have to rely on my own faculty of memory.
-
KC2VOD
I’m not transmitting as of yet, but it won’t be long now.
http://www.genesisradio.com.au/G40/ -
PHP: TrueType bounding box with GD
Just a snippet to print out the values in a bounding box. print_r’s simple outline format just makes it easier to visualize.
<?php $im = imagecreatetruecolor(800,600); $arr = imagettfbbox(30,0,'fonts/arial.ttf','this is a long string of text!'); print_r($arr); ?>


