The Ruby Passion
Attending Ruby conference India 2013

I am attending Ruby conference in Pune, India 2013. Excited to listen to some of the good talks and also meet many of my friends … :-)
I am attending RubyConf India 2013

Agile Conference 2013 India - A great learning experience !

I attended Agile Conference 2013, Bengaluru (India) for the very first time. 

The conference was full of good talks, workshops, discussions, tool demos and more than that a whole bunch of enthusiastic people! Due to time constraints and also my technical interest, I only attended the 2-day Technical Conference. (1st - 2nd March) 

The technical conference was mainly targeted at developers, Analysts, Architects & Dev-Ops and it covered quite a wide range of topics this time. 

On the first day, Venkat Subramaniam gave a fantastic key note - ‘It Could Be Heaven or It Could Be Hell: Pleasure and Peril of Being a Polyglot Programmer’. One can actually feel a lot of energy and enthusiasm while he talks and I think he eats, drinks and dreams only software languages :-) True language geek!

Neal Ford presented on Emergent Design. I liked the word he used - FED - Framework Enslaved Development. We should try to come out of this pattern to understand how the real software design emerges.

Venkat also presented a couple of other topics - ‘Reactor your language knowledge portfolio: We are what we can code in’,’Thinking and programming in functional language’ and ‘Caring about code quality’. I loved those. During these presentations, he emphasized on learning more than one language. He also told that as a developer, your focus should be on writing real business logic and that is also to the point - focus on essence instead of ceremony. The functional programming presentation was awesome. Learnt a lot of things. He also gave some examples of Java 8 which has more support of functional style coding. The take away from that session was to learn at least one functional language and experience the power of functions. 

In another track, Rebecca Parsons from ThoughtWorks presented on ‘Evolving NoSQL databases’. Her talk was quite informative where she touched upon various NoSQL database types like Graph, Document, key-value pair and column family. She suggested to read this book - ‘Re-factoring databases’ by Scott Ambler.

There were also some other good topics which I was able to attend among the ongoing parallel tracks - Test Driven Decoupling, Enabling Continuous Delivery With Evolutionary Architecture, Cultivating a DevOps Culture, etc.

Overall, the conference experience was certainly very good. It always feels great when you get a chance to hear good people. I was very lucky to hear some of the Agile Thought leaders like Neal Ford, Venkat Subramaniam, etc.

Really great learning experience ! Many thanks to all the organizers/volunteers for organizing such a beautiful conference !

 

Attending Agile Conference 2013 India

I am very keen to attend Agile India 2013 Conference @ Bengaluru. Though I have been practising Agile since last more than 4-5 years, this is my first time to attend any Agile conference. I’m certainly excited to hear from Agile Thought leaders !  

image

Here is the official link where you can find everything about the conference :- http://2013.agileindia.org/

BTW, I am attending only the Technical Conference (1st-2nd March 2013), and not the entire one. Let’s connect, network, and learn … ! :-)

The Unix Programming Environment

I am currently reading ‘The Unix Programming Environment’ book written by Brian W. Kernighan and Rob Pike. A nice read about the UNIX programming philosophy which is based on the relationships between programs. The book explains the concepts about file system, shell, filters, etc. very well. You will find many examples of how to effectively use the command interpreter or shell. I would definitely recommend this book to get a good understanding of Unix system. Listing down its chapters :-

1. UNIX for Beginners

2. The File System

3. Using the Shell

4. Filters

And some advanced chapters :-

5. Shell Programming

6. Programming with Standard I/O

7. UNIX System Calls

8. Program Development

9. Document Preparation

Automate yourself into a job

Tried to implement a thought/practice from ‘The Passionate Programmer’ book by Chad Fowler - “Identify daily repetitive tasks and try to automate those. Automate yourself into a job!”

Created a batch file auto_run.bat which will open the required software programs / tools with a single click :-

e.g.

start /d “C:\cygwin” Cygwin.bat

start /d “C:\Program Files\JetBrains\RubyMine<version>\bin” rubymine.exe

start /d “C:\sqldeveloper<version>” sqldeveloper.exe

start /d “C:\Program Files\Mozilla Firefox” firefox.exe

start /d “C:\Program Files\Internet Explorer” iexplore.exe


You can add as many as you use. This is just an example!

Good Learning sites for Ruby, Rails …

Listing some of the very good sites for learning Ruby, Rails, javascript, testing, deployment and various technological aspects, etc. You can find many more on the web … Google is the only limit ! :-)

http://www.codeschool.com/

http://rubymonk.com/

https://peepcode.com/

http://railscasts.com/

http://asciicasts.com/

http://www.tutorialspoint.com/index.htm

http://rubylearning.com/

http://ruby.railstutorial.org/

http://manwithcode.com/ruby-programming-tutorials/

http_proxy settings to use gem from behind a proxy firewall

If your computer is behind a HTTP proxy firewall, then you might have received an exception while running gem install <gem_name> as below e.g.

$ gem install rails
ERROR:  http://rubygems.org/ does not appear to be a repository
ERROR:  Could not find a valid gem 'rails' (>= 0) in any repository>

One solution that you can try is adding “gem: —http-proxy=my_proxy_server:8080” to ~/.gemrc. You can check these settings by simply running a ‘gem environment’ command. However, there is one more important config setting that you need to do on your machine. You need to set HTTP_PROXY system environment variable as well.

On Windows 7, go to My Computer and select System Properties -> Advanced System Settings. Select the Advanced tab and then click Environment Variables. Click New under System Variables and enter HTTP_PROXY as the name and your IP address and port as the value. e.g.

This works ! :-)

Ruby’s throw-catch…raise-rescue

This is a very nice article by Avdi Grimm (author of Exceptional Ruby book). He explains difference between Ruby’s throw-catch and raise-rescue. Raise-rescue should be used for exception handling, while throw-catch should be used as program control structures. Really nice and informative article!

http://rubylearning.com/blog/2011/07/12/throw-catch-raise-rescue-im-so-confused/

Using jQuery’s scrollTop method to get to the first error message on page

In my project, I have a pretty long page associated with a model. There are some validations defined on the attributes which get displayed as error w.r.t. that field on the form as :

<span class="unhappyMessage pull-right"><%=@my_model.errors.messages[:client_name]%></span>

Since there are many fields on the form, the user needs to scroll down to create the model entry. The problem is if validation fails on the field which is located at the bottom of the page, then the user gets confused because he needs to scroll down to find out the error message on that particular field. So we wanted to have a feature similar to adding an anchor tag to the first error message on the page, so that it is clearly visible to the user when validation error occurs. This is related to adjusting the position of the vertical scroll bar based on the position of the first error message. Since we had a fixed header height, we achieved the desired behaviour by using jQuery’s scrollTop() method :-

$(document).ready( function() { 
if ($(".unhappyMessage:first").offset() != null) {
$(window).scrollTop($('.unhappyMessage:first').offset().top - 120);
}
});
Issue with IE history (back button) and jquery colorbox

In my project, we are using jquery colorbox plugin. We are using it to display the notice message after a record gets successfully created or updated.

The application layout has :-

  <p id="notice"><%= notice %></p>

And application.js has the corresponding code :-

    if($("#notice").html().length > 0)
    {
        jQuery.colorbox({
            html: $("#notice"),
            height:"130px",
            width:"350px",
            margin:"0 0 15px 5px"
        });
        window.setTimeout('$.fn.colorbox.close();',2000);
    }

The issue we were facing was in IE (7,8) browser, when we click the back button, it also displays the colorbox notice message. However, in Firefox and Chrome, this does not happen.

e.g. You perform some update/create actions, and a notice message would appear with colorbox. However, when you click back button, you would not want the browser to retain the colorbox message history. In case of IE, this was happening which we wanted to avoid. A simple change solved this issue w.r.t. IE. Thanks to my colleague Ashish for pointing this out!

If we look at the public methods of colorbox, viz. close() and remove() :-

$.colorbox.close() This method initiates the close sequence, which does not immediately complete. The lightbox will be completely closed only when the cbox_closed event / onClosed callback is fired.
$.colorbox.remove() Removes all traces of ColorBox from the document. Not the same as $.colorbox.close(), which tucks colorbox away for future use.

So I replaced close() with remove(), and the issue got resolved.