<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
 
 <title>知易行难</title>
 <link href="http://blog.ashchan.com/feed" rel="self"/>
 <link href="http://blog.ashchan.com/"/>
 <updated>2010-06-01T16:21:03+08:00</updated>
 <id>http://blog.ashchan.com/</id>
 <author>
   <name>James Chan</name>
   <email>ashchan@gmail.com</email>
 </author>
 
 
 <entry>
   <title>消息一枚:东渡工作</title>
   <link href="http://blog.ashchan.com/archive/2010/06/01/going-to-japan/"/>
   <updated>2010-06-01T00:00:00+08:00</updated>
   <id>http://blog.ashchan.com/archive/2010/06/01/going-to-japan</id>
   <content type="html">&lt;p&gt;几年来我一直在做 freelancing ，接的项目基本上都是 Rails 工程。虽然收入会有起伏，工作上也难免会有大大小小的烦恼，但比起窝在办公司里全职上班要舒服很多。我有更多的时间看书，学习感兴趣的东西，结交不同行业的新朋友，参加有意义的社区活动; 最重要的是，有更多的机会看着儿子出生、一天天调皮的长大。&lt;/p&gt;

&lt;p&gt;因着 twitter 和 mac 开发，我结识了 &lt;a href=&quot;http://twitter.com/xu_lele&quot;&gt;乐乐 @xu_lele&lt;/a&gt; 和 &lt;a href=&quot;http://twitter.com/xuzhe&quot;&gt;徐哲 @xuzhe&lt;/a&gt;。他们在日本创业，公司 &lt;a href=&quot;http://www.rakuraku-inc.com/&quot;&gt;Rakuraku Technologies, Inc.&lt;/a&gt; 目前主要从事教育行业 iPhone/iPad 软件开发和互联网应用开发。我们非常谈得来，我也慢慢的有了加入他们去日本全职工作的想法。&lt;/p&gt;

&lt;p&gt;在乐乐及其夫人 &lt;a href=&quot;http://twitter.com/xiaoxiaojing&quot;&gt;@xiaoxiaojing&lt;/a&gt; 的帮助下，终于在半个月前获得了一年期的技术在留资格并于昨天拿到签证。&lt;/p&gt;

&lt;p&gt;今天我开心的告诉大家，我要东渡日本工作了。过去的三个月等在留资格的同时，我辞去了 &lt;a href=&quot;http://www.theplant.jp&quot;&gt;The Plant&lt;/a&gt; 的兼职，交割了手上的客户项目。现在我可以停止 freelance 工作，开始投入新的全职工作中去了。&lt;/p&gt;

&lt;p&gt;到了日本后我会停止接受 remote work，但是如果您是我的以往客户（如果是的话那么90%的机率您看不懂这篇中文文章，哈）并有新项目的话，我可以向您推荐其他非常出色的 Ruby/Rails/iPhone 开发者。&lt;/p&gt;

&lt;p&gt;最后，我要谢谢很多人。&lt;/p&gt;

&lt;p&gt;首先我要感谢国家！！！&lt;/p&gt;

&lt;p&gt;谢谢父母的理解。我是一个喜欢待在家里的人，但高中后一直选择漂的生活。&lt;/p&gt;

&lt;p&gt;谢谢乐乐和徐哲，我很开心加入你们从事自己喜欢的开发工作。谢谢乐乐夫人不辞辛苦为我办理在留、住房及其他琐事！&lt;/p&gt;

&lt;p&gt;谢谢我的妻子和儿子，我要暂时离开你们。我相信为了更美好的明天，暂时告别去往完全陌生的地方从头开始打拼是完全值得的。&lt;/p&gt;

&lt;p&gt;谢谢 The Plant 及各位同事。这份兼职工作不仅让我在自由工作的同时更好的养活自己，更重要的是，公司里的这帮家伙，我真的喜欢跟你们共事！&lt;/p&gt;

&lt;p&gt;也谢谢我那些劝我别去日本和鼓励我去日本的朋友。&lt;/p&gt;

&lt;p&gt;最后我要感谢国家！！！&lt;/p&gt;

&lt;p&gt;PS. 因相关知识匮乏，恕不接受技术签证、在留资格等相关问题咨询，请见谅。&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>如何轻松慢跑5公里</title>
   <link href="http://blog.ashchan.com/archive/2010/04/21/running-the-way/"/>
   <updated>2010-04-21T00:00:00+08:00</updated>
   <id>http://blog.ashchan.com/archive/2010/04/21/running-the-way</id>
   <content type="html">&lt;p&gt;近来朋友中开始跑步锻炼的人越来越多了。我从去年秋天开始慢跑，锻炼两个月后（每周三次左右）能够不间断跑5公里，这在之前是自己不敢想象的。学生时代我就非常厌烦跑步，觉得这是一种既枯燥乏味又很辛苦折磨人的锻炼方式。临近30岁（现在已经30出头了，哈），突然发现自己喜欢的其他运动或锻炼方式（滑板，篮球）要么就是凑不到伙伴一起玩，要不就是太受条件限制无法坚持。&lt;/p&gt;

&lt;p&gt;稍作“研究”后我发现慢跑是一种比较合适的体育锻炼方式──只要我能克服自己对它的无端厌烦情绪──有氧运动，不容易受伤，受条件限制少（主要是天气，下面会说到），既可以一个人玩也可以几个朋友一起进行、资金投入也不多。&lt;/p&gt;

&lt;p&gt;跟其他任何事情一样，一个劲猛的扎进去不一定会失败，但也不大可能成功。我以前其实也尝试跑步过，但都没有坚持。念书的时候，学校离海边只有一公里多远，每天早上有很多漂亮健康的女生跑步去海边。有一阵子我觉得跑步很爽啊，又锻炼身体又能与美女同行。于是我也开始跑，跑了之后养成了一个好习惯：早上要是起得来（我一般睡懒觉），我就跟着她们往海边跑，然后在学校门外的早餐铺里停下来喝豆浆吃油条，吃完了美女们就从海边跑回来了，我再跟跑回学校。&lt;/p&gt;

&lt;p&gt;我现在孩子都快能打酱油了，当然不能再做这种荒唐事了。为了保证锻炼效果，查阅了一些资料后，我决定照着一种在国外很流行的慢跑计划来训练，这种方式叫 C25K。&lt;/p&gt;

&lt;p&gt;C25K 的全称是 Couch to 5K Plan，可以参考&lt;a href=&quot;http://www.c25k.com&quot;&gt;这个网站&lt;/a&gt;（上面有中文翻译的链接）。Couch 不是教练的意思，而是沙发的意思。相信我，照着这份训练计划，即便你现在连 500 米也跑不动，只要坚持三个月，你也能够轻松地一口气跑 3-5 公里。&lt;/p&gt;

&lt;p&gt;我不详细介绍 C25K 计划的训练表，而是谈谈我自己的心得：&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;循序渐进，严格按照计划进行，千万不要觉得自己是超人，一开始就想跑几公里。&lt;/li&gt;
&lt;li&gt;做好热身运动（快步走），防止受伤。&lt;/li&gt;
&lt;li&gt;每次跑完后再步行走一会，这跟热身一样重要。&lt;/li&gt;
&lt;li&gt;可以在跑时听音乐或想事情，以防止心理疲劳，但一定要小心跑道或道路状况。（我前两个月是听 C25K 的 podcast 来进行的，这样可以边吃音乐边接受锻炼提示）&lt;/li&gt;
&lt;li&gt;坚持，隔一天跑一次是比较合适的频度。跑得次数少了效果要打折扣。&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;到目前为止，我可以很轻松地跑 5-6 公里，时间为 35-40 分钟，即 pace（跑速）为每公里6分钟左右。我不想刻意去跑得更快，因为那不是我的目标。也不想刻意去增加距离（元旦那天跑了 10 公里庆祝新年），毕竟只是锻炼身体，而且跑到 6 公里以上就会觉得比较无聊。遇到连续天气晴好，我一周能跑 2-4 次。个人感觉天气是影响跑步锻炼的最大因素。春节到现在因为经常下雨，加上琐事较多，跑得并不勤快。希望慢慢能再恢复到隔一天跑一次。&lt;/p&gt;

&lt;p&gt;关于装备，最重要的是有一双合适的鞋子。我还在使用 Nike+ 腕表计时，所以穿的是 Nike+ 的跑鞋。很多朋友推荐 Asics 的跑鞋，下次也弄一双穿。&lt;/p&gt;

&lt;p&gt;另外，分享和交流也是促使自己坚持的动力。&lt;a href=&quot;http://www.dailymile.com&quot;&gt;dailymile&lt;/a&gt; 是一个很不错的运动社交网站，在上面可以记录你的每一次锻炼情况，并与朋友交流，甚至是参加虚拟比赛。它还支持直接从 Nike+ 同步数据。我希望 dailymile 早点增加对 runkeeper 的支持，这样下次升级 iPhone 后可以使用 runkeeper 来记录了。我的 dailymile profile 是 &lt;a href=&quot;http://www.dailymile.com/people/ashchan&quot;&gt;http://www.dailymile.com/people/ashchan&lt;/a&gt;，欢迎大家加我为好友，一起进步：）&lt;/p&gt;

&lt;p&gt;连着下雨天气，已经一周没跑动。今天下午似乎天气会好些，又可以去锻炼一下了。&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>又至一年总结时</title>
   <link href="http://blog.ashchan.com/archive/2009/12/27/2010-approaching/"/>
   <updated>2009-12-27T00:00:00+08:00</updated>
   <id>http://blog.ashchan.com/archive/2009/12/27/2010-approaching</id>
   <content type="html">&lt;p&gt;窗外飘着渐大的雪花，2010 马上就到了。年终嘛，似乎总该有些回顾。&lt;/p&gt;

&lt;p&gt;又是平平常常的一年，对我说来，也是奔三踏入中年人行列的一年。&lt;/p&gt;

&lt;p&gt;儿子满周岁了，长得胖胖的。很淘气，他奶奶天天照看一整天，还要管其他家务活，真的非常辛苦。孩子他妈也没闲着，白天上班，晚上哄儿子，后半夜要起来两趟喂奶或换尿布; 早上儿子起得很早，老婆就跟着起来，打点好一切。两位母亲，你们辛苦了。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.flickr.com/photos/ashchan/4217797850/&quot;&gt;&lt;img src=&quot;http://farm3.static.flickr.com/2577/4217797850_cefe230ecd.jpg&quot; alt=&quot;豆豆、奶奶和妈妈&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;年纪一大，明显感觉体能不如以前了。滑板是玩不起来了，篮球也很难凑到足够的朋友一起打。于是乎开始了以前觉得很无聊的运动，跑步。照着 &lt;a href=&quot;http://www.c25k.com/&quot;&gt;couch to 5k&lt;/a&gt; 计划跑了一个多月，居然也能每次跑 5KM 了。一周跑三次左右，每次跑都用 &lt;a href=&quot;http://my.nike.com/ashchan&quot;&gt;nike plus&lt;/a&gt; 记录下来。&lt;/p&gt;

&lt;p&gt;还买了辆捷安特山地车，几个好友逢周末天气好又有空便去西湖附近或钱塘江边溜达一圈。可惜现在是冬天了，不大适合骑车。等来年春上了，一定要多出去骑几趟。&lt;/p&gt;

&lt;p&gt;工作上还比较顺心。继续 freelance ，接了几个小项目。&lt;a href=&quot;http://theplant.jp&quot;&gt;ThePlant&lt;/a&gt; 来杭州建了个团队，我以兼职的身份加入了。这是个很有活力的 team ，几乎纯技术，由几个 Linux geek ，Vim 控和苹果 fan 组成。目前使用的工具嘛，无非是我们都大爱的 Ruby, Rails, Merb 之类。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.flickr.com/photos/ashchan/4217125391/&quot;&gt;&lt;img src=&quot;http://farm3.static.flickr.com/2761/4217125391_6a247b82e8.jpg&quot; alt=&quot;theplant&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;起初每周三次去公司办公室上班，路上开车路程为 25 公里左右，不过由于杭州是东方小堵城，经常要开上一个多小时 (大部分时间是停在那的)。晚上回到家儿子一般都已经睡着了。老板和领导非常体贴，允许我国庆后改为在家工作，自由安排时间。这样，不用再受塞车之苦，原先路上浪费的时间还可以转化为看书和跑步。目前我的工作情况是，70% 远程供职于 ThePlant ，剩余时间偶尔自己接一些小项目做。很满意现状。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.flickr.com/photos/ashchan/3932454519/&quot;&gt;&lt;img src=&quot;http://farm3.static.flickr.com/2552/3932454519_541133bd53.jpg&quot; alt=&quot;在家办公&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;每周在家写程序的时间为 60% 左右，剩余的时间在图书馆蹭空调。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.flickr.com/photos/ashchan/4217984298/&quot;&gt;&lt;img src=&quot;http://farm5.static.flickr.com/4054/4217984298_357148fbab.jpg&quot; alt=&quot;萧山图书馆&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;这一年参加了数次上海和杭州的 Ruby 活动，认识了很多国内外的 Ruby 开发者。社区越来越壮大，这种现象很好。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://ashchan.com/projects/gmail-notifr&quot;&gt;Gmail Notifr&lt;/a&gt; 开发到比较稳定的阶段了，虽然还有些小问题，也有些尚待加入的功能，但基本上不大更新了。iPhone 开发一直停留在学习阶段，没有做出点东西来。倒是认识了一些这个行业中做得很不错的朋友。希望明年有机会可以做点东西吧，但愿。&lt;/p&gt;

&lt;p&gt;2010 年的一些小愿望：&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;儿子健康成长，少生病。父母和老婆身体健康生活快乐。&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;坚持跨步锻炼，目前来看，一年跑 1000KM 这么点距离对我来说尚难完成 (这个月因为感冒就停了十来天，下雨什么的话也不容易出去运动，这么一来要所保证隔一天跑一次还是比较困难的)。&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;多看些书，在 &lt;a href=&quot;http://tinyurl.com/ya6ujbt&quot;&gt;kindle&lt;/a&gt; 上读 10 本以上英文小说 (刚购买了 twilight 的前两本)。如果有可能，考个雅思什么的。不过不作强制规划。&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;出去旅游几趟，远近皆可。&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;带老婆孩子去看看姥姥姥爷。&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;工作顺利。保持对 Ruby 的热情，iPhone 和 Cocoa 开发能再深入一些。&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</content>
 </entry>
 
 <entry>
   <title>图书馆里的自由枪骑兵</title>
   <link href="http://blog.ashchan.com/archive/2009/12/01/freelancer-at-library/"/>
   <updated>2009-12-01T00:00:00+08:00</updated>
   <id>http://blog.ashchan.com/archive/2009/12/01/freelancer-at-library</id>
   <content type="html">&lt;p&gt;据说很多搞计算机的自由职业者 (freelancer，如独立程序员、设计师等) 喜欢在咖啡馆里工作。我去年有一段时间也去这种场所，后来感觉不舒服，今年就改成周二至周五下午 ── 图书馆周一休息 ── 在萧山图书馆打发了。&lt;/p&gt;

&lt;p&gt;相比咖啡馆，在图书馆“工作”有诸多好处，试举个人体会几例。&lt;/p&gt;

&lt;p&gt;图书馆是免费的，不仅借书免费 (办借书证无需押金，所借的书过还书期限也不罚钱)，在阅览室或自习室找个边上带插座的位子用一天的电都没关系。更妙的是，馆外停车也不要钱。&lt;/p&gt;

&lt;p&gt;环境好，安静，无人抽烟。夏天和冬天有空调，而且即便开了空调也不会把所有门窗关严。这些对于我这种对噪音和空气不流通超级敏感的人来说真是感觉惬意。&lt;/p&gt;

&lt;p&gt;馆里经常有一些年轻漂亮的女孩子，阅览室的几个管理员MM就很可爱。养眼也是调节工作压力的好方式嘛。&lt;/p&gt;

&lt;p&gt;如果自己不带水，可以在奶茶吧台买一杯五六块钱的咖啡，以我的水平 ── 在家里冲雀巢的人能什么水平 ── 喝不出跟咖啡馆里动辄 30、40 元的有多大差别。&lt;/p&gt;

&lt;p&gt;累了可以找本杂志或图书看，甚至直接趴在桌上睡觉。(念大学时，在自习室里唯一会做的事就是睡觉）&lt;/p&gt;

&lt;p&gt;如果说有什么不足之处的话，那就是桌椅对于用笔记本的人来说不算太舒服，久坐会觉得累。另外，听音乐时也不能把脚搁桌上，哈哈。&lt;/p&gt;

&lt;p&gt;寒暑假时图书馆就不是适合去的地方了。学生放假，图书馆里每天都人爆满，要找个空位子都不容易，更别说找一张靠近电源插座的桌子了。&lt;/p&gt;

&lt;p&gt;PS: 提到咖啡馆，上次 &lt;a href=&quot;http://twitter.com/yedingding&quot;&gt;@yedingding&lt;/a&gt; 带 &lt;a href=&quot;http://twitter.com/rakuraku_j&quot;&gt;@rakuraku_j&lt;/a&gt; 和我去黄龙附近的一家 noname 店，布置的很舒适，顾客不多，算是杭州适合 freelancer 窝点的极佳之处。&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Preview Color Tool in Snow Leopard</title>
   <link href="http://blog.ashchan.com/archive/2009/09/20/preview-color-tool-in-snow-leopard/"/>
   <updated>2009-09-20T00:00:00+08:00</updated>
   <id>http://blog.ashchan.com/archive/2009/09/20/preview-color-tool-in-snow-leopard</id>
   <content type="html">&lt;p&gt;I used the Preview Color Tool a lot in Leopard, mainly for picking color from an image. For reason unknown Apple has removed the Color Tool menu from Preview.app in Snow Leopard. Since the Annotations Tool also uses the color we can still show the Colors Pane, here's how:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;If the Annotations Toolbar is hidden, show it by View → Show Annotations Toolbar (shortcut: command-shift-A).&lt;/li&gt;
&lt;li&gt;Click Arrow (or Oval or Rectangle) to toggle on an annotation tool and enable the Color Menu icon.
&lt;div class=&quot;thumbnail&quot;&gt;&lt;a href=&quot;http://skitch.com/ashchan/b96mm/color-tool&quot;&gt;&lt;img src=&quot;http://img.skitch.com/20090920-fgsa1eyn91kjcpj8sujeee76pf.preview.jpg&quot; alt=&quot;color-tool&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Lucida Grande, Trebuchet, sans-serif, Helvetica, Arial; font-size: 10px; color: #808080&quot;&gt;Uploaded with &lt;a href=&quot;http://plasq.com/&quot;&gt;plasq&lt;/a&gt;'s &lt;a href=&quot;http://skitch.com&quot;&gt;Skitch&lt;/a&gt;!&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;Click the Color Menu icon to bring the Colors Pane up to front.&lt;/li&gt;
&lt;li&gt;Now do whatever you want to in the Colors Pane.&lt;/li&gt;
&lt;/ol&gt;

</content>
 </entry>
 
 <entry>
   <title>使用wake on lan远程唤醒</title>
   <link href="http://blog.ashchan.com/archive/2009/08/13/wake-on-lan-over-internet/"/>
   <updated>2009-08-13T00:00:00+08:00</updated>
   <id>http://blog.ashchan.com/archive/2009/08/13/wake-on-lan-over-internet</id>
   <content type="html">&lt;p&gt;客厅里的那台htpc，在无下片任务的时候，大部分时间里都在白白浪费电。主板是支持wake on lan的，把它弄成可以远程控制会比较经济。&lt;/p&gt;

&lt;p&gt;首先要设置bios，将电源管理下的 Wake On Lan (或叫PME Event Wake Up) 启用。&lt;/p&gt;

&lt;p&gt;然后在系统里对网卡进行设置(我的htpc跑的是windows xp sp2，网卡必须是支持Wake On Lan的，原本用的无线PCI网卡不支持，只好使用主板自带的网卡)，首先在&quot;高级&quot;中，将 Wake-On-Lan After Shutdown 的值设为 Enabled，将 Wake-On-Lan Capabilities 的值设为 Magick Packet:&lt;/p&gt;

&lt;div class=&quot;thumbnail&quot;&gt;&lt;a href=&quot;http://skitch.com/ashchan/b5fec/nic-advance&quot;&gt;&lt;img src=&quot;http://img.skitch.com/20090813-dkncuammpryh3tt14rr5qi26eq.preview.jpg&quot; alt=&quot;nic-advance&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Lucida Grande, Trebuchet, sans-serif, Helvetica, Arial; font-size: 10px; color: #808080&quot;&gt;Uploaded with &lt;a href=&quot;http://plasq.com/&quot;&gt;plasq&lt;/a&gt;'s &lt;a href=&quot;http://skitch.com&quot;&gt;Skitch&lt;/a&gt;!&lt;/span&gt;&lt;/div&gt;


&lt;p&gt;然后在&quot;电源管理&quot;中，将&quot;允许这台设备使计算机脱离待机状态。&quot;选中（需要先将最上面那个选项选中才能选这个）。不过在测试中发现这个选项似乎不影响最终结果:&lt;/p&gt;

&lt;div class=&quot;thumbnail&quot;&gt;&lt;a href=&quot;http://skitch.com/ashchan/b5fex/nic-power&quot;&gt;&lt;img src=&quot;http://img.skitch.com/20090813-x72j64uj16j118np4kn522ufk4.preview.jpg&quot; alt=&quot;nic-power&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Lucida Grande, Trebuchet, sans-serif, Helvetica, Arial; font-size: 10px; color: #808080&quot;&gt;Uploaded with &lt;a href=&quot;http://plasq.com/&quot;&gt;plasq&lt;/a&gt;'s &lt;a href=&quot;http://skitch.com&quot;&gt;Skitch&lt;/a&gt;!&lt;/span&gt;&lt;/div&gt;


&lt;p&gt;通过以上设置，这台PC已经可以在局域网内被唤醒了。接下去设置路由器。&lt;/p&gt;

&lt;p&gt;首先需要使用动态域名，否则在外边游荡里不知道家里的宽带连接正在使用的IP。这一步不作说明。&lt;/p&gt;

&lt;p&gt;我用的路由器是TP-LINK TL-WR340G，先加一个 Port Forward，将 UDP 端口7或9转发至198.168.1.254。这里假设子网是192.168.1.0。因为要唤醒的PC是待机状态的，使用它的IP是无效的，所以这里并不是将端口转发至目标PC的IP。如果路由器支持转发至整个子网，则这里填192.168.1.255便可。我这款路由器不支持，所以只好使用一个并不存在的192.168.1.254:&lt;/p&gt;

&lt;div class=&quot;thumbnail&quot;&gt;&lt;a href=&quot;http://skitch.com/ashchan/b5fjr/port-forward&quot;&gt;&lt;img src=&quot;http://img.skitch.com/20090813-acubdi4pj6ndwg6g2pwhkkkcf.preview.jpg&quot; alt=&quot;port-forward&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Lucida Grande, Trebuchet, sans-serif, Helvetica, Arial; font-size: 10px; color: #808080&quot;&gt;Uploaded with &lt;a href=&quot;http://plasq.com/&quot;&gt;plasq&lt;/a&gt;'s &lt;a href=&quot;http://skitch.com&quot;&gt;Skitch&lt;/a&gt;!&lt;/span&gt;&lt;/div&gt;


&lt;p&gt;关键的一步到了，为了将 Wake On Lan 的包 (Magick Packet) 转发至整个子网从而到达目标PC，上面的设置将端口9转发至了192.168.1.254，那么如何让发往192.168.1.254的包到达目标PC呢？答案是臭名昭著的ARP。&lt;/p&gt;

&lt;p&gt;在 IP &amp;amp; Binding 中增加一条 ARP 记录，Mac地址填写要唤醒的目标PC的网卡Mac地址，IP地址填入192.168.1.254。&lt;/p&gt;

&lt;div class=&quot;thumbnail&quot;&gt;&lt;a href=&quot;http://skitch.com/ashchan/b5fj2/mac-arp&quot;&gt;&lt;img src=&quot;http://img.skitch.com/20090813-qbcaj5tkqg1u83awbj4ty897rk.preview.jpg&quot; alt=&quot;mac-arp&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Lucida Grande, Trebuchet, sans-serif, Helvetica, Arial; font-size: 10px; color: #808080&quot;&gt;Uploaded with &lt;a href=&quot;http://plasq.com/&quot;&gt;plasq&lt;/a&gt;'s &lt;a href=&quot;http://skitch.com&quot;&gt;Skitch&lt;/a&gt;!&lt;/span&gt;&lt;/div&gt;


&lt;p&gt;通过以上设置，已经可以在任何地方唤醒我的HTPC了。当然还需要一个发送 Wake On Lane Magick Packet 包的工具，我用的是 &lt;a href=&quot;http://www.readpixel.com/wakeonlan/&quot;&gt;WakeOnLan&lt;/a&gt;，添加一个新的host，IP/DNS填入路由器的动态域名，Mac址址填入目标PC的网卡Mac地址。&lt;/p&gt;

&lt;div class=&quot;thumbnail&quot;&gt;&lt;a href=&quot;http://skitch.com/ashchan/b5fks/wakeonlan-client&quot;&gt;&lt;img src=&quot;http://img.skitch.com/20090813-k5s5xuh2c6wkjsumdsn6sawqj8.preview.jpg&quot; alt=&quot;wakeonlan-client&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Lucida Grande, Trebuchet, sans-serif, Helvetica, Arial; font-size: 10px; color: #808080&quot;&gt;Uploaded with &lt;a href=&quot;http://plasq.com/&quot;&gt;plasq&lt;/a&gt;'s &lt;a href=&quot;http://skitch.com&quot;&gt;Skitch&lt;/a&gt;!&lt;/span&gt;&lt;/div&gt;


&lt;p&gt;在HTPC上，设置电源管理让它在空闲15分钟时自动待机。修改电驴的设置，让电驴运行时禁用自动待机。&lt;/p&gt;

&lt;p&gt;这样，平时不下片时HTPC是待机着的，我在外面想要下东西时，先将其远程唤醒，然后通过电驴内置的Web服务器添加下载任务。&lt;/p&gt;

&lt;p&gt;PS:路由器的 Port Forward 真是非常有用。我家里的几台机器通过这个东东，都可以远程访问(ssh, Windows远程桌面, OS X Remote Management，电驴和BT Web管理端)。&lt;/p&gt;

&lt;p&gt;PS PS:OS X如果是连在网线上的话，也可以唤醒。相关系统设置在 Energy Saver 下 (Wake for Ethernet network access)。&lt;/p&gt;

&lt;p&gt;Update: Ubuntu 下设置方法: &lt;a href=&quot;http://ubuntuforums.org/showthread.php?t=234588&quot;&gt;HOWTO: Set your system up for Wake On LAN (WOL)&lt;/a&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Snow Leopard下使用华为天翼3G网卡</title>
   <link href="http://blog.ashchan.com/archive/2009/08/10/snow-leopard-china-mobile-huawei-3g/"/>
   <updated>2009-08-10T00:00:00+08:00</updated>
   <id>http://blog.ashchan.com/archive/2009/08/10/snow-leopard-china-mobile-huawei-3g</id>
   <content type="html">&lt;p&gt;中国电信天翼3G搭配的网卡之一华为EC1260可以在OS X下使用，但是仅支持10.4和10.5。这款网卡在Snow Leopard上无法正常工作，运行MobileConnect程序会直接崩溃。&lt;/p&gt;

&lt;p&gt;这也怪不得华为，毕竟这款网卡上市的时候离Snow Leopard的发布还远着呢。作为用户来说，我们当然也不能在未来的一年多时间里由于升级操作系统而放弃使用已经购买的3G网络服务。好在问题并不复杂。&lt;/p&gt;

&lt;p&gt;这个程序第一次运行时会往系统里安装网卡驱动，因此要做的第一件事是把驱动装上，方法如下:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;进入ChinaTelecom（插入网卡后会以光盘形式自动挂载）&lt;/li&gt;
&lt;li&gt;右击MobileConnect.app，选择&quot;Show Package Contents&quot;&lt;/li&gt;
&lt;li&gt;进入Contents/Resources目录，运行Mobile_Connect_Drv_App.pkg&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;非常幸运，这个安装包能正常安装。&lt;/p&gt;

&lt;p&gt;安装后，MobileConnect仍然无法正常运行，我们直接绕开它，使用系统自带的连接工具便可:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;打开 Network Preferences&lt;/li&gt;
&lt;li&gt;连接列表里会出现三个新连接，名字为HUAWEI Mobile，HUAWEI Mobile1和HUAWEI Mobile2（华为给CDMA，EVDO和Hybrid三种方式各建了一个连接？那哪个是哪个的？先不管这了，连得上是硬道理）&lt;/li&gt;
&lt;li&gt;给HUAWEI Mobile填入设置参数，电话号码填#777，用户名和密码填CARD&lt;/li&gt;
&lt;li&gt;点Connect试一下&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;不出意外的话这样便可以连上了，有图为证:&lt;/p&gt;

&lt;div class=&quot;thumbnail&quot;&gt;&lt;a href=&quot;http://skitch.com/ashchan/b4as8/snow-leopard-3g-huawei&quot;&gt;&lt;img src=&quot;http://img.skitch.com/20090810-d4u7p677pcqwt9kdts7iyjcd8n.preview.jpg&quot; alt=&quot;snow-leopard-3g-huawei&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Lucida Grande, Trebuchet, sans-serif, Helvetica, Arial; font-size: 10px; color: #808080&quot;&gt;Uploaded with &lt;a href=&quot;http://plasq.com/&quot;&gt;plasq&lt;/a&gt;'s &lt;a href=&quot;http://skitch.com&quot;&gt;Skitch&lt;/a&gt;!&lt;/span&gt;&lt;/div&gt;


&lt;p&gt;这样Snow Leopard也可以随时随地移动上网了。&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>VirtualBox NAT vs Bridged Adapter</title>
   <link href="http://blog.ashchan.com/archive/2009/07/31/virtualbox-nat-vs-bridged-adapter/"/>
   <updated>2009-07-31T00:00:00+08:00</updated>
   <id>http://blog.ashchan.com/archive/2009/07/31/virtualbox-nat-vs-bridged-adapter</id>
   <content type="html">&lt;p&gt;I've encountered networking problem for VirtualBox guest OS (Windows XP) several times. It's very slow to access internet. It appears that the default NAT doesn't play very well. The problem was solved by attaching the network adapter to Bridged Adapter instead. To do so:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Shut down the guest OS&lt;/li&gt;
&lt;li&gt;Go to Settings - Network&lt;/li&gt;
&lt;li&gt;From the Attached to drop down list, choose Bridged Adapter&lt;/li&gt;
&lt;li&gt;Start the guest OS and try it&lt;/li&gt;
&lt;/ol&gt;


&lt;div class=&quot;thumbnail&quot;&gt;&lt;a href=&quot;http://skitch.com/ashchan/b3s9q/virtualbox-adapter&quot;&gt;&lt;img src=&quot;http://img.skitch.com/20090731-k1bh5w3ba5jickfq7ikp4h9bgp.preview.jpg&quot; alt=&quot;virtualbox-adapter&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Lucida Grande, Trebuchet, sans-serif, Helvetica, Arial; font-size: 10px; color: #808080&quot;&gt;Uploaded with &lt;a href=&quot;http://plasq.com/&quot;&gt;plasq&lt;/a&gt;'s &lt;a href=&quot;http://skitch.com&quot;&gt;Skitch&lt;/a&gt;!&lt;/span&gt;&lt;/div&gt;


&lt;p&gt;I mainly use VirtualBox on a Mac. I have friends who run it on Arch Linux and they also have this issue.&lt;/p&gt;

&lt;p&gt;Why Sun made the decision to attach a virtual machine a slower network adapter?&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Rename James Chan -> James Chen</title>
   <link href="http://blog.ashchan.com/archive/2009/07/16/rename-james-chan-to-james-chen/"/>
   <updated>2009-07-16T00:00:00+08:00</updated>
   <id>http://blog.ashchan.com/archive/2009/07/16/rename-james-chan-to-james-chen</id>
   <content type="html">&lt;p&gt;I've been using James Chan as my English name for quite a long time. I did some search years ago (at that time there was even no Google) and found that people usually use Chan for my Chinese last name 陈, so I took it as mine too.&lt;/p&gt;

&lt;p&gt;This confuse people a lot, especially for those from Mainland China Chan looks and sounds quite odd. Chan is used widely in Hong Kong, where 陈 is pronounced like that in Cantonese.&lt;/p&gt;

&lt;p&gt;I speak Mandarin, so I decide to change it back to Chen, which is the Pinyin form of 陈. This one is more natural for me. Now I need to do many extra work to update my online profiles.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Migrate to jekyll</title>
   <link href="http://blog.ashchan.com/archive/2009/06/15/migrate-to-jekyll/"/>
   <updated>2009-06-15T00:00:00+08:00</updated>
   <id>http://blog.ashchan.com/archive/2009/06/15/migrate-to-jekyll</id>
   <content type="html">&lt;p&gt;I'm migrating this blog from WordPress (self hosted) to &lt;a href=&quot;http://github.com/mojombo/jekyll/tree/master&quot;&gt;jekyll&lt;/a&gt;, so in the future I don't need to worry about database backup, workpress upgrade and other house keeping anymore. The blog source will be on &lt;a href=&quot;http://github.com/ashchan/blog.ashchan.com/tree/master&quot;&gt;github&lt;/a&gt;, and the generated static pages are hosted on my own vps. (github offers CNANE for paying account, which saves even more time and energy)&lt;/p&gt;

&lt;p&gt;I've been publishing new blog entries with markdown for more than one year. This means most entries are safe to move. There might be some style or data lost, but that won't matter much. I've also imported most comments to &lt;a href=&quot;http://disqus.com/&quot;&gt;DISQUS&lt;/a&gt;, which will be used as the comment system from now on.&lt;/p&gt;

&lt;p&gt;I don't want to bother creating redirecting for old tags and pagination pages. I plan to delete them from google as these pages are filled with duplicated page links. Not so useful for human readers.&lt;/p&gt;

&lt;p&gt;My blog was initially hosted on a provider from China, then on microsoft live space, on a &lt;a href=&quot;http://subtextproject.com&quot;&gt;Subtext&lt;/a&gt; install, and on a self hosted wordpress install for the past two years.&lt;/p&gt;

&lt;p&gt;I feel like publishing web pages in the very old-school way, only simpler and faster.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>计算机教育从娃娃抓起</title>
   <link href="http://blog.ashchan.com/archive/2009/05/29/pc-baby/"/>
   <updated>2009-05-29T00:00:00+08:00</updated>
   <id>http://blog.ashchan.com/archive/2009/05/29/pc-baby</id>
   <content type="html">&lt;p&gt;&lt;a href=&quot;http://www.flickr.com/photos/ashchan/3575105625/&quot; title=&quot;计算机教育从娃娃抓起 by Ashchan, on Flickr&quot;&gt;&lt;img src=&quot;http://farm4.static.flickr.com/3355/3575105625_5f3f472e9a.jpg&quot; width=&quot;500&quot; height=&quot;322&quot; alt=&quot;计算机教育从娃娃抓起&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>篮球教育从娃娃抓起</title>
   <link href="http://blog.ashchan.com/archive/2009/05/25/basketball-baby/"/>
   <updated>2009-05-25T00:00:00+08:00</updated>
   <id>http://blog.ashchan.com/archive/2009/05/25/basketball-baby</id>
   <content type="html">&lt;p&gt;&lt;a href=&quot;http://www.flickr.com/photos/ashchan/3561987456/&quot; title=&quot;IMG_0297 by Ashchan, on Flickr&quot;&gt;&lt;img src=&quot;http://farm4.static.flickr.com/3624/3561987456_3697a8aa33.jpg&quot; width=&quot;500&quot; height=&quot;375&quot; alt=&quot;IMG_0297&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>An Awful Rails Project</title>
   <link href="http://blog.ashchan.com/archive/2009/05/14/an-awful-rails-project/"/>
   <updated>2009-05-14T00:00:00+08:00</updated>
   <id>http://blog.ashchan.com/archive/2009/05/14/an-awful-rails-project</id>
   <content type="html">&lt;p&gt;Recently I was asked to migrate an existing rails app from its hosting to &lt;a href=&quot;www.rackspace.com&quot;&gt;Rackspace&lt;/a&gt;. I was told the code base for the project was not very 'good', and I was supposed to fix issues that stood in the way during the migration.&lt;/p&gt;

&lt;p&gt;I've been involved in quite a few existing rails projects for the past two years. I have to say this project is by far the most tough one with so many bad practices. I'll share a few here.&lt;/p&gt;

&lt;h2&gt;Incomplete database migrations&lt;/h2&gt;

&lt;p&gt;As soon as I got the git access, I cloned the project and did a rake db:migrate. This failed thanks to some gems missing problem. The project didn't use config.gem so I had to install these gems manually. After that db:migrate went well. I started the app in development mode, visited several pages, found that the signup page was not working. The signup form referred to firstname, lastname etc of the User model, it looked like these columns didn't exist in the database.&lt;/p&gt;

&lt;p&gt;I checked other models and found that the migration files only had less than half the schema for the database. Apparently the developer(s) stopped using rails' database migrations at a certain point. I'm afraid they've altered the database schema directly from mysql. (I have to admit I did this one time last year, the project I was working on was hosted on a shared hosting without ssh access, the only way to change the database structure was to do it in PhpMyAdmin.)&lt;/p&gt;

&lt;p&gt;Solution for this problem: got their current database dump, generated a schema from the dump using rake db:schema:dump.&lt;/p&gt;

&lt;h2&gt;None view templates under app/views&lt;/h2&gt;

&lt;p&gt;When I tried to start the app in production mode, I got this error:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/erb.rb:469:in `scan': undefined method `empty?' for nil:NilClass (NoMethodError)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This didn't happen under development mode. The error message indicated it had something to do with ERB. A quick check on views folders lead to the source of this problem. There were some jpeg image files under one of the views folder, and there was a file named semantic.cache under every folder (I guess this was generated by the IDE or editor, the developer just checked them into the code base)!&lt;/p&gt;

&lt;p&gt;Solution for this problem: moved image files to public/images, removed all semantic.cache files.&lt;/p&gt;

&lt;h2&gt;Having a model called Spec!&lt;/h2&gt;

&lt;p&gt;This also prevented the app from running in production mode. The app had a model named Spec. The project installed the rspec and rspec-rails plugins. There seemed to be a name conflicts. Luckily (or unfortunately) the project didn't have any rspec tests.&lt;/p&gt;

&lt;p&gt;Solution for this problem: removed rspec and rspec-rails plugins. The Spec model was referred across the whole app I didn't want to rename it.&lt;/p&gt;

&lt;h2&gt;Running the live app in development mode&lt;/h2&gt;

&lt;p&gt;At this point I was so surprised how their app was running on the current hosting. I doubted it wasn't running in production mode at all. Then in the deploy.rb (did the capistrano deploy script really work?) file I saw this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;desc &quot;Stop the sphinx server&quot;
task :stop_sphinx, :roles =&amp;gt; :app do
    run &quot;cd #{current_path} &amp;amp;&amp;amp;  RAILS_ENV=development rake thinking_sphinx:stop&quot;
end
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Oops, the live app was running in development mode!&lt;/p&gt;

&lt;p&gt;Solution for this problem: had to fix some other issues to make the app run in production mode :-(&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Update (May 19, 2009)&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;Hard-coded ImagicMagick path&lt;/h2&gt;

&lt;p&gt;What is this!!!???&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;def convert
    if ENV[&quot;OS&quot;] =~ /Windows/
        &quot;C:\\Program Files\\ImageMagick-6.3.1-Q16\\convert&quot;
    else
        &quot;/usr/bin/convert&quot;
    end
end
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;It simply doesn't respect the fact that I have a Mac port version of ImageMagick which is under /opt/local/bin. The new hosting has it under /usr/local/bin. Wow!&lt;/p&gt;

&lt;p&gt;Solution for this problem: if the app really needs to specify the ImageMagick path, have it in a config file and load it on start.&lt;/p&gt;

&lt;h2&gt;AR model's initialize method not calling super&lt;/h2&gt;

&lt;p&gt;The project has one ActiveRecord model, the model has an initialize method:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;class Transformer &amp;lt; ActiveRecord::Base
    def initialize(arg1)
        # do some great job
    end
end
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;When creating a new object of this model, it gave a nil.has_key? error:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;bumblebee = Transformer.new(sam)
NoMethodError: You have a nil object when you didn't expect it!
The error occurred while evaluating nil.has_key?
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This is caused by not calling super in the initialize method.
Solution for this problem: add a call to super() in the initialize method.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>红河的一个Bug</title>
   <link href="http://blog.ashchan.com/archive/2009/04/24/red-river-bug/"/>
   <updated>2009-04-24T00:00:00+08:00</updated>
   <id>http://blog.ashchan.com/archive/2009/04/24/red-river-bug</id>
   <content type="html">&lt;p&gt;红河是一部很精彩的影片。可真想不到电影摄像会犯这种错误:&lt;/p&gt;

&lt;div class=&quot;thumbnail&quot;&gt;&lt;a href=&quot;http://skitch.com/ashchan/bc71q/red-river-1&quot;&gt;&lt;img src=&quot;http://img.skitch.com/20090424-gpqgkrhsjtpdxx47c5uqkg2gdg.preview.jpg&quot; alt=&quot;red-river-1&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Lucida Grande, Trebuchet, sans-serif, Helvetica, Arial; font-size: 10px; color: #808080&quot;&gt;Uploaded with &lt;a href=&quot;http://plasq.com/&quot;&gt;plasq&lt;/a&gt;'s &lt;a href=&quot;http://skitch.com&quot;&gt;Skitch&lt;/a&gt;!&lt;/span&gt;&lt;/div&gt;




&lt;div class=&quot;thumbnail&quot;&gt;&lt;a href=&quot;http://skitch.com/ashchan/bc711/red-river-2&quot;&gt;&lt;img src=&quot;http://img.skitch.com/20090424-jwiay66ebqcy9upsjytdrdnwe2.preview.jpg&quot; alt=&quot;red-river-2&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style=&quot;font-family: Lucida Grande, Trebuchet, sans-serif, Helvetica, Arial; font-size: 10px; color: #808080&quot;&gt;Uploaded with &lt;a href=&quot;http://plasq.com/&quot;&gt;plasq&lt;/a&gt;'s &lt;a href=&quot;http://skitch.com&quot;&gt;Skitch&lt;/a&gt;!&lt;/span&gt;&lt;/div&gt;

</content>
 </entry>
 
 <entry>
   <title>Passenger for Nginx安装与配置 (OS X)</title>
   <link href="http://blog.ashchan.com/archive/2009/04/17/install-passenger-for-nginx-on-os-x/"/>
   <updated>2009-04-17T00:00:00+08:00</updated>
   <id>http://blog.ashchan.com/archive/2009/04/17/install-passenger-for-nginx-on-os-x</id>
   <content type="html">&lt;p&gt;&lt;a href=&quot;http://blog.phusion.nl/2009/04/16/phusions-one-year-anniversary-gift-phusion-passenger-220/comment-page-2/#comment-5786&quot;&gt;Passenger 支持 Ｎginx 了&lt;/a&gt;！４月份最让人激动的消息。&lt;/p&gt;

&lt;p&gt;在 OS X　上安装 passenger 和 &lt;a href=&quot;http://blog.ashchan.com/archive/2007/12/17/nginx-301-redirect/&quot;&gt;nginx&lt;/a&gt; 非常简单，上面的链接中有一段 &lt;a href=&quot;http://www.peepcode.com/&quot;&gt;peepcode&lt;/a&gt; 的视频。这里作一下简单的文字描述:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;curl http://phusion-passenger.googlecode.com/files/passenger-2.2.0.gem -o passenger.gem&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;sudo gem install passenger.gem&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;sudo passenger-install-nginx-module&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;照着提示一步步操作便可, passenger-install-nginx-module　会自动下载 nginx 源包并编译安装至 /opt/nginx 。&lt;/p&gt;

&lt;p&gt;安装完成后进行配置:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;修改 /opt/nginx/conf/nginx.conf, 将默认　server 设置中的 server_name 由 localhost 改为 nginx.local，以免与 apache 冲突。&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;在 http 设置的最后，加入:&lt;/p&gt;

&lt;p&gt; include vhosts/*.conf;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;cd /opt/nginx/conf &amp;amp; sudo mkdir vhosts&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;sudo mate vhosts/ashchan.conf,　加入以下设置:&lt;/p&gt;

&lt;p&gt; server {&lt;/p&gt;

&lt;pre&gt;&lt;code&gt; listen 80;
 server_name ashchan.local;
 root /Users/james/Projects/ashchan.com/public;
 passenger_enabled on;
 rails_env development;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt; }&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;启动 nginx:&lt;/p&gt;

&lt;p&gt; sudo /opt/nginx/sbin/nginx&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;搞掂！&lt;/p&gt;
</content>
 </entry>
 
 
</feed>