星期六, 7月 07, 2007

Problems while installing RoR on OpenBSD

While installing ruby from ports (currently 1.8.5) on my OpenBSD 4.1 boxes, I will always get an error as follows:

.... failed to allocate memory (NoMemoryError)

 So, I tried to install ruby 1.8.6 and rubygems 0.9.4 from source tarballs instead and it can be done successfully w/o errors. But after that, another error showed when i tried to install rails:

Bulk updating Gem source index for: http://gems.rubyforge.org
/usr/local/lib/ruby/1.8/yaml.rb:133: [BUG] Segmentation fault
ruby 1.8.6 (2007-03-13) [i386-openbsd4.1]

Abort

After some googling around, I found this solution and it works for me.

You have to modify the file /usr/local/lib/ruby/site_ruby/1.8/rubygems/sources_index.rb, replace the convert_specs method with the following one:

def convert_specs(yaml_spec)
      specs = Cache.new

      nl = 0
      yaml_spec.each do |line|
        nl += 1
      end

      notify_percent = 15
      nl_till_rollover = nl_for_x_percent = nl / notify_percent
      p = 0.0

      state = :scan
      gem_yaml = ''
      yaml_spec += "\n  DONE" # so that the last gem is added

      yaml_spec.each do |line|
        if nl_till_rollover == 0 && nl > 100000
          p += 100.0 / notify_percent
          nl_till_rollover = nl_for_x_percent
          puts "#{p.to_i}%"
        end
        nl_till_rollover -= 1

        if state == :scan && line =~ /^  \S/
          gem_yaml = line
          state = :copy
        elsif state == :copy && line =~ /^  \S/
          spec = YAML.load(gem_yaml).values[0]
          specs.add_spec spec
          # keep going
          gem_yaml = line
        elsif state == :copy
          gem_yaml += line
        end
      end

      specs
    end

Then, you can run "gem i rails -y" again, but it will show:

Bulk updating Gem source index for: http://gems.rubyforge.org
6%
13%
20%
26%
33%
40%
46%
53%
59%
66%
73%
80%
86%
93%
100%
ERROR:  While executing gem ... (Gem::GemNotFoundException)
    Could not find rails (> 0) in any repository

 

That's alright, just run AGAIN and it will be done successfully. (I don't know why I have to run it twice....)

 

Technorati Tags: , , , ,

星期四, 7月 05, 2007

推一下 Windows Live Writer

前幾天聽 chenjl 大學長推的,先講一下,這是離線的 blog 編輯軟體,我聽到的第一個直覺是我又沒有離線寫 blog 的習慣和需求,用這個幹嘛... 但是!  重點來了! Windows Live Writer 可以間接同步多個不同的 blog!

之前曾寫過一篇同步 blogger 和 live spaces 的方法,但是,對於 wordpress.com 一直沒法,因為 wp 不支援 email 貼文的機制,所以我之前的方法都是不定時去 wp 使用它的 import 功能,直接從 blogger 匯入,反正也沒常在寫 blog,倒也還過的去。 

前面說過 Windows Live Writer 是個離線的編輯軟體,所以下載安裝完之後,你就可以在這套軟體中編輯你的文章內容,還有很多的 plugins 可以下載,像是 msn/洋蔥頭 的表情符號,flickr/youtube/google/del.icio.us ...等服務的整合,這些都是幫助你編輯用的。結束編輯後,若像我要一次要貼到 blogger/live spaces/wordpress.com 三個部落格上,我就可以把三個帳號都先建好,然後寫完就可以直接選擇三個帳號發表,文章在自己電腦上也會存一份,也算是間接做了一次備份。

最近這三篇我都是用 Live Writer 發的,用過才敢推 smile_tongue

丁丁大站又在耍丁丁

晚上正在看這篇blog的時候,正好瑄跑來跟我講她同學也碰到同一件事,結果因為她同學之前註冊的 email 早就不能用了,所以只好再重新註冊一個新帳號,人客阿~台灣還有其他可以用的 BSP 啦,不是只有丁丁大站啦,不要再去註冊新帳號給丁丁耍啦!

隨便推一個:http://www.pixnet.net/

星期日, 7月 01, 2007

東港黑鮪

一個多月前就說要去了(其實好像每年都吵著要去 @,@),但是要等某位待嫁新娘趕論文、畢業口試,所以上星期天才成行,專程跑去東港吃黑鮪,晚上順便去高雄愛河走走,在此特別感謝 Roger 長輩贊助 Natura 1600 底片三捲,剛好趕上在出發當天早上收到快遞包裹 smile_teeth

完整照片在這裡