Ruby China
  • 社区
  • 招聘
  • Wiki
  • 酷站
  • Gems
  • 注册
  • 登录
@quakewang
高级会员
第 162 位会员 / 2011-11-22

[email protected]
上海
26 篇帖子 / 752 条回帖
212 关注者
4 正在关注
22 收藏
GitHub Public Repos
  • rfcs 1

    This repository contains proposals, standards and documentations related to Nervos Network.

  • linux 1

    Linux kernel source tree

  • cfn-node 0

  • ckb 0

    CKB is a public/permissionless blockchain, the layer 1 of Nervos network.

  • ractor 0

    Rust actor framework

  • autocorrect 0

    A linter and formatter for help you improve copywriting, to correct spaces, punctuations between ...

  • ckb-vm 0

    CKB's vm, based on open source RISC-V ISA

  • ckb-auth 0

    A consolidated library featuring numerous blockchains authentication techniques on CKB-VM

  • hyprnote 0

    Privacy-first AI Notepad for back-to-back meetings

  • fiber-scripts 0

More on GitHub
  • 概况
  • 话题
  • 回帖
  • 收藏
  • 正在关注
  • 关注者
  • Data Warehouse Schema Design at 2015年04月13日

    你们有使用 Mondrian 这种 OLAP engine 吗,用 MDX 来查询,还是直接用 RDBMS 和 sql 来处理?

  • Ruby 中 block 的优先级 at 2015年04月09日

    第一感觉是没有用括号的缘故,搜索了一下 Programming Ruby 果然如此:

    http://phrogz.net/ProgrammingRuby/language.html#blocksclosuresandprocobjects

    Braces have a high precedence; do has a low precedence. If the method invocation has parameters that are not enclosed in parentheses, the brace form of a block will bind to the last parameter, not to the overall invocation. The do form will bind to the invocation.

    另外,这里用 map 应该就可以达成需求,不需要 each_with_object

    clear_cache users.map{ |user| disassociate_user user.id; user.cache_key}
    
  • 2015年3月29日 Rubyist 上海 2015 Q1 聚会 at 2015年03月30日

    #37 楼 @xiaoronglv 我的: http://quake.github.io/slides/lego-ruby/

  • LeetCode 可以上 Ruby 了哦,筒子们还不上 at 2015年03月26日

    已经撸了 2 题,有意思,你这个题目用 hash 保存一下,空间换时间,就可以了:

  • 发布一个 Gem —— ActiveService,给 Rails 添加一个 Service 层 at 2015年03月23日

    你应该在 4 月 1 号发布这个 gem 的

  • 发布用于分页的 gem - simple_paginate at 2015年03月16日

    好像有问题吧?比如说要求每页显示 10 个用户信息,那我代码调用

    @users = User.paginate(page: params[:page], per_page: 10)
    
    @users.each do |u|
      link_to u.name, u
    end
    

    页面上就显示 11 个用户了?

  • 简书沦陷了么? at 2015年03月09日

    将人工判断为 spam 的文章放入到一个集合,新发的文章对这个集合中进行相似度算法过滤,考虑到避免算法误杀,可以将过滤掉的文章再放入一个 list, 每天运营人员扫一眼就可以了。

  • 如何阻止 Ruby 吃掉所有内存?(已解决) at 2015年03月05日

    最大可能是在 deal_with 或者 write_file 这 2 个方法里面有内存泄漏,如果没有内存泄漏,只是做 array 操作,是不应该出现这种情况的。你可以测试一下:

    def report_rss
      puts 'Memory ' + `ps ax -o pid,rss | grep -E "^[[:space:]]*#{$$}"`.strip.split.map(&:to_i)[1].to_s + 'KB'
    end
    
    arr = []
    report_rss
    10.times do
      1000000.times do |i|
        arr << i
      end
      report_rss
      arr.clear
      GC.start
    end
    

    rss 内存会稳定在 GC 参数设置的一个上限。

  • 如何使用 Rails 建立可跨域访问的 API? at 2015年02月27日

    如果前端有 nginx 或者 apache, 可以不用在 rails 里面处理,比如说 nginx, 直接添加 options 的支持:

     if ($request_method = OPTIONS ) {
            add_header Access-Control-Allow-Origin "*";
            add_header Access-Control-Allow-Methods "POST, GET, OPTIONS";
            ...
            add_header Content-Length 0;
            add_header Content-Type text/plain;
            return 200;
    }
    
  • 程序员的好玩具 - Lego EV3 at 2015年02月13日

    #3 楼 @outman 家庭版六节 AA 电池,教育版自带 2000ma 的可充电锂电池,充电一次可以用好久

  • 误敲一个域名,得到意外发现,不得其解 at 2015年02月10日

    另外补充一个冷知识:

    ruby china 的 ip 是 61.174.15.167 转成 16 进制进行换算:61 * 256 * 256 * 256 + 174 * 256 * 256 + 15 * 256 + 167 得到 1034817447 请访问:

    http://1034817447/topics

  • 误敲一个域名,得到意外发现,不得其解 at 2015年02月10日

    后面有。和没有。都是解析到相同域名 只是在 heroku 域名识别的时候没有匹配

    https://ruby-china.org./topics

  • Time.now.at_beginning_of_month 耗时问题 at 2015年02月10日

    1000 次操作还不到 2 秒,平均一次 2 毫秒,这性能还想压榨...

  • [上海][2015年02月10日] 年末聚会 at 2015年02月10日

    #15 楼 @gene_wu 时间安排有冲突,只能年后聚会来了

  • [上海][2015年02月10日] 年末聚会 at 2015年02月08日

    如果时间合适,我可以带个新玩具过去

  • layout nil 无法生效? at 2015年02月04日

    render nothing: true

  • 正负抵消的删除 at 2015年01月24日

    #5 楼 @blacktulip 一行党

    arr.inject([]){|r, a| (i = r.index [a[0], -a[1]]) && r.delete_at(i) ? r : r << a} 
    
  • 怎么查 Rails 应用的灵异问题? (结帖,问题解决,但具体原因不清楚) at 2015年01月11日

    #4 楼 @cxh116 我看到 open file 是 1024,这个值是默认值吧,有点偏小。 你监控一下 lsof,看打开的文件数是不是超过了,而且错误日志有点奇怪,你说用的是 puma,但是为什么错误日志里面是 unicorn:I’m about to timeout bringing down my unicorn worker too :(

  • 怎么查 Rails 应用的灵异问题? (结帖,问题解决,但具体原因不清楚) at 2015年01月10日

    出现这些情况的时候是否都是并发比较多的时候?可以检查一下操作系统的 ulimit 等参数,可能文件打开句柄数或者 socket 打开数之类超过了限制,导致 nginx 等待 puma 处理掉其他请求的时候,没有办法再打开更多的进程而出现超时。

  • 为何淘宝有那么多便宜 VPS 的原因? at 2015年01月09日

    如果是买 linode 这些国外 vps 代充值的,比官网还便宜,那就是黑卡了。 用一段时间可能会被回收的。

  • Ruby 程序员这么难招,我来搞个 Ruby 就业培训班或培训学校怎么样? at 2015年01月09日

    #10 楼 @xhj6 我知道很多人愿意抽空在论坛上回个贴,或者整理一下心得什么的。但真要去做培训,花费的时间就要多很多,收了人家的钱,不认真备课就是误人子弟了。

    #12 楼 @xhj6 有经验的开发人员不一定是好的讲师。要找到有实际经验,同时又愿意设计课程,而且还要讲得好的老师,收费肯定不便宜。拿我来举例子,给其他公司提供咨询服务收费是 1000~1500/小时,如果培训课时费低于这个价格,我是没有兴趣的。这样的价格,据我了解在上海是 Top 5% 的公司或者是特别有这个需求的公司才会接受,而这些公司基本上没有用 Ruby 的 :)

  • ActiveRecord Object Instantiate at 2015年01月04日

    是直接塞进去的,在 Rails.cache 的 read/write 方法内部已经做过序列化和反序列化了。

  • 如果使用 https,电信这 2b 是不是就无法在网页中插入广告了? at 2014年12月24日

    投诉工信部是有用的,不过你得以用户的身份去提起投诉,说服务商在你访问 XXX 网站的时候插入广告。

    不过,这只能针对你所在的服务商...其他不同服务商的用户还是有可能被强 X

  • 平均分配问题 at 2014年12月21日

    #7 楼 @luikore 嗯,没有在 irb 里面验证,随手写一定就会出错啊啊啊

  • 平均分配问题 at 2014年12月21日

    #1 楼 @blacktulip 有内建的 divmod 方法可以用:

    def average_allocate(total, division)
      div, modulo = total.divmod division
      [div + 1] * modulo + [div] * (division - modulo)
    end
    
  • 总结 Web 应用中常用的各种 Cache at 2014年12月16日

    #87 楼 @outman 是的

  • 如何科学使用青云的秒级计费 at 2014年12月16日

    我之前是用 OpenStack 来实现自动扩容和降容: http://quake.github.io/slides/cosug-2012/

    算法是简单地通过统计 30 分钟的平均 session per instance,来决定扩容或者降容,或者通过监控 app 服务器 load,也比较容易实现。

  • 当 Nokogiri/Mechanize 遇到 bot detection 时完全失效了 at 2014年12月12日

    单纯解析 html 的方式是很容易被视为 bot,现在流行用 headless browser

  • 作为开发者,你喜欢 markdown 还是所见即所得的编辑器 at 2014年11月28日

    Markdown

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