Go to the folder where the package exists and do,
$ sudo dpkg -i package.deb
Go to the folder where the package exists and do,
$ sudo dpkg -i package.deb
To find a Rails version in Rails console is also so easy. Once I think about finding the version of Rails and at that time I am working on Rails console, just assuming I typed
ruby-1.9.2-p290 :024 > Rails.version => "3.1.3"
and returns like this. I wonder about Rails Console!!! You see how they made this!!
$ du // This gives you a list of directories that exist in the current directory along with their sizes.
$ du app/ // This gives you a list of directories that exist in the specified directory app/ along with their sizes.
$ du -h // Better output, '-h' stands for human readable format. So the sizes of the files / directories are this time suffixed with a 'k' if its kilobytes and 'M' if its Megabytes and 'G' if its Gigabytes.
$ du -ah // Lists file size also and in human readable format.
$ du -c // This gives only total size of the directories and the grand total.
$ du -ch | grep total // This gives the total size
$ df $ df // This shows the free space in kilobytes Filesystem 1K-blocks Used Available Use% Mounted on rootfs 40316280 5077616 34829228 13% / udev 1474708 0 1474708 0% /dev tmpfs 1482684 9024 1473660 1% /dev/shm tmpfs 1482684 712 1481972 1% /run /dev/sda6 40316280 5077616 34829228 13% / tmpfs 1482684 0 1482684 0% /sys/fs/cgroup tmpfs 1482684 0 1482684 0% /media /dev/sda8 46003208 9172500 34493840 22% /home /dev/sda6 40316280 5077616 34829228 13% /tmp /dev/sda6 40316280 5077616 34829228 13% /var/tmp /dev/sda8 46003208 9172500 34493840 22% /home
$ df -h // With human readable format
$ df -h | grep /dev/sda8 /dev/sda8 44G 8.8G 33G 22% /home /dev/sda8 44G 8.8G 33G 22% /home $ df -h | grep /dev/sda8 | cut -c 41-43 // This command gives the usage percentage of /dev/sda8 22% 22%
Reference: http://www.codecoffee.com/tipsforlinux/articles/22.html
The command ‘uname’ help you to know the information of the system.
$ uname --all # Give you all the information of the system
$ uname -m # Prints the machine hardware name
References:
1) http://linux.about.com/library/cmd/blcmdl1_uname.htm
One day when I tried to login to mysql it is not permitting me to login as a root. Then I found the following solution to get rid of from this issue.
$ sudo /etc/init.d/mysql stop
$ sudo vim /etc/my.cnf
> Add the following line to section [mysqld]:
skip-grant-tables
$ sudo /etc/init.d/mysql start
$ mysql -e "update user set password = old_password('newpassword') where user = 'root'" mysql
$ sudo kill -9 PROCESS_ID
$ vim ~/mysql-init
> Add the following lines:
EOF UPDATE mysql.user SET Grant_priv='Y', Super_priv='Y' WHERE User='root'; FLUSH PRIVILEGES; GRANT ALL ON *.* TO 'root'@'localhost'; EOF
$ mysqld_safe --init-file=~/mysql-init &
$ rm ~/mysql-init
$ sudo /etc/init.d/mysql restart
Login as root!
References:
1) http://www.ipreferjim.com/2011/06/cant-login-to-mysql-as-root/
$ ('#searchbox input').bind('keypress', function(e) {});
var code = (e.keyCode ? e.keyCode : e.which);
if(code == 13) { //Enter keycode
//Do something
}
try the following command.
$ pdf2swf -V
pdf2swf – part of swftools 0.8.1
HJSplit for Linux is a freeware file splitter for Linux with full graphical user-interface.
Download ‘HJSplit’ from Freebytesoftware
$ split -l 1000 my_file.txt # Split the file named my_file.txt into several files with 1000 lines
$ split -b n my_file.txt # Split a file into pieces n bytes in size.
ruby-1.9.2-p290 :058 > f = File.open(“my_file.txt”, “w”)
=>
ruby-1.9.2-p290 :059 > f.write(“This is the first line of my file\n”)
=> 34
ruby-1.9.2-p290 :060 > f.close
=> nil
ruby-1.9.2-p290 :061 > f = File.open(“my_file.txt”, “r”)
ruby-1.9.2-p290 :062 > f.read
=> “This is the first line of my file.\n”
ruby-1.9.2-p290 :063 > lines = IO.readlines(“my_file.txt”)
ruby-1.9.2-p290 :063 > puts lines.first
This is the first line of my file.
A useful link about ruby File manupulation is given below
Install ‘roo’ gem
$ sudo gem install ‘roo’
take the ruby console
$ irb
for example take an xlxs file and try to open
ruby-1.9.2-p290 :003 > require ‘roo’
if you get an error like
/home/prescience-toshiba/.rvm/gems/ruby-1.9.2-p290@rails31rc/gems/roo-1.10.0/lib/roo.rb:6: warning: already initialized constant VERSION
/home/prescience-toshiba/.rvm/gems/ruby-1.9.2-p290@rails31rc/gems/roo-1.10.0/lib/roo.rb:7: warning: already initialized constant LIBPATH
/home/prescience-toshiba/.rvm/gems/ruby-1.9.2-p290@rails31rc/gems/roo-1.10.0/lib/roo.rb:8: warning: already initialized constant PATH
LoadError: no such file to load — zip/zipfilesystem
from /home/prescience-toshiba/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require’
from /home/prescience-toshiba/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require’
from /home/prescience-toshiba/.rvm/gems/ruby-1.9.2-p290@rails31rc/gems/roo-1.10.0/lib/roo/openoffice.rb:3:in `’
from /home/prescience-toshiba/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require’
from /home/prescience-toshiba/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require’
from /home/prescience-toshiba/.rvm/gems/ruby-1.9.2-p290@rails31rc/gems/roo-1.10.0/lib/roo.rb:71:in `’
from /home/prescience-toshiba/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require’
from /home/prescience-toshiba/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require’
from (irb):3
from /home/prescience-toshiba/.rvm/rubies/ruby-1.9.2-p290/bin/irb:16:in `’
ruby-1.9.2-p290 :004 >
Then install the ‘rubyzip2’ gem
$ gem install rubyzip2
and open the file
ruby-1.9.2-p290 :003 > file = Excelx.new(“/home/prescience-toshiba/Documents/abhilash.raw.xlsx”)
output:
=> {[1, 1]=>”Name”, [1, 2]=>”Email Id”, [1, 3]=>”Alternate Number”, [1, 4]=>”Date of Birth”, [1, 5]=>”Mobile No.”, [1, 6]=>”Functional Area”, [1, 7]=>”Area of Specialization”, [1, 8]=>”Industry”, [1, 9]=>”Resume Title”, [1, 10]=>”Key Skills”, [1, 11]=>”Work Experience”, [1, 12]=>”Current Employer”, [1, 13]=>”Previous Employer”, [1, 14]=>”Current Salary”, [1, 15]=>”Level”, [1, 16]=>”Current Location”, [1, 17]=>”Preferred Location”, [1, 18]=>”Course(Highest Education)”, [1, 19]=>”Name”, [1, 20]=>”Email Id”, [1, 21]=>”Alternate Number”, [1, 22]=>”Date of Birth”, [1, 23]=>”Mobile No.”, [1, 24]=>”Functional Area”, [1, 25]=>”Area of Specialization”, [1, 26]=>”Industry”, [1, 27]=>”Resume Title”, [1, 28]=>”Key Skills”, [1, 29]=>”Work Experience”, [1, 30]=>”Current Employer”, [2, 1]=>”Rahel Robert”, [2, 2]=>”rtrobert@yahoo.com”, [……………………..