<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>

<channel>
	<title>Suave's Blog</title>
	<atom:link href="http://www.surui.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.surui.net</link>
	<description>anyway, so far so good, just keep going!</description>
	<pubDate>Fri, 26 Feb 2010 03:33:30 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
	<language>en</language>
			<item>
		<title>设计公益产品常犯的错误</title>
		<link>http://www.surui.net/2010/02/26/%e8%ae%be%e8%ae%a1%e5%85%ac%e7%9b%8a%e4%ba%a7%e5%93%81%e5%b8%b8%e7%8a%af%e7%9a%84%e9%94%99%e8%af%af/</link>
		<comments>http://www.surui.net/2010/02/26/%e8%ae%be%e8%ae%a1%e5%85%ac%e7%9b%8a%e4%ba%a7%e5%93%81%e5%b8%b8%e7%8a%af%e7%9a%84%e9%94%99%e8%af%af/#comments</comments>
		<pubDate>Fri, 26 Feb 2010 03:33:25 +0000</pubDate>
		<dc:creator>suave.su</dc:creator>
		
		<category><![CDATA[Web Related]]></category>

		<category><![CDATA[product-design]]></category>

		<guid isPermaLink="false">http://www.surui.net/?p=324</guid>
		<description><![CDATA[来自阿育王科技博客的一篇文章：公益产品设计的六个常犯错误
里面说的三个问题非常需要关注：
使用技术来解决文化问题。技术用来解决你在现实中切身体会到的问题，需要深入的参与、体... ]]></description>
			<content:encoded><![CDATA[<p>来自阿育王科技博客的一篇文章：<a href="http://www.csrglobal.cn/detail.jsp?fid=304262" target="_blank">公益产品设计的六个常犯错误</a></p>
<p>里面说的三个问题非常需要关注：</p>
<p>使用技术来解决文化问题。技术用来解决你在现实中切身体会到的问题，需要深入的参与、体会、理解，从而抽象，才好利用技术解决其中的问题，比如无味的重复、信息的不畅。用户的文化背景、生活习惯是非常重要的因素。</p>
<p>没有理解用户的使用环境。这里指的环境非常现实，文中举例说捐赠给发展中国家的医疗设备有98%在五年内会坏掉，罪魁祸首是电力不稳定。在设计这些医疗设备的发达国家里，这样的问题是不存在的，也自己不会在设计中考虑。再比如，一般的笔记本拿到撒哈拉用，八成会因为进沙子而坏掉，这就需要OLPC那样的一体塑料键盘了。</p>
<p>最后，也是我觉得目前阶段最重要的一点，不顺应的供应链。往往一个产品只能解决 big issue 中的一步，再下一步中没有相应的产品接招，这样第一步中的产品产生的效果就大打折扣了。所以说万事万物都需要一个够大的 ecosystem 才行。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.surui.net/2010/02/26/%e8%ae%be%e8%ae%a1%e5%85%ac%e7%9b%8a%e4%ba%a7%e5%93%81%e5%b8%b8%e7%8a%af%e7%9a%84%e9%94%99%e8%af%af/feed/</wfw:commentRss>
		</item>
		<item>
		<title>A Web 2.0 Strategy: 10 Tactics for Success</title>
		<link>http://www.surui.net/2010/02/26/a-web-20-strategy-10-tactics-for-success/</link>
		<comments>http://www.surui.net/2010/02/26/a-web-20-strategy-10-tactics-for-success/#comments</comments>
		<pubDate>Fri, 26 Feb 2010 02:20:33 +0000</pubDate>
		<dc:creator>suave.su</dc:creator>
		
		<category><![CDATA[Web Related]]></category>

		<category><![CDATA[marketing]]></category>

		<category><![CDATA[strategy]]></category>

		<category><![CDATA[web2.0]]></category>

		<guid isPermaLink="false">http://www.surui.net/?p=322</guid>
		<description><![CDATA[安猪分享了一个关于 web2.0 运营策略的 slide，总结得蛮切中要点的。
有两句话说中了一个 web 2.0 网站成功的重点

simple: can you explain your website on the phone?
value: a benefit to the person that make a real differ... ]]></description>
			<content:encoded><![CDATA[<p><a href="http://anzhu.net" target="_blank">安猪</a>分享了一个关于 web2.0 运营策略的 slide，总结得蛮切中要点的。</p>
<p>有两句话说中了一个 web 2.0 网站成功的重点</p>
<ul>
<li>simple: can you explain your website on the phone?</li>
<li>value: a benefit to the person that make a real difference in their lives</li>
</ul>
<p>其中有些内容是在今年的工作中要重点提升一下：</p>
<ul>
<li>membership: profiles, friending, groups</li>
<li>greet every new member</li>
<li>build-in ways to share</li>
<li>natural network effects - more value with more &#8220;friends&#8221;</li>
<li>content: outside in, inside out</li>
</ul>
<div style="width:425px" id="__ss_95431"><strong style="display:block;margin:12px 0 4px"><a href="http://www.slideshare.net/PaulLomax/a-web-20-strategy-10-tactics-for-success" title="A Web 2.0 Strategy: 10 Tactics for Success">A Web 2.0 Strategy: 10 Tactics for Success</a></strong><object width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=a-web-20-strategy-10-tactics-for-success4215&#038;stripped_title=a-web-20-strategy-10-tactics-for-success" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=a-web-20-strategy-10-tactics-for-success4215&#038;stripped_title=a-web-20-strategy-10-tactics-for-success" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object>
<div style="padding:5px 0 12px">View more <a href="http://www.slideshare.net/">presentations</a> from <a href="http://www.slideshare.net/PaulLomax">PaulLomax</a>.</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.surui.net/2010/02/26/a-web-20-strategy-10-tactics-for-success/feed/</wfw:commentRss>
		</item>
		<item>
		<title>2010 的打算</title>
		<link>http://www.surui.net/2010/02/16/2010-%e7%9a%84%e6%89%93%e7%ae%97/</link>
		<comments>http://www.surui.net/2010/02/16/2010-%e7%9a%84%e6%89%93%e7%ae%97/#comments</comments>
		<pubDate>Tue, 16 Feb 2010 17:00:53 +0000</pubDate>
		<dc:creator>suave.su</dc:creator>
		
		<category><![CDATA[Every day]]></category>

		<category><![CDATA[2010]]></category>

		<category><![CDATA[plan]]></category>

		<guid isPermaLink="false">http://www.surui.net/?p=320</guid>
		<description><![CDATA[也不记得去年有没有写总结和计划了，直接写写虎年的打算吧，先在脑图上整理了一下，方向比过往的几年都清晰简单了不少，但看上去还是满多事情的
工作方面：
* 精力从 developing 转向 produc... ]]></description>
			<content:encoded><![CDATA[<p>也不记得去年有没有写总结和计划了，直接写写虎年的打算吧，先在脑图上整理了一下，方向比过往的几年都清晰简单了不少，但看上去还是满多事情的</p>
<p>工作方面：</p>
<p>* 精力从 developing 转向 product design &#038; coordinate<br />
* 更多关注整个 NGO/NPO 行业的 IT 和互联网使用情况<br />
* 好好打理自己的 blog, 作为自己分享交流的重要通道</p>
<p>技术关注：</p>
<p>* Android 平台的技术和应用<br />
* CMS 的技术实现<br />
* 适合乡村学校使用的计算机软硬件平台</p>
<p>读书：有计划的看书，书单逐步充实，认真做读书笔记，根据过去的经验，没有笔记的书大多也没有思考。</p>
<p>旅行：争取多去几个地方，和更多处在不同领域的人交流，开拓自己的眼界和思路。目前希望去的几个地方：上海（看世博）、成都（看华德福）、贵州、泰国（算是走出国门的第一站吧）</p>
<p>That&#8217;s all.</p>
<p>这样的一个年度计划是要敏捷管理的，需要不断的迭代，定期回顾，调整。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.surui.net/2010/02/16/2010-%e7%9a%84%e6%89%93%e7%ae%97/feed/</wfw:commentRss>
		</item>
		<item>
		<title>how to create app store account without credit card</title>
		<link>http://www.surui.net/2009/08/14/how-to-create-app-store-account-without-credit-card/</link>
		<comments>http://www.surui.net/2009/08/14/how-to-create-app-store-account-without-credit-card/#comments</comments>
		<pubDate>Fri, 14 Aug 2009 04:06:36 +0000</pubDate>
		<dc:creator>suave.su</dc:creator>
		
		<category><![CDATA[Apple Fa(u)n]]></category>

		<category><![CDATA[app-store]]></category>

		<category><![CDATA[ipod-touch]]></category>

		<guid isPermaLink="false">http://www.surui.net/?p=318</guid>
		<description><![CDATA[没有美国的信用卡就不能注册美国的 iTunes Store，但 Apple 官方也给出了一个不用信用卡的注册方法，这样就能玩上很多美国站独有的 free app 了，比如 Amazon Kindle。
http://support.apple.com/kb/HT2534
需要... ]]></description>
			<content:encoded><![CDATA[<p>没有美国的信用卡就不能注册美国的 iTunes Store，但 Apple 官方也给出了一个不用信用卡的注册方法，这样就能玩上很多美国站独有的 free app 了，比如 Amazon Kindle。</p>
<p><a href="http://support.apple.com/kb/HT2534" target="_blank">http://support.apple.com/kb/HT2534</a></p>
<p>需要注册的是，地址还是要填一个美国的，可以借助 <a href="http://www.yellowpages.com/" target="_blank">http://www.yellowpages.com/</a> 随便找一个地址添上（我找了一个美国电影院）</p>
<p>搞定！可以 get free app 了。如果有能用国内信用卡注册美国帐户的方法，请赐教 <img src='http://www.surui.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.surui.net/2009/08/14/how-to-create-app-store-account-without-credit-card/feed/</wfw:commentRss>
		</item>
		<item>
		<title>how to build activity-streaming</title>
		<link>http://www.surui.net/2009/08/07/how-to-build-activity-streaming/</link>
		<comments>http://www.surui.net/2009/08/07/how-to-build-activity-streaming/#comments</comments>
		<pubDate>Fri, 07 Aug 2009 06:41:36 +0000</pubDate>
		<dc:creator>suave.su</dc:creator>
		
		<category><![CDATA[Web Related]]></category>

		<category><![CDATA[activitysteam]]></category>

		<category><![CDATA[database-design]]></category>

		<category><![CDATA[lifestreaming]]></category>

		<category><![CDATA[socialgraph]]></category>

		<guid isPermaLink="false">http://www.surui.net/?p=312</guid>
		<description><![CDATA[好友动态在各大社交网站中基本上已经是标配了，而且一般都会显示在用户登录之后的默认首页上，这种做法的确方便用户了解网站和自己朋友的一些动态。设计上应该如何实现呢？Google 了一... ]]></description>
			<content:encoded><![CDATA[<p>好友动态在各大社交网站中基本上已经是标配了，而且一般都会显示在用户登录之后的默认首页上，这种做法的确方便用户了解网站和自己朋友的一些动态。设计上应该如何实现呢？Google 了一些资料，整理在下面，欢迎有实际经验的朋友指点！</p>
<p>用户看到的可能是三种情况：</p>
<ul>
<li>我的动态</li>
<li>好友的动态</li>
<li>全站的动态</li>
</ul>
<div>
<p><span>朋友动态这种信息，根据网站的实际情况需要考虑几个问题：</span></p>
<p>1、是否只让用户看到最新n条？（<em>海内的最新动态数量是固定的，采用先进先出原则，用户只能看到最新的n条；而UCH则可以每页150条允许用户翻页</em>）</p>
<p><span>2、用户增减好友后，朋友动态是否能够立刻体现出变化？（<em>在海内，我如果在好友名单中删除一个人，好友动态还会有他的信息，只是不新增他的信息而已；而UCH里面，他的信息立刻消失。加一个人为朋友，也是一样的效果。</em>）</span></p>
<p><span>3、用户能否删除自己产生的动态？</span></p>
<p><span>4、阅读者是否可以删除其朋友动态中某一条动态？（<em>在校内用户可以删除某一条朋友动态，在UCH用户可以屏蔽某人或者所有人的某类动态，在海内你只能看不能屏蔽</em>）</span></p>
<p><span>5、动态是否有阅读权限？</span></p>
<p><span>6、动态所指向的信息被修改、删除，动态是否要同步变化？（<em>如果你修改了日志的标题，校内网的动态是不变的，而海内是变化的<span>） </span></em></span></div>
<div>最简单的实现方式是将所有事件记录到一张表里：</div>
<div>Event</div>
<div>- id</div>
<div>- user_id</div>
<div>- type</div>
<div>- data</div>
<div>- created_at</div>
<div>这样做比较适合用于显示全站更新，针对用户推送时，缺点明显：用户加好友后会显示出成为好友前的所有动态，删好友后之前的所有动态也看不到了。另外用户不能对活动进行删除，因为每个活动消息只有一份拷贝。</div>
<div>data 中可以用 json 来记录用户的动作，比如：</div>
<div>
<pre><span><code><span>{</span><span>photoId</span><span>:</span><span>2089</span><span>,</span><span> photoName</span><span>:</span><span>A trip to the beach</span><span>}</span></code></span></pre>
</div>
<div>PS: QQ新版的消息中心，对于同一好友下不同类型的操作都能合并。这时候如果动态表包括有type的字段，就不太好对付了，可以改成：</div>
<div>
<p><span><span>data中保存用户的操作日志，也就是本贴讨论的重点。我采用的方法是前面有同学提到json方式。</span></span><span><span>如：</span></span></p>
<p><span><span>{<br />
&#8220;blog&#8221;:[  {"id":1,"title":"安利台湾25周年庆"} ],<br />
&#8220;photo&#8221;:[  {"id":1,"title":"51韶关游"} ]<br />
}</span></span></p>
<p><span><span>其中blog、photo代表某种应用的标识，可以无限添加。只要显示的时候能分析就行。里面的id和title就是内容的属性，结构自定。至于新旧操作怎么合并，我是采取对event表的插入操作进行拦截实现的——我定义会员所有的操作均调用event的插入方法。在拦截函数中，先select该会员的记录。如返回为空，则直接插入新记录。如返回记录，则将待插入数据与原数据进行合并。如待插入数据为：</span></span></p>
<p><span><span>{<br />
&#8220;blog&#8221;:[  {"id":2,"title":"我是谁"} ],</span></span></p>
<p><span><span> &#8220;share&#8221;:[  {"url":"<a>http://www.tudou.com","title</a>":"土豆网 - 视频 - 播客 - 每个人都是生活的导演"} ]<br />
}<br />
</span></span></p>
<p>则合并后的content为：</p>
<p><span><span>{<br />
&#8220;blog&#8221;:[  {"id":2,"title":"我是谁"}  {"id":1,"title":"安利台湾25周年庆"}, ],</span></span></p>
<p><span><span> &#8220;photo&#8221;:[  {"id":1,"title":"51韶关游"} ],</span></span></p>
<p><span> &#8220;share&#8221;:[  {"url":"<a>http://www.tudou.com","title</a>":"土豆网 - 视频 - 播客 - 每个人都是生活的导演"} ]<br />
}</span></p>
<p><span>然后使用update方法即可。</span></div>
<div>为解决上面的问题，可以添加一个 EventUser 表，当用户发生动作后，用户的动作写在 Event 表中，给该用户的所有好友发一个消息，记录在 EventUser 表中</div>
<div>EventUser</div>
<div>- id</div>
<div>- event_id</div>
<div>- friend_user_id</div>
<div>- created_at</div>
<div>需要注意的是一定时间内完成的某些动作，对 Event 表应该更新，而不是插入。比如同时加N个好友可以合并到一个 event 中。另外当用户的动作被撤销后，也要考虑对应的 event 如何撤销。比如用户传了一张照片，然后又删掉了，这时如果传照片可以 event 没删掉，用户在动态列表中还会看到，XXX上传了一张照片，但点进去，照片已经不存在了。</div>
<div>优化：</div>
<div>Event 表可以做 mem cache</div>
<div>EventUser 表可以水平切分，分到多张表中，可以定期清除</div>
<div>写 EventUser 表的操作可以抛个消息，异步操作。或者先写到 mem cache 里，到一定条件时再持久化。</div>
<div>references:</div>
<div><a href="http://i.laoer.com/sns-news-feed-design.html">http://i.laoer.com/sns-news-feed-design.html<br />
</a><a href="http://www.javaeye.com/topic/176677">http://www.javaeye.com/topic/176677</a></div>
<div>
<div>
<div><a href="http://stackoverflow.com/questions/202198/whats-the-best-manner-of-implementing-a-social-activity-stream">http://stackoverflow.com/questions/202198/whats-the-best-manner-of-implementing-a-social-activity-stream</a></div>
<div><a href="http://stackoverflow.com/questions/624616/best-database-structure-for-storing-rss-feeds">http://stackoverflow.com/questions/624616/best-database-structure-for-storing-rss-feeds</a></div>
</div>
<div>ruby on rails plugin:</div>
<div><a href="http://github.com/face/activity_streams/tree/master" target="_blank">http://github.com/face/activity_streams/tree/master</a></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.surui.net/2009/08/07/how-to-build-activity-streaming/feed/</wfw:commentRss>
		</item>
		<item>
		<title>minutes about how to start a startup</title>
		<link>http://www.surui.net/2009/08/04/minutes-about-how-to-start-a-startup/</link>
		<comments>http://www.surui.net/2009/08/04/minutes-about-how-to-start-a-startup/#comments</comments>
		<pubDate>Tue, 04 Aug 2009 01:57:02 +0000</pubDate>
		<dc:creator>suave.su</dc:creator>
		
		<category><![CDATA[Read Minute]]></category>

		<category><![CDATA[startup]]></category>

		<guid isPermaLink="false">http://www.surui.net/?p=294</guid>
		<description><![CDATA[origin reading: http://www.paulgraham.com/start.html
writing following lines is just for my own minutes
3 big things:
- to start with good people
- make something customers actually want
- spend as little money as possible

useful points:
- the overall ... ]]></description>
			<content:encoded><![CDATA[<p>origin reading: <a href="http://www.paulgraham.com/start.html" target="_blank">http://www.paulgraham.com/start.html</a></p>
<p>writing following lines is just for my own minutes</p>
<p>3 big things:</p>
<div>- to start with good people</div>
<div>- make something customers actually want</div>
<div>- spend as little money as possible</div>
<p></p>
<div>useful points:</div>
<div>- the overall plan is straightforward</div>
<div>- don&#8217;t think about how to do database matches instead of how stuff works in the real world</div>
<div>- an idea for a startup is only beginning, and from that point all you have to do is execute</div>
<div>- what matters is not ideas, but the people who have them. good people can fix bad ideas, but good ideas can&#8217;t save bad people</div>
<div>- in a technology startup, which most startups are, the founders should include technical people</div>
<div>- in nearly every failed startup, the real problem was that customers didn&#8217;t want the product</div>
<p></p>
<div>the things every startup need to do:</div>
<div>get a version 1 out as soon as you can, but must include the thing customers want.</div>
<div>the only way to make something customers want is to get a prototype in front of them and refine it based on their reactions.</div>
<div>talk to as many VCs as you can, even if you don&#8217;t want their money, because a) they may be on the board of someone who will buy you, and b) if you seem impressive, they&#8217;ll be discouraged from investing in your competitors. but you may wonder how much to tell VCs. some of them may one day be funding your competitors. i think the best plan is not to be overtly secretive, but not to tell them everything either.</div>
<p></p>
<div>once you get big (in users or employees) it gets hard change your product.</div>
<p></p>
<div>that&#8217;s the key to success as a startup. there is nothing more important than understanding your business. google&#8217;s secret weapon waas simply that they understood search.</div>
<p></p>
<div>negative lessons is straightfoward to avoid errors:</div>
<div>- don&#8217;t have a lot of meetings</div>
<div>- don&#8217;t have chunk of code that multiple people own</div>
<div>- don&#8217;t have a sales guy running company</div>
<div>- don&#8217;t make a high-end product</div>
<div>- don&#8217;t let your code too big</div>
<div>- don&#8217;t leave finding bugs to QA people</div>
<div>- don&#8217;t go too long between releases</div>
<div>- don&#8217;t isolate developers from users</div>
]]></content:encoded>
			<wfw:commentRss>http://www.surui.net/2009/08/04/minutes-about-how-to-start-a-startup/feed/</wfw:commentRss>
		</item>
		<item>
		<title>web 3.0 come</title>
		<link>http://www.surui.net/2009/08/03/web-30-come/</link>
		<comments>http://www.surui.net/2009/08/03/web-30-come/#comments</comments>
		<pubDate>Mon, 03 Aug 2009 07:06:05 +0000</pubDate>
		<dc:creator>suave.su</dc:creator>
		
		<category><![CDATA[Web Related]]></category>

		<category><![CDATA[semantic-web]]></category>

		<category><![CDATA[web3.0]]></category>

		<guid isPermaLink="false">http://www.surui.net/?p=289</guid>
		<description><![CDATA[微博客越来越火，围绕 twitter 已经成为了一个美丽的生态系统，感觉到 web 3.0 时代要来了。
看了一些相关资料，做了些对比：
Web 1.0 - as an information portal
- be the first to own the content
- divide www info ... ]]></description>
			<content:encoded><![CDATA[<p>微博客越来越火，围绕 twitter 已经成为了一个美丽的生态系统，感觉到 web 3.0 时代要来了。</p>
<p>看了一些相关资料，做了些对比：</p>
<p>Web 1.0 - as an information portal</p>
<p>- be the first to own the content<br />
- divide www info useable directories<br />
- everyone has their personal corner in the cyberspace<br />
- lacks: context, interaction, scalability</p>
<p>Web 2.0 - as a platform</p>
<p>- focus on the power of community to create &amp; validate (UGC, collaboration)<br />
- tagging organization<br />
- setting up &#8220;hooks&#8221; for future integration (RSS, API)<br />
- lacks: personalization, true portability, interoperability</p>
<p>Web 3.0 - is semantic web</p>
<p>- HTML describes documents, while RDF describles things<br />
- specs: RDF (FOAF, DOAP), GRDDL, W3C, microformats<br />
- instances: Google, Twine, Swicki, Powerset, Wink, Twitter, FOAF, OpenSocial, Beacon, Joost, Netflix, Slingbox, iPhone, Andriod etc</p>
<p>个人总结是：<br />
web1.0 是资源互联（text, video, music, pictures etc）<br />
web2.0 是人互联（social graph, life streaming）<br />
web3.0 是数据互联 （系统可以更智能的理解数据之间的关联和用户表达的含义，从而更准确的给出用户想要的东西）</p>
]]></content:encoded>
			<wfw:commentRss>http://www.surui.net/2009/08/03/web-30-come/feed/</wfw:commentRss>
		</item>
		<item>
		<title>2 keypoints of semantic web</title>
		<link>http://www.surui.net/2009/07/29/2-keypoints-of-semantic-web/</link>
		<comments>http://www.surui.net/2009/07/29/2-keypoints-of-semantic-web/#comments</comments>
		<pubDate>Wed, 29 Jul 2009 07:29:39 +0000</pubDate>
		<dc:creator>suave.su</dc:creator>
		
		<category><![CDATA[Web Related]]></category>

		<category><![CDATA[semantic-web]]></category>

		<guid isPermaLink="false">http://www.surui.net/?p=287</guid>
		<description><![CDATA[
add semantics to today&#8217;s web, rather than create a future web
human first, machine second
... ]]></description>
			<content:encoded><![CDATA[<ol>
<li>add semantics to today&#8217;s web, rather than create a future web</li>
<li>human first, machine second</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.surui.net/2009/07/29/2-keypoints-of-semantic-web/feed/</wfw:commentRss>
		</item>
		<item>
		<title>i18n your website with google translate</title>
		<link>http://www.surui.net/2009/07/22/i18n-your-website-with-google-translate/</link>
		<comments>http://www.surui.net/2009/07/22/i18n-your-website-with-google-translate/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 04:55:44 +0000</pubDate>
		<dc:creator>suave.su</dc:creator>
		
		<category><![CDATA[Web Related]]></category>

		<category><![CDATA[google-translate]]></category>

		<guid isPermaLink="false">http://www.surui.net/?p=285</guid>
		<description><![CDATA[在 Google Translate 上面有个很实用的 browser bookmark，实际上是一段 js 脚本，用它可以将当前网页用 Google Translate 翻译成各种语言。
这段 js 一样可以用在你的网站中，这样就能给网站添加一个简化... ]]></description>
			<content:encoded><![CDATA[<p>在 Google Translate 上面有个很实用的 browser bookmark，实际上是一段 js 脚本，用它可以将当前网页用 Google Translate 翻译成各种语言。</p>
<p>这段 js 一样可以用在你的网站中，这样就能给网站添加一个简化的多语言版本了，最大的问题也就是你网站的界面设计可能不适应翻译过来的语言。</p>
<p>如果想让翻译的页面在新窗口中打开，可以参考<a href="http://www.geekyblogger.com/2008/06/modifying-google-translation-button-to.html" target="_blank">这篇博客</a></p>
<p>方式就是将 location.href = 改成 window_name = window.open(&#8230;)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.surui.net/2009/07/22/i18n-your-website-with-google-translate/feed/</wfw:commentRss>
		</item>
		<item>
		<title>use current_user in Model</title>
		<link>http://www.surui.net/2009/07/10/use-current_user-in-model/</link>
		<comments>http://www.surui.net/2009/07/10/use-current_user-in-model/#comments</comments>
		<pubDate>Fri, 10 Jul 2009 10:15:18 +0000</pubDate>
		<dc:creator>suave.su</dc:creator>
		
		<category><![CDATA[Ruby and Rails]]></category>

		<category><![CDATA[restful_authentication]]></category>

		<guid isPermaLink="false">http://www.surui.net/?p=282</guid>
		<description><![CDATA[我所有的项目几乎都用 restful_authentication 做了用户管理这部分，应用中经常要在 model 中调用 current_user，而这个是 session 相关的信息，在 Model 中不应直接读到，Google 到一个比较不错的办法，是 ... ]]></description>
			<content:encoded><![CDATA[<p>我所有的项目几乎都用 restful_authentication 做了用户管理这部分，应用中经常要在 model 中调用 current_user，而这个是 session 相关的信息，在 Model 中不应直接读到，Google 到<a href="http://www.ruby-forum.com/topic/51782" target="_blank">一个比较不错的办法</a>，是 Beast 的作者提供的。</p>
<p>首先在 User Model 中加入一个类变量：</p>
<pre>class User &lt; ActiveRecord::Base
  cattr_accessor :current_user
  ...
end</pre>
<p>之后在 ApplicationController 中用 before_filter 给刚才的类变量赋值：</p>
<pre>class ApplicationController &lt; ActionController::Base
  include AuthenticatedSystem
  before_filter { |c| User.current_user = c.current_user }
end</pre>
<p>看似完美，测试报错，说 current_user 方法是 protected，不能调用。看看 lib/authenticated_system.rb，果然 current_user 方法是 protected，为了不破坏 restful_authenticated plugin 的结构，对 controller 里面的方法做个修改：</p>
<pre>class ApplicationController &lt; ActionController::Base
  include AuthenticatedSystem
  before_filter :set_current_user

  protected
  def set_current_user
    User.current_user = self.current_user
  end
end</pre>
<p>&#8211;EOF&#8211;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.surui.net/2009/07/10/use-current_user-in-model/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
