Archive

Archive for May, 2007

Rails 1.2 routes and the dot “.”

May 22nd, 2007 Dante Regis 2 comments

Rails 1.2 came with great new features. One of them was the REST able applications. Other was the ability to serve results based on how the request was made. So you could send different results for controller/action.html, controller/action.xml or contoller/action.rss, for example. This one came with a price though: If you had any routes on your site that uses a dot (“.”), it will not work on rails 1.2.

Why is that? Well, the dot “.” is now a route separator, just like the slash “/”. But, of course, there’s a way to work around it if you don’t plan to use the dot for specific actions. Just place a :requirements => {:yourparam => /.*/} to your routes.rb. Here is an example:

Before:

# Here I could use an username like “john.smith” or “lys.cohen”, but not on Rails 1.2
map.connect “books/feed/:username”, {:controller => :book, :action => :book_feed}
After Rails 1.2:

# Now it works on Rails 1.2
map.connect “books/feed/:username”, {:controller => :book, :action => :book_feed, :requirements => { :username => /.*/}}

It worked great for me. And, best of all, it does not break the functionality, so you can use dots as they are intended to be used on other controllers and even actions on the same controller.

This tip was extracted from TextDrive Forums

Categories: Uncategorized Tags:

Moving and using Firefox Plugins on Swiftfox

May 21st, 2007 Dante Regis 1 comment

So, have you ever heard of Swiftfox? If you are coming from google, probably yes. It is just like Firefox (the same source code) but it is compiled with optimizators for the major CPUs avaiable. So, it will perform better on your machine. It’s like having Firefox on Steroids. So, since it has the same source code, you can use your existing extensions (and install new ones) as well as use your plugins. There’s an platform independent installer on the website, but if it does not import the plugins for you, or, for some reason, you have installed it using another method (like Automatix, or tarball), you can create soft links from your existing plugins to use them on swift fox.

1. Go to /usr/lib/firefox/plugins

2. Do a ‘ls -l’ so that you can see where the link points to

3. Now, create links on /opt/swiftfox/plugins to the original files

Tip: ln receives the target and then the name for the link (I always misplace them)

Example:

Giving ls -l you find out that the java plugin (firefox-javaplugin.so) is in /etc/alternatives/firefox-javaplugin.so. So you do a

ln -s /etc/alternatives/firefox-javaplugin.so /opt/swiftfox/plugins/

Swiftfox will automatically use the new plugins.

Categories: firefox, howto, web Tags: