<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>johnlu</title>
    <link>https://ruby-china.org/johnlu</link>
    <description></description>
    <language>en-us</language>
    <item>
      <title>Vim 中 html 标签 a 去除下划线</title>
      <description>&lt;p&gt;用 Vim 在编辑 html 文件时，a 标签中的文字都会有下划线，在一行中这个效果倒也不赖，但是 a 标签换行的话看着就有些丑了
如图：
&lt;img src="//l.ruby-china.com/photo/d075f0893e1f76aaeae6df5510ddea56.png" title="" alt=""&gt;&lt;/p&gt;</description>
      <author>johnlu</author>
      <pubDate>Sat, 10 Aug 2013 09:10:58 +0800</pubDate>
      <link>https://ruby-china.org/topics/13215</link>
      <guid>https://ruby-china.org/topics/13215</guid>
    </item>
    <item>
      <title>执行 Rspec 时提示 “You didn't set config.secret_key_base.”</title>
      <description>&lt;p&gt;执行&lt;code&gt;rspec spec/requests/authentication_pages_spec.rb -e "signin with invalid information"&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;提示:
·&lt;code&gt;DEPRECATION WARNING: You didn't set config.secret_key_base. Read the upgrade documentation to learn more about this new config option. (called from get at /home/johnlu/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/forwardable.rb:171)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;在网上找到的解决办法：
&lt;a href="https://github.com/rails-api/rails-api/issues/72" rel="nofollow" target="_blank"&gt;https://github.com/rails-api/rails-api/issues/72&lt;/a&gt;
在&lt;code&gt;config/application.rb&lt;/code&gt;中加入&lt;code&gt;config.secret_key_base = 'blipblapblup'&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;在&lt;a href="http://edgeguides.rubyonrails.org/configuring.html" rel="nofollow" target="_blank"&gt;http://edgeguides.rubyonrails.org/configuring.html&lt;/a&gt;有说明，但不懂是什么意思！
&lt;code&gt;config.secret_key_base used for specifying a key which allows sessions for the application to be verified against a known secure key to prevent tampering. Applications get config.secret_key_base initialized to a random key in config/initializers/secret_token.rb.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;问题是解决了，但迷茫的是为什么要这样设置？&lt;/p&gt;</description>
      <author>johnlu</author>
      <pubDate>Thu, 01 Aug 2013 20:47:30 +0800</pubDate>
      <link>https://ruby-china.org/topics/12989</link>
      <guid>https://ruby-china.org/topics/12989</guid>
    </item>
    <item>
      <title>每次执行 Rails 的时候都有提示信息是什么意思</title>
      <description>&lt;p&gt;如执行&lt;code&gt;rails generate integration_test authentication_pages&lt;/code&gt;&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DEPRECATION WARNING: config.whiny_nils option is deprecated and no longer works. (called from block in &amp;lt;top (required)&amp;gt; at /home/johnlu/rails_projects/mysampleapp/config/environments/development.rb:10)
config.eager_load is set to nil. Please update your config/environments/*.rb files accordingly:

  * development - set it to false
  * test - set it to false (unless you use a tool that preloads your test environment)
  * production - set it to true

      invoke  rspec
DEPRECATION WARNING: Model based mass assignment security has been extracted
out of Rails into a gem. Please use the new recommended protection model for
params or add `protected_attributes` to your Gemfile to use the old one.

To disable this message remove the `whitelist_attributes` option from your
`config/application.rb` file and any `mass_assignment_sanitizer` options
from your `config/environments/*.rb` files.

See http://guides.rubyonrails.org/security.html#mass-assignment for more information.

DEPRECATION WARNING: The Active Record auto explain feature has been removed.

To disable this message remove the `active_record.auto_explain_threshold_in_seconds`
option from the `config/environments/*.rb` config file.

See http://guides.rubyonrails.org/4_0_release_notes.html for more information.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;具体要设置哪些参数呢？
Ubuntu12.04 32 位&lt;/p&gt;</description>
      <author>johnlu</author>
      <pubDate>Wed, 31 Jul 2013 21:29:41 +0800</pubDate>
      <link>https://ruby-china.org/topics/12956</link>
      <guid>https://ruby-china.org/topics/12956</guid>
    </item>
    <item>
      <title>新建一个仓库后，推迭到 Github 时要输用户名密码</title>
      <description>&lt;p&gt;原来本地也有一个 Git 工作树仓库，推迭到 Github 时使用 SSH-Key；
把原来的 Git 仓库删除后，再新建一个一样的，但推迭到 Github 时却变成了要输入用户名密码；
感觉没有使用 SSH-Key 方便
请问大牛如何再设置成使用 SSH-Key？？&lt;/p&gt;</description>
      <author>johnlu</author>
      <pubDate>Tue, 30 Jul 2013 22:10:58 +0800</pubDate>
      <link>https://ruby-china.org/topics/12921</link>
      <guid>https://ruby-china.org/topics/12921</guid>
    </item>
    <item>
      <title>Git 恢复到上次提交后，新建的文件还在呢？</title>
      <description>&lt;p&gt;使用命令&lt;code&gt;git reset --head&lt;/code&gt;恢复到上次提交，但上次提交后新建的文件怎么还在的呢？&lt;/p&gt;</description>
      <author>johnlu</author>
      <pubDate>Sat, 27 Jul 2013 22:09:42 +0800</pubDate>
      <link>https://ruby-china.org/topics/12838</link>
      <guid>https://ruby-china.org/topics/12838</guid>
    </item>
    <item>
      <title>Rails console 时间不正确</title>
      <description>&lt;p&gt;在控制台上创建表记录时，时间显示不正确&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;2.0.0p247 :022 &amp;gt; user.updated_at
 =&amp;gt; Fri, 26 Jul 2013 14:17:27 UTC +00:00
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;然而我系统的时间是正确的&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ date
Fri Jul 26 22:18:54 CST 2013
&lt;/code&gt;&lt;/pre&gt;</description>
      <author>johnlu</author>
      <pubDate>Fri, 26 Jul 2013 22:24:10 +0800</pubDate>
      <link>https://ruby-china.org/topics/12813</link>
      <guid>https://ruby-china.org/topics/12813</guid>
    </item>
    <item>
      <title>RVM 总是提示"rvm rvmrc warning ignore"</title>
      <description>&lt;p&gt;终端进入到 rails app 目录后总是提示&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;RVM used your Gemfile for selecting Ruby, it is all fine - Heroku does that too,
you can ignore these warnings with 'rvm rvmrc warning ignore /home/johnlu/rails_projects/mysampleapp/Gemfile'.
To ignore the warning for all files run 'rvm rvmrc warning ignore allGemfiles'.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Gemfile 的内容为：&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;source 'http://ruby.taobao.org'
ruby '2.0.0'

gem 'rails', '4.0.0'

group :development, :test do
  gem 'sqlite3', '1.3.7'
  gem 'rspec-rails', '2.13.1'
end

group :test do
  gem 'selenium-webdriver', '2.0.0'
  gem 'capybara', '2.1.0'
end

gem 'sass-rails', '4.0.0'
gem 'uglifier', '2.1.1'
gem 'coffee-rails', '4.0.0'
gem 'jquery-rails', '2.2.1'
gem 'turbolinks', '1.1.1'
gem 'jbuilder', '1.0.2'

group :doc do
  gem 'sdoc', '0.3.20', require: false
end

group :production do
  gem 'pg', '0.15.1'
end
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;系统：Ubuntu 12.04 &lt;/p&gt;</description>
      <author>johnlu</author>
      <pubDate>Mon, 22 Jul 2013 21:24:42 +0800</pubDate>
      <link>https://ruby-china.org/topics/12684</link>
      <guid>https://ruby-china.org/topics/12684</guid>
    </item>
    <item>
      <title>2 个人使用 Git 做版本控制，如何合并代码</title>
      <description>&lt;p&gt;克隆代码后，修改！
再通过命令：git push origin master 提交合并时报错：&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;remote: error: refusing to update checked out branch: refs/heads/master

remote: error: By default, updating the current branch in a non-bare repository

remote: error: is denied, because it will make the index and work tree inconsistent

remote: error: with what you pushed, and will require 'git reset --hard' to match

remote: error: the work tree to HEAD.

remote: error:

remote: error: You can set 'receive.denyCurrentBranch' configuration variable to

remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into

remote: error: its current branch; however, this is not recommended unless you

remote: error: arranged to update its work tree to match what you pushed in some

remote: error: other way.

remote: error:

remote: error: To squelch this message and still keep the default behaviour, set

remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.

To git@192.168.1.X:/var/git.server/.../web

! [remote rejected] master -&amp;gt; master (branch is currently checked out)

error: failed to push some refs to 'git@192.168.1.X:/var/git.server/.../web'
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;到底是什么原理？&lt;/p&gt;</description>
      <author>johnlu</author>
      <pubDate>Sat, 20 Jul 2013 08:39:14 +0800</pubDate>
      <link>https://ruby-china.org/topics/12631</link>
      <guid>https://ruby-china.org/topics/12631</guid>
    </item>
    <item>
      <title>Ubuntu12.04 安装 RVM 后，打开新的虚拟终端都要执行 source .bashrc</title>
      <description>&lt;p&gt;按照&lt;a href="http://ruby-china.org/wiki/rvm-guideRVM" rel="nofollow" target="_blank"&gt;http://ruby-china.org/wiki/rvm-guideRVM&lt;/a&gt;成功安装
但每次打开新的终端，都不能使用&lt;code&gt;ll&lt;/code&gt;命令，需要执行 source .bashrc 后才可以！&lt;/p&gt;

&lt;p&gt;其它问题都正常，登录后就算没有执行 source .bashrc；RVM、gem 的功能都能正常用。
但就不能使用 ll 这样的别名命令了&lt;/p&gt;</description>
      <author>johnlu</author>
      <pubDate>Wed, 17 Jul 2013 21:50:48 +0800</pubDate>
      <link>https://ruby-china.org/topics/12571</link>
      <guid>https://ruby-china.org/topics/12571</guid>
    </item>
    <item>
      <title>求 Sublime Text 2 操作技巧</title>
      <description>&lt;p&gt;在 Sublime 官方首页第 2 张图显示的操作技巧，求操作过程！
如图：
操作前：
&lt;img src="//l.ruby-china.com/photo/0042c120892aa098e4a6e13b663f484f.png" title="" alt=""&gt;&lt;/p&gt;

&lt;p&gt;操作后：
&lt;img src="//l.ruby-china.com/photo/d1a4bdc70b2c05bad810cca7c80c4db0.png" title="" alt=""&gt;&lt;/p&gt;</description>
      <author>johnlu</author>
      <pubDate>Fri, 12 Jul 2013 14:00:13 +0800</pubDate>
      <link>https://ruby-china.org/topics/12458</link>
      <guid>https://ruby-china.org/topics/12458</guid>
    </item>
    <item>
      <title>3 个双引号在编辑器中的高亮问题</title>
      <description>&lt;p&gt;在同一行代码有 3 个双引号，有些编辑器的高亮会混乱，如 Sublime Text 2 和 Notepad++
但在 Vim 中就没问题。
在 Sublime 中有办法解决吗？&lt;/p&gt;

&lt;p&gt;如图：&lt;/p&gt;

&lt;p&gt;Sublime：
&lt;img src="//l.ruby-china.com/photo/8b8ea2ef7ab2cb9f1a9b090e1db6f459.png" title="" alt=""&gt;&lt;/p&gt;

&lt;p&gt;Vim:
&lt;img src="//l.ruby-china.com/photo/2aa758a8efbbd9cc77f2615c483a9c8c.png" title="" alt=""&gt;&lt;/p&gt;</description>
      <author>johnlu</author>
      <pubDate>Tue, 02 Jul 2013 12:36:52 +0800</pubDate>
      <link>https://ruby-china.org/topics/12179</link>
      <guid>https://ruby-china.org/topics/12179</guid>
    </item>
    <item>
      <title>RVM 安装 Ruby 报错</title>
      <description>&lt;p&gt;系统：Ubuntu12.04
提示错误：
There was an error while trying to resolve rubygems version for 'latest'. 
Halting the installation.&lt;/p&gt;

&lt;p&gt;是什么原因？&lt;/p&gt;</description>
      <author>johnlu</author>
      <pubDate>Sun, 30 Jun 2013 14:49:34 +0800</pubDate>
      <link>https://ruby-china.org/topics/12114</link>
      <guid>https://ruby-china.org/topics/12114</guid>
    </item>
    <item>
      <title>在 Ubuntu11.10 64 位系统安装 newrelic 出错</title>
      <description>&lt;p&gt;shilong@lushilong:~$ sudo apt-get install newrelic-sysmond
Reading package lists... Done
Building dependency tree&lt;br&gt;
Reading state information... Done
The following NEW packages will be installed:
  newrelic-sysmond
0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
Need to get 1,290 kB of archives.
After this operation, 3,723 kB of additional disk space will be used.
Get:1 &lt;a href="http://apt.newrelic.com/debian/" rel="nofollow" target="_blank"&gt;http://apt.newrelic.com/debian/&lt;/a&gt; newrelic/non-free newrelic-sysmond amd64 1.2.0.257 [1,290 kB]
Fetched 1,290 kB in 20s (62.7 kB/s)&lt;br&gt;
Selecting previously deselected package newrelic-sysmond.
(Reading database ... 302046 files and directories currently installed.)
Unpacking newrelic-sysmond (from .../newrelic-sysmond_1.2.0.257_amd64.deb) ...
Processing triggers for ureadahead ...
ureadahead will be reprofiled on next reboot
Setting up newrelic-sysmond (1.2.0.257) ...
Adding system user &lt;code&gt;newrelic' (UID 117) ...
Adding new group&lt;/code&gt;newrelic' (GID 129) ...
groupadd: cannot lock /etc/group; try again later.
adduser: &lt;code&gt;/usr/sbin/groupadd -g 129 newrelic' returned error code 10. Exiting.
chown: invalid group:&lt;/code&gt;root:newrelic'
chown: invalid user: `newrelic:newrelic'
Unknown id: newrelic&lt;/p&gt;

&lt;p&gt;按照官方网上的教程安装的，&lt;a href="https://newrelic.com/docs/server/server-monitor-installation-ubuntu-and-debian" rel="nofollow" target="_blank"&gt;https://newrelic.com/docs/server/server-monitor-installation-ubuntu-and-debian&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;使 deb 包安装也是一样&lt;/p&gt;</description>
      <author>johnlu</author>
      <pubDate>Thu, 06 Jun 2013 15:55:15 +0800</pubDate>
      <link>https://ruby-china.org/topics/11544</link>
      <guid>https://ruby-china.org/topics/11544</guid>
    </item>
    <item>
      <title>ssh 自动断开后,再也连接不上</title>
      <description>&lt;p&gt;A 主机 ssh 连接到 B 主机，当空闲一段时间后连接自动断开，提示&lt;code&gt;Write failed: Broken pipe&lt;/code&gt;
在 A 主机重新连接，却提示&lt;code&gt;ssh: connect to host 192.168.1.228 port 22: Connection refused&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;A 主机进程：
&lt;code&gt;1722 ?         00:00:00 ssh-agent&lt;/code&gt;
 &lt;code&gt;9165 ?        00:00:00 sshd&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;B 主机进程：
&lt;code&gt;639 ?        00:00:00 sshd&lt;/code&gt;
&lt;code&gt;2837 ?        00:00:00 sshd&lt;/code&gt;
在 B 主机查看：who
&lt;code&gt;root    pts/1    2013-01-24  15:14  (192.168.1.178)&lt;/code&gt;  #A 主机的 IP&lt;/p&gt;

&lt;p&gt;在 B 主机 ssh 连接 A 主机后，A 主机就能正常连接 B 主机，
这是为什么呢？&lt;/p&gt;</description>
      <author>johnlu</author>
      <pubDate>Thu, 24 Jan 2013 15:29:47 +0800</pubDate>
      <link>https://ruby-china.org/topics/8327</link>
      <guid>https://ruby-china.org/topics/8327</guid>
    </item>
    <item>
      <title>Cucumber+Capybara 做自动化测试登录的问题</title>
      <description>&lt;p&gt;用 Cucumber+Capybara 做自动化测试;
但是首先要进行登录，那么在写 Scenario 时每个 Scenario 都要有登录的步骤，如果有 100 个 Scenario 的话，就要登录 100 次了；&lt;/p&gt;

&lt;p&gt;有没有什么方法可以只登录一次，其它的 Scenario 就不用登录了呢？&lt;/p&gt;

&lt;p&gt;我尝试用 backgrounds，但是实际上也是执行每个 Scenario 前都会执行 backgrounds 的步骤；用 hooks 也一样；&lt;/p&gt;</description>
      <author>johnlu</author>
      <pubDate>Wed, 16 Jan 2013 16:43:53 +0800</pubDate>
      <link>https://ruby-china.org/topics/8119</link>
      <guid>https://ruby-china.org/topics/8119</guid>
    </item>
  </channel>
</rss>
