<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>puma (mxy)</title>
    <link>https://ruby-china.org/puma</link>
    <description></description>
    <language>en-us</language>
    <item>
      <title>Capistrano  Nginx Passenger 部署之后上传大文件很慢</title>
      <description>&lt;p&gt;用了 aliyun oss 来存储文件，本地上传，30M 几秒，服务器带宽 5M，应该不是带宽的问题？&lt;/p&gt;

&lt;p&gt;有没有哥们遇到过同样的问题以及解决方法&lt;/p&gt;</description>
      <author>puma</author>
      <pubDate>Sun, 19 Mar 2023 22:10:28 +0800</pubDate>
      <link>https://ruby-china.org/topics/42949</link>
      <guid>https://ruby-china.org/topics/42949</guid>
    </item>
    <item>
      <title>在 phoenix 里如何使用 vue</title>
      <description>&lt;p&gt;也没有用过 vue，现在有用 phoenix 的吗？你们一般用什么&lt;/p&gt;</description>
      <author>puma</author>
      <pubDate>Wed, 18 Mar 2020 10:42:35 +0800</pubDate>
      <link>https://ruby-china.org/topics/39624</link>
      <guid>https://ruby-china.org/topics/39624</guid>
    </item>
    <item>
      <title>服务器被墙了怎么办</title>
      <description>&lt;p&gt;阿里云买了一个国外的服务器，平常搭梯子用的，昨天突然 ping 不同，国外地址可以访问.
   以前基本都是封端口，现在竟然直接封 IP，阿里云貌似也不能更换公网 IP.&lt;/p&gt;

&lt;p&gt;有朋友碰到过这种情况吗？&lt;/p&gt;</description>
      <author>puma</author>
      <pubDate>Tue, 17 Sep 2019 17:19:57 +0800</pubDate>
      <link>https://ruby-china.org/topics/39060</link>
      <guid>https://ruby-china.org/topics/39060</guid>
    </item>
    <item>
      <title>development 模式加载不了 public 目录静态文件 (图片)</title>
      <description>&lt;p&gt;报错信息&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ActionController::RoutingError (No route matches [GET] "/public/uploads/registration/
user/avatar/21/52653c50-452b-42d0-a5ff-eca0195f1bd7.gif"):
&lt;/code&gt;&lt;/pre&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;select avatar from registration_users where id = 21;
                  avatar
------------------------------------------
52653c50-452b-42d0-a5ff-eca0195f1bd7.gif
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ls public/uploads/registration/user/avatar/21
3d2384d5-2ae1-4472-9a4f-28566a05c053.gif 52653c50-452b-42d0-a5ff-eca0195f1bd7.gif
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;使用 CarrierWave 上传图片
在用 image_tag 显示的时候出现这个问题。 
搜索了半天，找到可能相关的，enabled/disabled 了都不行&lt;img title=":joy:" alt="😂" src="https://twemoji.ruby-china.com/2/svg/1f602.svg" class="twemoji"&gt;   &lt;/p&gt;

&lt;p&gt;-&lt;a href="http://guides.rubyonrails.org/configuring.html" rel="nofollow" target="_blank" title=""&gt;Rails Guide&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;config.public_file_server.enabled configures Rails to serve static files from the public directory. This option defaults to true, but in the production environment it is set to false because the server software (e.g. NGINX or Apache) used to run the application should serve static files instead. If you are running or testing your app in production mode using WEBrick (it is not recommended to use WEBrick in production) set the option to true. Otherwise, you won't be able to use page caching and request for files that exist under the public directory.&lt;/p&gt;
&lt;/blockquote&gt;</description>
      <author>puma</author>
      <pubDate>Wed, 16 May 2018 19:12:16 +0800</pubDate>
      <link>https://ruby-china.org/topics/36787</link>
      <guid>https://ruby-china.org/topics/36787</guid>
    </item>
    <item>
      <title>这个一般怎么处理的</title>
      <description>&lt;p&gt;post.rb&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;has_many&lt;/span&gt; &lt;span class="ss"&gt;:comments&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;route.rb&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;resources&lt;/span&gt; &lt;span class="ss"&gt;:posts&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
  &lt;span class="n"&gt;resources&lt;/span&gt; &lt;span class="ss"&gt;:comments&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;请求 PostsController#show&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sx"&gt;% @post.comments.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;comment&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="sx"&gt;%&amp;gt;
  &amp;lt;%= link_to, '', edit_post_comment_path(@post, comment) %&amp;gt;&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sx"&gt;% end &lt;/span&gt;&lt;span class="o"&gt;%&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;想实现这种效果，但 comment 这里肯定不对，各位有什么建议吗？&lt;img title=":joy:" alt="😂" src="https://twemoji.ruby-china.com/2/svg/1f602.svg" class="twemoji"&gt; &lt;/p&gt;

&lt;hr&gt;

&lt;p&gt;&lt;img title=":joy:" alt="😂" src="https://twemoji.ruby-china.com/2/svg/1f602.svg" class="twemoji"&gt; 这里逻辑是对的，原因是我在&lt;/p&gt;

&lt;p&gt;PostsController#show 里面&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="vi"&gt;@post.comments.build&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;这句导致创建了一个 comment 值为 nil
然后在渲染的时候，这个值为 nil 的 comment 导致错误 &lt;img title=":joy:" alt="😂" src="https://twemoji.ruby-china.com/2/svg/1f602.svg" class="twemoji"&gt; &lt;/p&gt;</description>
      <author>puma</author>
      <pubDate>Fri, 11 May 2018 18:41:28 +0800</pubDate>
      <link>https://ruby-china.org/topics/36757</link>
      <guid>https://ruby-china.org/topics/36757</guid>
    </item>
    <item>
      <title>Ruby 正则问题</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;duplicate_count&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;scan&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/(\w)(?=(?!.*\1.*\1).*\1)/i&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;length&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;p&gt;Count the number of Duplicates&lt;/p&gt;

&lt;p&gt;Write a function that will return the count of distinct case-insensitive alphabetic characters and numeric digits that occur more than once in the input string. The input string can be assumed to contain only alphanumeric characters, including digits, uppercase and lowercase alphabets.&lt;/p&gt;

&lt;p&gt;Example&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="s2"&gt;"abcde"&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="c1"&gt;# no characters repeats more than once&lt;/span&gt;
&lt;span class="s2"&gt;"aabbcde"&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="c1"&gt;# 'a' and 'b'&lt;/span&gt;
&lt;span class="s2"&gt;"aabbcdeB"&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="c1"&gt;# 'a' and 'b'&lt;/span&gt;
&lt;span class="s2"&gt;"indivisibility"&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="c1"&gt;# 'i'&lt;/span&gt;
&lt;span class="s2"&gt;"Indivisibilities"&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="c1"&gt;# 'i' and 's'&lt;/span&gt;
&lt;span class="s2"&gt;"aa11"&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="c1"&gt;# 'a' and '1'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;</description>
      <author>puma</author>
      <pubDate>Mon, 03 Jul 2017 16:12:26 +0800</pubDate>
      <link>https://ruby-china.org/topics/33391</link>
      <guid>https://ruby-china.org/topics/33391</guid>
    </item>
  </channel>
</rss>
