From: Ruby Quiz Date: 2007-09-14T21:31:41+09:00 Subject: [QUIZ] IP to Country (#139) The three rules of Ruby Quiz: 1. Please do not post any solutions or spoiler discussion for this quiz until 48 hours have passed from the time on this message. 2. Support Ruby Quiz by submitting ideas as often as you can: http://www.rubyquiz.com/ 3. Enjoy! Suggestion: A [QUIZ] in the subject of emails about the problem helps everyone on Ruby Talk follow the discussion. Please reply to the original quiz message, if you can. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= This week's Ruby Quiz is to write a simple utility. Your program should accept an IP address as a command-line argument and print out the two letter code for the country that IP is assigned in. You can find a database for the matching at: http://software77.net/cgi-bin/ip-country/geo-ip.pl To keep the problem interesting though, let's write our programs with a focus on speed and memory efficiency. $ time ruby ip_to_country.rb 68.97.89.187 US real 0m0.314s user 0m0.259s sys 0m0.053s