Monthly Archives November 2005

Escaping URLs vs escaping HTML

I often get confused between two types of escaping you need to do when developing web applications: URL escaping and HTML escaping. This is a short note about when should you use what.
URL Escaping (or HTTP encoding or URL encoding) is used to escape the characters not allowed to be permitted for a URL (e.g. [...]

Playing mp3 links right in your browser

The del.icio.us folks have a nifty javascript piece of code which adds a small button to all the mp3 links on your webpage. (This infact embeds a small shockwave/flash script for each link). All you need to do is include the following code in the head section of your webpage:

<script type="text/javascript" src="http://del.icio.us/js/playtagger"></script>

Here is a link [...]

Yahoo Geocoding in ruby…

Find lattitude and longitude of any address
Yahoo just released a new beta of their maps webservice. Here is a small ruby script (inspired by Rasmus’s PHP code ) that I wrote that returns Lattitude, Longitude of the address provided…

require ‘open-uri’
require “rexml/document”
include REXML
url=’http://api.local.yahoo.com/MapsService/V1/geocode?appid=yahoomap.rb&location=’
puts ‘Enter Location: ‘
address=gets
address=URI.escape(address)
result=URI(url+address).read
doc = Document.new result
r=doc.elements["/ResultSet/Result"]
print “Precision: “, r.attributes["precision"],”\n”
r.children.each { |c| print c.name, [...]