Ruby China
  • Topics
  • 招聘
  • Wiki
  • 酷站
  • Gems
  • Sign Up
  • Sign In
@iwinux
VIP
NO. 152 / 2011-11-21

豆瓣
广州
17 Topics / 137 Replies
2 Followers
0 Following
0 Favorites
野生程序员
GitHub Public Repos
  • avante.nvim 0

    Use your Neovim like using Cursor AI IDE!

  • vfkit 0

  • spanner-cli 0

    Interactive command line tool for Cloud Spanner

  • booster 0

    Fast and secure initramfs generator

  • crane-test 0

    https://github.com/ipetkov/crane/issues/359

More on GitHub
  • Overview
  • Topics
  • Replies
  • Favorites
  • Following
  • Followers
  • 关于查看 Rails 动态生成的函数源码的问题 at February 27, 2012

    #4 楼 @ashchan

    respoind_to? 是个比较容易被忽视的问题,我是看 Meteprogramming Ruby 的时候才意识到。ActiveRecord 貌似有 override 掉 respond_to??

  • 关于查看 Rails 动态生成的函数源码的问题 at February 27, 2012

    其实也不难追踪啊。你想看 posts_path 是怎么定义的,那就去翻 ActionDispatch::Routing::Mapper::Resources 的源码咯

    至于出错时的调试,我觉得 stack trace 提供的信息已经足够定位出错的地方了……

  • 这里有多少人用机械键盘? at February 26, 2012

    Dell SK-8115 用户路过……话说现在已经很难买到了。

  • 如何批量生成百万条数据? at February 23, 2012

    #20 楼 @ashchan 嗯,我跑了你的测试,内存使用没有明显增加,但 CPU 保持 50% 占用率一直到测试运行完……我还另外写了一个 batch_insert.rb,作为对照。

    BTW: 为什么 benchmark 不显示内存占用??

    我的机器配置

    CPU: Pentium(R) Dual-Core CPU T4200 @ 2.00GHz RAM: DDR2 2G Arch Linux + Ruby 1.9.3-p0

    loop_insert.rb 测试结果

           user     system      total        real
    "create a million monkeys, crash me if you can"
    1_000_000.times #create554.660000  53.490000 608.150000 (641.897088)
    

    batch_insert.rb 的测试结果

           user     system      total        real
    1_000_000.times #create155.340000   0.480000 155.820000 (177.756519)
    
  • 如何批量生成百万条数据? at February 23, 2012

    @metal @xdite @ashchan

    我 Google 了一下,找到这篇文章,也许可以作为参考:http://www.coffeepowered.net/2009/01/23/mass-inserting-data-in-rails-without-killing-your-performance/

  • Rails 部署 Nginx 奇怪 404 问题 at February 20, 2012

    #15 楼 @29decibel

    呃,这个问题从 passenger 到 RVM 到 nginx 到 IP 映射最后居然是目录加密的问题 = =!!!!

  • Rails 部署 Nginx 奇怪 404 问题 at February 20, 2012

    #9 楼 @29decibel

    还有几个问题:

    1. 你是从外网访问这台服务器?

    2. 内网访问的时候是否正常?

    3. nginx server 的 server_name 是 localhost?

  • Rails 部署 Nginx 奇怪 404 问题 at February 20, 2012

    #9 楼 @29decibel 这我就不清楚了,所以刚才我才问 IP 映射是怎么设置的……

  • Rails 部署 Nginx 奇怪 404 问题 at February 20, 2012

    #7 楼 @29decibel

    试试配置一个静态目录,看看没有 SSH 连接的情况下能否正常访问,比如这样:

    user  fin;
    worker_processes  4;
    
    events {
        worker_connections  1024;
    }
    
    http {
        include       mime.types;
        default_type  application/octet-stream;
        sendfile        on;
        keepalive_timeout  65;
    
       server {
          listen 80;
          server_name localhost;
          root /tmp/test;
          index index.html;
       }
    }
    

    还有就是,server_name 是真的写了 localhost 么……

  • Rails 部署 Nginx 奇怪 404 问题 at February 20, 2012

    #4 楼 @29decibel Sorry 刚刚没注意到内外网映射……你的内外网映射是通过什么来设置的?

  • Rails 部署 Nginx 奇怪 404 问题 at February 20, 2012

    有几个问题:

    1. Ruby 是通过 RVM 安装的么?

    2. 你试试用另外一个用户 SSH 登录进主机,看看是否正常?(排除用户 .bash_profile 和 .bashrc 的影响)

  • Rails 部署 Nginx 奇怪 404 问题 at February 20, 2012

    /home/fin/app/current/public/index.html 是什么来的……还是贴 nginx 配置出来看看吧~

  • 新装机,把 VIM 插件整理一下,拿出来分享的交流一下 at February 20, 2012

    三个一起:

    • https://github.com/iwinux/vimrc
    • https://github.com/iwinux/oh-my-zsh
    • https://github.com/iwinux/emacs-config
  • Ruby 1.9.3-p125 is released at February 17, 2012

    鸡血补丁什么时候被 merge 啊

  • 好奇删除的时候的确认对话框肿么出来滴? at February 13, 2012

    看这里就知道了:https://github.com/rails/jquery-ujs/blob/master/src/rails.js#L207

  • Ruby 1.9 的新 Hash 语法 at February 12, 2012

    #2 楼 @camel 那就不可避免地要跟旧式的混在一起啊……

  • 大家谈谈自己在学习 rails 过程走过哪些弯路? at February 10, 2012

    学好 Ruby 语言非常重要。

  • 对于有很多 association 的 model 要怎么处理…… at February 10, 2012

    #6 楼 @azhao 所以我正在考虑(咳咳)……

    #7 楼 @lgn21st 把代码写到子模块里然后 include 进来?这个方法感觉不错。刚刚还想到,对于同一类型(比如多对多)的多个关联,可以通过命名约定 + meta programming 的方式简化代码(正在试验中)

  • 对于有很多 association 的 model 要怎么处理…… at February 10, 2012

    #2 楼 @lgn21st 这样这个 model 会变得非常庞大(指代码量),有没有什么方法可以把这些关系抽象出去呢……

  • 对于有很多 association 的 model 要怎么处理…… at February 10, 2012

    #1 楼 @clc3123 不是 user,是业务核心的一个 model.

  • 在 CentOS 服务器上做 rake db:migrate 非常非常慢,甚至崩溃 at January 19, 2012

    崩溃?具体的命令行输出是?

    PS: 跟 Rails 相关的命令大多都反应迟钝(遇上单核的机器就更伤不起了),习惯就好 = =

  • 手把手教你在 Windows7 中安装 Ruby1.9.3 at January 19, 2012

    @ery

    ack "keyword" -ail app | xargs git log -10 -- # 列出 app 目录中包含关键词 keyword 的所有文件的最近10次 git 提交记录
    

    这种命令如果有 GUI 替代品的话我也乐意用啊~

  • 手把手教你在 Windows7 中安装 Ruby1.9.3 at January 18, 2012

    个人认为,如果真的要在 Windows 里做 Ruby 开发,就开虚拟机装个 Ubuntu,设置好 NAT 之后 ssh 到 Ubuntu 里面玩吧……难道没有人觉得在 Windows 里写程序很自虐么,连个像样的 Terminal 都没有。

  •  怎样在产品环境下同时部署 ree 和 ruby 1.9 的应用 at January 17, 2012

    推荐用 RVM + Unicorn...

  • 大三下学期想实习 at January 17, 2012

    我也是大三,现在正在实习中……

  • Could not find a JavaScript runtime. at January 01, 2012

    在系统里装一个 Node.js

  • Prev
  • 1
  • 2
  • 3
  • 4
  • 5
  • Next
关于 / RubyConf / Ruby 镜像 / RubyGems 镜像 / 活跃会员 / 组织 / API / 贡献者
由众多爱好者共同维护的 Ruby 中文社区,本站使用 Homeland 构建,并采用 Docker 部署。
服务器由 赞助 CDN 由 赞助
iOS 客户端 / Android 客户端 简体中文 / English