Blogging is a conversation, not a code.

Rasem, draw SVG images using ruby

April 17th 2011, 5:06 amCategory: Ruby 1 comments

The web is moving to HTML 5 where SVG images are the standard images to use. But how to generate SVG images to include? You might draw static SVG images and include them in your web site but this will not help with generated SVG images with dynamic data. Of course, you can read the complete specification of SVG and generate your own images; these are a few hundreds of pages; good luck with that :)

Access oDesk APIs in Ruby and Rails

July 12th 2010, 1:51 amCategory: Rails 2 comments

BadrIT has developed libraries to access oDesk APIs. Checkout Ruby Desk gem for desktop applications and its variant RoR Desk plugin for Rails applications.

Update 13-7-2010: Ruby Desk and RoR Desk are now officially listed on oDesk developer section. See and .

Skipping cache for POST actions in Apache

February 3rd 2010, 1:49 amCategory: Rails 1 comments

If you used page caching in a site that implements RESTful interface, you may face a problem. You could have multiple actions that share a single URL with different HTTP methods. For example, showing a document is served at /documents/1, while updating the same document is also at /documents/1. When I'm trying to update a document, the request is something like:

PUT /documents/1

If your Apache is not well configured, it may respond with a cached file at /documents/1.html. This is wrong because this file should be served for GET requests only. In fact, POST, PUT and DELETE actions should never be cached because they change server state. Investigating in this issue, I found the following snippet at my .htaccess file.

Among the three methods of caching views in Rails, I particularly prefer page caching. The main advantage of page caching is that it is delivered by the web server without accessing your Ruby on Rails server. In this blog post I'll describe how you can keep two separate caches: one for pc browsers and one for iPhone. You can easily extend it to support more than two versions.


In this tutorial I assume you are using Apache to serve your application with mod_rewrite and .htaccess files enabled.