<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.2" -->
<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/"
	>

<channel>
	<title>OHeHLium liang~ &#187; web</title>
	<link>http://www.ohehlium.com/log</link>
	<description>Say something~</description>
	<pubDate>Mon, 13 Oct 2008 00:51:52 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2</generator>
	<language>en</language>
			<item>
		<title>Wordpress: url里的中文</title>
		<link>http://www.ohehlium.com/log/2007/04/18/wordpress-url%e9%87%8c%e7%9a%84%e4%b8%ad%e6%96%87/</link>
		<comments>http://www.ohehlium.com/log/2007/04/18/wordpress-url%e9%87%8c%e7%9a%84%e4%b8%ad%e6%96%87/#comments</comments>
		<pubDate>Wed, 18 Apr 2007 12:32:43 +0000</pubDate>
		<dc:creator>liang</dc:creator>
		
		<category><![CDATA[wordpress]]></category>

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

		<guid isPermaLink="false">http://www.ohehlium.com/log/2007/04/18/wordpress-url%e9%87%8c%e7%9a%84%e4%b8%ad%e6%96%87/</guid>
		<description><![CDATA[我一开始可能就做了个错误的决定，让url里包含着中文。在一亩地里，幸好一般的帖子的链接并不包含中文，可是序之类的属于页面，我没注意就设成了包含中文(当然可以通过Post Slug补救，但也只能一般页面，如果是子页面，也有情况处理不好)。于是在这种情况下，在一亩地里的序之类的地方留言，就会由于链接不对而得到错误页面。
理论上，网页留言并不是很复杂的情况，同时如果要求留言之后仍保留在同一页面，可以有以下两种方式：
1、自包含的页面处理，只要表格是这样的形式：&#60;form method=&#8221;&#8230;&#8221; action=&#8221;page_itself&#8221;&#62;
2、由别的页面处理，但在处理的末尾使用redirect的方法把页面又重指回到起始页面。Wordpress就用的是这种方式。
在第2种方式下，就需要有一些参数传递。我一开始总想不通这样简单的参数传递为何会引起错误的链接，于是用了小聪明，把404.php给改了一下，其实就是在发现错误链接的时候，试图通过其他信息把它又重定向回起始页面。但是，结果却发现这个方法在IE里又不适用，只有Firefox还行。这使得我只好不偷懒，重新阅读程序。
期间，还发现了另一个错误，那就是在编辑页面预览的地方，如果帖子的url包含中文，竟然也不能正确预览，而之前使用WP 2.0的时候决没有这样的错误。于是对比了一下，在wp 2.1里，调用iframe的地方，使用了一个新的function: clean_url，它会把一些不常见字符之类的给替换掉；而在wp 2.0里，用的是attribute_escape，但处理的只是常见符号。把clean_url改成attribute_escape也就能正常预览了(虽然我还是不明白有什么必要来调用clean_url或者attribute_escape)。
这倒也提醒了我，上面留言时可能出现的错误，于是看了一下wp_redirect，果然有部分内容和clean_url功能相同，把链接里的一些字符给处理了。 我就决定舍弃Wordpress提供的wp_redirect，自己用header(&#8221;Location: &#8220;.$url)来完成网页重定向，结果又是在IE里碰到了麻烦，一看url完全是乱码。而Firefox里则一切正常。问题其实又回到了一开始我试图用404.php来处理错误的地方。
于是就Google了一下，发现不同浏览器对url的encoding方式就是不同。一般的建议是不要依赖于浏览器来正确统一的解码。也就意味着在服务器端，我得先使用一下urlencode。 然后由于我自己想表现的厉害些，就想用array_map来做encoding，结果就是总有一些意外的情况，虽然总能处理，但却完全违背了我懒惰编程的习惯。所以最后就只是用urlencode来处理了几项会出错的地方。
一切都暂时解决了之后，我就想最当初Stone还问过我Slug是啥，我也没多加理会，还不让Stone用来着，硬是要链接里出现 %e5%92 这样的字符才高兴(当然有些浏览器还是挺好的，可以好好的看出是中文)。但最后也在奇怪，为什么Wordpress帖子(Post)的url是中文其实也没事，而页面(Page)却不行。再仔细查看了一下，原来是Wordpress把帖子的url都已经urlencode过了，而页面的url却没有。不明白Wordpress为什么不好事做到底&#8230;
]]></description>
			<content:encoded><![CDATA[<p>我一开始可能就做了个错误的决定，让url里包含着中文。在<a href="http://yimudi.org" title="一亩地">一亩地</a>里，幸好一般的帖子的链接并不包含中文，可是<a href="http://www.ohehlium.com/journal/%E5%BB%BF%E4%BA%8C%E6%9C%9F/%E5%BB%BF%E4%BA%8C%E6%9C%9F-%E5%BA%8F/" title="journal preface">序之类</a>的属于页面，我没注意就设成了包含中文(当然可以通过Post Slug补救，但也只能一般页面，如果是子页面，也有情况处理不好)。于是在这种情况下，在<a href="http://yimudi.org" title="一亩地">一亩地</a>里的<a href="http://www.ohehlium.com/journal/%E5%BB%BF%E4%BA%8C%E6%9C%9F/%E5%BB%BF%E4%BA%8C%E6%9C%9F-%E5%BA%8F/" title="journal preface">序之类</a>的地方留言，就会由于链接不对而得到错误页面。</p>
<p>理论上，网页留言并不是很复杂的情况，同时如果要求留言之后仍保留在同一页面，可以有以下两种方式：</p>
<p>1、自包含的页面处理，只要表格是这样的形式：&lt;form method=&#8221;&#8230;&#8221; action=&#8221;page_itself&#8221;&gt;</p>
<p>2、由别的页面处理，但在处理的末尾使用redirect的方法把页面又重指回到起始页面。Wordpress就用的是这种方式。</p>
<p>在第2种方式下，就需要有一些参数传递。我一开始总想不通这样简单的参数传递为何会引起错误的链接，于是用了小聪明，把404.php给改了一下，其实就是在发现错误链接的时候，试图通过其他信息把它又重定向回起始页面。但是，结果却发现这个方法在IE里又不适用，只有Firefox还行。这使得我只好不偷懒，重新阅读程序。</p>
<p>期间，还发现了另一个错误，那就是在编辑页面预览的地方，如果帖子的url包含中文，竟然也不能正确预览，而之前使用WP 2.0的时候决没有这样的错误。于是对比了一下，在wp 2.1里，调用iframe的地方，使用了一个新的function: clean_url，它会把一些不常见字符之类的给替换掉；而在wp 2.0里，用的是attribute_escape，但处理的只是常见符号。把clean_url改成attribute_escape也就能正常预览了(虽然我还是不明白有什么必要来调用clean_url或者attribute_escape)。</p>
<p>这倒也提醒了我，上面留言时可能出现的错误，于是看了一下wp_redirect，果然有部分内容和clean_url功能相同，把链接里的一些字符给处理了。 我就决定舍弃Wordpress提供的wp_redirect，自己用header(&#8221;Location: &#8220;.$url)来完成网页重定向，结果又是在IE里碰到了麻烦，一看url完全是乱码。而Firefox里则一切正常。问题其实又回到了一开始我试图用404.php来处理错误的地方。</p>
<p>于是就Google了一下，发现不同浏览器对url的encoding方式就是不同。一般的建议是不要依赖于浏览器来正确统一的解码。也就意味着在服务器端，我得先使用一下urlencode。 然后由于我自己想表现的厉害些，就想用array_map来做encoding，结果就是总有一些意外的情况，虽然总能处理，但却完全违背了我懒惰编程的习惯。所以最后就只是用urlencode来处理了几项会出错的地方。</p>
<p>一切都暂时解决了之后，我就想最当初Stone还问过我Slug是啥，我也没多加理会，还不让Stone用来着，硬是要链接里出现 %e5%92 这样的字符才高兴(当然有些浏览器还是挺好的，可以好好的看出是中文)。但最后也在奇怪，为什么Wordpress帖子(Post)的url是中文其实也没事，而页面(Page)却不行。再仔细查看了一下，原来是Wordpress把帖子的url都已经urlencode过了，而页面的url却没有。不明白Wordpress为什么不好事做到底&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ohehlium.com/log/2007/04/18/wordpress-url%e9%87%8c%e7%9a%84%e4%b8%ad%e6%96%87/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Snap preview - delayed/timeout load</title>
		<link>http://www.ohehlium.com/log/2007/01/14/snap-preview-delayedtimeout-load/</link>
		<comments>http://www.ohehlium.com/log/2007/01/14/snap-preview-delayedtimeout-load/#comments</comments>
		<pubDate>Sun, 14 Jan 2007 16:18:08 +0000</pubDate>
		<dc:creator>liang</dc:creator>
		
		<category><![CDATA[wordpress]]></category>

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

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

		<guid isPermaLink="false">http://www.ohehlium.com/log/2007/01/14/snap-preview-delayedtimeout-load/</guid>
		<description><![CDATA[I saw this function weeks ago. It pops you up a thumnail of the link:

I like this function. It is just like what the search engine, Ask.com, did to display the search results. Even the Wordpress.com started to use it. And I enabled this funtion last week.
But today, there is a serious problem fetching the [...]]]></description>
			<content:encoded><![CDATA[<p>I saw this function weeks ago. It pops you up a thumnail of the link:</p>
<p><a title="snap" href="http://www.snap.com/"><img title="snap preview" alt="snap preview" src="http://www.snap.com/images/promo_spa.gif" /></a></p>
<p>I like this function. It is just like what the search engine, <a title="ask" href="http://www.ask.com/">Ask.com</a>, did to display the search results. Even the <a title="wordpress.com snap" href="http://blog.snap.com/2007/01/13/snap-preview-anywhere%e2%84%a2-on-600k-wordpresscom-blo/">Wordpress.com</a> started to use it. And I enabled this funtion last week.</p>
<p>But today, there is a serious problem fetching the javascript from spa.snap.com. There is apparently a timeout, about 20 seconds. The preview is not functional now. I hope it won&#8217;t die as the <a title="Gravatar" href="http://www.gravatar.com/">Gravatar</a> and I still want to keep this function. I think they can solve the problem later. But I need a solution to download my page faster, at least without the 20s delay.</p>
<p>The solution seems simple, instead of putting the javascript in the header, moving the preview code to the near bottom, just before the end of body . This is just as where the Google analytics code is put.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ohehlium.com/log/2007/01/14/snap-preview-delayedtimeout-load/feed/</wfw:commentRss>
		</item>
		<item>
		<title>upgrade wordpress of 2.0.x series by patch</title>
		<link>http://www.ohehlium.com/log/2007/01/10/upgrade-wordpress-of-20x-series-by-patch/</link>
		<comments>http://www.ohehlium.com/log/2007/01/10/upgrade-wordpress-of-20x-series-by-patch/#comments</comments>
		<pubDate>Thu, 11 Jan 2007 00:32:02 +0000</pubDate>
		<dc:creator>liang</dc:creator>
		
		<category><![CDATA[tools]]></category>

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

		<guid isPermaLink="false">http://www.ohehlium.com/log/2007/01/10/upgrade-wordpress-of-20x-series-by-patch/</guid>
		<description><![CDATA[Now I did this two times: from 2.0.4->2.0.5 and 2.0.5->2.0.6. It was quick and neat. You don&#8217;t have to disable any installed plugin and reactivate it later. But surely do a backup.
And the way to do the patch is:
1. go to the Mark&#8217;s blog, and get the diff file. Remember, download the file and save [...]]]></description>
			<content:encoded><![CDATA[<p>Now I did this two times: from 2.0.4->2.0.5 and 2.0.5-><a title="wordpress 2.0.6" href="http://wordpress.org/development/2007/01/wordpress-206/">2.0.6</a>. It was quick and neat. You don&#8217;t have to disable any installed plugin and reactivate it later. But surely do a backup.</p>
<p>And the way to do the patch is:</p>
<p>1. go to the <a title="wordpress upgrade patch" href="http://markjaquith.wordpress.com/2007/01/06/wordpress-206-upgrade-changed-files-zip-changes-diff-changed-files-list/">Mark&#8217;s blog</a>, and get the <a title="upgrade diff file" href="http://txfx.net/files/wordpress/2.0.6-upgrade/wordpress-2.0.5-to-2.0.6-changes.diff">diff</a> file. Remember, download the file and save as it is. Last time, I did a silly job, opened the file in the browser and did a &#8220;copy&#038;paste&#8221;, which results critical error in doing patch, saying &#8220;hunk failed&#8221;.</p>
<p>2. go to the root file of the wordpress folder, issue this command:</p>
<p>patch -p0 <  wordpress-2.0.5-to-2.0.6-changes.diff (or any corresponding diff file downloaded, <a title="wordpress upgrade patch" href="http://markjaquith.wordpress.com/2007/01/06/wordpress-206-upgrade-changed-files-zip-changes-diff-changed-files-list/">Mark&#8217;s blog</a> is offering patch file starting from 2.0.2. )</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ohehlium.com/log/2007/01/10/upgrade-wordpress-of-20x-series-by-patch/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Digital Millennium Copyright Act （千禧年版权法）</title>
		<link>http://www.ohehlium.com/log/2006/12/10/dmca/</link>
		<comments>http://www.ohehlium.com/log/2006/12/10/dmca/#comments</comments>
		<pubDate>Sun, 10 Dec 2006 14:36:51 +0000</pubDate>
		<dc:creator>liang</dc:creator>
		
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://www.ohehlium.com/log/2006/12/10/dmca/</guid>
		<description><![CDATA[这是上两个星期就想关注的一个话题，还找到了一段关于设计（design）的法律原文。其中竟然还有对重点词汇的英文解释，感觉还可以用来学英语。不知道学法律的同志们是否因此就会对英语的准确性认识要高很多，不过他们本来英语就要比我们学科学的强吧。还有，我在此摘抄法律原文，应该不违反版权法吧 

(a)  Designs Protected.—   

(1)  In general.—  The designer or other owner of an original design of a useful article which makes the article attractive or distinctive in appearance to the purchasing or using public may secure the protection provided by this chapter upon complying with and subject to this [...]]]></description>
			<content:encoded><![CDATA[<p>这是上两个星期就想关注的一个话题，还找到了一段关于设计（design）的法律原文。其中竟然还有对重点词汇的英文解释，感觉还可以用来学英语。不知道学法律的同志们是否因此就会对英语的准确性认识要高很多，不过他们本来英语就要比我们学科学的强吧。还有，我在此摘抄法律原文，应该不违反版权法吧 <img src='http://www.ohehlium.com/log/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
<span class="enumbell"></p>
<p><span class="enumbell">(a)</span> <strong class="labelleader"> Designs Protected.— </strong> <span class="ptext-1"> </span><br />
</span>
<div class="psection-2"><span class="enumbell">(1)</span> <strong class="labelleader"> In general.— </strong> <span class="ptext-2">The designer or other owner of an original design of a useful article which makes the article attractive or distinctive in appearance to the purchasing or using public may secure the protection provided by this chapter upon complying with and subject to this chapter.</span></div>
<div class="psection-2">
<div class="psection-2">
<div class="psection-2"><span class="enumbell">(2)</span> <strong class="labelleader"> Vessel hulls.— </strong> <span class="ptext-2">The design of a vessel hull, including a plug or mold, is subject to protection under this chapter, notwithstanding section  <a href="http://www.law.cornell.edu/uscode/html/uscode17/usc_sec_17_00001302----000-.html">1302</a> <a href="http://www.law.cornell.edu/uscode/html/uscode17/usc_sec_17_00001302----000-.html#4">(4)</a>.</span></div>
<div class="psection-2">
<div class="psection-1">
<div class="psection-1"><span class="enumbell">(b)</span> <strong class="labelleader"> Definitions.— </strong> <span class="ptext-1">For the purpose of this chapter, the following terms have the following meanings:</span></div>
<div class="psection-1">
<div class="psection-1">
<div class="psection-2"><span class="enumbell">(1)</span> <span class="ptext-2">A design is “original” if it is the result of the designer’s creative endeavor that provides a distinguishable variation over prior work pertaining to similar articles which is more than merely trivial and has not been copied from another source.</span></div>
<div class="psection-2">
<div class="psection-2">
<div class="psection-2"><span class="enumbell">(2)</span> <span class="ptext-2">A “useful article” is a vessel hull, including a plug or mold, which in normal use has an intrinsic utilitarian function that is not merely to portray the appearance of the article or to convey information. An article which normally is part of a useful article shall be deemed to be a useful article.</span></div>
<div class="psection-2">
<div class="psection-2">
<div class="psection-2"><span class="enumbell">(3)</span> <span class="ptext-2">A “vessel” is a craft—</span></div>
<div class="psection-2">
<div class="psection-3"><span class="enumbell">(A)</span> <span class="ptext-3">that is designed and capable of independently steering a course on or through water through its own means of propulsion; and </span></div>
<div class="psection-3"><span class="enumbell">(B)</span> <span class="ptext-3">that is designed and capable of carrying and transporting one or more passengers.</span></div>
<div class="psection-2">
<div class="psection-2"><span class="enumbell">(4)</span> <span class="ptext-2">A “hull” is the frame or body of a vessel, including the deck of a vessel, exclusive of masts, sails, yards, and rigging.</span></div>
<div class="psection-2">
<div class="psection-2">
<div class="psection-2"><span class="enumbell">(5)</span> <span class="ptext-2">A “plug” means a device or model used to make a mold for the purpose of exact duplication, regardless of whether the device or model has an intrinsic utilitarian function that is not only to portray the appearance of the product or to convey information.</span></div>
<div class="psection-2">
<div class="psection-2">
<div class="psection-2"><span class="enumbell">(6)</span> <span class="ptext-2">A “mold” means a matrix or form in which a substance for material is used, regardless of whether the matrix or form has an intrinsic utilitarian function that is not only to portray the appearance of the product or to convey information. </span></div>
</div>
<p>UPDATE:放了那段法律原文之后，突然不确定了一下，然后找到了我国的这段条文（想必美国的法律也该差不多吧）：</p>
<p><a title="s:中华人民共和国著作权法" class="extiw" href="http://zh.wikisource.org/wiki/%E4%B8%AD%E5%8D%8E%E4%BA%BA%E6%B0%91%E5%85%B1%E5%92%8C%E5%9B%BD%E8%91%97%E4%BD%9C%E6%9D%83%E6%B3%95">中华人民共和国著作权法</a>不适用于（見第五條）：</p>
<ul>
<li>（一）法律、法规，国家机关的决议、决定、命令和其他具有立法、行政、司法性质的文件，及其官方正式译文；</li>
<li>（二）时事新闻；</li>
<li>（三）历法、通用数表、通用表格和公式。</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.ohehlium.com/log/2006/12/10/dmca/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Bluetooth</title>
		<link>http://www.ohehlium.com/log/2006/11/27/bluetooth/</link>
		<comments>http://www.ohehlium.com/log/2006/11/27/bluetooth/#comments</comments>
		<pubDate>Mon, 27 Nov 2006 16:32:33 +0000</pubDate>
		<dc:creator>liang</dc:creator>
		
		<category><![CDATA[web]]></category>

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

		<guid isPermaLink="false">http://www.ohehlium.com/log/2006/11/27/bluetooth/</guid>
		<description><![CDATA[今天在buy.com看到个免费的蓝牙耳机（after $25 mail-in rebate），虽然一户只能免费一个，但是有google  checkout赞助，我就脑子一热买了两个（刚好$50可以省20，然后拿rebate，也就花$5）。
然后现在仔细一想，犯了好大的错误，一则家里的手机还不知道能不能用bluetooth。二则，我的电脑也没bluetooth的功能，还得再买一个usb的bluetooth adapter。真应该买一个耳机，然后买一个adapter（价值正好$30左右），这样也就不花什么钱，电脑就可以用Bluetooth了，没买的同学考虑一下吧，后天过期 
]]></description>
			<content:encoded><![CDATA[<p>今天在buy.com看到个免费的<a title="bluetooth headset" href="http://www.buy.com/retail/product.asp?sku=201752120">蓝牙耳机</a>（after $25 mail-in rebate），虽然一户只能免费一个，但是有google  checkout赞助，我就脑子一热买了两个（刚好$50可以省20，然后拿rebate，也就花$5）。<a title="google checkout" href="http://www.buy.com/corp/promos/google_offer.asp"><img alt="google checkout" title="google checkout" src="http://ak.buy.com/buy_assets/google/20off50.gif" /></a></p>
<p>然后现在仔细一想，犯了好大的错误，一则家里的手机还不知道能不能用bluetooth。二则，我的电脑也没bluetooth的功能，还得再买一个usb的bluetooth adapter。真应该买一个耳机，然后买一个adapter（价值正好$30左右），这样也就不花什么钱，电脑就可以用Bluetooth了，没买的同学考虑一下吧，后天过期 <img src='http://www.ohehlium.com/log/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ohehlium.com/log/2006/11/27/bluetooth/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Show Google Adsense only to searchers</title>
		<link>http://www.ohehlium.com/log/2006/11/09/show-google-adsense-only-to-searchers/</link>
		<comments>http://www.ohehlium.com/log/2006/11/09/show-google-adsense-only-to-searchers/#comments</comments>
		<pubDate>Fri, 10 Nov 2006 02:20:59 +0000</pubDate>
		<dc:creator>liang</dc:creator>
		
		<category><![CDATA[adsense]]></category>

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

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

		<guid isPermaLink="false">http://www.ohehlium.com/log/2006/11/09/show-google-adsense-only-to-searchers/</guid>
		<description><![CDATA[I am not sure whether this is a good idea or not, but I like it and figured out a way doing it by using session.

First, get to know who is from search engines by checking the referers. There are so many search engines to list that I don't want to match their names into [...]]]></description>
			<content:encoded><![CDATA[<p>I am not sure whether this is a good idea or not, but I like it and figured out a way doing it by using session.</p>
<ul>
<li>First, get to know who is from search engines by checking the referers. There are so many search engines to list that I don't want to match their names into the referers' url. Instead, I thought "?" exists in all these query-like engine search urls. But I saw some "?" is inside some url from msn/live spaces as well. So I switched to check whether "&#038;" is inside or not.</li>
</ul>
<div class="igBar"><span id="lcode-4"><a href="#" onclick="javascript:showPlainTxt('code-4'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-4">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">if <span style="color:#006600; font-weight:bold;">&#40;</span>strpos<span style="color:#006600; font-weight:bold;">&#40;</span>$_SERVER<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">"HTTP_REFERER"</span><span style="color:#006600; font-weight:bold;">&#93;</span>, <span style="color:#CC0000;">'&amp;'</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">&#40;</span>Your Google Adsense Content<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<ul>
<li>Second, keep the information that the visitor is coming from searching if the visitor finds some other interesting posts within the site and go around, so google ads can be continuously displaced. Since the varible, which keeps the information, needs to go through pages, then it is best to be stored in session. So I do the following</li>
</ul>
<div class="igBar"><span id="lcode-5"><a href="#" onclick="javascript:showPlainTxt('code-5'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-5">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">if <span style="color:#006600; font-weight:bold;">&#40;</span> strpos<span style="color:#006600; font-weight:bold;">&#40;</span>$_SERVER<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">"HTTP_REFERER"</span><span style="color:#006600; font-weight:bold;">&#93;</span>, <span style="color:#CC0000;">'&amp;'</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$_SESSION<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">'ad'</span><span style="color:#006600; font-weight:bold;">&#93;</span>=true;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> ?&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">if <span style="color:#006600; font-weight:bold;">&#40;</span>$_SESSION<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">'ad'</span><span style="color:#006600; font-weight:bold;">&#93;</span>==true<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">&#40;</span>Your Google Adsense Content<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<ul>
<li>Third, how about then someone is willing to see the ads and they are not from search engines (who will be that? me, at least, at my own site :p ). So just put another tricky mark in the url to pass the variable to $_GET and then keep the option remembered by session. You may notice from the code, using "?ad=" at the end of url will let you just have google ads once by "?ad=(anything except y)" or for the whole session by "?ad=y"</li>
</ul>
<div class="igBar"><span id="lcode-6"><a href="#" onclick="javascript:showPlainTxt('code-6'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-6">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">if <span style="color:#006600; font-weight:bold;">&#40;</span> strpos<span style="color:#006600; font-weight:bold;">&#40;</span>$_SERVER<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">"HTTP_REFERER"</span><span style="color:#006600; font-weight:bold;">&#93;</span>, <span style="color:#CC0000;">'&amp;'</span><span style="color:#006600; font-weight:bold;">&#41;</span> || <span style="color:#006600; font-weight:bold;">&#40;</span>$_GET<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">'ad'</span><span style="color:#006600; font-weight:bold;">&#93;</span>==<span style="color:#CC0000;">'y'</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$_SESSION<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">'ad'</span><span style="color:#006600; font-weight:bold;">&#93;</span>=true;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> ?&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">if <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#40;</span>$_SESSION<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">'ad'</span><span style="color:#006600; font-weight:bold;">&#93;</span>==true<span style="color:#006600; font-weight:bold;">&#41;</span> || !empty<span style="color:#006600; font-weight:bold;">&#40;</span>$_GET<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">'ad'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">&#40;</span>Your Google Adsense Content<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
I didn't use this method here for this blog, but you do can test it at this <a title="ohehlium journal" href="http://www.ohehlium.com/journal">journal blog</a> here:</p>
<p>Directly use this link:   <a href="http://www.ohehlium.com/journal/2006/10/01/140/">http://www.ohehlium.com/journal/2006/10/01/140/</a>  (no adsense)</p>
<p>Then try google first, and see:  <a title="ohehlium nobel" href="http://www.google.com/search?q=nobel+site:ohehlium.com&#038;hl=en&#038;lr=&#038;filter=0">Nobel site:ohehlium.com</a>, click this <a title="googled" href="http://www.google.com/url?sa=t&#038;ct=res&#038;cd=4&#038;url=http%3A%2F%2Fwww.ohehlium.com%2Fjournal%2F2006%2F10%2F01%2F140%2F&#038;ei=X95TRdSTNamWaLG28bsG&#038;usg=__GEwUzazIDOJp5xJ4nnMxuIaIgHk=&#038;sig2=vOpfJGwxHFB77zHlidLYwg">link</a> and go, you will have ads there and you will have it when visiting around unless you close the browser</p>
<p>Or try this link:  <a title="ad option" href="http://www.ohehlium.com/journal/2006/10/01/140/?ad=1">http://www.ohehlium.com/journal/2006/10/01/140/?ad=1</a>, you will have one time adsense</p>
<p>Or then this one:  <a title="ad option" href="http://www.ohehlium.com/journal/2006/10/01/140/?ad=y">http://www.ohehlium.com/journal/2006/10/01/140/?ad=y</a>, then the same thing as from search engines<a title="ad option" href="http://www.ohehlium.com/journal/2006/10/01/140/?ad=y"><br />
</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ohehlium.com/log/2006/11/09/show-google-adsense-only-to-searchers/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Gino&#8217;s Auto Body Shop</title>
		<link>http://www.ohehlium.com/log/2006/11/02/ginos-auto-body-shop/</link>
		<comments>http://www.ohehlium.com/log/2006/11/02/ginos-auto-body-shop/#comments</comments>
		<pubDate>Fri, 03 Nov 2006 03:48:48 +0000</pubDate>
		<dc:creator>liang</dc:creator>
		
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://www.ohehlium.com/log/2006/11/02/ginos-auto-body-shop/</guid>
		<description><![CDATA[First, I recommended this place. Then I'll mention the bad aspect of online maps.
This is Gino's address: 4360 RT-27, Princeton, NJ 08540
The image (click for full picture) shown below is from google map, which says the green start sign is the place for Gino's. I liked google and preferred trusting it. However, someone else told [...]]]></description>
			<content:encoded><![CDATA[<p>First, I recommended this place. Then I'll mention the bad aspect of online maps.</p>
<p>This is Gino's address: 4360 RT-27, Princeton, NJ 08540</p>
<p>The image (click for full picture) shown below is from google map, which says the green start sign is the place for Gino's. I liked google and preferred trusting it. However, someone else told me it must be a little more north of it. So I drove along north route 27 and finally found it somewhere a little before reaching the red stop sign.</p>
<p><a title="gino_gmap" class="imagelink" href="http://www.ohehlium.com/log/wp-content/uploads/2006/11/gino_google.png"><img width="500" alt="gino_gmap" id="image86" src="http://www.ohehlium.com/log/wp-content/uploads/2006/11/gino_google.png" /></a></p>
<p>I was not quite satisfied with Gmap's behavior, and I have complaint it when we visisted <a title="puerto rico" href="http://www.ohehlium.com/journal/2006/08/07/76/">Puerto Rico</a>. But I don't know why it's so bad even within US continental states. And I am also wondering how google couldn't handle this correctly. So I tried map services of Yahoo, AAA. They all gave the same wrong place as google gave. And I also had taken a look at the <a title="gino's direction" href="http://www.ginosautobody.net/directions/">direction</a> from Gino's site. Wrong place again(as the image below and it's powered by microsoft)! As I claimed, the right place should be above the Promeade Blvd.<br />
<img alt="gino" title="gino" src="http://www.superpages.com/maps/spotmap.cgi?Tj1HaW5vJTI1MjdzK0F1dG8rQm9keStTaG9wJkM9JkNJRD0mVD1QcmluY2V0b24mTEM9MiZQRz1MJlBJPTEmUE09MGVmZmZmZmYmU1RZUEU9UyZSPU4mUz1OSiZBTD0mTUM9MSZtYXAueD0yMTImbWFwLnk9MTI1JmxldmVsPTgmbGF0PTQwMzc4NDU3JmxuZz0tNzQ2MDczMTgmUE9JMWxhdD00MDM3ODQ1NyZQT0kxbG5nPS03NDYwNzMxOCZQT0kxbmFtZT1HaW5vJTI1MjdzK0F1dG8rQm9keStTaG9wJnN0cmVldGFkZHJlc3M9JmNpdHk9UHJpbmNldG9uJnN0YXRlPU5KJnppcD0wODU0MCZMSUQ9JkxTPSZkaXNwbGF5PTEmQUQ9JkdWPTAmR0w9JkZOPSZQUD0mQ0lEPSZTUkM9bWFwcw" /></p>
<p>So it seems clear that the problem is not from these online map providers, but really from the data/resources providers. The online map providers should push the data providers to do a better job.<br />
And I did one more step of investigation: I tried to search the address of: 4359 RT-27, Princeton, NJ 08540. The result is the Red Stop sign of the google map. I hope and guess the odd numbers are properly displaced, but somehow the even numbers are erroneously shifted.</p>
<p>This is the link for google map of <a title="gmap" href="http://maps.google.com/maps?f=d&#038;hl=en&#038;saddr=4360+RT-27,+Princeton,+NJ+08540&#038;daddr=4359+RT-27,+Princeton,+NJ+08540&#038;ie=UTF8&#038;z=15&#038;ll=40.385847,-74.599228&#038;spn=0.019973,0.039911&#038;om=1">from 4359 to 4360</a> along RT-27.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ohehlium.com/log/2006/11/02/ginos-auto-body-shop/feed/</wfw:commentRss>
		</item>
		<item>
		<title>用xhtml来做ppt</title>
		<link>http://www.ohehlium.com/log/2006/09/14/%e7%94%a8xhtml%e6%9d%a5%e5%81%9appt/</link>
		<comments>http://www.ohehlium.com/log/2006/09/14/%e7%94%a8xhtml%e6%9d%a5%e5%81%9appt/#comments</comments>
		<pubDate>Fri, 15 Sep 2006 03:58:18 +0000</pubDate>
		<dc:creator>liang</dc:creator>
		
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://www.ohehlium.com/log/2006/09/14/%e7%94%a8xhtml%e6%9d%a5%e5%81%9appt/</guid>
		<description><![CDATA[困得但又还不想去睡觉，就再写下另一个心愿。XHTML其实几乎就是HTML了，只是听着更酷一些，当然也更标准化一些。其实就是想用网页来做presentation。事情是因为上次的presentation，我在一张slide里插了大概8张图片，还有两张是gif带动画的，结果要全屏显示时，就费了好半天劲才读出来。当然我用的是OpenOffice的Impress做得Slides，不是Powerpoint，但事后我同样试了Powerpoint，结果也是慢得要命。我就觉得如果是读网页，绝对不会那么慢。所以一心想以后都用网页来做Slides得了。只是到现在还没试一下，很想试试。
还有现在AJAX那么火，估计都有人在作同样的事情了，想想也会，html+css+javascript 应该可以做出一般slides所需要的效果了。
]]></description>
			<content:encoded><![CDATA[<p>困得但又还不想去睡觉，就再写下另一个心愿。XHTML其实几乎就是HTML了，只是听着更酷一些，当然也更标准化一些。其实就是想用网页来做presentation。事情是因为上次的presentation，我在一张slide里插了大概8张图片，还有两张是gif带动画的，结果要全屏显示时，就费了好半天劲才读出来。当然我用的是OpenOffice的Impress做得Slides，不是Powerpoint，但事后我同样试了Powerpoint，结果也是慢得要命。我就觉得如果是读网页，绝对不会那么慢。所以一心想以后都用网页来做Slides得了。只是到现在还没试一下，很想试试。</p>
<p>还有现在AJAX那么火，估计都有人在作同样的事情了，想想也会，html+css+javascript 应该可以做出一般slides所需要的效果了。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ohehlium.com/log/2006/09/14/%e7%94%a8xhtml%e6%9d%a5%e5%81%9appt/feed/</wfw:commentRss>
		</item>
		<item>
		<title>wp_slimstat百度、Live Space Comment</title>
		<link>http://www.ohehlium.com/log/2006/09/14/wp_slimstat%e7%99%be%e5%ba%a6%e3%80%81live-space-comment/</link>
		<comments>http://www.ohehlium.com/log/2006/09/14/wp_slimstat%e7%99%be%e5%ba%a6%e3%80%81live-space-comment/#comments</comments>
		<pubDate>Fri, 15 Sep 2006 03:43:59 +0000</pubDate>
		<dc:creator>liang</dc:creator>
		
		<category><![CDATA[code]]></category>

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

		<guid isPermaLink="false">http://www.ohehlium.com/log/2006/09/14/wp_slimstat%e7%99%be%e5%ba%a6%e3%80%81live-space-comment/</guid>
		<description><![CDATA[这两天总是想着要把这两件事做好，都知道个大概了，只是要花点时间完成它们。写下来，时刻有个印象。
有件事是先前冤枉百度了，以为只有百度不用UTF-8来编码，还要用GB2312，国内别的搜索引擎估计也是用同样的编码。soso.com至少也是如此。然后后来又发现原来google也干同样的事，只是在它的url里就可以看出来：http://www.google.com/...&#038;ie=gb2312... 或者可能(hl=zh_CN)(百度倒也是有编码信息ie，input encoding，在里面，只不过没有UTF8而已罢了) 。所以来访统计里总是有些乱码。然后php还是可以挺好的处理gb2312和utf8的转换的，回头要把wp_slimstat里的东西改一下。
至于Msn Space(现在是Live Space了)里没有comment的feed，早就是我的心头之恨了，今天学了个好玩的是用 Beautiful Soup 来处理Html文件，还是挺方便的，准备编个网页，来显示一些常去的space的评论吧。
]]></description>
			<content:encoded><![CDATA[<p>这两天总是想着要把这两件事做好，都知道个大概了，只是要花点时间完成它们。写下来，时刻有个印象。</p>
<p>有件事是<a title="冤枉百度" href="http://www.ohehlium.com/log/2006/07/19/http-header/">先前冤枉百度</a>了，以为只有百度不用UTF-8来编码，还要用GB2312，国内别的搜索引擎估计也是用同样的编码。soso.com至少也是如此。然后后来又发现原来google也干同样的事，只是在它的url里就可以看出来：http://www.google.com/...&#038;ie=gb2312... 或者可能(hl=zh_CN)(百度倒也是有编码信息ie，input encoding，在里面，只不过没有UTF8而已罢了) 。所以来访统计里总是有些乱码。然后php还是可以挺好的处理gb2312和utf8的转换的，回头要把wp_slimstat里的东西改一下。</p>
<p>至于Msn Space(现在是Live Space了)里没有comment的feed，早就是我的心头之恨了，今天学了个好玩的是用 <a href="http://www.crummy.com/software/BeautifulSoup/">Beautiful Soup</a> 来处理Html文件，还是挺方便的，准备编个网页，来显示一些常去的space的评论吧。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ohehlium.com/log/2006/09/14/wp_slimstat%e7%99%be%e5%ba%a6%e3%80%81live-space-comment/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Flock</title>
		<link>http://www.ohehlium.com/log/2006/09/06/flock/</link>
		<comments>http://www.ohehlium.com/log/2006/09/06/flock/#comments</comments>
		<pubDate>Thu, 07 Sep 2006 01:09:02 +0000</pubDate>
		<dc:creator>liang</dc:creator>
		
		<category><![CDATA[web]]></category>

		<category><![CDATA[linux exp.]]></category>

		<guid isPermaLink="false">http://www.ohehlium.com/log/2006/09/06/flock/</guid>
		<description><![CDATA[In August you guys created about 56k blogs, 57k users, 1.2 million posts, 188k pages, 1.3 million comments, 3.5k support requests, 196k file uploads, and around 45 million pageviews. (Not counting admin section, images, CSS, RSS feeds, etc.)
The most popular theme is Regulus, about two thousand blogs are using the Meebo widget. The tag surfer [...]]]></description>
			<content:encoded><![CDATA[<blockquote cite="http://www.bloggingpro.com/archives/2006/09/05/wordpresscom-august-stats/"><p>In August you guys created about 56k blogs, 57k users, 1.2 million posts, 188k pages, 1.3 million comments, 3.5k support requests, 196k file uploads, and around 45 million pageviews. (Not counting admin section, images, CSS, RSS feeds, etc.)<br />
The most popular theme is <strong>Regulus</strong>, about two thousand blogs are using the <strong>Meebo</strong> widget. The <strong>tag surfer i</strong>s more popular than “my comments”, but both are dwarfed by the number of times you guys look at your stats everyday. About 4200 of you have added avatars to your profile.</p></blockquote>
<p class="citation"><cite><a href="http://www.bloggingpro.com/archives/2006/09/05/wordpresscom-august-stats/">  WordPress.com August Stats by Blogging Pro</a></cite></p>
<p>Blogging from <a href="http://www.flock.com">Flock</a>, a web browser based on mozilla(firefox). It has some nice features for news aggregating, blogging and photo sharing. I am just testing here. The reason I found this browser is that today I tried to search blog editor for linux and at the end, when I am tired of looking around anymore, I noticed this and just wanted to use it. So it's not the perfect blog editor, at least at this moment. I guess at the current stage, my most wanted software from windows will be Live writer. And the reason I wanted the live writer so much, is that it enables you to download the CSS files from the blog and it is really doing the WYSIWYG job armed with the style file. It won't be a big deal to have this feature for other blog editors, I guess. But it's just whether people would like to make it real or not. Because there is certainly a big flaw if your post is too style-based on one specific CSS file, then for some reason, you change the CSS file for the whole site, how will the posts look like? But I still want to have this CSS-enabled feature. Since I like the idea to freeze the previous posts with the corresponding CSS file at that time. I will try to do this later or again search first <img src='http://www.ohehlium.com/log/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Meanwhile, don't forget the stats shown at the very top for wordpress.com, I would like to take a look at these most used whatever ~</p>
<p style="text-align: right; font-size: 8px">Blogged with <a title="Flock" target="_new" href="http://www.flock.com">Flock</a></p>
<p align="left" style="text-align: right; font-size: 8px">
<p><!--kw=browser blogeditor--></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ohehlium.com/log/2006/09/06/flock/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
