Wednesday, October 30, 2013

Saturday, October 26, 2013

cannot load such file -- zip/zip

rake aborted!
cannot load such file -- zip/zip
/home/sachin/.rvm/gems/ruby-1.9.3-p392@prjct/gems/selenium-webdriver-2.34.0/lib/selenium/webdriver/common/zipper.rb:1:in `require'
/home/sachin/.rvm/gems/ruby-1.9.3-p392@prjct/gems/selenium-webdriver-2.34.0/lib/selenium/webdriver/common/zipper.rb:1:in `<top (required)>'
/home/sachin/.rvm/gems/ruby-1.9.3-p392@prjct/gems/selenium-webdriver-2.34.0/lib/selenium/webdriver/common.rb:11:in `require'
/home/sachin/.rvm/gems/ruby-1.9.3-p392@prjct/gems/selenium-webdriver-2.34.0/lib/selenium/webdriver/common.rb:11:in `<top (required)>'
/home/sachin/.rvm/gems/ruby-1.9.3-p392@prjct/gems/selenium-webdriver-2.34.0/lib/selenium/webdriver.rb:7:in `require'
/home/sachin/.rvm/gems/ruby-1.9.3-p392@prjct/gems/selenium-webdriver-2.34.0/lib/selenium/webdriver.rb:7:in `<top (required)>'
/home/sachin/.rvm/gems/ruby-1.9.3-p392@prjct/gems/selenium-webdriver-2.34.0/lib/selenium-webdriver.rb:1:in `require'
/home/sachin/.rvm/gems/ruby-1.9.3-p392@prjct/gems/selenium-webdriver-2.34.0/lib/selenium-webdriver.rb:1:in `<top (required)>'
/home/sachin/prjct-test/lib/test.rb:2:in `require'
/home/sachin/prjct-test/lib/test.rb:2:in `<top (required)>'
/home/sachin/prjct-test/Rakefile:4:in `require'
/home/sachin/prjct-test/Rakefile:4:in `<top (required)>'
/home/sachin/.rvm/gems/ruby-1.9.3-p392@prjct/bin/ruby_noexec_wrapper:14:in `eval'
/home/sachin/.rvm/gems/ruby-1.9.3-p392@prjct/bin/ruby_noexec_wrapper:14:in `<main>'
(See full trace by running task with --trace)

Solution:

Install gem with :

gem install rubyzip -v 0.9.9

OR
 
Add gems in Gemfile :

gem 'rubyzip', '~> 0.9.9'
gem 'albacore'

then do 'bundle install'

and if gem locked in Gemfile.lock
then change the version rubyzip (1.0.0) to rubyzip (0.9.9)


Friday, October 25, 2013

How to install and remove Postgresql in ubuntu 12.04

PostgreSQL:

1) To Install postgresql run this command in terminal

sudo apt-get install postgresql

2) if you facing any error, make sure you already install libpq-dev. The libpq-dev package is 
for compiling wrappers/clients against libpq.
sudo apt-get install postgresql-9.1 libpq-dev

3) Now check it out installation is successful or not
locate postgresql

4) Check the installed version.
psql -V

5) Now let’s take look to postgres console
su postgres

You can install UI for this command:
sudo apt-get install pgadmin3
 Remove PostgreSQL from Ubuntu

* To Remove the Postgresql Completely the command is

1.) sudo apt-get remove postgresql-"version number"

2.) dpkg -l | grep postgresql 

Thursday, October 24, 2013

How to generate temparory URL with localtunnel in ubuntu



Temperory make url with LocalTunnal :


1.)   Install localtunnel using RubyGems. 

       $ sudo gem install localtunnel

2.)   Run your local web server on any port! Let's say you're running Apache on        port 8080.

3.)   Now run localtunnel passing it the port to share. The first time you run            localtunnel you have to point to a public SSH key.

       Here's an example:

       $ localtunnel -k ~/.ssh/id_rsa.pub 3000

       You should see something like this:

       Port 8080 is now publicly accessible from http://8bv2.localtunnel.com         ...

       So your localtunnel link is : 

         http://8bv2.localtunnel.com

       
       Ref By. :

         http://progrium.com/localtunnel/

Gem::Installer::ExtensionBuildError: ERROR

Error : Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem                    native extension.

          /home/sachin/.rvm/rubies/ruby-1.9.2-p320/bin/ruby extconf.rb 
          checking for curl-config... no
          checking for main() in -lcurl... no
          *** extconf.rb failed ***
          Could not create Makefile due to some reason, probably lack of
          necessary libraries and/or headers.  Check the mkmf.log file for more
          details.  You may need configuration options.

          Provided configuration options:
         --with-opt-dir
         --without-opt-dir
         --with-opt-include
         --without-opt-include=${opt-dir}/include
         --with-opt-lib
         --without-opt-lib=${opt-dir}/lib
         --with-make-prog
         --without-make-prog
         --srcdir=.
         --curdir
         --ruby=/home/sachin/.rvm/rubies/ruby-1.9.2-p320/bin/ruby
         --with-curl-dir
         --without-curl-dir
         --with-curl-include
         --without-curl-include=${curl-dir}/include
         --with-curl-lib
         --without-curl-lib=${curl-dir}/lib
         --with-curllib
         --without-curllib
          extconf.rb:23:in `<main>':   Can't find libcurl or curl/curl.h                             (RuntimeError)

          Try passing --with-curl-dir or --with-curl-lib and --with-curl-include
           options to extconf.


Gem files will remain installed in /home/sachin/.rvm/gems/ruby-1.9.2-p320/gems/curb-0.8.2 for inspection.
Results logged to /home/sachin/.rvm/gems/ruby-1.9.2-p320/gems/curb-0.8.2/ext/gem_make.out


Solution:


sudo apt-get install curl  

sudo apt-get install libcurl3 libcurl3-dev

sudo gem install typhoeus 

error occurred while installing debugger-linecache

Error : An error occurred while installing debugger-linecache (1.1.2), and               Bundler cannot continue.
            Make sure that `gem install debugger-linecache -v '1.1.2'`                           succeeds before bundling.

Solution:

gem install debugger-ruby_core_source

Wednesday, October 23, 2013

How to install ruby in cent os server

If you want to upgrade Packages then

sudo yum update

Follow this steps for installation for Ruby

Step 1 : Install recommended Packages 
sudo yum install build-essential openssl libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev autoconf libc6-dev libncurses5-dev automake libtool bison subversion
then press 'y'

Step 2 : Install Git
sudo yum install curl git-core
then press 'y'

Step 3 : Install Ruby Version Manager(RVM)
bash < <(curl -sk https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
Step 4: Setup RVM
         
          echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"' >> ~/.bashrc

Step 5: 
source ~/.bashrc
Step 6 : Check for RVM installation
             It will gie output as "rvm is a function" 
 type rvm | head -1

Step 7 : Install Ruby with version 1.9.3
             You can change with different version
rvm install 1.9.3
If this command ask you for this:
A RVM version 1.23.12 (master) is installed yet 1.23.10 (master) is loaded.  
Please do one of the following:
* 'rvm reload' 
* open a new shell 
* 'echo rvm_auto_reload_flag=1 >> ~/.rvmrc' # for auto reload with msg. 
* 'echo rvm_auto_reload_flag=2 >> ~/.rvmrc' # for silent auto reload.
then do 'rvm reload' 

Step 8: Setup Default Ruby Version
           You can check all installed Ruby versions with command:
           rvm list
           then setup your needed Ruby Version with command:
           rvm use 1.9.3 --default
Step 9 : For check ruby installation is done or not with command…

ruby -v

Saturday, October 12, 2013

What is Ruby On Rails


Here I, Sachin Gevariya introduce to you with new learning language Ruby On Rails(ROR). Developers like me loves it and Business people like it because how quickly applications can be created with it.

Today Ruby On Rails is the hottest technology in web application development. Ruby becomes heart of many websites. In earlier time no one can know about it. Now a day ROR gained its popularity within small companies or start up companies. With Agile process ROR provides better productivity than traditional JAVA or .NET platform.

First of all we know about two parts of Ruby On Rails.

Ruby on Rails, often simply Rails, is an open source web application framework which runs on the Ruby programming language. It is a full-stack framework: it allows creating pages and applications that gather information from the web server, talk to or query the database, and render templates out of the box. As a result, Rails features a routing system that is independent of the web server.

1.) Ruby :- Ruby is a general-purpose programming language that is not in any way specific to web applications. You can use Ruby without Rails — people use it for stand-alone application programs, scripting server administration tasks, and even for web applications that don’t use Rails.

2.) Rails :- Rails is a web application framework, written in Ruby Programming Language. An application framework such as Rails provides a structure for your code and includes a variety of powerful code modules that make many programming simply.

How to install ruby 1.9.3 in ubuntu

If you want to upgrade Packages then

sudo apt-get update

Follow this steps for installation for Ruby

Step 1 : Install recommended Packages 

           sudo apt-get install build-essential openssl libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev autoconf libc6-dev libncurses5-dev automake libtool bison subversion


Step 2 : Install Git

           sudo apt-get install curl git-core


Step 3 : Install Ruby Version Manager(RVM)

bash < <(curl -sk https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
Step 4: Setup RVM
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"' >> ~/.bashrc

Step 5:

 source ~/.bashrc
Step 6 : Check for RVM installation
 type rvm | head -1

Step 7 : Install Ruby with version 1.9.3

rvm install 1.9.3
Step 8: Setup Default Ruby Version

           You can check all installed Ruby versions with command:

                     rvm list
             Set Default Ruby Version

                  rvm use 1.9.3 --default


Step 9 : For check ruby installation is done or not with command…
              ruby -v

Create First Program with Ruby in ubuntu

1.) Open terminal by pressing Ctrl + Alt + T and write command like this:
      – emacs -nw helloworld.rb
      – In ruby file extension must be .rb so here we give the name as helloworld rb , helloworld is a file name            and .rb is extension

2.) And write code here in helloworld.rb:
     puts “Hello World”

3.) Save file by pressing Ctrl + x + s

4.) Exit from editor by pressing Ctrl + x + c

5.) Now how to execute our first program so for that you want to write like this syntax :
     – ruby filename.rb
     – ex : ruby hellowolrd.rb

     – in our case result should be like this

Hello World

How to work with gemset for any project in Ubuntu

1.) How to create gemset
      rvm gemset create gemset_name

2.) How to delete gemset
      rvm gemset delete gemset_name

3.) How to use gemset without rvmrc
     rvm use ‘gemset fullname from list’

4.) For display gemset list
     rvm gemset lists

How to work with .rvmrc and gemset

1.) Find list of gemsets with this:
     rvm list gemsets

2.) Make .rvmrc file for any project with this:
     vim .rvmrc

3.) Edit .rvmrc file
     Press I for insert in vim editor
     rvm --rvmrc use ‘gemset fullname from list’