Saturday, August 30, 2008

Travel On !

Its been some time since I have posted. I had some work to do, never leave the stuff that feeds you, and we had also a petty good trip to Jaipur. Sam, Jacob, Amit, Vivek, Abhilash and his two brothers also with some cousins of his started the onward journey to Jaipur on friday night. Amit drove his car where as Abhilash too his Santro. The ride was a mind boggling 300 odd kilometers but Amit chose to drive his Honda City all the way. I would have preferred the bike ride as it would have been adventurous like the Mukteshwar trip we had.

The Pink City was awesome ! The old buildings, the palaces were awesome. Chokhi Dhani was also great. To see all those ethnic craftsmanship, the delightful Rajasthani Food, especially Dal Bhatti, were excellent. We took a hell lot of pics, had lots of liquids as it was very humid. We managed to find a great hotel near Chokhi Dhani and stayed there for 2 days in whole. We managed to see Amer, Jaipur forts. We went through the straightest and best road ever while going to Ajmer. We visited the Ajmer Sharif and Pushkar as well. These religious places did not seem to be religious or pious to me in any way as the people there were more concerned about the money they got from the tourists rather than the sanctity of the place. This was disgraceful and discerning according to me.

I am due to travel home and spend some quality time with family starting the 5th of September and I am thrilled about that. Its been some time since I went home and I intend to have nice fish dishes this time around. Lets see how that goes.

Saturday, August 9, 2008

Asynchronous access via Ruby On Rails

Over the last month we have been pondering upon a major problem that needed to be implemented in a Ruby On Rails application. The statement of the problem is simple. I have a procedure/algorithm which takes two input sets, gets each element in the set and using a combination of the elements in the sets calculates a rating. As the problem it self suggests, this is a tedious process. Database access is evident and the procedure is also lengthy. I decided to write the algorithm implementation in the lib folder, so that it is accessible inside the application, and then call it inside the controllers.

If the algorithm was called inside the controller, the response would stall until the whole algorithm was completed. This is NOT what I wanted. The user should not be affected by the time the algorithm took to complete. The requirement here was to run this process as another thread/process at another place. To replicate the application environment in another server dedicated to this did not seem to be a great idea.

Thats when background process was suggested. Running the algorithm as another thread was another option. As the algorithm only required the sets, it could be run as a different thread. But the environment that the server provides must still be loaded. Ap4r came to the rescue here. Asynchronous Processing For Ruby could be used by any rails application to route all those tedious and time consuming accesses. This I thought was a smart way of doing a background process, although it is NOT a background process. It is just another url access. The Gem must be installed along with the plugin and the server must be started and wallah !! You are in ! Simple as that.

Next comes the trigger, ie the part where you actually need to start the background process. I had two places which acted as triggers. One was in the controller part and the other was from a model. Triggering from the controller part was easy as the plug-in's init file actually added the ap4r method with the Action Controller. Triggering from the model was tricky. As far as I know there is no way to actually call a url/controller method from a model. Theoretically this is wrong as the controller is supposed to be the base and the model does not need to know the controller which is accessing it, if it is accessing it.

I took the easy way out of this by firing a system command which did a wget to the url. This method (corresponding to the url) written in the controller does an asynchronous access thus returning immediately. Thus the system command does not stall the execution of the model method when it is called. The ap4r server is still called and the algorithm is run asynchronously thus serving our need.

The algorithm had many stages of executions/ filters along with database accesses. I managed to use message passing by calling the send method for the objects and lots of array operations. I thought I did a pretty good job in writing the algorithm. The vast thought that has been gone in developing a language like ruby must be praised here. Kudos to Yukihiro “matz” Matsumoto.

Monday, August 4, 2008

Lots of Action

The previous month was full of action. From conducting Interviews to taking training sessions. I always thought of myself as a person who could find answers and gives them. NOT a person whom you would come to and who would give prompt answers (I admire people like that). Chetan is one of them by the way. The training sessions gave me an opportunity to analyze myself. These days I don't browse and explore as I did when I joined this company. That has certainly deteriorated my skills I suppose (anything that was there I should say). I made mistakes here and there and even though I knew the concepts, they just confused me. Lack of preparation really showed and for a brief period I was down. But overall I thought I did a pretty good job. The guys were awesome. Great dynamism is what I saw along with debating.

I have always thought that to learn effectively, a healthy debate is essential. The debate will only get better if the conductor is really talented to avert the unnecessary questions and give prominence to the worthy questions. I was trying to play that role by making the guys involved fully and their co-operation was praise worthy. I could not do justice to the topic fully (could not complete the required stuff), but I brushed through all what I knew.

The interviews were not that great. I was yet to find a great communicator (I do not claim that I am one). Someone who would gives answers to the questions. Think and then act. I came across some simple and calm ones, but no one with absolute skills. I still do not understand how these recruiters evaluate a person if he does not perform. The body language ? The speed of answers ? Yet to find !!

With regard to the development, work is still haunting me. Lots of work to do and so less time to do it (and look at what I am doing now !!! ). But God helps me tremendously in these matters by striking a balance and fixing issues. Its in Him that I trust.

Its ciao for now !!!

Dinesh Vasudevan's Blog

Blog discussions.

read more | digg story