Ruby on Rails Training

Ruby on Rails- Future of web application development

Ruby on Rails is an elegant, dynamic, compact and exciting web application framework, used to develop dynamic websites.  In very less time ROR has emerged and established itself as one of the fastest growing programming languages.  However, in spite of being one of the forerunners in the technology market, it is not well known among most of the IT professionals.  It is not incorporated in our academic curriculum.  Due to this lack of cognizance among the techies, this jubilant technology is not getting much space, as it should have.  Presently, ROR is a small community, however it has a high potential to challenge many well-established giants like JAVA, ASP .NET etc.

Even after so much of reluctance and challenges of not getting required resource willing to work on this technology, many companies irrespective of their size (big, medium or small) have started working on this fantastic technology.  To full fill the demand of resources, many companies provide training on Ruby on Rails and groom their in-house resources. During the ruby on rails training, many developers apprehend the philosophy of this technology and see their career growth in this.  Developers who are acquainted  with this technology are harnessing all the possible opportunities to walk hand in hand with it, which could come up as a dominant web development environment.  While most of the development environment vying for adhesion, the ROR Web development framework is considering the emergence of a vibrant and growing ecology supporting the technology’s own growth.  Successful companies, which are benefited from the rapidity and agility of developing applications in Rails those results in amplified productivity and growth of the company, have propelled the rising demand for Ruby on Rails.

Moreover, growth of Ruby on Rails has become a debatable topic among the experts.  Some has predicted that it will flourish at a commendable rate and come up as the future of web development, whereas, some experts predict that the future of ROR is bleak and growth couldn’t be assured and it is a less efficient language than others.  It doesn’t have the capability of dwarfing the dominance of JAVA, which has almost become an eternal part of software development.  The efficiency dispute is not economically comprehensive. The vast chunk of application costs is development, training, marketing and sales.  The expense of compute cycles as a portion of overall application incidentals is minute and dwindling fast.  But for the companies where compute cost is a major distress, ROR is becoming more competent because of its latest accomplishments: JRuby, Ruby 1.9, and Rubinius.  So training in Ruby on Rails will pave an entirely new direction in the world of technology for these companies who look out for cost effective measures to grow.  With many mushrooming companies increasingly focused on delivery of information instead of delivery of physical product, many of them preferred Rails to build applications faster, at lower cost and, hence, lower risk.  These companies are leveraging ROR software developing and delivery economics in the fundamentals of their products development.

Nevertheless, as a ROR trained professionals, let us not get predisposed with any of the experts’ opinion but prognosticate based on the statistics available from various authentic sources.

Posted in Ruby on Rails Training | Tagged , , | 2 Comments

Another social network is on its way- Google +

There are many reasons today for Facebook owners to be worried of, like users are getting bored of using Facebook, number of users are declining at a tremendous rate, users are complaining that their privacy are being tampered due to the available data on Facebook and it is not being properly taken care off etc., and one more is added to these reasons. Goggle has announced its latest attempt to capture social networking market with the plan to launch Google+. So  Google + is launched with an intention as “Facebook Killer”.

Apart from the features similar to Facebook, Google+ has many exciting and advanced features, which can overtake the Web’s premier social networking service provider’s market. The major difference between Facebook and Google+ is that instead of having a massive friend list, users collect each other into groups, such as family, work and friends, called “circles.” From close family to foodies, people already use real-life circles to express themselves, and to share with precisely the right folks. So Google did only thing that made sense: with the help of Google+ these circles are brought to software. Just make a circle, add your people, and share what’s new—just like any other day. It has Hangout feature, as the name suggests, this feature is all about hanging out with your buddies, virtually, or Couse. User can choose specific friends, or circles, to invite for a face-to-face video chat and anyone in the Hangout can invite others to join as well. According to Google’s demo: “Until teleportation arrives, it’s the next best thing”. We’re not sure about that – it’s basically just video calling. Sparks is another interesting feature. Tell Sparks what sort of stuff you’re into and it’ll send you things that you might be interested in that you can then watch, read or share. For example, you could type ‘Films’ into the search box and see what comes up. If you like the results, then you can click the ‘Add Interest’ button to add Films to your list of important subjects. Another interesting feature is Hurddle. With the help of this feature user can do group texting. These are the few features, which Google claim itself to be different from other social networking sites. Google+ integrates with other Google services. If you use multiple Google services, you’ll especially welcome Google+. Conversations in it show up in Gmail. You can share photos from Picasa using it.

However the main concerns with most of the social networking sites are their privacy issues. Due to the privacy issues most of the users have left using social networking sites and thus the number of users have been shrunk to a large degree. So what has Google+ done to address this issue? That will only be visible when Google+ will be usable. For now Google+ can only be accessed with a special Field Trial invitation, which Google has been sending out at random to Gmail users. But the question is, do we really need another social networking site? As in this world of social networks relationships are becoming web dependent. We are more interested in virtual relationships. We have stopped finding new friends in our neighbor or in our colony, rather we like finding new friends on Facebook, Orkut etc. and like to share our views, opinions, emotions etc with them. By this way many of us are going far one who is staying close to us and close to one who is very distant. So are these social networks bringing an emotional dis-balance in the society?

Posted in Technology | 1 Comment

Select multiple option without CTRL Click (or Cmd-Click on Mac)


$(document).ready(function(){
customizeMultiSelect();
});

function customizeMultiSelect(){
$('.customize_multiselect option').click(function(){
var select = $(this).parents("select:first");
var option = $(this);
var option_selected = $.inArray(option.val(), select.val()); // return true if clicked option is selected else false

var option_values = new Array(); // use map to avoid iteration
$.each(select.find("option.clicked"), function(){
option_values.push($(this).val());
});

if (option.attr("class").length == 0 || option.hasClass("unclicked")){
option.removeClass('unclicked').addClass('clicked').css({'background-color' : '#316ac5'});
option_values.push(option.val());
} else {
option.removeClass('clicked').addClass('unclicked').css({'background-color' : 'none'});
option_values.splice(option_values.indexOf(option.val()), 1);
}
select.val(option_values);
});
}

Posted in Technology | Tagged , , | Leave a comment

GIT – How to check in which branches a specific commit is present?

Here’s a quick way of doing it :-

1. Take example of this GIT repository - https://github.com/resolve/refinerycms

2. It has 5 different branches

3. If you need to check if Move mime-types requirement to the gemspec and controller instead of Gem… https://github.com/resolve/refinerycms/commit/738c6a0b189c4fa1d540fceb00de2f1f195bc507

is present in which branches then following command helps

git branch –contains 738c6a0b189c4fa1d540

It lists all the branch names that contains the commit mentioned. This helps when we need to cherry-pick certain commits from different branches and want to confirm if commit is already present in current branch or any other available branch.

Read more at http://www.kernel.org/pub/software/scm/git/docs/git-branch.html

 

Posted in Technology | Leave a comment

The importance of employee behavior at workplace

No matter what the industry or business sector, “Positive Workplaces” are built on successful people-to-people relationships. This relationship sets the tone and impacts the workplace. The workplace environment drives employees; those people, who ultimately, drive the business. Given the close proximity of people in the workplace, technology and its affect on our time, the global business culture, and the on-going social and networking interactions, we live in a hectic, fast-paced business world! We can easily forget about the importance of the developing and maintaining the people-to-people connections. Have you ever thought about the role our actions play in rebuilding our important relationships and forging them in our business and personal lives? Etiquette has always been an important part of life, be it social or business. However, it seems that business etiquette has become more important in the last decade. This is mainly due to the fact that the business world is becoming more global .Attitude of a person is reflected in his behaviour. Research has repeatedly proved that knowledge about a person’s attitude helps anticipate his future behavior. This knowledge has great significance at the workplace. Etiquette helps people to understand what is appropriate in any situation. It is also important to know the difference between business protocol and business etiquette. Business protocol determines what actions you take in a situation. Etiquette tells you how to take those actions. Our actions speak about our behavior. In the world of business, it’s not what you do but how you do it. With one small gesture you can impress, insult, appear cultured and educated, or simply become a social outcast. We all know body language plays a part in the way we are perceived by the world, but how much does it affect you at work?

This article significantly conclude the importance of etiquette that includes courtesy, image, trust and reliability; which increases opportunities for new business, fosters congenial business relationship, builds confidence and creates goodwill. India is one of the largest and most multi -cultured country and business culture here tends to be more informal and friendly. Mentioned below are list of few etiquette we should practice:

• Avoid crossing your arms or standing with your hands on your hips or in your trouser pockets. Placing your hands behind your back is a good option. Actions we should avoid are:

1. Hands in pockets- Shows disrespect, and that you have something to hide.

2. Covering your mouth- It suggests you are lying.

3. Shaking feet or legs- It shows indifference and disinterest.

• A beckoning gesture with an upraised forefinger is considered rude.

• Avoid sitting in any manner that would permit the sole of your shoe or foot to be seen, which would be taken as an insult. Placing your feet on a table is especially bad manners. Likewise, if you cross your legs, do not allow the foot of the upper leg to point directly at your host.

• Make contact: There are few physical contacts that are appropriate in business; the most important and acceptable is your handshake. Your handshake is a non-verbal clue that indicates to the other person whether or not you are a take charge person. For example, a firm and strong handshake suggests that you are decisive, in control. Now think of the impression you had after shaking hands with someone that presented a weak, slippery or lifeless handshake. What did that make you think of them? If the handshake is between a male and a female, male should not initiate the handshake.

• Smile: This seems very simple, but it’s amazing how people’s moods and words are misjudged because their expressions are often overly-serious. A smile shows that you like yourself; you like your current place in the world and you’re happy with the people you’re interacting with. No one will say you’re crabby if you’re smiling. A smile says, I’m approachable and confident.

• Make eye contact: Every time a person begins talking to you, look them in the eye and smile first, then get on with the conversation. Also, when you enter a room for a meeting smile and look around at everyone. If you want to start talking to one person – or even a group – come up to them and smile. Again, this is another way to say, I’m approachable.

• Unpleasant manner or style of interacting, including being rude, abrupt, aggressive, dominating, commandeering, intimidating, non-cooperative or unhelpful.

• Spreading rumors and gossip about other employees or about the organization can lead to the breakdown of trust; affect morale and cause conflict at the work place.

• Sabotaging work practices, undermining others, wasting time and failing to co-operate “that’s not my work” are break down of professionalism at work.

• Don’t wear suggestive or revealing clothes. You should follow a proper way of dressing.

• If you are a man, let women enter or exit the door first.

We all know that negative, toxic environments disengage and de-motivate employees, while positive, supportive environments engage and motivate our most valuable asset .Its our behavior which can make our organization a better place to work. It doesn’t matter whether we are self-employed or work for a small business, not-for-profit, educational institution or large corporation, we all need to remember the basics of business etiquette. Keep it simple to survive and thrive in the work place.

Posted in Coffee Break, My Voice | Tagged , | Leave a comment

send_file sends 0 bytes to in Ruby on Rails 3

In my recent project Ruby on Rails 3 application, I had to download files which were uploaded on server. We can easily do this with “send_file”. But with “send_file”, when click to download any file, it was sending only 0 byte file in PRODUCTION mode.

Following is the way to fix this issue,

Comment following line from /config/environments/production.rb file,

config.action_dispatch.x_sendfile_header = “X-Sendfile”

Once above line is commented, need to restart server. Then access application and download file with actual filesize.

Ref URL – http://www.novafist.com/2010/09/send_file-sends-0-bytes-to-client-in-rails/

Posted in My Voice, Technology | Tagged , | Leave a comment

Devise usage in Rails 3 – Devise authentication in Ruby on Rails 3 application

Devise is very simple authentication solution for Rails 3 application.

Steps to implemente authentication in Rails 3 application with Devise,

1) Include devise gem in Gemfile as following,

gem 'devise'

2) Run generator as following,

rails g devise:install

3) Create model ‘User’ to store authentication,

rails g devise MODEL

Here MODEL will be your model name, in my case, my command was,

rails g devise User

4) Now run migration,

rake db:migrate

5) Now you can check for “rake routes”. With devise, user can register for new account, user can sign up, user can reset password.

Start web server, and hit URL http://localhost:3000/admins/sign_up for registration page.

There are many helper method available with devise gem. To read more information, ref – https://github.com/plataformatec/devise

Posted in Technology | Tagged , | Leave a comment

CSV file Upload in Ruby 1.8.x version

In Ruby in Rails application, to upload CSV file where Ruby version is 1.8.x, need to write following code,

require 'csv'

# Import Countries from CSV file

file = File.join("#{RAILS_ROOT}", "db/data", "countries.csv")

csv_file = CSV::Reader.parse(File.open(file, 'rb'))

n=0

ActiveRecord::Base.connection.execute "truncate countries"

print "Loading Countries......."

csv_file.each do |row|

  country = Country.new(:name => row[0], :code => row[1])

  if country.save

    n=n+1

    GC.start if n%50==0

    print "."

  end

end

puts "Countries Loaded."

In above file, there is line,

csv_file.each do |row|

syntax to retrieve records from CSV file is changed in Ruby 1.9.x .  Next post will be for ‘CSV file upload in Ruby 1.9.x version’.

Posted in My Voice, Technology | Tagged , | Leave a comment

CSV file upload in Ruby 1.9.x version

In Ruby in Rails application, to upload CSV file where Ruby version is 1.9.x, need to write following code,

require 'csv'

# Import Countries from CSV file

file = File.join("#{RAILS_ROOT}", "db/data", "countries.csv")

#csv_file = CSV::Reader.parse(File.open(file, 'rb'))    # Ruby 1.8

n=0

ActiveRecord::Base.connection.execute "truncate countries"

print "Loading Countries......."

#csv_file.each do |row|   # Ruby 1.8

# Following works with Ruby > 1.9

CSV.foreach file do |row|

  country = Country.new(:name => row[0], :code => row[1])

  if country.save

    n=n+1

    GC.start if n%50==0

    print "."

  end

end

puts "Countries Loaded."

Above code will work with Ruby 1.9.x version.

Posted in My Voice, Technology | Tagged , | Leave a comment

Set selected value in select_tag in Ruby on Rails

If you want to show selected value in select_tag, then do following,

<%= select_tag "manager[manager_id]",

    options_for_select(["Select Manager"] + @managers.collect { |m| [m.name, m.id] }, @manager_id.to_i)" %>

where @manager_id is the selected value from database, and need to set as selected in select_tag.

Hope this is helpful.

Posted in My Voice, Technology | Tagged , | Leave a comment