Showing posts with label ubuntu. Show all posts
Showing posts with label ubuntu. Show all posts

Tuesday, July 5, 2011

How to get started with tata photon on ubuntu machine

by sandipransing 0 comments
In order to get tata photon working on ubuntu machine you need to install following packages
1. usb-modeswitch-data 2. usb-modeswitch
Either you can download them from ubuntu site and install locally or install using apt manager
Download links
http://packages.debian.org/squeeze/usb-modeswitch-data http://packages.debian.org/squeeze/usb-modeswitch
apt installation
sudo apt-get install usb-modeswitch-data usb-modeswitch usb-modeswitch
After successful installation,
1. Connect photon usb card
2. Execute following commands one after another. sudo usb_modeswitch -c /etc/usb_modeswitch.d/12d1\:1446 wvdial
...and you should get connected via photon!
Read More…

Thursday, March 25, 2010

ruby on rails installation on fresh ubuntu machine

by sandipransing 0 comments

Ruby On Rails Installation on fresh ubuntu machine

Installation steps are applicable to ubuntu versions interpid, karmic koala. Make necessary changes according to package manager provided by other linux operating systems in order install ruby and rails.

Before getting started to installations make sure to build essential packages on fresh ubutnu machine. Ubuntu machine has built in apt-get package manager and that i loves because it is very to use as compared to other OS.
sudo apt-get install build-essential

Now there are many versions of ruby available including latest 1.9.2
But would like to prefer ruby version 1.8.7 as it is the most stable version as of now. I would like to recommend installtion of Ruby Enterprise Edition (REE) version as it is uses minimal system resources and consumes less memory.

Instrunctions to setup normal ruby and rails environment


1. Install Ruby, Rails, MySQL, irb and neceesary packages using single command
sudo apt-get install ruby ri rdoc mysql-server libmysql-ruby ruby1.8-dev irb1.8 libdbd-mysql-perl libdbi-perl libmysql-ruby1.8 libmysqlclient15off libnet-daemon-perl libplrpc-perl libreadline-ruby1.8 libruby1.8 mysql-client-5.1 mysql-common mysql-server-5.1 rdoc1.8 ri1.8 ruby1.8 irb libopenssl-ruby libopenssl-ruby1.8 libhtml-template-perl mysql-server-core-5.1 libmysqlclient16 libreadline5 psmisc
2. Install ruby gems
wget http://rubyforge.org/frs/download.php/60718/rubygems-1.3.5.tgz
tar xvzf rubygems-1.3.5.tgz
cd rubygems-1.3.5
sudo ruby setup.rb
3. Create symbolic links to installation paths
sudo ln -s /usr/bin/gem1.8 /usr/local/bin/gem
sudo ln -s /usr/bin/ruby1.8 /usr/local/bin/ruby
sudo ln -s /usr/bin/rdoc1.8 /usr/local/bin/rdoc
sudo ln -s /usr/bin/ri1.8 /usr/local/bin/ri
sudo ln -s /usr/bin/irb1.8 /usr/local/bin/irb
4. Setup gemrc in order to avoid rdoc installation and to setup gem sources.
Add following lines to ~/.gemrc file
---
gem: --no-ri --no-rdoc
:benchmark: false
:verbose: true
:backtrace: false
:update_sources: true
:sources:
- http://gems.rubyforge.org
- http://gems.github.com
:bulk_threshold: 1000
5. Install rails
sudo gem install rails --no-rdoc --no-ri

Ruby Enterprise Edition i.e. REE (ruby 1.8.7) Installation


This will install ruby, rails, mysql, nginx and passenger

1. Download REE setup and install it
wget http://rubyforge.org/frs/download.php/68719/ruby-enterprise-1.8.7-2010.01.tar.gz /opt/ruby

cd /opt
./ruby/installer

2. Add ruby inside path
vi ~/.bashrc
# Add following line at the end of file
export PATH=/opt/ruby/bin:$PATH

Thanks to @vwadhwani!
Read More…

Tuesday, March 23, 2010

Imagemagick/ RMagick Installation on ubuntu

by sandipransing 0 comments

ImageMagick Installation

Ubuntu machine has default apt-get package manager.
To install imagemagick following packages needs to be installed.

apt-get install imagemagick librmagick-ruby libmagickwand-dev

RMagick gem install

gem install rmagick

If you still facing problems with gem installation, Please look that following packages are installed
on your system.

dpkg -l | grep libmagickcore-dev graphicsmagick-libmagick-dev-compat

If there are no packages installed then try to install then first.

apt-get install libmagickcore-dev graphicsmagick-libmagick-dev-compat

Try to install rmagick gem again. Now it should be installed without any error.

Read More…

Thursday, March 11, 2010

alternative for tortoise svn on ubuntu

by sandipransing 0 comments
The Tortoise svn client on windows is one of my favorite svn client.
I am working on ubuntu karmic koala from last one year.
There are kdesvn. smartsvn svn clients available on ubuntu but still
time haven't found any svn client as good as tortoise svn on windows.

Is there any alternative ??? Can tortoise svn client installation possible
using wine utility package in ubuntu ??

Read More…

Tuesday, March 2, 2010

Programming ruby Linux basics

by sandipransing 0 comments
Remove svn files inside directory
rm -rf `find . -type d -name .svn


Set path in linux
export PATH=$PATH:/usr/ruby/bin
Here /usr/ruby/bin is the path to ruby extecuatble.

grep and print process pid
ps -ef | grep search_string | grep -v grep | awk '{print  $2 }'


Kill process
kill -9 process_id_here
ps -ef | grep search_string | grep -v grep | awk '{print  $2 }' | xargs kill -9


Store pid of process in a variable for further process
tokill=`ps -ef|grep ruby|grep -v grep|awk '{print $2}'`;kill -9 $tokill;


Mirror a website
Command to clone/copy a website for offline/local browsing.
wget -mk www.funonrails.com

Above command downloads all website pages in depth level with stylesheets, images and javascripts.
Read More…

Tuesday, February 16, 2010

Copy database to another database through command

by sandipransing 0 comments
1. Copy One database to another database on same host
mysqldump -uroot -p | mysql -uroot 2. Copy database to another database on remote host
mysqldump -uroot -p | ssh host2 "mysql -uroot "
Read More…

Monday, December 14, 2009

Getting wired and wireless working on ubuntu 9.0.4

by sandipransing 0 comments
It might be the case that earlier wireless was working and then it stopped working
Follow the simple steps here....
1. Restart networking
sudo /etc/init.d/networking restart
2. Disable the "Support for Atheros 802.11 wireless LAN cards" on system/administration/Hardware Drivers, and reboot your box.
3. Restart
sudo reboot

That's it, Cheers! Still having problem follow the instructions here
Read More…

Monday, November 23, 2009

Upgrading openoffice in ubuntu interpid

by sandipransing 0 comments
Follow simple steps defined in this post for smooth upgrade of openoffice in linux.

click here
Read More…

Wednesday, November 18, 2009

Get hand over VI / VIM editor

by sandipransing 1 comments

Movements
b   previous word
w   next word
e        end of word
0/^      begining of line
$        end of line
G        end of file
1G/gg    begining of file
/pattern  search next
?pattern  search previous
n         repeat    search forword ( i.e next occurence )
N         repeat    search backword
:line     goto line specified

  *****Modes****
  i   insert mode
  r   replace mode
  s   delete character under cursor and eneter insert mode

  *****Delete******
  x    delete character under cursor
  dd   delete current line
  line dd delete number of lines specified

  ****copy********
  yy        copy current line
  pp        print copied contents
  line yy   copy number of lines specified

  *******visual******

  v     enter visual mode
  aw    highlight word
  as    highlight sentence
  ap    highlight paragraph
  ab    highlight block

  ******undo/redo******
  u       undo
  cntrl+r redo

  ******autocomplete****
  cntrl+x   enter completion mode
  cntrl+p   display autocomplete options

  ******uppercase/lowercase*****
  guu   lowercase line
  gUU   uppercase line

  *******Regx replace****

  range s/foo/bar/arg - replace foo with bar in ‘range’ with

  Values of 'range':
  %               whole file
  number          that particular line
  none            apply to current line only

  values of 'arg':
  none  apply to first occurrence
  g     global (all occurrences)

Select/Macros
  qchar      start recording macro storing it in register ‘char’
  q          end recording
  @char      replay the macro stored in ‘char’
  :1,10 norm! @char run the macro stored in ‘char’ over the 1-10 line range

Read More…

Sunday, November 15, 2009

pidgin install and update pidgin messenger on ubuntu interpid

by sandipransing 0 comments
Fresh pidgin Installation
 sudo apt-get update
 sudo apt-get install pidgin
Earlier versions of pidgin has problem in connecting yahoo messenger which is solved in newer versions.
In order to update old version of pidgin, simply follow instructions written below and you are done.
New version provides video and voice chat, also buddy icon improvements are added.

Add GPG key
 sudo apt-get update
 sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A1F196A8
Goto System > Administration > Software Sources and select Third-Party Software tab and click ADD. And Simply Copy-Paste the following Repo
deb http://ppa.launchpad.net/pidgin-developers/ppa/ubuntu intrepid main 
deb-src http://ppa.launchpad.net/pidgin-developers/ppa/ubuntu intrepid main
Read More…

Friday, November 6, 2009

Linux commands for remote access, compress, decompress

by sandipransing 0 comments


Remote Login
============
ssh client is a program for logging into remote machine and execute commands.

ssh [-l login_name ] hostname | user@hostname [command ]

other options

ssh [-afgknqstvxACNTX1246 ] [-b bind_address ] [-c cipher_spec ] 
[-e escape_char ] [-i identity_file ] [-l login_name ] [-m mac_spec ] 
[-o option ] [-p port ] [-F configfile ] [-L port host hostport ] 
[-R port host hostport ] [-D port ] hostname | user@hostname [command ]

One can use putty for remote login through windows machine

Remote Copy
============
scp - secure copy (remote file copy program) that copies file between computers over network

scp source[ source file path] destination[user@funonrails.com:/home]

Other options

[-F ssh_config ] [-S program ] [-P port ] [-c cipher ] [-i identity_file ] 
[-o ssh_option ] [[user@ ] host1 : file1 ] [... ] [[user@ ] host2 : file2 ]

One can use pscp.exe for remote copy from windows machine

Compress
============
tar - is a package that allows you to compress direcory or file

tar czfv Test.tar.tgz Test/

Decompress
============
gzip - is a package that allows to extract compressed file/directories.

gzip -dc target.tar.tgz | tar xf -




Read More…

Monday, October 26, 2009

Find processor (cpu) information on linux

by sandipransing 0 comments
Here is the command

cat /proc/cpuinfo


Example use on my ubuntu machine, It shows me.



cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 15
model name : Intel(R) Pentium(R) Dual CPU T2330 @ 1.60GHz
stepping : 13
cpu MHz : 800.000
cache size : 1024 KB
physical id : 0
siblings : 2
core id : 0
cpu cores : 2
apicid : 0
initial apicid : 0
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc arch_perfmon pebs bts pni monitor ds_cpl est tm2 ssse3 cx16 xtpr lahf_lm
bogomips : 3191.95
clflush size : 64
power management:

processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 15
model name : Intel(R) Pentium(R) Dual CPU T2330 @ 1.60GHz
stepping : 13
cpu MHz : 800.000
cache size : 1024 KB
physical id : 0
siblings : 2
core id : 1
cpu cores : 2
apicid : 1
initial apicid : 1
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc arch_perfmon pebs bts pni monitor ds_cpl est tm2 ssse3 cx16 xtpr lahf_lm
bogomips : 3192.03
clflush size : 64
power management:

Read More…

Wednesday, October 14, 2009

Getting wireless working on ubuntu machine

by sandipransing 1 comments
Please follow following steps blindly to get wireless working on ubuntu machine.

Here are the steps...

On a fresh clean Ubuntu machine:
1. Disable the "Support for Atheros 802.11 wireless LAN cards" on Hardware Drivers, and reboot your box.

2. In a terminal:

2.1 Updates all package lists
# sudo apt-get update

2.2 Update driver.
# sudo apt-get install linux-backports-modules-intrepid-generic


3. Reboot.

Thanks to Gautam, directing me correct way :)
Here are the steps
Read More…

Monday, October 12, 2009

Feedzirra installtion on ubuntu interpid

by sandipransing 0 comments
Feedzirra is a feed library that is designed to get and update many feeds as quickly as possible. This includes using libcurl-multi through the taf2-curb gem for faster http gets, and libxml through nokogiri and sax-machine for faster parsing.
sudo apt-get install libcurl3 libxml2 libxml2-dev libxslt1-dev


sudo gem install pauldix-feedzirra

Read More…

Wednesday, October 7, 2009

Converting dos(windows) files to unix files

by sandipransing 0 comments

While using windows we get ^M characters in files that will get displayed when you open files on unix machines.


To remove such ^M characters,


Install dos2unix package using


sudo apt-get install sysutils


Convert individual file


dos2unix file_path


Run following command to convert recursively all the files inside directory.



find . -type f -exec dos2unix {} \;




sudo apt-get install sysutils

Read More…

Wednesday, September 30, 2009

Managing multiple ruby versions and rails versions with rvm

by sandipransing 2 comments
While working with many projects that uses different ruby versions and rails versions, one big problem arises that how do we manage all this ?

We know that managing multiple rails versions wont be problem at all.
but what about ruby versions, How one can manage multiple ruby versions. also while upgrading or degrading ruby version, we need to install all gems again including rails.
i know this is a big pain :(
How we can overcome this headache. meantime there must be some incompatibilities between two different ruby and rails versions.

Yesterday, i did some research and came to know that...

+ ruby 1.8.7 and rails 2.3.3 got quite stability and effectively. we can use it in next developments.
+ Also, after installing ruby 1.9.1 and dependent gems for my project,
and wondering that there are many incompatibilities while installing new gems with ruby 1.9.1

Some of the gems are mysql, ferret, acts_as_ferret, erubies, etc.

Today, while google, i found rvm gem and that seems very nice to manage multiple ruby versions.


Here are some steps explaining how to use it.

# Install rvm gem to manage multiple ruby version
# pre-requisite is that we already have ruby and rubygems installation
1. sudo gem install rvm

# Install rvm for a particular user
# It will also show how to use gem
2. rvm-install

3. Open new shell

# Show all ruby, jruby installations
4. rvm list

# Install ruby
# specify ruby version
5. rvm install RUBY_VERSION_TO_BE_INSTALLED
(rvm install 1.9.1)

# Install jruby
# By default it will install jruby-1.3.1
6. rvm install jruby

# Specify which ruby version to use ?
# Note: Be sure that ruby version is installed
7. rvm use RUBY_VERSION_TO_USE
(rvm use 1.9.1)

#. Default i.e. version before rvm gem installation
8. rvm use default

Sounds, cool :)
Read More…

Friday, May 22, 2009

vi / vim Shortcuts

by sandipransing 2 comments
Open file
vi filename
As i am newb on linux macine, i dont know vi shortcuts.
so, i am listing down shortcuts which i am getting familier. :)

Insert in file
i

Exit file
q

forced exit
q!

save file
wq

forced save
wq!

Copy no of lines
yy

Paste copied lines
pp

Undo changes
uu

Delete lines
dd

To search and replace string in vi
:%s/search_string/replacement_string/g

To find particular word in file
?string1

If you have any quick list. please, let me know
Read More…

About The Author

Sandip is a ruby on rails developer based in pune and also a blogger at funonrails. Opensource contributor and working with Josh software Private Limited. for more info read Follow Sandip on Twitter for updates.

Connect With Me...

Github Projects

@sandipransing Twitter