Sunday, March 7, 2010

Cron log in Ubuntu

* Edit /etc/syslog.conf and uncomment the line starting with cron.*
* touch /var/log/cron.log
* Run /etc/init.d/rsyslog restart
* Run /etc/init.d/cron restart

Changing of syslog.conf location in Ubuntu Karmic

Old:

/etc/syslog.conf
New:

/etc/rsyslog.d/50-default

Saturday, March 6, 2010

Changing timezone in terminal


sudo dpkg-reconfigure tzdata

Friday, March 5, 2010

Rvm notes

Getting prepared

sudo apt-get update
sudo apt-get -y install build-essential zlib1g zlib1g-dev libxml2 libxml2-dev libxslt-dev sqlite3 libsqlite3-dev locate git-core libssl-dev openssl autoconf subversion bison
sudo apt-get -y install curl wget

For Ubuntu, use rvm package to download and complie zlib

rvm package install zlib
rvm remove 1.8.7
rvm install 1.8.7 -C --with-zlib-dir=$rvm_path/usr

Before installing any versions of ruby using rvm

sudo apt-get install libssl-dev
Installing Ruby Enterprise Edition

Error running './installer -a /home/username/.rvm/rubies/ree-1.8.7-2010.01  --dont-install-useful-gems ', please check /home/username/.rvm/log/ree-1.8.7-2010.01/install*.log
There has been an error while trying to run the ree installer. Aborting the installation.

# Need to install the following library first
sudo apt-get install libreadline5-dev
rvm install ree

Thursday, March 4, 2010

Rails 3 notes

JQuery:

Grab the jQuery driver at http://github.com/rails/jquery-ujs and put it in your javascripts directory. Include the file in the layout.

http://joshhuckabee.com/jquery-rails-3

Forms:

Rails requires an authenticity token to do form posts back to the server. This helps protect your site against CSRF attacks. In order to handle this requirement the driver looks for two meta tags that must be defined in your page's head.

csrf_meta_tag
Routing:

Old

link_to :controller => 'user_sessions', :action => 'destroy'
New

# Route
match '/log' => "user_sessions#destroy", :as => :logout

# View
link_to 'Logout', '/logout'

Vim can't make backup file

Ensure that the backup directory in .vimrc exists.

# in .vimrc

set backup
set backupdir=~/.vim/backups

mkdir -p .vim/backups

Vim unable to open swap file

If you see the following message when opening a vim file

Unable to open swap file for "{filename}", recovery impossible

The directory specified in your vim for swap files is missing. In my case it's ~/.vim/tmp.

# in .vimrc
set directory=~/.vim/tmp

mkdir -p ~/.vim/tmp