RateMyArea - interesting rails bits

663 views

Published on

Slides from a presentation I gave at the Ruby Ireland Group

Published in: Technology, News & Politics
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
663
On SlideShare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

RateMyArea - interesting rails bits

  1. 1. Ciarán Lee
  2. 2. RateMyArea.com • Local-Social-Search • Starting off in Dublin • Launched 7 November • Rails app
  3. 3. Interesting things we have done • Search • Caching • iPhone web app
  4. 4. Search
  5. 5. Search = sphinx • moving from ultrasphinx to thinking_sphinx • more actively developed • nice syntax • we are overhauling search
  6. 6. geo-search • sphinx does this very well • insists on radians • ultrasphinx provides a nice interface # CREATE AN INDEX define_index do indexes :name has quot;RADIANS(latitude)quot;, :as => :latitude, :type => :float has quot;RADIANS(longitude)quot;, :as => :longitude, :type => :float end # RUN A SEARCH for popular bars nearby @bars = Listing.search(quot;barquot;, :per_page => 10, :page => 1, :geo => [deg2rad(@where.latitude), deg2rad(@where.longitude)], :order => average_rating DESC, :with => {quot;@geodistquot; => 0.0..2000})
  7. 7. caching - in order of preference 1. Page caching 2. Action caching 3. Fragment caching
  8. 8. Caching Page caching not possible if content changes for ANY user * Action caching can be used conditionally - for logged out users caches_action :show , :if => Proc.new { |controller| controller.send(:logged_out?) } * unless server side includes (SSI) are used
  9. 9. 20,000 action cached places But... the footer is dynamic How to keep the action cache but change the footer?
  10. 10. Server Side Includes Wikipedia: “As its name implies, its primary use is including the contents of one file into another one dynamically when the latter is served by a web server.” <!--# include virtual=quot;/ssi/footerquot; --> The webserver inserts the contents of the include before sending the response to the client http://blog.kovyrin.net/2007/08/05/using-nginx-ssi-and-memcache-to-make-your-web-applications-faster/ http://www.jkraemer.net/tags/nginx
  11. 11. also... • Object caching can be handy for expensive queries • these objects can be fetched out of request/ response cycle (we use workling for this) • don’t keep page cache in RAILS_ROOT/public - this will preserve it through redeploys http://blog.hasmanythrough.com/2008/1/30/segregated-page-cache-storage
  12. 12. RateMyArea on your mobile (if you have an iPhone) • We like MobileSafari! • iUi used for the interface • development has stalled • good starting point... • Flickr agree with copied us :) http://code.flickr.com/blog/2008/10/27/lessons-learned-while-building-an-iphone-site/
  13. 13. RateMyArea on your mobile (if you have an iPhone) • No access to CoreLocation through the browser :( • phonegap can fix this • native iPhone app • wraps a web-app • really is a site specific browser • http://github.com/sintaxi/phonegap/tree/master
  14. 14. Maps on the iPhone • Native app is really nice • can render kml • different firmware versions have different capabilities :(
  15. 15. Thank You keepusbusy@ratemyarea.com

×