Last week, I captured some beautiful nature snaps near Kolhapur, Maharashtra. Sharing few of those snaps ...



Yesterday, my father gave a marathi book - 'Hasgat' to me. It is written by a well known and my favorite marathi actor Dilip Prabhawalkar. I could not resist myself to read his book. The book made my travel to office and back to home journey jovial.
The book is a collection of short stories which can be enjoyed any time. The common thread that binds these stories is the element of situational humour and the naive characters in each of these, reminiscent of the P.G. Wodehousian style, which has admittedly been one of Prabhawalkar's literary influences.
Dilip Prabhawalkar has done a great work in theatre, cinema, television and as a writer as well. Please take a look at his website :- http://dilipprabhavalkar.com/v1/indexHtml.htm
I have watched his drama - 'Hasvaphasvi' at least 8 to 10 times. You can see the pictures of six different character roles that he played in that drama at : http://dilipprabhavalkar.com/v1/hasvaphasvi.htm
Isn't it awesome ? :-)
Enjoy reading ...
Few days ago, I was randomly going through the Ruby Array class API and the method '*' caught my attention.
array * int -> an_array : Returns a new array built by concatenating the int copies of self.
[ 1, 2, 3 ] * 3 #=> [ 1, 2, 3, 1, 2, 3, 1, 2, 3 ]
I just had a thought can I have a method named '/' which will return a new array by splitting the array into arrays of int divisor elements each ?
The functionality that I was looking for :-
[1,2,3,4,5,6]/1 # => [[1], [2], [3], [4], [5], [6]]
[1,2,3,4,5,6]/2 # => [[1, 2], [3, 4], [5, 6]]
[1,2,3,4,5,6]/3 # => [[1, 2, 3], [4, 5, 6]]
I gave it a try, my fingers typed the code as per my brain's instructions and it worked the way I expected.
Then I saw the methods at(index) and fetch(index) and thought can I fetch or even set the elements of the array with the index as if index acting as array's attributes ?
Like this :-
ary = [1,2,3]
ary._0 = 25
ary._0 # => 25
ary._1 = 10
ary._1 # => 10
ary # => [25, 10,3]
For the above to work, I played with the method_missing method.
Few things that I noticed in the Array class were it has 'first' and 'last' methods but not 'first=' and 'last=' methods. It has 'nitems' method which returns the number of non-nil elements, but no 'nilitems' method which will return nil elements in the array.
My mind started to think whether I can build some other useful methods as well and it came to a sufficiently big list which I finally moved into a gem. I named the gem as 'augmented_array' and pushed it to gemcutter.
Install:
====
gem install augmented_array
Uninstall:
====
gem uninstall augmented_array
Source Code is available at my Github repository.
Yesterday I read a management book - 'The One Minute Manager' written by Ken Blanchard and Spencer Johnson. I liked that book very much. It's practical. It includes some examples demonstrating how you can effectively handle the people under you. By the book definition, effective managers manage themselves and the people they work with so that both the organization and the people profit from their presence.
The metaphor, The One Minute Manager means it takes very little time for that manager to get big results from people and behind this success lie just three secrets :-
- One minute goals
- One minute praisings
- One minute reprimands
One should read this little book to know more about these secrets.
It is really good to know that the leaders of American and Japanese industry have made this book compulsory reading for all their managers.
Enjoy reading ...
I started my day today with reading my colleague's beautiful post what mindfood are we eating and it really made me think.
This is such a wonderful thought... what do we feed our mind with ? How many of us make conscious efforts to nurture our mind ? Hmm ... need to prepare healthy diet plan for our minds as well :-)
Sharing some good food of thoughts that I got from googling :-
1. Success is not the key to happiness. But happiness is the key to success.
2. You can tell whether a man is intelligent by his answers. But you can tell a man is wise by his questions.
3. Morning means one more inning given by the god to play.
4. Success is not a matter of being the best and winning the race, it is a matter of handling the worst and finishing the race. Be positive.
5. A honey bee visits 2 million flowers to collect 500 mg of honey. So our workload is nothing as compared to them. Be cheerful and keep working.
6. It is not that some people have will power and some do not. It is that some people are ready to change and others are not. Believe in yourself and change for betterment.
7. The world suffers a lot, not because of the violence of bad people, but because of the silence of good people.
I have worked with a couple of good companies. The managerial behavioral pattern that I have observed across these companies remains more or less the same. Yes... there are certainly few exceptions. I have many friends across different organizations, but to be frank, I have rarely seen people talking good about their managers. Why is this so ? Are the managers lacking the skills to effectively handle the people under them ? Or some other reason ? There is no straightforward answer to these questions, but can we improve this better ? I am not at manager level yet, but certainly I can suggest few tips which would improve this situation.
Tips for Managers :-
1. Consider people under you as people rather than only billable resources.
2. Do not let people under you to lose trust in you. It is very difficult to build back the trust again.
3. Give more importance to career progression of the people under you than billing.
4. Have faith in your people.
5. You do not have any right to play with or spoil the career of the people under you. Freshers are the best example of this. They are rarely asked about their career aspiration, rather they are asked to do things what the current situation demands.
6. Do not take people under you for granted.
7. Interact with your people regularly about their aspirations and make loyal efforts to fulfill those.
8. A little smile on your face makes a huge difference in the professional and personal lives of the people under you. The most important thing here is that it's absolutely free of cost.
9. Try to be a role model of the people under you.
10. Billing/Revenue is important. But people are more important as they sustain business with the client by their good work.
11. Micromanagement kills.
12. Try to be a thought leader than just to be a manager.
13. Do not lose your core values while dealing with the client.
The monsoon has started in Mumbai - Maharashtra with full force and one of my friends forwarded some great nature pictures especially from Konkan region to me. I can not resist myself to share some of those beautiful photos with you all.
Marleshwar waterfall near Sangameshwar in Ratnagiri district:
Jog waterfall:
A typical home in Konkan:
River bank:
Happy monsoon ! :-)
It's real time to go for a trek / nature trail !
Following my earlier post, I pushed hash_key_as_attribute gem to rubygems.org
Install
====
gem install hash_key_as_attribute
OR
Download the gem file from http://github.com/NiranjanSarade/hash_key_as_attribute/
gem install hash_key_as_attribute-0.0.1.gem
In ruby, we have OpenStruct which allows the creation of data objects with arbitrary attributes. With ruby's metaprogramming capability, we can also allow hash values to be set and retrieved as if they were its attributes. If the key does not correspond to any hash entry, it should return “The key does not correspond to any hash entry” message. The hook that we are going to use is Kernel's method_missing.
Here we are opening the class Hash :-
And this is the sample output :-
h = Hash.new("The key does not correspond to any hash entry")
h.one = 1
puts h.one #=> 1
h.two= [1,2,3,4]
puts h.two.inspect #=> [1,2,3,4]
puts h.three #=> "The key does not correspond to any hash entry"
puts h.inspect #=> {:one=>1, :two=>[1, 2, 3, 4]}
h2 = {}
h2.four = 4
h.three = h2
puts h.three.inspect #=> {:four=>4}
puts h.three.four #=> 4
In ruby, instance variables have prefix '@' and class variables have prefix '@@'.
We have instance_variable_get and instance_variable_set methods from Object class and class_variable_get and class_variable_set methods from Module class in Ruby. Here is the typical usage of these methods from the ruby docs :-
----
class Fred
@@foo = 99
end
def Fred.foo
class_variable_get(:@@foo) #=> 99
end
----
class Fred
def initialize(p1, p2)
@a, @b = p1, p2
end
end
fred = Fred.new('cat', 99)
fred.instance_variable_get(:@a) #=> "cat"
fred.instance_variable_get("@b") #=> 99
----
class Fred
def initialize(p1, p2)
@a, @b = p1, p2
end
end
fred = Fred.new('cat', 99)
fred.instance_variable_set(:@a, 'dog') #=> "dog"
fred.instance_variable_set(:@c, 'cat') #=> "cat"
fred.inspect #=> #Fred:0x401b3da8 @a=\"dog\", @b=99, @c=\"cat\"
----
However, why do we need to specify the @ and @@ when the method names are smart enough to distinguish between whether the variable is an instance or a class variable. Why does a call to instance_variable_set require the "@" symbol in the first argument? Any idea ? Or has it been done with some purpose ?
Last week my wife and I visited Thailand. In the tour, we got a chance to visit Tiger Temple near Bangkok. Yes ... the thrill was patting real tigers. Tiger Temple, or Wat Pha Luang Ta Bua, is a Buddhist temple in Western Thailand where tourists can actually touch/pat the tigers in open area. It was a great experience in watching the real tigers staying with men and how the people take care of them. The tigers are handled by Thai monks, volunteers and the local staff.
Sharing few photos ...


This is an excellent video about ruby metaprogramming concept:-
http://www.infoq.com/presentations/metaprogramming-ruby
This was presented by Dave Thomas, a well known author of The Pragmatic Programmer book.
I was working on one functionality where I needed to build hash like structure in javascript and make an ajax call to perform that particular action by passing that hash as params to process further. The functionality was to delete a numbered row from the form and after deletion the form should rearrange the rows in sequence while maintaining the order. I used javascript 2 dimensional array to treat it as hash.
e.g. On the form :-
No. | EmpID | Date | Location | Action |
1. | 123 |12-Mar-10 | Mumbai |Delete |
2. | 233 |10-Jan-10 | Mumbai |Delete |
3. | 444 |15-Mar-10 | Mumbai |Delete |
4. | 555 |18-Mar-10 | Mumbai |Delete |
So. If you delete the 3rd row, then after deletion the new form should render as :-
No. | EmpID | Date | Location | Action |
1. | 123 |12-Mar-10 | Mumbai |Delete |
2. | 233 |10-Jan-10 | Mumbai |Delete |
3. | 555 |18-Mar-10 | Mumbai |Delete |
The elements were written in table format. Each row is assigned unique id, so first row will have id = 1, 2nd row with id = 2 and so on. Each td has unique class.
In the last month, I got an opportunity to attend the very first Ruby conference held in Bangalore, India(20-21 March) organized by ThoughtWorks. The response was very huge (around 400 people ranging from beginners to CEOs from more than 100 companies) and people really enjoyed the event.
It was really great to hear some good speakers/industry leaders like Matz, Obie Fernandez, Ola Bini, etc. Many technical topics were presented like future of Ruby, Rails 3.0, Glassfish and WebRoar app servers, building cross platform mobile application with Rhodes framework, etc. You can find more details about these topics at http://rubyconfindia.org/
I felt a lot of enthusiasm and energy amongst the people w.r.t. Ruby and Rails. There are many small companies being set up especially in Pune and Bangalore for doing only rails projects. I really liked that !
Indian market is really catching up on Rails very fast !
Below is the way by which you can render partial with jQuery in your view.js.erb file :-
jQuery("#mydiv").html("<%= escape_javascript(render(:partial => 'my_partial', :locals => {:my_instance_var => @my_instance_var} ))%>");
A mechanic was removing a cylinder head from the motor of a Harley motorcycle when he spotted a well-known heart surgeon in his shop. The surgeon was there, waiting for the service manager to come and take a look at his bike. The mechanic shouted across the garage, "Hey, Doc, can I ask you a question?"
The surgeon a bit surprised, walked over to the mechanic working on the motorcycle. The mechanic straightened up, wiped his hands on a rag and asked, "So Doc, look at this engine. I open its heart, take valves out, fix 'em, put 'em back in, and when I finish, it works just like new. So how come I get such a small salary and you get the really big bucks, when you and I are doing basically the same work?"
The surgeon paused, smiled and leaned over, and whispered to the mechanic...
"Try doing it with the engine running."
I got a chance to visit http://webroar.in/ and it seems interesting.
http://webroar.in/blog/2009/11/25/introducing-webroar-v0-2-3-ruby-application-server
WebROaR is an application server that makes deployments of ruby web applications extremely simple. It provides an integrated solution to view the run time performance numbers and email notifications in case any exceptions occur in any of the deployed applications. It is 5 to 55% faster than all other comparable deployment stacks for RoR apps.
Comparison :-
http://webroar.in/blog/2009/11/25/comparison-of-rails-deployment-stacks-2
Some screenshots :-
http://webroar.in/screenshots
Source :-
http://github.com/webroar/webroar/
I recently read a very good book written by Dr. P.V.Vartak - "Geeta - Vidnyananishtha Nirupan" (Scientific explanation)
As we know, Geeta is a conversation between Lord Krishna and Arjuna which took place on the battlefield of Kurukshetra just prior to the start of Mahabharata war. Responding to Arjuna's confusion and moral dilemma, Krishna explained to Arjuna his duties as a warrior and real path of truth and elaborated on a number of different Yogic and Vedantic philosophies, with examples and analogies. Geeta is often being described as a concise guide to Hindu philosophy and also as a practical, self-contained guide to live life especially with Karma yog. Karma Yog is a science that frees us from the bonds of actions and attachment with the attributes. According to the Bhagawad Geeta, it consists of mentally renouncing the sense of doership in favour of God while performing all actions.
Dr. Vartak has explained all the 18 chapters (addhyay) of Geeta in a very simple but superior language. Many thanks to him !
He has also pointed out some mistakes that Mahaatma Gandhi (M.K.Gandhi) did which ultimately led to a lot of violence during Indian independence. Mahaatma Gandhi used to daily worship/read Geeta, but unfortunately could not grab the real meaning of non-violence, Karma yog described in Geeta. The Geeta was actually told to Arjuna to take away his confusion and encourage him to perform his duties as a warrior. But Mahaatma Gandhi never understood the crux of Geeta and repeatedly made mistakes in terms of following non-violence, forgiving real enemies at National level and unfortunately the Nation also followed wrong leadership during that time.
I would request everyone to read this book and think in solitude on the thoughts explained in the book ... We have yet a lot to improve ...
A pandit crossing a field felt that there was something in his mouth and spat it out. It turned out to be a heron's feather. He could not understand how it had got into his mouth and it perplexed him a great deal. When he reached home he told his wife about it but asked her not to tell anyone lest somebody put a bad interpretation on it. His wife was even more intrigued by the strange occurrence and felt the need to confide in someone. So she swore her neighbour to secrecy and told her what had happened.
Perhaps it was the way she told it, but her neighbour got the impression that several feathers had come out of the pandit's mouth. She was shocked. However, she assured the woman that such things could happen and advised her not to worry about it.
"Please don't tell anyone," said the pandit's wife.
"My lips are sealed," said the woman. But she was longing to tell someone and when she saw the dhobi's wife going past, called her in and told her the whole story. Only, she made it sound as if a whole heron had come out of the pandit's mouth.
"Never have I heard of such a thing," said the dhobi's wife, her eyes popping with excitement, "and he being a vegetarian and all that, but one can never tell..."
She went away promising not to tell anyone but on the way she met her friend and the whole story sort of tumbled out of her mouth. Perhaps in her excitement she said 'herons' instead of 'heron' or perhaps her friend just imagined she had said herons but when she told her husband the story sometime later, she was emphatic that a whole flock of herons had come out of the pandit's mouth.
And as the story spread "herons" became "herons and other birds" and then "hundreds of birds of all shapes and sizes".
By evening the whole village and several other neighbouring villages had heard the story and people began to arrive in droves at the pandit's house to witness the miraculous happenings there.
The pandit steadfastly denied that any bird had come out of his mouth but nobody would believe him and everybody begged him to demonstrate his wonderful power of producing birds from his mouth.
Finally in exasperation, he asked them all to sit in front of his house and when they had done so ran out of the back and hid in the jungle where he remained several days till the excitement had died down and the people had realised that the news was false...
In one of my previous projects, I worked on ruby script to read the emails from mail-in database and process the emails as per the business requirement. In ruby, we have a libray called Net::POP3 which provides functionality for retrieving email via POP3. I went ahead with a thought of converting this to a gem.
The emails retrieved from mail-in database are stored in some sort of data structure to process further. The utility makes use of Net::POP3 and TMail libraries and provides with some handy methods such as 'retrieve emails' as array of hashes. The hash has email's from,to,cc,bcc,subject,body fields. Email body with attachment has not been considered for simplicity.
It also provides 'delete_emails(unique_email_ids=[])' method which takes array of unique email ids (retrieved with pop email unique_id) as parameter and deletes those.
Install :-
gem install email_pop_reader
(It has been pushed to http://gemcutter.org) - http://gemcutter.org/gems/email_pop_reader
OR
Download the gem file from http://github.com/NiranjanSarade/email-pop-reader.git/
gem install email_pop_reader-0.0.1.gem
I went through a couple of articles on ruby's blocks, procs, lambda & method and found those really good and interesting. Sharing those articles :
http://www.robertsosinski.com/2008/12/21/understanding-ruby-blocks-procs-and-lambdas/
http://www.neeraj.name/blog/articles/589-block-vs-lambda-vs-proc
Finding that cranes were destroying his newly sown corn, a farmer one evening set a net in his field to catch the destructive birds. When he went to examine the net next morning he found a number of cranes and also a stork.
"Release me, I beseech you," cried the stork, "for I have eaten none of your corn, nor have I done you any harm. I am a poor innocent stork, as you may see - a most dutiful bird, I honor my father and mother, I..."
But the farmer cut him short. "All this may be true enough, I dare say, but I have caught you with those were destroying my crops, and you must suffer with the company in which you are found."
Moral: People are judged by the company they keep.
There is a Chinese saying which carries the meaning that "A speech will either prosper or ruin a nation." Many relationships break off because of wrong speech. When a couple is too close with each other,we always forget mutual respect and courtesy. We may say anything without considering if it would hurt the other party.
A friend and her millionaire husband visited their construction site. A worker who wore a helmet saw her and shouted,"Hi, Emily! Remember me? We used to date in the secondary school." On the way home, her millionaire husband teased her, "Luckily you married me.Otherwise you would have been the wife of a construction worker." She answered ,"You should appreciate that you married me. Otherwise, he would have been the millionaire and not you."
After my one of the last posts Shaping models in Rails, I got a chance to convert that piece of code into a Rails plugin.
It has been rolled out to Github.
Github Repository :- http://github.com/NiranjanSarade/model-diagram-generator
Installation :-
ruby script/plugin install http://github.com/NiranjanSarade/model-diagram-generator.git/
Usage :-
rake model_diagram:generate
It will generate diagramatic representation of the model relationship present in your rails app. The model_relationship.dot and model_relationship.png files will be generated at the application root folder.
It was a nice feeling with contributing something to the open source community !
In continuation of my previous post Formatting Rules, you will find this link very useful :- http://www.usemod.com/cgi-bin/wiki.pl?TextFormattingRules
ASCIIcasts are text versions of each Railscast developed by Ryan Bate, each with a link to the original video. So if we want to refer the text version of the railscasts, just refer this link :-
http://asciicasts.com/
Here is a good link for Ruby/Rails tool box which has collection of many utilities/tools to address different development life cycle concerns like deployment, testing, code metrics, continuous integration, project management and many more ...
http://www.ruby-toolbox.com/
Here are some formatting rules and how to use guide for UseModWiki :-
- Creating a new page
Every Wiki page has an edit button. Click on the edit button and type a wiki word. A wiki word starts with a capital letter and has at least one more capital letter in it. Between the capitals there must be lower case letters. There cannot be two capitals in a row.
e.g. MyWord will bw displayed as MyWord?
Now click on the ? to go to the wiki page
- See the Recent Changes
Type in the URL as http://localhost/cgi-bin/wiki.pl?RecentChanges
The Recent Changes page shows the dates on which the individual pages have been updated.
- Editing Content
Click the edit button on a wiki page. Input the contents in the text field and press the save button.
- Create Links
Page Link: wiki words are treated as links to the corresponding wiki pages.
External Link : use the corresponding URL e.g. http://c2.com
- Search content
Enter the key word that needs to be searched in the text field labelled search at the end of the wiki page.
- Creating Inter Wiki
Our wiki can refer to pages in other Wikis. Edit intermap file in cgi-bin folder and add the entry for the mapping. It contains the mapping for the key word and the corresp URL.
e.g.: UseMod? is the key word and the URL is http://www.usemod.com/cgi-bin/wiki.pl?. Now if we want to refer to a page WhatIsaWiki? in the wiki http://www.usemod.com/cgi-bin/wiki.pl, we just need to refer it as follows: UseMod:WhatIsaWiki
- Having a non-wiki word as a link
[http://c2.com/ppr/about/author/martin.html Martin Fowler] will be displayed as [Martin Fowler]
- Sub Pages
The [SubPage] - [http://www.usemod.com/cgi-bin/wiki.pl?SubPage SubPage] idea allows every main page to contain its own wiki universe of subpages. The subpages can be used to help refactor a large page without the problems /LongPrefixBeforeEachPage?.
I gave a try to UseModWiki (an implementation of the original Wiki concept created by Ward Cunningham) and found it simply superb! We can use this internally across the teams for sharing information :-)
The name wiki comes from the Hawaiian word wiki wiki, which means quick/fast. There is a famous quote by Glen Wilber: "Knowledge grows faster than the way to organize it !". Wiki does provide an efficient and simpler way to organize and spread the ever growing knowledge across the entire team. It enables easy collaboration and sharing of information across the network.
Why wiki ?
- Similarity to HTML
- Instant Feedback Mechanism
- Accessible anywhere
- Easy Searching
- Easy to learn and use
- Open Source
- Tracking of pages
Installation steps on Windows :-
- Install active perl (http://www.activestate.com/activeperl/)
- Install Apache Web Server (http://httpd.apache.org/download.cgi)
- Extract usemod10 (http://www.usemod.com/wikicode/usemod-1.0.5.zip.)
- Copy wiki.gif from extracted usemod directory to apache htdocs folder.
- Copy wiki.pl from extracted usemod directory to apache cgi-bin folder.
- Edit the first line of wiki.pl so that it shows the right path to perl.exe. (say c:/perl/bin/perl)
- Edit wiki.pl to change the value of $DataDir so that it points to "wikidb" folder (say d:\usemodwiki\wikidb )
- Edit wiki.pl to change the value of $FullUrl so that it points to 'http://localhost/cgi-bin/wiki.pl'
- Start the Apache server.
- Open a browser and type in the url : http://machine-name/cgi-bin/wiki.pl where machine-name refers to the name of your local machine.
e.g. http://localhost/cgi-bin/wiki.pl
Once installed, the wiki is accessible across all machines in the same domain.
This is the simple page that I created on my local machine :-
And clicking on 'RailsTips' link navigates to other page that I created as :-
I will be writing more on formatting rules in my upcoming blog ...
Enjoy being wiki ... :-)
" I had gone a-begging from door to door in the
village path when thy golden chariot appeared in
the distance like a gorgeous dream and I wondered
who was the king of all kings!
My hopes rose high and I thought my evil days
were at an end, and I stood for alms to be
given unasked and for wealth scattered on all sides in the dust.
The chariot stopped where I stood. Thy glance
fell on me and thou camest down with a smile, I felt
that the luck of my life had come at last. Then
of a sudden thou didst hold out thy right hand
and say "Why hast thou to give me?"
Ah, what a kingly jest was it to open thy palm
to a beggar to beg ! I was confused and stood
undecided and then from my wallet I slowly
took out the least little grain of corn and gave it to thee.
But how great my surprise when at the day's
end I emptied my bag on the floor to find a least
little grain of gold among the poor heap. I bitterly
wept and wished that I had had the heart to give
thee my all. "
- Rabindranath Tagore
A group of students were asked to list what they thought were the present "Seven Wonders of the World." Though there were some disagreements, the following received the most votes:
Egypt's Great Pyramids
Taj Mahal
Grand Canyon
Panama Canal
Empire State Building
St. Peter's Basilica
China's Great Wall
While gathering the votes, the teacher noted that one student had not finished her paper yet. So she asked the girl if she was having trouble with her list. The girl replied, "Yes, a little. I couldn't quite make up my mind because there were so many."
The teacher said, "Well, tell us what you have, and maybe we can help." The girl hesitated, then read, "I think the 'Seven Wonders of the World' are:
to see
to hear
to touch
to taste
to feel
to laugh
and to love."
The room was so quiet you could have heard a pin drop. The things we overlook as simple and ordinary and that we take for granted are truly wondrous!
A gentle reminder -- that the most precious things in life cannot be built by hand or bought by man.
I recently read a very intuitive and scientific book written by Dr. P.V.Vartak -"Patanjal Yog - Vidnyananishtha Nirupan" (Scientific explanation)
Dr. Vartak has explained the Yoga Sutras (threads) in a very scientific language in Marathi with real life examples. He has also established the date of Patanjali as around 5000 BC from reference of Brihadaranyaka Upanishad.
Patnjali was an authority on Yoga and had written way to enlightenment through Yoga (Yoga darshan - vision of Yoga). The Yoga system of Patanjali or the ancient Hindu doctrine of concentration of mind, ways to achieve it, are called Yoga-sutras, of Patanjali.
The Yoga Sutras consist of four chapters (called padas - Pada means 1/4th) :-
1. Samadhi Pada
2. Sadhana Pada
3. Vibhuti Pada
4. Kaivalya Pada
- Samadhi refers to a blissful state where the yogi is absorbed into the One.
- Sadhana is the Sanskrit word for "practice" or "discipline". The author explains karma yoga and ashtaanga yoga.
- Vibhuti is the Sanskrit word for "power" or "manifestation". 'Supra-normal powers' (Sanskrit: siddhi) are acquired by the practice of yoga. e.g. becoming invisible, travelling with a speed much more than a speed of light, reading minds, enter into foreign bodies (parakaya pravesh), etc.
- Kaivalya literally means "isolation", but stands for emancipation, liberation and used interchangeably with moksha (liberation), which is the goal of Yoga.
Here is the link for whoever is interested in reading Patanjal Yogasutras -
http://www.santosha.com/samadhi-pada1.html
But only reading would not help, every one needs to practice this as it is a practical knowledge !
Really great work done by Dr. Vartak ! Hats off to him for bringing this true ancient knoweldge in a very simple and heart touching language !
Whenever we use ruby script/console during development, we often would like to see the SQL queries instantly that get being generated at the backend. Those queries can be a result of method calls on model, named scope, etc.
We just need to execute the below 2 lines to have this enabled on console.
ActiveRecord::Base.logger = Logger.new(STDOUT)
ActiveRecord::Base.clear_active_connections!
And now whenever we will interact with ActiveRecord object method calls, the SQL query will get displayed immediately in the console.
e.g.
When NASA began the launch of astronauts into space, they found out that the pens wouldn't work at zero gravity (Ink won't flow down to the writing surface). In order to solve this problem, they hired Andersen Consulting (Accenture today). It took them one decade and $12 million. They developed a pen that worked at zero gravity, upside down, underwater, in practically any surface including crystal and in a temperature range from below freezing to over 300 degrees C. And what did Russians do ?
The Russians used a Pencil !!!
So, learn to focus on solutions not on problems
"If you look at what you do not have in life, you don't have anything. If you look at what you have in life, you have everything... ! "
Once a priest had been on a long flight. The first warning of the approaching problems came when the sign on the airplane flashed on: "Fasten your seat belts." Then, after a while, a calm voice said, "We shall not be serving the beverages at this time as we are expecting a little turbulence. Please be sure your seat belt is fastened."
As he looked around the aircraft, it became obvious that many of the passengers were becoming apprehensive. Later, the voice of the announcer said, "We are so sorry that we are unable to serve the meal at this time. The turbulence is still ahead of us." And then the storm broke. The threatening cracks of thunder could be heard even above the roar of the engines. Lightening lit up the darkening skies, and within moments that great plane was like a cork tossed around on a celestial ocean. One moment the airplane was lifted on terrific currents of air; the next, it dropped as if it were about to crash.
The priest confessed that he shared the discomfort and fear of those around him. He said, "As I looked around the plane, I could see that nearly all the passengers were upset and alarmed. Some were praying. The future seemed ominous and many were wondering if they would make it through the storm.
And then, I suddenly saw a girl to whom the storm meant nothing. She had tucked her feet beneath her as she sat on her seat and was reading a book. Everything within her small world was calm and orderly. Sometimes she closed her eyes, then she would read again; then she would straighten her legs, but worry and fear were not in her world. When the plane was being buffeted by the terrible storm, when it staggered this way and that, as it rose and fell with frightening severity, when all the adults were scared half to death, that marvelous child was completely composed and unafraid."
The priest could hardly believe his eyes. It was not surprising therefore, that when the plane finally reached its destination and all the passengers were hurrying to get off, he stayed back to speak to the girl whom he had watched for such a long time.
Having commented about the storm and behavior of the plane, he asked why she had not been afraid.
The sweet child replied, "Sir, my Dad is the pilot, and he is taking me home..."
The physical desires can never be satiated. The more one attempts to satisfy them, the more intense they grow, even as fire blazes instead of going out when oil is poured into it.
Tolstoy has written a very instructive story under the title "How much land does a man need ?"
- A man was promised free all land he could run round from sunrise till sunset. In his sheer greed to cover more and more land, he ran so far that he never got back to the starting place before sunset, and in utter exhaustion, he died. Only a strip of land, 7 feet, was needed to bury him !
This is an article by Marshall Goldsmith in which he states 5 points to build one's self confidence as a leader.
1. Don't worry about being perfect
2. Learn to live with failure
3. After you make the final decision - commit!
4. Show courage on the outside
5. Find happiness and contentment in your work
Here is the link to the article :-
http://blogs.harvardbusiness.org/goldsmith/2009/10/build_your_self_confidence_lik.html
I recently read a marathi book 'Shodh Bhavani Talvaricha' (Search for Bhavani sword) written by Indrajit Sawant. The author has done M.A. in History and is having a collection of different types of historical weapons. (especially swords of Chhatrapati Shivaji's era).
Chhatrapati Shivaji Maharaj was the greatest warrior of 17th century who established Hindavi Swarajya. He brought revolution in traditional maratha weapons. He developed Maratha swords. This type of sword has a unique comfortable hilt with a unique pommel.
Description of different parts of a typical Maratha Sword :-
The author's passion towards the swords and history motivated him to investigate into the real swords of Chhatrapati Shivaji Maharaj and study different types of swords.
There are different types of swords - Dhop, Khanda, Phirang, Latti, Samsher, etc.
The swords belonging to Shivaji Maharaj are of Phirang type. i.e. the blade is of European (Portuguese) made and they are straight and hilt of the sword is of Maratha type. In the historical records,we can find that Shivaji Maharaj was having many swords like Tulaja, Bhavani, Jagadamba, etc.
In this book, the author has given many references / evidences to find out where these swords are located now.
"Jagadamba", one of the swords of Shivaji Maharaj is now in London, in Royal Collection Trust of Royal family of Britain. This sword was presented by Shivaji IV of Kolhapur to Prince of Wales in 1875 AD. (The Royal Collection London - Address: Clarence House, St James's Palace, London, SW1 1BA)
The catalog at Royal collection has the following entry about this sword :-
" Sabre : Maratha: Straight, one-edged old European blade with two grooves on each side, in one of which I.H.S. is stamped three times; the raised steel supports at the hilt are damascened with gold in floral designs; the guarded hilt is iron with a broad knuckle guard and a circular pommel, terminating in a spike and encrusted with heavy open-work Floral decoration of gold thickly set with large diamonds and rubies. Presented by H.H. the Maharaja of Kolhapur as a relic of the Maratha chief Shivaji, to whom it formerly belonged."
Jagadamba sword in Royal collection :-
Efforts are being made to bring back this sword from London back to India. This sword is indeed a source of inspiration to all of us.
Please refer this link for more pictures and information :- http://swordofshivaji.blogspot.com/
I would recommend everyone to read this book.
Many thanks to Indrajit Sawant for doing this excellent research !
I liked these photos taken by Uddhav Thackeray - It includes forts in Maharashtra, some places in Mumbai and some places of worship in India.
http://www.uddhavsphotos.com/photos.html
Two monks were travelling in the rain, the mud sloshing under their feet. As they came to a rivulet crossing, they saw a beautiful young girl, finely dressed, unable to cross because of the mud. Without a word, the older monk picked up the girl and carried her to the other side.
The younger monk was agitated for the rest of their journey and could not control himself once they reached their destination. He exploded at the older monk, "How could you, a monk, even consider holding a woman in your arms, much less a young and beautiful one? It is against our teachings. It is in very bad taste."
"I put her down at the roadside", said the older monk, "Are you still carrying her ... ?"
I came across ruby treemap library and tried simple example with it. RubyTreemap is a library for generating treemaps in ruby in multiple formats such as png, svg and html.
Treemaps are for visualizing data sets and are commonly used to display hierarchical data.
Some good links :-
http://rubytreemap.rubyforge.org/
http://www.oreillynet.com/ruby/blog/2006/07/treemap_on_rails.html
A Node in the treemap has a size and a color. The size can be any value and is specific to your data set. So for example, in a treemap of the book sales, a given node's size could be equal to it's total sales for the day. For all non-leaf nodes the size value must be equal to the sum of the sizes of it's children. If the size is nil it will be calculated by recursively summing the size of the child nodes. The color for a node can be either a value usually a percentage (a rate of change) or a hex string color.
Installation and dependencies :-
-- ruby script/plugin install http://github.com/rails/acts_as_tree.git
-- ruby script/plugin install http://code.qnot.org/svn/projects/acts_as_treemap
-- RMagick (rmagick.rubyforge.org/)
Download and extract RMagick-2.10.0-ImageMagick-6.5.3-10-Q8.zip from
http://rubyforge.org/frs/?group_id=12 :-
gem install rmagick --local (installing rmagick-2.10.0-x86-mswin32 )
-- gem install ruby-treemap --source http://gems.rubyforge.org
Our simple Book Model :-
Here is the table that represents books as treemap :-
and here is the generated treemap :-
You can render the treemap in your view by :-
where @root is the parent treemap node.
We can also override the methods in the Treemap::HtmlOutput class to modify the label names, making lables as hyperlinks, etc.
If we want the rate of change of color, we can modify the model entry as below :-
acts_as_treemap :label => :name, :size => :total, :color => :total
So the rate change of color of blocks will be proportionate to the size of the book sales.
An old labourer, bent double with age and toil, was gathering sticks in a forest. At last he grew so tired and hopeless that he threw down the bundle of sticks, and cried out: "I cannot bear this life any longer. Ah, I wish Death would only come and take me!"
As he spoke, Death, a grisly skeleton, appeared and said to him: "May I help you? I heard you called me just now."
"Please, sir," replied the woodcutter, "would you kindly help me to lift this faggot of sticks on to my shoulder?"
We would often be sorry if our wishes were gratified.
I recently watched Ryan's railscast PDFs with Prawn and tried it on tool version tracker application's index page (Please see my previous blog - Tool Version Tracker )
It was a good experience of writing text, image, table to pdf document with clean and neat code. I was able to generate the pdf document I intended to display in less than 20-25 minutes. (installing prawn gem, prawnto plugin, understanding some API and making code changes :-)
Prawnto is a rails plugin leveraging the Prawn library to produce compiled pdf views. The plugin adds a new template handler class that will process any views with a .prawn extension. These .prawn views are evaluated as ruby code and are provided an instantiated Prawn::Document object as 'pdf'. The pdf object gives you complete access to all of prawn's capabilities.
I added the following line to my index.rhtml page :-
link_to 'PDF Format', tools_url(:pdf)
Then I created index.pdf.prawn file :-
Clicking 'PDF Format' link on index page generated inline pdf for tools as below :-
There are many things that you can do with prawnto. (http://www.cracklabs.com/prawnto/demos) I plan to try these different options.
Have a nice pdf ! :-)
The book 'Code Reading' has been written by Diomidis Spinellis.
This book is the first one to exclusively deal with code reading as a distinct activity. It primarily emphasizes on developing and improvising the Code Reading or comprehending skills of a programmer. The simplest way to learn to write great code is by reading good code. For that, one needs to make a distinction between a good and bad code.
The level of abstraction the programmer can hit upon given a section of code to analyze, depends on his/her code reading skills and perception about the problem. This book helps to enhance these skills.
At the beginning, it briefly introduces the commonly used programming structures and explains how to extract semantic meaning out of them. It talks about different nifty code reading techniques that may be used in the following scenarios –
- Analyzing large bodies of code
- Adding new functionality
- Fixing bugs
- Integrating into new environments
- Code Reuse
It further talks about understanding project build process, following coding standards and conventions, effectively using software documentation to supplement code reading efforts and getting architecture overview from a code in terms of design patterns.
It also describes some of the code reading and browsing tools which can enhance the code reading efficiency. (e.g. Regular expressions, grep for search, diff for difference in files, source navigator for browsing, code beautifiers, runtime tools like profiler – gprof in unix, etc.)
Reading this book will definitely spur interest into the programmers to learn a lot from the existing open source code and make valuable contributions to the open source world in future.
Thanks to Javier Smaldone for developing this gem!
http://railroad.rubyforge.org/
This gem generates model and controller diagrams in RoR application. Javier has built on top of the original idea by Matt Biddulph. I mentioned Matt's idea in one of my earlier posts - Shaping models in RoR.
We should play with RailRoad in all our RoR applications to understand the complexity of the relationships that we have developed.
This is a very nice story which I liked the most !
A man was walking along a beach when he saw a woman picking up starfish off the sand and tossing them into the waves. Curious, he asked her what she was doing. The woman replied "When the tide goes out it leaves these starfish stranded on the beach. They will dry up and die before the tide comes back in, so I am throwing them back into the sea where they can live."
The man then asked her "But this beach is miles long and there are hundreds of stranded starfish, many will die before you reach them - do you really think throwing back a few starfish is really going to make a difference?"
The woman just smiled. She picked up a starfish and threw it into the waves. "It certainly makes a difference to this one" she said.
In our day to day life, we come across many things that we consider very difficult to tackle with. There are many poor people, many mentally and physically retarded people, very old people, really needy people, etc. How can we make a difference in their lives ? Is it practical ? Certainly not. There are definitely some limitations.
But can we take inspiration from the above starfish story and step into making difference to at least one really needy person? Don't you think that will certaily make a difference in his/her life ?
Can we donate our valuable eyes to blind person after our death ?
Can we donate our blood ?
Can we adopt one orphan child for his/her education ?
Can we adopt a child completely ?
Can we help someone to start with small business ?
Actually there are many things that we can do .... we need to start with at least one though !
Long time ago there was a great fire in the forests that covered our Earth. People and animals started to run, trying to escape from the fire. One of the eagles, was flying away also when he noticed a small bird hurrying back and forth between the nearest river and the fire. He headed towards this small bird.
He noticed that it was a small sparrow, flyinging to the river, picking up small drops of water in his beak, then returning to the fire to throw that tiny bit of water on the flame. The eagle approached the sparrow and yelled at him: "What are you doing brother? Are you stupid? You are not going to achieve anything by doing this. What are you trying to do? You must run for your life!"
The sparrow stopped for a moment and looked at the big eagle, and then answered:
"I am doing the best I can with what I have."
Thomas Edison tried two thousand different materials in search of a filament for the light bulb. When none worked satisfactorily, his assistant complained, "All our work is in vain. We have learned nothing."
Edison replied very confidently, "Oh, we have come a long way and we have learned a lot. We know that there are two thousand elements which we cannot use to make a good light bulb!"
Moral: Always take things positively. You can learn a lot from the mistakes you commit. Actually by commiting mistakes, you are laying a strong foundation before the world. So even if you think you have wasted a big time for that, you have actually saved a huge time of others in future...
One day while they were on their way to a distant town, Guru Gampar fell asleep in the bullock cart they were travelling in. His head rolled from side to side and suddenly his turban slipped from his head and fell on to the road. But as their guru had told them never to do anything without his permission, none of the disciples made a move to get down and pick it up.
When the guru woke up and was told about the loss of his turban he was furious. "Next time anything falls off pick it up at once!" he thundered.
Some time later the bullock dropped its dung and the four foolish disciples leaped down and picked it up. Guru Gampar was horrified. He made a list of the things that could fall off from a moving cart. "Pick up any of these things if they fall," he told them, handing them the list. "Don't pick up anything that is not mentioned here."
Just then the cart lurched violently and Guru Gampar was thrown headlong into a ditch. Guru Gampar yelled to his disciples to pull him out.
"We can't, guruji," said his disciples, sadly. "Your name is not on the list you gave us." Guru Gampar pleaded with them to pull him out, but in vain.
"We know you are testing us, guruji," they told him. "But you can rest assured that we will never disobey you. You told us not pick up anything that was not mentioned in your list and we will not do so."
"Give me the list!" yelled Guru Gampar. They threw him the list and the pen and the guru hastily scrawled his name on it.
Then and then only did the obedient disciples pull their beloved guru out of the ditch and put him back into the cart !
Moral : Obedience has to be backed with Conscience and Prudence, otherwise it becomes just a silly act.
In simple words, it is separation of behaviour from the html structure.
Consider the following example :-
The style of this button element, to include the font of its caption, is provided by CSS rules loaded via a stylesheet. But while this declaration does not mix style with structure, it does mix behavior with structure, by including the JavaScript
that is to be executed when the button is clicked as part of the markup of the button element (which in this case, turns something named xyz red upon a click of the button).
For all the same reasons that it is desirable to segregate style and structure within an HTML document, it is also becoming recognized that separation of behavior from structure has just as many, if not more, benefits.
This movement is known as Unobtrusive Javascript.
jQuery is a javascript library which supports this movement. It aims to change the way that web developers fundamentally think about creating rich functionality in their pages. jQuery is generally useful for any page that needs to perform anything but the most trivial of JavaScript operations, but is also strongly focused on enabling page authors to employ the concept of Unobtrusive JavaScript within their pages. With this approach, behavior is separated from structure in the same way that CSS separates style from structure, achieving better page organization and increased code versatility.
The book 'Who moved my cheese?' has been written by Spencer Johnson. It's an amazing way to deal with change in our work and in our life. Many people have reported that what they discovered in the story has improved their careers, businesses, health and marriages.
I found this book very interesting as it correctly identifies human thinking patterns.
Cheese is a metaphor for what you want to have in life - whether it is a good job, a loving relationship, etc.
Maze is where you look for what you want - the organisation you work in, or the family or community you live in.
There are four imaginary characters depicted in the story. They intend to represent the simple and complex parts of ourselves, regardless of our age, gender, race or nationality.
Sniff :- who sniffs out change early
Scurry :- who scurries into action
Hem :- who denies and resists change as he fears it will lead to something worse
Haw :- who learns to adapt in time when he sees changing can lead to something better !
Here are the simple but very important notes/principles mentioned in this book :-
(1) Having cheese makes you happy
(2) The more important your cheese is to you, the more you want to hold on to it
(3) If you do not change, you can become extinct
(4) What would you do if you weren't afraid ?
(5) Smell the cheese often so you know when it is getting old
(6) Movement in a new direction helps you find new cheese
(7) When you stop being afraid, you feel good !
(8) Imagining yourself enjoying your new cheese leads you to it
(9) The quicker you let go of old cheese, the sooner you find new cheese
(10)It is safer to search in the maze, than remain in a cheeseless situation
(11)Old beliefs do not lead you to new cheese
(12)When you see that you can find and enjoy new cheese, you change course
(13)Noticing small changes early helps you adapt to the bigger changes that are to come
Enjoy reading ! :-)
I recently read a book "Vastav Ramayan" (Real Ramayan) written by Dr. P.V.Vartak.
He has done scientific research and calculated dates of the important events during Ramayan era. It is a very interesting and scientific book that everyone should read.
Here is a link for Astronomical Dating of the Ramayan :-
Astronomical dating of Ramayan events
Also, his research shows that South America was known at the Ramayan era. Indians migrated to South America which is called "Patal Lok" in sanskrit. There are some places in South America which denote the Indian culture, like Surya Mandir (Sun Temple), Elephants, Lord Ganesha and snakes carved on ancient monuments, etc.
In Ramyan, when King Sugriv directs his men in all directions in search of Sita, he instructs people going to east direction to check out for a TRIDENT engraved on a mountain. He describes the Trident as "A long Golden flagstick with three limbs stuck on top. It always glitters in when seen from sky". (This trident is on west coast of peru - Lima and is visible clearly from the sky)
In Valmiki Ramayan - Kishkindha Kaand - The sanskrit shlok is as below: (Kishkindha-39/47-48)
The entire Valkimi Ramayan can be found at :-
Complete Valkimi Ramayan in Sanskrit
The description given is so clear that Sugriv or Sage Valmiki must have seen this trident from sky proving they might have aeroplanes to travel.
Around 100 miles from this trident, there is a place called Nazca or Nasca, where gigantic geometric shapes are drawn on land (Spread in miles across). These are visible from sky only. Looks like big airport at that time.
Pls visit these links so that you can get a picture.
Trident at Lima-Peru
Nazca lines
According to Dr. P. V. Vartak, the trident is a sign of east ( as we have 180 degrees today to decide from where west starts ). This was created by Lord Vishnu around 15000 - 17000 years ago. And the lines on the Nazca are the signs of Ancient Airport of King Bali, around 15000 years ago.
If you get a chance, please read this book - Vastav Ramayan! It is awesome !
Also the book 'PataalYatra' by Anil Patil is good to read. It is a fiction inspired by South America and Pataal invention by Dr. P V Vartak.
I have read few fictions of Michael Crichton and very impressed with his writing skills. He keeps one totally engrossed with the story.
Jurassic Park, The Lost World, The Terminal Man, Eaters of the Dead, Timeline, State of Fear, The Andromeda Strain are some of his fictions that I have read and liked all of these.
I have also seen some movies that are based on his novels, but truely speaking the thrill that I experienced while reading the novels was much greater than watching the movie :-)
Whenever a new team member enters to any enhancement project, from technical perspective, he tries to understand the already developed code. Code comprehension may become difficult if there is no proper documentation. There can be many models with different relationships defined amongst themselves. Won't it be good to have some sort of diagrammatic representation of the Model relationships ? It will certainly be very helpful for the development and support teams to understand the application in technical perspective.
Let's develop small and simple ruby code to construct a diagrammatic representation
of the Model (Active Record) relationships (Model in M-V-C architecture) in any Ruby on Rails application. (We will follow KISS principle - Keep it simple and Succinct ! :-)
Active Record is an implementation of the object-relational mapping (ORM) pattern by the same name as described by Martin Fowler:
"An object that wraps a row in a database table or view, encapsulates
the database access, and adds domain logic on that data."
Active Record supports three types of relationship between tables:
(1) one-to-one
(2) one-to-many
(3) many-to-many.
You indicate these relationships by adding declarations to your models: has_one, has_many, belongs_to, and has_and_belongs_to_many.
There is a tool called 'Gvedit' (graphviz-2.20.2.exe) (http://www.graphviz.org/) which generates Directed and Undirected graphs. It accepts a dot file in specific format and it generates directed graphs free of cost ! :-) Why not use this tool ?
We can use the reflections for findling all associations of a Model.
http://api.rubyonrails.com/classes/ActiveRecord/Reflection/ClassMethods.html
Here is the utility which can be run from the rails application root and generates simple text file with the represention that the dot file requires for creating graphs. It looks for all the model classes under app/models directory.
It generates a simple text file as below :-
digraph model_relationship {
Asset -> DbFile [label=belongs_to]
Asset -> Thumbnail [label=has_many]
Category -> Child [label=has_many]
Category -> Content [label=has_and_belongs_to_many]
Category -> Parent [label=belongs_to]
Content -> Category [label=has_and_belongs_to_many]
Content -> Asset [label=belongs_to]
}
Save this as a .dot file. Open this file in Gvedit and run to generate the graph.
Here is a sample graph generated out of Gvedit :-
We can thus get a picture of all the model relationships in a typical ruby on rails application !
There are many sourceforge open source tools and it is sometimes difficult to track the latest vesions of all tools and keep us updated. We should atleast try to track the latest versions of the open source tools that we daily use in our projects.
So why not develop a very simple rails application which will allow you to add, edit and destroy tool information, the sourceforge url, version information, etc. Let's develop tool version tracker app with CRUD operations and some logic to track the tool versions :-) The logic may not be great but definitely useful for core developers who are always looking for new things/tools/versions ! Find the updated versions of the sourceforge tools and send an email with the updated versions to all team members :-) We can either run this periodically through web application or we can do some modifications to run this as a scheduled cron job :-)
We will use hpricot for parsing html.
Let's take an example of checkstyle. If we go to this link :- http://sourceforge.net/project/showfiles.php?group_id=29721
We will find the version information as :-
So in our code we will just compare the release number by parsing the html with hpricot and find out any change in version of the tool.
Here is the code in html_parser.rb under lib :-
In the environment.rb file, add the following line :-
SOURCEFORGE_URL = "http://sourceforge.net/project/showfiles.php?group_id="
For each tool, we have a unique group id.
The migration for Tool model is as below :-
You can view all the tools on index as below :-
You can find the updated version of individual tool or all tools by clicking on the links. So after clicking on the Update versions of all tools, you will get :-
And an email is also sent with the latest information (Simple Rails ActionMailer):-
You can edit/add the tool information from your application as :-
So how do you find it ? It is simple and easy to develop through Rails and definitely useful for all the Automated Tool Lovers :-)
It certainly solves our purpose :-)
In one of my ruby applications, there was a requirement to monitor application log file. We did it very quickly with sinatra web application framework. The requests made are checking whether application is running, viewing log file, etc.
http://www.sinatrarb.com/intro.html
Sinatra is a DSL for quickly creating web-applications in Ruby with minimal effort. In Sinatra, a route is an HTTP method paired with an URL matching pattern. Each route is associated with a block. Routes are matched in the order they are defined. The first route that matches the request is invoked.
Sinatra rides on Rack, a minimal standard interface for Ruby web frameworks. One of Rack’s most interesting capabilities for application developers is support for “middleware” — components that sit between the server and your application monitoring and/or manipulating the HTTP request/response to provide various types of common functionality.
Just do this and you will be on track :-)
gem install sinatra
ruby myapp.rb
In myapp.rb :-
get '/checklog' do
Some code here ...
[200, {"Content-Type" => "text/html"},
"Log is ok?:true or false]
end
CheckStyle is an open source tool that helps in verifying compliance to a coding standard. The rules of the coding standard can be configured in an XML file. This makes it ideal for projects that want to enforce a coding standard.
CheckStyle increases code comprehension and makes code review less taxing. It is most useful when integrated into a build process or development environment.
http://checkstyle.sourceforge.net/
A compiler may have difficulty in finding some commonly occurring defects such as null assignment, empty catch block, catching the canonical Exception instead of a specific one, etc. Dr. Eric Allen lists many instances of these defects in his book ‘Java Bug Patterns’.
PMD can detect such defects in a given set of Java source file once they are described as ‘patterns’. PMD rules can be written in java.
FindBugs & JLint can detect common defects by reviewing the class files. JLint can detect inconsistencies and synchronization problems.
CPD – a variant of the PMD is used for detecting instances of code that has been copy-pasted. Duplication of code indicates non-existence of single point of control. A bug can propagate to other parts of the code if the base code contains bug in it. CPD thus can denote code that needs to be refactored.
http://pmd.sourceforge.net/
http://findbugs.sourceforge.net/
http://jlint.sourceforge.net/
These tools are very interesting and simple to use.
Here are my few articles about trekking and nature ! I have written those in my Mother Language, i.e. Marathi ! :-)
http://trekshitiz.com/articles/Article_Index.htm