April 10, 2007

Firefox, MySQL, Rails quirks

Posted by Sudhindra Rao

Firefox


Firefox 2.0 has a new feature. It can remember sessions and reopen/reconnect to the same urls if Firefox was closed abruptly.


This helps a lot when you have to restart your Windows machine every so often. This feature becomes annoying especially when you want to automatically open Firefox, run Selenium tests and then close it.


Since this closing of the browser is considered abrupt(even though the tests are done the browser process is killed when we automate with Selenium) and the next time you open firefox - a popup appears asking you whether you want to 'Restore Session'. For the automation programs it is almost impossible to detect this pop-up and interact with it.


Firefox allows you to disable this feature and much more.


The trick is to type 'about:config' in your Firefox address box. It shows you all the parameters you can set(including the ones for your plugins/addons).


There is a cool filter which lets you narrow down your search for a parameter and change it. The one I am referring to for 'Restore Session' is 'browser.sessionstore.enabled'


Rails 1.2 and '.' separators


Starting Rails1.2 routes.rb makes as reserved and you cannot use a '.' in your routes.


Enter :requirements - The workaround to using '.' in your route elements.


For example:


map.connect '/:controller/:action/:id', :controller => 'wiki_pages', 
:action => 'show',
:requirements => {:id => /.*/}

This allows :id to contain '.'s. A nice thing to note is that it supports any regexp.(ref : http://forum.textdrive.com/viewtopic.php?pid=116742)


MySQL and Windows


MySQL goes away(ref : http://dev.mysql.com/doc/refman/5.0/en/gone-away.html) literally a number of times during the day on Windows. The solutions mentioned in this document


seem reasonable and logical but do not necessarily work. What worked this time is a machine restart. I also tried tweaking and setting all timeout values to a very large number but the problem does not completely go away.


Roderick wrote this MySQL-Ruby-Windows thing. Worth a try if it can fix the windows timeout issue.




 Tags: , , , , , , selenium



0 comments:

Welcome