2008/12/24

Merb + Rails merger























Update(2009.2.8)
"Merb in Action" => "Rails3 in Action"
http://www.manning.com/katz/

Table of Contents
1. Building Your First Rails 3.0 Application
2. Overview of the Rails stack(s) + architecture
3. Creating Rails Applications
4. Using DataMapper for Models
5. Using ActiveRecord for Models
6. Other Choices for Models
7. Processing Requests
8. Routing in Rails 3
9. Customizing Views
10. Working on the Client Side
11. Supporting Characters
12. Using the Plugin API
13. Testing Your Applications
14. Deploying a Rails Application
15. Scaling Rails

Appendix A Just enough advanced Ruby
Appendix B The migration story
Appendix C Rails 2 to Rails 3
Appendix D Merb 1 to Rails 3

Update(2009.2.5)
Rails 3 will have mountable applications, not engines or slices.

Update(2009.1.16)
I just got an email from manning about "Merb in Action".
  • Rails becomes more modular, by building on rails-core with the ability to opt in or out of specific components and making it possible to replace parts of Rails without disturbing other parts.
  • Merb performance improvements flow into Rails, including benchmarking applications so developers can see which optimizations have real-world impact.
  • A defined public API with a test suite, so users and plugin developers have a stable API to build against.
  • A "core" version of Rails, like Merb's current core generator, that makes it easy to select just the parts that are important for your app.
  • DataMapper and Sequel support as first-class ORMs, along with ActiveRecord as the default.
  • Rack support in Rails 3, to improve the state of modular, sharable logic between applications.
Update(2008/12/26)
So far, it seems that merb google group is the best source. And Matt Aimonetti answers all the concerns.

Yehuda Katz says
"If you want to learn Merb for modularity and power that is not currently present in Rails, stick with Merb. We'll provide a good upgrade path to Rails3 (and feel free to contact me personally to keep me honest on that promise), and you'll have a leg-up when the same power makes its way into Rails. While Rails3 will still be very similar to Rails2 for current Rails users, it will look a lot like Merb for those users who are currently drawn to Merb."

"We always said that there would be breaking changes in Merb 2.0. Now, some of those breaking changes will be in tandem with the Rails3 merger. However, we will treat them like any other breaking changes, and make sure the deprecation notices flow freely and the transition path is clean. Make sense?"

Matt Aimonetti says,
"The great advantage of using merb now, is that it has a public API so we will be able to easily migrate it to the new 3.0 API. Concretely, we are planning on being able to replace merb-core by rails-core in your merb app and to use merb-helpers and other plugins with rails-core."


I think "Merb in Action" would take longer than expected. And it's required to rewrite the whole chapters that are published. Of course, book's title will not be changed but I'm just worried about Merb. It would be called Rails3.0 by many other people, especially inside Rails community.

As Ezra said,
Merb is dead, long live Merb(Rails-3.0)!
Matt Aimonetti said,
I don't think Ezra is right. Merb isn't dead. First off, merb will still be around until the next release (rails 3.0) and we will keep on supporting it even after that (maintenance).
So many merbists are disappointed by this news but there is nothing can be done. Engin Yard's decision looks solid. I've accepted it, after all. I've read many articles enough to say that I will stick with Merb. There were some people who even want to switch to Django. I decided to practice Merb more than before. Because Merb would be the core changes in Rails3. And it could happen that Merb core team is too busy. But evangelist like Matt Aimonetti will help us. I hope taking this path would be natural to Merb2.

2008/12/20

오픈소스 merb-book 한국어 번역


Now, merb has many resources to learn.


튜토리얼 및 기타 소개 동영상들 : MerbCamp videos,
스크린캐스트 : http://merbunity.com/screencasts




and there is open source merb-book which is started by Matt Aimonetti.
Well, I saw Chinese and Japanese but no Korean one. I think that there are probably not enough rubists in Korea. Anyway I sent a message to him that I want to start if there is no one. And here it is.
















Update(12/22/2008)
I've completed "Merb-More" Chapter. But there are still unfinished chapters in English.
Merb-More 챕터까지 모두 한국어로 번역을 완료했지만, 영어로 된 원본이 아직 빈 곳이 많습니다. 번역하는데에는 네이버 단어장, 구글번역기, 바벨피쉬, 그리고 제 경험을 최대한 살려서 번역했습니다. 많이 부족하므로 오타나 잘못된 번역을 알려주시면 고치도록 하겠습니다. 한글로 된 merb 책이 나오려면 아직 오래 걸릴 것 같습니다. (영어 책도 아직 출판되지 않았습니다.) 참여를 원하시는 분은 메일 보내주시기 바랍니닷.

Update(12/23/2008)
I finished the translation.
현재까지 작성된 영어 원본에 대한 번역은 마쳤습니다. 제 생각에는 본격적으로 책들이 쏟아지는 2009년 전반에는 이 오픈소스 책도 많은 개선이 있을 것 같습니다.

Update(12/24/2008)
Rails와 Merb가 합쳐지는 이 시점에서, Pragmatic Bookshelf, Apress 등에서 나온 책들은 의미가 희석되었다고 생각합니다. 워낙 빠르게 변하다보니 책들이 따라가지 못하고 있습니다. 오픈소스 책의 발안자인 Matt Aimonetti가 Rails 코어팀에 합류했기 때문에 이 책이 그나마 현재 나온 책중에서는 가장 참고할만한 책이 되지 않을까 싶습니다. Rails3.0에선 Merb의 기능들을 흡수할 예정이기 때문입니다.

update(2009.1.4)
제가 실수로 master 브렌치에 작업내용을 합치질 않았었습니다. -_-;;;
이제 github에서 다운받으셔서 정상적으로 보실 수 있습니다. 업데이트 내용은 4번째 장인 "데이터베이스와 상호작용" 부분입니다. 현재까지 작업된 영어원본까지 모두 작업완료되었습니다. 책을 받아서 보시는 분들이 계시다면, 오타나 의역에 무리가 있는 부분을 지적해주세요. :)

오픈소스 merb 책이 나왔지만 한국어 번역이 없어 매트에게 해보겠다고 메세지를 보냈습니다. 흔쾌히 해보라해서 현재 작업중이고 getting started/mvc까지 작업완료했습니다. 이제와서 보니 일본어나 프랑스, 중국 번역판에 비해 늦은 것은 아니었습니다.

------------------------------
책을 보는 방법
------------------------------

필요조건 :
a. ruby, gem
b. git

스텝 :

1. 먼저 제 github 저장소에서 merb-book을 로컬 pc로 복사합니다.
$git clone git@github.com:jaigouk/merb-book.git

2. 다운받은 merb-book 루트 디렉토리에서 다음을 실행해 주시면 됩니다.
$./bin/merb

3. 브라우저에서 http://localhost:4000 주소로 가면 책을 보실 수 있습니다. 목차 맨위에 보시면 각 언어들 링크가 있는데 한국어를 선택하시면 됩니다.

----------------------------------
Chapter별 완성도(2009/1/4): 좋음(○), 미흡(△), 없음(X)
----------------------------------
  1. 서문

    1. 머리말 By Yehuda Katz(X)
    2. 서문 by Matt Aimonetti(○)
    3. 공헌자들(○)
  2. 소개

    1. Ruby 언어(○)
    2. Merb 웹프레임웍(○)
    3. DataMapper ORM(X)
    4. RSpec 테스팅 프레임웍(○)
  3. 시작하기

    1. 설치방법(○)
    2. 어플리케이션 생성하기(○)
    3. 프로젝트 구조(○)
    4. MVC(○)
    5. 컨트롤러(○)
    6. (X)
    7. 모델(○)
    8. 리퀘스트 패스(○)
    9. 라우터(X)
  4. 데이터베이스와 상호작용

    1. DataMapper 세팅()
    2. 데이터베이스 스키마()
    3. 데이터베이스 쿼리()
    4. 모델 관계(X)
    5. 데이터베이스 마이그레이션()
    6. 유효성 검증(X)
  5. 어플리케이션 테스팅

    1. 테스트를 하는 이유(△)
    2. 모델 테스팅(X)
    3. 리퀘스트 테스팅(X)
    4. RSpec Cucumber를 사용한 통합테스팅(△)
  6. Merb More

    1. 인증(○)
    2. 메일러(X)
    3. 캐싱(X)
    4. 예외처리(X)
    5. 슬라이스(X)
  7. 레시피

    1. 간단한 블로그(X)
    2. 블로그 슬라이스 만들기(X)
  8. 배치

    1. Passenger(△)
    2. nginx(△)
    3. JRuby 와 Glassfish(X)
    4. 어플리케이션 번들링(X)

2008/12/17

garage sale like notes




onenote.png

iPhone, and desktop notes are hard to see them all in a big picture as Roam said.


3D desktop and ruby















As the rumor says, it is obvious that Apple is developing next OSX. 3D environment is the critical difference. Bumptop desktop could be similar with it. Trends are really clear. Wiimote, Jeff Han's Ted demo, and Ubuntu Compiz fusion. The new era of HCI has come. But there're little apps which are appropriate with these environments. Adobe launched AIR, and it is still early for general users. But it is certain that adoptions are growing.

















Now, we see java 3d OS. Where is shining, rich ruby desktop environment! Do we need to learn Air to mimic 3d actions?

2008/12/09

morganstanley - Presentation from Web 2.0 Summit

Mary Meeker Web 2.0 Presentation
View SlideShare presentation or Upload your own. (tags: trends web)





Motorola hired 350 people for Android.

2008/12/03

look, see, imagine

Recently I've read "The Back of the Napkin". And Here is what I'm thinking.
I think it is really hard to see the big picture in these days. There are just too many informations to catch up.


We're gathering informations by emails, RSS, twitter, conversations and so on. But have you really gone through all the star-marked articles? Well, I haven't.



And there are web apps that makes me do extra things. Some apps look promising to me except I don't have a mac.




After reading Alan Greenspun's "The Age of Turbulence", I'm sure that the global economy's speed is really fast like light. It's out of control in this hot, flat, crowded world even for FRB.

How can we catch up all these informations? May be, no one can. But they only pay their attentions on something meaningful to them. As Eric Schmidt says, most of us focus on the head, not the tail. Why? Because there is so little time to spend on reading, studying, and even eating. Most of people do what they have been doing. But there are specific needs. And they start to google it or to digg it. They already have established their information sources. It could be friends, social networking sites, ranking sites, or a RSS reader. Here it comes, "Look, see, imagine".


















I don't have enough room to post every data that I've gathered. And it would consume a lot of ink and papers. Why there is no software that help me to see the big picture?

2008/11/20

Comment on Google CEO Interview









1. 지금 구글은 안드로이드와 기존의 플랫폼을 연계, GPS를 활용한 광고 등을 사용하여 기기 자체는 거의 공짜로 공급하는 것을 생각중

2. 롱테일 관점에서 80%를 차지하는 부분이 더 가속화. 브랜드가 강화될 것. 물론 테일 부분도 놓치면 안됨

3. 애플의 모바일미는 시기상조였음. 서비스 자체가 단조롭고 진짜로 도움이 되질 않음. 별반 다를게 없었던 것

4. 먼저 웹상에서 탄탄한 기반을 가지고 나서야 모바일 서비스의 의미가 있을 것임.

5. RFID, GPS, Sensor network 등이 갖춰졌을때 에릭슈미트가 이야기하는 서비스들이 나올 것. 그 전까지는 현재의 스마트폰이나 아이팟처럼 컨텐츠를 데스크탑에서 다운받아서 싱크하는 형태로 2-3년간 지속될 가능성이 큼.




6. 애플의 플랫폼이냐 구글의 플랫폼이냐는 좀 더 두고봐야 하겠지만 서비스가 웹상에서 먼저 정착이 되야 하므로 기다리면서 관망하는 것도 가능. (구글이 블로거를 인수하긴 했지만 블로깅에서는 워드프레스가 우위 )

7. 애플 아이폰이 선전하고 있으나 전체 마켓쉐어는 아직 멀었음.

8. 애플은 아이튠즈를 통한 어플리케이션 시장을 벌써 형성했음. 이에 반해 구글은 이제 막 안드로이드를 정착시켜나가야 하는 형태. 만약 구글이 노키아나 삼성, 모토롤라를 아우르는 협력을 끌어내어 안드로이드를 장착시킨다면 이야기가 달라짐.


    9. 위의 경우는 쉽지 않을 것. 각 업체들이 원하는 바를 통합시키는 것에 대한 시간이 걸릴 것. 그런면에서 애플이 타이밍이나 속도면에서 우위임.

    2008/08/22

    me.com simple UI










    Well, on my ubuntu 8.04 file attachment was not working properly. It seems that the UI is so simple that it even makes me feels paying for this app is expensive.

    Rails 2.1 OSX Finder like ColumnNav.

    original google code : http://columnav.googlecode.com/svn/trunk/index.html

    Update(22/8/2008):
    Since ResponseHeader was "applicatoin/json ;utf8 ",
    The original code does not work.

    in columnav.js,
    Before:
    var contentType = o.getResponseHeader['Content-Type'];
    if ('application/json' == contentType.replace(/\s+$/,'')) {

    After:
    var contentType = o.getResponseHeader['Content-Type'];
    var compareString = contentType.replace(/\s+$/,'')
    if (compareString.include('application/json')) {



    It was not easy to implement "finder" with extjs. And furthermore, my codes were getting ugly. Almost hard to see. So I abandoned Extjs on the user-view. I've decided to use it on admin pages.



    ColumNav is a hierarchical menu implementation utilizing Bill Scott's Yahoo UI Carousel component. Content is loaded from an unordered list and displayed in a scrollable viewport, similar to Column View in the Mac OS X Finder.


    Features include:


    • infinite extensibility using Ajax to build sub-menus
    • instantiation from DOM or JSON data sources
    • a highly customizable look and feel using CSS
    • support for multiple columns
    • support for keyboard-only navigation (CTRL + arrow keys)
    • cross-browser compatibility

    App/views/Categories/index.html



    <% content_for :head do%>


    <%= stylesheet_link_tag 'cssbits_notice' %>
    <%= stylesheet_link_tag 'columnav', 'columnav_apply' %>
    <%= javascript_include_tag :defaults %>
    <%= javascript_include_tag "columnav/yui/yahoo-min" %>
    <%= javascript_include_tag "columnav/yui/utilities" %>
    <%= javascript_include_tag "columnav/yui/container_core-min" %>

    <%= javascript_include_tag "columnav/carousel_min" %>
    <%= javascript_include_tag "columnav/columnav" %>
    <%= javascript_include_tag "columnav/columnav_json_parsing" %>


    <% javascript_tag do %>
    try { document.execCommand('BackgroundImageCache', false, true); } catch(e) {}


    function init() {
    var cn_cfg = {
    numVisible: 3,
    prevElement: 'columnav-prev',
    datasource: '/categories/columntree/1.json'
    };
    var cn = new YAHOO.extension.ColumNav('columnav', cn_cfg);
    }
    YAHOO.util.Event.addListener(window, 'load', init);
    <% end %>

    <% end %>







    App/controllers/Categories_controller.rb



    def columntree(id = params[:id])
    categories = Category.find_all_by_parent_id(id)

    data = get_tree(categories, id)
    respond_to do |format|
    format.json { render :text => data[0].to_json, :layout => false }
    end
    end


    def get_tree(categories, parent_id)
    parent = Category.find_by_id(parent_id)
    data = Array.new
    data.concat([ "ul" => insert(categories, parent) ])
    return data
    end

    def insert(categories, parent)
    result = Array.new
    result.concat(["li" => insert_data(categories, parent) ])
    return result[0]
    end

    def insert_data(categories, parent)
    iterated = Array.new
    categories.each { |category|
    if !category.leaf?
    iterated.concat(["a" => {"#text" => category.text, "@href" => "/categories/columntree/"+category.id.to_s+".json", "@rel" => "ajax"}, "id" => category.id]) # "@rel" => "ajax" 면 폴더로 인식.
    else
    iterated.concat(["a" => {"#text" => category.text, "@href" => "http://peepcode.com"}, "id" => category.id])
    end
    }
    return iterated
    end



    app/models/category.rb


    class Category < dependent =""> :nullify
    has_many :portfolios, :dependent => :nullify

    acts_as_nested_set

    validates_presence_of :text

    has_attached_file :photo,
    :styles => { :medium => "220x180#", :thumb => "100x82#" },
    :path => "#{RAILS_ROOT}/public/images/category_photos/:id/:style_:basename.:extension",
    :url => "/images/category_photos/:id/:style_:basename.:extension",
    :default_url => "/images/category_photos/missing.png",
    :whiny_thumbnails => true


    #liquid
    liquid_methods :text

    # extjs를 위한 코드임

    def self.root_nodes
    find(:all, :conditions => 'parent_id IS NULL')
    end

    def self.find_children(start_id = nil)
    start_id.to_i == 0 ? root_nodes : find(start_id).direct_children
    end

    def children
    Category.find_all_by_parent_id(self.id)
    end

    def self.find_level1
    find_all_by_parent_id(1)
    end

    def leaf
    unknown? || children_count == 0
    end

    def leaf?
    unknown? || children_count == 0
    end


    def to_json_with_leaf(options = {})
    self.to_json_without_leaf(options.merge(:methods => :leaf))
    end
    alias_method_chain :to_json, :leaf
    private
    end

    2008/08/14

    SproutCore !!




    For about 2 weeks, I studied and struggled to use extjs on my recent project.
    As time goes, It became a mess. Because of javascript codes that are not organized well. For example, I wanted to make a browser like Finder which is default file browser on OSX. I had to find some way embed erb code in javascript(I used extscaffold plugin and I personally added some codes) By using extjs It was so hard that I almost thought it is time to move on. And I clicked on Sprout and dug into it while searching for snippets on google search results. I barely knew about beauty of it by the time I saw the test screen. You better see it by yourself. It's really awesome.

    But one thing that bothers me is that it still does not support IE6, and IE7. I think it would take 3 or 4 months to be stable. And there will be "Merb in Action". It would be great to use Sproutcore with Merb. :)

    2008/07/22

    404 fetching http://gems.datamapper.org/yaml


    $ sudo gem sources -r http://gems.datamapper.org
    Bulk updating Gem source index for: http://gems.rubyforge.org/
    ERROR: While executing gem ... (Gem::RemoteSourceException)
    HTTP Response 404 fetching http://gems.datamapper.org/yaml

    $ sudo nano ~/.gemrc

    Capistrano, git, rails again.

    set :use_sudo, false
    # ====================================================
    # CUSTOM OPTIONS
    # ====================================================
    set :user, "deploy"
    set :runner, user
    set :application, "go.go.com"
    set :domain, "xx.xx.xx.xx."

    role :app, application
    role :web, application
    role :db, application, :primary => true

    # ====================================================
    # DATABASE OPTIONS
    # ====================================================
    set :rails_env, "production"

    # ====================================================
    # DEPLOY TO
    # ====================================================
    set :deploy_to, "/home/#{user}/public/#{application}"

    # ====================================================
    # REPOSITORY
    # ====================================================
    set :scm, :git
    set :deploy_via, :remote_cache
    set :repository, "ssh://deploy@xx.xx.xx.xx:xxxx/var/git/ext_kocm.git"
    set :repository_cache, "git_cache"

    # ====================================================
    # REPOSITORY
    # ====================================================
    set :ssh_options, { :forward_agent => true }
    default_run_options[:pty] = true
    set :port, 30003 #ssh port

    # ====================================================
    # Tasks
    # ====================================================
    namespace :deploy do
    desc "Restarting mod_rails with restart.txt"
    task :restart, :roles => :app, :except => {:no_release => true} do
    run "touch ${current_path}/tmp/restart.txt"
    end

    [:start, :stop].each do |t|
    desc "#{t} task is a no-op with modrails"
    task t, :roles => :app do; end
    end
    end

    2008/07/08

    Ubuntu Hardy Intel graphics dual monitor on LG XNote LW25

    1. xorg.conf

    http://www.thinkwiki.org/wiki/Installing_Ubuntu_6.06.1_on_a_ThinkPad_R60e#Intel_945GM_with_the_xorg_Intel_driver

    2.
    $  xrandr -q 
    $ xrandr --output LVDS --auto
    $ xrandr --output LVDS --mode 1024x768 --output VGA --off
    $ xrandr --output VGA --right-of LVDS --mode 1024x768

    3.
    compiz-switch howto
    sudo apt-get install fusion-icon

    You can run Fusion-icon immediately by opening the Run Applications dialog with Alt-F2 and typing fusion-icon. Note that this will cause Compiz to restart.

    To start Fusion-icon whenever you log in, add it to the Startup Programs list in System->Preferences->Sessions.

    adding Fusion-icon to startup programs

    I haven’t found a package for Ubuntu 7.10, but those who are waiting until the final 8.04 release to upgrade can also use the similar Compiz-Switch application instead.

    [update] emiligene has posted a Ubuntu 7.10 repository for Fusion-icon in the comments:
    deb http://ppa.launchpad.net/maco.m/ubuntu gutsy main restricted universe multiverse
    Thanks!

    [update] An anonymous commenter has pointed out that running fusion-icon -n will prevent the application from unnecessarily restarting Compiz when it starts. You should use this command instead.


    2008/02/08

    scrubyt on rails EOFERROR

    I'm using scrubyt on rails2.0.2 and development / running evironment is cygwin. 
    Problem :
    Everytime I run my extractor which is located lib and included in controller, 
    it runs properly just once. From second time, I saw EOFError and 
    I've searched scrubyt forum. and included this file in lib. 

    ----------------------------
    usr/lib/ruby/1.8/net/protocol.rb:133:in `sysread'
    /usr/lib/ruby/1.8/net/protocol.rb:133:in `rbuf_fill'
    /usr/lib/ruby/1.8/timeout.rb:56:in `timeout'
    /usr/lib/ruby/1.8/timeout.rb:76:in `timeout'
    /usr/lib/ruby/gems/1.8/gems/http_configuration-1.0.2/lib/http_configuration.rb:23:in `timeout'
    ----------------------------

    Why :
    I've googled about this problem enough. The problem is not on rails, nor on ruby. It's mechanize. 
    Here is the explanation about the bug.


    Solve :
    C:\cygwin\lib\ruby\gems\1.8\gems\scrubyt-0.3.4\lib\scrubyt\core\navigation\fetch_action.rb
    I've added just one line to the fetch_action.rb

    module FetchAction  
    @@current_doc_url = nil  
    @@current_doc_protocol = nil  
    @@base_dir = nil  
    @@host_name = nil  
    @@agent = WWW::Mechanize.new  
    @@history = []  
    @@agent.keep_alive = false

    2008/02/07

    My gem list

    I'm developing rails app on cygwin environment. And these are the list of my gems.  mongrel and thin are really run differently. It seems monrel consumes more memory. So I poked thin server. The result was slightly dissapoint, because thin server was not stable and was not capable of handling large size file uploading.  Anyway it's a dilema.
    update -- thin0.6.2 is ok with my app now. It's really fast and stable.
    • abstract (1.0.0)
    • actionmailer (2.0.2)
    • actionpack (2.0.2)
    • activerecord (2.0.2)
    • activeresource (2.0.2)
    • activesupport (2.0.2)
    • acts_as_ferret (0.4.3)
    • archive-tar-minitar (0.5.1)
    • archive-tarsimple (1.1.1)
    • aws-s3 (0.4.0)
    • beanstalk-client (0.6.1)
    • builder (2.1.2)
    • capistrano (2.1.0)
    • capserverext (0.0.5)
    • cgi_multipart_eof_fix (2.5.0)
    • coderay (0.7.4.215)
    • color (1.4.0)
    • daemons (1.0.9)
    • deprec (1.9.2)
    • erubis (2.5.0)
    • eventmachine (0.10.0)
    • fastercsv (1.2.3)
    • fastthread (1.0.1)
    • ferret (0.11.6)
    • flickraw (0.4.4)
    • flvtool2 (1.0.6)
    • gchart (0.4.2, 0.4.1)
    • gem_plugin (0.2.3)
    • gemsonrails (0.7.1)
    • geoip_city (0.1.2)
    • gettext (1.10.0)
    • googletranslate (0.2)
    • highline (1.4.0)
    • hobo (0.7.2)
    • hoe (1.5.0, 1.4.0)
    • hpricot (0.6)
    • json_pure (1.1.2)
    • mailfactory (1.2.3)
    • mechanize (0.7.0)
    • merb (0.5.3)
    • mime-types (1.15)
    • mini_magick (1.2.3)
    • mocha (0.5.6)
    • mongrel (1.1.3)
    • mongrel_cluster (1.0.5)
    • mongrel_send_file (0.1)
    • needle (1.3.0)
    • net-sftp (1.1.0)
    • net-ssh (1.1.2)
    • oauth (0.2.0)
    • ParseTree (2.1.1, 1.7.1)
    • ParseTreeReloaded (0.0.1)
    • pdf-writer (1.1.7)
    • piston (1.3.3)
    • rack (0.2.0)
    • radiant (0.6.4)
    • rails (2.0.2)
    • railsmachine (1.0.0)
    • rake (0.8.1)
    • RedCloth (3.0.4)
    • reliable-msg (1.1.0)
    • rfacebook (0.9.8)
    • right_aws (1.4.3)
    • right_http_connection (1.2.0)
    • rme2day (1.0.2)
    • rubigen (1.1.1)
    • ruby-debug (0.10.0)
    • ruby-debug-base (0.10.0)
    • ruby-hmac (0.3.1)
    • ruby-openid (2.0.3)
    • ruby-prof (0.5.2)
    • ruby-yadis (0.3.4)
    • ruby2ruby (1.1.8, 1.1.6)
    • rubyforge (0.4.4)
    • rubygems-update (1.0.1)
    • RubyInline (3.6.3)
    • RubyInlineAcceleration (0.0.1)
    • rubyzip (0.9.1)
    • ruport (1.4.0)
    • ruport-util (0.12.0)
    • rvideo (0.9.3)
    • scrapi (1.2.0)
    • scrubyt (0.3.4)
    • simple-daemon (0.1.2)
    • slave (1.2.1)
    • sources (0.0.1)
    • springnote_resources (0.5)
    • sqlite3-ruby (1.2.1)
    • superredcloth (1.160)
    • syntax (1.0.0)
    • termios (0.9.4)
    • thin (0.6.1)
    • tidy (1.1.2)
    • transaction-simple (1.4.0)
    • tzinfo (0.3.6)
    • uuid (1.0.4)
    • xml-simple (1.0.11)

    2008/02/01

    backgroudrb small tip.


    gerate worker thread (Boo is capitalized) 
    $ script/generate worker Boo

    http://jacqueschirag.wordpress.com/2007/09/12/setting-up-backgrounddrb/

    2008/01/27

    geoip_city

    tested on cygwin. runs smoothly..

    original article :http://blog.hungrymachine.com/2007/10/31/super-fast-ip-to-lat-lng-in-rails-part-2
    wget http://www.maxmind.com/download/geoip/api/c/GeoIP.tar.gz tar -zxvf GeoIP.tar.gz cd GeoIP ./configure && make && sudo make install  wget http://rubyforge.org/frs/download.php/27077/geoip_city-0.1.gem sudo gem install geoip_city-0.1.gem wget http://www.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz gunzip GeoLiteCity.dat.gz sudo mkdir /usr/local/share/GeoIP sudo mv GeoLiteCity.dat /usr/local/share/GeoIP/GeoLiteCity.dat
    Then the ruby part:
    >> require 'geoip_city' >> g = GeoIPCity::Database.new('/usr/local/share/GeoIP/GeoLiteCity.dat') >> res = g.look_up('4.2.2.2') >> puts "lat: #{res[:latitude]} lng: #{res[:longitude]}" lat: 38.0 lng: -97.0


    2008/01/25

    cygwin, Rails2, OpenID 2

    Hi, I've been googling about a week to solve a ruby-openid problem. And found a working example on Rama McIntosh's blog. http://myutil.com/2007/12/29/openid-2-0-2-with-rails-2-0-2

    At first, I thought rails Ticket #10604 patch worked. But it was more complicated than that. Since Rails, ruby-openid, and open_id_authentication plugin versions were not consistent. And Rama McIntosh went through all. You can find Dr. Nick’s example application fully ported to rails 2.0.2.
    Here is my development environment. 
    ------------------------------------------------------------
    LG LW25 advanced laptop IntelCore2 T5600, Mem 2G
    XP Pro version2002 SP2
    Cygwin + CygPutty 
    Ruby ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-cygwin]
    Rails 2.0.2
    ruby-openid (2.0.3)
    rake (0.8.1)
    mongrel (1.1.3)
    mongrel_cluster (1.0.5)
    ruby-yadis (0.3.4)
    app db : sqlite3
    ------------------------------------------------------------
    Besides his README, some extra typing was needed to run the app.
    1. svn co http://drnicwilliams.com/svn/openid/demos/apps/openidauth_multiopenid/trunk openidauth_multiopenid
     
    2. Do not erase some svn directories because he made some rake tasks related with svn.
    3. rake freeze TWICE!
    4. mkdir log
    5. require_gem => gem
    openidauth_multiopenid/vendor/gems/ruby-openid-1.1.4/lib/openid/service.rb:7
    openidauth_multiopenid/vendor/gems/ruby-openid-1.1.4/lib/openid/discovery.rb:8:
    6 rake db:create
    7. gem install mocha
    8. rake test
    9. config/environment.rb
      config.action_controller.session = { :session_key => "_openidauth_multiopenid_session", :secret => "mocramagic" }
      
      Replace to other {key, secret} like this,
      
        config.action_controller.session = {
        :session_key => '_foo_session',
        :secret      => '4747ba80asdfqwertwertwee5y4365345ertf gadrtvrwebterwvd653b65tyt93c45cb53242eb43'
      }
    10. mongrel_rails start!!

    2008/01/23

    IT WORKS!!!

    How I deployed to my slice. 
    1. Peepcode tutorials 
    capistrano and git screencast helped me. 

    He really help me out. Any one who's struggling with capistrano & git, I higly recommand his tutorial. I was able to deploy my app via Cygwin.

    IT'S PRODUCTION MODE!!

    1. In environment.rb, uncomment 
    RAILS_GEM_VERSION = '2.0.2' unless defined? RAILS_GEM_VERSION

    2. deploy.rb
    set :mongrel_servers, 3
    set :mongrel_port, xxxx
    set :rails_env, 'production'

    3. /u/apps/appname/current/config/mongrel_cluster.rb
    ---
    user: deploy
    group: deploy
    log_file: log/mongrel.log
    cwd: /u/apps/appname/current
    port: xxxx
    environment: production
    pid_file: tmp/pids/mongrel.pid
    address: 127.0.0.1
    servers: 3

    4. cap deploy:migrate RAILS_ENV=production

    2008/01/22

    grep mongrel pid

     ps -ef | grep mongrel

    kill -9 xxx

    OR

    ps aux | grep [m]ongrel

    ps aux | grep [m]ongrel | awk '{ print $2 }' | xargs kill -9

    2008/01/21

    ActiveRecord::StatementInvalid (Could not find table '

    ActiveRecord::Base.allow_concurrency = true
    http://blog.defv.be/2006/9/21/activerecord-ruby-and-threads
    http://blog.ardes.com/archives/2006/12
    It's just amazing that the bug is still there...

    2008/01/18

    cygwin ssh.

    If you're using capistrano or webistrano and developing on cygwin environment, you better set server's ssh port to 22. Capistrano does not change it's port number when cap deploy:cold. I googled this problem for 3 days. And this is what I got so far.

    edit .git/hooks/pre-commit and comment out the following lines:
    if (/\s$/) {
    bad_line("trailing whitespace", $_);
    }


    below article was written by stevie, at capistrano : google groups.
    ----------------------------------------------------------------

    A better Cygwin package manager: 
    1. run setup.exe again, but this time use the GUI and install only 
    wget (if you're installing Cygwin on a bunch of machines, it would 
    probably be easier to install wget on one machine and then copy over 
    then necessary files for wget on the others so you're not having to 
    fire up the GUI on each machine) 
    2. get Stephen Jungels' apt-cyg and copy it into /bin:  wget 
    http://stephenjungels.com/jungels.net/projects/apt-cyg/apt-cyg 
    3. Now you can install any cygwin package with a "apt-cyg install 
    ".  *MUCH* easier than using that horrible GUI. 
    ----------------------------------------------------------------------------------
    one cent tips
    ---------------------------------------------------------------------------------
    1. Can't see the welcome page?
    sudo chown -R www-data:www-data /var/www/rails/learnkorean.kr/current

    2. If you cannot deploy production mode, try this
    %> RAILS_ENV=production rake db:migrate
    or
    %> set RAILS_ENV=production
    %> rake db:migrate

    2008/01/16

    Gusty, Nginx, Rails and Mongrel_cluster howto

    Here are the articles where I learned proper way to do this.

    sudo cp /usr/lib/ruby/gems/1.8/gems/mongrel_cluster-1.0.5/resources/mongrel_cluster /etc/init.d/mongrel_cluster

    Next, add a path statement to mongrel_cluster file just above the CONF_DIR variable:
    sudo vi /etc/init.d/mongrel_cluster

    PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local:/usr/local/sbin:/usr/local/bin
    USER=mongrel to USER=www-data

    sudo chmod +x /etc/init.d/mongrel_cluster
    sudo update-rc.d mongrel_cluster defaults

    In our rails app directory we need to create our mongrel config and then symlink it to where our mongrel config directory located at /etc/mongrel_cluster.

    nano config/mongrel_cluster.yml

    cwd: /var/www/rails/coredrill
    log_file: log/mongrel.log
    port: 8000
    environment: production
    group: www-data
    user: mongrel
    address: 127.0.0.1
    pid_file: tmp/pids/mongrel.pid
    servers: 3


    ln -s /var/www/rails/coredrill/config/mongrel_cluster.yaml /etc/mongrel_cluster/coredrill.yaml

    Starting nginx: 2008/01/15 23:17:19 [warn] 3238#0: conflicting server
    name "coredrill.wowdns.com" on 37.208.125.80:80, ignored
    ==>
    You have to add this to your default vhost:

    server_name _ *;
    listen 8080 default;


    Finally, check your vhost config.
    server
     listen 37.208.125.80:80; => listen 8080;
    ...
    }
    sudo ln -s /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default



    mongrel_rails start -d -e production -p 8000 -P log/mongrel8000.pid 
    mongrel_rails start -d -e production -p 8001 -P log/mongrel8001.pid 
    mongrel_rails cluster::start 
    mongrel_cluster_ctl status

    2008/01/15

    another logo



    Core Drill


    Well, I'm developing a site with my friend. My rails stack is on Xen(slicehost).
    • Ubuntu 7.1.0 Gusty
    • NGINX
    • Mogrel_cluster
    • Capistrano
    • Rails2.0.2

    2008/01/10

    one cent tip.

    Fount this from google groups
    http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/e0fcc4720ee59ba8/5bd3f77e610925b3%235bd3f77e610925b3


     I installed mini magick correctly and 
    thumbnails are still not generated.

    You need to have a 'parent_id' column in your photos table.  This one 
    had me scratching my head for a few hours too until I stumbled across 
    this requirement of the plugin. 

    attachment_fu on Windows

    http://railsforum.com/viewtopic.php?id=6307
    Code :   fold - unfold
    1.       def uploaded_data=(file_data)
    2.         return nil if file_data.nil? || file_data.size == 0
    3.         self.size = file_data.size
    4.         self.content_type = file_data.content_type
    5.         self.filename     = file_data.original_filename if respond_to?(:filename)
    6.         if file_data.is_a?(StringIO)
    7.           file_data.rewind
    8.           self.temp_data = file_data.read
    9.         else
    10.           self.temp_path = file_data.path
    11.         end
    12.       end
    and added conditionals for the size
          

    Code :   fold - unfold
    1.       def set_size_from_temp_path
    2.           self.size = File.size(temp_path) if save_attachment? && (self.size == 0 || self.size.nil?)
    3.       end

    Posted by Adam (Guest) 
    on 10.04.2007 01:34
    http://www.ruby-forum.com/topic/99870
    To get things working with S3 and windows, I changed:        def temp_data         if save_attachment?           f = File.new( temp_path )           f.binmode           return f.read         else           return nil         end       end (before, the method body was save_attachment? ? File.read( temp_path ) :  nil  ) 

    2008/01/09

    Rails2.0 and heroku the awesome rails app hosting



    Check it out. It's free and looks cool. I was frustrated by googling free rails hosting all day. Of course there're many hosting sites with shining options. But for testing, it's too expensive. Anyway I found the heroku.com. With Rails2.0 and Amazon S3, this site will dominate all the other hosting sites. Why? because they'll support Gems & Plugins Manager which made me annoying.

    There're also some screencasts.

    So, for now you'd better freeze your gems by using Dr Nic's Gems on Rails.

    To install the plugin:

    > gem install gemsonrails > cd rails-app-folder > gemsonrails 

    Usage:

    rake gems:freeze   GEM=gem_to_freeze rake gems:link     GEM=gem_to_link rake gems:unfreeze GEM=gem_to_unfreeze_or_unlink
    gem install gemsonrails cd app-folder gemsonrails rake gems:freeze GEM=ruby-net-ldap


    (Though freezed gem does not work properly now)