<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2chinesetwfull.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" version="2.0">

<channel>
	<title>fatkun's blog</title>
	
	<link>http://fatkun.com</link>
	<description>又一个 WordPress 站点</description>
	<lastBuildDate>Sat, 19 May 2012 17:25:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/fatkun" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="fatkun" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.bloglines.com/sub/http://feeds.feedburner.com/fatkun" src="http://www.bloglines.com/images/sub_modern11.gif">Subscribe with Bloglines</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://fusion.google.com/add?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2Ffatkun" src="http://buttons.googlesyndication.com/fusion/add.gif">Subscribe with Google</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.plusmo.com/add?url=http%3A%2F%2Ffeeds.feedburner.com%2Ffatkun" src="http://plusmo.com/res/graphics/fbplusmo.gif">Subscribe with Plusmo</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.thefreedictionary.com/_/hp/AddRSS.aspx?http%3A%2F%2Ffeeds.feedburner.com%2Ffatkun" src="http://img.tfd.com/hp/addToTheFreeDictionary.gif">Subscribe with The Free Dictionary</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.bitty.com/manual/?contenttype=rssfeed&amp;contentvalue=http%3A%2F%2Ffeeds.feedburner.com%2Ffatkun" src="http://www.bitty.com/img/bittychicklet_91x17.gif">Subscribe with Bitty Browser</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.newsalloy.com/?rss=http%3A%2F%2Ffeeds.feedburner.com%2Ffatkun" src="http://www.newsalloy.com/subrss3.gif">Subscribe with NewsAlloy</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.live.com/?add=http%3A%2F%2Ffeeds.feedburner.com%2Ffatkun" src="http://tkfiles.storage.msn.com/x1piYkpqHC_35nIp1gLE68-wvzLZO8iXl_JMledmJQXP-XTBOLfmQv4zhj4MhcWEJh_GtoBIiAl1Mjh-ndp9k47If7hTaFno0mxW9_i3p_5qQw">Subscribe with Live.com</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://mix.excite.eu/add?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2Ffatkun" src="http://image.excite.co.uk/mix/addtomix.gif">Subscribe with Excite MIX</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://download.attensa.com/app/get_attensa.html?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2Ffatkun" src="http://www.attensa.com/blogs/attensa/WindowsLiveWriter/BadgeredintoBadges_10C02/attensa_feed_button5.gif">Subscribe with Attensa for Outlook</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.webwag.com/wwgthis.php?url=http%3A%2F%2Ffeeds.feedburner.com%2Ffatkun" src="http://www.webwag.com/images/wwgthis.gif">Subscribe with Webwag</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.podcastready.com/oneclick_bookmark.php?url=http%3A%2F%2Ffeeds.feedburner.com%2Ffatkun" src="http://www.podcastready.com/images/podcastready_button.gif">Subscribe with Podcast Ready</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.flurry.com/pushRssFeed.do?r=fb&amp;url=http%3A%2F%2Ffeeds.feedburner.com%2Ffatkun" src="http://www.flurry.com/images/flurry_rss_logo2.gif">Subscribe with Flurry</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.wikio.com/subscribe?url=http%3A%2F%2Ffeeds.feedburner.com%2Ffatkun" src="http://www.wikio.com/shared/img/add2wikio.gif">Subscribe with Wikio</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.dailyrotation.com/index.php?feed=http%3A%2F%2Ffeeds.feedburner.com%2Ffatkun" src="http://www.dailyrotation.com/rss-dr2.gif">Subscribe with Daily Rotation</feedburner:feedFlare><item>
		<title>格式化Hive语法树(python)</title>
		<link>http://fatkun.com/2012/05/format-hive-astnode.html</link>
		<comments>http://fatkun.com/2012/05/format-hive-astnode.html#comments</comments>
		<pubDate>Sat, 19 May 2012 17:19:02 +0000</pubDate>
		<dc:creator>fatkun</dc:creator>
				<category><![CDATA[未分类]]></category>
		<category><![CDATA[hadoop]]></category>
		<category><![CDATA[hive]]></category>

		<guid isPermaLink="false">http://fatkun.com/?p=1126</guid>
		<description><![CDATA[为了容易看一点，把用explain得到的语法树加上一些缩进. 该代码只是简单的加上缩进. 效果 这是查询explain select key from kv mykv join test mytest on (mykv.key == mytest.id);语句获取的语法树 &#160; (TOK_QUERY (TOK_FROM (TOK_JOIN (TOK_TABREF (TOK_TABNAME kv) mykv) &#160; (TOK_TABREF (TOK_TABNAME test) mytest) &#160; (== (. (TOK_TABLE_OR_COL mykv) key) &#160; (. (TOK_TABLE_OR_COL mytest) id) ) ) ) &#160; (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE) ) &#160; (TOK_SELECT (TOK_SELEXPR (TOK_TABLE_OR_COL key) ) [...]]]></description>
			<content:encoded><![CDATA[<p>为了容易看一点，把用explain得到的语法树加上一些缩进.</p>
<p>该代码只是简单的加上缩进.</p>
<h2>效果</h2>
<p>这是查询explain select key from kv mykv join test mytest on (mykv.key == mytest.id);语句获取的语法树</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">&nbsp;
(TOK_QUERY 
    (TOK_FROM 
        (TOK_JOIN 
            (TOK_TABREF 
                (TOK_TABNAME kv)
             mykv)
&nbsp;
            (TOK_TABREF 
                (TOK_TABNAME test)
             mytest)
&nbsp;
            (== 
                (. 
                    (TOK_TABLE_OR_COL mykv)
                 key)
&nbsp;
                (. 
                    (TOK_TABLE_OR_COL mytest)
                 id)
            )
        )
    )
&nbsp;
    (TOK_INSERT 
        (TOK_DESTINATION 
            (TOK_DIR TOK_TMP_FILE)
        )
&nbsp;
        (TOK_SELECT 
            (TOK_SELEXPR 
                (TOK_TABLE_OR_COL key)
            )
        )
    )
)</pre></div></div>

<h2>代码如下</h2>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#!/usr/bin/env python</span>
<span style="color: #808080; font-style: italic;"># -*- coding: utf-8 -*-</span>
<span style="color: #483d8b;">''</span><span style="color: #483d8b;">'
Created on 2012-5-20
&nbsp;
@author: fatkun
'</span><span style="color: #483d8b;">''</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">sys</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># explain select key from kv mykv join test mytest on (mykv.key == mytest.id);</span>
original_str = <span style="color: #483d8b;">&quot;&quot;&quot;(TOK_QUERY (TOK_FROM (TOK_JOIN (TOK_TABREF 
(TOK_TABNAME kv) mykv) (TOK_TABREF (TOK_TABNAME test) mytest) 
(== (. (TOK_TABLE_OR_COL mykv) key) (. (TOK_TABLE_OR_COL mytest) id)))) 
(TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_TABLE_OR_COL key)))))&quot;&quot;&quot;</span>
&nbsp;
tmp_str = original_str.<span style="color: black;">strip</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>.<span style="color: black;">replace</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span>, <span style="color: #483d8b;">''</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> my_print<span style="color: black;">&#40;</span>mystr<span style="color: black;">&#41;</span>:
    <span style="color: #dc143c;">sys</span>.<span style="color: black;">stdout</span>.<span style="color: black;">write</span><span style="color: black;">&#40;</span>mystr<span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> print_indent<span style="color: black;">&#40;</span>indent_level<span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span><span style="color: black;">&#40;</span>indent_level<span style="color: black;">&#41;</span>:
        my_print<span style="color: black;">&#40;</span><span style="color: #483d8b;">' '</span> <span style="color: #66cc66;">*</span> <span style="color: #ff4500;">4</span><span style="color: black;">&#41;</span>
&nbsp;
&nbsp;
indent_level = <span style="color: #ff4500;">0</span>
<span style="color: #ff7700;font-weight:bold;">for</span> char <span style="color: #ff7700;font-weight:bold;">in</span> tmp_str:
    <span style="color: #ff7700;font-weight:bold;">if</span> char == <span style="color: #483d8b;">'('</span>:
        <span style="color: #808080; font-style: italic;"># 如果是左括号,先换行,然后打印缩进+(</span>
        my_print<span style="color: black;">&#40;</span><span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span><span style="color: black;">&#41;</span>
        print_indent<span style="color: black;">&#40;</span>indent_level<span style="color: black;">&#41;</span>
        my_print<span style="color: black;">&#40;</span>char<span style="color: black;">&#41;</span>
        indent_level += <span style="color: #ff4500;">1</span>
    <span style="color: #ff7700;font-weight:bold;">elif</span> char == <span style="color: #483d8b;">')'</span>:
        <span style="color: #808080; font-style: italic;"># 如果是右括号,先打印),再换行,打印下一级别的缩进</span>
        indent_level -= <span style="color: #ff4500;">1</span>
        my_print<span style="color: black;">&#40;</span>char<span style="color: black;">&#41;</span>
        my_print<span style="color: black;">&#40;</span><span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span><span style="color: black;">&#41;</span>
        print_indent<span style="color: black;">&#40;</span>indent_level - <span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">else</span>:
        <span style="color: #808080; font-style: italic;"># 其他的直接打印出来</span>
        my_print<span style="color: black;">&#40;</span>char<span style="color: black;">&#41;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://fatkun.com/2012/05/format-hive-astnode.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[转]解决ubuntu下mysql不能远程连接数据库的问题</title>
		<link>http://fatkun.com/2012/05/ubuntu-mysql.html</link>
		<comments>http://fatkun.com/2012/05/ubuntu-mysql.html#comments</comments>
		<pubDate>Thu, 03 May 2012 18:00:09 +0000</pubDate>
		<dc:creator>fatkun</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[mysql权限]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[权限]]></category>

		<guid isPermaLink="false">http://fatkun.com/?p=1118</guid>
		<description><![CDATA[来源：http://www.php100.com/html/webkaifa/database/Mysql/2010/1115/6818.html Ubuntu10.04上自带的MySQL，执行了 root@ubuntu:~#sudo apt-get install mysql 安装完mysql-server 启动mysql root@ubuntu:~#/etc/init.d/mysql start 本地可以连接进入数据库。 root@ubuntu:~#mysql -uroot -p 设置了远程访问权限： mysql&#62; grant all PRIVILEGES on *.* to admin@’%’ identified by ‘123456′; Query OK, 0 rows affected (0.04 sec) mysql&#62; use information_schema mysql&#62; select * from user_privileges; 查询到有下面的结果：&#8217;admin’@&#8217;%'，说明mysql已经授权远程连接。 在windows下访问Ubuntu的数据库，连接不上，但是Ubuntu上安装的apache可以访问。 用iptalbes添加端口3306后也无法访问。 root@ubuntu:~# iptables -A INPUT -p tcp –dport 3306 -j ACCEPT Ubuntu上查看Mysql网络连接： [...]]]></description>
			<content:encoded><![CDATA[<p>来源：<a href="http://www.php100.com/html/webkaifa/database/Mysql/2010/1115/6818.html">http://www.php100.com/html/webkaifa/database/Mysql/2010/1115/6818.html</a><br />
Ubuntu10.04上自带的MySQL，执行了<br />
root@ubuntu:~#sudo apt-get install mysql<br />
安装完mysql-server</p>
<p>启动mysql<br />
root@ubuntu:~#/etc/init.d/mysql start</p>
<p>本地可以连接进入数据库。<br />
root@ubuntu:~#mysql -uroot -p</p>
<p>设置了远程访问权限：<br />
mysql&gt; grant all PRIVILEGES on *.* to admin@’%’ identified by ‘123456′;<br />
Query OK, 0 rows affected (0.04 sec)</p>
<p>mysql&gt; use information_schema<br />
mysql&gt; select * from user_privileges;<br />
查询到有下面的结果：&#8217;admin’@&#8217;%'，说明mysql已经授权远程连接。</p>
<p>在windows下访问Ubuntu的数据库，连接不上，但是Ubuntu上安装的apache可以访问。<br />
用iptalbes添加端口3306后也无法访问。<br />
root@ubuntu:~# iptables -A INPUT -p tcp –dport 3306 -j ACCEPT</p>
<p>Ubuntu上查看Mysql网络连接：<br />
root@ubuntu:~# netstat -an |grep 3306<br />
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN<br />
本地端口也在监听</p>
<p>root@ubuntu:~# ufw status<br />
Firewall not loaded<br />
本地防火墙未打开</p>
<p>后来在网上找到一个解决办法：<br />
查看/etc/mysql/my.cnf找到bind-address才发现配置的是 127.0.0.1(bind-address=127.0.0.1)，直接改为bind-address=192.168.0.xxx(本机ip)，然 后再查看3306端口打开了，ok，可以正常连接了</p>
]]></content:encoded>
			<wfw:commentRss>http://fatkun.com/2012/05/ubuntu-mysql.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fatkun图片批量下载谷歌浏览器扩展1.3版更新了</title>
		<link>http://fatkun.com/2012/05/fatkun-batch-image-download-1-3.html</link>
		<comments>http://fatkun.com/2012/05/fatkun-batch-image-download-1-3.html#comments</comments>
		<pubDate>Tue, 01 May 2012 14:00:51 +0000</pubDate>
		<dc:creator>fatkun</dc:creator>
				<category><![CDATA[网页前端]]></category>
		<category><![CDATA[Batch Image Download]]></category>

		<guid isPermaLink="false">http://fatkun.com/?p=1114</guid>
		<description><![CDATA[1.3版插件地址：https://bath-image-download.googlecode.com/files/batch1_3.crx 1.3版update:2012-05-01 支持特定网站取大图，添加新浪微博和新浪轻博客的支持 支持input图片 添加视图切换 &#160; 最近工作上有点忙，先做一个小更新。有好多东西要学，是压力也是动力~！ 详细信息：http://fatkun.com/2010/09/batch-image-download.html]]></description>
			<content:encoded><![CDATA[<p>1.3版插件地址：<a href="http://bath-image-download.googlecode.com/files/batch1_3.crx" target="_blank">https://bath-image-download.googlecode.com/files/batch1_3.crx</a></p>
<p><strong>1.3版<strong>update:2012-05-01</strong></strong></p>
<ol>
<li>支持特定网站取大图，添加新浪微博和新浪轻博客的支持</li>
<li>支持input图片</li>
<li>添加视图切换</li>
</ol>
<p>&nbsp;</p>
<p>最近工作上有点忙，先做一个小更新。有好多东西要学，是压力也是动力~！</p>
<p>详细信息：<a href="http://fatkun.com/2010/09/batch-image-download.html">http://fatkun.com/2010/09/batch-image-download.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://fatkun.com/2012/05/fatkun-batch-image-download-1-3.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu 11.04 下安装配置 JDK 7</title>
		<link>http://fatkun.com/2012/04/ubuntu-11-04-%e4%b8%8b%e5%ae%89%e8%a3%85%e9%85%8d%e7%bd%ae-jdk-7.html</link>
		<comments>http://fatkun.com/2012/04/ubuntu-11-04-%e4%b8%8b%e5%ae%89%e8%a3%85%e9%85%8d%e7%bd%ae-jdk-7.html#comments</comments>
		<pubDate>Sun, 29 Apr 2012 17:44:19 +0000</pubDate>
		<dc:creator>fatkun</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[JAVA]]></category>
		<category><![CDATA[jdk]]></category>

		<guid isPermaLink="false">http://fatkun.com/?p=1109</guid>
		<description><![CDATA[文章来源：Ubuntu 11.04 下安装配置 JDK 7 这篇文章说得很清晰。。复制过来。。以作备用。。 &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; 第一步：下载jdk-7-linux-i586.tar.gz wget -c http://download.oracle.com/otn-pub/java/jdk/7/jdk-7-linux-i586.tar.gz (注：如果下载不下来，建议使用迅雷下载，然后拷贝到Linux系统上。) 第二步：解压安装 sudo tar zxvf ./jdk-7-linux-i586.tar.gz -C /usr/lib/jvm cd /usr/lib/jvm sudo mv jdk1.7.0/ java-7-sun 第三步：修改环境变量 vim ~/.bashrc 添加： export JAVA_HOME=/usr/lib/jvm/java-7-sun export JRE_HOME=${JAVA_HOME}/jre export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib export PATH=${JAVA_HOME}/bin:$PATH 保存退出，输入以下命令使之立即生效。 source ~/.bashrc 第四步：配置默认JDK版本 由于ubuntu中可能会有默认的JDK，如openjdk，所以，为了将我们安装的JDK设置为默认JDK版本，还要进行如下工作。 执行代码: sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/java-7-sun/bin/java 300 sudo update-alternatives --install /usr/bin/javac javac [...]]]></description>
			<content:encoded><![CDATA[<p>文章来源：<a href="http://blog.csdn.net/yang_hui1986527/article/details/6677450" title="Ubuntu 11.04 下安装配置 JDK 7" target="_blank">Ubuntu 11.04 下安装配置 JDK 7</a></p>
<p>这篇文章说得很清晰。。复制过来。。以作备用。。<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
第一步：下载jdk-7-linux-i586.tar.gz</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #660033;">-c</span> http:<span style="color: #000000; font-weight: bold;">//</span>download.oracle.com<span style="color: #000000; font-weight: bold;">/</span>otn-pub<span style="color: #000000; font-weight: bold;">/</span>java<span style="color: #000000; font-weight: bold;">/</span>jdk<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">7</span><span style="color: #000000; font-weight: bold;">/</span>jdk-<span style="color: #000000;">7</span>-linux-i586.tar.gz</pre></div></div>

<p>(注：如果下载不下来，建议使用迅雷下载，然后拷贝到Linux系统上。)<br />
第二步：解压安装</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">tar</span> zxvf .<span style="color: #000000; font-weight: bold;">/</span>jdk-<span style="color: #000000;">7</span>-linux-i586.tar.gz  <span style="color: #660033;">-C</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>jvm  
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>jvm  
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">mv</span> jdk1.7.0<span style="color: #000000; font-weight: bold;">/</span> java-<span style="color: #000000;">7</span>-sun</pre></div></div>

<p>第三步：修改环境变量</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">vim</span> ~<span style="color: #000000; font-weight: bold;">/</span>.bashrc</pre></div></div>

<p>添加：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">JAVA_HOME</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>jvm<span style="color: #000000; font-weight: bold;">/</span>java-<span style="color: #000000;">7</span>-sun  
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">JRE_HOME</span>=<span style="color: #800000;">${JAVA_HOME}</span><span style="color: #000000; font-weight: bold;">/</span>jre  
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">CLASSPATH</span>=.:<span style="color: #800000;">${JAVA_HOME}</span><span style="color: #000000; font-weight: bold;">/</span>lib:<span style="color: #800000;">${JRE_HOME}</span><span style="color: #000000; font-weight: bold;">/</span>lib  
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">PATH</span>=<span style="color: #800000;">${JAVA_HOME}</span><span style="color: #000000; font-weight: bold;">/</span>bin:<span style="color: #007800;">$PATH</span></pre></div></div>

<p>保存退出，输入以下命令使之立即生效。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">source</span> ~<span style="color: #000000; font-weight: bold;">/</span>.bashrc</pre></div></div>

<p>第四步：配置默认JDK版本<br />
由于ubuntu中可能会有默认的JDK，如openjdk，所以，为了将我们安装的JDK设置为默认JDK版本，还要进行如下工作。<br />
执行代码:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> update-alternatives <span style="color: #660033;">--install</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>java java <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>jvm<span style="color: #000000; font-weight: bold;">/</span>java-<span style="color: #000000;">7</span>-sun<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>java <span style="color: #000000;">300</span>  
<span style="color: #c20cb9; font-weight: bold;">sudo</span> update-alternatives <span style="color: #660033;">--install</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>javac javac <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>jvm<span style="color: #000000; font-weight: bold;">/</span>java-<span style="color: #000000;">7</span>-sun<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>javac <span style="color: #000000;">300</span>  
<span style="color: #c20cb9; font-weight: bold;">sudo</span> update-alternatives <span style="color: #660033;">--install</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>jar jar <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>jvm<span style="color: #000000; font-weight: bold;">/</span>java-<span style="color: #000000;">7</span>-sun<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>jar <span style="color: #000000;">300</span></pre></div></div>

<p>执行代码：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> update-alternatives <span style="color: #660033;">--config</span> java</pre></div></div>

<p>系统会列出各种JDK版本，如下所示：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">snowdream<span style="color: #000000; font-weight: bold;">@</span>snowdream:~$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> update-alternatives <span style="color: #660033;">--config</span> java  
有 <span style="color: #000000;">3</span> 个候选项可用于替换 java <span style="color: #7a0874; font-weight: bold;">&#40;</span>提供 <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>java<span style="color: #7a0874; font-weight: bold;">&#41;</span>。  
&nbsp;
&nbsp;
  选择       路径                                    优先级  状态  
<span style="color: #660033;">------------------------------------------------------------</span>  
<span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000;">0</span>            <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>jvm<span style="color: #000000; font-weight: bold;">/</span>java-<span style="color: #000000;">6</span>-openjdk<span style="color: #000000; font-weight: bold;">/</span>jre<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>java   <span style="color: #000000;">1061</span>      自动模式  
  <span style="color: #000000;">1</span>            <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>jvm<span style="color: #000000; font-weight: bold;">/</span>java-<span style="color: #000000;">6</span>-openjdk<span style="color: #000000; font-weight: bold;">/</span>jre<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>java   <span style="color: #000000;">1061</span>      手动模式  
  <span style="color: #000000;">2</span>            <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>jvm<span style="color: #000000; font-weight: bold;">/</span>java-<span style="color: #000000;">6</span>-sun<span style="color: #000000; font-weight: bold;">/</span>jre<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>java       <span style="color: #000000;">63</span>        手动模式  
  <span style="color: #000000;">3</span>            <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>jvm<span style="color: #000000; font-weight: bold;">/</span>java-<span style="color: #000000;">7</span>-sun<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>java           <span style="color: #000000;">300</span>       手动模式</pre></div></div>

<p>要维持当前值[*]请按回车键，或者键入选择的编号：3<br />
update-alternatives: 使用 /usr/lib/jvm/java-7-sun/bin/java 来提供 /usr/bin/java (java)，于 手动模式 中。<br />
第五步：测试</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">snowdream<span style="color: #000000; font-weight: bold;">@</span>snowdream:~$ java <span style="color: #660033;">-version</span>  
java version <span style="color: #ff0000;">&quot;1.7.0&quot;</span>  
Java<span style="color: #7a0874; font-weight: bold;">&#40;</span>TM<span style="color: #7a0874; font-weight: bold;">&#41;</span> SE Runtime Environment <span style="color: #7a0874; font-weight: bold;">&#40;</span>build 1.7.0-b147<span style="color: #7a0874; font-weight: bold;">&#41;</span>  
Java HotSpot<span style="color: #7a0874; font-weight: bold;">&#40;</span>TM<span style="color: #7a0874; font-weight: bold;">&#41;</span> Server VM <span style="color: #7a0874; font-weight: bold;">&#40;</span>build <span style="color: #000000;">21.0</span>-b17, mixed mode<span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://fatkun.com/2012/04/ubuntu-11-04-%e4%b8%8b%e5%ae%89%e8%a3%85%e9%85%8d%e7%bd%ae-jdk-7.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>eclipse上单步调试Hive</title>
		<link>http://fatkun.com/2012/04/eclipse-debug-hive.html</link>
		<comments>http://fatkun.com/2012/04/eclipse-debug-hive.html#comments</comments>
		<pubDate>Sat, 14 Apr 2012 10:06:16 +0000</pubDate>
		<dc:creator>fatkun</dc:creator>
				<category><![CDATA[J2EE]]></category>
		<category><![CDATA[debug]]></category>
		<category><![CDATA[hive]]></category>

		<guid isPermaLink="false">http://fatkun.com/?p=1106</guid>
		<description><![CDATA[在百度找到这篇文章：在Windows eclipse上单步调试Hive教程 可是我死活搞不定在windows安装hadoop和hive，cgywin不靠普啊。。还是在ubuntu下调试了。 准备 前提条件是你已经部署好hadoop和hive，能够正常的执行hive查询。 我在~/workspace/hive新建了两个目录lib和conf 从hive目录中的lib和hadoop目录中的lib复制一份到一个目录里，我是放在~/workspace/hive/lib 还要把hadoop目录下的hadoop*.jar都拷贝过来吧。 如果用mysql做metastore的数据库，还需要把mysql-connector的lib加上 把hive的conf文件夹拷贝过来（要已配置好的conf文件哦） 把hive中的src目录拷贝进来 创建项目 在这个目录下（~/workspace/hive/src/cli）的代码是hive命令行的代码，我们可以通过调试它来了解hive的执行过程。 在这个目录下，用eclipse新建一个项目。 配置bulid path，把我们准备好的lib全部加上 这个时候，代码应该没有编译错误了，如果有，请检查一下那个lib没加上。 还有个重要的步骤！hive是怎样找它的配置文件的呢？ 我们要把conf目录加入classpath中，在debug configuration中的Classpath，点击左侧的advanced，add exteral path，选上我们准备好的conf目录。 这样就可以开始debug了！ 如果你运行报does not have a sch错误，应该是由于没找到配置文件引起的。 &#160; 顺便看看hive是怎么找到配置文件的。 都是通过getClassLoader().getResource()方法来获取的，所以配置文件夹必须在classpath中！ URL hconfurl = getClassLoader&#40;&#41;.getResource&#40;&#34;hive-default.xml&#34;&#41;; if &#40;hconfurl == null&#41; &#123; l4j.debug&#40;&#34;hive-default.xml not found.&#34;&#41;; &#125; else &#123; addResource&#40;hconfurl&#41;; &#125; URL hsiteurl = getClassLoader&#40;&#41;.getResource&#40;&#34;hive-site.xml&#34;&#41;; if &#40;hsiteurl == [...]]]></description>
			<content:encoded><![CDATA[<p>在百度找到这篇文章：<a href="http://wenku.baidu.com/view/f4d9b407e87101f69e319599.html">在Windows eclipse上单步调试Hive教程</a></p>
<p>可是我死活搞不定在windows安装hadoop和hive，cgywin不靠普啊。。还是在ubuntu下调试了。</p>
<h2>准备</h2>
<p>前提条件是你已经部署好hadoop和hive，能够正常的执行hive查询。</p>
<p>我在~/workspace/hive新建了两个目录lib和conf</p>
<ol>
<li>从hive目录中的lib和hadoop目录中的lib复制一份到一个目录里，我是放在~/workspace/hive/lib</li>
<li>还要把hadoop目录下的hadoop*.jar都拷贝过来吧。</li>
<li>如果用mysql做metastore的数据库，还需要把mysql-connector的lib加上</li>
<li>把hive的conf文件夹拷贝过来（要已配置好的conf文件哦）</li>
<li>把hive中的src目录拷贝进来</li>
</ol>
<h2>创建项目</h2>
<p>在这个目录下（~/workspace/hive/src/cli）的代码是hive命令行的代码，我们可以通过调试它来了解hive的执行过程。</p>
<p>在这个目录下，用eclipse新建一个项目。</p>
<p>配置bulid path，把我们准备好的lib全部加上</p>
<p>这个时候，代码应该没有编译错误了，如果有，请检查一下那个lib没加上。</p>
<p>还有个重要的步骤！hive是怎样找它的配置文件的呢？</p>
<p>我们要把conf目录加入classpath中，在debug configuration中的Classpath，点击左侧的advanced，add exteral path，选上我们准备好的conf目录。</p>
<p>这样就可以开始debug了！</p>
<p>如果你运行报does not have a sch错误，应该是由于没找到配置文件引起的。<br />
&nbsp;</p>
<p>顺便看看hive是怎么找到配置文件的。<br />
都是通过getClassLoader().getResource()方法来获取的，所以配置文件夹必须在classpath中！</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">    <span style="color: #003399;">URL</span> hconfurl <span style="color: #339933;">=</span> getClassLoader<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getResource</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;hive-default.xml&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>hconfurl <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      l4j.<span style="color: #006633;">debug</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;hive-default.xml not found.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
      addResource<span style="color: #009900;">&#40;</span>hconfurl<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #003399;">URL</span> hsiteurl <span style="color: #339933;">=</span> getClassLoader<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getResource</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;hive-site.xml&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>hsiteurl <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      l4j.<span style="color: #006633;">debug</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;hive-site.xml not found.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
      addResource<span style="color: #009900;">&#40;</span>hsiteurl<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://fatkun.com/2012/04/eclipse-debug-hive.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hive为什么会创建DELETEME表</title>
		<link>http://fatkun.com/2012/04/hive-deleteme-table.html</link>
		<comments>http://fatkun.com/2012/04/hive-deleteme-table.html#comments</comments>
		<pubDate>Tue, 10 Apr 2012 16:16:45 +0000</pubDate>
		<dc:creator>fatkun</dc:creator>
				<category><![CDATA[J2EE]]></category>
		<category><![CDATA[hive]]></category>

		<guid isPermaLink="false">http://fatkun.com/?p=1101</guid>
		<description><![CDATA[在Hive中会去取schme name和catalog（暂时不知道这个东西有什么用） 是第三方的库datanucleus在操作， 可以看到它创建DELETEME123213一些随机数字的表，然后删掉。。目的就为了去获取schme name和catalog 可以在hive-site.xml配置，不让做这个操作&#8230; &#60;property&#62; &#60;name&#62;datanucleus.fixedDatastore&#60;/name&#62; &#60;value&#62;true&#60;/value&#62; &#60;/property&#62; 这样会导致的结果暂时未知。。。o(╯□╰)o 另外，最好把datanucleus.autoCreateSchema设为false 官方的注释中表明，如果你第一次已经建好了表，就把这个设回false，为了方便第一次创建表结构。 &#60;property&#62; &#60;name&#62;datanucleus.autoCreateSchema&#60;/name&#62; &#60;value&#62;false&#60;/value&#62; &#60;/property&#62;]]></description>
			<content:encoded><![CDATA[<p>在Hive中会去取schme name和catalog（暂时不知道这个东西有什么用）<br />
是第三方的库datanucleus在操作，<br />
可以看到它创建DELETEME123213一些随机数字的表，然后删掉。。目的就为了去获取schme name和catalog</p>
<p>可以在hive-site.xml配置，不让做这个操作&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
 <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>datanucleus.fixedDatastore<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
 <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>true<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/property<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>这样会导致的结果暂时未知。。。o(╯□╰)o<br />
另外，最好把datanucleus.autoCreateSchema设为false<br />
官方的注释中表明，如果你第一次已经建好了表，就把这个设回false，为了方便第一次创建表结构。</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
 <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>datanucleus.autoCreateSchema<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
 <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>false<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/property<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://fatkun.com/2012/04/hive-deleteme-table.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hive MetaStore建表与修改表分析</title>
		<link>http://fatkun.com/2012/04/hive-metastore-create-table-and-alter-table.html</link>
		<comments>http://fatkun.com/2012/04/hive-metastore-create-table-and-alter-table.html#comments</comments>
		<pubDate>Tue, 10 Apr 2012 15:57:54 +0000</pubDate>
		<dc:creator>fatkun</dc:creator>
				<category><![CDATA[J2EE]]></category>
		<category><![CDATA[alter table]]></category>
		<category><![CDATA[hive]]></category>
		<category><![CDATA[MetaStore]]></category>
		<category><![CDATA[table]]></category>

		<guid isPermaLink="false">http://fatkun.com/?p=1092</guid>
		<description><![CDATA[问题 使用Hive MetaStore（这里指的是通过thrift连接hiveserver） Create table 和 Alter table的时候遇到一个问题 建表时指定的location为 /mnt/dfs/xxx，实质上使用hiveMetastore会帮你做一个转换，最后location变成 hdfs://hostname:port/mnt/dfs/xxx的路径 但在修改表的时候，却不会帮你做这样的转换！！坑爹啊。。你指定的是什么就是什么~ 注：通过hive命令行方式执行sql命令建表也是这样，不过修改表的时候，location必须是这样的路径hdfs://hostname:port/mnt/dfs/xxx才可以修改成功，否则报错。 分析问题 从代码入手吧。。 进入这个目录 hive-0.7.1-cdh3u3\src\metastore\src\java\org\apache\hadoop\hive\metastore 这里都是hiveserver的代码了。 打开HiveMetaStore.java代码，咱们直奔主题，找create_table和alter_table去 public void create_table&#40;final Table tbl&#41; throws AlreadyExistsException, MetaException, InvalidObjectException &#123; ... create_table_core&#40;ms, tbl&#41;; 调用了create_table_core(ms, tbl);继续 private void create_table_core&#40;final RawStore ms, final Table tbl&#41; throws AlreadyExistsException, MetaException, InvalidObjectException &#123; //检查了一些名称，列名，分区之类的 //... ms.openTransaction&#40;&#41;; //.... if &#40;!TableType.VIRTUAL_VIEW.toString&#40;&#41;.equals&#40;tbl.getTableType&#40;&#41;&#41;&#41; &#123; if [...]]]></description>
			<content:encoded><![CDATA[<h2>问题</h2>
<p>使用Hive MetaStore（这里指的是通过thrift连接hiveserver） Create table 和 Alter table的时候遇到一个问题<br />
建表时指定的location为 /mnt/dfs/xxx，实质上使用hiveMetastore会帮你做一个转换，最后location变成 hdfs://hostname:port/mnt/dfs/xxx的路径<br />
但在修改表的时候，却不会帮你做这样的转换！！坑爹啊。。你指定的是什么就是什么~</p>
<p>注：通过hive命令行方式执行sql命令建表也是这样，不过修改表的时候，location必须是这样的路径hdfs://hostname:port/mnt/dfs/xxx才可以修改成功，否则报错。</p>
<h2>分析问题</h2>
<p>从代码入手吧。。<br />
进入这个目录<br />
hive-0.7.1-cdh3u3\src\metastore\src\java\org\apache\hadoop\hive\metastore<br />
这里都是hiveserver的代码了。</p>
<p>打开HiveMetaStore.java代码，咱们直奔主题，找create_table和alter_table去</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> create_table<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">final</span> Table tbl<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> AlreadyExistsException,
        MetaException, <span style="color: #003399;">InvalidObjectException</span> <span style="color: #009900;">&#123;</span>
...
<span style="color: #006633;">create_table_core</span><span style="color: #009900;">&#40;</span>ms, tbl<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>调用了create_table_core(ms, tbl);继续</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">void</span> create_table_core<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">final</span> RawStore ms, <span style="color: #000000; font-weight: bold;">final</span> Table tbl<span style="color: #009900;">&#41;</span>
        <span style="color: #000000; font-weight: bold;">throws</span> AlreadyExistsException, MetaException, <span style="color: #003399;">InvalidObjectException</span> <span style="color: #009900;">&#123;</span>
<span style="color: #666666; font-style: italic;">//检查了一些名称，列名，分区之类的</span>
      <span style="color: #666666; font-style: italic;">//...</span>
        ms.<span style="color: #006633;">openTransaction</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #666666; font-style: italic;">//....</span>
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>TableType.<span style="color: #006633;">VIRTUAL_VIEW</span>.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span>tbl.<span style="color: #006633;">getTableType</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
          <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>tbl.<span style="color: #006633;">getSd</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getLocation</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">null</span>
            <span style="color: #339933;">||</span> tbl.<span style="color: #006633;">getSd</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getLocation</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">isEmpty</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            tblPath <span style="color: #339933;">=</span> wh.<span style="color: #006633;">getDefaultTablePath</span><span style="color: #009900;">&#40;</span>
              tbl.<span style="color: #006633;">getDbName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, tbl.<span style="color: #006633;">getTableName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
          <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>isExternal<span style="color: #009900;">&#40;</span>tbl<span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span>MetaStoreUtils.<span style="color: #006633;">isNonNativeTable</span><span style="color: #009900;">&#40;</span>tbl<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
              LOG.<span style="color: #006633;">warn</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Location: &quot;</span> <span style="color: #339933;">+</span> tbl.<span style="color: #006633;">getSd</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getLocation</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
                <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot; specified for non-external table:&quot;</span> <span style="color: #339933;">+</span> tbl.<span style="color: #006633;">getTableName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
            <span style="color: #666666; font-style: italic;">// 主要就是这里啦！getDnsPath！！！帮我们把dataurl补全</span>
            tblPath <span style="color: #339933;">=</span> wh.<span style="color: #006633;">getDnsPath</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> Path<span style="color: #009900;">&#40;</span>tbl.<span style="color: #006633;">getSd</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getLocation</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
          <span style="color: #009900;">&#125;</span>
          tbl.<span style="color: #006633;">getSd</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">setLocation</span><span style="color: #009900;">&#40;</span>tblPath.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">//...</span>
        ms.<span style="color: #006633;">createTable</span><span style="color: #009900;">&#40;</span>tbl<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #009900;">&#125;</span></pre></div></div>

<p>因为我们的location不为空~所以..<br />
主要就是这一句：tblPath = wh.getDnsPath(new Path(tbl.getSd().getLocation()));<br />
看看getDnsPath()做了什么，打开代码Warehouse.java</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">  <span style="color: #000000; font-weight: bold;">public</span> Path getDnsPath<span style="color: #009900;">&#40;</span>Path path<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> MetaException <span style="color: #009900;">&#123;</span>
    FileSystem fs <span style="color: #339933;">=</span> getFs<span style="color: #009900;">&#40;</span>path<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> Path<span style="color: #009900;">&#40;</span>fs.<span style="color: #006633;">getUri</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getScheme</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, fs.<span style="color: #006633;">getUri</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getAuthority</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, path
        .<span style="color: #006633;">toUri</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getPath</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span></pre></div></div>

<p>就帮我们做了些转换。。。我们建表看到的hdfs://hostname:port就是这里加上的。</p>
<p>再来看一下alter_table</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> alter_table<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">String</span> dbname, <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">String</span> name, <span style="color: #000000; font-weight: bold;">final</span> Table newTable<span style="color: #009900;">&#41;</span>
        <span style="color: #000000; font-weight: bold;">throws</span> InvalidOperationException, MetaException <span style="color: #009900;">&#123;</span>
\\...
 <span style="color: #006633;">alterHandler</span>.<span style="color: #006633;">alterTable</span><span style="color: #009900;">&#40;</span>ms, wh, dbname, name, newTable<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>跳入这个类HiveAlterHandler.java，只有一个方法：</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> alterTable<span style="color: #009900;">&#40;</span>RawStore msdb, Warehouse wh, <span style="color: #003399;">String</span> dbname,
      <span style="color: #003399;">String</span> name, Table newt<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> InvalidOperationException, MetaException <span style="color: #009900;">&#123;</span>
<span style="color: #666666; font-style: italic;">//这里主要判断表名有没有改</span>
<span style="color: #666666; font-style: italic;">//如果改了分区字段则抛错误</span>
<span style="color: #666666; font-style: italic;">//如果改了表名但location没改或者为空，并且不是外部表，则把数据给移了~</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//最后，直接的alterTable了。。？虾米，location就这样保存进去了？！</span>
      <span style="color: #666666; font-style: italic;">// now finally call alter table</span>
      msdb.<span style="color: #006633;">alterTable</span><span style="color: #009900;">&#40;</span>dbname, name, newt<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #666666; font-style: italic;">// commit the changes</span>
      success <span style="color: #339933;">=</span> msdb.<span style="color: #006633;">commitTransaction</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>location没做什么处理就保存进去了。。。</p>
<p>RawStore是什么东西？代码中很多用了反射的方式调用。。貌似实质上是ObjectStore.java类。。<br />
这个类使用jdo来操作metastore数据库</p>
]]></content:encoded>
			<wfw:commentRss>http://fatkun.com/2012/04/hive-metastore-create-table-and-alter-table.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>记录一些常用的linux shell命令</title>
		<link>http://fatkun.com/2012/03/linux-shell.html</link>
		<comments>http://fatkun.com/2012/03/linux-shell.html#comments</comments>
		<pubDate>Sun, 25 Mar 2012 13:31:35 +0000</pubDate>
		<dc:creator>fatkun</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[linux shell]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://fatkun.com/?p=1076</guid>
		<description><![CDATA[日期 # 取前一天 date -d &#8217;1 days ago&#8217; +%Y-%m-%d 命令別名設定功能： (alias) alias ll=&#8217;ls -al&#8217; 一些特殊值 $$：(關於本 shell 的 PID) $!：得到子进程的进程PID,例如nohup的命令可以通过这个获取PID $?：(關於上個執行指令的回傳值) $#: 参数个数 $@ ：代表『 “$1&#8243; “$2&#8243; “$3&#8243; “$4&#8243; 』 $* ：代表『 “$1c$2c$3c$4&#8243; 』，其中 c 為分隔字元 declare 数值计算要用 declare -i sum=100+12 也可以用sum=$((100+12))计算 [root@www ~]# declare [-aixr] variable 選項與參數： -a ：將後面名為 variable 的變數定義成為陣列 (array) 類型 -i [...]]]></description>
			<content:encoded><![CDATA[<h2>日期</h2>
<p># 取前一天<br />
date -d &#8217;1 days ago&#8217; +%Y-%m-%d</p>
<h2>命令別名設定功能： (alias)</h2>
<p>alias ll=&#8217;ls -al&#8217;</p>
<h2>一些特殊值</h2>
<p>$$：(關於本 shell 的 PID)<br />
$!：得到子进程的进程PID,例如nohup的命令可以通过这个获取PID<br />
$?：(關於上個執行指令的回傳值)<br />
$#: 参数个数</p>
<p>$@ ：代表『 “$1&#8243; “$2&#8243; “$3&#8243; “$4&#8243; 』<br />
$* ：代表『 “$1c$2c$3c$4&#8243; 』，其中 c 為分隔字元</p>
<h2>declare</h2>
<p>数值计算要用 declare -i sum=100+12<br />
也可以用sum=$((100+12))计算<br />
[root@www ~]# declare [-aixr] variable<br />
選項與參數：<br />
-a ：將後面名為 variable 的變數定義成為陣列 (array) 類型<br />
-i ：將後面名為 variable 的變數定義成為整數數字 (integer) 類型<br />
-x ：用法與 export 一樣，就是將後面的 variable 變成環境變數；<br />
-r ：將變數設定成為 readonly 類型，該變數不可被更改內容，也不能 unset</p>
<h2>数组</h2>
<p>var[1]=”small min”<br />
echo $(var[1])</p>
<h2>删除/替换字符</h2>
<p>echo ${PATH#/usr*:} #从前到后开始删除掉第一个符合条件的字符<br />
echo ${PATH##/usr*:} #从前到后开始删除掉所有符合条件的字符<br />
也可以从后面开始，就是把#号替换成%号<br />
echo ${PATH/usr/USR} #替换<br />
echo ${PATH//usr/USR} #替换所有</p>
<h2>&amp;&amp;和||</h2>
<p>可以把多条命令串起来，例如<br />
ls ./test/||mkdir ./test/ #如果目录不存在，创建一个</p>
<h2>判断</h2>
<p>使用中括号时注意空格必须要有[ -e "xxx" ]</p>
<p>语法</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$name</span>&quot;</span> == <span style="color: #ff0000;">&quot;Fatkun&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Hi!Fatkun&quot;</span>
<span style="color: #000000; font-weight: bold;">elif</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> ... <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;...&quot;</span>
<span style="color: #000000; font-weight: bold;">else</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;...&quot;</span>
<span style="color: #000000; font-weight: bold;">fi</span></pre></div></div>

<p>&nbsp;</p>
<table style="width: 85%;" border="1" cellspacing="0" cellpadding="3" bgcolor="lightyellow">
<tbody>
<tr align="center" bgcolor="lightblue">
<td width="100">測試的標誌</td>
<td>代表意義</td>
</tr>
<tr bgcolor="lightblue">
<td colspan="2">1. 關於某個檔名的『檔案類型』判斷，如 test -e filename 表示存在否</td>
</tr>
<tr>
<td align="center">-e</td>
<td>該『檔名』是否存在？(常用)</td>
</tr>
<tr>
<td align="center">-f</td>
<td>該『檔名』是否存在且為檔案(file)？(常用)</td>
</tr>
<tr>
<td align="center">-d</td>
<td>該『檔名』是否存在且為目錄(directory)？(常用)</td>
</tr>
<tr>
<td align="center">-b</td>
<td>該『檔名』是否存在且為一個 block device 裝置？</td>
</tr>
<tr>
<td align="center">-c</td>
<td>該『檔名』是否存在且為一個 character device 裝置？</td>
</tr>
<tr>
<td align="center">-S</td>
<td>該『檔名』是否存在且為一個 Socket 檔案？</td>
</tr>
<tr>
<td align="center">-p</td>
<td>該『檔名』是否存在且為一個 FIFO (pipe) 檔案？</td>
</tr>
<tr>
<td align="center">-L</td>
<td>該『檔名』是否存在且為一個連結檔？</td>
</tr>
<tr bgcolor="lightblue">
<td colspan="2">2. 關於檔案的權限偵測，如 test -r filename 表示可讀否 (但 root 權限常有例外)</td>
</tr>
<tr>
<td align="center">-r</td>
<td>偵測該檔名是否存在且具有『可讀』的權限？</td>
</tr>
<tr>
<td align="center">-w</td>
<td>偵測該檔名是否存在且具有『可寫』的權限？</td>
</tr>
<tr>
<td align="center">-x</td>
<td>偵測該檔名是否存在且具有『可執行』的權限？</td>
</tr>
<tr>
<td align="center">-u</td>
<td>偵測該檔名是否存在且具有『SUID』的屬性？</td>
</tr>
<tr>
<td align="center">-g</td>
<td>偵測該檔名是否存在且具有『SGID』的屬性？</td>
</tr>
<tr>
<td align="center">-k</td>
<td>偵測該檔名是否存在且具有『Sticky bit』的屬性？</td>
</tr>
<tr>
<td align="center">-s</td>
<td>偵測該檔名是否存在且為『非空白檔案』？</td>
</tr>
<tr bgcolor="lightblue">
<td colspan="2">3. 兩個檔案之間的比較，如： test file1 -nt file2</td>
</tr>
<tr>
<td align="center">-nt</td>
<td>(newer than)判斷 file1 是否比 file2 新</td>
</tr>
<tr>
<td align="center">-ot</td>
<td>(older than)判斷 file1 是否比 file2 舊</td>
</tr>
<tr>
<td align="center">-ef</td>
<td>判斷 file1 與 file2 是否為同一檔案，可用在判斷 hard link 的判定上。 主要意義在判定，兩個檔案是否均指向同一個 inode 哩！</td>
</tr>
<tr bgcolor="lightblue">
<td colspan="2">4. 關於兩個整數之間的判定，例如 test n1 -eq n2</td>
</tr>
<tr>
<td align="center">-eq</td>
<td>兩數值相等 (equal)</td>
</tr>
<tr>
<td align="center">-ne</td>
<td>兩數值不等 (not equal)</td>
</tr>
<tr>
<td align="center">-gt</td>
<td>n1 大於 n2 (greater than)</td>
</tr>
<tr>
<td align="center">-lt</td>
<td>n1 小於 n2 (less than)</td>
</tr>
<tr>
<td align="center">-ge</td>
<td>n1 大於等於 n2 (greater than or equal)</td>
</tr>
<tr>
<td align="center">-le</td>
<td>n1 小於等於 n2 (less than or equal)</td>
</tr>
<tr bgcolor="lightblue">
<td colspan="2">5. 判定字串的資料</td>
</tr>
<tr>
<td align="center">test -z string</td>
<td>判定字串是否為 0 ？若 string 為空字串，則為 true</td>
</tr>
<tr>
<td align="center">test -n string</td>
<td>判定字串是否非為 0 ？若 string 為空字串，則為 false。<br />
註： -n 亦可省略</td>
</tr>
<tr>
<td align="center">test str1 = str2</td>
<td>判定 str1 是否等於 str2 ，若相等，則回傳 true</td>
</tr>
<tr>
<td align="center">test str1 != str2</td>
<td>判定 str1 是否不等於 str2 ，若相等，則回傳 false</td>
</tr>
<tr bgcolor="lightblue">
<td colspan="2">6. 多重條件判定，例如： test -r filename -a -x filename</td>
</tr>
<tr>
<td align="center">-a</td>
<td>(and)兩狀況同時成立！例如 test -r file -a -x file，則 file 同時具有 r 與 x 權限時，才回傳 true。</td>
</tr>
<tr>
<td align="center">-o</td>
<td>(or)兩狀況任何一個成立！例如 test -r file -o -x file，則 file 具有 r 或 x 權限時，就可回傳 true。</td>
</tr>
<tr>
<td align="center">!</td>
<td>反相狀態，如 test ! -x file ，當 file 不具有 x 時，回傳 true</td>
</tr>
</tbody>
</table>
<h2>case语法</h2>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">case</span>  $變數名稱 <span style="color: #000000; font-weight: bold;">in</span>   <span style="color: #000000; font-weight: bold;">&amp;</span>lt;==關鍵字為 <span style="color: #000000; font-weight: bold;">case</span> ，還有變數前有錢字號
  <span style="color: #ff0000;">&quot;第一個變數內容&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>   <span style="color: #000000; font-weight: bold;">&amp;</span>lt;==每個變數內容建議用雙引號括起來，關鍵字則為小括號 <span style="color: #7a0874; font-weight: bold;">&#41;</span>
	程式段
	<span style="color: #000000; font-weight: bold;">;;</span>            <span style="color: #000000; font-weight: bold;">&amp;</span>lt;==每個類別結尾使用兩個連續的分號來處理！
  <span style="color: #ff0000;">&quot;第二個變數內容&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
	程式段
	<span style="color: #000000; font-weight: bold;">;;</span>
  <span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>                  <span style="color: #000000; font-weight: bold;">&amp;</span>lt;==最後一個變數內容都會用 <span style="color: #000000; font-weight: bold;">*</span> 來代表所有其他值
	不包含第一個變數內容與第二個變數內容的其他程式執行段
	<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
	<span style="color: #000000; font-weight: bold;">;;</span>
<span style="color: #000000; font-weight: bold;">esac</span>                  <span style="color: #000000; font-weight: bold;">&amp;</span>lt;==最終的 <span style="color: #000000; font-weight: bold;">case</span> 結尾！『反過來寫』思考一下！</pre></div></div>

<h2>while语法</h2>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">while</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> condition <span style="color: #7a0874; font-weight: bold;">&#93;</span>  <span style="color: #000000; font-weight: bold;">&amp;</span>lt;==中括號內的狀態就是判斷式
<span style="color: #000000; font-weight: bold;">do</span>            <span style="color: #000000; font-weight: bold;">&amp;</span>lt;==<span style="color: #000000; font-weight: bold;">do</span> 是迴圈的開始！
	程式段落
<span style="color: #000000; font-weight: bold;">done</span>          <span style="color: #000000; font-weight: bold;">&amp;</span>lt;==<span style="color: #000000; font-weight: bold;">done</span> 是迴圈的結束</pre></div></div>

<h2>for&#8230;do&#8230;done语法</h2>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">for</span> var <span style="color: #000000; font-weight: bold;">in</span> con1 con2 con3 ...
<span style="color: #000000; font-weight: bold;">do</span>
	程式段
<span style="color: #000000; font-weight: bold;">done</span></pre></div></div>

<p>参考以及大部分内容来自：http://linux.vbird.org/linux_basic/0320bash.php</p>
]]></content:encoded>
			<wfw:commentRss>http://fatkun.com/2012/03/linux-shell.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Extjs3 PagingToolbar下拉框分页插件</title>
		<link>http://fatkun.com/2012/03/extjs3-pagingtoolbar-combbox.html</link>
		<comments>http://fatkun.com/2012/03/extjs3-pagingtoolbar-combbox.html#comments</comments>
		<pubDate>Sun, 11 Mar 2012 17:37:40 +0000</pubDate>
		<dc:creator>fatkun</dc:creator>
				<category><![CDATA[网页前端]]></category>
		<category><![CDATA[combbox]]></category>
		<category><![CDATA[extjs]]></category>
		<category><![CDATA[paging]]></category>
		<category><![CDATA[分页]]></category>

		<guid isPermaLink="false">http://fatkun.com/?p=1067</guid>
		<description><![CDATA[Extjs PagingToolbar下拉框分页插件 Ext.namespace&#40;'Ext.ui.plugins'&#41;; &#160; Ext.ui.plugins.ComboPageSize = function&#40;config&#41; &#123; Ext.apply&#40;this, config&#41;; &#125;; &#160; Ext.extend&#40;Ext.ui.plugins.ComboPageSize, Ext.util.Observable, &#123; &#160; pageSizes: &#91;25, 50, 100, 200, 500&#93;, prefixText: '每页显示', postfixText: '条', addToItem: true, //true添加到items中去，配合index；false则直接添加到最后 index: 10, //在items中的位置 init: function&#40;pagingToolbar&#41; &#123; var ps = this.pageSizes; var combo = new Ext.form.ComboBox&#40;&#123; typeAhead: true, triggerAction: 'all', lazyRender: true, mode: 'local', width: 80, store: [...]]]></description>
			<content:encoded><![CDATA[<p>Extjs PagingToolbar下拉框分页插件</p>

<div class="wp_syntax"><div class="code"><pre class="js" style="font-family:monospace;">Ext.<span style="color: #003366; font-weight: bold;">namespace</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Ext.ui.plugins'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
 Ext.<span style="color: #660066;">ui</span>.<span style="color: #660066;">plugins</span>.<span style="color: #660066;">ComboPageSize</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>config<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
     Ext.<span style="color: #660066;">apply</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">,</span> config<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
 Ext.<span style="color: #660066;">extend</span><span style="color: #009900;">&#40;</span>Ext.<span style="color: #660066;">ui</span>.<span style="color: #660066;">plugins</span>.<span style="color: #660066;">ComboPageSize</span><span style="color: #339933;">,</span> Ext.<span style="color: #660066;">util</span>.<span style="color: #660066;">Observable</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
&nbsp;
     pageSizes<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><span style="color: #CC0000;">25</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">50</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">100</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">200</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">500</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
     prefixText<span style="color: #339933;">:</span> <span style="color: #3366CC;">'每页显示'</span><span style="color: #339933;">,</span>
     postfixText<span style="color: #339933;">:</span> <span style="color: #3366CC;">'条'</span><span style="color: #339933;">,</span>
     addToItem<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>    <span style="color: #006600; font-style: italic;">//true添加到items中去，配合index；false则直接添加到最后</span>
     index<span style="color: #339933;">:</span> <span style="color: #CC0000;">10</span><span style="color: #339933;">,</span>           <span style="color: #006600; font-style: italic;">//在items中的位置</span>
     init<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>pagingToolbar<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
         <span style="color: #003366; font-weight: bold;">var</span> ps <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">pageSizes</span><span style="color: #339933;">;</span>
         <span style="color: #003366; font-weight: bold;">var</span> combo <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Ext.<span style="color: #660066;">form</span>.<span style="color: #660066;">ComboBox</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
             typeAhead<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>
             triggerAction<span style="color: #339933;">:</span> <span style="color: #3366CC;">'all'</span><span style="color: #339933;">,</span>
             lazyRender<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>
             mode<span style="color: #339933;">:</span> <span style="color: #3366CC;">'local'</span><span style="color: #339933;">,</span>
             width<span style="color: #339933;">:</span> <span style="color: #CC0000;">80</span><span style="color: #339933;">,</span>
             store<span style="color: #339933;">:</span> ps<span style="color: #339933;">,</span>
             enableKeyEvents<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>
             editable<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">,</span>
             loadPages<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                 <span style="color: #003366; font-weight: bold;">var</span> rowIndex <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
                 <span style="color: #003366; font-weight: bold;">var</span> gp <span style="color: #339933;">=</span> pagingToolbar.<span style="color: #660066;">findParentBy</span><span style="color: #009900;">&#40;</span>
                                 <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>ct<span style="color: #339933;">,</span> cmp<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #009900;">&#40;</span>ct <span style="color: #000066; font-weight: bold;">instanceof</span> Ext.<span style="color: #660066;">grid</span>.<span style="color: #660066;">GridPanel</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">?</span> <span style="color: #003366; font-weight: bold;">true</span> <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
                               <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                 <span style="color: #003366; font-weight: bold;">var</span> sm <span style="color: #339933;">=</span> gp.<span style="color: #660066;">getSelectionModel</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                 <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>undefined <span style="color: #339933;">!=</span> sm <span style="color: #339933;">&amp;&amp;</span> sm.<span style="color: #660066;">hasSelection</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                     <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>sm <span style="color: #000066; font-weight: bold;">instanceof</span> Ext.<span style="color: #660066;">grid</span>.<span style="color: #660066;">RowSelectionModel</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                         rowIndex <span style="color: #339933;">=</span> gp.<span style="color: #660066;">store</span>.<span style="color: #660066;">indexOf</span><span style="color: #009900;">&#40;</span>sm.<span style="color: #660066;">getSelected</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                     <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>sm <span style="color: #000066; font-weight: bold;">instanceof</span> Ext.<span style="color: #660066;">grid</span>.<span style="color: #660066;">CellSelectionModel</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                         rowIndex <span style="color: #339933;">=</span> sm.<span style="color: #660066;">getSelectedCell</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                     <span style="color: #009900;">&#125;</span>
                 <span style="color: #009900;">&#125;</span>
                 rowIndex <span style="color: #339933;">+=</span> pagingToolbar.<span style="color: #660066;">cursor</span><span style="color: #339933;">;</span>
                 pagingToolbar.<span style="color: #660066;">doLoad</span><span style="color: #009900;">&#40;</span>Math.<span style="color: #660066;">floor</span><span style="color: #009900;">&#40;</span>rowIndex <span style="color: #339933;">/</span> pagingToolbar.<span style="color: #660066;">pageSize</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> pagingToolbar.<span style="color: #660066;">pageSize</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
             <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
             listeners<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
                 select<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>c<span style="color: #339933;">,</span> r<span style="color: #339933;">,</span> i<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                     pagingToolbar.<span style="color: #660066;">pageSize</span> <span style="color: #339933;">=</span> ps<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                     <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">loadPages</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                 <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
                 <span style="color: #000066;">blur</span><span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                     <span style="color: #003366; font-weight: bold;">var</span> pagesizeTemp <span style="color: #339933;">=</span> Number<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">getValue</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                     <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>isNaN<span style="color: #009900;">&#40;</span>pagesizeTemp<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                         <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">setValue</span><span style="color: #009900;">&#40;</span>pagingToolbar.<span style="color: #660066;">pageSize</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                         <span style="color: #000066; font-weight: bold;">return</span><span style="color: #339933;">;</span>
                     <span style="color: #009900;">&#125;</span>
                     pagingToolbar.<span style="color: #660066;">pageSize</span> <span style="color: #339933;">=</span> Number<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">getValue</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                     <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">loadPages</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                 <span style="color: #009900;">&#125;</span>
             <span style="color: #009900;">&#125;</span>
         <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
         <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">addToItem</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
             <span style="color: #003366; font-weight: bold;">var</span> inputIndex <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">index</span><span style="color: #339933;">;</span>
             <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>inputIndex <span style="color: #339933;">&gt;</span> pagingToolbar.<span style="color: #660066;">items</span>.<span style="color: #660066;">length</span><span style="color: #009900;">&#41;</span> inputIndex <span style="color: #339933;">=</span> pagingToolbar.<span style="color: #660066;">items</span>.<span style="color: #660066;">length</span><span style="color: #339933;">;</span>
             pagingToolbar.<span style="color: #660066;">insert</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">++</span>inputIndex<span style="color: #339933;">,</span> <span style="color: #3366CC;">'-'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
             pagingToolbar.<span style="color: #660066;">insert</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">++</span>inputIndex<span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">prefixText</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
             pagingToolbar.<span style="color: #660066;">insert</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">++</span>inputIndex<span style="color: #339933;">,</span> combo<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
             pagingToolbar.<span style="color: #660066;">insert</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">++</span>inputIndex<span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">postfixText</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
         <span style="color: #009900;">&#125;</span>
         <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
             pagingToolbar.<span style="color: #660066;">add</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'-'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
             pagingToolbar.<span style="color: #660066;">add</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">prefixText</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
             pagingToolbar.<span style="color: #660066;">add</span><span style="color: #009900;">&#40;</span>combo<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
             pagingToolbar.<span style="color: #660066;">add</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">postfixText</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
         <span style="color: #009900;">&#125;</span>
         pagingToolbar.<span style="color: #660066;">on</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
             beforedestroy<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                 combo.<span style="color: #660066;">destroy</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
             <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
             change<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                 combo.<span style="color: #660066;">setValue</span><span style="color: #009900;">&#40;</span>pagingToolbar.<span style="color: #660066;">pageSize</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
             <span style="color: #009900;">&#125;</span>
         <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
     <span style="color: #009900;">&#125;</span>
 <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span></pre></div></div>

<h2>使用方法</h2>

<div class="wp_syntax"><div class="code"><pre class="js" style="font-family:monospace;">                bbar<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">new</span> Ext.<span style="color: #660066;">PagingToolbar</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
                    plugins<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">new</span> Ext.<span style="color: #660066;">ui</span>.<span style="color: #660066;">plugins</span>.<span style="color: #660066;">ComboPageSize</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
                    pageSize<span style="color: #339933;">:</span> myPageSize<span style="color: #339933;">,</span>
                    displayInfo <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>
                    displayMsg <span style="color: #339933;">:</span> <span style="color: #3366CC;">'当前记录数: {0} - {1} 总记录数: {2}'</span><span style="color: #339933;">,</span>   
                    emptyMsg <span style="color: #339933;">:</span> <span style="color: #3366CC;">'没有符合条件的记录'</span><span style="color: #339933;">,</span>   
                    store <span style="color: #339933;">:</span> config.<span style="color: #660066;">store</span>
                <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span></pre></div></div>

<p>来源：<a href="http://www.cnblogs.com/badwps/archive/2011/04/15/2016440.html" title="Ext.PagingToolbar设置每页显示条数插件" target="_blank">Ext.PagingToolbar设置每页显示条数插件</a><br />
作者还有个滑动条改变分页的，赞，链接过去看吧。</p>
]]></content:encoded>
			<wfw:commentRss>http://fatkun.com/2012/03/extjs3-pagingtoolbar-combbox.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>hue runcpserver has restarted more than 3 times</title>
		<link>http://fatkun.com/2012/03/hue-runcpserver-has-restarted-more-than-3-times.html</link>
		<comments>http://fatkun.com/2012/03/hue-runcpserver-has-restarted-more-than-3-times.html#comments</comments>
		<pubDate>Tue, 06 Mar 2012 17:07:38 +0000</pubDate>
		<dc:creator>fatkun</dc:creator>
				<category><![CDATA[未分类]]></category>
		<category><![CDATA[hue]]></category>

		<guid isPermaLink="false">http://fatkun.com/?p=1062</guid>
		<description><![CDATA[运行hue时，~/hue/build/env/bin$ ./supervisor 遇到这个错误，查看logs可以看到这句： runcpserver has restarted more than 3 times 解决方法 更改hue/desktop/conf/hue.ini配置 # Set to true to use CherryPy as the webserver, set to false # to use Spawning as the webserver. Defaults to Spawning if # key is not specified. use_cherrypy_server = true 去掉注释并改为true 默认为Spawning，不知道我错误的原因。。不过盖茨用cherrypy就正常了。 如果需要用beeswax还需要配置hue_beeswax.ini，把注释去掉就可以了。]]></description>
			<content:encoded><![CDATA[<p>运行hue时，~/hue/build/env/bin$ ./supervisor 遇到这个错误，查看logs可以看到这句：</p>
<blockquote><p>runcpserver has restarted more than 3 times</p></blockquote>
<h2>解决方法</h2>
<p>更改hue/desktop/conf/hue.ini配置<br />
# Set to true to use CherryPy as the webserver, set to false<br />
# to use Spawning as the webserver. Defaults to Spawning if<br />
# key is not specified.<br />
 use_cherrypy_server = true</p>
<p>去掉注释并改为true<br />
默认为Spawning，不知道我错误的原因。。不过盖茨用cherrypy就正常了。<br />
如果需要用beeswax还需要配置hue_beeswax.ini，把注释去掉就可以了。</p>
]]></content:encoded>
			<wfw:commentRss>http://fatkun.com/2012/03/hue-runcpserver-has-restarted-more-than-3-times.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss><!-- Dynamic page generated in 2.749 seconds. --><!-- Cached page generated by WP-Super-Cache on 2012-05-27 10:53:11 -->

