howtos » 2008 » August

If a user types in or follows a URL that does not exist on a website they are usually taken to a 404 (page not found) page.  Returning a standard 404 page to your user tends to provide a less-than-optimal user experience and may cause you to lose them altogether. 

A solution is now at hand.  Create a custom 404 page and embed a Webmaster Tools 404 widget into it.  The 404 widget helps your visitors find what they’re looking for by providing suggestions based on the incorrect URL.  It also provides a link to the parent subdirectory, a sitemap webpage, and a site search query suggestions and search box.

The Google Maps API is a great way to utilise Google’s Maps platform on your own website. The standard Maps API, however, does not work in e-mails as it is reliant on JavaScript which most (if not all) e-mail clients block.



Luckily there is a solution thanks to the Google Static Maps API. The Static Maps API generates an image file that can be embedded into your HTML content (like below). Because it is an image, and there is no JavaScript involved, mail clients will display such a map. You can specify the location of the map, the size of the image, the zoom level, the type of map, and the placement of optional markers at locations on the map using the API. For example:



Singapore MRT stations



Sydney - Pitt St Mall to Hyde Park



Getting started is easy!

  1. Sign up for a Google Maps API key
  2. Use the Google Static Map Wizard to create your first static map
  3. Read the Google Maps Static API documentation



This method is great for also providing map content in other mediums that don’t support JavaScript - such as mobile content.

Disclaimer: I’m a Python newbie … if you know of a more efficient way let me know!

I needed to take a sequence of 4 digits (eg 1145) and modify it to look like clock-time (eg “11:45″). After a bit of online (what else?) research I decided to take the approach of converting the integer to a string and then to a list (of characters). I then insert the extra character (ie the “:”) into the list at the right position. Finally, join the list elements together to form a new string.


time_int = 1145
time_str = str(time_int)
time_list = list(time_str)
time_list.insert(2, ‘:’) #insert the ‘:’ character into the list before position 2
time_str = “”.join(time_list)