<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>long_chn (程龙)</title>
    <link>https://ruby-china.org/long_chn</link>
    <description/>
    <language>en-us</language>
    <item>
      <title>为什么 render 回来的 HTML 中 JS 不重新加载？</title>
      <description>&lt;p&gt;render 回来一个页面中明明有 js，但是浏览器确没有发请求来获取这些 js，是什么问题
如图：请求返回了一个被渲染的 new 页面，其中返回 html 能看到 js，但是里面的这些 js 没有被重新加载是怎么回事？抓包看只有一个 html 的请求，没有 js 之类的请求
&lt;img src="https://l.ruby-china.com/photo/2014/ce812f7ba72dce60b54b7e457ac6b943.png" title="" alt=""&gt;
&lt;img src="https://l.ruby-china.com/photo/2014/69cce6cdd07b09ce9c74c0682669935e.png" title="" alt=""&gt;
&lt;img src="https://l.ruby-china.com/photo/2014/5518ad7bee4e2a1d39d405ae00909c1e.png" title="" alt=""&gt;
&lt;img src="https://l.ruby-china.com/photo/2014/154fa680d85f02be83f06387def13af7.png" title="" alt=""&gt;&lt;/p&gt;</description>
      <author>long_chn</author>
      <pubDate>Sat, 27 Dec 2014 18:47:12 +0800</pubDate>
      <link>https://ruby-china.org/topics/23433</link>
      <guid>https://ruby-china.org/topics/23433</guid>
    </item>
    <item>
      <title>Passenger/Nginx/Ubuntu 部署 Rails 4.1 Unable to download or extract Nginx source tarball 的解决方法</title>
      <description>&lt;p&gt;今天用 Passenger 安装 Nginx
$ rvmsudo passenger-install-nginx-module
    一直提示
&lt;img src="//l.ruby-china.com/photo/2014/eff03906900a4fc448c5824444657bc5.png" title="" alt=""&gt;
    这个 URLhttp://&lt;a href="http://www.nginx.org/download/nginx-1.4.7.tar.gz%E5%9C%A8windows%E4%B8%8B%E9%9D%A2%E8%AF%95%E4%BA%86%E8%AF%95%E5%8F%AF%E4%BB%A5%E6%89%93%E5%BC%80%E7%9A%84" title=""&gt;www.nginx.org/download/nginx-1.4.7.tar.gz在windows下面试了试可以打开的&lt;/a&gt;
linux 下用 wget 的时候一定概率会出现访问不了
wget &lt;a href="http://www.nginx.org/download/nginx-1.4.7.tar.gz" rel="nofollow" target="_blank"&gt;http://www.nginx.org/download/nginx-1.4.7.tar.gz&lt;/a&gt;
--2014-04-16 17:58:10--  &lt;a href="http://www.nginx.org/download/nginx-1.4.7.tar.gz" rel="nofollow" target="_blank"&gt;http://www.nginx.org/download/nginx-1.4.7.tar.gz&lt;/a&gt;
正在解析主机 &lt;a href="http://www.nginx.org" rel="nofollow" target="_blank" title=""&gt;www.nginx.org&lt;/a&gt; (&lt;a href="http://www.nginx.org" rel="nofollow" target="_blank" title=""&gt;www.nginx.org&lt;/a&gt;)... 
最后解析失败
     偶尔几次成功可以看到这样的打印
正在解析主机 &lt;a href="http://www.nginx.org" rel="nofollow" target="_blank" title=""&gt;www.nginx.org&lt;/a&gt; (&lt;a href="http://www.nginx.org" rel="nofollow" target="_blank" title=""&gt;www.nginx.org&lt;/a&gt;)... 206.251.255.63
正在连接 &lt;a href="http://www.nginx.org" rel="nofollow" target="_blank" title=""&gt;www.nginx.org&lt;/a&gt; (&lt;a href="http://www.nginx.org)|206.251.255.63|:80" title=""&gt;www.nginx.org)|206.251.255.63|:80&lt;/a&gt;... 已连接。
已发出 HTTP 请求，正在等待回应... 301 Moved Permanently
位置：&lt;a href="http://nginx.org/download/nginx-1.4.7.tar.gz" rel="nofollow" target="_blank"&gt;http://nginx.org/download/nginx-1.4.7.tar.gz&lt;/a&gt; [跟随至新的 URL]
--2014-04-16 18:05:31--  &lt;a href="http://nginx.org/download/nginx-1.4.7.tar.gz" rel="nofollow" target="_blank"&gt;http://nginx.org/download/nginx-1.4.7.tar.gz&lt;/a&gt;
正在解析主机 nginx.org (nginx.org)... 206.251.255.63
再次使用存在的到 &lt;a href="http://www.nginx.org:80" rel="nofollow" target="_blank" title=""&gt;www.nginx.org:80&lt;/a&gt; 的连接。
    这下才有点明白为什么 rvmsudo passenger-install-nginx-module 下载不了 nginx 的原因，可能是由于下载的地址有问题导致不能跳转
    这个时候去找这个安装脚本的配置文件
    sudo find / -name &lt;em&gt;passenger&lt;/em&gt;
    &lt;img src="//l.ruby-china.com/photo/2014/63c9b902fea33e110f8e49f7b09225a5.png" title="" alt=""&gt;
    发现了这个文件
   没错！
   打开它，找到下面这一段
   def download_and_extract_nginx
                new_screen
                puts "Downloading Nginx..."&lt;/p&gt;

&lt;p&gt;url = "&lt;a href="http://www.nginx.org/download/nginx-#PREFERRED_NGINX_VERSION}.tar.gz" rel="nofollow" target="_blank"&gt;http://www.nginx.org/download/nginx-#PREFERRED_NGINX_VERSION}.tar.gz&lt;/a&gt;{"
                dirname = "nginx-#{PREFERRED_NGINX_VERSION}"
                tarball = "#{&lt;a href="/working_dir" class="user-mention" title="@working_dir"&gt;&lt;i&gt;@&lt;/i&gt;working_dir&lt;/a&gt;}/nginx.tar.gz"&lt;/p&gt;

&lt;p&gt;if download(url, tarball)   &lt;/p&gt;

&lt;p&gt;将中间的&lt;a href="http://www.nginx.org/download/nginx-#PREFERRED_NGINX_VERSION}.tar.gz%E6%9B%BF%E6%8D%A2%E4%B8%BAhttp://nginx.org/download/nginx-#PREFERRED_NGINX_VERSION}.tar.gz" rel="nofollow" target="_blank"&gt;http://www.nginx.org/download/nginx-#PREFERRED_NGINX_VERSION}.tar.gz替换为http://nginx.org/download/nginx-#PREFERRED_NGINX_VERSION}.tar.gz&lt;/a&gt;{&lt;/p&gt;

&lt;p&gt;再重新试试 rvmsudo passenger-install-nginx-module 发现流畅无比了&lt;/p&gt;</description>
      <author>long_chn</author>
      <pubDate>Wed, 16 Apr 2014 18:16:05 +0800</pubDate>
      <link>https://ruby-china.org/topics/18641</link>
      <guid>https://ruby-china.org/topics/18641</guid>
    </item>
    <item>
      <title>关于 Ruby 线程之间控制的一个问题</title>
      <description>&lt;p&gt;线程 A 中有个数组，其余有多个 B,C 线程，同时并发，想要线程 A 中的数组遍历的时候，每个元素能在其它线程中同步输出，也就是每从线程 A 中的数组中弹出一个元素，其余线程就能把这个元素取出来，依次逐步迭代
基础代码如下：&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;thread = []
arr = [1,2,3,4,5]
thread &amp;lt;&amp;lt; Thread.new{
  arr.each{|i|
     @value =i
}
}
thread &amp;lt;&amp;lt; Thread.new{
p    @value
}
thread &amp;lt;&amp;lt; Thread.new{
p    @value
}
thread.each{|t|t.join}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;需要在这些代码上面加上控制结构，完成上面的需求，期待大牛！&lt;/p&gt;</description>
      <author>long_chn</author>
      <pubDate>Tue, 15 Oct 2013 20:27:48 +0800</pubDate>
      <link>https://ruby-china.org/topics/14775</link>
      <guid>https://ruby-china.org/topics/14775</guid>
    </item>
  </channel>
</rss>
