Author Archives: Raghavendar T S

“Active Record::Connection Not Established” Error in Ruby on Rails (ROR) when Connecting to MYSQL Server – Solution

"ActiveRecord::ConnectionNotEstablished" Error in Ruby on Rails (ROR) when Connecting to MYSQL Server

“Active Record::Connection Not Established” Error in Ruby on Rails (ROR) when Connecting to MYSQL Server – Solution

      I got this error “ActiveRecord::ConnectionNotEstablished” while using Ruby on Rails with MYSQL initially. The error means that the Rails framework is not able to connect to MYSQL server. The problem is that the root(MYSQL) user was not able to connect to MYSQL through Rails. So to solve this issue, login as root in MSQL and create a new MYSQL user and config Rails to use the new MYSQL user and password.

Create User MYSQL Command:

CREATE USER ‘user’@’localhost’ IDENTIFIED BY ‘password’;

Grant Access to Required Database to the New User:

GRANT ALL PRIVILEGES ON *.* TO ‘user’@’localhost’;

Note: The first * represents the database and second * represents the table name. *.* means that user is given access to all databases and its table. You can also give restricted access to a specific database by replacing *.* by database_name.* 

      Now use the new MYSQL user in config/database.yml file which solves the issue.

Setup Used:

  • Gem v1.8
  • Ruby v1.9
  • Rails v4.0.3
  • MYSQL Server v5.5
  • mysql2 gem in Rails
  • Rails default web server (WEBrick)

Ruby on Rails – Error installing mysql2: Failed to build gem native extension – Ubuntu Linux

"ActiveRecord::ConnectionNotEstablished" Error in Ruby on Rails (ROR) when Connecting to MYSQL Server

Ruby on Rails – Error installing mysql2: Failed to build gem native extension – Ubuntu Linux

      This is a very common issue where we get error “Error installing mysql2: Failed to build gem native extension” while installing mysql2 gem in Rails(in Ubuntu Linux OS). The problem is due to missing libmysql(from MYSQL) file.

Linux Solution:

      To solve the issue install the compnents libmysql-ruby and libmysqlclient-dev using the command sudo apt-get install libmysql-ruby libmysqlclient-dev (Run in Ubuntu Terminal). Then run gem install mysql2 which should run successfully.

Windows Solution:

      Run the following command where we pass the location of MYSQL lib and include folder. Replace the PATH with the actual location of MYSQL Server application.

gem install mysql2 — ‘–with-mysql-lib=”PATH\MySQL Server 5.5\lib” –with-mysql-include=”PATH\MySQL Server 5.5\include”‘

How to install Ruby on Rails (ROR) in Ubuntu Linux

"ActiveRecord::ConnectionNotEstablished" Error in Ruby on Rails (ROR) when Connecting to MYSQL Server

How to install Ruby on Rails (ROR) in Ubuntu Linux

      There are a lot of posts out there to install Ruby on Rails in Linux and Windows which are not clear explained. The reason is that latest version of Ruby and Gem are causing some issues due to which we are not able to use Rails. So I have given simple steps to install Ruby on Rails in Ubuntu Linux.

  1. Install Ruby – sudo apt-get install ruby
  2. Use ruby -v to check for the version you are using.
  3. Configure system to use the Ruby version 1.9 –  sudo update-alternatives –config ruby. Select which version to use.
  4. Install rubygem – sudo apt-get install rubygems
  5. Configure system to use the gem version 1.9- sudo update-alternatives –config gem. Select which version to use.
  6. Install Rails – sudo apt-get install rails
  7. MYSQL & Apache will be installed by default. If it is not installed use the following command to install it.
  8. Install MYSQL – sudo apt-get install mysql-server 
  9. Install Nodejs – sudo apt-get install nodejs
  10. To install mysql2 gem, you need to install the following sudo apt-get install libmysql-ruby libmysqlclient-dev
  11. Check whether Rails is working – rails new app1
  12. Start the app – rails server inside app1 folder.

Note: This setup was tested in Ubuntu 12.04 LTS.

Use Single Keyboard & Mouse with multiple CPUs or Computers

Share single Keyboard & Mouse with 2 or more Computers using Free Software

Use Single Keyboard & Mouse with multiple CPUs or Computers

      There are many situations where a user needs to use a single keyboard & mouse with 2 or 3 computers or CPUs (with either one monitor or more than one monitor). Is this kind of setup possible? Yes. It is possible with either using a software or hardware. Both the approaches have its own pros and cons.

Share Keyboard & Mouse using Software

      There are many free and licensed software available to download to make use of single keyboard & mouse with 2 or more computers.

Share single Keyboard & Mouse with 2 or more Computers using Free Software

Share single Keyboard & Mouse with 2 or more Computers using Free Software

Software – Input Director & Synergy
Share Keyboard & Mouse using KVM Switch(Hardware)

      There is a special hardware called KVM Switch which can be used to share single keyboard, single mouse and single monitor with multiple CPUs. The number of CPUs that can share the same keyboard, mouse and monitor depends on the cost and specificaiton of KVM switch.

Share single Keyboard & Mouse with 2 or more Computers using KVM Switch

Share single Keyboard & Mouse with 2 or more Computers using KVM Switch

      A KVM switch costs around Rs 2500 in India which can share same keyboard, mouse and a monitor with 4 CPUs.

TypeProCon
SoftwareFree
Share Keyboard & Mouse
Cannot share Monitor
KVM SwitchShare Keyboard, Mouse & MonitorNot Free

Social Mobile Apps for Indian General Election 2014

Social Mobile Apps-Indian General Election 2014

Social Mobile Apps for Indian General Election 2014

      The internet was once a craze among people. Now it has become very much common. With the internet spread all over the world, the idea of social networking in internet came in picture. Social Networking created a great platform for every one including small-scale to large-scale industries. People were able to build their network of friends which resulted in more social interaction. The industries were able to do research on market to understand people and their trends.

      Social Networking has become a great platform to publicize products, games, movies and many more. It has become a part of human life. Is it good? Yes! If we use it in right way. The teenagers(youth) are among the top users of the social networking sites such as Facebook, Twitter, Google+ and many more. These youths can help India by contributing their views and ideas for the goodness. Social Network is a platform which can drive the youths to vote for the coming Indian General Elections 2014.

Social Networking – A Driving Force For The Youths

      The previous generation people were very much interested in Indian politics and Indian economy. There was no driving force for them in knowing about the Indian politics other than news papers. But with all technologies and social networking, the current generation youths can bring a drastic change in Indian politics. Many youths though show their interest in politics, many doesn’t turn up during the voting. What is the reason behind it?

      Corruption is one thing which I think is making the people in non-exercising their vote. Many people do not exercise their voting right. There are many people who wants a great leader to lead, but they fail to choose the leader during the election. A great leader can come only if the youths can contribute their vote in selecting their leader. In my personal opinion, only the youths can bring a change in the society. The current generation youths are highly qualified, both in terms of education and technology which is great necessity for bringing out new and innovative ideas to the country more prosperous.

Why not a youth can become a leader?

      The question has already been asked in many movies. There are a lot of youths in India who are passionate about India and stand for election. But they fail to get the votes for winning. The reason for the fail is the younger generation people who fail to understand the real politics.

Social Mobile Apps for Indian General Elections 2014

      There are millions and millions of people using social networking sites and applications of which youths and teenagers are the biggest audience. Many fail to update themselves in knowing news about the election. So use of social networks will make both leaders and public people share their ideas, suggestions etc. Social Mobile Apps make great news go viral in seconds of time. Social Network is a great platform for the leader and candidates who are standing for election in showcasing their positive views and ideas. With all technologies in hand, younger generation people can easily become next generation leaders. Many people fail to know about the younger candidates who stand for election. But using social network as a platform can make a big difference. This will make the youths to know about the current Indian politics and in turn drives them in exercising their voting right. The social network will help the common people to about the Indian election in positive manner. Use of technology can create a great impact on the youths. This is one of the smart way to attract  and gain more audience.

Election Process with Smartphone Applications

      The world has gone digital. There are millions of transaction going on in the internet in a secure way. Why not we can make a smartphone application to mobilize the voting process? Mobile applications have become very much popular. They make the living style more comfort and easier. So mobile applications for voting can make the youth more easier in exercising their vote. Who can develop these apps? Well only the youths can do it. But they require strong permissions and rules from the government in designing the standards for voting process and building it.

Social Mobile Apps for Election Campaigns

      Before a decade, people used to conduct campaigns in public places to attract people. But they same campaigns can be digitized and mobilized now. The youths can actively contribute their vision to the people who are standing for election. One of the another great advantage is that the public people can have direct contact to the people who are standing for the election. This creates rich bond among everyone. Social networking and forums will bring transparency among everyone. The candidates can build mobile applications and sites for themselves to get well-recognized in the society. These kind of new and innovative strategies can technologist and corporate people get more interested in politics. Politics can be won only by targeting all kinds of audience in the society.

Inspiring Children in knowing about Politics

      Now a days, children have a wide range of access to the internet and applications in home, schools and colleges. So they are very much aware about current trends in all areas of the world and also the internet and social network make the children understand the ins and outs of the politics. Though children do not have voting right, the leaders should make sure that the children understand about politics because they are next people. Politics is not just a short-term plan. The leaders should prepare for everything beyond their life time.

      Thus mobilizing the Indian General Elections 2014 in social network will bring out complete makeover among the youth and will make the maximum vote percentage as never before.