Archive for the 'Coding' Category

Debug function for FireBug

If you do much JavaScript coding and have FireBug odds are good you know that you can call console.info() to output to the FireBug console. But what happens if you leave your console.info() call in your code and a visitor looks with IE? It'll throw an error. So here's a quick, little function that will [...]

isApache() and isIIS() functions for PHP

A couple quick little functions for when you need to know if you're running on Apache or IIS. PLAIN TEXT PHP: function isApache()     {     return ((bool) preg_match('/Apache/i', $_SERVER['SERVER_SOFTWARE']));     } function isIIS()     {     return ((bool) preg_match('/IIS/i', $_SERVER['SERVER_SOFTWARE']));     } isApache() will return true if it's [...]

Java code practice on JavaBat

Looking for a place to polish up your Java skills?  Try JavaBat.  It's a library of short Java projects that you fill in the code and it'll check if for you.

Dice Sprites in GIF format

After spending about 20 minutes trying to find a good set of graphics for a dice rolling script I was working on I decided it was faster to just create my own. 5 minutes in Photoshop and I was done. There are individual files for each of the 6 die faces, an animated version cycling [...]

Trimming array elements in PHP

Several times I've had a user setting that was separated by commas that I needed to split out into an array. People, correctly, put a space after commas. But for the array the space shouldn't be there. Here's a quick tip to strip out those leading spaces. PLAIN TEXT PHP: $array = array_map('trim', $array); array_map [...]