<?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>Kylexlau&#039;s Weblog</title>
	<atom:link href="http://www.xlau.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.xlau.org</link>
	<description></description>
	<lastBuildDate>Sun, 01 Aug 2010 02:35:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>为什么写博客</title>
		<link>http://www.xlau.org/2010/08/334/</link>
		<comments>http://www.xlau.org/2010/08/334/#comments</comments>
		<pubDate>Sun, 01 Aug 2010 02:35:26 +0000</pubDate>
		<dc:creator>kyle</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.xlau.org/?p=334</guid>
		<description><![CDATA[昨天读了一篇文章，说即使没有读者，你也应该写博客。 其实重要的不是博客，重要的是写。写作的好处很多。作者谈到两点，写作让人更会阅读，写作让人更聪明。 作者说他喜欢 Paul Graham 和 Bradford Cross。我也喜欢Paul的文章，尽管读的不多。Bradford 我没听说过，但过去看下他的关于页面，就知道我肯定喜欢了，马上加到Google Reader去。他谈到两者的写作风格，当然都是很好的风格，可那是英文的写作风格。 写作让人更聪明。我很长一段时间没有写任何东西了，我觉得我的智商在降低。虽然我每天都读很多博客文章，但我不再读书了。我的脑袋成了别人的跑马场，且跑的是劣马。我不会思考，没有思想了。 写作能强迫你思考。当我想写某个主题时，我会先对它做比较深入的思考和研究。对一个主题，只是阅读，和阅读，做笔记，然后写自己的心得，后者肯定能让你掌握得更加深入。 最后，他说，You should write because writing makes you a better person.]]></description>
			<content:encoded><![CDATA[<p>昨天读了<a href="http://nathanmarz.com/blog/you-should-blog-even-if-you-have-no-readers.html">一篇文章</a>，说即使没有读者，你也应该写博客。</p>
<p>其实重要的不是博客，重要的是写。写作的好处很多。作者谈到两点，写作让人更会阅读，写作让人更聪明。</p>
<p>作者说他喜欢 Paul Graham 和 Bradford Cross。我也喜欢Paul的文章，尽管读的不多。Bradford 我没听说过，但过去看下他的关于页面，就知道我肯定喜欢了，马上加到Google Reader去。他谈到两者的写作风格，当然都是很好的风格，可那是英文的写作风格。</p>
<p>写作让人更聪明。我很长一段时间没有写任何东西了，我觉得我的智商在降低。虽然我每天都读很多博客文章，但我不再读书了。我的脑袋成了别人的跑马场，且跑的是劣马。我不会思考，没有思想了。</p>
<p>写作能强迫你思考。当我想写某个主题时，我会先对它做比较深入的思考和研究。对一个主题，只是阅读，和阅读，做笔记，然后写自己的心得，后者肯定能让你掌握得更加深入。</p>
<p>最后，他说，You should write because writing makes you a better person.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xlau.org/2010/08/334/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Emacs 简单脚本</title>
		<link>http://www.xlau.org/2009/01/319/</link>
		<comments>http://www.xlau.org/2009/01/319/#comments</comments>
		<pubDate>Tue, 20 Jan 2009 18:49:49 +0000</pubDate>
		<dc:creator></dc:creator>
		
		<guid isPermaLink="false">http://www.xlau.org/post/319</guid>
		<description><![CDATA[#!/usr/local/bin/emacs --script ;;; emacs-script.el --- a simple emacs lisp script &#160; ;;; Commentary: ;; #!（shebang），从 Emacs 22 开始支持。这让 Emacs 也可以用来写类似 ;; Bash 的脚本。处理文本文件，用 Emacs Lisp 脚本，应该是很强大的。当 ;; 然，据说 perl 才是文本处理之王，但作为一个编辑器，Emacs 在文本处理上 ;; 也有其优势的。 &#160; ;; 一个简单例子，可以处理命令行参数。 ;; 打开一个文件，进行一些文本处理，然后保存。 &#160; ;;; &#8230; <a href="http://www.xlau.org/2009/01/319/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="lisp" style="font-family:monospace;">#<span style="color: #66cc66;">!</span>/usr/local/bin/emacs --script
<span style="color: #808080; font-style: italic;">;;; emacs-script.el --- a simple emacs lisp script</span>
&nbsp;
<span style="color: #808080; font-style: italic;">;;; Commentary:</span>
<span style="color: #808080; font-style: italic;">;; #!（shebang），从 Emacs 22 开始支持。这让 Emacs 也可以用来写类似</span>
<span style="color: #808080; font-style: italic;">;; Bash 的脚本。处理文本文件，用 Emacs Lisp 脚本，应该是很强大的。当</span>
<span style="color: #808080; font-style: italic;">;; 然，据说 perl 才是文本处理之王，但作为一个编辑器，Emacs 在文本处理上</span>
<span style="color: #808080; font-style: italic;">;; 也有其优势的。</span>
&nbsp;
<span style="color: #808080; font-style: italic;">;; 一个简单例子，可以处理命令行参数。</span>
<span style="color: #808080; font-style: italic;">;; 打开一个文件，进行一些文本处理，然后保存。</span>
&nbsp;
<span style="color: #808080; font-style: italic;">;;; Code:</span>
<span style="color: #808080; font-style: italic;">;; handle command line arguments</span>
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>/<span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">1</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">length</span> command-line-args-left<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">and</span> <span style="color: #66cc66;">&#40;</span>print <span style="color: #ff0000;">&quot;just need one argument for filename&quot;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#40;</span>kill-emacs <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">setq</span> filename command-line-args-left<span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">;; open the file</span>
<span style="color: #66cc66;">&#40;</span>find-file <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">car</span> filename<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">;; processing it</span>
<span style="color: #808080; font-style: italic;">;; indenting</span>
<span style="color: #66cc66;">&#40;</span>indent-region <span style="color: #66cc66;">&#40;</span>point-<span style="color: #b1b100;">min</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#40;</span>point-<span style="color: #b1b100;">max</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">;; filling</span>
<span style="color: #808080; font-style: italic;">;; (fill-region (point-min) (point-max))</span>
&nbsp;
<span style="color: #808080; font-style: italic;">;; trailing white space</span>
<span style="color: #66cc66;">&#40;</span>delete-trailing-whitespace<span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">;; save the file</span>
<span style="color: #66cc66;">&#40;</span>save-buffer<span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">;;; emacs-script.el ends here</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.xlau.org/2009/01/319/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Read command-line arguments with Perl</title>
		<link>http://www.xlau.org/2009/01/318/</link>
		<comments>http://www.xlau.org/2009/01/318/#comments</comments>
		<pubDate>Fri, 09 Jan 2009 08:09:57 +0000</pubDate>
		<dc:creator></dc:creator>
		
		<guid isPermaLink="false">http://www.xlau.org/post/318</guid>
		<description><![CDATA[#!/usr/bin/perl -w use feature ':5.10'; use strict; use warnings; &#160; # How do I read command-line arguments with Perl? &#160; # http://perldoc.perl.org/perlvar.html # The array @ARGV contains the command-line arguments intended for the script. # $#ARGV is generally the number &#8230; <a href="http://www.xlau.org/2009/01/318/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/usr/bin/perl -w</span>
<span style="color: #000000; font-weight: bold;">use</span> feature <span style="color: #ff0000;">':5.10'</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">use</span> strict<span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">use</span> warnings<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># How do I read command-line arguments with Perl?</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># http://perldoc.perl.org/perlvar.html</span>
<span style="color: #666666; font-style: italic;"># The array @ARGV contains the command-line arguments intended for the script.</span>
<span style="color: #666666; font-style: italic;"># $#ARGV is generally the number of arguments minus one, because $ARGV[0] is</span>
<span style="color: #666666; font-style: italic;"># the first argument, not the program's command name itself. See $0 for the</span>
<span style="color: #666666; font-style: italic;"># command name.</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># $0, script file name.</span>
<span style="color: #666666; font-style: italic;"># @ARGV </span>
<span style="color: #666666; font-style: italic;"># $ARGV[0] .. $ARGV[9]</span>
<span style="color: #666666; font-style: italic;"># $#ARGV, the last argment's subscript</span>
<span style="color: #666666; font-style: italic;"># $#ARGV+1, the total </span>
&nbsp;
&nbsp;
say <span style="color: #0000ff;">$0</span><span style="color: #339933;">;</span>
say <span style="color: #0000ff;">@ARGV</span><span style="color: #339933;">;</span>
say <span style="color: #0000ff;">$#ARGV</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$numArgs</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$#ARGV</span> <span style="color: #339933;">+</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
&nbsp;
say <span style="color: #ff0000;">&quot;you gave me $numArgs command-line arguments.&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">for</span> <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$subscript</span> <span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span> <span style="color: #339933;">..</span> <span style="color: #0000ff;">$#ARGV</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	say <span style="color: #ff0000;">&quot;$ARGV[$subscript]&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># @INC is include paths.</span>
<span style="color: #666666; font-style: italic;"># say @INC;</span>
<span style="color: #b1b100;">for</span> <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$inc</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">@INC</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	say <span style="color: #0000ff;">$inc</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># %ENV is the enviroment.</span>
<span style="color: #666666; font-style: italic;"># say %ENV;</span>
<span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$key</span><span style="color: #339933;">,</span> <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$value</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> <span style="color: #000066;">each</span> <span style="color: #0000ff;">%ENV</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	say <span style="color: #ff0000;">&quot;$key=$value&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.xlau.org/2009/01/318/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>heredoc</title>
		<link>http://www.xlau.org/2008/12/316/</link>
		<comments>http://www.xlau.org/2008/12/316/#comments</comments>
		<pubDate>Sun, 28 Dec 2008 16:29:26 +0000</pubDate>
		<dc:creator></dc:creator>
		
		<guid isPermaLink="false">http://www.xlau.org/?p=316</guid>
		<description><![CDATA[Almost all scripting languages support heredoc, include bash, perl, python, ruby, php and tcl, and more. Bash]]></description>
			<content:encoded><![CDATA[<p>Almost all scripting languages support heredoc, include bash, perl, python, ruby, php and tcl, and more.</p>
<h3> Bash </h3>
<p><< and delimiting identifer like EOF.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #cc0000; font-style: italic;">&lt;&lt;EOF
working dir is $PWD
working dir is `pwd`
EOF</span></pre></div></div>

<p>Output:</p>

<div class="wp_syntax"><div class="code"><pre class="abc" style="font-family:monospace;">working dir is /home/user
working dir is /home/user</pre></div></div>

<p>By default, variables and commands in backticks are evaluated. This can disabledby setting the label in the command line in single or double quotes:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">&lt;&lt;</span><span style="color: #ff0000;">&quot;EOF&quot;</span>
working <span style="color: #c20cb9; font-weight: bold;">dir</span> is <span style="color: #007800;">$PWD</span>
working <span style="color: #c20cb9; font-weight: bold;">dir</span> is <span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">pwd</span><span style="color: #000000; font-weight: bold;">`</span>
EOF
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #cc0000; font-style: italic;">&lt;&lt;'EOF'
working dir is $PWD
working dir is `pwd`
EOF</span></pre></div></div>

<p>Output:</p>

<div class="wp_syntax"><div class="code"><pre class="abc" style="font-family:monospace;">working dir is $PWD
working dir is `pwd`
working dir is $PWD
working dir is `pwd`</pre></div></div>

</pre>
<h3> Perl </h3>
<p>Like Bash, and using double quotes around the tag allows variables to be interpolated, using single quotes doesn't and using the tag without either behaves like double quotes.</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #b1b100;">my</span> var<span style="color: #339933;">=</span><span style="color: #ff0000;">&quot;World&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># without quotes</span>
<span style="color: #000066;">print</span> <span style="color: #cc0000; font-style: italic;">&lt;&lt;EOF;
Hello $var
EOF</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># double quotes</span>
<span style="color: #000066;">print</span> <span style="color: #cc0000; font-style: italic;">&lt;&lt;&quot;EOF&quot;;
Hello $var
EOF</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#single qutoes:</span>
<span style="color: #000066;">print</span> <span style="color: #cc0000; font-style: italic;">&lt;&lt;EOF;
Hello $var
EOF</span></pre></div></div>

<p>The output:</p>

<div class="wp_syntax"><div class="code"><pre class="abc" style="font-family:monospace;">Hello World
Hello World
Hello $var</pre></div></div>

<h3> Python </h3>
<p>Python supports heredocs delimited by single or double quotes repeated three times (i.e. ''' or """).</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">var = <span style="color: #483d8b;">'World'</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">print</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;&quot;&quot;
Hello %(var)s
&quot;&quot;&quot;</span> <span style="color: #66cc66;">%</span> <span style="color: #008000;">locals</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">print</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">''</span><span style="color: #483d8b;">'
Hello %(var)s
'</span><span style="color: #483d8b;">''</span> <span style="color: #66cc66;">%</span> <span style="color: #008000;">locals</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span></pre></div></div>

<p>Output:</p>

<div class="wp_syntax"><div class="code"><pre class="abc" style="font-family:monospace;">Hello World
Hello World</pre></div></div>

<h3> Ruby </h3>
<p>Ruby's grammer is from Bash and Perl.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">now = <span style="color:#CC00FF; font-weight:bold;">Time</span>.<span style="color:#9900CC;">now</span>
&nbsp;
<span style="color:#CC0066; font-weight:bold;">puts</span> <span style="color:#006600; font-weight:bold;">&lt;&lt;</span>EOF
Hello <span style="color:#008000; font-style:italic;">#{now.hour}</span>
EOF
&nbsp;
<span style="color:#CC0066; font-weight:bold;">puts</span> <span style="color:#006600; font-weight:bold;">&lt;&lt;</span><span style="color:#996600;">&quot;EOF&quot;</span>
Hello <span style="color:#008000; font-style:italic;">#{now.hour}</span>
EOF
&nbsp;
<span style="color:#CC0066; font-weight:bold;">puts</span> <span style="color:#006600; font-weight:bold;">&lt;&lt;</span><span style="color:#996600;">'EOF'</span>
Hello <span style="color:#008000; font-style:italic;">#{now.hour}</span>
EOF</pre></div></div>

<p>Output:</p>

<div class="wp_syntax"><div class="code"><pre class="abc" style="font-family:monospace;">Hello World
Hello World
Hello #{now.hour}</pre></div></div>

<h3> PHP </h3>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #339933;">=</span> World<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// heredoc</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000cc; font-style: italic;">&lt;&lt;&lt;EOF
Hello $var
EOF</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// nowdoc, need php 5.3</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000cc; font-style: italic;">&lt;&lt;&lt;'EOF'
Hello $var
EOF</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Output:</p>

<div class="wp_syntax"><div class="code"><pre class="abc" style="font-family:monospace;">Hello World
Hello $var</pre></div></div>

<h3> Tcl </h3>
<p>Tcl's ordinary string syntaxes already allow embedded newlines and preserve indentation.</p>

<div class="wp_syntax"><div class="code"><pre class="tcl" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">set</span> var <span style="color: #483d8b;">&quot;World&quot;</span>
&nbsp;
<span style="color: #008000;">puts</span> <span style="color: #483d8b;">&quot;
Hello $var
&quot;</span>
&nbsp;
<span style="color: #008000;">puts</span> <span style="color: black;">&#123;</span>
Hello <span style="color: #ff3333;">$var</span>
<span style="color: black;">&#125;</span></pre></div></div>

<p>Output:</p>

<div class="wp_syntax"><div class="code"><pre class="abc" style="font-family:monospace;">Hello World
Hello $var</pre></div></div>

<h3>References</h3>
<p><a href="http://en.wikipedia.org/wiki/Heredoc">http://en.wikipedia.org/wiki/Heredoc</a><br />
<a href="http://php.net/manual/en/language.types.string.php"> http://php.net/manual/en/language.types.string.php</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.xlau.org/2008/12/316/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>git svn</title>
		<link>http://www.xlau.org/2008/12/315/</link>
		<comments>http://www.xlau.org/2008/12/315/#comments</comments>
		<pubDate>Sun, 28 Dec 2008 07:13:18 +0000</pubDate>
		<dc:creator></dc:creator>
		
		<guid isPermaLink="false">http://www.xlau.org/?p=315</guid>
		<description><![CDATA[svn with git. 1 Import $ git svn clone --username yourname -T trunk -s https://u-prj.googlecode.com/svn 2 Develop $ git add/rm FILE $ git commit -a $ git reset --hard HEAD^ $ git checkout HEAD~5 FILE 3 Update $ git svn &#8230; <a href="http://www.xlau.org/2008/12/315/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>svn with git.</p>
<p>1 Import</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ git <span style="color: #c20cb9; font-weight: bold;">svn</span> clone <span style="color: #660033;">--username</span> yourname <span style="color: #660033;">-T</span> trunk <span style="color: #660033;">-s</span> https:<span style="color: #000000; font-weight: bold;">//</span>u-prj.googlecode.com<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">svn</span></pre></div></div>

<p>2 Develop</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ git add<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">rm</span> FILE
$ git commit <span style="color: #660033;">-a</span>
$ git reset <span style="color: #660033;">--hard</span> HEAD^
$ git checkout HEAD~<span style="color: #000000;">5</span> FILE</pre></div></div>

<p>3 Update</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ git <span style="color: #c20cb9; font-weight: bold;">svn</span> rebase <span style="color: #666666; font-style: italic;"># svn update</span></pre></div></div>

<p>4 Export</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ git <span style="color: #c20cb9; font-weight: bold;">svn</span> dcommint <span style="color: #666666; font-style: italic;"># svn commit</span></pre></div></div>

<p><a href="http://google-opensource.blogspot.com/2008/05/develop-with-git-on-google-code-project.html"> src </a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.xlau.org/2008/12/315/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>15 Exercises</title>
		<link>http://www.xlau.org/2008/12/314/</link>
		<comments>http://www.xlau.org/2008/12/314/#comments</comments>
		<pubDate>Sat, 27 Dec 2008 07:15:55 +0000</pubDate>
		<dc:creator></dc:creator>
		
		<guid isPermaLink="false">http://www.xlau.org/?p=314</guid>
		<description><![CDATA[往后学习一门新语言时，做做下面15个练习。当然，如果是编程语言，之前要知道如何编译与运行源程序；如果是脚本语言，首先要知道如何运行它。至于IDE，vim和emacs都是最好的IDE了。 不需要读完整个手册，才能开始写程序，读个十来页，知道基本了，就找个refcard，然后参照refcard开始做下面的练习。 (1) Display series of numbers (1,2,3,4, 5&#8230;.etc) in an infinite loop. The program should quit if someone hits a specific key (Say ESCAPE key). (2) Fibonacci series, swapping two variables, finding maximum/minimum among a list of numbers. (3) &#8230; <a href="http://www.xlau.org/2008/12/314/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>往后学习一门新语言时，做做下面15个练习。当然，如果是编程语言，之前要知道如何编译与运行源程序；如果是脚本语言，首先要知道如何运行它。至于IDE，vim和emacs都是最好的IDE了。</p>
<p>不需要读完整个手册，才能开始写程序，读个十来页，知道基本了，就找个refcard，然后参照refcard开始做下面的练习。</p>
<blockquote><p>
(1) Display series of numbers (1,2,3,4, 5&#8230;.etc) in an infinite loop. The program should quit if someone hits a specific key (Say ESCAPE key).</p>
<p>(2) Fibonacci series, swapping two variables, finding maximum/minimum among a list of numbers.</p>
<p>(3) Accepting series of numbers, strings from keyboard and sorting them ascending, descending order.</p>
<p>(4) Reynolds number is calculated using formula (D*v*rho)/mu Where D = Diameter, V= velocity, rho = density mu = viscosity</p>
<p>Write a program that will accept all values in appropriate units (Don&#8217;t worry about unit conversion) </p>
<p>If number is < 2100, display Laminar flow,<br />
If it.s between 2100 and 4000 display 'Transient flow' and<br />
if more than '4000', display 'Turbulent Flow' (If, else, then...)</p>
<p>(5) Modify the above program such that it will ask for 'Do you want to calculate again (y/n), if you say 'y', it'll again ask the parameters. If 'n', it'll exit. (Do while loop)</p>
<p>While running the program give value mu = 0. See what happens. Does it give 'DIVIDE BY ZERO' error?  Does it give 'Segmentation fault..core dump?'. How to handle this situation. Is there something built in the language itself? (Exception Handling)</p>
<p>(6) Scientific calculator supporting addition, subtraction, multiplication, division, square-root, square, cube, sin, cos, tan, Factorial, inverse, modulus</p>
<p>(7) Printing output in different formats (say rounding up to 5 decimal places, truncating after 4 decimal places, padding zeros to the right and left, right and left justification)(Input output operations)</p>
<p>(8) Open a text file and convert it into HTML file. (File operations/Strings)</p>
<p>(9) Time and Date : Get system time and convert it in different formats 'DD-MON-YYYY', 'mm-dd-yyyy', 'dd/mm/yy' etc.</p>
<p>(10) Create files with date and time stamp appended to the name</p>
<p>(11) Input is HTML table, Remove all tags and put data in a comma/tab separated file.</p>
<p>(12) Extract uppercase words from a file, extract unique words</p>
<p>(13) Implement word wrapping feature (Observe how word wrap works in windows 'notepad')</p>
<p>(14) Adding/removing items in the beginning, middle and end of the array.</p>
<p>(15) Are these features supported by your language: Operator overloading, virtual functions, references, pointers etc.
</p></blockquote>
<p><a href="http://www.jobsnake.com/seek/articles/index.cgi?openarticle&#038;8533">原文</a>和<a href="http://www.yeeyan.com/articles/view/38585/19790">中文</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.xlau.org/2008/12/314/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>收到OpenSolaris 2008.11光盘</title>
		<link>http://www.xlau.org/2008/12/313/</link>
		<comments>http://www.xlau.org/2008/12/313/#comments</comments>
		<pubDate>Fri, 26 Dec 2008 05:55:35 +0000</pubDate>
		<dc:creator></dc:creator>
		
		<guid isPermaLink="false">http://www.xlau.org/?p=313</guid>
		<description><![CDATA[OpenSolaris 2008.11 在2008年12月1日才正式发布，我12月24号收到unix-center从北京挂号邮寄过来的光盘。 马上进livecd里玩了下，很是喜欢。它是unix系的，跟linux的目录结构不大相同。又因为它是SUN家的，Java环境有预装，GNU工具都在一个目录下。 我喜欢的是*nix系统，不仅仅是Linux，更不仅仅是Ubuntu。Ubuntu是Linux几百个发行版中最流行一个，Linux是数十种*nix系统中最流行的一个。目前为止，我还只用Linux系统做桌面，服务器端用过FreeBSD，Unix-Center里体验过Solaris 10。 OpenSolaris有而Linux无的特性，最重要的三个是ZFS、DTrace、SMF。ZFS和DTrace，我闻大名久矣。SMF(Service Management Facility)是一种管理*nix下服务的创新技术，似乎也很不错。 经常有用户错误地认为Unix-Center.Net是一个Sun 公司的平台。事实上，Unix-Center.Net完全是我个人创建网站，包括服务器、机柜和带宽等等运营费用都是我个人支付的。由于我在Sun 公司工作的关系，目前Unix-Center.Net的内容偏向于Sun 公司的产品和技术。出于同样的理由，Unix-Center.Net有一些针对Sun 公司产品和技术的推广活动。我欢迎任何单位和个人在Unix-Center.Net这个平台上提供与其他Unix/Linux相关内容。 从这里看到，unix-center.net竟然不是sun的,而是蒋清野个人提供的服务，令人不敢相信。一直以为是sun的，但鉴于蒋是sun的雇员，uc跟sun关系仍是非常密切的。]]></description>
			<content:encoded><![CDATA[<p>OpenSolaris 2008.11 在2008年12月1日才正式发布，我12月24号收到unix-center从北京挂号邮寄过来的光盘。</p>
<p>马上进livecd里玩了下，很是喜欢。它是unix系的，跟linux的目录结构不大相同。又因为它是SUN家的，Java环境有预装，GNU工具都在一个目录下。</p>
<p>我喜欢的是*nix系统，不仅仅是Linux，更不仅仅是Ubuntu。Ubuntu是Linux几百个发行版中最流行一个，Linux是数十种*nix系统中最流行的一个。目前为止，我还只用Linux系统做桌面，服务器端用过FreeBSD，Unix-Center里体验过Solaris 10。</p>
<p>OpenSolaris有而Linux无的特性，最重要的三个是ZFS、DTrace、SMF。ZFS和DTrace，我闻大名久矣。SMF(Service Management Facility)是一种管理*nix下服务的创新技术，似乎也很不错。</p>
<blockquote><p>
经常有用户错误地认为Unix-Center.Net是一个Sun 公司的平台。事实上，Unix-Center.Net完全是我个人创建网站，包括服务器、机柜和带宽等等运营费用都是我个人支付的。由于我在Sun 公司工作的关系，目前Unix-Center.Net的内容偏向于Sun 公司的产品和技术。出于同样的理由，Unix-Center.Net有一些针对Sun 公司产品和技术的推广活动。我欢迎任何单位和个人在Unix-Center.Net这个平台上提供与其他Unix/Linux相关内容。
</p></blockquote>
<p>从<a href="http://auction1.taobao.com/auction/item_detail-0db2-41beb3114e6a958f202d81ab99cdbf05.jhtml">这里</a>看到，unix-center.net竟然不是sun的,而是<a href="http://www.qyjohn.net">蒋清野</a>个人提供的服务，令人不敢相信。一直以为是sun的，但鉴于蒋是sun的雇员，uc跟sun关系仍是非常密切的。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xlau.org/2008/12/313/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bash Special Parameters</title>
		<link>http://www.xlau.org/2008/12/312/</link>
		<comments>http://www.xlau.org/2008/12/312/#comments</comments>
		<pubDate>Thu, 25 Dec 2008 10:34:26 +0000</pubDate>
		<dc:creator></dc:creator>
		
		<guid isPermaLink="false">http://www.xlau.org/?p=312</guid>
		<description><![CDATA[这些古怪的符号，其实都是有含义有规律的。弄懂它们一点都不难，只需要写点代码，运行一下就知道了。perl 的特殊变量更多，perldoc perlvar. #/bin/bash &#160; # http://www.gnu.org/software/bash/manual/html_node/Special-Parameters.html &#160; # run it like # ./spec_para.sh 1 2 3 &#160; # Parameters echo $_ # absolute pathname echo $0 # ./spec_para.sh echo $1 # 1 echo $2 # 2 echo $3 # &#8230; <a href="http://www.xlau.org/2008/12/312/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>这些古怪的符号，其实都是有含义有规律的。弄懂它们一点都不难，只需要写点代码，运行一下就知道了。perl 的特殊变量更多，perldoc perlvar.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#/bin/bash</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># http://www.gnu.org/software/bash/manual/html_node/Special-Parameters.html</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># run it like </span>
<span style="color: #666666; font-style: italic;"># ./spec_para.sh 1 2 3</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Parameters</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$_</span> <span style="color: #666666; font-style: italic;"># absolute pathname</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> $<span style="color: #000000;">0</span> <span style="color: #666666; font-style: italic;"># ./spec_para.sh</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> $<span style="color: #000000;">1</span> <span style="color: #666666; font-style: italic;"># 1</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> $<span style="color: #000000;">2</span> <span style="color: #666666; font-style: italic;"># 2</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> $<span style="color: #000000;">3</span> <span style="color: #666666; font-style: italic;"># 3</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># $* and $@ is differents</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> $<span style="color: #000000; font-weight: bold;">@</span> <span style="color: #666666; font-style: italic;"># 1 2 3 (&quot;$1&quot; &quot;$2&quot; &quot;$3&quot;)</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$*</span> <span style="color: #666666; font-style: italic;"># 1 2 3 (&quot;$1c$2c$3&quot;)</span>
<span style="color: #666666; font-style: italic;"># c is the first character of the value of the IFS variable. If IFS is</span>
<span style="color: #666666; font-style: italic;"># unset, the parameters are separated by spaces. If IFS is null, the</span>
<span style="color: #666666; font-style: italic;"># parameters are joined without intervening separators. </span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$#</span> <span style="color: #666666; font-style: italic;"># 3 ( number of positional parameters in decimal )</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$?</span> <span style="color: #666666; font-style: italic;"># exit status of the most recently executed foreground pipeline </span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$$</span> <span style="color: #666666; font-style: italic;"># process ID of the shell</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$!</span> <span style="color: #666666; font-style: italic;"># process ID of the most recently executed background command</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$-</span> <span style="color: #666666; font-style: italic;"># current option flags</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.xlau.org/2008/12/312/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>customize ubuntu for eee pc</title>
		<link>http://www.xlau.org/2008/12/310/</link>
		<comments>http://www.xlau.org/2008/12/310/#comments</comments>
		<pubDate>Mon, 22 Dec 2008 21:13:45 +0000</pubDate>
		<dc:creator></dc:creator>
		
		<guid isPermaLink="false">http://www.xlau.org/post/310</guid>
		<description><![CDATA[# http://www.array.org/ubuntu/setup-intrepid.html # to enable wireless network, install a kernel customized for eee pc wget http://www.array.org/ubuntu/array-intrepid.list sudo mv -v array-intrepid.list /etc/apt/sources.list.d/ wget http://www.array.org/ubuntu/array-apt-key.asc sudo apt-key add array-apt-key.asc sudo apt-get update &#160; sudo apt-get install linux-eeepc linux-headers-eeepc &#160; # http://forum.eeeuser.com/viewtopic.php?id=49081 # &#8230; <a href="http://www.xlau.org/2008/12/310/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># http://www.array.org/ubuntu/setup-intrepid.html</span>
<span style="color: #666666; font-style: italic;"># to enable wireless network, install a kernel customized for eee pc</span>
<span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>www.array.org<span style="color: #000000; font-weight: bold;">/</span>ubuntu<span style="color: #000000; font-weight: bold;">/</span>array-intrepid.list
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">mv</span> <span style="color: #660033;">-v</span> array-intrepid.list <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>apt<span style="color: #000000; font-weight: bold;">/</span>sources.list.d<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>www.array.org<span style="color: #000000; font-weight: bold;">/</span>ubuntu<span style="color: #000000; font-weight: bold;">/</span>array-apt-key.asc
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-key</span> add array-apt-key.asc
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> update
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> linux-eeepc linux-headers-eeepc
&nbsp;
<span style="color: #666666; font-style: italic;"># http://forum.eeeuser.com/viewtopic.php?id=49081</span>
<span style="color: #666666; font-style: italic;"># install ACPI scipts, for wifi toggle Fn-Keys and more</span>
<span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>www.informatik.uni-bremen.de<span style="color: #000000; font-weight: bold;">/</span>~elmurato<span style="color: #000000; font-weight: bold;">/</span>EeePC<span style="color: #000000; font-weight: bold;">/</span>Intrepid_ACPI_scripts-EeePC.tar.gz
<span style="color: #c20cb9; font-weight: bold;">tar</span> xfvz Intrepid_ACPI_scripts-EeePC_900A_901_1000.tar.gz
<span style="color: #7a0874; font-weight: bold;">cd</span> Intrepid_ACPI_scripts-EeePC_900A_901_1000<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #c20cb9; font-weight: bold;">chmod</span> +x acpi-scripts.sh
<span style="color: #c20cb9; font-weight: bold;">sudo</span> .<span style="color: #000000; font-weight: bold;">/</span>acpi-scripts.sh <span style="color: #c20cb9; font-weight: bold;">install</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># https://help.ubuntu.com/community/EeePC/Using</span>
<span style="color: #666666; font-style: italic;"># font size</span>
gconftool-<span style="color: #000000;">2</span> <span style="color: #660033;">--set</span> <span style="color: #000000; font-weight: bold;">/</span>apps<span style="color: #000000; font-weight: bold;">/</span>nautilus<span style="color: #000000; font-weight: bold;">/</span>preferences<span style="color: #000000; font-weight: bold;">/</span>desktop_font <span style="color: #660033;">--type</span> string <span style="color: #ff0000;">&quot;Sans 8&quot;</span>
gconftool-<span style="color: #000000;">2</span> <span style="color: #660033;">--set</span> <span style="color: #000000; font-weight: bold;">/</span>desktop<span style="color: #000000; font-weight: bold;">/</span>gnome<span style="color: #000000; font-weight: bold;">/</span>interface<span style="color: #000000; font-weight: bold;">/</span>document_font_name <span style="color: #660033;">--type</span> string <span style="color: #ff0000;">&quot;Sans 8&quot;</span>
gconftool-<span style="color: #000000;">2</span> <span style="color: #660033;">--set</span> <span style="color: #000000; font-weight: bold;">/</span>desktop<span style="color: #000000; font-weight: bold;">/</span>gnome<span style="color: #000000; font-weight: bold;">/</span>interface<span style="color: #000000; font-weight: bold;">/</span>font_name <span style="color: #660033;">--type</span> string <span style="color: #ff0000;">&quot;Sans 8&quot;</span>
gconftool-<span style="color: #000000;">2</span> <span style="color: #660033;">--set</span> <span style="color: #000000; font-weight: bold;">/</span>apps<span style="color: #000000; font-weight: bold;">/</span>metacity<span style="color: #000000; font-weight: bold;">/</span>general<span style="color: #000000; font-weight: bold;">/</span>titlebar_font <span style="color: #660033;">--type</span> string <span style="color: #ff0000;">&quot;Sans Bold 8&quot;</span>
gconftool-<span style="color: #000000;">2</span> <span style="color: #660033;">--set</span> <span style="color: #000000; font-weight: bold;">/</span>desktop<span style="color: #000000; font-weight: bold;">/</span>gnome<span style="color: #000000; font-weight: bold;">/</span>interface<span style="color: #000000; font-weight: bold;">/</span>monospace_font_name <span style="color: #660033;">--type</span> string <span style="color: #ff0000;">&quot;Monospace 8&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># alt-f11 fullscreen</span>
gconftool-<span style="color: #000000;">2</span> <span style="color: #660033;">--set</span> <span style="color: #000000; font-weight: bold;">/</span>apps<span style="color: #000000; font-weight: bold;">/</span>metacity<span style="color: #000000; font-weight: bold;">/</span>window_keybindings<span style="color: #000000; font-weight: bold;">/</span>toggle_fullscreen <span style="color: #660033;">--type</span> string <span style="color: #ff0000;">&quot;&lt;Alt&gt;F11&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># toolbar icons</span>
gconftool-<span style="color: #000000;">2</span> <span style="color: #660033;">--set</span> <span style="color: #000000; font-weight: bold;">/</span>desktop<span style="color: #000000; font-weight: bold;">/</span>gnome<span style="color: #000000; font-weight: bold;">/</span>interface<span style="color: #000000; font-weight: bold;">/</span>toolbar_style <span style="color: #660033;">--type</span> string <span style="color: #ff0000;">&quot;icons&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># menu icons</span>
gconftool-<span style="color: #000000;">2</span> <span style="color: #660033;">--set</span> <span style="color: #000000; font-weight: bold;">/</span>desktop<span style="color: #000000; font-weight: bold;">/</span>gnome<span style="color: #000000; font-weight: bold;">/</span>interface<span style="color: #000000; font-weight: bold;">/</span>menus_have_icons <span style="color: #660033;">--type</span> bool <span style="color: #000000;">0</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># mixer mute key</span>
gconftool-<span style="color: #000000;">2</span> <span style="color: #660033;">--set</span> <span style="color: #000000; font-weight: bold;">/</span>desktop<span style="color: #000000; font-weight: bold;">/</span>gnome<span style="color: #000000; font-weight: bold;">/</span>sound<span style="color: #000000; font-weight: bold;">/</span>default_mixer_tracks <span style="color: #660033;">--type</span> list <span style="color: #660033;">--list-type</span> string <span style="color: #ff0000;">&quot;[PCM]&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># panel</span>
gconftool-<span style="color: #000000;">2</span> <span style="color: #660033;">--set</span> <span style="color: #000000; font-weight: bold;">/</span>apps<span style="color: #000000; font-weight: bold;">/</span>panel<span style="color: #000000; font-weight: bold;">/</span>toplevels<span style="color: #000000; font-weight: bold;">/</span>top_panel_screen0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">size</span> <span style="color: #660033;">--type</span> integer <span style="color: #000000;">19</span>
gconftool-<span style="color: #000000;">2</span> <span style="color: #660033;">--set</span> <span style="color: #000000; font-weight: bold;">/</span>apps<span style="color: #000000; font-weight: bold;">/</span>panel<span style="color: #000000; font-weight: bold;">/</span>toplevels<span style="color: #000000; font-weight: bold;">/</span>bottom_panel_screen0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">size</span> <span style="color: #660033;">--type</span> integer <span style="color: #000000;">19</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># battery warning</span>
gconftool-<span style="color: #000000;">2</span> <span style="color: #660033;">--set</span> <span style="color: #000000; font-weight: bold;">/</span>apps<span style="color: #000000; font-weight: bold;">/</span>gnome-power-manager<span style="color: #000000; font-weight: bold;">/</span>notify<span style="color: #000000; font-weight: bold;">/</span>low_capacity <span style="color: #660033;">--type</span> bool <span style="color: #000000;">0</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.xlau.org/2008/12/310/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>disable post revision</title>
		<link>http://www.xlau.org/2008/12/300/</link>
		<comments>http://www.xlau.org/2008/12/300/#comments</comments>
		<pubDate>Mon, 22 Dec 2008 20:54:57 +0000</pubDate>
		<dc:creator></dc:creator>
		
		<guid isPermaLink="false">http://www.xlau.org/?p=300</guid>
		<description><![CDATA[I hate wordpress&#8217; post revision feature, its only function is to waste my database storage. Every time I save or modify a post, it&#8217;ll store a full copy of that post to my database. I don&#8217;t know why need to &#8230; <a href="http://www.xlau.org/2008/12/300/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I hate wordpress&#8217; post revision feature, its only function is to waste my database storage. Every time I save or modify a post, it&#8217;ll store a full copy of that post to my database. I don&#8217;t know why need to do that,  that&#8217;s a personal blog, not a wiki. The funny thing is that I can&#8217;t find a option in admin dashboard to disable it, the writer of wordpress maybe think everybody need that feature, they are wrong!</p>
<p>Find a way to disable it, <a href="http://wordpress.org/support/topic/175886">http://wordpress.org/support/topic/175886</a>.</p>
<p>adding to wp-config:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">define</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'WP_POST_REVISIONS'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  <span style="color: #666666; font-style: italic;">// disable post revisions feature</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'AUTOSAVE_INTERVAL'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">600</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// auto save interval time</span></pre></div></div>

<p>or install a plugin:<br />
<a href="http://exper.3drecursions.com/2008/07/25/disable-revisions-and-autosave-plugin/">http://exper.3drecursions.com/2008/07/25/disable-revisions-and-autosave-plugin/</a></p>
<p>clean-up SQL:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #808080; font-style: italic;"># can't delete wp_postmeta and wp_term_relationships table</span>
<span style="color: #993333; font-weight: bold;">DELETE</span> <span style="color: #993333; font-weight: bold;">FROM</span> wp<span style="color: #66cc66;">-</span>posts <span style="color: #993333; font-weight: bold;">WHERE</span> post_type<span style="color: #66cc66;">=</span><span style="color: #ff0000;">'revision'</span>;
&nbsp;
<span style="color: #808080; font-style: italic;"># delete all post revision data</span>
<span style="color: #993333; font-weight: bold;">DELETE</span> a<span style="color: #66cc66;">,</span>b<span style="color: #66cc66;">,</span>c  
<span style="color: #993333; font-weight: bold;">FROM</span> wp_posts a  
<span style="color: #993333; font-weight: bold;">LEFT</span> <span style="color: #993333; font-weight: bold;">JOIN</span> wp_term_relationships b <span style="color: #993333; font-weight: bold;">ON</span> <span style="color: #66cc66;">&#40;</span>a<span style="color: #66cc66;">.</span>ID <span style="color: #66cc66;">=</span> b<span style="color: #66cc66;">.</span>object_id<span style="color: #66cc66;">&#41;</span>  
<span style="color: #993333; font-weight: bold;">LEFT</span> <span style="color: #993333; font-weight: bold;">JOIN</span> wp_postmeta c <span style="color: #993333; font-weight: bold;">ON</span> <span style="color: #66cc66;">&#40;</span>a<span style="color: #66cc66;">.</span>ID <span style="color: #66cc66;">=</span> c<span style="color: #66cc66;">.</span>post_id<span style="color: #66cc66;">&#41;</span>  
<span style="color: #993333; font-weight: bold;">WHERE</span> a<span style="color: #66cc66;">.</span>post_type <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'revision'</span>;</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.xlau.org/2008/12/300/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
