<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>secondrocker (二手摇滚迷)</title>
    <link>https://ruby-china.org/secondrocker</link>
    <description></description>
    <language>en-us</language>
    <item>
      <title>ruby-china 更多精华帖 分页 错了</title>
      <description>&lt;p&gt;&lt;img src="photo/.jpg" title="" alt=""&gt;
&lt;a href="https://ruby-china.org/topics/excellent?page=99" title=""&gt;https://ruby-china.org/topics/excellent?page=99&lt;/a&gt;&lt;/p&gt;</description>
      <author>secondrocker</author>
      <pubDate>Thu, 10 Sep 2015 17:51:53 +0800</pubDate>
      <link>https://ruby-china.org/topics/27273</link>
      <guid>https://ruby-china.org/topics/27273</guid>
    </item>
    <item>
      <title>Object 定义的方法求解答</title>
      <description>&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Object&lt;/span&gt;
  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;do_it&lt;/span&gt;
    &lt;span class="nb"&gt;puts&lt;/span&gt; &lt;span class="s2"&gt;"do it"&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;

&lt;span class="no"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;do_it&lt;/span&gt; &lt;span class="c1"&gt;#这个class method 怎么来的？&lt;/span&gt;
&lt;span class="no"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;do_it&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;大神给解答下 Object.do_it 怎么来的？&lt;/p&gt;</description>
      <author>secondrocker</author>
      <pubDate>Fri, 19 Dec 2014 13:42:59 +0800</pubDate>
      <link>https://ruby-china.org/topics/23283</link>
      <guid>https://ruby-china.org/topics/23283</guid>
    </item>
    <item>
      <title>大神帮看看这个插入排序有什么问题</title>
      <description>&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;insertSort&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;left&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[],&lt;/span&gt;&lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;left&lt;/span&gt; &lt;span class="k"&gt;unless&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;pop&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;left&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;each_with_index&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;l&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;l&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;
            &lt;span class="n"&gt;left&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;insert&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;insertSort&lt;/span&gt; &lt;span class="n"&gt;left&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;arr&lt;/span&gt;
        &lt;span class="k"&gt;end&lt;/span&gt;
    &lt;span class="k"&gt;end&lt;/span&gt;
    &lt;span class="n"&gt;left&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;insertSort&lt;/span&gt; &lt;span class="n"&gt;left&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;arr&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt;
&lt;span class="n"&gt;arrE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;..&lt;/span&gt;&lt;span class="mi"&gt;10000&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;to_a&lt;/span&gt;
&lt;span class="mi"&gt;10000&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;times&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;t&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;
    &lt;span class="n"&gt;tmp&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;rand&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;arrE&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;count&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;arrE&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;delete_at&lt;/span&gt; &lt;span class="n"&gt;tmp&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="nb"&gt;puts&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;insertSort&lt;/span&gt; &lt;span class="n"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;数组数量小于 900 没问题，大于 900 就会报
 stack level too deep (SystemStackError)
大神帮看看什么问题&lt;/p&gt;</description>
      <author>secondrocker</author>
      <pubDate>Tue, 15 Apr 2014 17:59:01 +0800</pubDate>
      <link>https://ruby-china.org/topics/18621</link>
      <guid>https://ruby-china.org/topics/18621</guid>
    </item>
    <item>
      <title>ruby 占位符问题</title>
      <description>&lt;p&gt;ruby 中字符串有没有这种风格的占位符，或者类似的，即声明 "name:{0},age:{1}"字符串时只指定占位符没有内容&lt;/p&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="n"&gt;String&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;format&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"name:{0},age:{1}"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="s"&gt;"sx"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="m"&gt;23&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;</description>
      <author>secondrocker</author>
      <pubDate>Fri, 03 Jan 2014 09:13:52 +0800</pubDate>
      <link>https://ruby-china.org/topics/16588</link>
      <guid>https://ruby-china.org/topics/16588</guid>
    </item>
    <item>
      <title>旅程</title>
      <description>&lt;p&gt;&lt;img src="//l.ruby-china.com/photo/9ca9befc1dec7ebd20661b3935108666.jpg" title="" alt=""&gt;&lt;/p&gt;</description>
      <author>secondrocker</author>
      <pubDate>Sun, 24 Mar 2013 15:37:41 +0800</pubDate>
      <link>https://ruby-china.org/topics/9716</link>
      <guid>https://ruby-china.org/topics/9716</guid>
    </item>
    <item>
      <title>has_many 求助</title>
      <description>&lt;p&gt;各位大神，我有两个 model，分别是 user 和 card，通过一个中间 model     carding 相互 has_many，其中中间 model 记录了一个字段，叫做 start_date，那么我怎么访问某个 user 的某个 card 的 start_date 呢？&lt;/p&gt;</description>
      <author>secondrocker</author>
      <pubDate>Sat, 09 Mar 2013 15:35:10 +0800</pubDate>
      <link>https://ruby-china.org/topics/9276</link>
      <guid>https://ruby-china.org/topics/9276</guid>
    </item>
    <item>
      <title>遍历数组内对象的属性，有什么好的方法？</title>
      <description>&lt;p&gt;tagnames=[]
list.tags.each{|t| tagnames.push(t.name) }&lt;br&gt;
tagnames.join(',')&lt;/p&gt;

&lt;p&gt;我是这么做的，看着真不舒服...
有什么更简便的，牛 X 的方法木有？&lt;/p&gt;</description>
      <author>secondrocker</author>
      <pubDate>Sat, 27 Oct 2012 00:20:33 +0800</pubDate>
      <link>https://ruby-china.org/topics/6352</link>
      <guid>https://ruby-china.org/topics/6352</guid>
    </item>
    <item>
      <title>新手求助 怎么保存 html 代码到数据库</title>
      <description>&lt;p&gt;使用 kindeditor，按照说明，别的没问题，但保存时保存不了，
log 日志如下&lt;/p&gt;

&lt;p&gt;tarted POST "/articles" for 127.0.0.1 at 2012-10-25 22:36:27 +0800
Processing by ArticlesController#create as HTML
  Parameters: {"utf8"=&amp;gt;"✓", "authenticity_token"=&amp;gt;"2sr+RFvJbtF19DnMkKMNieOjaIY6Mq+Hg3TvpBraBUw=", "article"=&amp;gt;{"title"=&amp;gt;"Dream undead,keep on fighting"}, "content"=&amp;gt;"&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;千古路不转，后顾路也不转，什么玩意 思密达 所覆盖忽然他孙刚峰二个热人多高的贵的跌入谷底如果打工的人他如果热贴个", "commit"=&amp;gt;"Create Article"}
   (0.2ms)  BEGIN
  SQL (3.3ms)  INSERT INTO &lt;code&gt;articles&lt;/code&gt; (&lt;code&gt;content&lt;/code&gt;, &lt;code&gt;created_at&lt;/code&gt;, &lt;code&gt;title&lt;/code&gt;, &lt;code&gt;updated_at&lt;/code&gt;, &lt;code&gt;user_id&lt;/code&gt;) VALUES (NULL, '2012-10-25 14:36:27', 'Dream undead,keep on fighting', '2012-10-25 14:36:27', NULL)
   (1.3ms)  COMMIT
Redirected to &lt;a href="http://0.0.0.0:3000/articles/1" rel="nofollow" target="_blank"&gt;http://0.0.0.0:3000/articles/1&lt;/a&gt;
Completed 302 Found in 47ms (ActiveRecord: 4.7ms)&lt;/p&gt;

&lt;p&gt;rails 的版本时 3.28&lt;/p&gt;

&lt;p&gt;html 代码貌似被滤掉了，需要咋弄啊？&lt;/p&gt;</description>
      <author>secondrocker</author>
      <pubDate>Thu, 25 Oct 2012 23:06:42 +0800</pubDate>
      <link>https://ruby-china.org/topics/6329</link>
      <guid>https://ruby-china.org/topics/6329</guid>
    </item>
  </channel>
</rss>
