scaling rails to a billion page view a month…

June 24th, 2008 tkadom

 Linked in built a rails app for facebook called bumper sticker which is currently handling a billion page views in a month.  This link has a great video discussing lessons learned…

Posted in Random | No Comments »

Ruby Security Issues!

June 22nd, 2008 tkadom

 

Drew Yao at Apple uncovered a handful of nasty security vulnerabilities affecting all current versions of Ruby. The details are still under wraps because an attacker can DoS you or possibly execute arbitrary code.

If you are the type who thinks all presents must be opened early, and who just cant stand stuff that is "still underwraps", check out zed’s investigation

 

 

Posted in Random | No Comments »

If you have heard the buzz on maglev from rubyconf…

June 16th, 2008 tkadom

 

Now you can see what all the buzz is about.  PArt one of the maglev talk is now online at vimeo.

 


MagLev presentation at RailsConf 2008 - part 1 from Monty Williams on Vimeo.

Posted in Random | No Comments »

Geocode an IP, and check for local events on eventful…

June 11th, 2008 tkadom

 I was reviewing a friends application this weekend and saw a nifty free IPGeocoding gem based off the maxmind geocoding library.  If you have ever wondered how websites can guess where you are, then you probably ran into a site that uses IPGeocoding.  Essentially your location is guessed based off your IP address.  the results are not always accurate, but for a good portion of the userbase they are close enough.  You can check out the library using the following steps:

	wget http://www.maxmind.com/download/geoip/api/c/GeoIP.tar.gz
	tar -zxvf GeoIP.tar.gz
	cd GeoIP
	./configure
	make
	sudo make install
	sudo gem install geoip_city   

	wget http://www.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
	gunzip GeoLiteCity.dat.gz
	sudo mkdir /usr/local/share/GeoIP
	sudo mv GeoLiteCity.dat /usr/local/share/GeoIP/GeoLiteCity.dat   

use irb to confirm install


        require 'rubygems'
        require 'geoip_city'
        g = GeoIPCity::Database.new('/usr/local/share/GeoIP/GeoLiteCity.dat')
        res = g.look_up('69.94.197.133')
        puts "lat: #{res[:latitude]} lng: #{res[:longitude]}"

Its that simple!  I did notice that upon installing the gem on a debian box, i was receiving a shared object library error.  This was corrected by exporting my LD_LIBRARY_PATH to include /usr/local/lib.  Alternately you could simply take the libraries that were installed in usr/local/lib and create symbolic links in /usr/lib.  A commercial version of their database is available for a fee.  (check out maxmind for more info)

 once that was working, i decided to take a look at events that might be happening in the area.  so i created a basic rails application, installed the eventful gem (sudo gem install eventfulapi), and created a geo controller.  i.e.

        class GeoController < ApplicationController
          require 'rubygems'
          require 'geoip_city'
          require 'eventful/api'

          GEOCODER = GeoIPCity::Database.new('/usr/local/share/GeoIP/GeoLiteCity.dat')

          def index
            @ip = request.remote_ip
            @location = GEOCODER.look_up(@ip.to_s)
            eventful = Eventful::API.new('REPLACEME')

            @citystate = "#{@location[:city]}, #{@location[:region]}"
            @results = eventful.call('events/search',
                            :app_key => 'REPLACEME',
                            :location => @citystate,
                            :date => 'Today',
                            :page_size => 25)

          end
        end

this controller pulls events for the location returned.  you can access the results in a view
via:

 <%= event['start_time'] %> - </td><td><%= link_to event['title'], event['url']%>

Posted in Random | 3 Comments »

railsconf 2008 in 36 minutes…

June 4th, 2008 tkadom

 Gregg Pollack of rails envy and Orlando RUG fame did this excellent summary video of rails conf 2008 which I found very helpful.

 


Railsconf in 36 minutes from Gregg Pollack on Vimeo.

Posted in Random | No Comments »