Posted by: Vijay Dev on: January 1, 2010
I have had the chance to work on a Rails project this December and learned quite a lot in the process. My earlier reading and trying out some sample applications surely helped. However, doing a real life project gave more insights and knowledge about the framework. So here I am, trying to document some of those learnings, niceties and weirdos (in no particular order).
Rake is cool! One of the gotchas is that the command “rake -T” displays only those tasks that have descriptions. Also, found a nice way to pass parameters to rake tasks here – the parameters need to be passed are listed next to the task name as below. When this idiom is being used, the usual way of specifying the dependency tasks does not work. We need to use “:needs” explicitly and specify the dependencies. “args” is a hash of all the parameters that are passed to the task.
task :truncate_table, :db_name, :tbl_name, :needs => [:environment, :load_config] do |t, args|
Providing a drop down of time zones is so simple using the time_zone_select helper method. The priority_zones option is a nice way to specify some time zones up front so as to avoid the hassle of going through the entire list.
There is also a country_select plugin that gives a drop down of countries. Seems that this functionality was available earlier in Rails and later extracted out as a plugin.
All files in config/initializers are loaded at server start-up. Application level constants can be written in a file, say, constants.rb and saved in this folder and accessible from anywhere in the application.
One of the things that tripped me early on is the need to restart the server for any changes done in the modules in ‘lib’ to take effect.
Thanks to K, came to know about gotapi and used it extensively!
Posted by: Vijay Dev on: January 1, 2010
Well, it’s a new year of a new decade!
Here are some of my resolutions:
Hoping for a great year ahead!
Posted by: Vijay Dev on: December 26, 2009
Not so much busy to not write a post, but this December was all fast and crazy. A nephew was born and named; work became fun again – delving deep into Ruby on Rails, getting a nice project and much more!
Posted by: Vijay Dev on: October 11, 2009
Recently, when we were moving our staging applications and databases to a different server (from Win 2003 to Ubuntu 9.04), we had two problems with the MySQL server.
One, easy to fix, was the case-sensitive nature of table names. Using lower_case_table_names=1 in /etc/mysql/my.cnf fixed the problem.
The other problem riddled the server startup and shutdown (even server status) with errors, even while keeping the server functional. When looking into the error messages, I found out that there is a special MySQL user named ‘debian-sys-maint’ which has admin privileges. This account is used to shut down the server gracefully, to check for corrupt tables etc. The password for this account is stored in plaintext in the file /etc/mysql/debian.cnf.
Error message obtained:
/usr/bin/mysqladmin: connect to server at ‘localhost’ failed
error: ‘Access denied for user ‘debian-sys-maint’@'localhost’ (using password: YES)’
Fix:
GRANT ALL PRIVILEGES ON *.* TO ‘debian-sys-maint’@'localhost’ IDENTIFIED BY ‘<password>’ WITH GRANT OPTION;
where <password> is the plain text password found in /etc/mysql/debian.cnf. Found the fix here.
Posted by: Vijay Dev on: September 13, 2009
Been inexplicably away from blogging for a long time (except for the birthday post) – it had been a tough month and a half in various aspects. Meanwhile, Ananth went to SA for a project implementation and those two weeks were boring without him to chit-chat with. He returned to India on my birth day and we had good fun that day with a late lunch at Woodlands, watching “Up” and what not !
On the technical side, I have got bitten by the Flex bug which is quite dangerously spreading in my team!! I am also starting to learn Ruby on Rails. I like Rails more than Flex and I might work on both these technologies in the coming months. Top Secret
Work is otherwise monotone for sometime now with nothing interesting/challenging coming on the way. Anyway, enjoying what I do and trying to learn something out of whatever I do.
Last two months also saw an Increase (note the caps) in watching movies. Watched several films for the first time in life – Matrix, Lord of the Rings, Enemy at the Gates, Up, Dark Knight, Shrek to name a few.. Thanks to Manu and Karan.
Lord of the Rings – I must write about this magnum opus. Manu told me that it’s the best movie adaptation of a book ever and refused to give me the movies until I read the book and he bought me one (thanks dude!). By the time I finished the book, I was already blown away at the fantasy and the imagination. And the movies did not fail the expectations. All three were magnificent, especially the last one – Return of the King !!
I have been searching for a book for long (which I read in a local library at the age of 10 or 11) and finally got it yesterday at a book shop in T Nagar. “Thiruvarangan Ula” – a fascinating historical novel – is one of my most favourites and glad that I got hold of a copy of this 4-part book and have already finished the first part
As always, would love to get back soon