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
  • 概况
  • 话题
  • 回帖
  • 收藏
  • 正在关注
  • 关注者
  • sidekiq jobs 里的竞态问题 at 2014年07月04日

    用 limit_fetch 设置某个 queue 同时只能由一个 worker 处理

    https://github.com/brainopia/sidekiq-limit_fetch

  • sidekiq jobs 里的竞态问题 at 2014年07月04日

    用 limit_fetch 设置某个 queue 同时只能由一个 worker 处理

    https://github.com/brainopia/sidekiq-limit_fetch

  • 分享几个部署时解决 ENV 变量问题的方案 at 2014年07月02日

    #3 楼 @ruohanc 多个应用可以用不同的环境变量 APP1_SECRET_KEY_BASE APP2_SECRET_KEY_BASE

    secrets.yml 里面也相应修改即可

  • 全新的 Ruby Web 框架:Lotus at 2014年06月30日

    #11 楼 @luikore 还不够啊,model 这边还缺少 DTO,PO,VO 等等,这样才能算是回到 EJB 时代。

  • 纯静态网站,如何做 form 提交? at 2014年06月25日

    https://www.jinshuju.net/

  • 可能是最瞎扯淡的职业测试 at 2014年06月19日

    我和你们不一样,说明这代码不是写死的,哈哈哈

  • Grape API 如何对结果进行 Gzip? at 2014年06月19日

    #3 楼 @glorySpring 开发环境可以用 Rack middle ware: Rack::Deflater

  • 请问如何高效率的计算最长连续子序列? at 2014年06月19日

    这种需求属于常用统计,翻开我的 sql 小本本,找到一句 sql 查询就可以搞定:

    select a.name, a.created_at as start, min(c.created_at) as end, (c.created_at - a.created_at) as counter
    from visits      as a
    left join visits as b on a.name = b.name and a.created_at = adddate(b.created_at, 1)
    left join visits as c on a.name = c.name and a.created_at <= c.created_at
    left join visits as d on c.name = d.name and c.created_at = adddate(d.created_at, -1)
    where b.created_at is null and c.created_at is not null and d.created_at is null
    group by a.name, a.created_at
    

    输出结果

    +------+------------+------------+---------+
    | name | start      | end        | counter |
    +------+------------+------------+---------+
    | ls   | 2014-01-01 | 2014-01-02 |       1 |
    | ls   | 2014-02-01 | 2014-02-05 |       4 |
    | ls   | 2014-03-02 | 2014-03-03 |       1 |
    | zs   | 2014-01-01 | 2014-01-02 |       1 |
    | zs   | 2014-02-01 | 2014-02-04 |       3 |
    | zs   | 2014-03-01 | 2014-03-03 |       2 |
    +------+------------+------------+---------+
    
  • 有什么好用的 HTML 截断 gem 推荐吗? at 2014年06月17日

    推荐 hpricot 可以参考别人写的: https://github.com/jdidion/feedme/blob/master/lib/hpricot-util.rb

  • [上海][2014年6月17日] 周中聚会 at 2014年06月13日

    啊,我被点名?没准备好呢,只能按照我论坛上发布的帖子来和大家随便聊聊...

  • 一个算法问题:保证用户总是看到随机新的东西,并且效率还不错? at 2014年06月04日

    #3 楼 @imlcl visited 表只有 2 个复合主键,千万级数据也只是几十 M 大小的数据文件

  • 一个算法问题:保证用户总是看到随机新的东西,并且效率还不错? at 2014年06月04日

    就用一个表记录一下取过的文章,因为有外键和主键在,查询效率完全不用担心:

    query = "id not in (select id from visited where user_id = 1)"
    Post.where(querey).offset(rand(Post.where(query).count)).limit(1)
    
  • Ruby 程序员写 Swift 毫无压力 at 2014年06月03日

    #33 楼 @Victor ruby 的 case when 只是做===比较,无法做 value binding

  • Ruby 程序员写 Swift 毫无压力 at 2014年06月03日

    #1 楼 @xds2000 嗯,也像 js,7 天 7 语言嘛 :)

  • 七牛邀你回忆童年的那些事,赢取儿童节礼物 at 2014年05月30日

    代表 70 后来吐槽...

  • 大家看老罗的锤子手机发布会了么 at 2014年05月23日

    #41 楼 @hooopo 明白了,是我弄错了,刚刚上他们预订网站(preorder.smartisan.com)看了一下,下订单或者支付等是用 http,但是登陆或者注册的域名 account.smartisan.com 用了 https

  • 大家看老罗的锤子手机发布会了么 at 2014年05月22日

    #39 楼 @hooopo 今天刚刚改的?preorder 这个域名获取订单信息,支付等还没改完,估计是听到别人说他吹牛了

  • 总结 Web 应用中常用的各种 Cache at 2014年05月22日

    #67 楼 @aptx4869 nginx 自带 etag 只支持静态资源

  • 总结 Web 应用中常用的各种 Cache at 2014年05月22日

    #62 楼 @aptx4869 #63 楼 @hepochen Rack::ETag 不是累赘,对于非性能瓶颈的请求,没必要手工加 fresh_when/stale 等判断,就算多生成一次 response body,浪费一些服务器资源也无所谓,客户端还是能够享受到 304 带来的好处.

  • 总结 Web 应用中常用的各种 Cache at 2014年05月22日

    #59 楼 @hepochen 对于动态请求来说,etag 和 last modified 都是需要后置校验,没办法提前到 nginx 这层面校验.我不选择用 last modified 是因为 etag 更加灵活,可以用更新时间+其他参数,比如我文章中提到过的当前用户 id,评论数等来做.

  • 总结 Web 应用中常用的各种 Cache at 2014年05月22日

    #52 楼 @hepochen rails 的 fresh_when 是做了特殊处理的,在判断到 etag match 时候,只返回 304 header,而不会去执行后续代码.可以参考源码: https://github.com/rails/rails/blob/master/actionpack/lib/action_controller/metal/conditional_get.rb#L82 我里面提到的和 Rack::Cache 的对比 curl 实验也说明了这一点 至于 last_modified,我在实际应用中因为采用 fresh when/stale 这种方式手工处理 etag,就没必要混合使用,2者用其一就可以了.除非你有 last modified 未触发时间失效,但是又会出现 etag 改变的特殊情况才需要混用.

    不仅仅是 markdown 转 html,就是单纯的 rails helper 生成 html,或者复杂页面 view template 渲染,也需要花费 10ms 级别的时间(没办法,ruby 不够快),对于访问量大的页面,片段缓存能够节约掉这部分时间也是相当可观的

    in 查询一般都是主键查询,或者是有 index,不会有全表查询问题.

  • 大家看老罗的锤子手机发布会了么 at 2014年05月21日

    #29 楼 @jasl 这是老罗那条微博的截图: 捐给科技基金还是医疗基金,或者是助学基金,都是 PR 行为,只不过老罗的粉丝认为前者更有逼格,于是就原谅了他吹牛的部分.

  • Cache 在 Ruby China 里面的应用 at 2014年05月21日

    #10 楼 @huacnlee 你用的 newrelic gem 没升级吧,某个版本以后有的.

    我们现在用的 gctools/oobgc 基本上请求中 GC 的情况很少很少了.

  • Cache 在 Ruby China 里面的应用 at 2014年05月21日

    我那篇还没写完,也准备要加"给最需要的部分做缓存"这一节,先搭车放个我们网站 New Relic 的图:

  • 大家看老罗的锤子手机发布会了么 at 2014年05月21日

    #16 楼 @costy_peak 不在规划中?不是说有芯片和基带的技术问题没解决,要到年底么? 另外一边说有情怀地捐款给 OpenSSL,一边自己网站的登陆,注册,购买还是 plain http,吹嘘能力还是一如既往的不错.

  • 大家看老罗的锤子手机发布会了么 at 2014年05月21日

    锤子目前还不支持 4G,要到年底才有 4G 版本,期货卖 4000 元,对比去年的 nexus 5,更加觉得 google 是良心企业。

  • 总结 Web 应用中常用的各种 Cache at 2014年05月20日

    #30 楼 @meeasyhappy 是一样的,我已经补充到原文。 关于 3 的标题,action cache 其实也是缓存整个请求,和 2 差异在于:检查命中缓存的操作一个在 nginx,一个在 ruby,我再想想是否有更好的标题名。

  • 总结 Web 应用中常用的各种 Cache at 2014年05月20日

    #9 楼 @leekelby Rack::ETag 和 fresh_when 的区别我已经补充到原文。 Page Caching 和 Action Caching 在 rails 4 里面是独立了一个 gem,并不是废弃。

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