<?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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Web Development Notes &#187; Life &amp; Work</title>
	<atom:link href="http://blog.eood.cn/category/life-and-work/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.eood.cn</link>
	<description>PHP, Drupal, Erlang, MySQL, Java, MongoDB, Linux, vim, ssh, screen etc</description>
	<lastBuildDate>Sat, 31 Dec 2011 12:49:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>2011 Review</title>
		<link>http://blog.eood.cn/2011-review</link>
		<comments>http://blog.eood.cn/2011-review#comments</comments>
		<pubDate>Sat, 31 Dec 2011 12:49:49 +0000</pubDate>
		<dc:creator>Bruce Dou</dc:creator>
				<category><![CDATA[Life & Work]]></category>
		<category><![CDATA[My Thinking]]></category>
		<category><![CDATA[2011]]></category>
		<category><![CDATA[Review]]></category>
		<category><![CDATA[总结]]></category>
		<category><![CDATA[目标]]></category>

		<guid isPermaLink="false">http://blog.eood.cn/?p=1784</guid>
		<description><![CDATA[又到一个年底，回顾一年的变化和目标，幸好有1年前的总结和目标 2010 Summary And 2011 Goals ，可以让我在一年后还能回顾一下以前的计划和现在的完成情况。 关于博客的总结 本年度博客数量有所降低，原因是下半年从主要开发 A 切换到主要开发 B 。而 B 的核心是人工智能，由于领域过于窄，不方便分享一些通用的心得；另一方面写博客的时间变少，有几篇总结性的博客想放到新的一年吧。以下是有一点价值的博文： 关于 Drupal What is new in Drupal 7 Drupal Views PHP Code Validator [Drupal] 错误执行MYSQL命令之后如何挽救 Add a custom tab menu in profile edit page in Drupal 7 Why Drupal is not popular in China Drupal 仍然是快速原型，甚至是生产系统的首选。当然现在更多的人推崇 Rails 或者 Django， NodeJS [...]]]></description>
			<content:encoded><![CDATA[<p>又到一个年底，回顾一年的变化和目标，幸好有1年前的总结和目标 <a title="Permanent Link to 2010 Summary And 2011 Goals" rel="bookmark" href="http://blog.eood.cn/2011_goals_2010_summary">2010 Summary And 2011 Goals</a> ，可以让我在一年后还能回顾一下以前的计划和现在的完成情况。<br />
<img title="m_s_2011" src="http://blog.eood.cn/wp-content/uploads/2011/12/m_s_2011.jpg" alt="" width="425" height="203" /></p>
<h2>关于博客的总结</h2>
<p>本年度博客数量有所降低，原因是下半年从主要开发 A 切换到主要开发 B 。而 B 的核心是人工智能，由于领域过于窄，不方便分享一些通用的心得；另一方面写博客的时间变少，有几篇总结性的博客想放到新的一年吧。以下是有一点价值的博文：</p>
<p><strong>关于 Drupal</strong></p>
<ol>
<li><a title="Permanent Link to What is new in Drupal 7" rel="bookmark" href="http://blog.eood.cn/what-is-new-in-drupal-7">What is new in Drupal 7</a></li>
<li><a title="Permanent Link to Drupal Views PHP Code Validator" rel="bookmark" href="http://blog.eood.cn/drupal-views-php-code-validator">Drupal Views PHP Code Validator</a></li>
<li><a title="Permanent Link to [Drupal] 错误执行MYSQL命令之后如何挽救" rel="bookmark" href="http://blog.eood.cn/drupal_mysql_tips">[Drupal] 错误执行MYSQL命令之后如何挽救</a></li>
<li><a title="Permanent Link to Add a custom tab menu in profile edit page in Drupal 7" rel="bookmark" href="http://blog.eood.cn/add-a-custom-tab-menu-in-profile-edit-page-in-drupal-7-2">Add a custom tab menu in profile edit page in Drupal 7</a></li>
<li><a title="Permanent Link to Why Drupal is not popular in China" rel="bookmark" href="http://blog.eood.cn/why-drupal-is-not-popular-in-china">Why Drupal is not popular in China</a></li>
</ol>
<p>Drupal 仍然是快速原型，甚至是生产系统的首选。当然现在更多的人推崇 Rails 或者 Django， NodeJS ，个人也在 2011 对这 3 中技术堆栈进行了认真比较，发现 Drupal 仍然是不二选择。当然 Drupal 只能用在 WEB 的 UI 界面和业务逻辑部分，对性能要求高的地方或者通讯层可以考虑用 NodeJS 或者 Erlang 。假如能自己定主要开发框架，我倒是愿意尝试 Django ，它看起来还是比较完善的。</p>
<p><strong>关于前端开发</strong></p>
<ol>
<li><a title="Permanent Link to JSON JSON-RPC 和 JSONP" rel="bookmark" href="http://blog.eood.cn/json-json-rpc-%e5%92%8c-jsonp">JSON JSON-RPC 和 JSONP</a></li>
<li><a title="Permanent Link to JSONP Library In Plain JavaScript With Timeout" rel="bookmark" href="http://blog.eood.cn/jsonp-library-in-plain-javascript-with-timeout">JSONP Library In Plain JavaScript With Timeout</a></li>
<li><a href="http://blog.eood.cn/backbone">Backbone JS框架指南</a></li>
<li><a title="Permanent Link to CoffeeScript – 未来可以取代 JavaScript 的语言" rel="bookmark" href="http://blog.eood.cn/coffeescript-2">CoffeeScript – 未来可以取代 JavaScript 的语言</a></li>
<li><a title="Permanent Link to Javascript 设计模式入门" rel="bookmark" href="http://blog.eood.cn/javascript-design-patterns">Javascript 设计模式入门</a></li>
</ol>
<p>前端部分这年尝试了基于 Backbone 开发，发现它也是个学习曲线比较高的东西，但是一旦熟悉还是很通用的。CoffeeScript 建议不要用，无论如何还是离不开 JS 。2011 前端部分研究比较多，发现 WEB 开发最靠谱的还是纯文本+超链接的方式，将计算分散到客户端是比较不靠谱的想法，尝试各种花哨的前端技术也是不靠谱的，毕竟<strong>用户体验</strong>才是王道。</p>
<p><strong>关于 WEB 架构</strong></p>
<ol>
<li><a title="Permanent Link to 谈一谈 Scalability 和可扩展的架构设计模式" rel="bookmark" href="http://blog.eood.cn/scalable_system_patterns">谈一谈 Scalability 和可扩展的架构设计模式</a></li>
<li><a title="Permanent Link to WEB Development Rookie – NodeJS" rel="bookmark" href="http://blog.eood.cn/web-development-rookie-nodejs">WEB Development Rookie – NodeJS</a></li>
<li><a title="Permanent Link to Enter Django Development" rel="bookmark" href="http://blog.eood.cn/enter_django_python_development">Enter Django Development</a></li>
<li><a title="Permanent Link to 细数跨语言通信的选择" rel="bookmark" href="http://blog.eood.cn/cross_language_communication">细数跨语言通信的选择</a></li>
</ol>
<p>NodeJS 可能是 2011 最热门的话题，目前已经在项目 B 用到了生产环境。</p>
<p><strong>其他</strong></p>
<ol>
<li><a title="Permanent Link to What tools and software used for development" rel="bookmark" href="http://blog.eood.cn/what-tools-and-software-used-fro-development">What tools and software used for development</a></li>
<li><a title="Permanent Link to XML 文件处理利器 VTD-XML" rel="bookmark" href="http://blog.eood.cn/vtd-xml_xml_parser">XML 文件处理利器 VTD-XML</a></li>
<li><a title="Permanent Link to Encrypt your files or content on cloud services" rel="bookmark" href="http://blog.eood.cn/encrypt-your-files-or-content-on-cloud-services">Encrypt your files or content on cloud services</a></li>
<li><a title="Permanent Link to 如何停止Windows服务器上僵死进程" rel="bookmark" href="http://blog.eood.cn/kill_zombie_process">如何停止Windows服务器上僵死进程</a></li>
</ol>
<h2>2011的个人计划完成</h2>
<ol>
<li>深入IOS , Android开发 <strong><span style="color: #ff0000;">未完成</span></strong></li>
<li>关注产品的网络营销 <span style="color: #ff0000;"><strong><span style="color: #008000;">完成</span></strong></span></li>
<li>项目1,2,3的开发和营销的0突破 <strong><span style="color: #ff0000;">未完成</span></strong></li>
<li><span style="text-decoration: line-through;">Improve Algorithm and Linux C DELETED</span></li>
<li>继续关注 Marketing, Social information, BI <span style="color: #ff0000;"><strong>完成</strong></span></li>
<li><span style="text-decoration: line-through;">换一个拥有大数据量的环境? DELETED</span></li>
</ol>
<p>Oh, shit!  好像 2011 并没有按计划进行，但是仍然很充实，有很多收获。</p>
<h2>2012个人目标</h2>
<ol>
<li>进入 <span style="color: #ff0000;"><strong>IOS</strong> </span>, <span style="color: #008000;"><strong>Android </strong></span>开发</li>
<li>继续关注市场和营销趋势</li>
<li>项目方向改进和营销</li>
<li>构建基于人工智能的解析器</li>
<li>写更多质量比较好的总结博客</li>
<li>尝试<span style="text-decoration: underline;"><strong>新</strong></span>的模式</li>
</ol>
<p><a href="http://blog.eood.cn/backbone"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.eood.cn/2011-review/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google 彩蛋大全</title>
		<link>http://blog.eood.cn/google_tricks</link>
		<comments>http://blog.eood.cn/google_tricks#comments</comments>
		<pubDate>Tue, 20 Dec 2011 03:20:06 +0000</pubDate>
		<dc:creator>Bruce Dou</dc:creator>
				<category><![CDATA[IT Reviews]]></category>

		<guid isPermaLink="false">http://blog.eood.cn/google_tricks</guid>
		<description><![CDATA[在 Google 的搜索框输入以下词就能看到彩蛋效果： Let it snow = 在页面上下雪和下雾 Askew = 屏幕会向右倾斜 Tilt = 也是屏幕向右倾斜 Recursion = 循环提问你是不是要找 Recursion Hannukah = 出现一排小星星 Google 重力下沉效果:&#160;http://mrdoob.com/projects/chromeexperiments/google_gravity/ &#160; &#160;]]></description>
			<content:encoded><![CDATA[<p><strong>在 Google 的搜索框输入以下词就能看到彩蛋效果：</strong></p>
<p>Let it snow = 在页面上下雪和下雾</p>
<p>Askew = 屏幕会向右倾斜</p>
<p>Tilt = 也是屏幕向右倾斜</p>
<p>Recursion = 循环提问你是不是要找 Recursion</p>
<p>Hannukah = 出现一排小星星</p>
<p>Google 重力下沉效果:&nbsp;<a href="http://mrdoob.com/projects/chromeexperiments/google_gravity/">http://mrdoob.com/projects/chromeexperiments/google_gravity/</a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.eood.cn/google_tricks/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>比较酷的书签 (Bookmarklet) 应用</title>
		<link>http://blog.eood.cn/bookmarklet_apps</link>
		<comments>http://blog.eood.cn/bookmarklet_apps#comments</comments>
		<pubDate>Fri, 16 Dec 2011 05:51:01 +0000</pubDate>
		<dc:creator>Bruce Dou</dc:creator>
				<category><![CDATA[IT Reviews]]></category>
		<category><![CDATA[Appliaction]]></category>
		<category><![CDATA[Web 2.0]]></category>

		<guid isPermaLink="false">http://blog.eood.cn/bookmarklet_apps</guid>
		<description><![CDATA[// < ![CDATA[ google_ad_client = "ca-pub-5744751471423663"; /* blog */ google_ad_slot = "4169011132"; google_ad_width = 468; google_ad_height = 60; // ]]&#62; 书签应用是一种通过在书签中嵌入可以运行的 Javascript 代码，通过调用远程资源文件，对正在浏览的网页进行入侵式修改的应用。 书签应用的安装，一般是把一个链接拖到收藏夹，有的个人应用可能需要注册之后操作。 Cc2Me 是结合 Gmail 使用的网页笔记应用。可以收藏当前浏览 URL ，并且可以在当前 URL 记笔记，还支持 Tag ，通过 Gmail 的 Filter 管理。 YumTab 是一个自动收藏所浏览网页的应用，特点是可以自动提取图片和摘要，以便以后查阅。 Mobile Pref 是移动客户端的网页辅助开发工具，集成了 Firebug Lite DOM Monster Storager YSlow SpriteMe CSSess Zoompf 等工具。 PrintWhatYouLike 可以让你随意修改所浏览网页，添加删除内容，手工修改成所需要的打印版本。 Delicious [...]]]></description>
			<content:encoded><![CDATA[<p><script type="text/javascript">// < ![CDATA[
 google_ad_client = "ca-pub-5744751471423663"; /* blog */ google_ad_slot = "4169011132"; google_ad_width = 468; google_ad_height = 60;
// ]]&gt;</script><br />
<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript">
</script></p>
<p>书签应用是一种通过在书签中嵌入可以运行的 Javascript 代码，通过调用远程资源文件，对正在浏览的网页进行入侵式修改的应用。</p>
<p>书签应用的安装，一般是把一个链接拖到收藏夹，有的个人应用可能需要注册之后操作。</p>
<p><a title="CC2ME" href="http://cctome.com/" target="_blank">Cc2Me</a> 是结合 Gmail 使用的网页笔记应用。可以收藏当前浏览 URL ，并且可以在当前 URL 记笔记，还支持 Tag ，通过 Gmail 的 Filter 管理。</p>
<p><img style="display: block; margin-left: auto; margin-right: auto; border: 3px solid black;" src="http://blog.eood.cn/wp-content/uploads/2011/12/amazingly_powerful.png" alt="" width="340" height="180" /></p>
<p><a href="https://yumtab.com/">YumTab</a> 是一个自动收藏所浏览网页的应用，特点是可以自动提取图片和摘要，以便以后查阅。</p>
<p><img style="display: block; margin-left: auto; margin-right: auto; border: 3px solid black;" src="https://yumtab.com/static/images/logo6b.png" alt="" width="120" height="40" /></p>
<p><a href="http://stevesouders.com/mobileperf/mobileperfbkm.php">Mobile Pref</a> 是移动客户端的网页辅助开发工具，集成了 <span style="font-family: Arial; font-size: 12px; line-height: 16px;"><a style="outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: #0000ee; text-decoration: underline; background-position: initial initial; background-repeat: initial initial; padding: 0px; margin: 0px; border: 0px initial initial;">Firebug Lite</a> </span><span style="font-family: Arial; font-size: 12px; line-height: 16px;"><a style="outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: #0000ee; text-decoration: underline; background-position: initial initial; background-repeat: initial initial; padding: 0px; margin: 0px; border: 0px initial initial;">DOM Monster</a> </span><span style="font-family: Arial; font-size: 12px; line-height: 16px;"><a style="outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: #0000ee; text-decoration: underline; background-position: initial initial; background-repeat: initial initial; padding: 0px; margin: 0px; border: 0px initial initial;">Storager</a> </span><span style="font-family: Arial; font-size: 12px; line-height: 16px;"><a style="outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: #0000ee; text-decoration: underline; background-position: initial initial; background-repeat: initial initial; padding: 0px; margin: 0px; border: 0px initial initial;">YSlow</a> </span><span style="font-family: Arial; font-size: 12px; line-height: 16px;"><a style="outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: #0000ee; text-decoration: underline; background-position: initial initial; background-repeat: initial initial; padding: 0px; margin: 0px; border: 0px initial initial;">SpriteMe</a> </span><span style="font-family: Arial; font-size: 12px; line-height: 16px;"><a style="outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: #0000ee; text-decoration: underline; background-position: initial initial; background-repeat: initial initial; padding: 0px; margin: 0px; border: 0px initial initial;">CSSess</a> </span><span style="font-family: Arial; font-size: 12px; line-height: 16px;"><a style="outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 12px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: #0000ee; text-decoration: underline; background-position: initial initial; background-repeat: initial initial; padding: 0px; margin: 0px; border: 0px initial initial;">Zoompf</a> 等工具。</span></p>
<p><span style="font-family: Arial; font-size: 12px; line-height: 16px;"><img style="display: block; margin-left: auto; margin-right: auto; border: 3px solid black;" src="http://stevesouders.com/mobileperf/mobileperfbkm.png" alt="" width="134" height="264" /></span></p>
<p><a href="http://www.printwhatyoulike.com/" target="_blank">PrintWhatYouLike</a> 可以让你随意修改所浏览网页，添加删除内容，手工修改成所需要的打印版本。</p>
<p><img style="display: block; margin-left: auto; margin-right: auto; border: 3px solid black;" src="http://www.printwhatyoulike.com/site/img/demotop_h3.png" alt="" width="396" height="254" /></p>
<p><a href="http://delicious.com/help/bookmarklets" target="_blank">Delicious</a> 鼎鼎大名的网址收藏网站。</p>
<p><img style="display: block; margin-left: auto; margin-right: auto; border: 3px solid black;" src="http://delicious.com/static/img/button_bookmarklet.png" alt="" width="162" height="44" /></p>
<p><a href="https://dev.twitter.com/docs/share-bookmarklet" target="_self">Twitter</a> 一键分享内容到 Twitter</p>
<p><img style="display: block; margin-left: auto; margin-right: auto; border: 3px solid black;" src="http://blog.eood.cn/wp-content/uploads/2011/12/share-bookmarklet-flow.png" alt="" width="357" height="297" /></p>
<p><a href="http://readitlaterlist.com/bookmarklets" target="_blank">ReaditLater</a> 网页收藏工具</p>
<p><img style="display: block; margin-left: auto; margin-right: auto; border: 3px solid black;" src="http://readitlaterlist.com/i/bookmarklets.png" alt="" width="243" height="216" /></p>
<p><a href="http://citebite.com/bookmarklet" target="_blank">CiteBite</a> 在线注释和网址收藏工具。</p>
<p><img style="display: block; margin-left: auto; margin-right: auto; border: 3px solid black;" src="http://blog.eood.cn/wp-content/uploads/2011/12/bookmarklet.gif" alt="" width="305" height="100" /></p>
<p><a href="http://www.readability.com/bookmarklets" target="_blank">Readability</a> 网页内容提取工具，可以自动移除广告和其他无关内容。</p>
<p><img style="display: block; margin-left: auto; margin-right: auto; border: 3px solid black;" src="http://du3itj18e4z0b.cloudfront.net/b90819/images/publish_learn.png" alt="" width="394" height="356" /></p>
<p><a href="http://www.addthis.com/tools/bookmarklets" target="_blank">AddThis</a> 很流行嵌入式的兴趣分享按钮的Bookmarklet</p>
<p><img style="display: block; margin-left: auto; margin-right: auto; border: 3px solid black;" src="http://www.addthis.com/cms-content/images/tools/at_bookmarklet.jpg" alt="" width="522" height="260" /></p>
<p><a href="http://posterous.com/help/bookmarklet" target="_blank">Posterous</a> 博客类应用，通过 Bookmarklet 快捷的发布博客。</p>
<p><img style="display: block; margin-left: auto; margin-right: auto; border: 3px solid black;" src="http://blog.eood.cn/wp-content/uploads/2011/12/illustration1.png" alt="" /></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.eood.cn/bookmarklet_apps/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[Drupal] 错误执行MYSQL命令之后如何挽救</title>
		<link>http://blog.eood.cn/drupal_mysql_tips</link>
		<comments>http://blog.eood.cn/drupal_mysql_tips#comments</comments>
		<pubDate>Mon, 28 Nov 2011 02:25:00 +0000</pubDate>
		<dc:creator>Bruce Dou</dc:creator>
				<category><![CDATA[Life & Work]]></category>
		<category><![CDATA[Drupal]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://blog.eood.cn/drupal_mysql_tips</guid>
		<description><![CDATA[长期维护生产环境的数据库，恐怕很多人会犯这样的错误: update tableA set field1value = VVVV (where &#8230;); 忘记了加括号中的约束条件，等反应过来，Shell 中显示已经更新了几万条数据。 如何挽救这样的失误呢？ 每天进行数据备份，我们的方案是每天 dump 整库，保存在 S3 中，服务器上只保存昨天的数据 假如有前一天的备份数据，可以选择性恢复除了今天以外的数据。Shell 中命令行失误往往被损坏的数据都涉及一张表的一个字段或者几个字段。 Drupal 中可以利用其支持多库的特性，新建一个旧数据的库，从旧数据库中读取数据，覆盖到新库上。以下是恢复数据的脚本例子 假如不是 Drupal 系统，也可以直接用 PHP 连接2个数据库，进行类似操作。]]></description>
			<content:encoded><![CDATA[<p>长期维护生产环境的数据库，恐怕很多人会犯这样的错误:</p>
<p>update table<em></em><em>A set field</em>1value = VVVV (where &#8230;);</p>
<p>忘记了加括号中的约束条件，等反应过来，Shell 中显示已经更新了几万条数据。</p>
<p>如何挽救这样的失误呢？</p>
<ol>
<li>每天进行数据备份，我们的方案是每天 dump 整库，保存在 S3 中，服务器上只保存昨天的数据</li>
<li>假如有前一天的备份数据，可以选择性恢复除了今天以外的数据。Shell 中命令行失误往往被损坏的数据都涉及一张表的一个字段或者几个字段。</li>
<li>Drupal 中可以利用其支持多库的特性，新建一个旧数据的库，从旧数据库中读取数据，覆盖到新库上。以下是恢复数据的脚本例子</li>
</ol>
<p><script src=http://gist.github.com/cb5584ba78c08ff8073b.js ></script></p>
<p>假如不是 Drupal 系统，也可以直接用 PHP 连接2个数据库，进行类似操作。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.eood.cn/drupal_mysql_tips/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Add a custom tab menu in profile edit page in Drupal 7</title>
		<link>http://blog.eood.cn/add-a-custom-tab-menu-in-profile-edit-page-in-drupal-7-2</link>
		<comments>http://blog.eood.cn/add-a-custom-tab-menu-in-profile-edit-page-in-drupal-7-2#comments</comments>
		<pubDate>Thu, 20 Oct 2011 08:12:00 +0000</pubDate>
		<dc:creator>Bruce Dou</dc:creator>
				<category><![CDATA[Life & Work]]></category>

		<guid isPermaLink="false">http://blog.eood.cn/add-a-custom-tab-menu-in-profile-edit-page-in-drupal-7-2</guid>
		<description><![CDATA[There 2 methods to add a menu in Drupal, hookmenu or hookmenu_alert We can define a menu like this: $items['user/%user/facebook'] = array( 'title' =&#62; 'Facebook', 'description' =&#62; 'Facebook Profile', 'page callback' =&#62; 'facebook_user_settings', 'file' =&#62; 'facebook.pages.inc', 'page arguments' =&#62; array(1), 'access callback' =&#62; 'facebook_user_access', //access arguments don't support multiple arguments, so create our access handler [...]]]></description>
			<content:encoded><![CDATA[<p><img style="vertical-align: middle;" src="http://blog.eood.cn/wp-content/uploads/2011/10/drupal_7_menu.png" alt="Drupal 7 profile menu" width="265" height="178" /></p>
<p>There 2 methods to add a menu in Drupal, hook<em>menu or hook</em>menu_alert</p>
<p><strong>We can define a menu like this:</strong></p>
<pre>
  $items['user/%user/facebook'] = array(
    'title' =&gt; 'Facebook',
    'description' =&gt; 'Facebook Profile',
    'page callback' =&gt; 'facebook_user_settings',
    'file' =&gt; 'facebook.pages.inc',
    'page arguments' =&gt; array(1),
    'access callback' =&gt; 'facebook_user_access', //access arguments don't support multiple arguments, so create our access handler
    'access arguments' =&gt; array(1),
    'type' =&gt; <span style="color: #ff0000;">MENU_LOCAL_TASK</span>,
  );
</pre>
<p>Because the menu type is MENU<em>LOCAL</em>TASK, this will add a new tab &#8220;Facebook&#8221; right after the &#8220;edit&#8221; tab.&nbsp;</p>
<p>But how to add the &#8220;facebook&#8221; tab in secondary level, after &#8220;Account&#8221;, just do as the &#8220;Linkedin&#8221; tab?</p>
<p><strong>The following code is <span style="color: #ff0000;">NOT</span> right:</strong></p>
<pre>
  $items['user/%user/<span style="color: #ff0000;">edit</span>/facebook'] = array(
    'title' =&gt; 'Facebook',
    'description' =&gt; 'Facebook Profile',
    'page callback' =&gt; 'facebook_user_settings',
    'file' =&gt; 'facebook.pages.inc',
    'page arguments' =&gt; array(1),
    'access callback' =&gt; 'facebook_user_access', //access arguments don't support multiple arguments, so create our access handler
    'access arguments' =&gt; array(1),
    'type' =&gt; MENU_LOCAL_TASK,
  );
</pre>
<p>&nbsp;</p>
<p>This will lead some errors. You should do as the following steps, (Linkedin codes):</p>
<p><strong>Step 1, show a tab menu after &#8220;Account&#8221;:</strong></p>
<pre>
function linkedin_user_categories() {
  return array(
    array(
      'name' =&gt; 'linkedin',
      'title' =&gt; 'Linkedin',
      'weight' =&gt; 3,
    ),
  );
}
</pre>
<p><strong>Step 2, define the menu callback functions:</strong></p>
<pre>
function linkedin_menu_alter(&amp;$callbacks) {
  $callbacks['user/%user_category/edit/linkedin']['page callback'] = 'linkedin_user_settings';
  $callbacks['user/%user_category/edit/linkedin']['module'] = 'linkedin';
  $callbacks['user/%user_category/edit/linkedin']['page arguments'] = array(1);
  $callbacks['user/%user_category/edit/linkedin']['file'] = 'linkedin.pages.inc';
}
</pre>
<p>There is no document about hook<em>user</em>categories for Drupal 7, so this article shows How to use it.</p>
<p>Hope to help you.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.eood.cn/add-a-custom-tab-menu-in-profile-edit-page-in-drupal-7-2/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enter Django Development</title>
		<link>http://blog.eood.cn/enter_django_python_development</link>
		<comments>http://blog.eood.cn/enter_django_python_development#comments</comments>
		<pubDate>Mon, 17 Oct 2011 08:55:13 +0000</pubDate>
		<dc:creator>Bruce Dou</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Development Story]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://blog.eood.cn/?p=1751</guid>
		<description><![CDATA[Introduction: Django is the modern base stack for web development. Compared with Ruby on Rails, I think I like Django better: Build-in ready to use admin interface Written in Python, with better performance Simpler and reasonable project struct Smaller base stack, but you can add what you want (ajax, south, REST, oauth &#8230;) Essential tools [...]]]></description>
			<content:encoded><![CDATA[<p><img style="float: right;" src="http://blog.eood.cn/wp-content/uploads/2011/10/django_serious-pony-331x300.jpg" alt="Django" width="331" height="300" /></p>
<p><strong><span style="font-size: large;">Introduction:</span></strong></p>
<p>Django is the modern base stack for web development. Compared with Ruby on Rails, I think I like Django better:</p>
<ul>
<li>Build-in ready to use admin interface</li>
<li>Written in Python, with better performance</li>
<li>Simpler and reasonable project struct</li>
<li>Smaller base stack, but you can add what you want (ajax, south, REST, oauth &#8230;)</li>
</ul>
<p><strong><span style="font-size: large;">Essential tools for Django development:</span></strong></p>
<p><span style="color: #000000;"><strong>virtualenv</strong></span></p>
<p>We use this to manage the library for the project. You can have different environments (different python modules, different python versions) for every projects.</p>
<blockquote><p><strong>Create new clean environment foobar</strong></p>
<p>virtualenv &#8211;no-site-packages foobar</p>
<p><strong>Active the environment foobar</strong></p>
<p>source foobar/bin/activate</p>
<p><strong>Then install library in the environment foobar</strong></p>
<p>pip &#8230;</p>
<p><strong>At the end leave the environment foobar</strong></p>
<p>deactivate</p>
</blockquote>
<p><strong>pip or easy_install</strong></p>
<p><em></em>To install python libraries.</p>
<p><strong> Django south</strong></p>
<p>Database migration tool. Alertanative tool for syncdb</p>
<p><strong>Create migration for your app</strong></p>
<p><em> ./manage.py schemamigration myapp &#8211;initial</em></p>
<p><strong>Apply the migration</strong></p>
<p><em> ./manage.py migrate myapp</em></p>
<p><strong> Then change the model myapp, and make a new migratation</strong></p>
<p><em> ./manage.py schemamigration myapp &#8211;auto</em></p>
<p><strong> And apply it</strong></p>
<p><em> ./manage.py migrate myapp django-annoying</em></p>
<p><strong> Useful decorators:</strong></p>
<p><em> rederto ajaxrequest JSONField getobjectorNone</em></p>
<p><strong>django-compressor</strong></p>
<p>Compresses linked and inline javascript or CSS into a single cached file. And support coffeescript and less css framework.</p>
<p><strong>django-pagination</strong></p>
<p>pagination tools</p>
<p><strong>django-piston</strong></p>
<p><strong></strong>A mini-framework for Django for creating RESTful APIs.</p>
<p><strong>django-celery</strong></p>
<p>Celery integration for Django.</p>
<p>Celery is a task queue/job queue based on distributed message passing.</p>
<p><strong>django-mongodb</strong></p>
<p>MongoDB backend</p>
<p><strong>django-admin-tools</strong></p>
<p>Custom user interface, customizable dashboard</p>
<p><strong>django-socialauth</strong></p>
<p>oauth for social sites, login with twitter account, facebook account or gmail account</p>
<p><strong>django-storages</strong></p>
<p>Amazon S3, MogileFS file storage</p>
<p><strong>django-grappelli</strong></p>
<p>A jazzy skin for the Django Admin-Interface</p>
<p><strong>django-profiles</strong></p>
<p>A simple application which provides basic features for working with custom user profiles in Django projects.</p>
<p><strong>django-registration</strong></p>
<p>User registration and login</p>
<p><strong>simplejson</strong></p>
<p>JSON encoding and decoding</p>
<p><strong>django-imagekit</strong></p>
<p>Image process, support S3.</p>
<p><strong>Beautiful Soup</strong></p>
<p>Web Scrapping tool</p>
<p><strong>django-workflows</strong></p>
<p>django-workflows provides a generic workflow engine for Django.</p>
<p><span style="font-size: large;">The Django development environment steps:</span></p>
<p><strong>How to install the virtualenv &amp; django:</strong></p>
<blockquote><p>sudo apt-get install python-virtualenv</p>
<p>virtualenv &#8211;no-site-packages env_nm</p>
<p>source env_nm/bin/activate</p>
<p>pip install django</p>
<p>&#8230; ( install other modules )</p>
<p>deactivate</p>
<p>Export the libraries of the environment to a configuration file</p>
<p>pip freeze &gt; requirements.txt</p>
<p>Install the environment in a clean environment</p>
<p>pip install -r requirements.txt</p>
</blockquote>
<p><strong>The missing part of Django settings.py</strong></p>
<blockquote><p><span style="font-size: small;">import os</span></p>
<p><span style="font-size: small;">ROOT_PATH = os.path.dirname(file)</span></p>
<p><span style="font-size: small;">MEDIAROOT = os.path.join(ROOTPATH, &#8216;static&#8217;)</span></p>
<p><span style="font-size: small;">TEMPLATE_DIRS = (</span></p>
<p><span style="font-size: small;">os.path.join(ROOT_PATH, &#8216;templates&#8217;)</span></p>
<p><span style="font-size: small;">)</span></p>
</blockquote>
<p><strong>Django Signals &#8211; You should pay attentation to this</strong></p>
<p>This is the ECA (Aka: Event Condition Action) part of Django.&nbsp;</p>
<p>ECA is the essentail part of modern web appliactions.</p>
<p><strong><span style="font-size: large;">Other useful modules:</span></strong></p>
<p>SQLAlchemy &#8211; use this when the django ORM is not enough.</p>
<p>Haystack &#8211; Modular search for Django.</p>
<p>Django-mptt &#8211; Preorder tree management</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.eood.cn/enter_django_python_development/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Encrypt your files or content on cloud services</title>
		<link>http://blog.eood.cn/encrypt-your-files-or-content-on-cloud-services</link>
		<comments>http://blog.eood.cn/encrypt-your-files-or-content-on-cloud-services#comments</comments>
		<pubDate>Wed, 21 Sep 2011 04:39:46 +0000</pubDate>
		<dc:creator>Bruce Dou</dc:creator>
				<category><![CDATA[Life & Work]]></category>
		<category><![CDATA[mcrypt]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://blog.eood.cn/encrypt-your-files-or-content-on-cloud-services</guid>
		<description><![CDATA[More and more cloud services enter our life. Such as Cloud file store service Dropbox. We can not only rely on the Safety of the service provider.&#160; Two way to encrypt your content or files: 1. Encrypt by password in VIM Just enter: :set key=&#60;password&#62; when you editing the file, then the file will be [...]]]></description>
			<content:encoded><![CDATA[</p>
<p>More and more cloud services enter our life. Such as Cloud file store service Dropbox. We can not only rely on the Safety of the service provider.&nbsp;</p>
<p>Two way to encrypt your content or files:</p>
<p><strong>1. Encrypt by password in VIM</strong></p>
<p>Just enter:</p>
<p><span style="color: #0000ff;">:set key=&lt;password&gt;</span></p>
<p>when you editing the file, then the file will be encrypted.</p>
<p>When opening the encrypted file, you will be asked to input the password.</p>
<p>If you want to convert a encrypted file to be a plain file, you should set the &lt;password&gt; to be empty.</p>
<p><strong>2. Encrypt files by mcrypt in UBUNTU:</strong></p>
<p>Install mcrypt:</p>
<p><span style="color: #0000ff;">sudo apt-get install mycrypt</span></p>
<p>Encrypt a file with password:</p>
<p><span style="color: #0000ff;">mcrypt -a blowfish test.txt</span></p>
<p>You will get a file named&nbsp;</p>
<p><span style="color: #0000ff;">test.txt.nc</span></p>
<p>Decrypt the .nc file</p>
<p><span style="color: #0000ff;">mycrypt -d test.txt.nc</span></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.eood.cn/encrypt-your-files-or-content-on-cloud-services/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CoffeeScript &#8211; 未来可以取代 JavaScript 的语言</title>
		<link>http://blog.eood.cn/coffeescript-2</link>
		<comments>http://blog.eood.cn/coffeescript-2#comments</comments>
		<pubDate>Thu, 01 Sep 2011 07:39:00 +0000</pubDate>
		<dc:creator>Bruce Dou</dc:creator>
				<category><![CDATA[Life & Work]]></category>
		<category><![CDATA[Backbone]]></category>
		<category><![CDATA[CoffeeScript]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[NodeJS]]></category>

		<guid isPermaLink="false">http://blog.eood.cn/?p=1740</guid>
		<description><![CDATA[CoffeeScript 是在JavaScript 基础上增加了很多易读的语法糖的新一代编程语言。 CoffeeScript 编译成 JavaScript 在客户端执行，或者在 NodeJS 服务器端执行。它的语法本质就是 JavaScript ，但是提高了代码的可读性。 在 JavaScript 基础上增加了很多 Ruby Python 的语法特性。比如，用缩进代替括号，取消了作为行结束的分号，简化function定义, 用 @ 符号替代OO编程中到处用到的 this 。 增加了很多编程的强制规范，比如默认变量为局部变量，函数最后一行为返回值。 提供了很多 JavaScript 编程经常用到的模式，比如可以给函数提供默认值，改进的循环处理。 由于 CoffeeScript 编译为 JavaScript ，所以可以在任何需要 JavaScript 的地方用 CoffeeScript 取代它。如果说 Web 开发的趋势是 HTML5 和 服务器端 JavaScript 。那么 Web 开发的趋势就是 CoffeeScript 。你可以只写一种优雅的现代语言 CoffeeScript 。 CoffeeScript 编写和开发环境 以 Ubuntu 为例 需要安装 NodeJS [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://jashkenas.github.com/coffee-script/">CoffeeScript</a> 是在JavaScript 基础上增加了很多易读的语法糖的新一代编程语言。</p>
<p>CoffeeScript 编译成 JavaScript 在客户端执行，或者在 NodeJS 服务器端执行。它的语法本质就是 JavaScript ，但是提高了代码的可读性。</p>
<p><strong>在 JavaScript 基础上增加了很多 Ruby Python 的语法特性</strong>。比如，用缩进代替括号，取消了作为行结束的分号，简化function定义, 用 @ 符号替代OO编程中到处用到的 this 。</p>
<p><strong>增加了很多编程的强制规范</strong>，比如默认变量为局部变量，函数最后一行为返回值。</p>
<p><strong>提供了很多 JavaScript 编程经常用到的模式</strong>，比如可以给函数提供默认值，改进的循环处理。</p>
<p>由于 CoffeeScript 编译为 JavaScript ，所以可以在任何需要 JavaScript 的地方用 CoffeeScript 取代它。如果说 Web 开发的趋势是 <span style="color: #ff0000;">HTML5</span> 和 服务器端 JavaScript 。那么 Web 开发的趋势就是 CoffeeScript 。你可以只写一种优雅的现代语言 CoffeeScript 。</p>
<p><span style="font-size: medium;"><strong>CoffeeScript 编写和开发环境</strong></span></p>
<p>以 Ubuntu 为例</p>
<p>需要安装 NodeJS 作为编译器环境</p>
<p>安装 npm 包管理器</p>
<p>安装 coffee-script 编译器</p>
<p>npm install -g coffee-script</p>
<p>安装 VIM 插件 <a href="https://github.com/kchmck/vim-coffee-script">vim-coffee-script</a></p>
<p>然后在 VIM 中执行&nbsp;</p>
<p>:CoffeeCompile watch vert</p>
<div>这样在右边窗口开发 CoffeeScript ，可以在左边窗口实时查看被编译成的 JavaScript</div>
<div>也可以用命令行 coffee -c test.coffee 来手动编译</div>
<p><span style="font-size: medium;"><strong>常用的 CoffeeScript 语法例子</strong></span></p>
<p>定义一个连续数组</p>
<p><span style="font-family: Consolas, 'Courier New', Courier, mono; font-size: 12px; line-height: 14px;">numbers&nbsp;=&nbsp;[0..3] &nbsp;</span></p>
<p>循环操作数列</p>
<pre class="prettyprint">
sites = ['blog.eood.cn','www.eood.cn','google.com']
for site in sites
 alert site
</pre>
<p>甚至可以这样</p>
<pre class="prettyprint">
sites = ['blog.eood.cn','www.eood.cn','google.com']
alert site for site in sites
</pre>
<p>定义函数</p>
<pre class="prettyprint">
myfunc = (arg) -&gt;
  alert arg
</pre>
<p>或者</p>
<pre class="prettyprint">
myfunc:  -&gt;
  alert 'ok'
</pre>
<p>定义复杂对象</p>
<pre class="idle" style="font-family: Monaco, Consolas, 'Lucida Console', monospace; font-size: 12px; line-height: 18px; color: #000000; white-space: pre-wrap; word-wrap: break-word; border-left-width: 0px; border-left-style: initial; border-left-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 12px; background-color: #ffffff; width: 450px; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; margin-top: 10px; margin-right: 0px; margin-bottom: 15px; margin-left: 3px; background-position: initial initial; background-repeat: initial initial;">
kids <span class="Keyword" style="color: #ff5600;">=</span>
  brother:
    name: <span class="String" style="color: #00a33f;"><span class="String" style="color: #00a33f;">"</span>Max<span class="String" style="color: #00a33f;">"</span></span>
    age:  <span class="Number">11</span>
  sister:
    name: <span class="String" style="color: #00a33f;"><span class="String" style="color: #00a33f;">"</span>Ida<span class="String" style="color: #00a33f;">"</span></span>
    age:  <span class="Number">9</span>
</pre>
<p>同过 JQuery 操作 DOM</p>
<pre class="idle" style="font-family: Monaco, Consolas, 'Lucida Console', monospace; font-size: 12px; line-height: 18px; color: #000000; white-space: pre-wrap; word-wrap: break-word; border-left-width: 0px; border-left-style: initial; border-left-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 12px; background-color: #ffffff; width: 450px; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; margin-top: 10px; margin-right: 0px; margin-bottom: 15px; margin-left: 3px; background-position: initial initial; background-repeat: initial initial;">
$(<span class="String" style="color: #00a33f;"><span class="String" style="color: #00a33f;">'</span>.account<span class="String" style="color: #00a33f;">'</span></span>).attr class: <span class="String" style="color: #00a33f;"><span class="String" style="color: #00a33f;">'</span>active&lsquo;</span>
</pre>
<p>定义类和类的继承</p>
<pre class="idle" style="font-family: Monaco, Consolas, 'Lucida Console', monospace; font-size: 12px; line-height: 18px; color: #000000; white-space: pre-wrap; word-wrap: break-word; border-left-width: 0px; border-left-style: initial; border-left-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 12px; background-color: #ffffff; width: 450px; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; margin-top: 10px; margin-right: 0px; margin-bottom: 15px; margin-left: 3px; background-position: initial initial; background-repeat: initial initial;">
<span class="Storage" style="color: #ff5600;">class</span> <span class="TypeName" style="color: #21439c;">Animal</span>
  <span class="FunctionName" style="color: #21439c;">constructor</span><span class="Keyword" style="color: #ff5600;">:</span> <span class="FunctionArgument" style="color: #0076ad;">(@name)</span> <span class="Storage" style="color: #ff5600;">-&gt;</span>

  <span class="FunctionName" style="color: #21439c;">move</span><span class="Keyword" style="color: #ff5600;">:</span> <span class="FunctionArgument" style="color: #0076ad;">(meters)</span> <span class="Storage" style="color: #ff5600;">-&gt;</span>
    alert <span class="Variable" style="color: #a535ae;">@name</span> <span class="Keyword" style="color: #ff5600;">+</span> <span class="String" style="color: #00a33f;"><span class="String" style="color: #00a33f;">"</span> moved <span class="String" style="color: #00a33f;"><span class="String" style="color: #00a33f;">#{</span>meters<span class="String" style="color: #00a33f;">}</span></span>m.<span class="String" style="color: #00a33f;">"</span></span>

<span class="Storage" style="color: #ff5600;">class</span> <span class="TypeName" style="color: #21439c;">Snake</span><span class="InheritedClass"> <span class="Keyword" style="color: #ff5600;">extends</span> Animal</span>
  <span class="FunctionName" style="color: #21439c;">move</span><span class="Keyword" style="color: #ff5600;">:</span> <span class="Keyword" style="color: #ff5600;">-</span><span class="Keyword" style="color: #ff5600;">&gt;</span>
    alert <span class="String" style="color: #00a33f;"><span class="String" style="color: #00a33f;">"</span>Slithering...<span class="String" style="color: #00a33f;">"</span></span>
    <span class="Variable" style="color: #a535ae;">super</span> <span class="Number">5</span>

<span class="Storage" style="color: #ff5600;">class</span> <span class="TypeName" style="color: #21439c;">Horse</span><span class="InheritedClass"> <span class="Keyword" style="color: #ff5600;">extends</span> Animal</span>
  <span class="FunctionName" style="color: #21439c;">move</span><span class="Keyword" style="color: #ff5600;">:</span> <span class="Keyword" style="color: #ff5600;">-</span><span class="Keyword" style="color: #ff5600;">&gt;</span>
    alert <span class="String" style="color: #00a33f;"><span class="String" style="color: #00a33f;">"</span>Galloping...<span class="String" style="color: #00a33f;">"</span></span>
    <span class="Variable" style="color: #a535ae;">super</span> <span class="Number">45</span>
</pre>
<p>绑定事件函数到 DOM 对象</p>
<pre class="idle" style="font-family: Monaco, Consolas, 'Lucida Console', monospace; font-size: 12px; line-height: 18px; color: #000000; white-space: pre-wrap; word-wrap: break-word; border-left-width: 0px; border-left-style: initial; border-left-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 12px; background-color: #ffffff; width: 450px; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; margin-top: 10px; margin-right: 0px; margin-bottom: 15px; margin-left: 3px; background-position: initial initial; background-repeat: initial initial;">
  $(<span class="String" style="color: #00a33f;"><span class="String" style="color: #00a33f;">'</span>.shopping_cart<span class="String" style="color: #00a33f;">'</span></span>).bind <span class="String" style="color: #00a33f;"><span class="String" style="color: #00a33f;">'</span>click<span class="String" style="color: #00a33f;">'</span></span>, <span class="FunctionArgument" style="color: #0076ad;">(event)</span> <span class="Storage" style="color: #ff5600;">=&gt;</span>
    <span class="Variable" style="color: #a535ae;">@customer</span>.purchase <span class="Variable" style="color: #a535ae;">@cart</span>
</pre>
<p><span style="font-size: medium;"><strong>CoffeeScript 实际生产环境的使用</strong></span></p>
<p>可以结合 JQuery, Backbone JS 或者所有的 JavaScript 开发框架来开发复杂的前端应用和服务器端应用。37signals 利用了 CoffeeScript + BackboneJS 开发了 HTML5 的手机客户端程序。用 CoffeeScript 来书写 JavaScript 可以减少代码量，不降低代码执行效率，降低开发成本。</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.eood.cn/coffeescript-2/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>北京租房小记</title>
		<link>http://blog.eood.cn/rent_apartment_in_beijing</link>
		<comments>http://blog.eood.cn/rent_apartment_in_beijing#comments</comments>
		<pubDate>Sat, 27 Aug 2011 05:34:02 +0000</pubDate>
		<dc:creator>Bruce Dou</dc:creator>
				<category><![CDATA[Bussiness & Economic]]></category>
		<category><![CDATA[Life & Work]]></category>
		<category><![CDATA[Marketing]]></category>
		<category><![CDATA[marketing]]></category>

		<guid isPermaLink="false">http://blog.eood.cn/?p=1714</guid>
		<description><![CDATA[一直想就在北京租房，买房，出租房写一篇博客，但一直没时间。最近又需要出租那个小公寓。原来的租户需要回香港发展，这月房租到期。 所以遇到了如何出租自己的房子的问题 我具备的条件是一台可以上网的电脑，一部手机。希望用这简单而有限的资源完成将自己房子出租的目标。 目标是： 1. 将自己的房子出租 2. 尽量少的时间消耗 3. 尽量少的资源消耗，包括体力，精力 这是个如何发布信息和获取信息的问题或者典型的 Marketing 问题 想到的发布方法基本有以下几类： 1. 到活跃的社区相关论坛，小组发布信息 2. 到专业租房信息网发布信息 3. 微博发布信息 4. 找中介发布信息 5. 向认识的朋友发布信息 除此之外，逆向思维，假如我需要租房会这么办？ 6. 在活跃的社区相关论坛寻找需要租房的信息 7. 到专业的租房信息网寻找需要租房的信息 8. 微博寻找需要租房的信息 9. 找中介获取信息 10. 向认识的朋友获取信息 然后逐个尝试以上的方法 在开始之前，首先排除了 5 和 9 。 为什么首先排除房屋中介呢？ 不得不承认找房屋中介可以很快的将房子租出去。假如你不想耗费很多时间和精力，单纯从出租房的角度，找房屋中介应该是个不错的选择，虽然这种方法也有很多问题。 房屋中介是个看似合理的行业。和很多商业一样，帮助客户解决一些问题，拿到一定的报酬。一般都是收取一月的房租作为中介费，在美国租房也类似。 中介的商业模式是利用的信息的不对称。这在信息不发达的年代应该是非常合理的。但是在信息如此发达的今天，几乎所有需要租房的人和需要出租房的人都会想到上网发布信息。仍然存在那么多房屋中介就不那么合理了。 但他就是存在了，原因就是中介的商业模式从利用信息的不对称向制造信息不对称进行了转变。这造成了很大的资源浪费。好吧，扯远了，社会问题不是我们该关心的。 假如真的通过中介出租房屋会有哪些问题呢，或者会带来哪些损失？ 1. 大量的干扰信息，很多需要租房的人来看房，而不是租 原因在于，中介会尽力想办法促成交易拿到中介费。一方面，向需要租房的人掩藏一些必要和关键的信息，比如租金，房屋的缺点等等。另一方面，向出租房的人掩藏部分信息。比如需要租房人可以承受的租金，租期等等。这样做可以稳定出租房的人和需要租房的人两方面的客户。 2. 大量的骚扰电话 在网络化的今天，其实中介和我们自己获取信息的方式没有任何差别。基本也就是前边所列的几种方式。( 登门采集信息？他们和你一样不会那么做。中介也需要降低成本。) 但为什么中介仍然可以通过所有人都可以拿到的信息来赚钱呢？就是靠不停的浏览所有相关的信息渠道，和电话联系租房和需要租房的双方。以非常低廉的打电话的成本，来大规模的联系客户。 [...]]]></description>
			<content:encoded><![CDATA[<p>一直想就在北京租房，买房，出租房写一篇博客，但一直没时间。最近又需要出租那个小公寓。原来的租户需要回香港发展，这月房租到期。</p>
<p><strong>所以遇到了如何出租自己的房子的问题</strong></p>
<p>我具备的条件是一台可以上网的电脑，一部手机。希望用这简单而有限的资源完成将自己房子出租的目标。</p>
<p>目标是：</p>
<p>1. 将自己的房子出租</p>
<p>2. 尽量少的时间消耗</p>
<p>3. 尽量少的资源消耗，包括体力，精力</p>
<p><strong>这是个如何发布信息和获取信息的问题或者典型的 Marketing 问题</strong></p>
<p>想到的发布方法基本有以下几类：</p>
<p>1. 到活跃的社区相关论坛，小组发布信息</p>
<p>2. 到专业租房信息网发布信息</p>
<p>3. 微博发布信息</p>
<p>4. 找中介发布信息</p>
<p>5. 向认识的朋友发布信息</p>
<p>除此之外，逆向思维，假如我需要租房会这么办？</p>
<p>6. 在活跃的社区相关论坛寻找需要租房的信息</p>
<p>7. 到专业的租房信息网寻找需要租房的信息</p>
<p>8. 微博寻找需要租房的信息</p>
<p>9. 找中介获取信息</p>
<p>10. 向认识的朋友获取信息</p>
<p><strong>然后逐个尝试以上的方法</strong></p>
<p>在开始之前，首先排除了 5 和 9 。</p>
<p><strong>为什么首先排除房屋中介呢？</strong></p>
<p>不得不承认找房屋中介可以很快的将房子租出去。假如你不想耗费很多时间和精力，单纯从出租房的角度，找房屋中介应该是个不错的选择，虽然这种方法也有很多问题。</p>
<p>房屋中介是个看似合理的行业。和很多商业一样，帮助客户解决一些问题，拿到一定的报酬。一般都是收取一月的房租作为中介费，在美国租房也类似。</p>
<p>中介的商业模式是利用的信息的不对称。这在信息不发达的年代应该是非常合理的。但是在信息如此发达的今天，几乎所有需要租房的人和需要出租房的人都会想到上网发布信息。仍然存在那么多房屋中介就不那么合理了。</p>
<p>但他就是存在了，原因就是中介的商业模式从<span style="text-decoration: underline;">利用信息的不对称</span>向<span style="text-decoration: underline;">制造信息不对称</span>进行了转变。这造成了很大的资源浪费。好吧，扯远了，社会问题不是我们该关心的。</p>
<p><strong>假如真的通过中介出租房屋会有哪些问题呢，或者会带来哪些损失？</strong></p>
<p>1. 大量的干扰信息，很多需要租房的人来看房，而不是租</p>
<p>原因在于，中介会尽力想办法促成交易拿到中介费。一方面，向需要租房的人掩藏一些必要和关键的信息，比如租金，房屋的缺点等等。另一方面，向出租房的人掩藏部分信息。比如需要租房人可以承受的租金，租期等等。这样做可以稳定出租房的人和需要租房的人两方面的客户。</p>
<p>2. 大量的骚扰电话</p>
<p>在网络化的今天，其实中介和我们自己获取信息的方式没有任何差别。基本也就是前边所列的几种方式。( 登门采集信息？他们和你一样不会那么做。中介也需要降低成本。)</p>
<p>但为什么中介仍然可以通过所有人都可以拿到的信息来赚钱呢？就是靠不停的浏览所有相关的信息渠道，和电话联系租房和需要租房的双方。以非常低廉的打电话的成本，来大规模的联系客户。</p>
<p>即使通过打电话的转化率只有 0.1% ：</p>
<p>直接成本： 1000 *0.1 CNY + ( 2min * 1000 ) / 60 / 8  = 100 CNY + 4 Day</p>
<p>收入：1000  - 5000 CNY ( 一月房租 )</p>
<p>当然中介实际操作中，还会有其他的很多方式，来制造信息的不对称：到信息网站的发大量的虚假信息来获取客户； 联系信息网站，付费屏蔽真实信息等等。</p>
<p>减去其他成本和中介竞争造成的成本上升，房屋中介这种轻资产的商业模式仍然有非常高的利润率。</p>
<p>3. 时间和精力的浪费</p>
<p><strong>实施 2 到专业租房信息网发布信息</strong></p>
<p>登记了房屋的信息，为了避免中介联系，专门注明：1. 中介勿扰 2. 只可以短信联系。这样做希望能屏蔽我不希望的到的干扰信息。</p>
<p>在半天内获取的结果，截止到写这篇博客为止</p>
<p>真实租房人  - 1</p>
<p>中介电话 &#8211; 48 ( 看了中介根本不在意你的需求和想法，唯一目的就是赚钱，这个干扰没法屏蔽 )</p>
<p>中介短信 &#8211; 5 ( 部分中介还是比较认真看说明的 )</p>
<p>中介假冒租房人的短信 &#8211; 1 ( 无语了，短信强调自己不是中介，但是手机号码从Google一下就能找，以中介身份发布过信息)</p>
<p><strong>实施 1 到活跃的社区发布信息</strong></p>
<p>半天的结果</p>
<p>真实租房人 &#8211; 2 ( Social 社区的好处就是很容易将中介区分出来 )</p>
<p><strong>实施 3 到微博客发布信息</strong></p>
<p>1天结果</p>
<p>真实租房人 0</p>
<p>看了微博的受众还是太少了，只有600多粉丝可以在有限的一点时间内看到那条出租房的信息</p>
<p><strong>实施 5 向认识的朋友发布信息</strong></p>
<p>半天的结果</p>
<p>真实租房人 0</p>
<p>朋友中遇到要租房的概率还是非常小，简单而言仍然是受众太少。</p>
<p><strong>6, 7,  8,  9,  10 很难找到需要的信息</strong></p>
<p><strong><br />
</strong></p>
<p><strong>商业上结论</strong></p>
<p>纯粹利益驱动而没有监管的市场只能走向恶化。房屋中介就是个典型的例子。</p>
<p>有效的获取客户的方法仍然是利用成熟的信息平台。</p>
<p>在所有平台上发布广告或者信息寻找客户的同时一定会遇到损失，来自竞争对手和干扰。</p>
<p><strong>出租房的结论</strong></p>
<p>中介看起来虽好但难以让人相信。</p>
<p>以后遇到发布公众信息的时候，一定要买一张临时的手机卡。减少之后的骚扰。</p>
<p><strong>租房的结论</strong></p>
<p>假如不想通过中介，可以定期及时关注那些信息发布平台。</p>
<p>在网上查询发布人的手机号。</p>
<p><strong>其他</strong></p>
<p>房屋中介更换手机号的成本还是比较高的。固定电话自然不用说。手机号的更换意味着之前很多客户的损失。</p>
<p>另外，来着固定电话的 100% 都是中介。看来固定电话在个人使用上几乎已经淘汰了。</p>
<p><strong><br />
</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.eood.cn/rent_apartment_in_beijing/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Drupal Views PHP Code Validator</title>
		<link>http://blog.eood.cn/drupal-views-php-code-validator</link>
		<comments>http://blog.eood.cn/drupal-views-php-code-validator#comments</comments>
		<pubDate>Mon, 30 May 2011 07:48:12 +0000</pubDate>
		<dc:creator>Bruce Dou</dc:creator>
				<category><![CDATA[Life & Work]]></category>
		<category><![CDATA[Drupal]]></category>
		<category><![CDATA[Views]]></category>

		<guid isPermaLink="false">http://blog.eood.cn/drupal-views-php-code-validator</guid>
		<description><![CDATA[Views is one of the best module of Drupal. It provide a way to map the data in the mysql database to the web interface. You can do that even without writing any SQL query, just some clicks. I do not want to cover all the aspet of Views, but only to show how to [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Views </strong>is one of the best module of Drupal. It provide a way to map the data in the mysql database to the web interface. You can do that even without writing any SQL query, just some clicks. I do not want to cover all the aspet of Views, but only to show how to restrict the Veiws result based on <strong>Arguments</strong>.</p>
<p>Arguments are parts of URL, may be a node id in /node/xxxx, or user id in /user/xxxx. Views provide some build-in arguments: See <a href="http://drupal.org/node/54455">Views arguments</a>. You can restrict the views by Node type, User ID, Term ID, etc. But these build-in features can not meet all of our requirement.</p>
<p>So we can use <strong>PHP Code Validator</strong>.</p>
<p>For example, I want to show the view only in the node where a CCK field eqs <strong>1</strong>. And only show in the content type <em>blog</em>.</p>
<blockquote><p>$nid = $argument;<br />
$node = node_load($nid);<br />
return ($node-&gt;type == &#8216;blog&#8217; &amp;&amp; $node-&gt;field_Myfield_type[0]['value'] == 1);</p>
</blockquote>
<p>Put the php code block in the views argument, then you will find the result.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.eood.cn/drupal-views-php-code-validator/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic page generated in 0.353 seconds. -->
<!-- File not cached! Super Cache Couldn't write to: wp-content/cache/wp-cache-0efad6a227536fc53290837cb84894c4.html -->

