Posted by: Vijay Dev on: January 25, 2010
While running a script in a rails app, I got this error /usr/bin/ruby^M: bad interpreter: No such file or directory in the shebang line of the script.
One of the fixes that I came across after a bit of googling is to add a harmless switch at the end of the line; in this case a -w (which turns warnings on in the script). Even though it worked, the log file started growing with all kinds of warnings which obviously I don’t want to live with.
More search revealed that it’s actually a pesky file format issue (damn the ^M). A quick change in the file format to unix did the trick. In vim, do :set ff=unix to achieve this and remove the bad interpreter error!
Posted by: Vijay Dev on: January 24, 2010
While installing the mysql gem in Ubuntu 9.10, I encountered this error:
Error:
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options.
After a bit of searching in the forums, got a solution that worked fine without a need for any configuration options:
Fix:
Execute sudo apt-get install libmysqlclient15-dev to install the package “libmysqlclient15-dev“.
Posted by: Vijay Dev on: January 22, 2010
Firefox being my primary browser, I have updated to the latest version released yesterday. Having not used the beta version at all, Firefox had a big surprise in store for me: Very Fast Startup! Now, I am not comparing it with Chrome or any other browser out there. By Firefox’s standards, the 3.6 startup is super fast ! It’s been just a day of usage and so I am reserving comments on Firefox’s claim of improved JavaScript performance and browser responsiveness. For now, I did not perceive any change in performance. Here is a nice performance benchmarking of Firefox 3.6 with other browsers.
The one-click install of Personas is good but I am not really that excited about the feature. Protection from out-of-date plugins looks interesting. A feature that I missed noticing for sometime is that the new tabs are now opened next to the tabs that open them and not at the far end as before. Again, my bad missing the beta version. However, there is a config option to make the tabs open at the far end. Changing the option “tabs.insertRelatedAfterCurrent” in about:config to false is all it takes. Got this trick from here, where I also found out how to do prettier tab switching. Of course, the config option “browser.ctrlTab.previews” is set to false by default.
Side note: Firebug 1.5, ready for Firefox 3.6, was released just a day before the browser!
Posted by: Vijay Dev on: January 13, 2010
Two movies in a day, back-to-back !! Now, that’s a record for me! Watched Avatar & Sherlock Holmes in Sathyam today with Manu (who else
).
Avatar is a stunning visual experience and worth watching once again for it’s CG. The 3-D glasses gave a headache though. The credits for the movie is justifiably Huge!
Sherlock Holmes is pure fun! The picturing of London is awesome and so is Robert Downey Jr’s charismatic performance. I’m starting to like that guy after Iron Man and SH now. The story line is thin and kind of like a Chemistry course
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!