Lamdas and Procs [Note to self]
on Robert Sosinski blog an excellent article on understanding ruby and block.
http://www.robertsosinski.com/2008/12/21/understanding-ruby-blocks-procs-and-lambdas/
A company developing multitouch solutions #bookmarking
I was browsing TED and found this demo of Jeff Han breakthrough in touchscreen solutions.
His company is Perceptive Pixel , that breaks that wall of point and click user interfaces..
on Ruby1.9 installation 2
my box:
mpagalan-203:~$lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 9.04 Release: 9.04 Codename: jaunty mpagalan-203:~$ruby --version ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux] mpagalan-203:~$gem --version 1.3.1 mpagalan-203:~$irb --version irb 0.9.5(05/04/13) mpagalan-203:~$irb irb(main):001:0>RUBY_VERSION #=>"1.8.7"
Now you got a sense of my box, I want to install ruby1.9 side by side with ruby1.8
mpagalan-203:~$sudo apt-get install ruby1.9 -o program-suffix=1.9 The following extra packages will be installed: libreadline-ruby1.9 #this tells you that ruby1.9 will be installed in your system mpagalan-203:~$ruby1.9 --version ruby 1.9.0 (2008-06-20 revision 17482) [i486-linux] #now install irb and rubygems mpagalan-203:~$sudo apt-get install irb1.9 -o program-suffix=1.9 mpagalan-203:~$sudo apt-get install rubygems1.9 -o program-suffix=1.9 #test the installation mpagalan-203:~$irb1.9 irb(main):001:0>RUBY_VERSION #=>"1.9.0" mpagalan-203:~$gem1.9 list *** LOCAL GEMS *** #got empty gems, since need to install gem using the new ruby
thats it now I have ruby1.9 and ruby1.8 running side by side in my box
Ajax Load Google Maps Markers in paginated [part2]
#hompage/index.hmtl.erb
now we need to handle the request on markers_controller#index with json request format.
#markers_controller.rb
def index
@markers = Marker.paginate :conditions => {:approved => true}, :per_page => 100, :page => params[:page]
respond_to do |format|
format.html {}
format.json do
@markers.json
end
end
end
now we benchmark again to see of any improvements to the request time
mpagalan:/needs_performance_optimization$ab -n 100 -c 100 http://localhost:3000/ Time per request: 62414.935 [ms] (mean) Time per request: 624.149 [ms] (mean, across all concurrent requests)
Ajax Load Google Maps Markers in paginated [part1]
Was bumped into optimized an existing code that is querying 1000+ of data in the db and display it into the Google Maps as markers. The goals are:
- reduce the request time
- reduce the document size to reduce bandwith
- make the 1000+ markers intuitively presented to the client
The current implementation is working correctly and using a robust marker clustering methods. Before diving into the code or chaingin, I did some profiling first. Using Apache "ab" an http based benchmarking tool. A well written guide for performace testing your Rails application can be found here http://guides.rubyonrails.org/performance_testing.html. The benchmarking shows that application needs somehow of tweaking to be done.
mpagalan:/needs_performance_optimization$ab -n 100 -c 100 http://localhost:3000/ Time per request: 200419.935 [ms] (mean) Time per request: 2004.199 [ms] (mean, across all concurrent requests)
Hurdles of Typo 5.3 in Heroku
I was recently revisiting an old and one of most powerful Ruby on Rails blogware, Typo
As the description says this is quite an old project that housed lots of different people. The current developers of this project are Piers Cawley, Frederic de Villamil, Scott Laird and Cyril Mougel.
Okay so much for Typo background. So went to Github and forked and clone the project. First in mind was to make Typo run it in the local before running it in Heroku.
just another acts_as_tracked
this was my 2nd published plugin that ive created after a controversial project in early 2008.
the plugin attempts to create archives known as tracks. it does track objects that are deleted, edited. The plugins need more work but, the primary functionality are working as expected. The code can be downloaded here (http://code.google.com/p/acts-as-tracked/)
Future plans is to migrate it to Github.