<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>pacingwang (王千一)</title>
    <link>https://ruby-china.org/pacingwang</link>
    <description>我相信天分，更相信努力，专注和坚持才是制胜之道</description>
    <language>en-us</language>
    <item>
      <title>ruby-china 源代码里 user 模型有实例方法：pull 和 push</title>
      <description>&lt;p&gt;如题，请问，这两个方法在哪里定义，还是哪个 gem 的方法？&lt;/p&gt;</description>
      <author>pacingwang</author>
      <pubDate>Mon, 27 May 2013 21:25:42 +0800</pubDate>
      <link>https://ruby-china.org/topics/11273</link>
      <guid>https://ruby-china.org/topics/11273</guid>
    </item>
    <item>
      <title>在看 cancan 的源代码，测试里面有点东西看不懂</title>
      <description>&lt;p&gt;代码在这里&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="nb"&gt;require&lt;/span&gt; &lt;span class="s1"&gt;'rubygems/test_case'&lt;/span&gt;
&lt;span class="nb"&gt;require&lt;/span&gt; &lt;span class="s1"&gt;'rubygems'&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;TestConfig&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="no"&gt;Gem&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;TestCase&lt;/span&gt;

  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;test_datadir&lt;/span&gt;
    &lt;span class="n"&gt;_&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;capture_io&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
      &lt;span class="n"&gt;datadir&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;RbConfig&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;CONFIG&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'datadir'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
      &lt;span class="n"&gt;assert_equal&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="n"&gt;datadir&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/xyz"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;RbConfig&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;datadir&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'xyz'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;end&lt;/span&gt;

    &lt;span class="n"&gt;assert_match&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/deprecate/&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt;&lt;span class="p"&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;问题：
         1    err 之前的 符号（显示不了）是什么意思？
         2    capture_io 之后的 block 是什么作用？&lt;/p&gt;

&lt;p&gt;求助  &lt;/p&gt;</description>
      <author>pacingwang</author>
      <pubDate>Wed, 22 May 2013 13:43:33 +0800</pubDate>
      <link>https://ruby-china.org/topics/11149</link>
      <guid>https://ruby-china.org/topics/11149</guid>
    </item>
    <item>
      <title>Nokogiri 安装提示：unable to convert "\xC0" from ASCII-8BIT to UTF-8</title>
      <description>&lt;p&gt;刚才在安装  nokogiri，遇到了一点问题&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;gem &lt;span class="nb"&gt;install &lt;/span&gt;nokogiri      
提示：unable to convert &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\x&lt;/span&gt;&lt;span class="s2"&gt;C0"&lt;/span&gt; from ASCII-8BIT
to UTF-8 &lt;span class="k"&gt;for &lt;/span&gt;lib/nokogiri/nokogiri.so, skipping  1 gem installed
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;有人遇到过这样的提示吗，求救&lt;/p&gt;</description>
      <author>pacingwang</author>
      <pubDate>Fri, 12 Apr 2013 11:14:24 +0800</pubDate>
      <link>https://ruby-china.org/topics/10128</link>
      <guid>https://ruby-china.org/topics/10128</guid>
    </item>
    <item>
      <title>怎么把爬虫爬到的数据添加到 rails 已有的 model 中</title>
      <description>&lt;p&gt;我的网站已有 Product 模型，请问怎么把爬虫爬到的信息插入到已有 model 对应的
table 里面&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="nb"&gt;require&lt;/span&gt; &lt;span class="s1"&gt;'rubygems'&lt;/span&gt;
&lt;span class="nb"&gt;require&lt;/span&gt; &lt;span class="s1"&gt;'mechanize'&lt;/span&gt;
&lt;span class="nb"&gt;require&lt;/span&gt; &lt;span class="s1"&gt;'activerecord'&lt;/span&gt;

&lt;span class="n"&gt;agent&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"http://rs.xidian.edu.cn/forum.php?mod=forumdisplay&amp;amp;fid=110"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="k"&gt;do&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;page&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;
  &lt;span class="n"&gt;page&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;links_with&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;:dom_class&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;"xst"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;each&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;  &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;link&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;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;:title&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;link&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;text&lt;/span&gt; &lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="ss"&gt;:link&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;link&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;href&lt;/span&gt;&lt;span class="p"&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;之后执行这个文件来把数据添加到表里面
大概是这么个意思，不知道怎么实现，求大神帮忙&lt;/p&gt;</description>
      <author>pacingwang</author>
      <pubDate>Wed, 10 Apr 2013 22:11:16 +0800</pubDate>
      <link>https://ruby-china.org/topics/10078</link>
      <guid>https://ruby-china.org/topics/10078</guid>
    </item>
    <item>
      <title>end.submit</title>
      <description>&lt;p&gt;require 'rubygems'
require 'mechanize'&lt;/p&gt;

&lt;p&gt;a = Mechanize.new { |agent|
  agent.user_agent_alias = 'Mac Safari'
}&lt;/p&gt;

&lt;p&gt;a.get('&lt;a href="http://google.com/" rel="nofollow" target="_blank"&gt;http://google.com/&lt;/a&gt;') do |page|
  search_result = page.form_with(:name =&amp;gt; 'f') do |search|
    search.q = 'Hello world'
  end.submit&lt;/p&gt;

&lt;p&gt;search_result.links.each do |link|
    puts link.text 
    puts link.page
  end
end&lt;/p&gt;

&lt;p&gt;do ... end.submit  是什么语法&lt;/p&gt;</description>
      <author>pacingwang</author>
      <pubDate>Wed, 10 Apr 2013 00:01:23 +0800</pubDate>
      <link>https://ruby-china.org/topics/10056</link>
      <guid>https://ruby-china.org/topics/10056</guid>
    </item>
    <item>
      <title>rails  源代码</title>
      <description>&lt;p&gt;require File.expand_path('../../../load_paths', &lt;strong&gt;FILE&lt;/strong&gt;)&lt;/p&gt;

&lt;p&gt;$:.unshift(File.dirname(&lt;strong&gt;FILE&lt;/strong&gt;) + '/lib')
     $:.unshift(File.dirname(&lt;strong&gt;FILE&lt;/strong&gt;) + '/fixtures/helpers')
     $:.unshift(File.dirname(&lt;strong&gt;FILE&lt;/strong&gt;) + '/fixtures/alternate_helpers')
     $:是什么东西？&lt;/p&gt;</description>
      <author>pacingwang</author>
      <pubDate>Sat, 23 Mar 2013 19:15:58 +0800</pubDate>
      <link>https://ruby-china.org/topics/9700</link>
      <guid>https://ruby-china.org/topics/9700</guid>
    </item>
    <item>
      <title>出来透透气</title>
      <description>&lt;p&gt;在论坛里快半年了，一直在潜伏。哈哈，今天出来透透气。
      在看了英文版 ruby 元编程两个月后，今天又把同学新买的中文版元编程看完了一边，打算开始看 ruby 项目的源代码，提高自己的 ruby 实力。
      初步打算是先看几个小型库，等消化一点后，再看看 rails，rake 之类的源代码。
      大家有什么小型库介绍一下吧，拜谢&lt;/p&gt;</description>
      <author>pacingwang</author>
      <pubDate>Fri, 22 Mar 2013 22:14:21 +0800</pubDate>
      <link>https://ruby-china.org/topics/9688</link>
      <guid>https://ruby-china.org/topics/9688</guid>
    </item>
    <item>
      <title>西安有什么地方招 ruby 的实习吗</title>
      <description>&lt;p&gt;碰碰运气&lt;/p&gt;</description>
      <author>pacingwang</author>
      <pubDate>Fri, 23 Nov 2012 22:28:40 +0800</pubDate>
      <link>https://ruby-china.org/topics/7052</link>
      <guid>https://ruby-china.org/topics/7052</guid>
    </item>
    <item>
      <title>Ruby on Rails 有什么控件可以实现博客里面编辑文章的功能</title>
      <description>&lt;p&gt;如题，我想用 ROR 做一个博客，可是不知到怎么实现文本编辑功能&lt;/p&gt;</description>
      <author>pacingwang</author>
      <pubDate>Thu, 27 Sep 2012 23:02:02 +0800</pubDate>
      <link>https://ruby-china.org/topics/5791</link>
      <guid>https://ruby-china.org/topics/5791</guid>
    </item>
  </channel>
</rss>
