Search

Archive for the 'Coding' Category

Date diff in PHP

Posted by John on July 15th, 2003

I needed this, and didn’t find a ready-made solution (there are, no doubt, billions of ready-made solutions, but I refuse to go searching through those hideous directories of code snippets to find them). It seems to work with all modern dates, and I’ve tested it reasonably well, trying a number of different cases, but [...]

Decoding UTF-8

Posted by John on May 24th, 2003

Below is a PHP function that reads UTF-8 encoded text and spits out entity-encoded text suitable for use in webpages (with the proper character encoding set, of course). I know that 99.6% of won’t have any use for this whatsoever, but since I couldn’t find an example of this on the Internet and had [...]

l33t SQL skillz

Posted by John on May 17th, 2003

Since I started my current job (the first time) I’ve had ample opportunity to build and refine my SQL skills. I started with only the vaguest idea of the syntax, which seemed arcane at best and totally unusable at worst, and no practical experience. I was forced to learn quickly, and it has paid [...]

Stop awk’ing at me

Posted by Jordan on May 14th, 2003

This is normal. Really. Lately I’ve taking to using awk for all my shell programming tasks. Awk is wonderful. Want to only output lines of text where 25 is in the 6th column of text? Sure thing:
awk ‘ ~ /25/’

How about something complicated? You want to take a unix [...]