<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>zhangyuxiu (zhangyuxiu)</title>
    <link>https://ruby-china.org/zhangyuxiu</link>
    <description></description>
    <language>en-us</language>
    <item>
      <title>如何使用脚本将特定 http:// 网址中的文件都下载下来</title>
      <description>&lt;p&gt;如题，现有一个网址，里面有很多视频文件及 txt 文档，想要使用脚本将该网址中的视频文件和文档下载到本地目录。
求大神指导如何实现？
谢谢！&lt;/p&gt;</description>
      <author>zhangyuxiu</author>
      <pubDate>Tue, 31 Mar 2015 11:46:06 +0800</pubDate>
      <link>https://ruby-china.org/topics/24929</link>
      <guid>https://ruby-china.org/topics/24929</guid>
    </item>
    <item>
      <title>普通进程可以切换为实时进程 实时进程可以切换为普通进程么</title>
      <description>&lt;p&gt;普通进程可以切换为实时进程么？
实时进程可以切换为普通进程么？&lt;/p&gt;</description>
      <author>zhangyuxiu</author>
      <pubDate>Mon, 17 Feb 2014 14:58:01 +0800</pubDate>
      <link>https://ruby-china.org/topics/17307</link>
      <guid>https://ruby-china.org/topics/17307</guid>
    </item>
    <item>
      <title>linux 中实时进程的动态优先级有什么作用</title>
      <description>&lt;p&gt;最近在学习进程调度相关知识，实时进程有静态优先级，动态优先级，实时优先级。
根据实时优先级决定哪个进程进行调度。
当相同优先级别的进程被抉择时，可以采用 SHED_FIFO 或者 SHED_RR 两种调度策略。其中 SHED_RR 调度策略需要用到静态优先级，计算时间片的大小。
那么实时进程中的动态优先级有什么作用呢？&lt;/p&gt;

&lt;p&gt;看到说实时进程的动态优先级不像普通进程的动态优先级那样可以根据进程的运行状态动态地变化；会在开始时设置好，之后便不能更改。那么实时进程的动态优先级初始值是否应该和静态优先级相等？&lt;/p&gt;</description>
      <author>zhangyuxiu</author>
      <pubDate>Mon, 17 Feb 2014 14:42:28 +0800</pubDate>
      <link>https://ruby-china.org/topics/17306</link>
      <guid>https://ruby-china.org/topics/17306</guid>
    </item>
    <item>
      <title>/proc/pid/maps 的具体含义</title>
      <description>&lt;p&gt;&lt;img src="//l.ruby-china.com/photo/2014/1737c1ba6ebc7d426e0b17db66c26a31.png" title="" alt=""&gt;&lt;/p&gt;

&lt;p&gt;如上图说示，为/proc//maps 的一段结果，有下述问题：&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;[vdso] 是什么段？&lt;/li&gt;
&lt;li&gt;共享库/lib/tls/i686/cmov/libc-2.10.1.so 有四行，这四行自上向下分别是什么段？&lt;/li&gt;
&lt;/ol&gt;</description>
      <author>zhangyuxiu</author>
      <pubDate>Tue, 28 Jan 2014 14:32:31 +0800</pubDate>
      <link>https://ruby-china.org/topics/17040</link>
      <guid>https://ruby-china.org/topics/17040</guid>
    </item>
    <item>
      <title>malloc 分配的物理内存在哪个区？</title>
      <description>&lt;p&gt;如题，malloc 分配的物理内存在哪个区？dma_zone normal_zone 还是 highmem_zone？&lt;/p&gt;</description>
      <author>zhangyuxiu</author>
      <pubDate>Tue, 28 Jan 2014 09:25:45 +0800</pubDate>
      <link>https://ruby-china.org/topics/17033</link>
      <guid>https://ruby-china.org/topics/17033</guid>
    </item>
    <item>
      <title>malloc 越界访问为什么不会报错？</title>
      <description>&lt;p&gt;malloc 40 个字节，访问第 100 个字节的内容，为什么编译器都不会报错。&lt;/p&gt;

&lt;p&gt;如下代码：
int * p = (int *) malloc(sizeof(int)*5);
cout &amp;lt;&amp;lt; *(p+100); &lt;/p&gt;

&lt;p&gt;结果：
编译器通过检查，结果为 0。&lt;/p&gt;

&lt;p&gt;前段时间学习了，说 malloc 只是分配了线性地址，返回值也是线性地址，只有真正访问虚拟地址的时候，才会分配物理地址。malloc 40 个字节，访问第 100 个字节的时候，不会因为没有对应的物理地址而报错么？&lt;/p&gt;</description>
      <author>zhangyuxiu</author>
      <pubDate>Mon, 27 Jan 2014 16:38:53 +0800</pubDate>
      <link>https://ruby-china.org/topics/17026</link>
      <guid>https://ruby-china.org/topics/17026</guid>
    </item>
    <item>
      <title>oauth 中的数字签名技术，密钥是 app_secret</title>
      <description>&lt;p&gt;oauth 中的数字签名技术，生成字符基串和一个密钥，利用密钥对字符基串进行签名。
请求：那个密钥是 app_secret 么？&lt;/p&gt;</description>
      <author>zhangyuxiu</author>
      <pubDate>Thu, 26 Dec 2013 14:11:30 +0800</pubDate>
      <link>https://ruby-china.org/topics/16436</link>
      <guid>https://ruby-china.org/topics/16436</guid>
    </item>
    <item>
      <title>可以对 HTTPS 的请求进行数字签名么？</title>
      <description>&lt;p&gt;HTTPS 协议基于 SSL 协议，保证数据传输过程的安全性。想在 HTTPS 的基础上使用 HMAC-SHA1 运算，提供数字签名的技术，保证数据的完整性。可以么？&lt;/p&gt;</description>
      <author>zhangyuxiu</author>
      <pubDate>Thu, 26 Dec 2013 13:58:27 +0800</pubDate>
      <link>https://ruby-china.org/topics/16435</link>
      <guid>https://ruby-china.org/topics/16435</guid>
    </item>
    <item>
      <title>rails generate devise:install 是什么意思</title>
      <description>&lt;p&gt;rails generate devise:install 是什么意思？&lt;/p&gt;</description>
      <author>zhangyuxiu</author>
      <pubDate>Sun, 08 Dec 2013 15:53:36 +0800</pubDate>
      <link>https://ruby-china.org/topics/16064</link>
      <guid>https://ruby-china.org/topics/16064</guid>
    </item>
    <item>
      <title>rvm use 出错</title>
      <description>&lt;p&gt;问题描述：&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;目前有两个 ruby 版本：
$ rvm list 
rvm rubies
=* ruby-1.9.2-p320 [ i686 ]
ruby-1.9.3-p484 [ i686 ]&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;2.当前环境下，默认是 1.9.2 的。&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;想默认更改为 1.9.3 版本的，但是出错：
$ rvm use 1.9.3
RVM is not a function, selecting rubies with 'rvm use ...' will not work.
You need to change your terminal emulator preferences to allow login shell.
Sometimes it is required to use &lt;code&gt;/bin/bash --login&lt;/code&gt; as the command.
Please visit &lt;a href="https://rvm.io/integration/gnome-terminal/" rel="nofollow" target="_blank"&gt;https://rvm.io/integration/gnome-terminal/&lt;/a&gt; for a example.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;如何解决上述的问题呢？我是 Fedora 的系统，已经将“以登录 Shell 方式运行命令”选中。但是还是没有能解决问题，求救啊。&lt;/p&gt;</description>
      <author>zhangyuxiu</author>
      <pubDate>Wed, 04 Dec 2013 20:11:37 +0800</pubDate>
      <link>https://ruby-china.org/topics/16010</link>
      <guid>https://ruby-china.org/topics/16010</guid>
    </item>
    <item>
      <title>新浪微博 oauth2.0 的一个小问题</title>
      <description>&lt;p&gt;新浪微博 OAuth2.0 的两个接口：
请求授权的接口：oauth2/authorize 请求参数有 client_id 等&lt;br&gt;
（具体使用方法见链接：&lt;a href="http://open.weibo.com/wiki/Oauth2/authorize" rel="nofollow" target="_blank"&gt;http://open.weibo.com/wiki/Oauth2/authorize&lt;/a&gt; ）
获取授权的接口：oauth2/access_token 请求参数有 client_id, client_secret 等
（具体使用方法见链接：&lt;a href="http://open.weibo.com/wiki/OAuth2/access_token" rel="nofollow" target="_blank"&gt;http://open.weibo.com/wiki/OAuth2/access_token&lt;/a&gt; ）&lt;/p&gt;

&lt;p&gt;求详解 client_secret 的作用，为什么在请求授权时不要提供，而在获取授权时需要提供呢？&lt;/p&gt;</description>
      <author>zhangyuxiu</author>
      <pubDate>Fri, 29 Nov 2013 21:17:11 +0800</pubDate>
      <link>https://ruby-china.org/topics/15894</link>
      <guid>https://ruby-china.org/topics/15894</guid>
    </item>
    <item>
      <title>OAuth 2.0 访问令牌</title>
      <description>&lt;p&gt;一直以来都有一个疑问：
为什么 OAuth2.0，要先请求获得授权码，再用授权码换取 Access Token 呢。为什么不在客户端将浏览器引导至授权服务器让用户授权之后，直接返回访问 Access Token 呢？&lt;/p&gt;

&lt;p&gt;求解释。&lt;/p&gt;</description>
      <author>zhangyuxiu</author>
      <pubDate>Fri, 29 Nov 2013 13:41:54 +0800</pubDate>
      <link>https://ruby-china.org/topics/15884</link>
      <guid>https://ruby-china.org/topics/15884</guid>
    </item>
    <item>
      <title>fork () 函数的一个小问题</title>
      <description>&lt;p&gt;自己测试写了一个程序：&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#include &amp;lt;iostream&amp;gt;&lt;/span&gt;
&lt;span class="c"&gt;#include &amp;lt;unistd.h&amp;gt;&lt;/span&gt;
&lt;span class="c"&gt;#include &amp;lt;stdio.h&amp;gt;&lt;/span&gt;
&lt;span class="c"&gt;#include &amp;lt;stdlib.h&amp;gt;&lt;/span&gt;
using namespace std&lt;span class="p"&gt;;&lt;/span&gt;

int main&lt;span class="o"&gt;(){&lt;/span&gt;
    cout &amp;lt;&amp;lt; &lt;span class="s2"&gt;"son/parent&lt;/span&gt;&lt;span class="se"&gt;\t&lt;/span&gt;&lt;span class="s2"&gt;ppid&lt;/span&gt;&lt;span class="se"&gt;\t&lt;/span&gt;&lt;span class="s2"&gt;pid&lt;/span&gt;&lt;span class="se"&gt;\t&lt;/span&gt;&lt;span class="s2"&gt;spid"&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;endl&lt;/span&gt;&lt;span class="sh"&gt;;
    pid_t spid = fork();
    if (spid&amp;lt;0) cout &amp;lt;&amp;lt; "error" &amp;lt;&amp;lt;endl;
    else if (spid!=0) cout &amp;lt;&amp;lt; "&lt;/span&gt;&lt;span class="se"&gt;\t&lt;/span&gt;&lt;span class="sh"&gt;" &amp;lt;&amp;lt; "parent" &amp;lt;&amp;lt; "&lt;/span&gt;&lt;span class="se"&gt;\t&lt;/span&gt;&lt;span class="sh"&gt;" &amp;lt;&amp;lt; getppid() &amp;lt;&amp;lt; "&lt;/span&gt;&lt;span class="se"&gt;\t&lt;/span&gt;&lt;span class="sh"&gt;" &amp;lt;&amp;lt; getpid() &amp;lt;&amp;lt; "&lt;/span&gt;&lt;span class="se"&gt;\t&lt;/span&gt;&lt;span class="sh"&gt;" &amp;lt;&amp;lt; spid &amp;lt;&amp;lt; endl;
    else {
        cout &amp;lt;&amp;lt; "&lt;/span&gt;&lt;span class="se"&gt;\t&lt;/span&gt;&lt;span class="sh"&gt;" &amp;lt;&amp;lt; "son" &amp;lt;&amp;lt; "&lt;/span&gt;&lt;span class="se"&gt;\t&lt;/span&gt;&lt;span class="sh"&gt;" &amp;lt;&amp;lt; getppid() &amp;lt;&amp;lt; "&lt;/span&gt;&lt;span class="se"&gt;\t&lt;/span&gt;&lt;span class="sh"&gt;" &amp;lt;&amp;lt; getpid() &amp;lt;&amp;lt; "&lt;/span&gt;&lt;span class="se"&gt;\t&lt;/span&gt;&lt;span class="sh"&gt;" &amp;lt;&amp;lt; spid &amp;lt;&amp;lt; endl;
    }
    return 0;
}
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;执行结果如下：&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;son/parent  ppid    pid spid
parent  32278   32343   32344
son 1   32344   0
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;问题：fork() 后，产生的子进程的父进程的 pid 为什么是 1？我感觉应该是 32343 啊。。。求解释。&lt;/p&gt;</description>
      <author>zhangyuxiu</author>
      <pubDate>Mon, 25 Nov 2013 19:43:46 +0800</pubDate>
      <link>https://ruby-china.org/topics/15789</link>
      <guid>https://ruby-china.org/topics/15789</guid>
    </item>
    <item>
      <title>内存分配的问题 </title>
      <description>&lt;p&gt;前两天笔试碰到一道题：
char *p = "aaa";&lt;/p&gt;

&lt;p&gt;问字符串“aaa”存放在哪里？
A 数据段  B 代码段 C 堆 D 堆栈 E 不一定&lt;/p&gt;

&lt;p&gt;答案是什么呢？不确定常量区对应到内存中，是在代码段中，还是数据段中啊？&lt;/p&gt;</description>
      <author>zhangyuxiu</author>
      <pubDate>Fri, 22 Nov 2013 16:25:19 +0800</pubDate>
      <link>https://ruby-china.org/topics/15735</link>
      <guid>https://ruby-china.org/topics/15735</guid>
    </item>
    <item>
      <title>OAuth2.0 中的问题 access token 如何产生 资源服务器如何验证 access token</title>
      <description>&lt;p&gt;最近学习 OAuth2.0，遇到了一些问题，期望大家能帮助到我，先谢过各位了！&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Access Token 是如何产生的，是否有同学知道详细的算法，可以举例说明一下。&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;资源服务器是怎么验证 Access Token 的合法性的，是让授权服务器代为验证么？也请举例详细说明。&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;OAuth2.0 是基于 https 协议的。在自己开发的网站中，如何搭建 https 通道呢？&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;</description>
      <author>zhangyuxiu</author>
      <pubDate>Fri, 08 Nov 2013 16:13:09 +0800</pubDate>
      <link>https://ruby-china.org/topics/15396</link>
      <guid>https://ruby-china.org/topics/15396</guid>
    </item>
    <item>
      <title>[求助] auto_explain_threshold_in_seconds 警告</title>
      <description>&lt;p&gt;rails s 之后，出现了 auto_explain_threshold_in_seconds is set but will be ignored...的警告，如何解决呢。警告的意思是什么呢。一般程序中设置 auto_explain_threshold_in_seconds 是来做什么的？&lt;/p&gt;

&lt;p&gt;$rails s
    =&amp;gt; Booting WEBrick
    =&amp;gt; Rails 3.2.13 application starting in development on &lt;a href="http://0.0.0.0:3000" rel="nofollow" target="_blank"&gt;http://0.0.0.0:3000&lt;/a&gt;
    =&amp;gt; Call with -d to detach
    =&amp;gt; Ctrl-C to shutdown server
    auto_explain_threshold_in_seconds is set but will be ignored because your adapter does not support this feature. Please unset the configuration to avoid this warning.
    [2013-06-09 21:06:37] INFO  WEBrick 1.3.1
    [2013-06-09 21:06:37] INFO  ruby 1.9.2 (2012-04-20) [i686-linux]
    [2013-06-09 21:06:37] INFO  WEBrick::HTTPServer#start: pid=11753 port=3000&lt;/p&gt;</description>
      <author>zhangyuxiu</author>
      <pubDate>Sun, 09 Jun 2013 21:14:23 +0800</pubDate>
      <link>https://ruby-china.org/topics/11620</link>
      <guid>https://ruby-china.org/topics/11620</guid>
    </item>
    <item>
      <title>RVM 安装 Ruby 1.9.2 安装出错，如何解决啊。呜呜。。</title>
      <description>&lt;p&gt;问题已经累积了好久，期待能有人解决。&lt;/p&gt;

&lt;p&gt;系统为 Fedora14，想在上面搭建 Rails3。目前已经安装了 RVM 1.20.13 (stable) 和 Ruby（1.8.7）
看网上的提示，接下来要安装 ruby 1.9.2。我执行了 rvm 1.9.2 后出现下面的问题：&lt;/p&gt;

&lt;p&gt;[user@cloud-privacy /]$ rvm install 1.9.2
    Searching for binary rubies, this might take some time.
    No binary rubies available for: fedora/14/i386/ruby-1.9.2-p320.
    Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies.
    Installing requirements for fedora, might require sudo password.
     ccache: failed to create /var/cache/ccache/tmp (Permission denied)
    Installing Ruby from source to: /home/user/.rvm/rubies/ruby-1.9.2-p320, this may take     a while depending on your cpu(s)...
    ruby-1.9.2-p320 - #downloading ruby-1.9.2-p320, this may take a while depending on your connection...
    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
    100 8770k  100 8770k    0     0  57435      0  0:02:36  0:02:36 --:--:-- 54846
    ruby-1.9.2-p320 - #extracting ruby-1.9.2-p320 to /home/user/.rvm/src/ruby-1.9.2-p320
    ruby-1.9.2-p320 - #extracted to /home/user/.rvm/src/ruby-1.9.2-p320
    ruby-1.9.2-p320 - #configuring........
    Error running './configure --prefix=/home/user/.rvm/rubies/ruby-1.9.2-p320 --disable-    install-doc --enable-shared',
    please read /home/user/.rvm/log/ruby-1.9.2-p320/1370681828_configure.log
    There has been an error while running configure. Halting the installation.&lt;/p&gt;

&lt;p&gt;其中，/home/user/.rvm/log/ruby-1.9.2-p320/1370681828_configure.log 日志内容如下：&lt;/p&gt;

&lt;p&gt;checking build system type... i686-pc-linux-gnu
    checking host system type... i686-pc-linux-gnu
    checking target system type... i686-pc-linux-gnu
    checking for gcc... gcc 
    checking whether the C compiler works... no
    configure: error: in &lt;code&gt;/home/user/.rvm/src/ruby-1.9.2-p320':
    configure: error: C compiler cannot create executables
    See&lt;/code&gt;config.log' for more details&lt;/p&gt;

&lt;p&gt;config.log 的详细内容见链接：&lt;a href="https://gist.github.com/anonymous/5734645" rel="nofollow" target="_blank"&gt;https://gist.github.com/anonymous/5734645&lt;/a&gt;&lt;/p&gt;</description>
      <author>zhangyuxiu</author>
      <pubDate>Sat, 08 Jun 2013 17:01:54 +0800</pubDate>
      <link>https://ruby-china.org/topics/11592</link>
      <guid>https://ruby-china.org/topics/11592</guid>
    </item>
    <item>
      <title>gem install rails 以后一直没有反应</title>
      <description>&lt;p&gt;命令行执行 gem install rails 以后，终端没有任何显示。大家安装 rails 的时候，也是这个样子么，要等多久才能安装好啊？&lt;/p&gt;</description>
      <author>zhangyuxiu</author>
      <pubDate>Sat, 08 Jun 2013 11:59:41 +0800</pubDate>
      <link>https://ruby-china.org/topics/11585</link>
      <guid>https://ruby-china.org/topics/11585</guid>
    </item>
    <item>
      <title>如何在发贴的时候，代码高亮显示</title>
      <description>&lt;p&gt;看到别人的发贴，代码中会有颜色显色，我的为什么没有呢？怎么编辑阿？&lt;/p&gt;</description>
      <author>zhangyuxiu</author>
      <pubDate>Sat, 08 Jun 2013 10:03:38 +0800</pubDate>
      <link>https://ruby-china.org/topics/11583</link>
      <guid>https://ruby-china.org/topics/11583</guid>
    </item>
    <item>
      <title>Fedora14 下 如何安装 rails3?</title>
      <description>&lt;p&gt;期望能说的详细些，新手不太懂。Thank you!&lt;/p&gt;</description>
      <author>zhangyuxiu</author>
      <pubDate>Fri, 07 Jun 2013 17:16:43 +0800</pubDate>
      <link>https://ruby-china.org/topics/11567</link>
      <guid>https://ruby-china.org/topics/11567</guid>
    </item>
  </channel>
</rss>
