Ruby China
  • 社区
  • 招聘
  • Wiki
  • 酷站
  • Gems
  • 注册
  • 登录
Hooopo
@hooopo
管理员
第 8 位会员 / 2011-10-28

[email protected]
nil
北京
160 篇帖子 / 3013 条回帖
360 关注者
0 正在关注
74 收藏
聪明的妖怪录下了唐僧的紧箍咒
打赏作者
GitHub Public Repos
  • oh-my-github-circles 47

    GitHub User Circle Generator Using GitHub Actions

  • hackernews-insight 21

    Hackernews Insight using TiDB Cloud

  • repo-track-pipeline 6

    🔄 A flexible open-source data pipeline for seamlessly syncing data from any repository to your da...

  • oh-my-github-pipeline 6

    🔄 A flexible open-source data pipeline for seamlessly syncing data from any github user to your d...

  • chatgpt-xiaoai 3

    小爱音箱集成LLM,SaaS 服务

  • repo-contributor-circles 1

    GitHub repo contributor circles generator.

  • ossinsight-x 1

    Automatically post trending repos to Twitter every day.

  • mi-service 1

    XiaoMi Cloud Service for mi.com

  • hooopo 0

  • streamlit-echarts-demo 0

    Demo for Streamlit ECharts component

More on GitHub
  • 概况
  • 话题
  • 回帖
  • 收藏
  • 正在关注
  • 关注者
  • 【转载】向数据库插入多条数据的效率问题 at 2015年01月06日

    #5 楼 @est thx.

  • 【转载】向数据库插入多条数据的效率问题 at 2015年01月06日

    #2 楼 @est 不信..

  • 【转载】向数据库插入多条数据的效率问题 at 2015年01月06日

    http://shopperplus.github.io/blog/2014/11/08/fastest-way-to-load-data-in-mysql.html

  • 2015年 你打算学习哪门编程语言? at 2015年01月06日

    HTML

  • Redis MySQL 混用的最佳实践 at 2015年01月06日

    你为了解决一个不存在的问题引入了 5 个新问题,就是这样……

  • ActiveRecord model 里你们是如何处理耗时远程属性的 cache 的? at 2015年01月05日

    #4 楼 @est 这样?

    class XX
      class << self
        extend ActiveSupport::Memoizable
    
          def addresses
            # some code
          end
          memoize :addresses
       end
    
       def address
         self.class.addresses[type_id]
       end
    end
    
  • ActiveRecord model 里你们是如何处理耗时远程属性的 cache 的? at 2015年01月05日

    https://github.com/matthewrudy/memoist

  • ActiveRecord Object Instantiate at 2015年01月04日

    #1 楼 @quakewang 是的。

    但有几个问题,Rails3 之后 AR 对象内部其实非常复杂了,除了最核心的 attributes 属性之外,还有一些内部状态,比如关联缓存也被储存到了实例里,导致直接塞进去之后再读回来 AR 对象不是fresh的(Rails3 时是这样,不知道 Rails4 是否有改动)。如果是片段缓存这种只读场景无所谓,如果可以对从缓存读出的对象再修改,就会带来同步问题。我觉得这也是 initialize_dup 和 encode_with 接口存在的意义。保证 dump 出来的对象是fresh的。

    我觉得 Rails 推荐的用法是 用 encode_with dump 出 attributes,用 allocate + init_with 初始化对象,序列化只需要存储的是 attributes,这样对象体积也减少了很多。

    # AR内部状态
    https://github.com/rails/rails/blob/f916aa247bddba0c58c50822886bc29e8556df76/activerecord/lib/active_record/core.rb#L550-L562
        def init_internals
          @aggregation_cache        = {}
          @association_cache        = {}
          @readonly                 = false
          @destroyed                = false
          @marked_for_destruction   = false
          @destroyed_by_association = nil
          @new_record               = true
          @txn                      = nil
          @_start_transaction_state = {}
          @transaction_state        = nil
          @reflects_state           = [false]
        end
    

    然后 encode_with 这个接口对于 serialize attributes 居然是不 work 的 ... 本质是 attributes_before_type_cast 这个方法返回值不固定: https://github.com/rails/rails/issues/18210

    # encode_with imp
      def encode_with(coder)
        # FIXME: Remove this when we better serialize attributes
        coder['raw_attributes'] = attributes_before_type_cast
        coder['attributes'] = @attributes
        coder['new_record'] = new_record?
      end
    
  • 寻找一个创业技术合伙人 at 2015年01月02日

    架构师^_^

  • [广州] 招聘 Ruby 工程师 at 2015年01月01日

    #11 楼 @cliviazhou 大几?

  • second_level _cache 2.1.1 is released at 2014年12月31日

    #5 楼 @moioo 已修复,谢谢反馈~~

  • 如何更好的同步 github 上的数据 at 2014年12月30日

    #4 楼 @bcho 看着 id 好熟悉

  • File.read 读不全文件 at 2014年12月30日

    #5 楼 @jasl http://blog.rubybestpractices.com/posts/ewong/013-IO-dup-and-dup-system-call.html

    文件只有一个,但文件描述符和 Ruby IO 对象有多个,他这个就是没写进去..

  • 如何更好的同步 github 上的数据 at 2014年12月30日

    #2 楼 @bcho 你是豆瓣的何先生...?

  • File.read 读不全文件 at 2014年12月30日

    设置 async = false 呢,没测

  • 开发 app 的后台,用 ror 或者 Sinatra 能否合适? at 2014年12月30日

    都合适

  • 如何更好的同步 github 上的数据 at 2014年12月30日

    楼主就这样把 rubychina 玩成 stackoverflow

  • InfluxDB + Grafana 快速搭建自己的 NewRelic,分析应用运行情况 at 2014年12月30日

    #7 楼 @huacnlee Orz

  • InfluxDB + Grafana 快速搭建自己的 NewRelic,分析应用运行情况 at 2014年12月30日

    把 NewRelic 的 APM client 后端改成 InfluxDB 就强大了..

  • 你们都是如何调试的 at 2014年12月29日

    pry pry

  • 捣鼓算法有意义么? at 2014年12月29日

    没意义,人活着不是也没意义么,整天做的就是 killing time 啊!

  • GZRuby 第 22 次活动总结 at 2014年12月29日

    #3 楼 @jasli2 使用 Token Base 应该没什么争议,MessageVerifier 也是签名,不加密。看了源码和 JWT 实现方式几乎一样。其实自己写签名步骤也就几行代码搞定...

    链接内容不错,谢谢分享。

  • How search and index works (Ruby 语言描述) at 2014年12月29日

    #10 楼 @luikore 嗯,为了简化,没写那么复杂。

    fourty-four 和 fourtyfour 等价应该算是一个 WordDelimiter 相关的话题,solr 的文档描述的更全一些: http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters#solr.WordDelimiterFilterFactory

    可能还需要根据驼峰或数字与字母间隔去拆:fourtyFour -> fourty four, windows2000 -> windows 2000

  • GZRuby 第 22 次活动总结 at 2014年12月29日

    #1 楼 @will7v 囧 rz

    之前没有了解过 JWT,回去看了一下,感觉和 Rails 自带的cookie 签名机制没啥区别。更想听的是“Why jwt better”,和其他类似方案的对比,比如直接用 Rails 的 MessageVerifier 或 AES 加密 甚至直接在 account 上面加一个 api token 之类做法有什么优缺点之类的话题。还有,JWT 作为标准有什么约束力,如果标准没有人遵守其实也是一种束缚,大家各自使用自己的实现会更自由一些。

    大家可以就这个帖子再讨论一下...

  • How search and index works (Ruby 语言描述) at 2014年12月28日

    #4 楼 @lgn21st 因为手机上不能用 github 登录,又不记得密码……

  • How search and index works (Ruby 语言描述) at 2014年12月28日

    #2 楼 @bhuztez 为何不去看 lucence 代码

  • [远程] 福利 Groupon 招聘高级研发工程师 提供 L-1 Visa at 2014年12月26日

    HR 好机智 居然会用+过滤邮件

  • 如何权衡 DRY 与可读性 at 2014年12月26日

    #22 楼 @ery 因为不认识成语读不懂中文,和因为句子不通、逻辑混乱读不懂,是两种情况。一段程序好不好不应该以奥巴马能否读懂为基准,奥巴马读懂了是巧合,我们谈论可读性不应该在这个层面上。

  • 开源项目 获取分享 huoqufenxiang.com at 2014年12月26日

    delete

  • 如何实时获得 stdout 里的内容? at 2014年12月18日

    不用那么麻烦。

    # cat o.rb
    $stdout.sync = true
    (1..10).each do |i|
      $stdout.puts i
      sleep 1
    end
    
    # cat i.rb
    while line = $stdin.gets
      puts line
    end
    

    $ ruby o.rb | ruby i.rb

    也可以用一个 Ruby 进程里,自己开两个管道,一个读一个写,推荐 Eric Wong 的这篇文章: http://blog.rubybestpractices.com/posts/ewong/010-An-introduction-to-the-Unix-pipe.html http://blog.rubybestpractices.com/

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