March 25, 2008
Thankfully we all survived Easter this year. To celebrate the resurrection of our savior we resurrected our servers into a new cluster at Engine Yard. The new cluster has plenty of room for us to grow as we need more resources. We didn’t kill our servers on Good Friday but we did have two hours of easter downtime right before midnight as we copied the database.
We discovered some new deployment recipes in the process.
Engine Yard has a gem eycap that allows remote caching and dramatically speeds up deployment for our plugin laden application. It works by checking out our code on the remote system. For every deploy the code is updated and then copied minus the .svn directories. That means an entire svn checkout is not needed!
First install the gem:
gem install eycap –source http://gems.engineyard.com
Then add this to your deploy.rb:
require ‘eycap/recipes’
set :deploy_via, :filtered_remote_cache
set :repository_cache, “/var/cache/somewhere”
The license included says anyone who has the software can use it so I think I’m allowed talk about it. Enjoy.

2 Comments |
Uncategorized |
Permalink
Posted by Chris Hobbs
March 21, 2008
Lazy Load Content

Sometimes a portion of your page takes a really long time to generate and render. Instead of allowing the user to spin his thumbs, you can display the bulk of content to user and send off a separate ajax request to gather the “slow” data. Lazy Load Content makes late loading a portion of your page through ajax as easy as setting up a remote_function call. With options to render fragment cached if they exist, and perform the late load if not, your app will fly like the sloth eating eagle.
Install
ruby script/plugin install http://arperftoolkit.rubyforge.org/svn/trunk/lazy_load_content/
Copy the file javascripts/lazyLoadContent.js into your public/javascripts folder and include it with prototype.js in your views.
The Basics:
In your rhtml or haml file:
<h1> I love giraffes.. basically </h1>
<% lazy_load(:remote => {:update => 'lazyLoadContent', :url => {:action => 'lazy_load_action'}})do -%>
<div id = "lazyLoadContent"> We wait while the giraffes are smelling themselves. </div>
<% end -%>
In your controller define the specified function
def lazy_load_action
render :text => 'The giraffes are ready!'
end
When the page loads, the loading text is displayed: We wait while the giraffes are smelling themselves.
Then after the ajax call we see: The giraffes are ready!
…….. and more………. Read the rest of this entry »
Leave a Comment » |
Uncategorized | Tagged: ajax, cache, eagle, fragment cache, javascript, late load, lazy load, performance, plugin, remote_function, ruby, ruby on rails, sloth |
Permalink
Posted by blythedunham
March 14, 2008
Porting native ruby gems to Win32 is a bitch. I have been using ruby-xslt for our XSLT needs on OS X for a while now and finally had to port it to Windows to support our minority of Windows developers.
Here is my advice for if you have to do this sort of thing:
Download the Windows SDK – turns out you can download the Windows development tools for free now. The web install wasted many hours of my time getting clogged and refusing to install and it would have been faster to just download the ISO in the first place. You don’t need all the .Net stuff.
Try to get rid of any shell scripts in the gem build process. There was a little shell to build the arguments to the linker to include the xslt libraries for example. I wasted a bunch of time trying to get it to run in the build process somehow when the real best answer was to look at the output in cygwin and put the equivalent flags straight into my Makefile.
There is a magic thing you have to do with manifests that I don’t even pretend to understand:
mt.exe -manifest my_lib_name.so.manifest -outputresource:my_lib_name.so;2
These blog posts by Al Hoang explain a lot.
You probably have to include msvcr80.dll with your thing which is installed and used by the SDK.
Replace non-portable library calls with portable calls back into Ruby, not with Windows native calls. There were a bunch of POSIX file calls in the ruby-xslt library for opening and reading libraries. Those kinds of things are really easy to replace by just calling methods on File from C.
I’d like to get this all cleaned up and made available with ruby-xslt so it can be used straight from the gem by Windows users. But it is extra work and gem install stuff is confusing and weird. Email me if ruby-xslt for Windows is something you are looking for though and maybe I will try to put some effort into it.
Oh, and these are the libxml2 and libxslt binaries precompiled for Win32.
Leave a Comment » |
Technology |
Permalink
Posted by Tom Bagby