<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>alphaliu (Alpha)</title>
    <link>https://ruby-china.org/alphaliu</link>
    <description></description>
    <language>en-us</language>
    <item>
      <title>请问如何通过 Rails 解析和发送 soap？</title>
      <description>&lt;p&gt;首先说明一下我的需求：我是想在我的 rails app 里面有一个 controller 处理 soap 数据，第三方程序通过访问我的地址，比如&lt;a href="http://localhost:3000/soap,rails" rel="nofollow" target="_blank"&gt;http://localhost:3000/soap,rails&lt;/a&gt;向我的 app post soap 数据，然后 rails app 的 controller 要解析这个 post 里面的 soap 数据，然后处理结果再封装 soap 报文发送回去。我看过 savon，但不是很明白，不知道有哪位朋友能够指导一下呢？？&lt;/p&gt;</description>
      <author>alphaliu</author>
      <pubDate>Sat, 11 Oct 2014 07:13:27 +0800</pubDate>
      <link>https://ruby-china.org/topics/21977</link>
      <guid>https://ruby-china.org/topics/21977</guid>
    </item>
    <item>
      <title>有喝咖啡的不？？都喝啥？</title>
      <description>&lt;p&gt;我最近有人从马来西亚旅游回来送了一包即溶白咖啡，感觉有点甜而且大包，一杯喝下来肚子都饱了，不习惯。各位喝咖啡的程序员有什么心头好推荐吗？？不要鄙视喝即溶咖啡的程序员哦。&lt;/p&gt;</description>
      <author>alphaliu</author>
      <pubDate>Fri, 06 Dec 2013 17:26:59 +0800</pubDate>
      <link>https://ruby-china.org/topics/16042</link>
      <guid>https://ruby-china.org/topics/16042</guid>
    </item>
    <item>
      <title>收到 gotealeaf 的 T-Shirt 了</title>
      <description>&lt;p&gt;纯炫耀。&lt;img src="//l.ruby-china.com/photo/457218a0c8451ec543c3cf74b44bd457.jpg" title="" alt=""&gt;
&lt;img src="//l.ruby-china.com/photo/7453881a162226d23cd722a98fa3f1ec.jpg" title="" alt=""&gt;&lt;/p&gt;

&lt;p&gt;多谢 Roy 和 Tealeaf Academy.&lt;/p&gt;</description>
      <author>alphaliu</author>
      <pubDate>Wed, 23 Oct 2013 20:22:05 +0800</pubDate>
      <link>https://ruby-china.org/topics/14973</link>
      <guid>https://ruby-china.org/topics/14973</guid>
    </item>
    <item>
      <title>如何在 Rails Controller 支持 SOAP？</title>
      <description>&lt;p&gt;我需要写一个 rails app，然后要支持一个客户端发过来的 soap 数据，要能够解析并且回复，请问有什么技术能做到吗？？
客户端发过来的 http 数据大致如下：&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="no"&gt;POST&lt;/span&gt; &lt;span class="sr"&gt;/ftacs-acs/&lt;/span&gt;&lt;span class="n"&gt;acs&lt;/span&gt; &lt;span class="no"&gt;HTTP&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mf"&gt;1.1&lt;/span&gt;
&lt;span class="no"&gt;Accept&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="sr"&gt;/*
Host: acs-tech.com
Connection: Keep-Alive
Content-type: text/xm&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;charset&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="no"&gt;UTF&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;
&lt;span class="no"&gt;Content&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="ss"&gt;length: &lt;/span&gt;&lt;span class="mi"&gt;233&lt;/span&gt;
&lt;span class="no"&gt;SOAPAction&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;

&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;SOAP&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="no"&gt;ENV&lt;/span&gt;&lt;span class="ss"&gt;:Envelope&lt;/span&gt;
 &lt;span class="n"&gt;xmlns&lt;/span&gt;&lt;span class="ss"&gt;:SOAP&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="no"&gt;ENV&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"http://schemas.xmlsoap.org/soap/envelope/"&lt;/span&gt; 
 &lt;span class="n"&gt;xmlns&lt;/span&gt;&lt;span class="ss"&gt;:SOAP&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="no"&gt;ENC&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"http://schemas.xmlsoap.org/soap/encoding/"&lt;/span&gt; 
 &lt;span class="n"&gt;xmlns&lt;/span&gt;&lt;span class="ss"&gt;:xsd&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"http://www.w3.org/2001/XMLSchema"&lt;/span&gt; 
 &lt;span class="n"&gt;xmlns&lt;/span&gt;&lt;span class="ss"&gt;:xsi&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"http://www.w3.org/2001/XMLSchema-instance"&lt;/span&gt; 
 &lt;span class="n"&gt;xmlns&lt;/span&gt;&lt;span class="ss"&gt;:cwmp&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"urn:dslforum-org:cwmp-1-0"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
 &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;SOAP&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="no"&gt;ENV&lt;/span&gt;&lt;span class="ss"&gt;:Header&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;cwmp&lt;/span&gt;&lt;span class="ss"&gt;:ID&lt;/span&gt; &lt;span class="no"&gt;SOAP&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="no"&gt;ENV&lt;/span&gt;&lt;span class="ss"&gt;:mustUnderstand&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"1"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="mi"&gt;291188&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/cwmp:ID&amp;gt;
 &amp;lt;/&lt;/span&gt;&lt;span class="no"&gt;SOAP&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="no"&gt;ENV&lt;/span&gt;&lt;span class="ss"&gt;:Header&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
 &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;SOAP&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="no"&gt;ENV&lt;/span&gt;&lt;span class="ss"&gt;:Body&lt;/span&gt; &lt;span class="no"&gt;SOAP&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="no"&gt;ENV&lt;/span&gt;&lt;span class="ss"&gt;:encodingStyle&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"http://schemas.xmlsoap.org/soap/"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;cwmp&lt;/span&gt;&lt;span class="ss"&gt;:Inform&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
   &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;DeviceId&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;Manufacturer&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="no"&gt;Arcadyan&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/Manufacturer&amp;gt;
    &amp;lt;OUI&amp;gt;0E0908&amp;lt;/&lt;/span&gt;&lt;span class="no"&gt;OUI&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;ProductClass&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="no"&gt;HGW&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/ProductClass&amp;gt;
    &amp;lt;SerialNumber&amp;gt;JM20130922&amp;lt;/&lt;/span&gt;&lt;span class="no"&gt;SerialNumber&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
   &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/DeviceId&amp;gt;
  &amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;cwmp&lt;/span&gt;&lt;span class="ss"&gt;:Inform&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
 &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/SOAP-ENV:Body&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span class="no"&gt;SOAP&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="no"&gt;ENV&lt;/span&gt;&lt;span class="ss"&gt;:Envelope&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;目前我想到的就是在 ftacs-acs/acs 这个 controller 里面支持解析这么一大串数据，但是不知道要怎么解析，求教一下各位，谢谢。&lt;/p&gt;</description>
      <author>alphaliu</author>
      <pubDate>Sun, 29 Sep 2013 15:45:16 +0800</pubDate>
      <link>https://ruby-china.org/topics/14474</link>
      <guid>https://ruby-china.org/topics/14474</guid>
    </item>
    <item>
      <title>Rails 如何在一个自己的 CSS 文件里调用位于其他位置的资源？</title>
      <description>&lt;p&gt;我想在一个 css 文件里面调用一个字体文件，请问这个字体文件的路径应该怎么写才对？？？我把它放在 asserts/font 目录里面，然后路径用 asserts/font/font.ttf，找不到这个资源.....&lt;/p&gt;</description>
      <author>alphaliu</author>
      <pubDate>Tue, 03 Sep 2013 14:07:43 +0800</pubDate>
      <link>https://ruby-china.org/topics/13851</link>
      <guid>https://ruby-china.org/topics/13851</guid>
    </item>
    <item>
      <title>如何将两个 Model 里面的类似的两个 callback 函数提出来复用?</title>
      <description>&lt;p&gt;比如我有两个 model，里面都有一个叫做 generate 的方法，是 before_save 的 callback，但这两个 generate 的方法里面的内容只是类似，如下&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="c1"&gt;#model1的generate&lt;/span&gt;
&lt;span class="n"&gt;before_save&lt;/span&gt; &lt;span class="ss"&gt;:generate&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;generate&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;slug&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;title&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;gsub&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;' '&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'-'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;downcase&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="c1"&gt;#model2的generate&lt;/span&gt;
&lt;span class="n"&gt;before_save&lt;/span&gt; &lt;span class="ss"&gt;:generate&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;generate&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;slug&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;name&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;gsub&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;' '&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'-'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;downcase&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;现在我想把这两个方法弄成一个 module，问题是我想要还是能够用 before_save 来调用，但方法里面的内容又不大一样，不知道要怎么做才好，请教一下各位&lt;/p&gt;</description>
      <author>alphaliu</author>
      <pubDate>Sun, 01 Sep 2013 19:46:07 +0800</pubDate>
      <link>https://ruby-china.org/topics/13807</link>
      <guid>https://ruby-china.org/topics/13807</guid>
    </item>
    <item>
      <title>请教一下这样的 Rails 程序怎么设计比较好？</title>
      <description>&lt;p&gt;我想用 Rails 做一个软件，就是后台有个程序在监听某个端口，然后把收到数据保存进数据库。再用 rails 的 view 显示出来。用户可以用页面改变一些数据保存起来，再通过后台的那个程序发送出去。请问这样子的设计可行吗？？还是后台的监听程序可以由 rails 来做？？一直搞不明白。请大家教一下&lt;/p&gt;</description>
      <author>alphaliu</author>
      <pubDate>Wed, 21 Aug 2013 14:03:50 +0800</pubDate>
      <link>https://ruby-china.org/topics/13489</link>
      <guid>https://ruby-china.org/topics/13489</guid>
    </item>
    <item>
      <title>MacVim 无法保存 preference</title>
      <description>&lt;p&gt;我说的是 MacVim 无法保存它自己的 preference。不知道各位有没有遇到过这种事情，我想设置在最后一个窗口关闭时退出 macvim，但每次退出后再打开却发现又恢复默认设置了。不知道各位有没有解决方法？&lt;/p&gt;</description>
      <author>alphaliu</author>
      <pubDate>Mon, 05 Aug 2013 07:09:48 +0800</pubDate>
      <link>https://ruby-china.org/topics/13047</link>
      <guid>https://ruby-china.org/topics/13047</guid>
    </item>
    <item>
      <title>Ruby Tuesday 来自这首歌吗？？</title>
      <description>&lt;p&gt;刚刚在 youtube 上搜到这首 The Rolling Stones 的 Ruby Tuesday，不会是 Ruby Tuesday 的由来吧？？挺好听的歌...&lt;/p&gt;</description>
      <author>alphaliu</author>
      <pubDate>Sun, 07 Jul 2013 21:56:51 +0800</pubDate>
      <link>https://ruby-china.org/topics/12321</link>
      <guid>https://ruby-china.org/topics/12321</guid>
    </item>
    <item>
      <title>rails 做服务器端软件应该没问题吧</title>
      <description>&lt;p&gt;想用 rails 做一个服务器端软件，通过页面设置参数，然后 ruby 在后台根据参数监听网络，再把监听到的客户端发送过来的数据反馈给页面。Rails 应该可以做到吧？&lt;/p&gt;</description>
      <author>alphaliu</author>
      <pubDate>Tue, 02 Jul 2013 14:43:32 +0800</pubDate>
      <link>https://ruby-china.org/topics/12185</link>
      <guid>https://ruby-china.org/topics/12185</guid>
    </item>
    <item>
      <title>用 Rails 实现一个 ACS server 是否没有什么问题</title>
      <description>&lt;p&gt;要做毕业论文了，我想用 Rails 实现一个 ACS server（这比较专业），但不知道 Rails 在解析网络协议这方面能力怎么样。有没有一些方法或者 Gem 是做这种事情的？？我想了想，监听端口解析协议等功能好像是 Ruby 的事情。&lt;/p&gt;</description>
      <author>alphaliu</author>
      <pubDate>Mon, 24 Jun 2013 11:39:44 +0800</pubDate>
      <link>https://ruby-china.org/topics/11942</link>
      <guid>https://ruby-china.org/topics/11942</guid>
    </item>
    <item>
      <title>请问有没有 ruby 语言的机器人项目？</title>
      <description>&lt;p&gt;研究生论文想搞一个人工智能，不知道有没有相关的项目可以拿来用呢？？？指明 ruby 是因为其他语言太麻烦了....&lt;/p&gt;</description>
      <author>alphaliu</author>
      <pubDate>Mon, 27 May 2013 11:57:00 +0800</pubDate>
      <link>https://ruby-china.org/topics/11255</link>
      <guid>https://ruby-china.org/topics/11255</guid>
    </item>
    <item>
      <title>我的一位老师说网络开发技术只有 Windows 的 DAO COM 和 J2EE</title>
      <description>&lt;p&gt;我的一位老师说网络开发技术就 windows 的 dao com 和 J2EE，我无力吐槽。虽然当年老师你也很牛，但是现在是不是跟不上时代了...&lt;/p&gt;</description>
      <author>alphaliu</author>
      <pubDate>Mon, 13 May 2013 16:53:56 +0800</pubDate>
      <link>https://ruby-china.org/topics/10954</link>
      <guid>https://ruby-china.org/topics/10954</guid>
    </item>
    <item>
      <title>征求算法题目</title>
      <description>&lt;p&gt;上研究生的算法课，老师说要写作业，我看了老师给出的题目，大概都是一些具体题目然后要你设计算法来分析及解决，不过老师只给了 11 个，同学不够分，所以我想自己找一些涉及到算法的题，不知道大家有没有什么好题目呢？？&lt;/p&gt;</description>
      <author>alphaliu</author>
      <pubDate>Mon, 18 Mar 2013 10:19:15 +0800</pubDate>
      <link>https://ruby-china.org/topics/9521</link>
      <guid>https://ruby-china.org/topics/9521</guid>
    </item>
    <item>
      <title>想给 MBP 换个 SSD，结果把光驱的螺丝弄花了，搞不下来</title>
      <description>&lt;p&gt;真心想哭了，难道 ssd 就这样没用了？各位有什么简单办法能够把这颗花了的螺丝给卸下来吗？？？？&lt;/p&gt;</description>
      <author>alphaliu</author>
      <pubDate>Fri, 15 Mar 2013 07:01:34 +0800</pubDate>
      <link>https://ruby-china.org/topics/9432</link>
      <guid>https://ruby-china.org/topics/9432</guid>
    </item>
    <item>
      <title>想写一个网络抓取数据的程序，该怎么写 rspec 测试？</title>
      <description>&lt;p&gt;想测试这个程序是否能抓取到正确的数据之类的，rspec 测试怎么写合适？主要是考虑到网络上抓取到的数据每次可能都不同，怎么写才能测试出程序工作正常呢？初次使用 TDD 的方式写程序，请指教。&lt;/p&gt;</description>
      <author>alphaliu</author>
      <pubDate>Tue, 19 Feb 2013 18:11:43 +0800</pubDate>
      <link>https://ruby-china.org/topics/8776</link>
      <guid>https://ruby-china.org/topics/8776</guid>
    </item>
    <item>
      <title>如何找出数组中出现频率最高的元素？</title>
      <description>&lt;p&gt;需要找出数组中出现频率最高的元素，我找了一下，可以像下面这种写法。&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;nums&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="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;num_hash&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;Hash&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;nums&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;uniq&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;num&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;num&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;nums&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;num&lt;/span&gt;&lt;span class="p"&gt;)]&lt;/span&gt; &lt;span class="p"&gt;}]&lt;/span&gt;
&lt;span class="n"&gt;most_freq&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;nums&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sort_by&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;num&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;num_hash&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;num&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;}.&lt;/span&gt;&lt;span class="nf"&gt;last&lt;/span&gt;
&lt;span class="c1"&gt;# most_freq == 1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;基本思想就是用一个 hash 先存好每个元素出现的次数然后再对原数组依据次数的高低排序，最后一个就是出现次数最高的元素。
我总觉得会有更好的解法，不知各位高手如何解的？&lt;/p&gt;</description>
      <author>alphaliu</author>
      <pubDate>Wed, 06 Feb 2013 22:57:29 +0800</pubDate>
      <link>https://ruby-china.org/topics/8634</link>
      <guid>https://ruby-china.org/topics/8634</guid>
    </item>
    <item>
      <title>一些项目里面用到的 Setting.app_name 是从哪里来的？</title>
      <description>&lt;p&gt;看到 ruby-china 等都有用到一个叫 Setting.app_name 的变量，本来我以为是定义在 config/config.yml 里面的，试了一下，还是出现 uninitialized constant ActionView::CompiledTemplates::Setting 的错误。问一下这变量在哪里定义的？谢谢&lt;/p&gt;</description>
      <author>alphaliu</author>
      <pubDate>Fri, 14 Dec 2012 00:09:22 +0800</pubDate>
      <link>https://ruby-china.org/topics/7550</link>
      <guid>https://ruby-china.org/topics/7550</guid>
    </item>
    <item>
      <title>Screenflow 4 的 export 格式问题，求教。</title>
      <description>&lt;p&gt;刚刚换了新版的 screenflow 4，结果导出的时候用以前一直惯用的 web high 设置，发现都只能存成 mp4 格式，不是 mov 了，而且 web high 导出的文件超大。我想请教一下，以前 3 的时候的 web high 配置是相当于 4 的什么？还有有没有办法变成 mov 格式？我以前导出的都是 mov，想要统一。（关键是 3 还打不开 4 的文件）&lt;/p&gt;</description>
      <author>alphaliu</author>
      <pubDate>Thu, 06 Dec 2012 09:48:03 +0800</pubDate>
      <link>https://ruby-china.org/topics/7356</link>
      <guid>https://ruby-china.org/topics/7356</guid>
    </item>
    <item>
      <title>新手求推荐一些开源的 Rails 程序</title>
      <description>&lt;p&gt;作为 web 开发和数据库开发的新手，主要想了解一下在实际开发中数据库表是如何设计的。所以请推荐一些能够让新手看得懂的开源 rails 程序。谢谢！&lt;/p&gt;</description>
      <author>alphaliu</author>
      <pubDate>Mon, 03 Dec 2012 10:52:17 +0800</pubDate>
      <link>https://ruby-china.org/topics/7260</link>
      <guid>https://ruby-china.org/topics/7260</guid>
    </item>
  </channel>
</rss>
