all about my IT experiences and knowledges

Install Ruby on Rails easily on CentOS 6.4 with rbenv

Open Terminal

Install git:

sudo yum install git

Install ruby environment with RBENV:

git clone ~/.rbenv

echo ‘export PATH=”$HOME/.rbenv/bin:$PATH”‘ >> ~/.bashrc

echo ‘eval “$(rbenv init -)”‘ >> ~/.bashrc

to check: restart terminal then type: type rbenv

If it say #=> “rbenv is a function” bla bla bla, it is successfull rbenv install

Install Ruby (2.1.2 version):

Install plugin ruby-build on rbenv:

git clone ~/.rbenv/plugins/ruby-build

echo ‘export PATH=”$HOME/.rbenv/plugins/ruby-build/bin:$PATH”‘ >> ~/.bashrc

restart terminal

Install ruby 2.1.2 version:

rbenv install 2.1.2

then make it global ruby version on your local environment:

rbenv global 2.1.2

rehash the rbenv:

rbenv rehash

to check type: ruby

Install bundler:

gem install bundler

rehash the rbenv:

rbenv rehash

Install Rails:

First, you must install nodejs:

sudo yum install npm

check if it successfull: node –version

install rails:

gem install rails

long wait…

rehash the rbenv:

rbenv rehash

to check type: rails

Categories: IT | Tags: , , , , , | Leave a comment

Install psycopg2 in Linux with Python 3

It’s hard to install psycopg2 on a Linux server that running python 3.

First of all, you need to install python3-dev. The python3-dev package is required for compilation of Python 3 extensions written in C or C++, like psycopg2. If you’re running a Debian-based distribution (e.g. Ubuntu, linux mint), you can install python3-dev by running:

apt-get install python3-dev

Then you can install psycopg2 normally (here is example with a python package manager):

pip install psycopg2

If you’re using python2, you should install python-dev instead

Categories: IT | Tags: , , , | Leave a comment

Yii: Add New Field/Coloumn Table after Generate Its Model

Maybe it’s hard to you to update your class model of a table when you’ve just add a new field/coloumn/attribute. It causes no effect on Create and Update application.

For example, you add coloumn post_code on your user table.
Then you should update the model (model/User.php):
– on function rules() just add new line:¬†array(‘post_code’, ‘numerical’, ‘integerOnly’=>true),

– on function attributeLabels() add new line, to define its name: ‘post_code’ => ‘Post Code’,

– maybe you should update some related views file

Hope this will helping you

Categories: IT | Tags: , , | 1 Comment

[Solved] MySQL error 1036: table is read only

When you create a new table, and you insert it with some rows, but you get these error. It’s mean that your new table can’t be write. Otherwise, your other old tables is fine, writable.

Instead of change your mysql folder permisson, you might to:


Change your new table Storage Engine. You can do it on Operation menu on your phpmyadmin or other mysql visual administrator. Compare it with your old tables Storage Engine.
In my case, my new tables Storage Engine is default set to MRG_MYISAM. My old tables is InnoDB. So I change my new table Storage Engine to InnoDB, then it works, writable.

Categories: IT | Tags: , | 1 Comment

Blog at