• 说说 Rails 的套娃缓存机制 at 2014年09月15日

    rails 可能是这个世界上缓存解决方案最全的框架了

  • 请教各位,我们在用 emay 的接口,使用的专用通道 http 地址与 china_sms 提供的不一样,所以需要修改 URL 地址,感觉这样修有点暴力,求指导

       def use(service, options)
         @service = ChinaSMS::Service.const_get("#{service.to_s.capitalize}")
    +    @service.const_set("URL", options[:base_uri]) if options[:base_uri]
         @username = options[:username]
         @password = options[:password]
       end
    

    详细请看

    https://github.com/roymax/china_sms/commit/d54d40483681f30e65a9f328bb4c078e7e9ff1e4m

  • 参考http://astrails.com/blog/2012/11/13/rvm-install-patched-ruby-for-faster-rails-startup 加个参数竟然过了,-n falcon参数是什么意思?

    rvm get head && rvm install 1.9.3 1.9.3-p327-falcon --patch falcon -n falcon

    $ time rails runner "puts :OK"
    OK
    rails runner "puts :OK"  6.32s user 1.37s system 92% cpu 8.292 total
    
    $ rvm use ruby-1.9.3-p327-falcon
    $ time rails runner "puts :OK"  
    OK
    rails runner "puts :OK"  3.75s user 0.96s system 99% cpu 4.752 total
    
    $ export RUBY_HEAP_MIN_SLOTS=1000000
    $ export RUBY_HEAP_FREE_MIN=500000
    $ export RUBY_HEAP_SLOTS_INCREMENT=1000000
    $ export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
    $ export RUBY_GC_MALLOC_LIMIT=100000000
    
    $ time rails runner "puts :OK"            
    OK
    rails runner "puts :OK"  3.18s user 1.02s system 99% cpu 4.234 total
    
  • 装不上,大家没用 clang?

    Building 'ruby-1.9.3-p327-falcon' using clang - but it's not (fully) supported, expect errors.
    Installing Ruby from source to: /Users/roymax/.rvm/rubies/ruby-1.9.3-p327-falcon, this may take a while depending on your cpu(s)...
    ruby-1.9.3-p327-falcon - #downloading ruby-1.9.3-p327, this may take a while depending on your connection...
    ruby-1.9.3-p327-falcon - #extracting ruby-1.9.3-p327 to /Users/roymax/.rvm/src/ruby-1.9.3-p327-falcon
    ruby-1.9.3-p327-falcon - #extracted to /Users/roymax/.rvm/src/ruby-1.9.3-p327-falcon
    Applying patch /Users/roymax/.rvm/patches/ruby/1.9.3/p327/falcon.diff
    ruby-1.9.3-p327-falcon - #autoreconf
    Error running 'autoreconf', please read /Users/roymax/.rvm/log/ruby-1.9.3-p327-falcon/autoreconf.log
    ruby-1.9.3-p327-falcon - #configuring
    Error running './configure --enable-shared --disable-install-doc --prefix=/Users/roymax/.rvm/rubies/ruby-1.9.3-p327-falcon --with-opt-dir=/Users/roymax/.rvm/usr', please read /Users/roymax/.rvm/log/ruby-1.9.3-p327-falcon/configure.log
    There has been an error while running configure. Halting the installation.
    Ruby 'ruby-1.9.3-p327-falcon' was built using clang - but it's not (fully) supported, expect errors.
    
  • @huacnleerails_admin中设置Referenced 1-n 时,子 collection 的 _id 字段为空值

  • 用 bash 一样也有自动补全,而且暂时不是很想转 zsh 上去