Dec 02
After going to GameDev ‘07 at Harvard with James Lindsay on Saturday, I got some motivation and decided to get my feet wet with the facebook api. I have created my first application which pulls pictures from the website www.xepic.net and displays them in your profile like so:

If you’d like to try out my application, you can find it here.
Jun 19
Over the past few days, I’ve been creating some rather large and confusing SQL queries, so I went on a hunt to see if maybe there was a visual aid that would make the selects, joins and sub queries easier. I was a bit disappointed to find that MySQL offered a Query Browser that wasn’t available for download… or was it?
After a little more research I came about a link to a slightly thinner client in the developer zone under the Generally Available (GA) license. I’ve played around with it a bit and while it wasn’t exactly what I was looking for, it’s helped me during those times I don’t feel like waiting on phpMyAdmin.
Check out this screencast to get a better idea of how this tool works. I’m sure I’ll grow to like this tool a lot more in the future, I just need to learn more about it’s functionality. I thought I’d pass this tip onto you.

Jun 08
Someone overheard a friend and I chatting about a website and it’s tag cloud script. I mentioned that it’s pretty easy to create and that I had already created a php function. He asked me to dig it up, so I present to you a cloud script in it’s simplest form.
Cloud
<?php
$ceiling = 50;
class cloud {
function setTop($top) {
global $ceiling;
$ceiling = $top;
}
function sizeMe($name,$times) {
global $ceiling;
$times = ($times / $ceiling) * 100;
if ($times <=20)
$size = 1;
else if ($times>=11 && $times <=40)
$size = 2;
else if ($times>=21 && $times <=60)
$size = 3;
else if ($times>=31 && $times <=80)
$size = 4;
else
$size = 5;
// You should really replace this with a return $size, this is just for demonstration purposes
echo "<span class=\"a$size\"><a href=\"#\">$name</a></span> ";
}
}
?>
It’s pretty straight forward and easily modified. You setTop based on the number of entries in your database, then pass $name and the number of times it appears to the sizeMe function. If you have any questions or suggestions please let me know. I tried to keep this simple.
In this example I created classes, a1, a2, a3, a4 and a5 that I defined font-size for in a css file.
Strip Characters From A Filename
<?php
function renameStripChars($directory, $pattern, $replacement, $verbose = false) {
if($curdir = opendir($directory)) {
while($file = readdir($curdir)) {
if($file != '.' && $file != '..') {
$dstfile = $directory . '/' . preg_replace($pattern, $replacement, $file);
$srcfile = $directory . '/' . $file;
rename($srcfile, $dstfile);
if(is_dir($srcfile) && $verbose) {
renameStripChars($srcfile, $pattern, $replacement, $verbose);
}
}
}
closedir($curdir);
}
}
// An example of how I used it
renameStripChars('picsTest', '/[^\w\d\.-\s]+/', '', true);
renameStripChars('picsTest', '/[\s]+/', '_', true);
renameStripChars('picsTest', '/[-]+/', '-', true);
renameStripChars('picsTest', '/[_]+/', '_', true);
?>
I wrote this function because I had a boatload of images with ridiculous characters in them and I wanted them out before I uploaded them somewhere. Most frameworks have a similar function built in but if you’re looking for a quick fix, this is perfect for you.