Thursday, March 25, 2010

Install sqlite3-ruby on Ubuntu 10.4 (for using with sequel)

I got this error while trying install sqlite on Ubuntu 10.4

/opt/ruby-1.9.1-p376/bin/ruby extconf.rb install sqlite3-ruby ruby=/opt/ruby-1.9.1-p376/bin/ruby
checking for fdatasync() in -lrt... yes
checking for sqlite3.h... 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.


1. Install sqlite3

luan@luan-laptop:~$ sudo apt-get install sqlite3


2. Install libsqlite3-dev
luan@luan-laptop:~$ sudo apt-get install libsqlite3-dev

3. Install sqlite3-ruby for using with sequel
luan@luan-laptop:~$ sudo gem install sqlite3-ruby

Monday, February 22, 2010

Can't find tokyocabinet native extention

luan@luan-laptop:~/app/software/ruby/tokyo_projects$ ruby hash_db.rb
hash_db.rb:1:in `require': libtokyocabinet.so.9: cannot open shared object file: No such file or directory - /opt/ruby-1.9.1-p376/lib/ruby/site_ruby/1.9.1/x86_64-linux/tokyocabinet.so (LoadError)
from hash_db.rb:1:in `
'

he solution was to modify the LD_LIBRARY_PATH to include /usr/local/lib or to where the ruby lib is located.


Modified:

sudo vi .bashrc

#~/.bashrc

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib

Tuesday, February 9, 2010

install ruby 1.9.1 script

http://gist.github.com/59130

#!/bin/sh

PATCH=376

mkdir -p /usr/local/src && cd /usr/local/src
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-p$PATCH.tar.bz2
tar -xjvf ruby-1.9.1-p$PATCH.tar.bz2
cd ruby-1.9.1-p$PATCH
./configure --prefix=/usr --program-suffix=19 --enable-shared
make && make install

install ruby 1.9.1p376 on Ubuntu 9.10

First, remove any ruby version on the system:

sudo apt-get remove --purge ruby1.8 ruby1.9

-- package build dependencies (ruby)

sudo apt-get build-dep ruby1.9

-- get ruby 1.9 source
-- if you can't get it, try to download from
-- http://www.ruby-lang.org/en/

wget -c ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-p376.tar.gz

-- extract ruby source using tar

tar -xvzf ruby-1.9.1-p376.tar.gz

-- go to extracted ruby code dir

cd ruby-1.9.1-p376/

-- execute configure
./configure --prefix=/opt/ruby-1.9.1-p376 --enable-shared

-- execute make command
make

-- install process
sudo make install

Then I add the following line to the bottom of $HOME/.bash_profile

luan@luan-desktop:~$ cat .bash_profile
export OC4J_HOME=/opt/oc4j

export JAVA_HOME=/opt/java
export ECLIPSE_HOME=/opt/eclipse
export GROOVY_HOME=/opt/groovy

export GRAILS_HOME=/opt/grails
export TNS_ADMIN=/opt/oracle
export ORACLE_HOME=/u01/app/oracle/product/11.1.0/db_1
export RUBY_HOME=/opt/ruby

export NLS_LANG=AMERICAN_AMERICA.UTF8
export PATH=$ORACLE_HOME/bin:$RUBY_HOME/bin:$JAVA_HOME/bin:$OC4J_HOME/bin:$ECLIPSE_HOME:$GROOVY_HOME/bin:$GRAILS_HOME/bin:$PATH

export AWT_TOOLKIT=MToolkit

Create a link:

luan@luan-desktop:/opt$ ln -s /opt/ruby-1.9.1-p0 /opt/ruby

luan@luan-desktop:/$ cd

luan@luan-desktop:/$ s
ource .bash_profile

luan@luan-desktop:/$ ruby -v
ruby 1.9.1p376 (2009-12-07 revision 26041) [x86_64-linux]


If you are using ruby gem, you need to type:
sudo /opt/ruby/bin/gem

Thursday, May 28, 2009

FTP with backslash in username or passwd

If you have a backslash in username or passwd, you need to do a special character to escape backslash.

For example: ftp\username

export ftpusername='ftp\\username'

If you put a double quote around export ftpusername, it doesn't work. Or if you try to add "/" like "ftp/\username" doesn't work either. Imagine how syntax could get your way.

Saturday, May 9, 2009

Ubuntu useful commands

To install .deb package.

sudo dpkg -i package_file.deb

When using vi editor in Awn gnome-terminal, ESC does not work, but Ctrl+[. It's hard to use vi in Awn, but it's still work.

-- searching virtualbox in the system

sudo aptitude search virtualbox

-- install virtual box

sudo apt-get virtualbox-ose

-- get new updates

sudo apt-get update

-- install updates

sudo apt-get upgrade

-- How to change files/folders ownership

sudo chown username /location_of_files_or_folders

-- If you want to change ownership of all containing files and folders recursively, use the -R option like this:

sudo chown -R username /location_of_files_or_folders

-- How to change files/folders group ownership

sudo chgrp groupname /location_of_files_or_folders

-- If you want to change group ownership of all containing files and folders recursively, use the -R option like this:

sudo chgrp -R username /location_of_files_or_folders

yakuake drop-down terminal emulator

This is my favorite terminal emulator.

Yakuake is a drop-down terminal emulator based on KDE Konsole technology.

http://yakuake.kde.org/

You can install on Ubuntu:

sudo apt-get install yakuake