<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>lufeihaidao (Wulfric Wang)</title>
    <link>https://ruby-china.org/lufeihaidao</link>
    <description></description>
    <language>en-us</language>
    <item>
      <title>Floobits: Atom 的结对编程工具</title>
      <description>&lt;p&gt;&lt;a href="https://github.com/Floobits/floobits-atom" rel="nofollow" target="_blank"&gt;https://github.com/Floobits/floobits-atom&lt;/a&gt;
当然也支持 sublime text, vim, emacs&lt;/p&gt;</description>
      <author>lufeihaidao</author>
      <pubDate>Tue, 20 Oct 2015 16:09:48 +0800</pubDate>
      <link>https://ruby-china.org/topics/27754</link>
      <guid>https://ruby-china.org/topics/27754</guid>
    </item>
    <item>
      <title>GitHub Page 的博客如何让 Google 收录？</title>
      <description>&lt;p&gt;我用 Jekyll 搭了一个博客，同时绑定了域名。Google analytics 和 Google 网站站长工具都提交了该域名。依旧没有收录。&lt;/p&gt;

&lt;p&gt;是否需要把 xxx.github.io 的域名也提交到 Google 站长工具？&lt;/p&gt;</description>
      <author>lufeihaidao</author>
      <pubDate>Fri, 17 Oct 2014 17:30:43 +0800</pubDate>
      <link>https://ruby-china.org/topics/22097</link>
      <guid>https://ruby-china.org/topics/22097</guid>
    </item>
    <item>
      <title>类似于 Google 二次验证的服务是如何做的？</title>
      <description>&lt;p&gt;逻辑：&lt;/p&gt;

&lt;p&gt;当登录的时候，判断该设备是否曾经登录过。如果是，允许登录；否则，需要通过手机验证之后才能登录&lt;/p&gt;

&lt;p&gt;主要分为两块：&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;设备唯一性的识别：手机有设备 ID，比较方便，PC 一般是怎样标识唯一性的？UA IP 都不靠谱，普通的 cookie 受限于浏览器。stackoverflow 上说到 Google 使用 flash cookie 结合 local shared object。有人这样做过吗？&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;手机验证，国内有没有比较安全的提供手机验证的工具和平台？（相对于 Google 的 APP 二次验证，手机验证码验证可以少安装一个 APP）&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;我注意到，用 steam 登录的时候，如果从未使用该 PC 登录过，会要求你邮箱验证。但当我在网吧登录过一次之后，再次去这家网吧就可以直接 steam 登录了，它是如何识别我的？&lt;/p&gt;

&lt;p&gt;----------------------------------------------------------更新分割线---------------------------------------------------------------&lt;/p&gt;

&lt;p&gt;代码基本完成了。已有问题是这样解决的：&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;用 cookie。移动端则是设备 ID 号&lt;/li&gt;
&lt;li&gt;暂时不用手机 APP 验证，而采用短信验证&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;相关的设计见我的博文：&lt;a href="http://wulfric.me/2014/09/design-of-sms-verification/" rel="nofollow" target="_blank" title=""&gt;短信验证的设计&lt;/a&gt;&lt;/p&gt;</description>
      <author>lufeihaidao</author>
      <pubDate>Mon, 07 Jul 2014 20:22:14 +0800</pubDate>
      <link>https://ruby-china.org/topics/20362</link>
      <guid>https://ruby-china.org/topics/20362</guid>
    </item>
    <item>
      <title>mysql 更改表：在有数据的情况下新增一列 uniq column 的问题</title>
      <description>&lt;pre class="highlight plaintext"&gt;&lt;code&gt;+-------------------+---------------------+                       
|                   |                     |                       
|    column1        |      column2        |                       
|                   |                     |                       
+-----------------------------------------+                       
|                   |                     |                       
+-----------------------------------------+                       
|                   |                     |                       
+-----------------------------------------+                       
|                   |                     |                       
+-------------------+---------------------+                       
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;如图所示的一个表格，已经有了一些数据，我想新增一列 unique column3，步骤是 1：新增一列 column3；2：改 column3 为 unique。（当然直接 add column unique 也是可以的）&lt;/p&gt;

&lt;p&gt;如果 column3 可以是 null，那么这不会有什么问题。&lt;/p&gt;

&lt;p&gt;问题是，我需要 column3 是 not null 的，这样我先添加 column3, 默认值是 '', 再改 column3 为 unique 的时候，mysql 就会报错（数据的 column3 都是 ''）&lt;/p&gt;

&lt;p&gt;这样的问题一般如何解决？&lt;/p&gt;</description>
      <author>lufeihaidao</author>
      <pubDate>Wed, 18 Jun 2014 14:06:26 +0800</pubDate>
      <link>https://ruby-china.org/topics/20022</link>
      <guid>https://ruby-china.org/topics/20022</guid>
    </item>
    <item>
      <title>html 编辑器的内容上传后应该做哪些工作？</title>
      <description>&lt;p&gt;先问下大家用的是哪种富文本编辑器？我选了个 redactor（我觉得 ckeditor 太重）&lt;/p&gt;

&lt;p&gt;这些编辑器上传的应该都是 html 内容的字符串。对于日志/博客这种内容，应该允许到什么程度的自定义呢？换句话说，应该禁止出现哪些 html tag？（script tag 是必然要 ban 的）除此之外，经由 redactor 编辑的内容还会包含 style float 等属性，这些我不太确定是否应该去掉。删掉吧，有些东西不太好实现，比如居中，图片在文字左或者右等；不删吧，要是用户给出很复杂的结构也不太好。大家是怎么处理的？&lt;/p&gt;

&lt;p&gt;到实现上，在 rails 中是用 &lt;code&gt;sanitize(content)&lt;/code&gt; 来清理 html 字符串的，但是如果我只想清除 script 标签的话，配置好麻烦，要把所有我不想删除的标签都写出来，有没有比较简便的方法？&lt;/p&gt;</description>
      <author>lufeihaidao</author>
      <pubDate>Mon, 02 Dec 2013 21:28:28 +0800</pubDate>
      <link>https://ruby-china.org/topics/15951</link>
      <guid>https://ruby-china.org/topics/15951</guid>
    </item>
    <item>
      <title>Rails 的 controller 中如何处理图片路径？</title>
      <description>&lt;p&gt;背景是这样的：假设存在一张 200＊200 的纯白图片（可以在 public 文件夹下，也可以在 app/asset/images 文件夹下），在某个 controller 的方法中，需要用 mini_magick 读取这个文件，并根据用户的输入（比如 (line 0,0,100,100) 就是画出一条 (0,0) 到 (100,100) 的连线），生成一幅图片，并保存。&lt;/p&gt;

&lt;p&gt;但是，在 controller 里不能用 views 里常用的 image_path 之类的方法，怎样得到图片的正确路径并正确保存呢？&lt;/p&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;HomeController&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="no"&gt;ApplicationController&lt;/span&gt;
  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;show&lt;/span&gt;
    &lt;span class="n"&gt;image&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;MiniMagick&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;Image&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="n"&gt;get_image_path&lt;/span&gt; &lt;span class="s2"&gt;"sample.jpg"&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;image&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;draw&lt;/span&gt; &lt;span class="s2"&gt;"line 0,0,100,100"&lt;/span&gt;
    &lt;span class="n"&gt;image&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;save&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="n"&gt;to_the_asset_path&lt;/span&gt; &lt;span class="s2"&gt;"test1.jpg"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;代码的样子大概是这样的，请问怎样在 controller 里访问图片？&lt;/p&gt;</description>
      <author>lufeihaidao</author>
      <pubDate>Sat, 15 Jun 2013 23:34:22 +0800</pubDate>
      <link>https://ruby-china.org/topics/11746</link>
      <guid>https://ruby-china.org/topics/11746</guid>
    </item>
    <item>
      <title>请问这里有人参加过启程日本的项目吗？</title>
      <description>&lt;p&gt;&lt;a href="http://www.workinjapan.cn/" rel="nofollow" target="_blank" title=""&gt;启程日本&lt;/a&gt; 项目就是中日双方的人力公司以中国方的公司为代表到中国招聘应届毕业生的。&lt;a href="http://www.workinjapan.cn/list.html" rel="nofollow" target="_blank" title=""&gt;这里&lt;/a&gt; 是今年的招聘列表，但是我看了下，不少公司好像企业文化都挺严肃的，正装加班非自由工作制等。一些公司：&lt;a href="http://www.workinjapan.cn/company12378.html" rel="nofollow" target="_blank" title=""&gt;DeNA&lt;/a&gt;; &lt;a href="http://www.workinjapan.cn/company12380.html" rel="nofollow" target="_blank" title=""&gt;Drecom&lt;/a&gt;。&lt;/p&gt;

&lt;p&gt;请问对于日本 IT 比较熟悉的同学有什么意见和建议？ &lt;a href="/ashchan" class="user-mention" title="@ashchan"&gt;&lt;i&gt;@&lt;/i&gt;ashchan&lt;/a&gt; &lt;a href="/donnior" class="user-mention" title="@donnior"&gt;&lt;i&gt;@&lt;/i&gt;donnior&lt;/a&gt; &lt;a href="/hlxwell" class="user-mention" title="@hlxwell"&gt;&lt;i&gt;@&lt;/i&gt;hlxwell&lt;/a&gt; &lt;a href="/zhangjingqiang" class="user-mention" title="@zhangjingqiang"&gt;&lt;i&gt;@&lt;/i&gt;zhangjingqiang&lt;/a&gt; 随便 at 几个那个帖子里的人希望不会打扰到你们：）&lt;/p&gt;

&lt;p&gt;要是 cookpad 也在这个项目里就好了……我第一志愿肯定是这个了&lt;/p&gt;

&lt;p&gt;还有请问下列表中的公司你们怎么看呀，比如 DeNA Drecom Yahoo Japan&lt;/p&gt;</description>
      <author>lufeihaidao</author>
      <pubDate>Sun, 09 Jun 2013 10:41:05 +0800</pubDate>
      <link>https://ruby-china.org/topics/11602</link>
      <guid>https://ruby-china.org/topics/11602</guid>
    </item>
    <item>
      <title>怎样在 rails 的 view 中调用 .coffee 中的函数</title>
      <description>&lt;pre class="highlight plaintext"&gt;&lt;code&gt;%button.btn.btn-primary{onclick: "test()"} submit

.test 
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;我的 view 中（production 模型的 new.html.haml）包含这样一段代码；在 productions.js.coffee 中则包含&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;test = -&amp;gt;
  $(".test").append("test")
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;这样的代码，似乎由于 coffee 自动闭包的特性，当点击按钮时提示 &lt;code&gt;Uncaught ReferenceError: test is not defined&lt;/code&gt; ，当我把这段代码放到 application.js 中时，则可以成功。（这个编译后的 producitons.js 是存在的，可以找到，但是加了闭包）&lt;/p&gt;</description>
      <author>lufeihaidao</author>
      <pubDate>Thu, 16 May 2013 14:25:16 +0800</pubDate>
      <link>https://ruby-china.org/topics/11029</link>
      <guid>https://ruby-china.org/topics/11029</guid>
    </item>
    <item>
      <title>用不了 scss 的变量和 mixin 一般是什么原因？</title>
      <description>&lt;p&gt;用的是 bootstrap-sass gem，css 可以用，但是变量和 mixin 都无效，请问是一般是什么原因？&lt;/p&gt;</description>
      <author>lufeihaidao</author>
      <pubDate>Sun, 21 Apr 2013 22:06:38 +0800</pubDate>
      <link>https://ruby-china.org/topics/10390</link>
      <guid>https://ruby-china.org/topics/10390</guid>
    </item>
    <item>
      <title>如何从头开始做一个地图</title>
      <description>&lt;p&gt;这么说或许不够明确，那么假设这样的场景：&lt;/p&gt;

&lt;p&gt;我想在杭州市这一范围内，给定两个（经纬度）点后，我自己去做路径导航（只考虑机动车道）。当然，现在的地图 api 都可以做到，但我需要的是自己按照自己的算法（其实我是想研究下这些算法，同时能够演示）。那么我就需要一个地图，我拥有这个地图的数据（基础的就是所有的机动车道和其交叉点），请问这种地图从何得到？&lt;/p&gt;

&lt;p&gt;不知道在这里问能不能得到答案&lt;/p&gt;</description>
      <author>lufeihaidao</author>
      <pubDate>Thu, 18 Apr 2013 20:45:58 +0800</pubDate>
      <link>https://ruby-china.org/topics/10317</link>
      <guid>https://ruby-china.org/topics/10317</guid>
    </item>
    <item>
      <title>你们 Ubuntu 用什么桌面管理工具？</title>
      <description>&lt;p&gt;作为从 11.10 开始的用户，刚接触的时候肯定是 unity，后来接触到 gnome，今天刚刚装了下 KDE，感觉 KDE 比 gnome 好多了。不知道对于现在的版本来说，KDE 和 gnome 的优缺点都有那些（网上的比较老）？&lt;/p&gt;

&lt;p&gt;另外还有没有比较好的桌面？优点是什么？&lt;/p&gt;</description>
      <author>lufeihaidao</author>
      <pubDate>Thu, 04 Apr 2013 00:18:07 +0800</pubDate>
      <link>https://ruby-china.org/topics/9953</link>
      <guid>https://ruby-china.org/topics/9953</guid>
    </item>
    <item>
      <title>ruby 字符串的一些操作问题</title>
      <description>&lt;p&gt;给定一个字符串 s="......"，大概好几千的字符的样子&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;ruby 怎样像 python 那样，依靠 s[i::5] 可以从第 i 个字符开始每隔 5 个重新构成一个字符串。我能想到的是： &lt;code&gt;s.each_char.with_index{|c,idx| another_s&amp;lt;&amp;lt;c if idx%5==i}&lt;/code&gt;，不知有没有简洁的方法&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;假如 s 长度为 1000，怎样在每 100 个字符后添加一个 "\n"，重新构成一个长为 1010 的字符串？&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;</description>
      <author>lufeihaidao</author>
      <pubDate>Fri, 29 Mar 2013 16:53:29 +0800</pubDate>
      <link>https://ruby-china.org/topics/9846</link>
      <guid>https://ruby-china.org/topics/9846</guid>
    </item>
    <item>
      <title>vim vundle 更新插件需要 github 帐号密码，什么原因？</title>
      <description>&lt;p&gt;&lt;img src="//l.ruby-china.com/photo/f066bce46090447912f42afd169627ea.png" title="" alt=""&gt;&lt;/p&gt;

&lt;p&gt;如图所示。更新 vim-slim 插件时说要 github 的帐号和密码。我直接 git clone 是可以成功的，怎么在这里更新就不行了呢？&lt;/p&gt;</description>
      <author>lufeihaidao</author>
      <pubDate>Thu, 28 Mar 2013 15:25:09 +0800</pubDate>
      <link>https://ruby-china.org/topics/9814</link>
      <guid>https://ruby-china.org/topics/9814</guid>
    </item>
    <item>
      <title>ruby 读取大段文本</title>
      <description>&lt;p&gt;新手。做题目的时候试着用 ruby 读取大段文本。我是在 pry 中尝试的。首先尝试用 gets，理所当然的失败了，因为大段文本中含有换行符。搜了下，发现可以这样：&lt;code&gt;gets = &amp;lt;&amp;lt;'EOF'&lt;/code&gt;，然后结束的时候输入&lt;code&gt;EOF&lt;/code&gt;就行了。但是我发现复制的一大段文本只粘贴了一小部分。后来看到可以 &lt;code&gt;ARGF.read&lt;/code&gt;，但是我输入之后不知道如何结束输入，请问用 ARGF 读取字符串的方法&lt;/p&gt;

&lt;p&gt;追加问题：
我在编辑器中进行了。
在 python 里可以用三个引号扩起包括换行符的字符串，ruby 也可以，但似乎不太一样：这段字符串包含许多特殊字符，大中小括号啊什么的，ruby 会出错（我猜是 ruby 进入字符串判断括号的匹配了？），而 python 不会出错。
在编辑器中，使用&lt;code&gt;= &amp;lt;&amp;lt;'EOF'&lt;/code&gt;的方法是可以正确读取字符串的。请问 ruby 这几种读取多行字符串的区别？&lt;/p&gt;</description>
      <author>lufeihaidao</author>
      <pubDate>Thu, 14 Mar 2013 00:05:58 +0800</pubDate>
      <link>https://ruby-china.org/topics/9397</link>
      <guid>https://ruby-china.org/topics/9397</guid>
    </item>
    <item>
      <title>markdown 能用 html 包裹 md 格式的内容吗？怎样做？</title>
      <description>&lt;p&gt;比如 markdown 这样的内容：&lt;/p&gt;

&lt;p&gt;h2: ##XXX
li: * XX
li: * XX&lt;/p&gt;

&lt;p&gt;h2
paragraph&lt;/p&gt;

&lt;p&gt;h2
paragraph&lt;/p&gt;

&lt;p&gt;我想给 paragraph 做格式，于是用 &amp;lt;div class="paragraph" markdown="1"&amp;gt;paragraph&amp;lt;/div&amp;gt;
把 paragraph 包裹起来，可是包裹起来后，像 * 的列表项表示和空行的分段都失去作用了，这是为什么？ps：``` 表示的代码区的格式没有失去作用&lt;/p&gt;

&lt;p&gt;我是在网上看到可以加 markdown="1" 的，可是并没有解决，请问有没有解决的办法？&lt;/p&gt;</description>
      <author>lufeihaidao</author>
      <pubDate>Sun, 16 Dec 2012 23:05:51 +0800</pubDate>
      <link>https://ruby-china.org/topics/7618</link>
      <guid>https://ruby-china.org/topics/7618</guid>
    </item>
    <item>
      <title>vim 有批量修改 (多重选取) 的插件吗？</title>
      <description>&lt;p&gt;比如这样：&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;item1, item2
something else, item3
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;改成&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;item 1, item 2
something else, item 3
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;在 sublime 里按住 ctrl 点击鼠标可以实现，在 vim 里怎么实现？&lt;/p&gt;
&lt;h2 id="update in 20130705"&gt;update in 20130705&lt;/h2&gt;
&lt;p&gt;偶然找到了，&lt;a href="https://github.com/terryma/vim-multiple-cursors" rel="nofollow" target="_blank" title=""&gt;vim-multiple-cursors&lt;/a&gt; 插件可以完成这个目的&lt;/p&gt;</description>
      <author>lufeihaidao</author>
      <pubDate>Fri, 14 Dec 2012 00:09:07 +0800</pubDate>
      <link>https://ruby-china.org/topics/7549</link>
      <guid>https://ruby-china.org/topics/7549</guid>
    </item>
    <item>
      <title>通过 github 注册的帐号没法用头像吗？</title>
      <description>&lt;p&gt;我是用 github 注册的帐号，在个人资料修改页面头像附近说点击去 gravatar 更改头像，但是我的 gravatar 已经有头像了，而个人资料的邮箱是和 github 有关但是却无效（？）的邮箱，无法绑定我的 gravatar 邮箱，是不是说这种注册方式就无效了？&lt;/p&gt;

&lt;p&gt;PS：我的 github 的头像显示正常的&lt;/p&gt;</description>
      <author>lufeihaidao</author>
      <pubDate>Wed, 12 Dec 2012 23:13:08 +0800</pubDate>
      <link>https://ruby-china.org/topics/7509</link>
      <guid>https://ruby-china.org/topics/7509</guid>
    </item>
    <item>
      <title>linux 下如何删除外部文件夹？</title>
      <description>&lt;p&gt;比如说，在一个目录下有个文件夹叫 folder，在 folder 里还有个文件夹叫 folder。怎样删除外部的 folder，让里面的 folder 到外面来？&lt;/p&gt;</description>
      <author>lufeihaidao</author>
      <pubDate>Sun, 04 Nov 2012 22:57:18 +0800</pubDate>
      <link>https://ruby-china.org/topics/6529</link>
      <guid>https://ruby-china.org/topics/6529</guid>
    </item>
  </channel>
</rss>
