<?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>蓝色的华</title>
	<atom:link href="http://bluehua.org/feed" rel="self" type="application/rss+xml" />
	<link>http://bluehua.org</link>
	<description>分享所学,backup一切~</description>
	<lastBuildDate>Fri, 27 Aug 2010 08:41:16 +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>用好vim的外部过滤器</title>
		<link>http://bluehua.org/2010/08/16/1430.html</link>
		<comments>http://bluehua.org/2010/08/16/1430.html#comments</comments>
		<pubDate>Mon, 16 Aug 2010 08:26:47 +0000</pubDate>
		<dc:creator>小鹿</dc:creator>
				<category><![CDATA[soft]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://bluehua.org/2010/08/16/1430.html</guid>
		<description><![CDATA[明知有此功能却不知道利用，以前要在命令行转完再贴过来。。


&#8212;&#8212;&#8212;&#8211;
post by gmail~
]]></description>
			<content:encoded><![CDATA[<p>明知有此功能却不知道利用，以前要在命令行转完再贴过来。。</p>
<p><img src="http://bluehua.org/wp-content/uploads/2010/08/screenshot_084.png" alt="screenshot_084.png" title="screenshot_084.png"/></p>
<p><img src="http://bluehua.org/wp-content/uploads/2010/08/screenshot_085.png" alt="screenshot_085.png" title="screenshot_085.png"/></p>
<p>&#8212;&#8212;&#8212;&#8211;<br />
post by gmail~</p>
]]></content:encoded>
			<wfw:commentRss>http://bluehua.org/2010/08/16/1430.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>速度创建一个grub启动盘</title>
		<link>http://bluehua.org/2010/08/13/1424.html</link>
		<comments>http://bluehua.org/2010/08/13/1424.html#comments</comments>
		<pubDate>Fri, 13 Aug 2010 11:36:03 +0000</pubDate>
		<dc:creator>小鹿</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[grub4dos]]></category>
		<category><![CDATA[syslinux]]></category>

		<guid isPermaLink="false">http://bluehua.org/2010/08/13/1424.html</guid>
		<description><![CDATA[写了个shell，可以把U盘快速变成一个Grub启动盘，防灾必备~
恩,我采用了syslinux引导grub4dos的方式，这样不用给u盘格ext分区，使用脚本之前要现确保一下U盘是fat格式,不是的话mkfs.vfat格一下，之后下载下面这个shell
http://code-of-emptyhua.googlecode.com/svn/trunk/shell/mkgrubusb/bin/mkgrubusb.bin
然后运行下

#/dev/sdb4是u盘的设备号,因人而异,可用df命令查到
sudo ./mkgrubusb.bin /dev/sdb4

如果提示成功,就可以用了
&#8212;&#8212;&#8212;&#8211;
post by gmail~
]]></description>
			<content:encoded><![CDATA[<p>写了个shell，可以把U盘快速变成一个Grub启动盘，防灾必备~<br />
恩,我采用了syslinux引导grub4dos的方式，这样不用给u盘格ext分区，使用脚本之前要现确保一下U盘是fat格式,不是的话mkfs.vfat格一下，之后下载下面这个shell<br />
<a href="http://code-of-emptyhua.googlecode.com/svn/trunk/shell/mkgrubusb/bin/mkgrubusb.bin">http://code-of-emptyhua.googlecode.com/svn/trunk/shell/mkgrubusb/bin/mkgrubusb.bin</a><br />
然后运行下</p>

<div class="wp_syntax"><div class="code overflow"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#/dev/sdb4是u盘的设备号,因人而异,可用df命令查到</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> .<span style="color: #000000; font-weight: bold;">/</span>mkgrubusb.bin <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sdb4</pre></div></div>

<p>如果提示成功,就可以用了</p>
<p>&#8212;&#8212;&#8212;&#8211;<br />
post by gmail~</p>
]]></content:encoded>
			<wfw:commentRss>http://bluehua.org/2010/08/13/1424.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>why mail2blog</title>
		<link>http://bluehua.org/2010/08/13/1423.html</link>
		<comments>http://bluehua.org/2010/08/13/1423.html#comments</comments>
		<pubDate>Fri, 13 Aug 2010 04:50:10 +0000</pubDate>
		<dc:creator>小鹿</dc:creator>
				<category><![CDATA[soft]]></category>
		<category><![CDATA[mail2blog]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://bluehua.org/2010/08/13/1423.html</guid>
		<description><![CDATA[这阵子一直用email更新这个blog，很爽。
优点：
1. 客户端变得很多，比如我现在吃饭的空用e71码这篇blog，blog变得可以随时随地。
2. 更稳定得编辑器，worpress自带得编辑器给我特不稳定得感觉，而且添加附件不方便。
3. 不用再备份blog，全在已发邮件里了，包括附件。
从我的e71发送superscreenshot0029.jpg
&#8212;&#8212;&#8212;&#8211;
post by gmail~
]]></description>
			<content:encoded><![CDATA[<p>这阵子一直用email更新这个blog，很爽。</p>
<p>优点：<br />
1. 客户端变得很多，比如我现在吃饭的空用e71码这篇blog，blog变得可以随时随地。<br />
2. 更稳定得编辑器，worpress自带得编辑器给我特不稳定得感觉，而且添加附件不方便。<br />
3. 不用再备份blog，全在已发邮件里了，包括附件。</p>
<p>从我的e71发送<br /><a href="http://bluehua.org/wp-content/uploads/2010/08/superscreenshot0029.jpg">superscreenshot0029.jpg</a><br />
&#8212;&#8212;&#8212;&#8211;<br />
post by gmail~</p>
]]></content:encoded>
			<wfw:commentRss>http://bluehua.org/2010/08/13/1423.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>日历的重复事件预测</title>
		<link>http://bluehua.org/2010/08/11/1417.html</link>
		<comments>http://bluehua.org/2010/08/11/1417.html#comments</comments>
		<pubDate>Wed, 11 Aug 2010 15:12:06 +0000</pubDate>
		<dc:creator>小鹿</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[calendar]]></category>
		<category><![CDATA[repeat event]]></category>

		<guid isPermaLink="false">http://bluehua.org/2010/08/11/1417.html</guid>
		<description><![CDATA[本周开发一个web行事历，遇到一个比较繁琐的问题，就是重复事件。比如我创建了一个每周1,3,5重复的事件，当点击2012年的某月的日历时，需要显示这个事件会在哪几天发生。我又偷懒的去google找PHP源码，这回真的没有&#8230;,于是按照正常的想法实现了一个,不知道有没有更好的实现~
简述如下:
恩，问题描述出来就是找出特定规则的重复事件E在日期DA和日期DB之间会发生的日期，那么俺先粗略的在日期DA之前找一个事件E会发生日期DC然后从DC开始严格按照重复规则遍历,找出所有事件发生日期。
源代码:
http://code-of-emptyhua.googlecode.com/svn/trunk/phplib/calutil.class.php
&#8212;&#8212;&#8212;&#8211;
post by gmail~
]]></description>
			<content:encoded><![CDATA[<p>本周开发一个web行事历，遇到一个比较繁琐的问题，就是重复事件。比如我创建了一个每周1,3,5重复的事件，当点击2012年的某月的日历时，需要显示这个事件会在哪几天发生。我又偷懒的去google找PHP源码，这回真的没有&#8230;,于是按照正常的想法实现了一个,不知道有没有更好的实现~<br />
简述如下:<br />
恩，问题描述出来就是找出特定规则的重复事件E在日期DA和日期DB之间会发生的日期，那么俺先粗略的在日期DA之前找一个事件E会发生日期DC然后从DC开始严格按照重复规则遍历,找出所有事件发生日期。</p>
<p>源代码:<br />
<a href="http://code-of-emptyhua.googlecode.com/svn/trunk/phplib/calutil.class.php">http://code-of-emptyhua.googlecode.com/svn/trunk/phplib/calutil.class.php</a></p>
<p>&#8212;&#8212;&#8212;&#8211;<br />
post by gmail~</p>
]]></content:encoded>
			<wfw:commentRss>http://bluehua.org/2010/08/11/1417.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>找到Flash Media Server的替代品~</title>
		<link>http://bluehua.org/2010/08/08/1412.html</link>
		<comments>http://bluehua.org/2010/08/08/1412.html#comments</comments>
		<pubDate>Sun, 08 Aug 2010 00:48:10 +0000</pubDate>
		<dc:creator>小鹿</dc:creator>
				<category><![CDATA[soft]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[FMS]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[record]]></category>
		<category><![CDATA[rtmp]]></category>
		<category><![CDATA[rtmplite]]></category>

		<guid isPermaLink="false">http://bluehua.org/2010/08/08/1412.html</guid>
		<description><![CDATA[很早之前就想实现一个在线录音的功能，无奈一直没有找到FMS的替代品。以前用&#8221;flash 录音&#8221;两个关键词，结果大多是FMS实现，还有个开源的Red5，java实现的，还是算了，vps上跑java。。偶尔换了个高级点的关键词&#8221;python rtmp&#8221;立刻找到我想要的:http://code.google.com/p/rtmplite/ 。rtmplite实现了一个简单的RTMP server,而且只用了3个python文件，(Red5都有三十几兆。。)

ls -lh amf.py multitask.py rtmp.py 
-rwxr-xr-x 1 lu lu 17K 2010-07-30 12:31 amf.py
-rwxr-xr-x 1 lu lu 41K 2010-06-29 07:28 multitask.py
-rwxr-xr-x 1 lu lu 51K 2010-07-30 09:42 rtmp.py

实现的在线录音功能:http://v.hua.lu
&#8212;&#8212;&#8212;&#8211;
post by gmail~
]]></description>
			<content:encoded><![CDATA[<p>很早之前就想实现一个在线录音的功能，无奈一直没有找到FMS的替代品。以前用&#8221;flash 录音&#8221;两个关键词，结果大多是FMS实现，还有个开源的Red5，java实现的，还是算了，vps上跑java。。偶尔换了个高级点的关键词&#8221;python rtmp&#8221;立刻找到我想要的:<a href="http://code.google.com/p/rtmplite/">http://code.google.com/p/rtmplite/</a> 。rtmplite实现了一个简单的RTMP server,而且只用了3个python文件，(Red5都有三十几兆。。)</p>

<div class="wp_syntax"><div class="code overflow"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-lh</span> amf.py multitask.py rtmp.py 
<span style="color: #660033;">-rwxr-xr-x</span> <span style="color: #000000;">1</span> lu lu 17K <span style="color: #000000;">2010</span>-07-<span style="color: #000000;">30</span> <span style="color: #000000;">12</span>:<span style="color: #000000;">31</span> amf.py
<span style="color: #660033;">-rwxr-xr-x</span> <span style="color: #000000;">1</span> lu lu 41K <span style="color: #000000;">2010</span>-06-<span style="color: #000000;">29</span> 07:<span style="color: #000000;">28</span> multitask.py
<span style="color: #660033;">-rwxr-xr-x</span> <span style="color: #000000;">1</span> lu lu 51K <span style="color: #000000;">2010</span>-07-<span style="color: #000000;">30</span> 09:<span style="color: #000000;">42</span> rtmp.py</pre></div></div>

<p>实现的在线录音功能:<a href="http://v.hua.lu">http://v.hua.lu</a></p>
<p>&#8212;&#8212;&#8212;&#8211;<br />
post by gmail~</p>
]]></content:encoded>
			<wfw:commentRss>http://bluehua.org/2010/08/08/1412.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>汉字转拼音的C语言版本</title>
		<link>http://bluehua.org/2010/07/30/1410.html</link>
		<comments>http://bluehua.org/2010/07/30/1410.html#comments</comments>
		<pubDate>Fri, 30 Jul 2010 15:55:07 +0000</pubDate>
		<dc:creator>小鹿</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[c]]></category>
		<category><![CDATA[汉字转拼音]]></category>

		<guid isPermaLink="false">http://bluehua.org/2010/07/30/1410.html</guid>
		<description><![CDATA[2010.8.5日更新，svn版本12
修正了部分多音字拼音的优先级顺序
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;
&#8230;，本周接到用C的任务，搞定了一个生成头像的fastcgi程序，这个转拼音的写好了给别人用，我对C终于不是那么恐惧了~
生成可执行文件可以直接用,多音字会用&#124;分开

$ echo 中国淫 &#124; ./hz2py 
zhong guo yan&#124;yao&#124;yin

编译:

gcc -D HZ2PY_BINARY hz2py.c -o hz2py

源代码:http://code-of-emptyhua.googlecode.com/svn/trunk/chz2py/hz2py.c
可执行文件:http://code-of-emptyhua.googlecode.com/svn/trunk/chz2py/hz2py
&#8212;&#8212;&#8212;&#8211;
post by gmail~
]]></description>
			<content:encoded><![CDATA[<p>2010.8.5日更新，svn版本12<br />
修正了部分多音字拼音的优先级顺序<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
&#8230;，本周接到用C的任务，搞定了一个生成头像的fastcgi程序，这个转拼音的写好了给别人用，我对C终于不是那么恐惧了~</p>
<p>生成可执行文件可以直接用,多音字会用|分开</p>

<div class="wp_syntax"><div class="code overflow"><pre class="bash" style="font-family:monospace;">$ <span style="color: #7a0874; font-weight: bold;">echo</span> 中国淫 <span style="color: #000000; font-weight: bold;">|</span> .<span style="color: #000000; font-weight: bold;">/</span>hz2py 
zhong guo yan<span style="color: #000000; font-weight: bold;">|</span>yao<span style="color: #000000; font-weight: bold;">|</span>yin</pre></div></div>

<p>编译:</p>

<div class="wp_syntax"><div class="code overflow"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">gcc</span> <span style="color: #660033;">-D</span> HZ2PY_BINARY hz2py.c <span style="color: #660033;">-o</span> hz2py</pre></div></div>

<p>源代码:<a href="http://code-of-emptyhua.googlecode.com/svn/trunk/chz2py/hz2py.c">http://code-of-emptyhua.googlecode.com/svn/trunk/chz2py/hz2py.c</a><br />
可执行文件:<a href="http://code-of-emptyhua.googlecode.com/svn/trunk/chz2py/hz2py">http://code-of-emptyhua.googlecode.com/svn/trunk/chz2py/hz2py</a></p>
<p>&#8212;&#8212;&#8212;&#8211;<br />
post by gmail~</p>
]]></content:encoded>
			<wfw:commentRss>http://bluehua.org/2010/07/30/1410.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>fastcgi的printf输出图片时有问题</title>
		<link>http://bluehua.org/2010/07/29/1408.html</link>
		<comments>http://bluehua.org/2010/07/29/1408.html#comments</comments>
		<pubDate>Thu, 29 Jul 2010 10:23:48 +0000</pubDate>
		<dc:creator>小鹿</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[fastcgi]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[printf]]></category>

		<guid isPermaLink="false">http://bluehua.org/2010/07/29/1408.html</guid>
		<description><![CDATA[直接使用stdio的printf输出二进制图片没有问题,但是改用fcgi_stdio.h后直接被吃了许多字节,不知道具体什么原因，不过直接写到标准输出没有问题

for &#40;i = 0; i &#60; base_outlen; i ++&#41;
&#123;
    //printf(&#34;%c&#34;, *start); 
    //fix:fastcgi脑残，printf输出不了二进制流
    tmpc = *start;
    fwrite&#40;&#38;tmpc, sizeof&#40;char&#41;, 1, stdout&#41;;
    start++;
&#125;

关键词:fastcgi image,搜出一个一样情况的帖子,不过没有解决方案,那我这个就算解决方法了.
http://www.fastcgi.com/archives/fastcgi-developers/2008-August/000011.html
&#8212;&#8212;&#8212;&#8211;
post by gmail~
]]></description>
			<content:encoded><![CDATA[<p>直接使用stdio的printf输出二进制图片没有问题,但是改用fcgi_stdio.h后直接被吃了许多字节,不知道具体什么原因，不过直接写到标准输出没有问题</p>

<div class="wp_syntax"><div class="code overflow"><pre class="c" style="font-family:monospace;"><span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span>i <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> base_outlen<span style="color: #339933;">;</span> i <span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">//printf(&quot;%c&quot;, *start); </span>
    <span style="color: #666666; font-style: italic;">//fix:fastcgi脑残，printf输出不了二进制流</span>
    tmpc <span style="color: #339933;">=</span> <span style="color: #339933;">*</span>start<span style="color: #339933;">;</span>
    fwrite<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span>tmpc<span style="color: #339933;">,</span> <span style="color: #993333;">sizeof</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">char</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">,</span> stdout<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    start<span style="color: #339933;">++;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>关键词:fastcgi image,搜出一个一样情况的帖子,不过没有解决方案,那我这个就算解决方法了.<br />
<a href="http://www.fastcgi.com/archives/fastcgi-developers/2008-August/000011.html">http://www.fastcgi.com/archives/fastcgi-developers/2008-August/000011.html</a></p>
<p>&#8212;&#8212;&#8212;&#8211;<br />
post by gmail~</p>
]]></content:encoded>
			<wfw:commentRss>http://bluehua.org/2010/07/29/1408.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>vim里快速调试PHP</title>
		<link>http://bluehua.org/2010/07/28/1407.html</link>
		<comments>http://bluehua.org/2010/07/28/1407.html#comments</comments>
		<pubDate>Wed, 28 Jul 2010 13:10:18 +0000</pubDate>
		<dc:creator>小鹿</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[debug]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://bluehua.org/2010/07/28/1407.html</guid>
		<description><![CDATA[恩，python中一般会把调试代码跟普通代码混在一块

class xx:
#    .....
if __name__ == '__main__':
    testxx = xx&#40;&#41;
    #测试代码....

这个__name__ == &#8216;__main__&#8217;判断此文件是否被直接执行，而不是被其他文件import,所以在vim中调试时可以直接输入:!python % 执行当前正在编辑的文件,调试代码便会执行并输出结果
php也可以这么加调试代码,php中是这么实现的

class xx &#123;
// ......
&#125;
//确定当前被执行的文件就是自己,而不是被其他php文件包含
if &#40;realpath&#40;$_SERVER&#91;'SCRIPT_FILENAME'&#93;&#41; == __FILE__&#41;
&#123;
    $testxx = new xx;
    //测试代码....
&#125;

如果仅限在命令行运行测试代码就再加个条件

if &#40;php_sapi_name&#40;&#41; == 'cli' &#38;&#38; realpath&#40;$_SERVER&#91;'SCRIPT_FILENAME'&#93;&#41; == __FILE__&#41;

为了更速度，vim配置里添加了一个快捷键F5

&#34;php和python调试快捷键
au FileType php map &#60;F5&#62; :call DebugRun&#40;'php'&#41;&#60;cr&#62;
au FileType php [...]]]></description>
			<content:encoded><![CDATA[<p>恩，python中一般会把调试代码跟普通代码混在一块</p>

<div class="wp_syntax"><div class="code overflow"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">class</span> xx:
<span style="color: #808080; font-style: italic;">#    .....</span>
<span style="color: #ff7700;font-weight:bold;">if</span> __name__ == <span style="color: #483d8b;">'__main__'</span>:
    testxx = xx<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    <span style="color: #808080; font-style: italic;">#测试代码....</span></pre></div></div>

<p>这个__name__ == &#8216;__main__&#8217;判断此文件是否被直接执行，而不是被其他文件import,所以在vim中调试时可以直接输入:!python % 执行当前正在编辑的文件,调试代码便会执行并输出结果</p>
<p>php也可以这么加调试代码,php中是这么实现的</p>

<div class="wp_syntax"><div class="code overflow"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> xx <span style="color: #009900;">&#123;</span>
<span style="color: #666666; font-style: italic;">// ......</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #666666; font-style: italic;">//确定当前被执行的文件就是自己,而不是被其他php文件包含</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">realpath</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'SCRIPT_FILENAME'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #009900; font-weight: bold;">__FILE__</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$testxx</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> xx<span style="color: #339933;">;</span>
    <span style="color: #666666; font-style: italic;">//测试代码....</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>如果仅限在命令行运行测试代码就再加个条件</p>

<div class="wp_syntax"><div class="code overflow"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">php_sapi_name</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'cli'</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">realpath</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'SCRIPT_FILENAME'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #009900; font-weight: bold;">__FILE__</span><span style="color: #009900;">&#41;</span></pre></div></div>

<p>为了更速度，vim配置里添加了一个快捷键F5</p>

<div class="wp_syntax"><div class="code overflow"><pre class="vim" style="font-family:monospace;"><span style="color: #adadad; font-style: italic;">&quot;php和python调试快捷键</span>
au FileType php <span style="color: #25BB4D;">map</span> <span style="color: #000000;">&lt;</span>F5<span style="color: #000000;">&gt;</span> <span style="color: #000000;">:</span><span style="color: #804040;">call</span> DebugRun<span style="color: #000000;">&#40;</span><span style="color: #C5A22D;">'php'</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&lt;</span>cr<span style="color: #000000;">&gt;</span>
au FileType php imap <span style="color: #000000;">&lt;</span>F5<span style="color: #000000;">&gt;</span> <span style="color: #000000;">&lt;</span>Esc<span style="color: #000000;">&gt;:</span><span style="color: #804040;">call</span> DebugRun<span style="color: #000000;">&#40;</span><span style="color: #C5A22D;">'php'</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&lt;</span>cr<span style="color: #000000;">&gt;</span>
au FileType python <span style="color: #25BB4D;">map</span> <span style="color: #000000;">&lt;</span>F5<span style="color: #000000;">&gt;</span> <span style="color: #000000;">:</span><span style="color: #804040;">call</span> DebugRun<span style="color: #000000;">&#40;</span><span style="color: #C5A22D;">'python'</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&lt;</span>cr<span style="color: #000000;">&gt;</span>
au FileType python imap <span style="color: #000000;">&lt;</span>F5<span style="color: #000000;">&gt;</span> <span style="color: #000000;">&lt;</span>Esc<span style="color: #000000;">&gt;:</span><span style="color: #804040;">call</span> DebugRun<span style="color: #000000;">&#40;</span><span style="color: #C5A22D;">'python'</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&lt;</span>cr<span style="color: #000000;">&gt;</span>
<span style="color: #804040;">function</span> DebugRun<span style="color: #000000;">&#40;</span>cmd<span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">:</span>w
    <span style="color: #804040;">execute</span> <span style="color: #C5A22D;">'!'</span> <span style="color: #000000;">.</span> a<span style="color: #000000;">:</span>cmd <span style="color: #000000;">.</span> <span style="color: #C5A22D;">' %'</span>
endfunction</pre></div></div>

<p>OK,写完调试代码按下F5立刻有结果。</p>
<p>&#8212;&#8212;&#8212;&#8211;<br />
post by gmail~</p>
]]></content:encoded>
			<wfw:commentRss>http://bluehua.org/2010/07/28/1407.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>相对完美的设计思路~</title>
		<link>http://bluehua.org/2010/07/22/1394.html</link>
		<comments>http://bluehua.org/2010/07/22/1394.html#comments</comments>
		<pubDate>Wed, 21 Jul 2010 16:27:31 +0000</pubDate>
		<dc:creator>小鹿</dc:creator>
				<category><![CDATA[web dev]]></category>
		<category><![CDATA[all in one]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[web.py]]></category>

		<guid isPermaLink="false">http://bluehua.org/2010/07/22/1394.html</guid>
		<description><![CDATA[有没有可能写一套代码适应以下三种情况:
1. 客户端没有开启javascript，或者使用ucweb一类的弱智浏览器访问时，功能没有影响
2. 客户端开启了javascript，每个页面都有单独加载的js,但是禁用ajax,只帮助用户交互
3. 客户端开启了javascript，为了提高载入速度，尽量使所有操作用ajax完成
略有所得: http://www.blogo2.com
源代码: http://code-of-emptyhua.googlecode.com/svn/trunk/blogo2
没有禁用js的时候，页面切换，表单提交（注册和登录没有用）尽量的使用ajax，而且部分操作会使用弹层(登录后的管理),禁用js之后，则所有操作换成普通表单提交在页面之间跳来跳去。。
还有一个功能没有开启，就是可以选择不用ajax，但是独立开的页面js依然有效。
有兴趣的同学可以check源代码，这种模式的实现:
1. 开发的时候禁用ajax，单个页面开发，而且要求禁用js时业务可以走通，页面内的js和css统一由模板引入。
2. 对需要开启ajax的链接增加hook，例如data-ajax=&#8221;dialog:{}&#8221;,则表明在开启ajax模式后，点击这个链接需要弹窗
3. ajax模式下只需要对单个页面更换特有的模板，动态加载需要的js和css即可。
这种设计的特点:
1. 尽量一个人包前后端。。
2. json不潮了，ajax返回html代码，优点是js不用套页面了，缺点是流量大
over，虽然没有完美的代码，但是我尽量~
&#8212;&#8212;&#8212;&#8211;
post by gmail~
]]></description>
			<content:encoded><![CDATA[<p>有没有可能写一套代码适应以下三种情况:<br />
1. 客户端没有开启javascript，或者使用ucweb一类的弱智浏览器访问时，功能没有影响<br />
2. 客户端开启了javascript，每个页面都有单独加载的js,但是禁用ajax,只帮助用户交互<br />
3. 客户端开启了javascript，为了提高载入速度，尽量使所有操作用ajax完成</p>
<p>略有所得: <a href="http://www.blogo2.com">http://www.blogo2.com</a><br />
源代码: <a href="http://code-of-emptyhua.googlecode.com/svn/trunk/blogo2">http://code-of-emptyhua.googlecode.com/svn/trunk/blogo2</a></p>
<p>没有禁用js的时候，页面切换，表单提交（注册和登录没有用）尽量的使用ajax，而且部分操作会使用弹层(登录后的管理),禁用js之后，则所有操作换成普通表单提交在页面之间跳来跳去。。</p>
<p>还有一个功能没有开启，就是可以选择不用ajax，但是独立开的页面js依然有效。</p>
<p>有兴趣的同学可以check源代码，这种模式的实现:<br />
1. 开发的时候禁用ajax，单个页面开发，而且要求禁用js时业务可以走通，页面内的js和css统一由模板引入。<br />
2. 对需要开启ajax的链接增加hook，例如data-ajax=&#8221;dialog:{}&#8221;,则表明在开启ajax模式后，点击这个链接需要弹窗<br />
3. ajax模式下只需要对单个页面更换特有的模板，动态加载需要的js和css即可。</p>
<p>这种设计的特点:<br />
1. 尽量一个人包前后端。。<br />
2. json不潮了，ajax返回html代码，优点是js不用套页面了，缺点是流量大</p>
<p>over，虽然没有完美的代码，但是我尽量~</p>
<p>&#8212;&#8212;&#8212;&#8211;<br />
post by gmail~</p>
]]></content:encoded>
			<wfw:commentRss>http://bluehua.org/2010/07/22/1394.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>以后这么写日志:)</title>
		<link>http://bluehua.org/2010/07/21/1393.html</link>
		<comments>http://bluehua.org/2010/07/21/1393.html#comments</comments>
		<pubDate>Wed, 21 Jul 2010 14:02:48 +0000</pubDate>
		<dc:creator>小鹿</dc:creator>
				<category><![CDATA[未分类]]></category>
		<category><![CDATA[screenshot]]></category>

		<guid isPermaLink="false">http://bluehua.org/2010/07/21/1393.html</guid>
		<description><![CDATA[最快最稳定~

&#8212;&#8212;&#8212;&#8211;
post by gmail~
]]></description>
			<content:encoded><![CDATA[<p>最快最稳定~</p>
<p><img src="http://bluehua.org/wp-content/uploads/2010/07/screenshot_083_small.png" alt="screenshot_083_small.png" title="screenshot_083_small.png"/></p>
<p>&#8212;&#8212;&#8212;&#8211;<br />
post by gmail~</p>
]]></content:encoded>
			<wfw:commentRss>http://bluehua.org/2010/07/21/1393.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic page generated in 0.719 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2010-09-03 13:35:22 -->
