<?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>Nocoo.Weblog &#187; 开发心得</title>
	<atom:link href="http://www.nocoo.us/category/development-tips/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.nocoo.us</link>
	<description>Professional, Passion and Patient</description>
	<lastBuildDate>Sun, 27 Jun 2010 09:55:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Google实时搜索</title>
		<link>http://www.nocoo.us/2009/12/google-realtime-search/</link>
		<comments>http://www.nocoo.us/2009/12/google-realtime-search/#comments</comments>
		<pubDate>Tue, 08 Dec 2009 12:45:49 +0000</pubDate>
		<dc:creator>nocoo</dc:creator>
				<category><![CDATA[Web标准化研究]]></category>
		<category><![CDATA[开发心得]]></category>
		<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://www.nocoo.us/?p=4115</guid>
		<description><![CDATA[早就听说Google要整合实时信息比如Twitter到搜索结果中，这次真的见识到了，而且信息是不断更新到搜索结果页面中的&#8230;]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.nocoo.us/wp-content/uploads/2009/12/google-realtime.png"><img src="http://www.nocoo.us/wp-content/uploads/2009/12/google-realtime-610x419.png" alt="google-realtime" title="google-realtime" width="610" height="419" class="alignnone size-large wp-image-4116" /></a></p>
<p>早就听说Google要整合实时信息比如Twitter到搜索结果中，这次真的见识到了，而且信息是不断更新到搜索结果页面中的&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nocoo.us/2009/12/google-realtime-search/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>如何关联Silverlight和ASP.NET项目</title>
		<link>http://www.nocoo.us/2009/11/silverlight-asp-net-build-link/</link>
		<comments>http://www.nocoo.us/2009/11/silverlight-asp-net-build-link/#comments</comments>
		<pubDate>Sat, 07 Nov 2009 03:29:37 +0000</pubDate>
		<dc:creator>nocoo</dc:creator>
				<category><![CDATA[开发心得]]></category>
		<category><![CDATA[微软技术]]></category>
		<category><![CDATA[Silverlight]]></category>

		<guid isPermaLink="false">http://www.nocoo.us/?p=4097</guid>
		<description><![CDATA[用过Silverlight的兄弟都清楚，当在Visual Studio 2008中建立一个Silverlight Application Project时，首先会弹出一个提示框如上图，询问是否自动生成一个ASP.NET网站来托管这个Silverlight应用。默认会建立。一般情况下我们都会选择不建立，这样会在解决方案里少生成一个项目。 自动生成一个ASP.NET网站来托管这个Silverlight应用的好处是，在每次Debug整个解决方案的时候，Visual Studio 2008会自动首先编译Silverlight项目，然后把编译结果，一个xap文件，自动拷贝到ASP.NET网站项目的ClientBin下，然后启动ASP.NET网站项目的默认页面，显示了最新版本的Silverlight应用。如下图所示。 问题是，如果你一开始没有让Visual Studio 2008建立那个网站项目，如果哪天你需要一个网站了，可能是各种原因，比如需要一个本地的Web Service等等，自己新建一个ASP.NET网站，就不能实现上面的自动拷贝xap文件了。 解决方法比较绕。这是一个MSBuild问题，你需要Unload各个项目，然后用写字板打开ASP.NET的项目文件（csproj文件），然后在PropertyGroup中加一个SilverlightApplicationList项，如图： 注意相对路径，项目名称以及项目的GUID。这些东西都可以在解决方案文件（sln文件）里找到。就不详细解释了。 Reload项目之后Build，就会发现你的项目可以自动把xap文件拷贝到ClientBin下了。 后记：作为一个使用Silverlight开发了无数年的工程师，这似乎是我第一次写关于Silverlight的博文。现在想想，大概是公司政策使然？我应该是个很守规矩的人。]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.nocoo.us/wp-content/uploads/2009/11/silverlight-host.png" alt="silverlight-host" title="silverlight-host" width="447" height="265" class="alignnone size-full wp-image-4098" /></p>
<p>用过Silverlight的兄弟都清楚，当在Visual Studio 2008中建立一个Silverlight Application Project时，首先会弹出一个提示框如上图，询问是否自动生成一个ASP.NET网站来托管这个Silverlight应用。默认会建立。一般情况下我们都会选择不建立，这样会在解决方案里少生成一个项目。<br />
自动生成一个ASP.NET网站来托管这个Silverlight应用的好处是，在每次Debug整个解决方案的时候，Visual Studio 2008会自动首先编译Silverlight项目，然后把编译结果，一个xap文件，自动拷贝到ASP.NET网站项目的ClientBin下，然后启动ASP.NET网站项目的默认页面，显示了最新版本的Silverlight应用。如下图所示。</p>
<p><img src="http://www.nocoo.us/wp-content/uploads/2009/11/silverlight-host2.png" alt="silverlight-host2" title="silverlight-host2" width="293" height="372" class="alignnone size-full wp-image-4099" /></p>
<p>问题是，如果你一开始没有让Visual Studio 2008建立那个网站项目，如果哪天你需要一个网站了，可能是各种原因，比如需要一个本地的Web Service等等，自己新建一个ASP.NET网站，就不能实现上面的自动拷贝xap文件了。</p>
<p>解决方法比较绕。这是一个MSBuild问题，你需要Unload各个项目，然后用写字板打开ASP.NET的项目文件（csproj文件），然后在PropertyGroup中加一个SilverlightApplicationList项，如图：</p>
<p><a href="http://www.nocoo.us/wp-content/uploads/2009/11/silverlight-host3.png"><img src="http://www.nocoo.us/wp-content/uploads/2009/11/silverlight-host3-610x282.png" alt="silverlight-host3" title="silverlight-host3" width="610" height="282" class="alignnone size-large wp-image-4100" /></a></p>
<p>注意相对路径，项目名称以及项目的GUID。这些东西都可以在解决方案文件（sln文件）里找到。就不详细解释了。</p>
<p><img src="http://www.nocoo.us/wp-content/uploads/2009/11/silverlight-host4.png" alt="silverlight-host4" title="silverlight-host4" width="288" height="335" class="alignnone size-full wp-image-4101" /></p>
<p>Reload项目之后Build，就会发现你的项目可以自动把xap文件拷贝到ClientBin下了。</p>
<p><strong>后记：</strong>作为一个使用Silverlight开发了无数年的工程师，这似乎是我第一次写关于Silverlight的博文。现在想想，大概是公司政策使然？我应该是个很守规矩的人。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nocoo.us/2009/11/silverlight-asp-net-build-link/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Google Wave on my iPhone</title>
		<link>http://www.nocoo.us/2009/10/google-wave-on-my-iphone/</link>
		<comments>http://www.nocoo.us/2009/10/google-wave-on-my-iphone/#comments</comments>
		<pubDate>Fri, 23 Oct 2009 09:54:10 +0000</pubDate>
		<dc:creator>nocoo</dc:creator>
				<category><![CDATA[Web标准化研究]]></category>
		<category><![CDATA[开发心得]]></category>
		<category><![CDATA[服务器和集群技术]]></category>
		<category><![CDATA[Google Wave]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://www.nocoo.us/?p=4088</guid>
		<description><![CDATA[Google Wave是不是一种迅速花掉全部流量的方式呢，呵呵。 速度是真的慢啊，输入速度更是不敢恭维，这种速度在with:public灌水是不太现实了，协同工作应该还行。 看好Google Wave加入Google Apps大家庭!!]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.nocoo.us/wp-content/uploads/2009/10/wave-on-iphone.png"><img src="http://www.nocoo.us/wp-content/uploads/2009/10/wave-on-iphone.png" alt="wave-on-iphone" title="wave-on-iphone" width="320" height="480" class="alignnone size-full wp-image-4089" /></a></p>
<p>Google Wave是不是一种迅速花掉全部流量的方式呢，呵呵。<br />
速度是真的慢啊，输入速度更是不敢恭维，这种速度在with:public灌水是不太现实了，协同工作应该还行。<br />
看好Google Wave加入Google Apps大家庭!!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nocoo.us/2009/10/google-wave-on-my-iphone/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Google Wave and Reader 2.0</title>
		<link>http://www.nocoo.us/2009/10/google-wave-and-reader-2-0/</link>
		<comments>http://www.nocoo.us/2009/10/google-wave-and-reader-2-0/#comments</comments>
		<pubDate>Fri, 23 Oct 2009 09:42:53 +0000</pubDate>
		<dc:creator>nocoo</dc:creator>
				<category><![CDATA[Web标准化研究]]></category>
		<category><![CDATA[开发心得]]></category>
		<category><![CDATA[服务器和集群技术]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Google Wave]]></category>

		<guid isPermaLink="false">http://www.nocoo.us/?p=4077</guid>
		<description><![CDATA[with:public真的是个好地方，什么是真正的地球村呢？我想这就是了。 Google Wave中的with:public是一个公共wave的大集合，真的是大杂烩的大杂烩，什么都有&#8230;而且中文的内容很多很多，当然比较低俗，贴美女的，啥都有，不禁令我为wave开放后在中国的未来捏把汗。对了，提到with:public，Twitter的public timeline也不错，不过明显不如Google Wave那么2.0。 以前总是习惯于在Google Reader中定向地获取新信息，就好像填鸭一样，人家写什么，喂给你你就接着就行了，不用挪窝，打开Google Reader就行。现在在Wave上，信息渠道更加广泛了，说白了就是一片大森林，你自己出去觅食吧&#8230; 大家都知道，野生的鸭子更好吃一些。 上图，今天在Google Wave上发现的好东东，在线听歌服务——亦歌，音质不错哦，在公司不能乱装东西同学可以试用一下。]]></description>
			<content:encoded><![CDATA[<p>with:public真的是个好地方，什么是真正的地球村呢？我想这就是了。<br />
Google Wave中的with:public是一个公共wave的大集合，真的是大杂烩的大杂烩，什么都有&#8230;而且中文的内容很多很多，当然比较低俗，贴美女的，啥都有，不禁令我为wave开放后在中国的未来捏把汗。对了，提到with:public，Twitter的public timeline也不错，不过明显不如Google Wave那么2.0。<br />
以前总是习惯于在Google Reader中定向地获取新信息，就好像填鸭一样，人家写什么，喂给你你就接着就行了，不用挪窝，打开Google Reader就行。现在在Wave上，信息渠道更加广泛了，说白了就是一片大森林，你自己出去觅食吧&#8230;</p>
<p>大家都知道，野生的鸭子更好吃一些。</p>
<p><a href="http://www.nocoo.us/wp-content/uploads/2009/10/yige-google-wave.png"><img src="http://www.nocoo.us/wp-content/uploads/2009/10/yige-google-wave-610x417.png" alt="yige-google-wave" title="yige-google-wave" width="610" height="417" class="alignnone size-large wp-image-4086" /></a></p>
<p>上图，今天在Google Wave上发现的好东东，在线听歌服务——<a href="http://www.1g1g.com">亦歌</a>，音质不错哦，在公司不能乱装东西同学可以试用一下。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nocoo.us/2009/10/google-wave-and-reader-2-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>祝贺同济网论坛进入全球中文论坛100强</title>
		<link>http://www.nocoo.us/2009/10/tongji-net-top-100/</link>
		<comments>http://www.nocoo.us/2009/10/tongji-net-top-100/#comments</comments>
		<pubDate>Thu, 22 Oct 2009 03:44:26 +0000</pubDate>
		<dc:creator>nocoo</dc:creator>
				<category><![CDATA[开发心得]]></category>
		<category><![CDATA[服务器和集群技术]]></category>

		<guid isPermaLink="false">http://www.nocoo.us/?p=4075</guid>
		<description><![CDATA[全球中文论坛100强排行，由2004年发起的一次评选后，在网络引起了很大的反响。时间已经过去了5年，经过新一轮的网络淘汰和洗牌，很多老的论坛已经倒下，也有很多新的论坛崛起，5年的时间对于网络论坛来说，实在是变化太大了，大到让我们已经无法认识以前，所以为了让大家重新了解全球中文论坛情况，我们发起这个评选活动，让大家重新认识现在的全球中文论坛状况。 http://bbs.ifeng.com/zhuanti/bbstop100/ 感谢CCTV，感谢MTV&#8230; 感谢我的简历上又能写上一个能让我骄傲的事件。blueonline说的话我现在还记得，希望在同济网论坛经历能让大家骄傲地在自己简历上写上那么一笔，就谢天谢地了。 不过其实大学论坛真的不好做。今天早晨在Google Wave上还得知武汉白云黄鹤站不幸的消息&#8230; 这些事情，纯技术是永远解决不了的。]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.nocoo.us/wp-content/uploads/2009/10/top-100-chs-bbs.png"><img src="http://www.nocoo.us/wp-content/uploads/2009/10/top-100-chs-bbs.png" alt="top-100-chs-bbs" title="top-100-chs-bbs" width="610" height="143" class="alignnone size-full wp-image-4074" /></a></p>
<blockquote><p>全球中文论坛100强排行，由2004年发起的一次评选后，在网络引起了很大的反响。时间已经过去了5年，经过新一轮的网络淘汰和洗牌，很多老的论坛已经倒下，也有很多新的论坛崛起，5年的时间对于网络论坛来说，实在是变化太大了，大到让我们已经无法认识以前，所以为了让大家重新了解全球中文论坛情况，我们发起这个评选活动，让大家重新认识现在的全球中文论坛状况。<br />
<a href="http://bbs.ifeng.com/zhuanti/bbstop100/">http://bbs.ifeng.com/zhuanti/bbstop100/</a>
</p></blockquote>
<p>感谢CCTV，感谢MTV&#8230;<br />
感谢我的简历上又能写上一个能让我骄傲的事件。blueonline说的话我现在还记得，希望在同济网论坛经历能让大家骄傲地在自己简历上写上那么一笔，就谢天谢地了。<br />
不过其实大学论坛真的不好做。今天早晨在Google Wave上还得知武汉白云黄鹤站不幸的消息&#8230;<br />
这些事情，纯技术是永远解决不了的。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nocoo.us/2009/10/tongji-net-top-100/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Google Wave Performance Issue</title>
		<link>http://www.nocoo.us/2009/10/google-wave-performance-issue/</link>
		<comments>http://www.nocoo.us/2009/10/google-wave-performance-issue/#comments</comments>
		<pubDate>Thu, 22 Oct 2009 02:38:48 +0000</pubDate>
		<dc:creator>nocoo</dc:creator>
				<category><![CDATA[Web标准化研究]]></category>
		<category><![CDATA[开发心得]]></category>
		<category><![CDATA[服务器和集群技术]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Google Wave]]></category>

		<guid isPermaLink="false">http://www.nocoo.us/?p=4071</guid>
		<description><![CDATA[最近的Google Wave用下来的感觉，对这个方向和思路是很看好的，因为一直以来我在寻找一种能够同时拥有IM的即时性和Email的绝对时间轴、存档性的方式，Google Wave显然是这个问题的最优解，通过Google Wave可以协同工作，甚至可以取代BBS。 昨天提到Google Wave是HTML 5的应用，大量使用了Ajax技术，带来的问题是显然的——太慢了&#8230; 打开with:public之后我的CPU开始狂转。Firebug统统关掉也没有丝毫好转。 目前的Google Wave采取限量邀请政策，只有第一代用户每个人能邀请几个人，被邀请的二代不能继续邀请（穷二代）。这样的性能显然不能支撑持续的邀请&#8230; 我对Google的数据处理能力是不怀疑的，相信有Gmail的基础，再大的Ajax数据请求都是能够处理的。看起来前端性能是如此重要！]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.nocoo.us/wp-content/uploads/2009/10/google-wave.png"><img src="http://www.nocoo.us/wp-content/uploads/2009/10/google-wave-610x417.png" alt="google-wave" title="google-wave" width="610" height="417" class="alignnone size-large wp-image-4072" /></a></p>
<p>最近的Google Wave用下来的感觉，对这个方向和思路是很看好的，因为一直以来我在寻找一种能够同时拥有IM的即时性和Email的绝对时间轴、存档性的方式，Google Wave显然是这个问题的最优解，通过Google Wave可以协同工作，甚至可以取代BBS。<br />
昨天提到Google Wave是HTML 5的应用，大量使用了Ajax技术，带来的问题是显然的——太慢了&#8230;<br />
打开with:public之后我的CPU开始狂转。Firebug统统关掉也没有丝毫好转。<br />
目前的Google Wave采取限量邀请政策，只有第一代用户每个人能邀请几个人，被邀请的二代不能继续邀请（穷二代）。这样的性能显然不能支撑持续的邀请&#8230;<br />
我对Google的数据处理能力是不怀疑的，相信有Gmail的基础，再大的Ajax数据请求都是能够处理的。看起来前端性能是如此重要！</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nocoo.us/2009/10/google-wave-performance-issue/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Firebug can make Gmail slow</title>
		<link>http://www.nocoo.us/2009/10/firebug-can-make-gmail-slow/</link>
		<comments>http://www.nocoo.us/2009/10/firebug-can-make-gmail-slow/#comments</comments>
		<pubDate>Wed, 21 Oct 2009 07:52:33 +0000</pubDate>
		<dc:creator>nocoo</dc:creator>
				<category><![CDATA[Web标准化研究]]></category>
		<category><![CDATA[开发心得]]></category>
		<category><![CDATA[服务器和集群技术]]></category>
		<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://www.nocoo.us/?p=4066</guid>
		<description><![CDATA[“Firebug is known to make Gmail slow unless it is configured correctly.” For the best Gmail performance, we suggest disabling Firebug for www.google.com. Windows or Linux Users To disable Firebug: Open the Firebug pane in your Gmail tab by clicking the Firebug icon. Click the down arrow next to the Net tab, and select Disable [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.nocoo.us/wp-content/uploads/2009/10/gmail-firebug.png"><img src="http://www.nocoo.us/wp-content/uploads/2009/10/gmail-firebug-610x444.png" alt="gmail-firebug" title="gmail-firebug" width="610" height="444" class="alignnone size-large wp-image-4067" /></a></p>
<blockquote><p>
“Firebug is known to make Gmail slow unless it is configured correctly.”</p>
<p>For the best Gmail performance, we suggest disabling Firebug for www.google.com.</p>
<p><strong>Windows or Linux Users</strong><br />
To disable Firebug:</p>
<ol>
<li>Open the Firebug pane in your Gmail tab by clicking the Firebug icon.</li>
<li>Click the down arrow next to the <strong>Net</strong> tab, and select Disable monitor for mail.google.com</li>
<li>Repeat Step 2 on the <strong>Console</strong> and <strong>Script</strong> tabs.</li>
</ol>
<p>If you&#8217;d like to keep Firebug running, you may improve Gmail performance by following these steps:</p>
<ol>
<li>Click the green or red icon in the bottom right corner of the browser window to open Firebug.</li>
<li>Click the <strong>Console</strong> tab.</li>
<li>Select Options.</li>
<li>Uncheck Show XMLHttpRequests.</li>
<li>Click the Net tab.</li>
<li>Select Options.</li>
<li>Check Disable Network Monitoring.</li>
</ol>
<p><strong>Mac Users</strong><br />
To disable Firebug:</p>
<ol>
<li>Click the green or red icon in the bottom right corner of the browser window to open Firebug.</li>
<li>Click the bug icon in the top left corner of Firebug and select &#8216;Disable Firebug for mail.google.com.&#8217;</li>
</ol>
<p>If disabling Firebug for Gmail doesn&#8217;t improve performance results, you may have to entirely disable Firebug.
</p></blockquote>
<p>看起来Firebug的监控功能对这种大量应用Ajax的网站还是影响很大的。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nocoo.us/2009/10/firebug-can-make-gmail-slow/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Wave与HTML 5</title>
		<link>http://www.nocoo.us/2009/10/google-wave-html-5/</link>
		<comments>http://www.nocoo.us/2009/10/google-wave-html-5/#comments</comments>
		<pubDate>Wed, 21 Oct 2009 07:26:12 +0000</pubDate>
		<dc:creator>nocoo</dc:creator>
				<category><![CDATA[Web标准化研究]]></category>
		<category><![CDATA[开发心得]]></category>
		<category><![CDATA[服务器和集群技术]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Google Wave]]></category>

		<guid isPermaLink="false">http://www.nocoo.us/?p=4061</guid>
		<description><![CDATA[如果你在Microsoft Internet Explorer 8下访问Google Wave，登陆后会发现上图的提示。 Google Wave是一个HTML 5应用，看起来Google一直走在了技术的前端，当年Ajax的发明以及Web 2.0的火热正是由于Google提供的Gmail带来的。这一次，Google为我们推开了HTML 5的大门，当然，是用波浪冲开的。 当然，占据用户比例大头的Microsoft Internet Explorer 8如果不能访问Google Wave这显然是一种悲剧，然后Google就做了Google Chrome Frame&#8230; 看着Google一头扎进IE的波涛洪流，我无语啊。没事搅这滩浑水干什么。]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.nocoo.us/wp-content/uploads/2009/10/google-wave-ie8.png" alt="google-wave-ie8" title="google-wave-ie8" width="448" height="343" class="alignnone size-full wp-image-4062" /></p>
<p>如果你在Microsoft Internet Explorer 8下访问Google Wave，登陆后会发现上图的提示。<br />
Google Wave是一个HTML 5应用，看起来Google一直走在了技术的前端，当年Ajax的发明以及Web 2.0的火热正是由于Google提供的Gmail带来的。这一次，Google为我们推开了HTML 5的大门，当然，是用波浪冲开的。<br />
当然，占据用户比例大头的Microsoft Internet Explorer 8如果不能访问Google Wave这显然是一种悲剧，然后Google就做了<a href="http://code.google.com/chrome/chromeframe/">Google Chrome Frame</a>&#8230;<br />
看着Google一头扎进IE的波涛洪流，我无语啊。没事搅这滩浑水干什么。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nocoo.us/2009/10/google-wave-html-5/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>好吧，我承认只有我才会发现这样的小问题</title>
		<link>http://www.nocoo.us/2009/09/silverlight-comment-error/</link>
		<comments>http://www.nocoo.us/2009/09/silverlight-comment-error/#comments</comments>
		<pubDate>Mon, 14 Sep 2009 13:47:27 +0000</pubDate>
		<dc:creator>nocoo</dc:creator>
				<category><![CDATA[开发心得]]></category>
		<category><![CDATA[微软技术]]></category>
		<category><![CDATA[Silverlight]]></category>

		<guid isPermaLink="false">http://www.nocoo.us/?p=4028</guid>
		<description><![CDATA[public sealed class ScrollViewer : ContentControl // // Summary: // Gets a value that represents the horizontal size of the area that can be // scrolled; the difference between the width of the extent and the width of // the viewport.. // // Returns: // The horizontal size of the area that can be scrolled. [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.nocoo.us/wp-content/uploads/2009/09/c-sharp-comment.png" alt="c-sharp-comment" title="c-sharp-comment" width="600" height="242" class="alignnone size-full wp-image-4030" /></p>
<p><strong>public sealed class ScrollViewer : ContentControl</strong></p>
<pre class="brush: csharp">
//
// Summary:
//     Gets a value that represents the horizontal size of the area that can be
//     scrolled; the difference between the width of the extent and the width of
//     the viewport..
//
// Returns:
//     The horizontal size of the area that can be scrolled. This property has no
//     default value.
public double ScrollableWidth { get; internal set; }
</pre>
<p>Silverlight Control里面的小细节，小小小细节&#8230;<br />
好几篇这样的文章了，以后学着粗枝大叶一点，产品中的这些小细节太让我恼火了。</p>
<p>补充几句，觉得C#里面的注释写得太像八股文了。最近写了好多好多，现在随便开个东西开始无意识输出的是“Gets or sets a value indicating whether&#8230;”。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nocoo.us/2009/09/silverlight-comment-error/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Snow Leopard</title>
		<link>http://www.nocoo.us/2009/08/snow-leopard/</link>
		<comments>http://www.nocoo.us/2009/08/snow-leopard/#comments</comments>
		<pubDate>Mon, 24 Aug 2009 01:33:50 +0000</pubDate>
		<dc:creator>nocoo</dc:creator>
				<category><![CDATA[开发心得]]></category>
		<category><![CDATA[苹果技术]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[Mac OS]]></category>

		<guid isPermaLink="false">http://www.nocoo.us/?p=4011</guid>
		<description><![CDATA[我年轻的时候也是一个追求最新软件版本的人呢。Snow Leopard释出测试版本一直就没有安装，最主要的原因是没时间折腾，更现实的原因是Mac OS Leopard满足了我这样一个苛刻的人的近乎所有要求，没有更换的需求。 这次现实的问题是，买了一块硬盘。随机的10.5恢复盘留在了上海，重装系统成了一种权衡。最终经过各种折腾选择了下载Snow Leopard，然后用镜像恢复一块移动硬盘使之成为安装介质，最终装好了系统。 Snow Leopard，感觉很好，至少我觉得发热又变小了，安安静静工作，不吵不闹，很乖。 如果Windows 7在我的Mac OS上的VMware Fusion里不要发热那么厉害，我也乐意把现在里面的XP换成Windows 7。]]></description>
			<content:encoded><![CDATA[<p>我年轻的时候也是一个追求最新软件版本的人呢。Snow Leopard释出测试版本一直就没有安装，最主要的原因是没时间折腾，更现实的原因是Mac OS Leopard满足了我这样一个苛刻的人的近乎所有要求，没有更换的需求。<br />
这次现实的问题是，买了一块硬盘。随机的10.5恢复盘留在了上海，重装系统成了一种权衡。最终经过各种折腾选择了下载Snow Leopard，然后用镜像恢复一块移动硬盘使之成为安装介质，最终装好了系统。</p>
<p><img src="http://www.nocoo.us/wp-content/uploads/2009/08/snow-leopard-600x375.png" alt="snow-leopard" title="snow-leopard" width="600" height="375" class="alignnone size-large wp-image-4012" /></p>
<p>Snow Leopard，感觉很好，至少我觉得发热又变小了，安安静静工作，不吵不闹，很乖。<br />
如果Windows 7在我的Mac OS上的VMware Fusion里不要发热那么厉害，我也乐意把现在里面的XP换成Windows 7。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nocoo.us/2009/08/snow-leopard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Apps界面问题</title>
		<link>http://www.nocoo.us/2009/08/google-apps-rendoring-error/</link>
		<comments>http://www.nocoo.us/2009/08/google-apps-rendoring-error/#comments</comments>
		<pubDate>Wed, 19 Aug 2009 09:08:42 +0000</pubDate>
		<dc:creator>nocoo</dc:creator>
				<category><![CDATA[开发心得]]></category>
		<category><![CDATA[服务器和集群技术]]></category>

		<guid isPermaLink="false">http://www.nocoo.us/?p=4008</guid>
		<description><![CDATA[图片，被拉伸了&#8230;]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.nocoo.us/wp-content/uploads/2009/08/google-apps.png" alt="google-apps" title="google-apps" width="563" height="548" class="alignnone size-full wp-image-4009" /></p>
<p>图片，被拉伸了&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nocoo.us/2009/08/google-apps-rendoring-error/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>你就这样死了么&#8230;</title>
		<link>http://www.nocoo.us/2009/08/die-so-early/</link>
		<comments>http://www.nocoo.us/2009/08/die-so-early/#comments</comments>
		<pubDate>Mon, 17 Aug 2009 03:08:13 +0000</pubDate>
		<dc:creator>nocoo</dc:creator>
				<category><![CDATA[开发心得]]></category>
		<category><![CDATA[服务器和集群技术]]></category>

		<guid isPermaLink="false">http://www.nocoo.us/?p=4001</guid>
		<description><![CDATA[这几天同济网服务器出了一系列故障。主要症状就是忽然系统卡住，任何HTTP请求发送到Squid之后不进行任何返回，最终time out。同时SSH连不上服务器进行管理，甚至连登陆期间的SSH认证信息都不能返回。 打电话叫机房一遍遍重启的结果是机器可以恢复一段时间正常运行，但是数十分钟之后再次hang。 今天早晨观察到了一次出错的过程。在我把所有服务软件（MySQL, Apahce, Squid）全部关掉的情况下，只是下载新版本MySQL和执行备份脚本过程中，所有其他控制台提示connection closed by remote host unexpectly，留下一个控制台提示这个： tongji kernel: EDAC MC0: UE page 0xa8810, offset 0x0, grain 4096, row 3, labels &#34;:&#34;: e7xxx UE My god，莫非内存完了&#8230; BTW，找人，在上海的可靠的人员，懂点Linux的需要进机房看看问题，至少备份下数据。]]></description>
			<content:encoded><![CDATA[<p>这几天同济网服务器出了一系列故障。主要症状就是忽然系统卡住，任何HTTP请求发送到Squid之后不进行任何返回，最终time out。同时SSH连不上服务器进行管理，甚至连登陆期间的SSH认证信息都不能返回。<br />
打电话叫机房一遍遍重启的结果是机器可以恢复一段时间正常运行，但是数十分钟之后再次hang。<br />
今天早晨观察到了一次出错的过程。在我把所有服务软件（MySQL, Apahce, Squid）全部关掉的情况下，只是下载新版本MySQL和执行备份脚本过程中，所有其他控制台提示connection closed by remote host unexpectly，留下一个控制台提示这个：<br />
<img src="http://www.nocoo.us/wp-content/uploads/2009/08/tongjinet-600x375.png" alt="tongjinet" title="tongjinet" width="600" height="375" class="alignnone size-large wp-image-4002" /></p>
<pre class="brush: sh">
tongji kernel: EDAC MC0: UE page 0xa8810, offset 0x0, grain 4096, row 3, labels &quot;:&quot;: e7xxx UE
</pre>
<p>My god，莫非内存完了&#8230;<br />
BTW，找人，在上海的可靠的人员，懂点Linux的需要进机房看看问题，至少备份下数据。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nocoo.us/2009/08/die-so-early/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>We want IE 6 dead</title>
		<link>http://www.nocoo.us/2009/08/we-want-ie-6-dead/</link>
		<comments>http://www.nocoo.us/2009/08/we-want-ie-6-dead/#comments</comments>
		<pubDate>Thu, 06 Aug 2009 01:29:43 +0000</pubDate>
		<dc:creator>nocoo</dc:creator>
				<category><![CDATA[开发心得]]></category>
		<category><![CDATA[服务器和集群技术]]></category>

		<guid isPermaLink="false">http://www.nocoo.us/?p=3989</guid>
		<description><![CDATA[IE6带给了我们那么多的麻烦。现在两个新版本的浏览器都已经发布，是时候宣布IE6的死刑了。即日起，使用IE6访问本站都会看到这样的提示： 如果您发现这样的提示，请升级您的浏览器。 关于IE6 no more 您可以在您的网站中插入这样的代码，加入IE6 no more计划。 &#60;!--[if lt IE 7]&#62; &#60;div style=&#34;border: 1px solid #F7941D; background: #FEEFDA; text-align: center; clear: both; height: 75px; position: relative; margin-bottom:10px;&#34;&#62; &#60;div style=&#34;position: absolute; right: 3px; top: 3px; font-family: courier new; font-weight: bold;&#34;&#62; &#60;a href=&#34;#&#34; onclick=&#34;javascript:this.parentNode.parentNode.style.display=&#039;none&#039;; return false;&#34;&#62; &#60;img src=&#34;http://www.ie6nomore.com/files/theme/ie6nomore-cornerx.jpg&#34; alt=&#34;关闭本通知&#34;/&#62; &#60;/a&#62; &#60;/div&#62; &#60;div style=&#34;width: 100%; margin: 0 [...]]]></description>
			<content:encoded><![CDATA[<p>IE6带给了我们那么多的麻烦。现在两个新版本的浏览器都已经发布，是时候宣布IE6的死刑了。即日起，使用IE6访问本站都会看到这样的提示：</p>
<p><img src="http://www.nocoo.us/wp-content/uploads/2009/08/ie6-dead.png" alt="ie6-dead" title="ie6-dead" width="610" height="429" class="alignnone size-full wp-image-3990" /></p>
<p>如果您发现这样的提示，请升级您的浏览器。</p>
<p>关于<a href="http://www.ie6nomore.com">IE6 no more</a><br />
<img src="http://www.nocoo.us/wp-content/uploads/2009/08/ie6nomore-logo.jpg" alt="ie6nomore-logo" title="ie6nomore-logo" width="406" height="104" class="alignnone size-full wp-image-3991" /></p>
<p>您可以在您的网站中插入这样的代码，加入IE6 no more计划。</p>
<pre class="brush: html">
&lt;!--[if lt IE 7]&gt;
&lt;div style=&quot;border: 1px solid #F7941D; background: #FEEFDA; text-align: center; clear: both; height: 75px; position: relative; margin-bottom:10px;&quot;&gt;
    &lt;div style=&quot;position: absolute; right: 3px; top: 3px; font-family: courier new; font-weight: bold;&quot;&gt;
        &lt;a href=&quot;#&quot; onclick=&quot;javascript:this.parentNode.parentNode.style.display=&#039;none&#039;; return false;&quot;&gt;
            &lt;img src=&quot;http://www.ie6nomore.com/files/theme/ie6nomore-cornerx.jpg&quot; alt=&quot;关闭本通知&quot;/&gt;
        &lt;/a&gt;
    &lt;/div&gt;
    &lt;div style=&quot;width: 100%; margin: 0 auto; text-align: left; padding: 0; overflow: hidden; color: black;&quot;&gt;
        &lt;div style=&quot;width: 75px; float: left;&quot;&gt;
            &lt;img src=&quot;http://www.ie6nomore.com/files/theme/ie6nomore-warning.jpg&quot; alt=&quot;Warning!&quot;/&gt;
        &lt;/div&gt;
        &lt;div style=&quot;width: 275px; float: left;&quot;&gt;
            &lt;div style=&quot;font-size: 14px; font-weight: bold; margin-top: 12px;&quot;&gt;
                您正在使用旧版本的浏览器
            &lt;/div&gt;
            &lt;div style=&quot;font-size: 12px; margin-top: 6px; line-height: 12px;&quot;&gt;
                为了在使用本站时获得更好的体验，请升级到一种现代浏览器。
            &lt;/div&gt;
        &lt;/div&gt;
        &lt;div style=&quot;width: 75px; float: left;&quot;&gt;
            &lt;a href=&quot;http://www.firefox.com&quot;&gt;
                &lt;img src=&quot;http://www.ie6nomore.com/files/theme/ie6nomore-firefox.jpg&quot; alt=&quot;Firefox 3.5&quot;/&gt;
            &lt;/a&gt;
        &lt;/div&gt;
        &lt;div style=&quot;width: 75px; float: left;&quot;&gt;
            &lt;a href=&quot;http://www.browserforthebetter.com/download.html&quot;&gt;
                &lt;img src=&quot;http://www.ie6nomore.com/files/theme/ie6nomore-ie8.jpg&quot; alt=&quot;Internet Explorer 8&quot;/&gt;
            &lt;/a&gt;
        &lt;/div&gt;
        &lt;div style=&quot;width: 73px; float: left;&quot;&gt;
            &lt;a href=&quot;http://www.apple.com/safari/download/&quot;&gt;
                &lt;img src=&quot;http://www.ie6nomore.com/files/theme/ie6nomore-safari.jpg&quot; alt=&quot;Safari 4&quot;/&gt;
            &lt;/a&gt;
        &lt;/div&gt;
        &lt;div style=&quot;float: left;&quot;&gt;
            &lt;a href=&quot;http://www.google.com/chrome&quot;&gt;
                &lt;img src=&quot;http://www.ie6nomore.com/files/theme/ie6nomore-chrome.jpg&quot; alt=&quot;Google Chrome&quot;/&gt;
            &lt;/a&gt;
        &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;
&lt;![endif]--&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.nocoo.us/2009/08/we-want-ie-6-dead/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>如何用CSS让一个div全屏居中</title>
		<link>http://www.nocoo.us/2009/08/div-center-screen/</link>
		<comments>http://www.nocoo.us/2009/08/div-center-screen/#comments</comments>
		<pubDate>Mon, 03 Aug 2009 11:22:35 +0000</pubDate>
		<dc:creator>nocoo</dc:creator>
				<category><![CDATA[Web标准化研究]]></category>
		<category><![CDATA[开发心得]]></category>

		<guid isPermaLink="false">http://www.nocoo.us/?p=3981</guid>
		<description><![CDATA[居中是一个能有效获取用户注意的排版方式。尤其是你有一个大大的提示想告诉用户的时候。 div居中有点难度，水平一般没问题，垂直，也就是全屏居中就有点技巧了。这里翻译了一篇办法： 展示的是旧版本的剧种方法，图示很清楚。稍微改进下代码如下： &#60;!DOCTYPE html PUBLIC &#34;-//W3C//DTD XHTML 1.0 Transitional//EN&#34; &#34;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#34;&#62; &#60;html xmlns=&#34;http://www.w3.org/1999/xhtml&#34;&#62; &#60;head&#62; &#60;meta http-equiv=&#34;Content-Type&#34; content=&#34;text/html; charset=iso-8859-1&#34; /&#62; &#60;title&#62;Centered DIV Test&#60;/title&#62; &#60;style type=&#34;text/css&#34;&#62; .centered_div{ width:500px; height:200px; position:absolute; top:50%; left:50%; margin-left:-250px; margin-top:-100px; background:red; } &#60;/style&#62; &#60;/head&#62; &#60;body&#62; &#60;div class=&#34;centered_div&#34;&#62;centered div content&#60;/div&#62; &#60;/body&#62; &#60;/html&#62; 在线例子可以看这里。 原文：The simplest way to horizontally and vertically center a DIV]]></description>
			<content:encoded><![CDATA[<p>居中是一个能有效获取用户注意的排版方式。尤其是你有一个大大的提示想告诉用户的时候。<br />
div居中有点难度，水平一般没问题，垂直，也就是全屏居中就有点技巧了。这里翻译了一篇办法：</p>
<p><img src="http://www.nocoo.us/wp-content/uploads/2009/08/centering_a_div.jpg" alt="centering_a_div" title="centering_a_div" width="600" height="400" class="alignnone size-full wp-image-3982" /></p>
<p>展示的是旧版本的剧种方法，图示很清楚。稍微改进下代码如下：</p>
<pre class="brush: html">
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
    &lt;head&gt;
        &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot; /&gt;
        &lt;title&gt;Centered DIV Test&lt;/title&gt;
        &lt;style type=&quot;text/css&quot;&gt;
            .centered_div{
            width:500px;
            height:200px;
            position:absolute;
            top:50%; left:50%;
            margin-left:-250px;
            margin-top:-100px;
            background:red;
        }
        &lt;/style&gt;
    &lt;/head&gt;
    &lt;body&gt;
        &lt;div class=&quot;centered_div&quot;&gt;centered div content&lt;/div&gt;
    &lt;/body&gt;
&lt;/html&gt;
</pre>
<p>在线例子可以看<a href="http://www.dezinerfolio.com/wp-content/uploads/vertical_center.html">这里</a>。<br />
原文：<a href="http://www.dezinerfolio.com/2007/05/02/the-simplest-way-to-horizontally-and-vertically-center-a-div">The simplest way to horizontally and vertically center a DIV</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.nocoo.us/2009/08/div-center-screen/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>关于JavaScript多线程</title>
		<link>http://www.nocoo.us/2009/07/javascript-multithreading/</link>
		<comments>http://www.nocoo.us/2009/07/javascript-multithreading/#comments</comments>
		<pubDate>Sun, 19 Jul 2009 15:34:08 +0000</pubDate>
		<dc:creator>nocoo</dc:creator>
				<category><![CDATA[开发心得]]></category>
		<category><![CDATA[服务器和集群技术]]></category>

		<guid isPermaLink="false">http://www.nocoo.us/?p=3970</guid>
		<description><![CDATA[你知道Web 2.0是什么吗？如果你只觉得Facebook，Gmail就是Web 2.0那你也太肤浅了些。说Ajax就是Web 2.0还接近一些。 这里不详细探讨Web 2.0是什么，不过我觉得2.0可以认为是两个线程。Ajax核心是异步请求，其实就是前台界面一个线程跑你的代码，然后浏览器在实现XmlHttpRequest的异步版本时不小心开了另一个线程去请求数据。然后这个不小心被人发现并大肆应用，加上互联网带宽增长的，程序变得更肆无忌惮，2.0个线程成就了互联网的新时代——Web 2.0。 进一步想，若是JavaScript干脆支持多线程你说怎么样？Web N.0哈哈。下面这段话告诉你这是不可能的： You must be &#8220;as tall as an NBA player&#8221; to hack on threaded systems, and that means most programmers should run away crying. But they don&#8217;t. Instead, as with most other sharp tools, the temptation is to show how big one is by picking up the [...]]]></description>
			<content:encoded><![CDATA[<p>你知道Web 2.0是什么吗？如果你只觉得Facebook，Gmail就是Web 2.0那你也太肤浅了些。说Ajax就是Web 2.0还接近一些。<br />
这里不详细探讨Web 2.0是什么，不过我觉得2.0可以认为是两个线程。Ajax核心是异步请求，其实就是前台界面一个线程跑你的代码，然后浏览器在实现XmlHttpRequest的异步版本时不小心开了另一个线程去请求数据。然后这个不小心被人发现并大肆应用，加上互联网带宽增长的，程序变得更肆无忌惮，2.0个线程成就了互联网的新时代——Web 2.0。</p>
<p>进一步想，若是JavaScript干脆支持多线程你说怎么样？Web N.0哈哈。下面这段话告诉你这是不可能的：</p>
<blockquote><p>You must be &#8220;as tall as an NBA player&#8221; to hack on threaded systems, and that means most programmers should run away crying. But they don&#8217;t. Instead, as with most other sharp tools, the temptation is to show how big one is by picking up the nearest singlethreaded code and jamming it into a multi-threaded embedding, or tempting racecondition fate otherwise. Occasionally the results are infamous, but too often, with only virtual fingers and limbs lost, no one learns.<br />
Threads violate abstractions six ways to Sunday. Mainly by creating race conditions, deadlock hazards, and pessimistic locking overhead. And still they don&#8217;t scale up to handle the megacore teraflop future.<br />
So my default answer to questions such as, &#8220;When will you add threads to JavaScript?&#8221; is: &#8220;over your dead body!&#8221; —— <a href="http://en.wikipedia.org/wiki/Brendan_Eich">Brendan Eich</a></p></blockquote>
<p>这可不是随便什么人说说的，Brendan Eich那可是Mozilla的CTO，JavaScript的创始人。基本上在可见的将来JavaScript是不打算支持多线程的。</p>
<p>这并不是说多线程这个金钥匙就关闭了，有很多办法可以实现并行的目的。</p>
<h2>Concurrent.Thread</h2>
<p>Concurrent.Thread实现了一个树，需要并行的函数注册到Concurrent.Thread里，然后由Concurrent.Thread安排到树中，主线程再进行模拟多线程操作。Concurrent.Thread库很大，实际中应该加载时性能不很好。<br />
以下文字引用自<a href="http://www.infoq.com/cn/articles/js_multithread">InfoQ</a>：</p>
<blockquote><p>让我来介绍一下Concurrent.Thread，它是一个允许JavaScript进行多线程编程的库，应用它可以大大缓解上文提及的在AJAX开发中与异步通信相关的困难。这是一个用JavaScript写成的免费的软件库，使用它的前提是遵守Mozilla Public License和GNU General Public License这两个协议。你可以从他们的<a href="http://sourceforge.net/projects/jsthread/">网站</a>下载源代码。</p>
<p>马上来下载和使用源码吧！假定你已经将下载的源码保存到一个名为Concurrent.Thread.js的文件夹里，在进行任何操作之前，先运行如下程序，这是一个很简单的功能实现：</p>
<pre class="brush: javascript">
Concurrent.Thread.create
    (function()
    {
        var i = 0;
        while (1) { document.body.innerHTML += i++ + &quot;&lt;br&gt;&quot;; }
    });
</pre>
<p>执行这个程序将会顺序显示从0开始的数字，它们一个接一个出现，你可以滚屏来看它。现在让我们来仔细研究一下代码，他应用while(1)条件制造了一个不会中止的循环，通常情况下，象这样不断使用一个并且是唯一一个线程的JavaScript程序会导致浏览器看起来象冻结了一样，自然也就不会允许你滚屏。那么为什么上面的这段程序允许你这么做呢？关键之处在于while(1)上面的那条Concurrent.Thread.create()语句，这是这个库提供的一个方法，它可以创建一个新线程。被当做参数传入的函数在这个新线程里执行，让我们对程序做如下微调：</p>
<pre class="brush: javascript">
function f (i)
{
    while (1) { document.body.innerHTML += i++ + &quot;&lt;br&gt;&quot;; }
}

Concurrent.Thread.create(f, 0);
Concurrent.Thread.create(f, 100000);
</pre>
<p>在这个程序里有个新函数f()可以重复显示数字，它是在程序段起始定义的，接着以f()为参数调用了两次create()方法，传给create()方法的第二个参数将会不加修改地传给f()。执行这个程序，先会看到一些从0开始的小数，接着是一些从100,000开始的大数，然后又是接着前面小数顺序的数字。你可以观察到程序在交替显示小数和大数，这说明两个线程在同时运行。</p>
<p>让我来展示Concurrent.Thread的另外一个用法。上面的例子调用create()方法来创建新线程。不调用库里的任何APIs也有可能实现这个目的。例如，前面那个例子可以这样写：</p>
<pre class="brush: html">
&lt;script type=&quot;text/javascript&quot; src=&quot;Concurrent.Thread.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/x-script.multithreaded-js&quot;&gt;
    var i = 1;
    while (1) { document.body.innerHTML += i++ + &quot;&lt;br&gt;&quot;; }
&lt;/script&gt;
</pre>
<p>在script 标签内，很简单地用JavaScript写了一个无穷循环。你应该注意到标签内的type属性，那里是一个很陌生的值(text/x-script.multithreaded-js)，如果这个属性被放在script标签内，那么Concurrent.Thread就会在一个新的线程内执行标签之间的程序。你应当记住一点，在本例一样，必须将Concurrent.Thread库包含进来。</p>
<p>有了Concurrent.Thread，就有可能自如的将执行环境在线程之间进行切换，即使你的程序很长、连续性很强。我们可以简要地讨论下如何执行这种操作。简言之，需要进行代码转换。粗略地讲，首先要把传递给create()的函数转换成一个字符串，接着改写直至它可以被分批分次执行。然后这些程序可以依照调度程序逐步执行。调度程序负责协调多线程，换句话说，它可以在适当的时候做出调整以便每一个修改后的函数都会得到同等机会运行。 Concurrent.Thread实际上并没有创建新的线程，仅仅是在原本单线程的基础上模拟了一个多线程环境。</p>
<p>虽然转换后的函数看起来是运行在不同的线程内，但是实际上只有一个线程在做这所有的事情。在转换后的函数内执行同步通信仍然会造成浏览器冻结，你也许会认为以前的那些问题根本就没有解决。不过你不必耽心，Concurrent.Thread提供了一个应用JavaScript 的异步通信方式实现的定制通信库，它被设计成当一个线程在等待服务器的响应时允许其它线程运行。这个通信库存于 Concurrent.Thread.Http下。它的用法如下所示：</p>
<pre class="brush: html">
&lt;script type=&quot;text/javascript&quot; src=&quot;Concurrent.Thread.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/x-script.multithreaded-js&quot;&gt;
    var req = Concurrent.Thread.Http.get(url, [&quot;Accept&quot;, &quot;*&quot;]);
    if (req.status == 200)
    {
        alert(req.responseText);
    }
    else
    {
        alert(req.statusText);
    }
&lt;/script&gt;
</pre>
<p>get()方法，就像它的名字暗示的那样，可以通过HTTP的GET方法获得指定URL的内容，它将目标URL作为第一个参数，将一个代表HTTP请求头的数组作为可选的第二个参数。get()方法与服务器交互，当得到服务器的响应后就返回一个XMLHttpRequest对象作为返回值。当get()方法返回时，已经收到了服务器响应，所以就没必要再用回调函数接收结果。自然，也不必再耽心当程序等待服务器的响应时浏览器冻结的情况了。另外，还有一个 post()方法可以用来发送数据到服务器：</p>
<pre class="brush: html">
&lt;script type=&quot;text/javascript&quot; src=&quot;Concurrent.Thread.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/x-script.multithreaded-js&quot;&gt;
    var req = Concurrent.Thread.Http.post(url, &quot;key1=val1&amp;amp;amp;key2=val2&quot;);
    alert(req.statusText);
&lt;/script&gt;
</pre>
<p>post()方法将目的URL作为第一个参数，要发送的内容作为第二个参数。像get()方法那样，你也可以将请求头作为可选的第三个参数。
</p></blockquote>
<h2>Simulating</h2>
<p>第二种方法是比较简单的模拟方式，也是通过一个线程去模拟多线程并行执行的过程。以下是库的实现：</p>
<pre class="brush: javascript">
//loops through an array in segments
var threadedLoop = function(array) {
	var self = this;

	//holds the threaded work
	var thread = {
		work: null,
		wait: null,
		index: 0,
		total: array.length,
		finished: false
	};

	//set the properties for the class
	this.collection = array;
	this.finish = function() { };
	this.action = function() { throw &quot;You must provide the action to do for each element&quot;; };
	this.interval = 1;

	//set this to public so it can be changed
	var chunk = parseInt(thread.total * .005);
	this.chunk = (chunk == NaN || chunk == 0) ? thread.total : chunk;

	//end the thread interval
	thread.clear = function() {
		window.clearInterval(thread.work);
		window.clearTimeout(thread.wait);
		thread.work = null;
		thread.wait = null;
	};

	//checks to run the finish method
	thread.end = function() {
		if (thread.finished) { return; }
		self.finish();
		thread.finished = true;
	};

	//set the function that handles the work
	thread.process = function() {
		if (thread.index &gt;= thread.total) { return false; }

		//thread, do a chunk of the work
		if (thread.work) {
			var part = Math.min((thread.index + self.chunk), thread.total);
			while (thread.index++ &lt; part) {
				self.action(self.collection[thread.index], thread.index, thread.total);
			}
		}
		else {

			//no thread, just finish the work
			while(thread.index++ &lt; thread.total) {
				self.action(self.collection[thread.index], thread.index, thread.total);
			}
		}

		//check for the end of the thread
		if (thread.index &gt;= thread.total) {
			thread.clear();
			thread.end();
		}

		//return the process took place
		return true;

	};

	//set the working process
	self.start = function() {
		thread.finished = false;
		thread.index = 0;
		thread.work = window.setInterval(thread.process, self.interval);
	};

	//stop threading and finish the work
	self.wait = function(timeout) {

		//create the waiting function
		var complete = function() {
			thread.clear();
			thread.process();
			thread.end();
		};

		//if there is no time, just run it now
		if (!timeout) {
			complete();
		}
		else {
			thread.wait = window.setTimeout(complete, timeout);
		}
	};

};

// Note: this class is not battle-tested, just personal testing on large arrays
</pre>
<p>搞点测试数据：</p>
<pre class="brush: javascript">
var array = [];
for (var i = 0; i &lt; 500000; i++) {
	array.push(&quot;this is some long string&quot;);
}
</pre>
<p>启动并行执行：</p>
<pre class="brush: javascript">
//create our new class
var work = new threadedLoop(array);

//create the action to compare each item with
work.action = function(item, index, total) {
	var check = (item == &quot;this is some long string comparison to slow it down&quot;);
	document.body.innerHTML = &quot;Item &quot; + index + &quot; of &quot; + total;
};

//another action to use when our loop is done
work.finish = function(thread) {
	alert(&quot;Thread finished!&quot;);
};

//and start our &#039;thread&#039;
work.start();
</pre>
<h2>GIF Image Hack</h2>
<p>这种方法是在国内网站见到的，蛮好玩的。原理就是搞一张gif图片，能动画的，会自动循环的那种。然后利用每次动画结束后的onload事件启动多个函数的执行。</p>
<pre class="brush: javascript">
var img = new Image();
img.src = &quot;images/animation.gif&quot;;
img.onload = function()
{
    alert(&quot;如要关闭请按住ESC键不放，并点击关闭按钮&quot;);
}
</pre>
<h2>参考资料</h2>
<ol>
<li><a href="http://www.infoq.com/cn/articles/js_multithread">InfoQ: JavaScript多线程编程简介</a></li>
<li><a href="http://www.tzwhx.com/newOperate/html/2/22/221/8944.html">javascript多线程的实现方法</a></li>
<li><a href="http://www.codeproject.com/Articles/37998/Simulate-Threading-Using-Javascript.aspx">Simulate Threading Using Javascript</a></li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.nocoo.us/2009/07/javascript-multithreading/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Reader Bug</title>
		<link>http://www.nocoo.us/2009/07/google-reader-bug/</link>
		<comments>http://www.nocoo.us/2009/07/google-reader-bug/#comments</comments>
		<pubDate>Sat, 18 Jul 2009 04:57:02 +0000</pubDate>
		<dc:creator>nocoo</dc:creator>
				<category><![CDATA[Web标准化研究]]></category>
		<category><![CDATA[开发心得]]></category>
		<category><![CDATA[Google Reader]]></category>

		<guid isPermaLink="false">http://www.nocoo.us/?p=3961</guid>
		<description><![CDATA[今天午休翻Google Reader的时候终于看到Google一个Bug。如上图所示。 请无视这个Bug的题目吧，我发现只有这篇文章才能重现这个Bug&#8230; 当然这也更可能是IE的问题。不过跨浏览器兼容应该是Google的事情。我的IE版本是8.0.6001.18783。 也有很小的可能是春哥的问题&#8230; Update: 确实还有不少，比如下图。我冤枉春哥了&#8230;]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.nocoo.us/wp-content/uploads/2009/07/google-reader-bug.png" alt="google-reader-bug" title="google-reader-bug" width="598" height="346" class="alignnone size-full wp-image-3962" /></p>
<p>今天午休翻Google Reader的时候终于看到Google一个Bug。如上图所示。<br />
请无视这个Bug的题目吧，我发现只有这篇文章才能重现这个Bug&#8230;<br />
当然这也更可能是IE的问题。不过跨浏览器兼容应该是Google的事情。我的IE版本是8.0.6001.18783。<br />
也有很小的可能是春哥的问题&#8230;</p>
<p><strong>Update:</strong><br />
确实还有不少，比如下图。我冤枉春哥了&#8230;</p>
<p><img src="http://www.nocoo.us/wp-content/uploads/2009/07/google-reader-bug2.png" alt="google-reader-bug2" title="google-reader-bug2" width="598" height="346" class="alignnone size-full wp-image-3965" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.nocoo.us/2009/07/google-reader-bug/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>还是校内</title>
		<link>http://www.nocoo.us/2009/06/xiaonei-again/</link>
		<comments>http://www.nocoo.us/2009/06/xiaonei-again/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 06:42:48 +0000</pubDate>
		<dc:creator>nocoo</dc:creator>
				<category><![CDATA[Web标准化研究]]></category>
		<category><![CDATA[开发心得]]></category>

		<guid isPermaLink="false">http://www.nocoo.us/?p=3922</guid>
		<description><![CDATA[高亮背景挡住字了.唉,我就无语了,同样是中国软件公司,校内网前端团队和淘宝UED咋就差那么远呢? 真的希望校内网的人好好看看淘宝UED在研究什么,想想差距. 具体参见最近的淘宝UED文章:垂直栅格与渐进式行距]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.nocoo.us/wp-content/uploads/2009/06/xiaonei-again.png" alt="xiaonei-again" title="xiaonei-again" width="370" height="174" class="alignnone size-full wp-image-3923" /></p>
<p>高亮背景挡住字了.唉,我就无语了,同样是中国软件公司,校内网前端团队和淘宝UED咋就差那么远呢?<br />
真的希望校内网的人好好看看淘宝UED在研究什么,想想差距.</p>
<p><img src="http://www.nocoo.us/wp-content/uploads/2009/06/taobaoued-600x283.png" alt="taobaoued" title="taobaoued" width="600" height="283" class="alignnone size-large wp-image-3924" /></p>
<p>具体参见最近的淘宝UED文章:<a href="http://ued.taobao.com/blog/2009/06/29/vertical-rhythm-and-the-incremental-leading-2/">垂直栅格与渐进式行距</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.nocoo.us/2009/06/xiaonei-again/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>通过ping方式监测网站状态(PHP)</title>
		<link>http://www.nocoo.us/2009/06/php-ping/</link>
		<comments>http://www.nocoo.us/2009/06/php-ping/#comments</comments>
		<pubDate>Mon, 29 Jun 2009 05:32:14 +0000</pubDate>
		<dc:creator>nocoo</dc:creator>
				<category><![CDATA[开发心得]]></category>
		<category><![CDATA[服务器和集群技术]]></category>

		<guid isPermaLink="false">http://www.nocoo.us/?p=3913</guid>
		<description><![CDATA[如题,那么个东西,可以一次性ping一堆网站,看看哪个挂掉了.方便系统管理员用的东西,不必被动地等用户来叫了才知道网站挂了.以前还写了个exe的,不过是会检查返回的页面是不是包含特定的关键字的,相比起来更有可信度,不然一个404的网站,ping返回还是正常的呢. 贴点关键代码: $result = ping_site($_POST[&#34;site&#34;]); $ip = &#34;N/A&#34;; $ttl = &#34;N/A&#34;; $time = &#34;N/A&#34;; if($result != &#34;Fail&#34;) { $start = stripos($result, &#34;from &#34;) + 5; $length = stripos($result, &#34;:&#34;) - stripos($result, &#34;from &#34;) - 5; $ip = substr($result, $start, $length); $start = stripos($result, &#34;ttl=&#34;) + 4; $length = stripos($result, &#34; time=&#34;) - stripos($result, &#34;ttl=&#34;) - [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.nocoo.us/wp-content/uploads/2009/06/Picture-2-600x498.png" alt="Picture 2" title="Picture 2" width="600" height="498" class="alignnone size-large wp-image-3914" /></p>
<p>如题,那么个东西,可以一次性ping一堆网站,看看哪个挂掉了.方便系统管理员用的东西,不必被动地等用户来叫了才知道网站挂了.以前还写了个exe的,不过是会检查返回的页面是不是包含特定的关键字的,相比起来更有可信度,不然一个404的网站,ping返回还是正常的呢.</p>
<p>贴点关键代码:</p>
<pre class="brush: php">
$result = ping_site($_POST[&quot;site&quot;]);
$ip = &quot;N/A&quot;;
$ttl = &quot;N/A&quot;;
$time = &quot;N/A&quot;;

if($result != &quot;Fail&quot;)
{
    $start = stripos($result, &quot;from &quot;) + 5;
    $length = stripos($result, &quot;:&quot;) - stripos($result, &quot;from &quot;) - 5;
    $ip = substr($result, $start, $length);

    $start = stripos($result, &quot;ttl=&quot;) + 4;
    $length = stripos($result, &quot; time=&quot;) - stripos($result, &quot;ttl=&quot;) - 4;
    $ttl = substr($result, $start, $length);

    $start = stripos($result, &quot;time=&quot;) + 5;
    $length = stripos($result, &quot; ms&quot;) - stripos($result, &quot;time=&quot;) - 5;
    $time = substr($result, $start, $length).&quot; ms&quot;;

    echo &quot;&lt;td class=\&quot;success\&quot;&gt;&quot;.$_POST[&quot;site&quot;].&quot;&lt;/td&gt;&lt;td class=\&quot;success\&quot;&gt;&lt;img src=\&quot;images/success.png\&quot; alt=\&quot;Success\&quot; /&gt;&lt;/td&gt;&lt;td class=\&quot;success\&quot;&gt;$ip&lt;/td&gt;&lt;td class=\&quot;success\&quot;&gt;$ttl&lt;/td&gt;&lt;td class=\&quot;success\&quot;&gt;$time&lt;/td&gt;&lt;td&gt;&lt;a href=\&quot;http://&quot;.$_POST[&quot;site&quot;].&quot;\&quot;&gt;HTTP&lt;/a&gt;,&lt;a href=\&quot;#\&quot; title=\&quot;$result\&quot;&gt;Raw Data&lt;/a&gt;&lt;/td&gt;&quot;;
}
else
{
    echo &quot;&lt;td class=\&quot;fail\&quot;&gt;&quot;.$_POST[&quot;site&quot;].&quot;&lt;/td&gt;&lt;td class=\&quot;fail\&quot;&gt;&lt;img src=\&quot;images/fail.png\&quot; alt=\&quot;Fail\&quot; /&gt;&lt;/td&gt;&lt;td class=\&quot;fail\&quot;&gt;N/A&lt;/td&gt;&lt;td class=\&quot;fail\&quot;&gt;N/A&lt;/td&gt;&lt;td class=\&quot;fail\&quot;&gt;N/A&lt;/td&gt;&lt;td&gt;&lt;a href=\&quot;http://&quot;.$_POST[&quot;site&quot;].&quot;\&quot;&gt;HTTP&lt;/a&gt;,&lt;a href=\&quot;#\&quot; title=\&quot;$result\&quot;&gt;Raw Data&lt;/a&gt;&lt;/td&gt;&quot;;
}

function ping_site($target)
{
    $command = &quot;ping -c 1 $target&quot;;
    exec($command, $result);
    if($result[1] == &quot;&quot;) { return &quot;Fail&quot;; }
    else { return $result[1]; }
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.nocoo.us/2009/06/php-ping/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>挑Google一个瑕疵</title>
		<link>http://www.nocoo.us/2009/06/google-flaw/</link>
		<comments>http://www.nocoo.us/2009/06/google-flaw/#comments</comments>
		<pubDate>Fri, 26 Jun 2009 00:51:37 +0000</pubDate>
		<dc:creator>nocoo</dc:creator>
				<category><![CDATA[Web标准化研究]]></category>
		<category><![CDATA[开发心得]]></category>
		<category><![CDATA[服务器和集群技术]]></category>
		<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://www.nocoo.us/?p=3906</guid>
		<description><![CDATA[本人是完美主义者,所以会注意到这种小&#8221;问题&#8221;&#8230; 在橙色条最左端弧线处,有条border-bottom漏出了那么若干pixalpixel.同样的右边也是对称的情况. 我是在Mac OS X下用Safari 4.0.1 (5530.18)看到的效果. Google Analytics已经不是beta啦,检查要注意些噢&#8230;]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.nocoo.us/wp-content/uploads/2009/06/google-analytics.png" alt="google-analytics" title="google-analytics" width="229" height="71" class="alignnone size-full wp-image-3907" /></p>
<p>本人是完美主义者,所以会注意到这种小&#8221;问题&#8221;&#8230;<br />
在橙色条最左端弧线处,有条border-bottom漏出了那么若干<del datetime="2009-10-08T09:03:13+00:00">pixal</del>pixel.同样的右边也是对称的情况.<br />
我是在Mac OS X下用Safari 4.0.1 (5530.18)看到的效果.<br />
Google Analytics已经不是beta啦,检查要注意些噢&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nocoo.us/2009/06/google-flaw/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>利用SSH越过长城</title>
		<link>http://www.nocoo.us/2009/06/ssh-gfw/</link>
		<comments>http://www.nocoo.us/2009/06/ssh-gfw/#comments</comments>
		<pubDate>Wed, 24 Jun 2009 23:21:42 +0000</pubDate>
		<dc:creator>nocoo</dc:creator>
				<category><![CDATA[开发心得]]></category>
		<category><![CDATA[服务器和集群技术]]></category>
		<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://www.nocoo.us/?p=3896</guid>
		<description><![CDATA[Google.COM被屏蔽.这种事情发生了就没办法评论了,这算是什么事情呢? Anyway,对策还是经典办法,Proxy过去访问. 我想提示大家的是,一个具备SSH访问的服务器天生就可以作为一个代理服务器使用.如果这样一个服务器在中国以外,就可以通过这个Proxy访问到Google了. 有一种方式,可以在本机开上一个代理服务器,SSH连到服务器,然后把本机的SOCK通信都转发到服务器,通信出去. 这种方式称为&#8221;SSH Port Forwarding&#8221;,也直接称&#8221;SSH Tunnels&#8221; 方式非常简单: Windows下: 你需要Plink这款软件,下载下来,命令行进入它的目录,下面输入: plink your_username@somewherefree.com -D 1748 Mac OS X下: 之间打开Terminal,用系统自带的ssh客户端,输入以下命令: ssh -D 1748 your_username@somewherefree.com 这样,你的localhost,端口1748就是一个SOCK的代理服务器了.设置你的浏览器代理服务器选项即可. 注意: 这是一个SOCK代理服务器,不是常用的HTTP服务器. 端口1748的选择我不是随意的,1748代表&#8221;你去死吧&#8221;. 只想查邮件,又怕麻烦的同学不如到我机器上来查吧.我想没有Google阅读器你们一样能活着,不像我&#8230; 你知道最简单的办法么?只需要把DNS设置成OpenDNS就可以了&#8230;208.67.220.220和208.67.222.222,也许这次事件不是GFW,只是个不凑巧的DNS故障?]]></description>
			<content:encoded><![CDATA[<p>Google.COM被屏蔽.这种事情发生了就没办法评论了,这算是什么事情呢?<br />
Anyway,对策还是经典办法,Proxy过去访问.<br />
我想提示大家的是,一个具备SSH访问的服务器天生就可以作为一个代理服务器使用.如果这样一个服务器在中国以外,就可以通过这个Proxy访问到Google了.<br />
有一种方式,可以在本机开上一个代理服务器,SSH连到服务器,然后把本机的SOCK通信都转发到服务器,通信出去.<br />
这种方式称为&#8221;SSH Port Forwarding&#8221;,也直接称&#8221;SSH Tunnels&#8221;<br />
方式非常简单:</p>
<p><strong>Windows下:</strong><br />
你需要<a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html">Plink</a>这款软件,下载下来,命令行进入它的目录,下面输入:</p>
<pre class="brush: sh">plink your_username@somewherefree.com -D 1748</pre>
<p><strong>Mac OS X下:</strong><br />
之间打开Terminal,用系统自带的ssh客户端,输入以下命令:</p>
<pre class="brush: sh">ssh -D 1748 your_username@somewherefree.com</pre>
<p>这样,你的localhost,端口1748就是一个SOCK的代理服务器了.设置你的浏览器代理服务器选项即可.</p>
<p><img src="http://www.nocoo.us/wp-content/uploads/2009/06/SSH-Tunnel.png" alt="SSH-Tunnel" title="SSH-Tunnel" class="alignnone size-full wp-image-3897" /></p>
<p><strong>注意:</strong></p>
<ol>
<li>这是一个SOCK代理服务器,不是常用的HTTP服务器.</li>
<li>端口1748的选择我不是随意的,1748代表&#8221;你去死吧&#8221;.</li>
<li>只想查邮件,又怕麻烦的同学不如到我机器上来查吧.我想没有Google阅读器你们一样能活着,不像我&#8230;</li>
<li>你知道最简单的办法么?只需要把DNS设置成OpenDNS就可以了&#8230;208.67.220.220和208.67.222.222,也许这次事件不是GFW,只是个不凑巧的DNS故障?</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.nocoo.us/2009/06/ssh-gfw/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
