<?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>Lukewarm &#187; work</title>
	<atom:link href="http://www.imluke.net/blog/category/work/feed" rel="self" type="application/rss+xml" />
	<link>http://www.imluke.net/blog</link>
	<description>Luke&#039;s lukewarm life now gets some {GREEN}.</description>
	<lastBuildDate>Tue, 29 Jun 2010 09:49:17 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>VPN on VPS</title>
		<link>http://www.imluke.net/blog/226_vpn-on-vps.html</link>
		<comments>http://www.imluke.net/blog/226_vpn-on-vps.html#comments</comments>
		<pubDate>Tue, 02 Mar 2010 13:43:31 +0000</pubDate>
		<dc:creator>Luke</dc:creator>
				<category><![CDATA[work]]></category>
		<category><![CDATA[VPN]]></category>
		<category><![CDATA[VPS]]></category>

		<guid isPermaLink="false">http://www.imluke.net/blog/?p=226</guid>
		<description><![CDATA[这两天刚搞到一台米国的VPS，相当便宜，配置、速度也还不错。周末忙活了两天配了一下VPN，这里做一下笔记：
1. Apache优化
ubuntu下有个apache2-mpm-perfork包，能很显著地降低apache内存占用。装完之后apache的从200M掉到100M！很好很强大！
2. OpenVPN证书生成
这个要在本机做！生成的CA.crt是public key,ca.key是private key，这两个用于生成server和client的证书。因此ca.key一定不要传到server上去，否则别人就能拿来自己生成证书了。
3. 服务器内核配置
服务器端要做nat的话需要内核的tun和iptables_nat module，我的vps是联系管理员给加的，因为自己改不了内核配置。
4. OpenVPN服务器端配置
做NAT需要添加两条：
这个将使客户端将VPN配置成默认网络连接
push "redirect-gateway def1"
这个将设置客户端的DNS服务器（防止DNS劫持）
push "dhcp-option DNS x.x.x.x"
这里DNS可以用OpenDNS的server
5. 用iptables中转来自client的包
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j SNAT --to-source x.x.x.x
&#8211;to-source配置成服务器公网IP。OpenVPN的howto里面的这一条目在我的VPS上不适用。
6. Windows客户端权限问题
windows的GUI客户端需要管理员权限运行。在vista/win7等开启了UAC时，要将gui程序兼容性改为winxp,并默认管理员运行。
7. 客户端route/iptables
按上面配置客户端将会使用VPN做默认连接。可以使用chnroutes来配置国内IP不走VPN.
客户端配置仍然不太满意。正在考虑Firefox的autoproxy插件，再利用什么软件中转到VPN去，然后其余连接用普通的。这样可以大大减少VPN流量并提高访问速度。刚在google code中搜了下openvpn，似乎有相关的项目。firefox那边插件选择连接的可能性不大，理论上。
客户端都配好了再更新。
&#8212;PS&#8212;
今天本来想跟美女炫耀一下，结果说错话了，适得其反。郁闷。
]]></description>
			<content:encoded><![CDATA[<p>这两天刚搞到一台米国的VPS，相当便宜，配置、速度也还不错。周末忙活了两天配了一下VPN，这里做一下笔记：</p>
<h4>1. Apache优化</h4>
<p>ubuntu下有个apache2-mpm-perfork包，能很显著地降低apache内存占用。装完之后apache的从200M掉到100M！很好很强大！</p>
<h4>2. OpenVPN证书生成</h4>
<p>这个要在本机做！生成的CA.crt是public key,ca.key是private key，这两个用于生成server和client的证书。因此ca.key一定不要传到server上去，否则别人就能拿来自己生成证书了。</p>
<h4>3. 服务器内核配置</h4>
<p>服务器端要做nat的话需要内核的tun和iptables_nat module，我的vps是联系管理员给加的，因为自己改不了内核配置。</p>
<h4>4. OpenVPN服务器端配置</h4>
<p>做NAT需要添加两条：<br />
这个将使客户端将VPN配置成默认网络连接</p>
<pre>push "redirect-gateway def1"</pre>
<p>这个将设置客户端的DNS服务器（防止DNS劫持）</p>
<pre>push "dhcp-option DNS x.x.x.x"</pre>
<p>这里DNS可以用OpenDNS的server</p>
<h4>5. 用iptables中转来自client的包</h4>
<pre>iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j SNAT --to-source x.x.x.x</pre>
<p>&#8211;to-source配置成服务器公网IP。OpenVPN的howto里面的这一条目在我的VPS上不适用。</p>
<h4>6. Windows客户端权限问题</h4>
<p>windows的GUI客户端需要管理员权限运行。在vista/win7等开启了UAC时，要将gui程序兼容性改为winxp,并默认管理员运行。</p>
<h4>7. 客户端route/iptables</h4>
<p>按上面配置客户端将会使用VPN做默认连接。可以使用<a href="http://code.google.com/p/chnroutes/">chnroutes</a>来配置国内IP不走VPN.</p>
<p>客户端配置仍然不太满意。正在考虑Firefox的autoproxy插件，再利用什么软件中转到VPN去，然后其余连接用普通的。这样可以大大减少VPN流量并提高访问速度。刚在google code中搜了下openvpn，似乎有相关的项目。firefox那边插件选择连接的可能性不大，理论上。<br />
客户端都配好了再更新。</p>
<p>&#8212;PS&#8212;<br />
今天本来想跟美女炫耀一下，结果说错话了，适得其反。郁闷。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.imluke.net/blog/226_vpn-on-vps.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Eclipse and Ubuntu</title>
		<link>http://www.imluke.net/blog/219_eclipse-and-ubuntu.html</link>
		<comments>http://www.imluke.net/blog/219_eclipse-and-ubuntu.html#comments</comments>
		<pubDate>Sat, 05 Dec 2009 02:00:27 +0000</pubDate>
		<dc:creator>Luke</dc:creator>
				<category><![CDATA[work]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.imluke.net/blog/?p=219</guid>
		<description><![CDATA[Some buttons in Eclipse 3.5 under Ubuntu 9.10 won&#8217;t work but short cut key works. It&#8217;s because SWT eclipse uses have some problem with the underlying GTK.
Also this will be fixed in eclipse 3.5.2, the is a work around for those older 3.5 releases. Write a simple shell script to start eclipse:
#!/bin/sh
export GDK_NATIVE_WINDOWS=1
~/bin/eclipse
Replace "~/bin/eclipse" with [...]]]></description>
			<content:encoded><![CDATA[<p>Some buttons in Eclipse 3.5 under Ubuntu 9.10 won&#8217;t work but short cut key works. It&#8217;s because SWT eclipse uses have <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=287307">some problem</a> with the <a href="http://git.gnome.org/cgit/gtk+/commit/?id=a79f929dd6c89fceeaf0d9039e5a10cad9d87d2f">underlying GTK</a>.</p>
<p>Also this will be fixed in eclipse 3.5.2, the is a work around for those older 3.5 releases. Write a simple shell script to start eclipse:</p>
<pre>#!/bin/sh
export GDK_NATIVE_WINDOWS=1
~/bin/eclipse</pre>
<p>Replace <code>"~/bin/eclipse"</code> with your eclipse path.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.imluke.net/blog/219_eclipse-and-ubuntu.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>重新开张</title>
		<link>http://www.imluke.net/blog/156_%e9%87%8d%e6%96%b0%e5%bc%80%e5%bc%a0.html</link>
		<comments>http://www.imluke.net/blog/156_%e9%87%8d%e6%96%b0%e5%bc%80%e5%bc%a0.html#comments</comments>
		<pubDate>Wed, 25 Mar 2009 14:14:29 +0000</pubDate>
		<dc:creator>Luke</dc:creator>
				<category><![CDATA[work]]></category>
		<category><![CDATA[website]]></category>
		<category><![CDATA[备案]]></category>

		<guid isPermaLink="false">http://www.imluke.net/blog/?p=156</guid>
		<description><![CDATA[网站前一阵因为没备案被关停了，这在俺的历史上也是头一遭。虽说平均ip/d几近与0，但俺追求accessability的决心还是很坚定的，被关停对俺来说是奇耻大辱啊。当然，这里俺也不敢评论是非了，就当黄连、榴莲之类的自己吞了好了。
是在大概两周之前提交了备案，昨天刚刚通过了，然后今天就马上整理好东西重新开通了。看看荒芜的blog，倒也有些惭愧。年前在玩python，后来因为unicode的问题放弃了。年后搞到xbox之后就不务正业啦，下班之后的时间几乎全耗在上面了。再之后一些残念，一一作古。现在游戏玩腻了，也许该重新整整网站了。重新开张，重新写东西，算作第一步吧！
放个鞭炮吧，噼啪噼啪，噼啪噼啪&#8230;
]]></description>
			<content:encoded><![CDATA[<p>网站前一阵因为没备案被关停了，这在俺的历史上也是头一遭。虽说平均ip/d几近与0，但俺追求accessability的决心还是很坚定的，被关停对俺来说是奇耻大辱啊。当然，这里俺也不敢评论是非了，就当黄连、榴莲之类的自己吞了好了。</p>
<p>是在大概两周之前提交了备案，昨天刚刚通过了，然后今天就马上整理好东西重新开通了。看看荒芜的blog，倒也有些惭愧。年前在玩python，后来因为unicode的问题放弃了。年后搞到xbox之后就不务正业啦，下班之后的时间几乎全耗在上面了。再之后一些残念，一一作古。现在游戏玩腻了，也许该重新整整网站了。重新开张，重新写东西，算作第一步吧！</p>
<p>放个鞭炮吧，噼啪噼啪，噼啪噼啪&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.imluke.net/blog/156_%e9%87%8d%e6%96%b0%e5%bc%80%e5%bc%a0.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Spam comments</title>
		<link>http://www.imluke.net/blog/139_spam-comments.html</link>
		<comments>http://www.imluke.net/blog/139_spam-comments.html#comments</comments>
		<pubDate>Mon, 01 Sep 2008 07:49:51 +0000</pubDate>
		<dc:creator>Luke</dc:creator>
				<category><![CDATA[work]]></category>
		<category><![CDATA[akismet]]></category>
		<category><![CDATA[comments]]></category>
		<category><![CDATA[spam]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.imluke.net/blog/?p=139</guid>
		<description><![CDATA[Until now, Akismet has blocked 846 spam comments for me. And until now, I have got only 12 normal comments from human being visitors!
My website gets a high pagerank. It was 4 about 2 months ago. But now drop back to 3. I don&#8217;t know but maybe they choose to spam on sites with high [...]]]></description>
			<content:encoded><![CDATA[<p>Until now, Akismet has blocked 846 spam comments for me. And until now, I have got only 12 normal comments from human being visitors!</p>
<p>My website gets a high pagerank. It was 4 about 2 months ago. But now drop back to 3. I don&#8217;t know but maybe they choose to spam on sites with high pagerank. Thanks for Akismet, there were only about 2 or 3 spam comments wasn&#8217;t blocked. So the spam links never get a link to promot there page rank.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.imluke.net/blog/139_spam-comments.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Wordpress related posts</title>
		<link>http://www.imluke.net/blog/125_wordpress-related-posts.html</link>
		<comments>http://www.imluke.net/blog/125_wordpress-related-posts.html#comments</comments>
		<pubDate>Fri, 09 May 2008 15:33:35 +0000</pubDate>
		<dc:creator>Luke</dc:creator>
				<category><![CDATA[work]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wordpress related posts]]></category>

		<guid isPermaLink="false">http://www.imluke.net/blog/?p=125</guid>
		<description><![CDATA[I installed a wordpress plugin which is written by a friend: Denis. It returns the related posts by tags.
I want to put it in sidebar. So I added a widget function for this plugin. Also the content filters were commented out so that it won&#8217;t borther to filter my post contents everytime since I don&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>I installed <a title="wordpress related posts plugin" href="http://wordpress.org/extend/plugins/wordpress-23-related-posts-plugin/">a wordpress plugin</a> which is written by a friend: <a title="Denis's website" href="http://fairyfish.net/">Denis</a>. It returns the related posts by tags.</p>
<p>I want to put it in sidebar. So I added a widget function for this plugin. Also the content filters were commented out so that it won&#8217;t borther to filter my post contents everytime since I don&#8217;t want to display them in post or feeds.</p>
<p>Although it works fine for me now, there are still some things to be improved:</p>
<ol>
<li>If the number of related posts does not reach to display limit, it should have option to fill with random or most commented posts.</li>
<li>The title section really need to be moved out from the main code generate function.</li>
<li>Take count of category. The posts in the same category are related.</li>
<li>Denis submitted v0.6 to SVN trunk! I wander how he released v0.7 via SVN&#8230;</li>
</ol>
<p>I will send Denis my patch tomorrow. Hopefully he will merge it into next release, and, fix the functions I wanted here.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.imluke.net/blog/125_wordpress-related-posts.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache下配置sandbox</title>
		<link>http://www.imluke.net/blog/124_apache%e4%b8%8b%e9%85%8d%e7%bd%aesandbox.html</link>
		<comments>http://www.imluke.net/blog/124_apache%e4%b8%8b%e9%85%8d%e7%bd%aesandbox.html#comments</comments>
		<pubDate>Thu, 08 May 2008 14:01:14 +0000</pubDate>
		<dc:creator>Luke</dc:creator>
				<category><![CDATA[work]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[DNS]]></category>
		<category><![CDATA[sandbox]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://www.imluke.net/blog/?p=124</guid>
		<description><![CDATA[今天google了一下, 把长久以来很想做的一个apache VirtualHost配置搞定了.
基本功能是这样的: 在地址栏输入sandbox能访问我建在原来localhost下的document root/sandbox文件夹.
分开来,包括了两大部分: 将sandbox解析到本机(http request给Apache); 然后Apache根据server name返回内容.
解析sandbox
当你往浏览器地址栏里面输入http://sandbox/的时候, 浏览器会把sandbox作为一个域名, 查询与之相关联的IP. 浏览器首先去查看系统的host文件有没有列出这个域名. 如果有, 将直接返回host文件里的IP. 没有, 则要找网络连接里面配置的DNS服务器查询IP.
我要达到的目的让浏览器查询sandbox时返回本机IP 127.0.0.1, 最简单的办法就是修改host文件啦.
host文件在我的系统(Vista)的C:\Windows\System32\drivers\etc内. 用记事本打开, 在文件末端添加一行:

127.0.0.1    sandbox

这样浏览器就会将sandbox指向127.0.0.1.
配置Apache
浏览器把http请求顺利的转到了本机, 接下来应该是Apache忙活了. 为了让Apache找到sandbox对应的本地目录, 就需要配置一个VirtualHost.  我的配置是这样的:

NameVirtualHost 127.0.0.1:80
&#60;VirtualHost 127.0.0.1:80&#62;
DocumentRoot "F:/web"
ServerName localhost
&#60;/VirtualHost&#62;

&#60;VirtualHost 127.0.0.1:80&#62;
DocumentRoot "F:/web/sandbox"
ServerName sandbox
&#60;/VirtualHost&#62;

具体配置说明去看文档, 这里就不讲了. 上面配置的意思就是127.0.0.1下域名为localhost的内容在F:/web, 而sandbox内容在F:/web/sandbox.
到这里, 浏览器就能收到Apache的输出, 显示存在F:/web/sandbox下的内容了.
未解决的问题
host文件似乎不能用将域名绑定到一个端口上去. 比如我尝试下面的配置就失败了:

127.0.0.1:8000    jira

http://jira/不会连接到我的Tomcat上, 而是很&#8221;智能&#8221;地跑到jira.com去了-_-!!!也许这种问题需要其它的解决方案咯.
]]></description>
			<content:encoded><![CDATA[<p>今天google了一下, 把长久以来很想做的一个<a title="Apache" href="http://www.apache.org">apache</a> <a title="Apache VirtualHost Document" href="http://httpd.apache.org/docs/2.2/vhosts/">VirtualHost</a>配置搞定了.</p>
<p>基本功能是这样的: 在地址栏输入sandbox能访问我建在原来localhost下的document root/sandbox文件夹.</p>
<p>分开来,包括了两大部分: 将sandbox解析到本机(http request给Apache); 然后Apache根据server name返回内容.</p>
<h4>解析sandbox</h4>
<p>当你往浏览器地址栏里面输入<code>http://sandbox/</code>的时候, 浏览器会把sandbox作为一个域名, 查询与之相关联的IP. 浏览器首先去查看系统的host文件有没有列出这个域名. 如果有, 将直接返回host文件里的IP. 没有, 则要找网络连接里面配置的DNS服务器查询IP.</p>
<p>我要达到的目的让浏览器查询sandbox时返回本机IP 127.0.0.1, 最简单的办法就是修改host文件啦.</p>
<p>host文件在我的系统(Vista)的<code>C:\Windows\System32\drivers\etc</code>内. 用记事本打开, 在文件末端添加一行:</p>
<pre>
127.0.0.1    sandbox
</pre>
<p>这样浏览器就会将sandbox指向127.0.0.1.</p>
<h4>配置Apache</h4>
<p>浏览器把http请求顺利的转到了本机, 接下来应该是Apache忙活了. 为了让Apache找到sandbox对应的本地目录, 就需要配置一个VirtualHost.  我的配置是这样的:</p>
<pre>
NameVirtualHost 127.0.0.1:80
&lt;VirtualHost 127.0.0.1:80&gt;
DocumentRoot "F:/web"
ServerName localhost
&lt;/VirtualHost&gt;

&lt;VirtualHost 127.0.0.1:80&gt;
DocumentRoot "F:/web/sandbox"
ServerName sandbox
&lt;/VirtualHost&gt;
</pre>
<p>具体配置说明去看<a title="Apache VirtualHost Document" href="http://httpd.apache.org/docs/2.2/vhosts/">文档</a>, 这里就不讲了. 上面配置的意思就是127.0.0.1下域名为localhost的内容在<code>F:/web</code>, 而sandbox内容在<code>F:/web/sandbox</code>.</p>
<p>到这里, 浏览器就能收到Apache的输出, 显示存在<code>F:/web/sandbox</code>下的内容了.</p>
<h4>未解决的问题</h4>
<p>host文件似乎不能用将域名绑定到一个端口上去. 比如我尝试下面的配置就失败了:</p>
<pre>
127.0.0.1:8000    jira
</pre>
<p><code>http://jira/</code>不会连接到我的Tomcat上, 而是很&#8221;智能&#8221;地跑到jira.com去了-_-!!!也许这种问题需要其它的解决方案咯.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.imluke.net/blog/124_apache%e4%b8%8b%e9%85%8d%e7%bd%aesandbox.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tips for switching to valid XHTML1.1</title>
		<link>http://www.imluke.net/blog/119_tips-for-switching-to-valid-xhtml11.html</link>
		<comments>http://www.imluke.net/blog/119_tips-for-switching-to-valid-xhtml11.html#comments</comments>
		<pubDate>Sun, 13 Apr 2008 06:28:54 +0000</pubDate>
		<dc:creator>Luke</dc:creator>
				<category><![CDATA[work]]></category>
		<category><![CDATA[standard]]></category>
		<category><![CDATA[w3c]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[xhtml]]></category>

		<guid isPermaLink="false">http://www.imluke.net/blog/?p=119</guid>
		<description><![CDATA[Since the web is waiting for the XHTML2 standard, we can notice that the trend of web page markup is heading to the pure XML direction. Though XHTML2 might need a long time to be published, we should be prepared. What shall we do now? Switching to XHTML1.1 now would be the best practice since:

It&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>Since the web is waiting for the <a title="XHTML2" href="http://www.w3.org/TR/xhtml2/">XHTML2</a> standard, we can notice that the trend of web page markup is heading to the pure XML direction. Though XHTML2 might need a long time to be published, we should be prepared. What shall we do now? Switching to <a title="xhtml1.1" href="http://www.w3.org/MarkUp/#xhtml11">XHTML1.1</a> now would be the best practice since:</p>
<ol>
<li>It&#8217;s pure XML, which is similar to XHTML2.</li>
<li>It is supported by current common browsers.</li>
</ol>
<p>Using XHTML1.1 will let you be familiar with pure XML, and makes it much easier to change to XHTML2 in the future.</p>
<p>I decided to switch to XHTML1.1 (from XHTML1.0 traditional) today. While cleaning up my web pages, I found some tips which might be helpful for web you developers:</p>
<p><span id="more-119"></span></p>
<h4>Doctype declare:</h4>
<p>This is the first thing to do. Add following line in the very beginning of your file:</p>
<pre>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/2001/REC-xhtml11-20010531/DTD/xhtml11-flat.dtd"&gt;</pre>
<p>This will let browsers know it&#8217;s in XHTML1.1 format.</p>
<p>Also, because XHTML1.1 should be transmitted with MIME type application/xhtml+xml, a meta tag should be added in &lt;head&gt;:</p>
<pre>&lt;meta http-equiv="Content-Type"
    content="application/xhtml+xml; charset=utf-8" /&gt;</pre>
<h4>No lang attribute</h4>
<p>&#8220;lang&#8221; attribute in tags is not supported in XHTML1.1. Instead, you should use &#8220;xml:lang&#8221; attribute. A example:</p>
<pre>&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"&gt;</pre>
<p>This defines language of the whole document as English(en).</p>
<p>Other changes from XHTML1.0 strict can be found here: <a title="Diff with 1.0" href="http://www.w3.org/TR/xhtml11/changes.html#a_changes">http://www.w3.org/TR/xhtml11/changes.html#a_changes</a></p>
<h4>Adding CDATA in scripts</h4>
<p>Some java scripts may break validation result of your web page. A very common example is Google Analytics javascript code. Modify your Google analytics code will make it passing <a title="W3C validator" href="http://validator.w3.org/">W3C validation</a>:</p>
<pre>&lt;!--Google Analytics--&gt;
&lt;script type="text/javascript"&gt;
//&lt;!--[CDATA[
var gaJsHost = ( ("https:" == document.location.protocol) ?
    "https://ssl." : "http://www.");
document.write("\&lt;script src='" + gaJsHost +
    "google-analytics.com/ga.js' type='text/javascript'&gt;\&lt;\/script&gt;" );
//]]--&gt;
&lt;/script&gt;
&lt;script type="text/javascript"&gt;
<span style="color: #c0c0c0;">//&lt;!--[CDATA[</span>
var pageTracker = _gat._getTracker("UA-????????");
pageTracker._initData();
pageTracker._trackPageview();
<span style="color: #999999;">//]]--&gt;</span>
&lt;/script&gt;
&lt;!--End of Google Analytics--&gt;</pre>
<h4>File name matters</h4>
<p>Traditionally, it does not matter if you name web pages with .hml/.html. But if you still use them as postfix of XHTML1.1 web pages, your server most probably send it withMIME type text/html while XHTML1.1 should be application/xhtml+xml. Does this matter? W3C validator warning message says:</p>
<blockquote><p>Using a wrong media type for a certain document type may       confuse the validator and other user agents with respect to the        nature of the document, and you may get some erroneous validation       errors.</p></blockquote>
<p>I tried with my webserver(FreeBSD+Apache), it will send right mime type if file name ends with .xhtml. Otherwise W3C validator will generate a warning message. But unfortunately my server won&#8217;t recognize index.xhtml as default page. So be sure to check this issue on your server. Otherwise your front page might be broken.</p>
<p>Although I would like to suggest everyone to drop his IE6, it&#8217;s disappointing for web developers to see that IE6 is still widely used. And IE6 has problem with MIME typeapplication/xhtml+xml as described  <a title="IE6 issue" href="http://juicystudio.com/article/content-negotiation.php#user">here</a>. This might cause problem under some conditions &#8211; especially when you change file postfix to .xhtml. So it seems to be a hard decision to make on file names &#8211; although it&#8217;s easy for me: I abandon users under IE6!</p>
<h4>Setting MIME type</h4>
<p>Setting MIME type in dynamic language is easy. Here is a script in PHP:</p>
<pre>header("Vary: Accept");
if (stristr($_SERVER["HTTP_ACCEPT"], "application/xhtml+xml"))
header("Content-Type: application/xhtml+xml; charset=utf-8");
else
header("Content-Type: text/html; charset=utf-8");</pre>
<p>This script will check with user agent to see if it accept <code>application/xhtml+xml</code>, thus it&#8217;s safe to use.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.imluke.net/blog/119_tips-for-switching-to-valid-xhtml11.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Many things, no time</title>
		<link>http://www.imluke.net/blog/106_many-things-no-time.html</link>
		<comments>http://www.imluke.net/blog/106_many-things-no-time.html#comments</comments>
		<pubDate>Sat, 22 Mar 2008 15:36:38 +0000</pubDate>
		<dc:creator>Luke</dc:creator>
				<category><![CDATA[work]]></category>
		<category><![CDATA[ideas]]></category>

		<guid isPermaLink="false">http://www.imluke.net/blog/106_many-things-no-time.html</guid>
		<description><![CDATA[最近忙到没法抽时间写几篇blog, 的确有点夸张. 留个印记, 以便回头看看叹口气(可能或许maybe炫耀一下也难说).
日程上有一个issue是写一个JIRA的安装教程, 还有一些新鲜的东东, 比如M$和DELL搞的(product)RED, android下的bluetooth, HID, 还有一些新鲜的ideas, 崔健的Rock, 包括刚刚从taobao淘到的黑曜石手链和Diesel jeans&#8230; 太多太多
ADC剩下的时间不多了, 能用的idea才刚刚出来, 看来最近也不可能抽时间写blog了. 再过半个月, 又要忙工作的事了&#8230; 算来算去, 要熬到哪天才能安心的写篇blog呢? 唉, 50h/d的幻想又一次浮出脑门~~~
]]></description>
			<content:encoded><![CDATA[<p>最近忙到没法抽时间写几篇blog, 的确有点夸张. 留个印记, 以便回头看看叹口气(可能或许maybe炫耀一下也难说).</p>
<p>日程上有一个issue是写一个JIRA的安装教程, 还有一些新鲜的东东, 比如M$和DELL搞的(product)RED, android下的bluetooth, HID, 还有一些新鲜的ideas, 崔健的Rock, 包括刚刚从taobao淘到的黑曜石手链和<a title="Diesel jeans" href="http://auction1.taobao.com/auction/item_detail-0db1-a5ac5903cba682dcb6298ee4f745a424.jhtml">Diesel jeans</a>&#8230; 太多太多</p>
<p>ADC剩下的时间不多了, 能用的idea才刚刚出来, 看来最近也不可能抽时间写blog了. 再过半个月, 又要忙工作的事了&#8230; 算来算去, 要熬到哪天才能安心的写篇blog呢? 唉, 50h/d的幻想又一次浮出脑门~~~</p>
]]></content:encoded>
			<wfw:commentRss>http://www.imluke.net/blog/106_many-things-no-time.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Android running on a handset</title>
		<link>http://www.imluke.net/blog/104_android-running-on-a-handset.html</link>
		<comments>http://www.imluke.net/blog/104_android-running-on-a-handset.html#comments</comments>
		<pubDate>Sat, 01 Mar 2008 14:44:06 +0000</pubDate>
		<dc:creator>Luke</dc:creator>
				<category><![CDATA[work]]></category>
		<category><![CDATA[ADC]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[phone]]></category>

		<guid isPermaLink="false">http://www.imluke.net/blog/104_android-running-on-a-handset.html</guid>
		<description><![CDATA[With an exciting news from engadget, a big touch screen is shaped into the new android prototype mobile phone.

Unfortunately because of GFW, I can&#8217;t see that live demo video. But from the picture I can see it&#8217;s running the newly released m5 build of android OS. I think the release of m5 is based on [...]]]></description>
			<content:encoded><![CDATA[<p>With <a title="engadget" href="http://www.engadget.com/2008/02/28/android-gets-handled-now-with-street-view/">an exciting news from engadget</a>, a big touch screen is shaped into the new android prototype mobile phone.</p>
<p><img src="http://www.blogsmithmedia.com/www.engadget.com/media/2008/02/android-demo-alpha-1.png" /></p>
<p>Unfortunately because of GFW, I can&#8217;t see that live demo video. But from the picture I can see it&#8217;s running the <a title="Android SDK M5" href="http://code.google.com/android/migrating/m3-to-m5/m5-api-changes.html">newly released m5 build</a> of android OS. I think the release of m5 is based on the test on that mobile phone &#8211; the screen size and menu layout in SDK m5 is the same as this phone.</p>
<p>So, it&#8217;s coming soon~~~ I gonna hurry up with my <a title="Android developer challenge" href="http://code.google.com/android/adc.html">ADC</a> project.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.imluke.net/blog/104_android-running-on-a-handset.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>数据库编码导致Wordpress中文显示乱码的解决方法</title>
		<link>http://www.imluke.net/blog/102_wordpress-database-utf8.html</link>
		<comments>http://www.imluke.net/blog/102_wordpress-database-utf8.html#comments</comments>
		<pubDate>Mon, 25 Feb 2008 14:53:51 +0000</pubDate>
		<dc:creator>Luke</dc:creator>
				<category><![CDATA[work]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.imluke.net/blog/102_wordpress%e6%95%b0%e6%8d%ae%e5%ba%93%e7%bc%96%e7%a0%81%e9%bb%98%e8%ae%a4%e4%b8%8d%e6%98%afutf8%e7%9a%84%e8%a7%a3%e5%86%b3%e6%96%b9%e6%b3%95.html</guid>
		<description><![CDATA[今天把wordpress升级到了2.5beta1, 中文又是一片乱码, 唉,万恶的8-host, 万恶的GBK.
不得已,再去翻wp-db.php. 却发现代码改了,添加了对DB_CHARSET的支持,使用了:
$this-&#62;charset = DB_CHARSET;
...
$this-&#62;query("SET NAMES '$this-&#62;charset'");
来定义数据库连接的编码了
于是马上在我的wp-config.php中添加了一行:
define('DB_CHARSET','UTF8');
F5了一下, 果然好用, 哈哈．以后不需要改wp的core, 直接在config文件中定义就可以了. 方便,方便,相当地方便.
]]></description>
			<content:encoded><![CDATA[<p>今天把wordpress升级到了2.5beta1, 中文又是一片乱码, 唉,万恶的8-host, 万恶的GBK.</p>
<p>不得已,再去翻wp-db.php. 却发现代码改了,添加了对DB_CHARSET的支持,使用了:</p>
<pre>$this-&gt;charset = DB_CHARSET;
...
$this-&gt;query("SET NAMES '$this-&gt;charset'");</pre>
<p>来定义数据库连接的编码了</p>
<p>于是马上在我的wp-config.php中添加了一行:</p>
<pre>define('DB_CHARSET','UTF8');</pre>
<p>F5了一下, 果然好用, 哈哈．以后不需要改wp的core, 直接在config文件中定义就可以了. 方便,方便,相当地方便.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.imluke.net/blog/102_wordpress-database-utf8.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
