Finally Launch! digg delicious su

Posted by chardy
on Friday, September 07

Ruby one click installer for mac OSX Tiger digg delicious su

Posted by chardy
on Wednesday, July 25

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

Programming is our closest thing to sex digg delicious su

Posted by chardy
on Wednesday, July 25
the closest thing to sex

Changing our Office Layout digg delicious su

Posted by chardy
on Wednesday, July 25

We been talking about improving our office design and repositioning it, which goal is creating more productivity. Just browse through the web, I saw Paul Stamatiou and not miss up Carlson System for their post about office design, lets look into others startup office design first, since Spiragram also considered one of the startup company.

Digg

Flickr

Flock

Facebook

OpenDNS

Carlson System

Lets see how we can redesign our office. :-)

Why Ruby is exciting? digg delicious su

Posted by chardy
on Thursday, July 19

Sometime there is some fun on writing a duck type so called Ruby Programming Language. The language is neat and close to English as humanity language which we use daily. I use example of counting how many word in a String below:

class String 
  # Common usage using regular expression 
  def count_words 
    n = 0 
    scan(/\b\S+\b/) { n += 1} 
    n 
  end 

  # Ruby way (sort of) 
  # No vulgarity intention here, do not misunderstanding 
  def yet_another_count_words 
    self.strip.squeeze.split.size 
  end 
end 

"Passionately Remarkable Programmers".count_words #=> 3 
"Passionately Remarkable Programmers".yet_another_count_words #=> 3 

Both resulted the same result, so which one you like to follow, method count_words, or method yet_another_count_words. You make the choice. Cheer, have fun :-)

Install Gem in Local User Directory for Back Up Purpose digg delicious su

Posted by chardy
on Wednesday, July 11

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/ 

Date on Ruby digg delicious su

Posted by chardy
on Wednesday, June 27

Recently have been working a lot with Date in ruby, basically Ruby has Date, DateTime as subclass to Date and Time. Lets do some work out on Date with Ruby:

  • Time.now != DateTime.now && Time.superclass != Date
  • There is no method in Time class to convert object to a Date object, but you can write date = Date.new(time.year, time.mon, time.day). Rails Active Support extends DateTime and Time classes which allows to_date and to_time conversions for both classes.
  • Today is Date.today and now it is Time.now, there is no such thing as Date.now but there is Time.today
  • Tomorrow is Date.today+1, yesterday Date.today-1, to add or substract a month use Date.today >> 1 or Date.today << 1. See also Rails extensions to time class which allows to write things like Date.today.to_time.at_beginning_of_week
  • Date class includes Comparable module which allows us to write some_date.between?(Date.today, Date.today + 7)
  • Time.now.beginning_of_month.to_date.upto( Time.now.next_month.beginning_of_month.to_date-1) {|d| puts d.to_s} would print all days in current month in your Rails application.