Author Archive

Here is a quick example of how to use PHP’s base convert function in AS3. A lot of people use this function for shorter masked URLs like YouTube. Easy enough but took me a minute to find the equivalent in actionscript. PHP: function encode36($x){ return base_convert($x, 10, 36); } function decode36($x){ return base_convert($x, 36, 10); [...]

In my previous post about email validation one user pointed out that this will not actually validate if a website’s domain actually exists. Here is a simple function that will do just that, determine if a website exists using PHP and cURL. Edit: After searching a bit, I found another similar cURL solution that checks [...]

Assuming you have a table called `users` with birthday as `bday` for the column name, this will pull all users who are having a birthday in the next 7 days. This is very useful if you want to showcase your member’s birthdays on your website. SELECT * FROM `users` WHERE DAYOFYEAR(curdate()) = dayofyear(`bday`) LIMIT 30; [...]

Goodbye MTV API

14, Feb 2009

About 7 months ago MTV released a promising API MTVN which opened up a ton of artist metadata and the ability to embed videos from MTV, VH1, CMT and Logo. Looks like they’re pulling the plug come March. As a developer and someone who uses the API, I am pretty upset about this. Thanks MTV [...]

Have you seen this error? If you work with Flash actionscript and Javascript, you probably have. It can be pretty frustrating the first time you see this error since it’s not very informative. In my experience, this happened when I was trying to communicate with actionscript via Javascript using ExternalInterface call. The problem was sure [...]

I see a lot of sites still using the long default Amazon S3 url so I thought this might be helpful to someone. Lets say I setup a bucket for images on this domain at images.wrichards.com.s3.amazonaws.com to serve all my images. I don’t really want to type out the extra s3.amazonaws.com bit everytime I link [...]

JQuery sort()

11, Feb 2009

Today I was trying to figure out how to sort a set of list item elements alphabetically using JQuery. Seems simple enough but after searching around I couldn’t find any ready made solution. The best I could find was JQuery Table Sort (which is a nice sorting package but not what I was looking for). [...]

PHP5 Email Validation

10, Feb 2009

In prior version of PHP you had to use some regex solution to validate an email address, now in PHP5 it’s as simple as: function isValidEmail($email){ return filter_var(filter_var($email, FILTER_SANITIZE_EMAIL), FILTER_VALIDATE_EMAIL); } if(isValidEmail(‘email@domain.com’)){ //valid } else { //not valid } I’ve been using PHP5 ever since it was released but didn’t look into the PECL Filter [...]

This has got to be one of the coolest things I have come across in a long time. Sphinx a standalone MySQL full-text search engine. I’ve been working with it for a couple weeks now and I must say, this thing is blazin’ fast. I was most impressed by performance on large data sets (60+ [...]

A few weeks back I ran into a rather odd situation when trying to load an xml file via Actionscript across multiple domains. No matter what I did, it would not load! Typical way to resolve this is to put a crossdomain.xml granting access to the swf host location right? Well, if you’re planning on [...]


top