Random useful data sets for developers

Posted in Development on February 24th, 2010 by Mike – Be the first to comment

It took close to 20 minutes of searching this morning for me to find a plain-text list of state names & abbreviations without any formatting or columns. I’m posting these here for my own reference and  my hope is others will find their way here. I’d like to pass on the feeling of relief that I experience when I find that someone out there has made the effort.

Country List
State Abbreviation List
State Name List

While I’m on the subject, another data set which has proven to be difficult to track down, but has been immensely useful to me on a number of occasions: a ZIP Code table which includes the fields: Zip, City, State, Latitude, Longitude, Timezone, and DST.

I’ve used this data to calculate distances, draw maps, handle timezone conversions, generate local search listings, and in many other functional and convenient applications. I have this table in two formats, it’s original: CSV, and my preference: SQL. If you’re using an SQL database, importing this should be painless.

ZIP Code Table

Edit: Added country list.

Drupal 301 Redirects

Posted in Drupal on February 10th, 2010 by Mike – Be the first to comment

Because of Drupal’s URL query structure, standard 301 redirects in your .htaccess file will not work. Here is a simple solution for this problem.

The following should be placed on the next line after “# RewriteBase /” and before

“# Rewrite URLs of the form ‘x’ to the form ‘index.php?q=x’.”

RewriteRule ^old/file.htm$ http://www.yoursite.com/new/file.htm [R=301,L]

For URLs with spaces in them, simply wrap the URL in quote tags, like so:

RewriteRule ^old/file.htm$ “http://www.yoursite.com/new file.htm” [R=301,L]

You must use the full URL for your site for these redirects, not just the relative path.

Hello world!

Posted in Development on February 8th, 2010 by Mike – Comments Off

Testing out the code highlighter.

function hello($who = "world"){
    print "Hello " . $who . "!";
}