If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!
I decided about a week ago that I wanted to try Erubis with a Rails project to see if I got any performance boost. So after reading the documentation, it appeared to be straightforward to install. So I did.
But I discovered that the latest Erubis (2.6.4) and Rails 2.3 are not compatible. After doing some googling and looking at stackoverflow solutions, the problem was still not resolved. So I started to dig into the problem.
I found that the main issue is that the generated ruby code from Erubis uses “_buf” as the buffer variable and Rails 2.2 and 2.3 require “@output_buffer” to be used.
The reason for “@output_buffer” to be used is that ActionView helpers like CaptureHelper are designed around “@output_buffer” being the primary buffer in the generated code.
I have created a gem called elkinsware-erubis_rails_helper that fixes these issues and allows Erubis and Rails 2.3 (for sure but it should work for 2.2).
Here is how to use it:
inside config/environment.rb and the following
config.gem 'erubis' , :version => '2.6.4'
config.gem 'elkinsware-erubis_rails_helper', :lib => 'erubis_rails_helper', :source => 'http://gems.github.com'
You can customize some of the options for Erubis still if you want to by adding config/initializers/erubis_config.rb to your initializers folder
#Erubis::Helpers::RailsHelper.engine_class = Erubis::Eruby # or Erubis::FastEruby
#Erubis::Helpers::RailsHelper.init_properties = {}
#Erubis::Helpers::RailsHelper.show_src = false
#Erubis::Helpers::RailsHelper.preprocessing = true
The source is at http://github.com/elkinsware/erubis_rails_helper/tree/master
Let me know if you have any issues with the gem.
Share and Enjoy:
These icons link to social bookmarking sites where readers can share and discover new web pages.
Tags: Rails Plugins · code · rails
April 10th, 2009 · 1 Comment
This is a list of steps I took to setup a headless XServer and CutyCapt on Ubuntu. Please let me know if you run into any issues using these steps.
The first set of steps is to get the requirements for CutyCapt installed and the Headless XServer setup.
sudo apt-get update
sudo apt-get -y install build-essential
sudo apt-get install xvfb
sudo apt-get install xfs xfonts-scalable xfonts-100dpi
sudo apt-get install libgl1-mesa-dri
sudo apt-get install subversion libqt4-webkit libqt4-dev g++
Now lets download and install CutyCapt. Then we will run a couple of tests to make sure it is working properly.
svn co https://cutycapt.svn.sourceforge.net/svnroot/cutycapt
cd cutycapt/CutyCapt
qmake
make
xvfb-run --server-args="-screen 0, 1024x768x24" ./CutyCapt --url=http://www.google.com --out=example.png
xvfb-run --server-args="-screen 0, 1024x768x24" ./CutyCapt --url=http://www.google.com --out=example.html --out-format=html
I hope this helped and let me know if you have any feedback.
update: Per Paul’s comment, you may need to enable the aptitude backports repository in /etc/apt/sources.list, as this is off by default, to get the libqt4 libraries.
references
http://corpocrat.com/2008/08/19/how-to-install-xvfb-x11-server-in-linux-server/
http://cutycapt.sourceforge.net/
http://www.wonko.be/2008/01
Share and Enjoy:
These icons link to social bookmarking sites where readers can share and discover new web pages.
Tags: code · install · web
Tags: AWS · code · web
http://pivotallabs.com/users/steve/blog/articles/746-inspect-running-ruby-processes-using-xray-and-kill-3
This is great when you need to figure out what a ruby process is doing and adds more visibility what is happening in real time.
Share and Enjoy:
These icons link to social bookmarking sites where readers can share and discover new web pages.
Tags: code · rails
An interesting article about how FriendFeed uses battled tested technology (MySQL) in new and innovate ways to meet their needs.
http://bret.appspot.com/entry/how-friendfeed-uses-mysql
Share and Enjoy:
These icons link to social bookmarking sites where readers can share and discover new web pages.
Tags: code · scaling · web
http://axonflux.com/building-and-scaling-a-startup
Share and Enjoy:
These icons link to social bookmarking sites where readers can share and discover new web pages.
Tags: code · rails · scaling · web
http://www.therailsway.com/2009/2/22/file-downloads-done-right
Share and Enjoy:
These icons link to social bookmarking sites where readers can share and discover new web pages.
Tags: code · rails · scaling · web
A good article, with lots of tips, about protecting your privacy on facebook.
http://www.allfacebook.com/2009/02/facebook-privacy/
Share and Enjoy:
These icons link to social bookmarking sites where readers can share and discover new web pages.
Tags: Uncategorized
If anyone is trying to install rfuzz and/or eventmachine on windows and are having trouble here is how I got them installed.
gem install rfuzz –version=0.8
gem install eventmachine –version=0.12.0
These seem to be the latest versions that have windows binaries version. You may need OpenSSL installed for eventmachine. For that, go here http://www.slproweb.com/products/Win32OpenSSL.html.
It is also a good idea to have nmake in your PATH.
Hope this helps.
Share and Enjoy:
These icons link to social bookmarking sites where readers can share and discover new web pages.
Tags: code · rails
Matt Raible has a good article about starting a web company with a lot of great advice and he promises more articles to come.
http://raibledesigns.com/rd/entry/how_to_setup_your_own
Share and Enjoy:
These icons link to social bookmarking sites where readers can share and discover new web pages.
Tags: business · web