<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>fsword (淘李福)</title>
    <link>https://ruby-china.org/fsword</link>
    <description>喜欢经济学，愿意保持很土的外表</description>
    <language>en-us</language>
    <item>
      <title>转帖：Kill Your Dependencies</title>
      <description>&lt;p&gt;&lt;a href="https://www.mikeperham.com/2016/02/09/kill-your-dependencies/" rel="nofollow" target="_blank"&gt;https://www.mikeperham.com/2016/02/09/kill-your-dependencies/&lt;/a&gt;&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Rules to Remember

Some software engineering rules:

    No code runs faster than no code.
    No code has fewer bugs than no code.
    No code uses less memory than no code.
    No code is easier to understand than no code.

Kill those dependencies. Your gems and apps will be better for it.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;感觉很有道理，俺觉得 Ruby 社区应该兴起一场简化依赖的运动......&lt;/p&gt;</description>
      <author>fsword</author>
      <pubDate>Tue, 05 Apr 2016 14:02:02 +0800</pubDate>
      <link>https://ruby-china.org/topics/29543</link>
      <guid>https://ruby-china.org/topics/29543</guid>
    </item>
    <item>
      <title>Reddit 上的 Ruby 程序员 monad 入门</title>
      <description>&lt;p&gt;简洁有力，比什么“自函子范畴上的一个幺半群”的说法实用多了&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.reddit.com/r/ruby/comments/448b62/teaching_monads_to_rubyists_without_analogies/" rel="nofollow" target="_blank"&gt;https://www.reddit.com/r/ruby/comments/448b62/teaching_monads_to_rubyists_without_analogies/&lt;/a&gt;&lt;/p&gt;</description>
      <author>fsword</author>
      <pubDate>Fri, 05 Feb 2016 13:21:49 +0800</pubDate>
      <link>https://ruby-china.org/topics/28958</link>
      <guid>https://ruby-china.org/topics/28958</guid>
    </item>
    <item>
      <title>为什么 Ruby 程序员应该了解和掌握 Docker</title>
      <description>&lt;h2 id="为什么Ruby程序员应该了解和掌握Docker"&gt;为什么 Ruby 程序员应该了解和掌握 Docker&lt;/h2&gt;
&lt;p&gt;Docker 技术在 ruby 社区是有影响力的，我所知道的一些创业团队很早就在运用它来解决环境管理、持续集成以及部署的问题了。但是，也有一些同学尚未注意到这个技术，或者了解过后认为它不是很重要，所以我想讨论一下 Docker 对 Ruby 系技术的帮助。&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;有的人可能对 Docker 技术不太了解，不妨参考论坛里的&lt;a href="https://ruby-china.org/topics/22004" title=""&gt;这篇文章&lt;/a&gt;以及肖德时写的&lt;a href="http://www.infoq.com/cn/articles/docker-core-technology-preview" rel="nofollow" target="_blank" title=""&gt;系列文章&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id="Docker 与 Vagrant"&gt;Docker 与 Vagrant&lt;/h2&gt;
&lt;p&gt;我一直很喜欢 Vagrant 这个工具，两三年前就用它来进行自己项目的环境维护，那时候主要是做测试，由于 Vagrant 将操作系统环境进行了标准化，我很容易就能让自己的应用系统以及相关的测试结果保持稳定。&lt;/p&gt;

&lt;p&gt;Vagrant 还有一个好处，Ruby 社区比较偏爱 Mac，但是线上的系统基本都是 Linux，所以开发环境所做的测试是有疑问的，特别是遇到一些有 so 依赖的 gem，这时一个和线上完全一样的环境就特别重要。&lt;/p&gt;

&lt;p&gt;其实上面的表述不太准确，vagrant 也有各种 provider，我所说的场景，基本上都是 virtualbox 的 provider，所以这些地方正确的说法是 vagrant/virtualbox。&lt;/p&gt;

&lt;p&gt;和 Docker 相比，vagrant/virtualbox 组合的成本还是很高的，无论是 setup 一个环境还是 reset 一个环境，都需要一段时间的等待，vagrant 只是把 virtualbox 的操作 DSL 了而已，底层的做法没有变化。而 Docker 由于本质上就是一个进程，因此天生就是轻量级的。对于运行时间在分钟级别的自动化测试工作，docker 显然有很大的优势。&lt;/p&gt;

&lt;p&gt;当然，也有人会认为 docker 不能模拟完整的操作系统，不过这恐怕是一个优点而不是缺点。我在&lt;a href="http://www.jianshu.com/p/a75ddf6915e0" rel="nofollow" target="_blank" title=""&gt;以前的文章&lt;/a&gt;中已经说过了，这里概述一下主要观点——&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;docker 简化了操作系统这个基础设施，让应用精简为其最核心的形态——携带有限资源的进程，在此基础上更有利于架构上的最佳实践&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;而对 Ruby 工程师而言，这个“最佳实践”中肯定少不了的一条就是——&lt;code&gt;微服务&lt;/code&gt;&lt;/p&gt;
&lt;h2 id="微服务"&gt;微服务&lt;/h2&gt;
&lt;p&gt;Ruby 工程师中有很多就是 Rails 工程师，而 Rails 实际上更倾向于单体架构，因此后来社区的工程师们才需要在实际工作中总结&lt;code&gt;1 to 30&lt;/code&gt;这样的实践。&lt;/p&gt;

&lt;p&gt;其实微服务本身不是个教条，即使没有人教，我们也常常自发的去进行服务化改造，但是这个工作并不容易，主要是会受到一些问题的掣肘，比如运维复杂度和系统测试成本会大幅度上升等等。&lt;/p&gt;

&lt;p&gt;处理这些困难，首先当然是看是否必要，一些简单场景我们也可以用单体架构直接搞定，但是我们很容易会注意到，这两年大家越来越多的提到了微服务或者服务化，这背后其实是有趋势的——各种业务形态都在朝着互联网级的用户规模推进，同时大家都在努力从每一个用户的各种维度上挖掘价值（这导致了大数据的需求），这些场景变得越来越常见，单体架构是难以支持的。&lt;/p&gt;

&lt;p&gt;既然微服务或者服务化不可避免，那么就要有相应的对策，虽然 Ruby 社区也有很多人在不同问题点上针对微服务进行改进（比如完善异步化框架，以及对服务协议的探索等），但是在基础设施层面，Docker 是最重要的武器，没有之一！&lt;/p&gt;

&lt;p&gt;对 Ruby 工程师来说，Docker 能做两件事：约束边界和建立通用基础服务。&lt;/p&gt;
&lt;h3 id="约束服务边界"&gt;约束服务边界&lt;/h3&gt;
&lt;p&gt;Ruby 项目 Docker 化，并不是简单换个虚拟机那么简单，我们会面对拆分的压力，相信很多人尝试用 Dockerfile 来描述自己的项目的时候都会觉得束手束脚，但这些地方其实是促使我们想清楚——这个应用到底要做什么？它和外界是什么关系？对于外界的变化它如何响应？失败后怎样恢复？&lt;/p&gt;

&lt;p&gt;这类的问题对系统架构非常重要。比如应用到底要做什么，这是让工程师去思考系统的目标，无论是提供 web 服务，管理调度后台任务，还是提供实时分析，它们都应该有一个尽可能单一的目标，在这个基础之上，我们建立的服务才有可能是易测试、易扩展和易维护的。&lt;/p&gt;

&lt;p&gt;其它问题也类似，这些地方以前如果没有留意，很可能不是没问题，而是没意识到，使用 Docker 有助于我们意识到这些问题。&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;另外补充一点，由于 Ruby 项目不能完全脱离动态库依赖（java 大都可以），本身的打包机制又没有自包含结构（gem+bundle 不包括动态库，相比之下，Golang 是静态联编的），在分布式环境中的交付和软件包分发其实是有着先天不足的，Docker 的 Image 恰好补上了这一块，简直是睡觉时候有人送枕头了。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3 id="建立通用基础服务"&gt;建立通用基础服务&lt;/h3&gt;
&lt;p&gt;当我们将应用系统分裂为各种服务并明确其边界以后，就出现了“分久必合”的问题，这很自然，服务化改造并不是各行其是，应用之间还是要协作，而对应用的运维——服务发现、水平扩展、容错等等——都需要基础设施的支持。&lt;/p&gt;

&lt;p&gt;以前，对于这种运维基础设施，各公司甚至同一个公司的各个团队的做法都千差万别，
但是借助 Docker 以及周边的生态圈，我们可以很容易的得到通用的服务发现框架，享受自动的部署和弹性扩展。&lt;/p&gt;

&lt;p&gt;更好的消息是，这些基础服务是通用的——不但不关心是 rails 还是 sinatra，甚至根本不关心是不是 ruby。&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;这也很好理解，Docker 是对进程这个操作系统工作单元进行了简化约束，而进程的概念本来就是与语言和框架无关的&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;这使得 Ruby 工程师以及 Ruby 项目可以更为自由的选择合适的技术去扩展公司的产品线。&lt;/p&gt;
&lt;h2 id="延伸技术框架"&gt;延伸技术框架&lt;/h2&gt;
&lt;p&gt;Ruby 刚出来的时候，有很多来自 Java 社区的工程师加入其中（我也算是其中之一吧），很多人最大的感受是——视野被打开了。曾经象口号一样的“all in java”变成了落后的标志，大家意识到，一把钥匙开一把锁，用最合适的技术针对性的解决问题才是聪明的做法，单纯排斥某种技术或者语言框架并不明智。&lt;/p&gt;

&lt;p&gt;这个道理在 Ruby/RoR 应用开发中也不例外，但是不少人在使用了几年 ruby 以后都会遇到一个问题——“ruby 确实很适合开发 Web，但是现在有些问题需要使用 XX 技术，而我们的系统严重依赖 ruby 环境，这该怎么办呢？”&lt;/p&gt;

&lt;p&gt;我认为问题就出在“系统严重依赖 ruby 环境”上，研发的基础设施，比如配管、自动化测试、打包、部署，不应该仅满足一种技术或是语言，它一开始就要考虑到通用性，否则我们就只能“手里拿着锤子，看谁都像钉子”。&lt;/p&gt;

&lt;p&gt;Docker 本身和语言无关，它唯一的约束大概就是要运行在 Linux 上，这个对互联网服务端系统来说也算是标准了，问题不大。所以，我们应该以 Docker 为核心打造研发的基础设施，这将是未来的一笔重要投资。&lt;/p&gt;

&lt;p&gt;当然，为未来画饼是危险的，不过还好，Docker 领域的创业很活跃，有很多团队和公司已经做了相当多的基础工作，对于 Ruby 工程师和 Ruby 创业团队，去用现成的基础设施其实更方便。&lt;/p&gt;</description>
      <author>fsword</author>
      <pubDate>Fri, 27 Nov 2015 02:02:36 +0800</pubDate>
      <link>https://ruby-china.org/topics/28209</link>
      <guid>https://ruby-china.org/topics/28209</guid>
    </item>
    <item>
      <title>北京本周有聚会吗？</title>
      <description>&lt;p&gt;21 号要去北京几天，不想浪费难得的外出机会，不知道北京的 rubyist 有没有活动？25 号之前的晚上我应该都有空&lt;/p&gt;</description>
      <author>fsword</author>
      <pubDate>Mon, 19 Oct 2015 23:30:55 +0800</pubDate>
      <link>https://ruby-china.org/topics/27739</link>
      <guid>https://ruby-china.org/topics/27739</guid>
    </item>
    <item>
      <title>现在有公司要远程工作的员工么？</title>
      <description>&lt;p&gt;刚才看到有公司招聘，号称是弹性工作，于是突然想问一下。&lt;/p&gt;

&lt;p&gt;也可以说说自己公司 remote 办公的情况，反正我是放到了瞎扯淡节点下了&lt;/p&gt;

&lt;p&gt;感谢 &lt;a href="#reply28" class="at_floor" data-floor="28"&gt;#28 楼&lt;/a&gt; &lt;a href="/huobazi" class="user-mention" title="@huobazi"&gt;&lt;i&gt;@&lt;/i&gt;huobazi&lt;/a&gt;  ，补充一下这个 list： &lt;a href="https://github.com/jessicard/remote-jobs" rel="nofollow" target="_blank"&gt;https://github.com/jessicard/remote-jobs&lt;/a&gt;&lt;/p&gt;</description>
      <author>fsword</author>
      <pubDate>Sat, 10 Oct 2015 02:40:50 +0800</pubDate>
      <link>https://ruby-china.org/topics/27614</link>
      <guid>https://ruby-china.org/topics/27614</guid>
    </item>
    <item>
      <title>RubyConf China slides -《持续集成和云》</title>
      <description>&lt;p&gt;slides 是用 deck.js 的，已经放上网了 &lt;a href="http://fsword.github.io/slide/devops_on_cloud" rel="nofollow" target="_blank"&gt;http://fsword.github.io/slide/devops_on_cloud&lt;/a&gt;&lt;/p&gt;</description>
      <author>fsword</author>
      <pubDate>Mon, 03 Nov 2014 14:44:36 +0800</pubDate>
      <link>https://ruby-china.org/topics/22430</link>
      <guid>https://ruby-china.org/topics/22430</guid>
    </item>
    <item>
      <title>larrow 发布 0.0.3，顺便请教一个问题</title>
      <description>&lt;p&gt;release note:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;clean dependency: remove &lt;code&gt;active_support&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;open verbose mode on tests&lt;/li&gt;
&lt;li&gt;delete resource file when cleanup&lt;/li&gt;
&lt;li&gt;ensure node start( use &lt;code&gt;nmap&lt;/code&gt; to detect)&lt;/li&gt;
&lt;li&gt;use larrow-qingcloud v0.0.2&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;顺便问一个问题，我在某些目录下执行 larrow 遇到了如下的现象：&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;~/projects/github/easycmd/essh(master)[2.1.3]
$ larrow
Could not find proper version of larrow-runner (0.0.1) in any of the sources
Run `bundle install` to install missing gems.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;但是这里安装的是 0.0.3 这个版本，我经过查找，发现&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ which larrow 
/home/john/.rvm/gems/ruby-2.1.3/bin/larrow
~/projects/github/easycmd/essh(master)[2.1.3]
$ cat /home/john/.rvm/gems/ruby-2.1.3/bin/larrow | head -n 1
#!/usr/bin/env ruby_executable_hooks
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;如果把这个 shebang 设定改为 &lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="c1"&gt;#!/usr/bin/env ruby&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;就没问题了。&lt;/p&gt;

&lt;p&gt;似乎是 executable-hooks 这个 gem 的问题，但是涉及到 gem 插件，这块我不太懂，有人处理过类似的情况么？&lt;/p&gt;</description>
      <author>fsword</author>
      <pubDate>Sun, 02 Nov 2014 08:52:38 +0800</pubDate>
      <link>https://ruby-china.org/topics/22407</link>
      <guid>https://ruby-china.org/topics/22407</guid>
    </item>
    <item>
      <title>这是 gem 包依赖写错误了吗？</title>
      <description>&lt;p&gt;刚把 larrow-runn 升级到 0.0.2，结果自己测试一下发现有错误：&lt;/p&gt;

&lt;p&gt;$ larrow
Could not find proper version of larrow-runner (0.0.1) in any of the sources&lt;/p&gt;

&lt;p&gt;这个意思是什么啊，为什么会找 larrow-runner 0.0.1 版呢？&lt;/p&gt;</description>
      <author>fsword</author>
      <pubDate>Mon, 20 Oct 2014 11:04:32 +0800</pubDate>
      <link>https://ruby-china.org/topics/22130</link>
      <guid>https://ruby-china.org/topics/22130</guid>
    </item>
    <item>
      <title>发布一个工具</title>
      <description>&lt;p&gt;源码在这里： &lt;a href="https://github.com/fsword/larrow-runner/" rel="nofollow" target="_blank"&gt;https://github.com/fsword/larrow-runner/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;gem 在这里： &lt;a href="http://rubygems.org/gems/larrow-runner" rel="nofollow" target="_blank"&gt;http://rubygems.org/gems/larrow-runner&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;不擅长写文档，为了配合 README，做了视频大家凑合着看&lt;/p&gt;

&lt;p&gt;&lt;span class="embed-responsive embed-responsive-16by9"&gt;&lt;iframe class="embed-responsive-item" src="//player.youku.com/embed/XODAzNzgyMjUy" allowfullscreen=""&gt;&lt;/iframe&gt;&lt;/span&gt;
&lt;span class="embed-responsive embed-responsive-16by9"&gt;&lt;iframe class="embed-responsive-item" src="//player.youku.com/embed/XODAzNzgxOTky" allowfullscreen=""&gt;&lt;/iframe&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;写这个东西花了很多精力，当然不纯粹是为了好玩，目前先放出来，也是方便在 rubyconfchian 活动上和大家交流&lt;/p&gt;</description>
      <author>fsword</author>
      <pubDate>Thu, 16 Oct 2014 22:31:08 +0800</pubDate>
      <link>https://ruby-china.org/topics/22081</link>
      <guid>https://ruby-china.org/topics/22081</guid>
    </item>
    <item>
      <title>Elixir 有了长足的发展啊</title>
      <description>&lt;ul&gt;
&lt;li&gt;mix 工具现在越来越像 elixir 的 gem、bundle ...... 了&lt;/li&gt;
&lt;li&gt;出现了类似 rubygems.org 的包管理服务 —— hex&lt;/li&gt;
&lt;li&gt;OTP 风格的代码重复问题，已经有人做了 &lt;a href="https://github.com/sasa1977/exactor" rel="nofollow" target="_blank" title=""&gt;这个&lt;/a&gt; 项目，用宏的方式来简化&lt;/li&gt;
&lt;li&gt;甚至还出现了一个类似 railscast 的网站 —— &lt;a href="http://elixirsips.com" rel="nofollow" target="_blank"&gt;http://elixirsips.com&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="/yukihiro_matz" class="user-mention" title="@yukihiro_matz"&gt;&lt;i&gt;@&lt;/i&gt;yukihiro_matz&lt;/a&gt; 补充&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;类似 rack 的 plug &lt;/li&gt;
&lt;li&gt;web framework - phoenix&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;欢迎继续补充&lt;/p&gt;</description>
      <author>fsword</author>
      <pubDate>Sat, 16 Aug 2014 03:06:58 +0800</pubDate>
      <link>https://ruby-china.org/topics/21049</link>
      <guid>https://ruby-china.org/topics/21049</guid>
    </item>
    <item>
      <title>RSpec 疑问： 为什么这里的 subject 不是最近的那个类呢？</title>
      <description>&lt;p&gt;源码如下：&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cat spec/nested_subject_spec.rb 
class ArrayWithOneElement &amp;lt; Array
  def initialize(*)
    super
    unshift "first element"
  end
end

describe Array do
  describe ArrayWithOneElement do
    context "referenced as subject" do
      it "contains one element" do
        expect(subject).to include("first element")
      end
    end
  end
end
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;下面是执行结果：&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ rspec spec/nested_subject_spec.rb 
F

Failures:

  1) Array ArrayWithOneElement referenced as subject contains one element
     Failure/Error: expect(subject).to include("first element")
       expected [] to include "first element"
     # ./spec/nested_subject_spec.rb:12:in `block (4 levels) in &amp;lt;top (required)&amp;gt;'

Finished in 0.00099 seconds
1 example, 1 failure

Failed examples:

rspec ./spec/nested_subject_spec.rb:11 # Array ArrayWithOneElement referenced as subject contains one element
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;官方网站上也说应该是 pass 的，但我执行就 fail 了，不得其解&lt;/p&gt;</description>
      <author>fsword</author>
      <pubDate>Thu, 03 Jul 2014 13:35:40 +0800</pubDate>
      <link>https://ruby-china.org/topics/20296</link>
      <guid>https://ruby-china.org/topics/20296</guid>
    </item>
    <item>
      <title>sinatra-synchrony is obsolete 了？</title>
      <description>&lt;p&gt;最近没有关注，刚刚发现这个——&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;NOTICE: sinatra-synchrony is obsolete.
This gem should not be considered for a new application. It is better to use threads with Ruby, rather than EventMachine. It also tends to break when new releases of ruby come out, and EM itself is not maintained very well and has some pretty fundamental problems.

I will not be maintaining this gem anymore. If anyone is interested in maintaining it, feel free to inquire, but I recommend not using EventMachine or sinatra-synchrony anymore.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;作者为什么说 &lt;code&gt;It is better to use threads with Ruby ？&lt;/code&gt;&lt;/p&gt;</description>
      <author>fsword</author>
      <pubDate>Mon, 23 Dec 2013 16:03:40 +0800</pubDate>
      <link>https://ruby-china.org/topics/16378</link>
      <guid>https://ruby-china.org/topics/16378</guid>
    </item>
    <item>
      <title>建议使用来往</title>
      <description>&lt;p&gt;作为阿里人，一开始不太好意思推销自家东西，不过今天没有微信群感觉很不利于互动，所以还是建议大家先用来往交流吧，我确认过，来往的群上限是 1000 人&lt;/p&gt;

&lt;p&gt;会场中 wifi 信号不好，提醒一下大家在家装好来往，那样明天就好交流了&lt;/p&gt;

&lt;p&gt;&lt;img src="//l.ruby-china.com/photo/4ebfc7baed2845542ba609c0e41d1658.png" title="" alt=""&gt;&lt;/p&gt;</description>
      <author>fsword</author>
      <pubDate>Sat, 26 Oct 2013 23:17:56 +0800</pubDate>
      <link>https://ruby-china.org/topics/15056</link>
      <guid>https://ruby-china.org/topics/15056</guid>
    </item>
    <item>
      <title>阿里员工来往二维码</title>
      <description>&lt;p&gt;建议阿里的同学把自己的来往二维码都发出来，直说了吧，没好友就没红包，请论坛里的朋友们看心情帮忙。&lt;/p&gt;

&lt;p&gt;非阿里系的同学们，这是一次机会，你可以通过来往认识一些阿里员工，不过这种推广方式很弱智，所以估计过段时间有可能很多人（包括我在内）不再使用来往，这一点要预先说明&lt;/p&gt;

&lt;p&gt;这是我的二维码——
&lt;img src="//l.ruby-china.com/photo/225443da02afda89a73e3c8309e04cb5.jpg" title="" alt=""&gt;&lt;/p&gt;</description>
      <author>fsword</author>
      <pubDate>Mon, 21 Oct 2013 11:45:10 +0800</pubDate>
      <link>https://ruby-china.org/topics/14901</link>
      <guid>https://ruby-china.org/topics/14901</guid>
    </item>
    <item>
      <title>单测与持续集成 3-erlang 例子</title>
      <description>&lt;p&gt;我应该算是深度拖延症吧，这篇拖了好久
 &lt;a href="http://fsword.github.io/blog/2013/07/22/dan-ce-yu-chi-xu-ji-cheng-3-erlangli-zi/" rel="nofollow" target="_blank"&gt;http://fsword.github.io/blog/2013/07/22/dan-ce-yu-chi-xu-ji-cheng-3-erlangli-zi/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;转发过来其实是想看看有没有人在做 erlang 项目时有同感&lt;/p&gt;</description>
      <author>fsword</author>
      <pubDate>Tue, 27 Aug 2013 22:55:56 +0800</pubDate>
      <link>https://ruby-china.org/topics/13681</link>
      <guid>https://ruby-china.org/topics/13681</guid>
    </item>
    <item>
      <title>大家平时习惯怎么使用属性？</title>
      <description>&lt;p&gt;对于如下属性定义：&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;A&lt;/span&gt;
  &lt;span class="nb"&gt;attr_accessor&lt;/span&gt; &lt;span class="ss"&gt;:x&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;在使用中有两种写法——&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;写法一&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;A&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;hello&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt;
&lt;span class="o"&gt;...&lt;/span&gt;
&lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt;
&lt;span class="o"&gt;...&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;hello2&lt;/span&gt;
&lt;span class="o"&gt;...&lt;/span&gt;
&lt;span class="n"&gt;dosomething&lt;/span&gt; &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;x&lt;/span&gt;
&lt;span class="o"&gt;...&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;写法二&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;A&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;hello&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt;
&lt;span class="o"&gt;...&lt;/span&gt;
&lt;span class="vi"&gt;@x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt;
&lt;span class="o"&gt;...&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;hello2&lt;/span&gt;
&lt;span class="o"&gt;...&lt;/span&gt;
&lt;span class="n"&gt;dosomething&lt;/span&gt; &lt;span class="vi"&gt;@x&lt;/span&gt;
&lt;span class="o"&gt;...&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;后者更短些，但是依赖了 attr_accessor 的实现，大家一般倾向于怎么写？&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;</description>
      <author>fsword</author>
      <pubDate>Fri, 19 Jul 2013 10:03:17 +0800</pubDate>
      <link>https://ruby-china.org/topics/12603</link>
      <guid>https://ruby-china.org/topics/12603</guid>
    </item>
    <item>
      <title>奇怪，在 console 里试验明明没问题，但是到了 rspec 中用例却失败了</title>
      <description>&lt;p&gt;commit 如下，有人能帮忙看看不？ &lt;a href="https://github.com/fsword/gitlabhq/commit/387d8c4b9dcd8392cc6a5c058dfb34ab4111799e" rel="nofollow" target="_blank"&gt;https://github.com/fsword/gitlabhq/commit/387d8c4b9dcd8392cc6a5c058dfb34ab4111799e&lt;/a&gt;&lt;/p&gt;</description>
      <author>fsword</author>
      <pubDate>Wed, 17 Jul 2013 13:15:58 +0800</pubDate>
      <link>https://ruby-china.org/topics/12564</link>
      <guid>https://ruby-china.org/topics/12564</guid>
    </item>
    <item>
      <title>Active Record 怎么做带参数的 insert</title>
      <description>&lt;p&gt;批量将数据转移到历史表，需要用 raw 的方式，但是我一直没搞定如何 execute，目前的做法是这样的：&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;dd&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;Product&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;first&lt;/span&gt; &lt;span class="c1"&gt;# 示例，将要转移的数据&lt;/span&gt;
&lt;span class="n"&gt;attrs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;dd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;attributes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;keys&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="s2"&gt;"`&lt;/span&gt;&lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`"&lt;/span&gt;&lt;span class="p"&gt;}.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt; &lt;span class="s1"&gt;','&lt;/span&gt;

&lt;span class="no"&gt;ActiveRecord&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;Base&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;connection&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"insert into `history_products`(&lt;/span&gt;&lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="n"&gt;attrs&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;attributes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;values&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;然后报错——”Mysql2::Error: You have an error in your SQL syntax“&lt;/p&gt;

&lt;p&gt;而不用动态参数的话是没有问题的&lt;/p&gt;</description>
      <author>fsword</author>
      <pubDate>Thu, 30 May 2013 21:19:58 +0800</pubDate>
      <link>https://ruby-china.org/topics/11358</link>
      <guid>https://ruby-china.org/topics/11358</guid>
    </item>
    <item>
      <title>求助：ffmpeg 或者类似软件如何做视频压缩</title>
      <description>&lt;p&gt;上周六的录像效果还不错，不过我拿到的是原始文件，大约 30G，不方便传出去编辑，按说应该压缩一下以后再传播，估计 ffmpeg 可以，但是我不会捣鼓那些参数，有人知道怎么做吗？，我的环境是 linux&lt;/p&gt;</description>
      <author>fsword</author>
      <pubDate>Tue, 14 May 2013 23:11:55 +0800</pubDate>
      <link>https://ruby-china.org/topics/10987</link>
      <guid>https://ruby-china.org/topics/10987</guid>
    </item>
    <item>
      <title>[杭州][2013年5月16日] Ruby Tuesday 活动召集 - 朴灵讲 nodejs</title>
      <description>&lt;p&gt;&lt;strong&gt;本次 Ruby Tuesday 不是在周二，是在周四，请各位注意&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;时间：2013-5-16 星期四 19:00 - 20:30&lt;/li&gt;
&lt;li&gt;主题：Node.js 分享&lt;/li&gt;
&lt;li&gt;地点：西湖国际科技大厦 B 楼 2 楼飞来峰&lt;/li&gt;
&lt;li&gt;主讲：朴灵 &lt;a href="https://github.com/JacksonTian" rel="nofollow" target="_blank"&gt;https://github.com/JacksonTian&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src="//l.ruby-china.com/photo/970f60f94c8fc66265ac8795cb21b852.png" title="" alt=""&gt;&lt;/p&gt;

&lt;p&gt;大家可以从文二路的入口进入，如果不熟悉，可以找一个阿里系的同学带路，也可以和我联系（&lt;code&gt;13685751275&lt;/code&gt;)&lt;/p&gt;

&lt;p&gt;Ruby 社区向来热心接纳各种新技术，之前我们也曾经沟通过一些 Node.js 的知识，但是朴灵所在的团队在过去很长时间里一直在用 Node.js，我们这次专门请他来做一些分享，和这个领域的高手交流交流&lt;/p&gt;

&lt;p&gt;考虑到一些了解较少的同学，现场可能会介绍一些基本情况，如果你能预先做些 homework，相信会得到更多&lt;/p&gt;</description>
      <author>fsword</author>
      <pubDate>Mon, 13 May 2013 23:01:11 +0800</pubDate>
      <link>https://ruby-china.org/topics/10965</link>
      <guid>https://ruby-china.org/topics/10965</guid>
    </item>
  </channel>
</rss>
