Friday, November 1, 2013

Installing SQLite3 on Ubuntu/Xubuntu 13.04

1. Installing SQLite3
$ sudo apt-get install sqlite3
Test the installation.
$ mkdir sqlprj
cd sqlprj/
$ sqlite3 test.db
SQLite version 2013-01-09 11:53:05
sqlite> .exit

2. Installing sqliteman (GUI app to manage SQLite)
sudo apt-get install sqliteman
Test the installation by launching it from menu and creating a table and inserting a few rows.

3. Installing ruby gem for SQLite3 
$ sudo apt-get install libsqlite3-dev
$ sudo gem install sqlite3
Test the installation.
# test.rb
# based on samples in 

require 'sqlite3'

    db = "test.db"
    stm = db.prepare "SELECT * FROM party" 
    rs = stm.execute 
    rs.each do |row|
        puts row.join "\s"
rescue SQLite3::Exception => e 
    puts "Exception occured"
    puts e
    stm.close if stm
    db.close if db    
$ ruby test.rb
1 Doe, John per
2 Big Company org

Friday, August 9, 2013

Installing Oracle JDK 7 with Netbeans Installer

I have installed Oracle JDK 7 using a special version of Netbeans installer that included JDK7.


I went to the Oracle Java downlaod page:
Click "JDK 7 + Netbeans" icon.

And I download one for my [X]Ubuntu 64bit:

I made the downloaded file executable and ran it as root to install both JDK and Netbeans.
$ cd Downloads/
$ chmod a+x 
$ sudo ./
I specified /usr/lib/jvm/ as JDK installation location because all installed Java versions were there.

Test the installation.
$/usr/lib/jvm/jdk1.7.0_25/bin/java -version
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)


I downloaded and used galternatives to swich default Java.
$ sudo apt-get install galternatives
$ gksu galternative
See my post "Installing Alternatives Configurator (galternatives) on Ubuntu".

Test the default.
$ cd ~
$ java -version
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)

Thursday, August 8, 2013

Installing Alternatives Configurator (galternatives) on Ubuntu

I have installed Alternatives Configurator(galternatives), a GUI front end for update-alternatives. And I used it to add Oracle JDK to Java alternatives and made it default Java because I installed JDK manually.

Debian Admin: Galternatives – graphical setup tool for Alternatives Configuration in Ubuntu
Ask Ubuntu: How do I make java default to a manually installed JRE/JDK?

$ sudo apt-get install galternatives

$ gksu galternatives

Before the Java default change using galternative, my Java version was OpenJDK 1.7.
$ java -version
java version "1.7.0_21"
OpenJDK Runtime Environment (IcedTea 2.3.9) (7u21-2.3.9-1ubuntu1)
OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode)
After the change, my Java version is now Oracle JDK SE 1.7.
$ java -version
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)

Be sure to have JAVA_HOME set in .bashrc.
export JAVA_HOME=/usr/lib/jvm/default-java

Sunday, July 7, 2013

Installing Octopress

I have installed Octopress (blogging framework) on my Xbuntu.

1. Resources

Octopress home page:
The Hiltomon: "18 Months of Octopress"

2. Installation

$ git clone git:// octopress
Cloning into 'octopress'...
remote: Counting objects: 10374, done.
remote: Compressing objects: 100% (4486/4486), done.
remote: Total 10374 (delta 5726), reused 9440 (delta 5036)
Receiving objects: 100% (10374/10374), 2.30 MiB | 1.28 MiB/s, done.
Resolving deltas: 100% (5726/5726), done.

$ cd octopress

$ ruby --version
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]

$ sudo gem install bundler
Fetching: bundler-1.3.5.gem (100%)
Successfully installed bundler-1.3.5
1 gem installed
Installing ri documentation for bundler-1.3.5...
Installing RDoc documentation for bundler-1.3.5...

$ bundle install
Fetching gem metadata from
Fetching gem metadata from
Resolving dependencies...
Using rake ( 
Installing RedCloth (4.2.9) 
Installing chunky_png (1.2.5) 
Installing fast-stemmer (1.0.1) 
Installing classifier (1.3.3) 
Installing fssm (0.2.9) 
Installing sass (3.2.9) 
Installing compass (0.12.2) 
Installing directory_watcher (1.4.1) 
Installing haml (3.1.7) 
Installing kramdown (0.13.8) 
Installing liquid (2.3.0) 
Installing syntax (1.0.0) 
Installing maruku (0.6.1) 
Installing posix-spawn (0.3.6) 
Installing yajl-ruby (1.1.0) 
Installing pygments.rb (0.3.4) 
Installing jekyll (0.12.0) 
Installing rack (1.5.2) 
Installing rack-protection (1.5.0) 
Installing rb-fsevent (0.9.1) 
Installing rdiscount ( 
Installing rubypants (0.2.0) 
Installing sass-globbing (1.0.0) 
Installing tilt (1.3.7) 
Installing sinatra (1.4.2) 
Installing stringex (1.4.0) 
Using bundler (1.3.5) 
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.

$ rake install
## Copying classic theme into ./source and ./sass
mkdir -p source
cp -r .themes/classic/source/. source
mkdir -p sass
cp -r .themes/classic/sass/. sass
mkdir -p source/_posts
mkdir -p public

3. Installation Directory

4. Deployment on Heroku
Required to have a Heroku account. (
$ wget -qO- | sh
$ heroku create
Git remote heroku added
$ leafpad .gitignore  # edit to remove line 'public'
$ rake generate
## Generating Site with Jekyll
$ git add .
$ git commit -m 'site updated'
$ git push heroku master
$ git commit -m 'new title'
# On branch master
# Changes not staged for commit:
#   (use "git add ..." to update what will be committed)
#   (use "git checkout -- ..." to discard changes in working directory)
# modified:   _config.yml
no changes added to commit (use "git add" and/or "git commit -a")
$ git add _config.yml
$ git commit -m 'config change: new title'
$ git push heroku master

$ rake preview
Starting to watch source with Jekyll and Compass. Starting Rack on port 4000

$ heroku open
Opening myapp... done

5. Some notes
After the deployment, I had to make a change to _config.yml. However, it did not update my site with:
$ git add _config.yml
$ git commit -m 'config changed'
$ git push heroku master
I had to add "all".
$ git add .
$ git commit -m 'config changed'
$ git push heroku master
Then and only then, it update my site with the latest changes to my _config.ym.

Ubuntu 13.4 was too slow and I switched to Xubuntu

Upgrading my Ubuntu 12.04 to 13.04 was a nightmare. The latest version of Ubuntu is extremely slow. It is absolutely unusable in my machine, which is a descent one with core i3. I tried various suggestions but none was satisfactory.

Finally I decided to move away from Ubuntu and jump into Xubuntu. And I cannot be happier. It is fast, and its user interface is simple, clean and familiar.
I basically followed the instruction in the following site for installation: Turn Ubuntu into Xubuntu

Goodbye Ubuntu, Hello Xbuntu!

Thursday, January 10, 2013

Wordpress stopped working after changing Apache server's port number

My Wordpress stopped working after I changed Apache server's port number.

My Apache server was using its default port number 80. But I had to change it to something else (8000) because I wanted to use the port for Nginx server. After the change, I found my Wordpress no longer working even when I specified the new port like "http://localhost:8000/wp".

I found that what I was supposed to do was to change URL settings in Wordpress configuration before actually changing the Apache server's port.

It is probably easiest to fix the problem if I change the port back to the default 80 temporarily and use Wordpress admin page to change its URL settings.

1. Resources

"Wordpress wont load after changing ports"
"Changing Apache port number"

2. Change Apache Server port back to default 80, temporarily

Stop Nginx server, which is using the port 80.

 $ sudo /etc/init.d/nginx stop

Change Apache server port back to 80, temporarily.
Open ports.conf file.

 $ sudo gedit /etc/apache2/ports.conf


 NameVirtualHost *:8000
 Listen 8000


 NameVirtualHost *:80
 Listen 80

Next, to change virtual host's port, edit the file 000-default.

$ sudo gedit /etc/apache2/sites-enabled/000-default


 <VirtualHost *:8000>


 <VirtualHost *:80>

Then restart the Apache server.

 $ sudo /etc/init.d/apache2 restart

3. Change URL settings in Wordpress admin window 

Logon to the Wordpress as Administrator.
Goto Settings on the side bar and select General.
And change:

WordPress Address (URL): http://localhost/wp
Site Address (URL): http://localhost/wp


WordPress Address (URL): http://localhost:8000/wp
Site Address (URL): http://localhost:8000/wp

4. Now Undo the Temporary Change made above (2)

Change the ports.conf back to

 NameVirtualHost *:8000
 Listen 8000

and change the 000-default back to

 <VirtualHost *:8000>

5. Restart Servers

$ sudo /etc/init.d/apache2 restart
$ sudo /etc/init.d/nginx start