Recently, I addicted to blogging..

Posted on July 29, 2007
Yes, and its getting it to me, I am addicted to blogging, I write about technicals, my story, interest in multiple blog site. Part of my life is blogging now, virtually attached to the world, even the company where I work started their corporate website as a blogging site, I gotta blog more and more.

71%How Addicted to Blogging Are You?

Ruby one click installer for mac OSX Tiger

Posted on July 25, 2007

Once upon a time when I still use windows laptop as my workstation, I used to know there is a Ruby One click Installer for Windows. Just notice, another one click installer for mac is born. Visit http://rubyosx.rubyforge.org/ to download.

The good things are this package help to install basic framework to get you started with Ruby on Rails, It done the installation in UNIX way, which installed everything on /usr/local and it replaces the broken Readline library, updates to a current version of SQLite3 and prepares your OSX for Rails, which needs at least Ruby 1.8.4 to run.

After, do not forget to set your environment for /usr/local path.

export PATH="/usr/local/bin:/usr/local/sbin:$PATH" 

But if you still prefer the Terminal way to install Ruby on Rails framework on OSX, I have fews good links below: (Just stick to these links, you will be fine)

  1. Hivelogic Guide
  2. NubyonRails Guide

Install Gem in Local User Directory for Back Up Purpose

Posted on July 11, 2007

It seems not maintainable when we have too many gems installed on your local machine gem repositories, indeed in UNIX machine, our access is granted by user group itself. How if one day, my harddisk crashes and I loss all my data, BTW, I only backup my home folder in this case. So due to this incident, I need to reinstall all my ruby gems again to get Ruby on Rails development environment ready to use. Too much work.

Try this to solve the issue, by installing all your gem inside you home folder.

$ cd ~
$ mkdir .gem
$ export GEM_PATH=~/.gem
$ gem install -i ~/.gem haml

You can also put this export GEM_PATH=~/.gem to your ~/.profile or ~/.bash_profile.
Whats the .gem directory look like:

$ ls ~/.gem
./  ../  bin/  cache/  doc/  gems/  source_cache  specifications/

No More Angry but Piss Off

Posted on July 09, 2007
justbecause2223.jpg

It's always going to be true. No matter what (who) she/him is.

Colorize your terminal logging.

Posted on July 04, 2007

When you running your rails application via mongrel or lighttpd by using script/console command in development mode, you can see the terminal logging running in colorize mode, come to an idea to creating the same logging output for some of my background process. Do you know what is actually made up the color on the terminal? Basically it just special character code to color the terminal, and every terminal application have slight different implementation. Last time I was playing around with hyper terminal application and found this, then implement this on mac terminal.

I have make a simple method to do this for ruby programming language:


# usage: 
# format_log("This is log message", {:background => "red", :foreground => "white", :special => "reset"})
#

def format_log(str, params)   
    specials = {
        "reset" => 0,
        "bold" => 1,
        "half-bright" => 2,
        "underscore" => 4,
        "blink" => 5,
        "reverse" => 7,
        "normal-bright" => 22,
        "no-underline" => 24,
        "blink" => 25,
        "no-reverse" => 27
    }
    foregrounds = {
        "black" => 30,
        "red" => 31,
        "green" => 32,
        "black" => 30,
        "red" => 31,
        "green" => 32,
        "brown" => 33,
        "blue" => 34,
        "magenta" => 35,
        "cyan" => 36,
        "white" => 37
    }
    
    backgrounds = {
        "black" => 40,
        "red" => 41,
        "green" => 42,
        "brown" => 43,
        "blue" => 44,
        "magenta" => 45,
        "cyan" => 46,
        "white" => 47,
        "default" => 49
    }
    
    puts "\033[#{backgrounds[params[:background]]};#{foregrounds[params[:foreground]]}m #{str} \033[#{specials[params[:special]]}m"

end

Sample below:

It tested on mac terminal, not sure whether is running on others. When free, I will make this tiny little helper to become a more mature plugin :-)

Rake Tutorial

Posted on July 04, 2007

Nice introductory tutorial on Rake from the guys @ Rails Envy, which provides a brief history, introduces concepts such as tasks and namespaces and talks about its role within Rails.