<?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>vifix.cn</title>
	<atom:link href="http://vifix.cn/blog/feed" rel="self" type="application/rss+xml" />
	<link>http://vifix.cn/blog</link>
	<description>compile the dream, compile tomorrow</description>
	<lastBuildDate>Tue, 15 May 2012 11:42:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>CentOS 安装 KVM 因 nc.openbsd 不存在导致无法使用远程 virt-manager 连接的问题</title>
		<link>http://vifix.cn/blog/centos-6-2-install-kvm-remote-virt-manager-nc-openbsd-exception.html</link>
		<comments>http://vifix.cn/blog/centos-6-2-install-kvm-remote-virt-manager-nc-openbsd-exception.html#comments</comments>
		<pubDate>Tue, 15 May 2012 07:36:42 +0000</pubDate>
		<dc:creator>Mac</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[KVM]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://vifix.cn/blog/?p=2321</guid>
		<description><![CDATA[这两天公司里面准备配置一台专门的机器作为开发这边的共同测试环境 虽然前段时间早就配置过真实的生产环境机器的kvm，但是发现这次有些东西还是想不起来了，所以还是记录一下 安装KVM本身没什么，在yum的帮助下完成即可： yum install libvirt kvm 就行了，然后使用modprobe加载下kvm模块，并且启动libvirtd服务（或者重启也可以） 但是在接下去的用远程的virt-manager连接的时候会碰到远程管理无法连接的问题，使用virt-manager &#8211;debug可以看到错误输出如下： 2012-05-14 20:35:10,068 (connection:991): Scheduling background open thread for qemu+ssh://root@hxdev/system 2012-05-14 20:35:10,068 (connection:1177): Background &#8216;open connection&#8217; thread is running 2012-05-14 20:35:10,095 (connection:1227): Background open thread complete, scheduling notify 2012-05-14 20:35:10,096 (connection:1232): Notifying open result 2012-05-14 20:35:10,096 (create:158): Closing new vm wizard 2012-05-14 20:35:10,097 (storagebrowse:80): Closing storage [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://vifix.cn/blog/wp-content/uploads/2012/05/virt-manager-kvm.png" rel="shadowbox[sbpost-2321];player=img;" title="virt-manager-kvm"><img class="alignnone size-medium wp-image-2363" title="virt-manager-kvm" src="http://vifix.cn/blog/wp-content/uploads/2012/05/virt-manager-kvm-300x240.png" alt="" width="300" height="240" /></a></p>
<p>这两天公司里面准备配置一台专门的机器作为开发这边的共同测试环境</p>
<p>虽然前段时间早就配置过真实的生产环境机器的kvm，但是发现这次有些东西还是想不起来了，所以还是记录一下</p>
<p>安装KVM本身没什么，在yum的帮助下完成即可：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">yum <span style="color: #c20cb9; font-weight: bold;">install</span> libvirt kvm</pre></div></div>

<p>就行了，然后使用modprobe加载下kvm模块，并且启动libvirtd服务（或者重启也可以）</p>
<p>但是在接下去的用远程的virt-manager连接的时候会碰到远程管理无法连接的问题，使用virt-manager &#8211;debug可以看到错误输出如下：<br />
<span id="more-2321"></span></p>
<blockquote><p>2012-05-14 20:35:10,068 (connection:991): Scheduling background open thread for qemu+ssh://root@hxdev/system<br />
2012-05-14 20:35:10,068 (connection:1177): Background &#8216;open connection&#8217; thread is running<br />
2012-05-14 20:35:10,095 (connection:1227): Background open thread complete, scheduling notify<br />
2012-05-14 20:35:10,096 (connection:1232): Notifying open result<br />
2012-05-14 20:35:10,096 (create:158): Closing new vm wizard<br />
2012-05-14 20:35:10,097 (storagebrowse:80): Closing storage browser<br />
2012-05-14 20:35:10,097 (createvol:80): Closing new volume wizard<br />
2012-05-14 20:35:10,100 (cli:83): Uncaught exception:<br />
Traceback (most recent call last):<br />
File &#8220;/usr/share/virt-manager/virtManager/manager.py&#8221;, line 665, in _connect_error<br />
if conn.is_remote() and re.search(r&#8221;nc.openbsd: .* &#8212; &#8216;U&#8217;&#8221;, details):<br />
UnboundLocalError: local variable &#8216;details&#8217; referenced before assignment</p>
<p>Traceback (most recent call last):<br />
File &#8220;/usr/share/virt-manager/virtManager/manager.py&#8221;, line 665, in _connect_error<br />
if conn.is_remote() and re.search(r&#8221;nc.openbsd: .* &#8212; &#8216;U&#8217;&#8221;, details):<br />
UnboundLocalError: local variable &#8216;details&#8217; referenced before assignment</p></blockquote>
<p>原因是virtmanager依赖的nc.openbsd不存在，但实际上nc（netcat）在CentOS中是有的，所以只要在服务器上为nc建立一个符号链接即可：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</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>nc <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>nc.openbsd</pre></div></div>

<p>小TIP: virt-manager貌似bug还不少，很多时候实际发生错误的时候它都不会报错，如果你在使用它连接远程的时候，connect发现毫无动静，那就说明实际上已经出错了，可以通过virt-manager &#8211;debug进行查看。先前靠着这个信息还发现了一个变量在使用前没有初始化的问题，可见其代码质量并不是很好……</p>
<p>可以参考此文：<a href="http://korprulu.blogspot.com/2011/05/virt-manager-problem-in-archlinux.html" target="_blank" onclick="pageTracker._trackPageview('/outgoing/korprulu.blogspot.com/2011/05/virt-manager-problem-in-archlinux.html?referer=');">http://korprulu.blogspot.com/2011/05/virt-manager-problem-in-archlinux.html</a> （讲的也是上面的问题，当时找这个错误的原因花了好久……）</p>
]]></content:encoded>
			<wfw:commentRss>http://vifix.cn/blog/centos-6-2-install-kvm-remote-virt-manager-nc-openbsd-exception.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>简单的ssh-copy-id脚本(for osx)</title>
		<link>http://vifix.cn/blog/simple-ssh-copy-id-osx.html</link>
		<comments>http://vifix.cn/blog/simple-ssh-copy-id-osx.html#comments</comments>
		<pubDate>Fri, 04 May 2012 06:40:22 +0000</pubDate>
		<dc:creator>Mac</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[OSX]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://vifix.cn/blog/?p=2355</guid>
		<description><![CDATA[Mac OS X没有ssh-copy-id，要对目标服务器上传一个公钥很麻烦，所以自己简单写了个，没什么技术含量，只是放上来方便下大家 #!/bin/bash &#160; #uncomment this for debug #set -x &#160; if &#91;&#91; &#34;$1&#34; =~ .+@.+ &#93;&#93;; then user=`echo &#34;$1&#34; &#124; cut -d @ -f 1` host=`echo &#34;$1&#34; &#124; cut -d @ -f 2` echo &#34;user: $user&#34; echo &#34;host: $host&#34; ssh $1 &#34;echo \&#34;`cat ~/.ssh/id_rsa.pub`\&#34; &#62;&#62; \$HOME/.ssh/authorized_keys&#34; echo &#34;done&#34; exit 0 else echo &#34;parameter [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://vifix.cn/blog/wp-content/uploads/2012/05/openssh.gif" rel="shadowbox[sbpost-2355];player=img;" title="openssh"><img src="http://vifix.cn/blog/wp-content/uploads/2012/05/openssh-300x99.gif" alt="" title="openssh" width="300" height="99" class="alignnone size-medium wp-image-2356" /></a></p>
<p>Mac OS X没有ssh-copy-id，要对目标服务器上传一个公钥很麻烦，所以自己简单写了个，没什么技术含量，只是放上来方便下大家</p>
<p><span id="more-2355"></span></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;">#uncomment this for debug</span>
<span style="color: #666666; font-style: italic;">#set -x</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;$1&quot;</span> =~ .+<span style="color: #000000; font-weight: bold;">@</span>.+ <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #007800;">user</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cut</span> <span style="color: #660033;">-d</span> <span style="color: #000000; font-weight: bold;">@</span> <span style="color: #660033;">-f</span> <span style="color: #000000;">1</span><span style="color: #000000; font-weight: bold;">`</span>
	<span style="color: #007800;">host</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cut</span> <span style="color: #660033;">-d</span> <span style="color: #000000; font-weight: bold;">@</span> <span style="color: #660033;">-f</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">`</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;user: <span style="color: #007800;">$user</span>&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;host: <span style="color: #007800;">$host</span>&quot;</span>
	<span style="color: #c20cb9; font-weight: bold;">ssh</span> <span style="color: #007800;">$1</span> <span style="color: #ff0000;">&quot;echo <span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #780078;">`cat ~/.ssh/id_rsa.pub`</span><span style="color: #000099; font-weight: bold;">\&quot;</span> &gt;&gt; <span style="color: #000099; font-weight: bold;">\$</span>HOME/.ssh/authorized_keys&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;done&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span>
<span style="color: #000000; font-weight: bold;">else</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;parameter should be a string like user@host&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">fi</span></pre></div></div>

<p>可以看到只考虑了最普遍的情况，如果有更进一步的需求可以在这个上面修改。</p>
]]></content:encoded>
			<wfw:commentRss>http://vifix.cn/blog/simple-ssh-copy-id-osx.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Coreseek在GCC 4.7上编译不通过的问题</title>
		<link>http://vifix.cn/blog/coreseek-cant-make-in-gcc-4-7-enviroment.html</link>
		<comments>http://vifix.cn/blog/coreseek-cant-make-in-gcc-4-7-enviroment.html#comments</comments>
		<pubDate>Mon, 16 Apr 2012 06:31:35 +0000</pubDate>
		<dc:creator>Mac</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Coreseek]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://vifix.cn/blog/?p=2342</guid>
		<description><![CDATA[今天在archlinux在安装coreseek 4.1-beta时碰到的问题，在g++编译sphinxexpr.cpp时： &#160; g++ -DHAVE_CONFIG_H -I. -I../config -DSYSCONFDIR=&#34;\&#34;/opt/coreseek-3.2.14/etc\&#34;&#34; -DDATADIR=&#34;\&#34;/opt/coreseek-3.2.14/var/data\&#34;&#34; -I/usr/local/include -pthread -I/usr/include/mysql -fPIC -pipe -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 -fno-strict-aliasing -DBIG_JOINS=1 -fomit-frame-pointer -g -I/opt/mmseg-3.2.14/include/mmseg/ -Wall -g -D_FILE_OFFSET_BITS=64 -O3 -DNDEBUG -MT sphinxexpr.o -MD -MP -MF .deps/sphinxexpr.Tpo -c -o sphinxexpr.o sphinxexpr.cpp sphinxexpr.cpp: In constructor ‘ExprParser_t::ExprParser_t&#40;CSphSchema*, ISphExprHook*&#41;’: sphinxexpr.cpp:742:17: warning: ‘ExprParser_t::m_pExtra’ will be initialized after &#91;-Wreorder&#93; sphinxexpr.cpp:711:19: warning: ‘ISphExprHook* ExprParser_t::m_pHook’ &#91;-Wreorder&#93; [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://vifix.cn/blog/wp-content/uploads/2012/04/coreseek.gif" rel="shadowbox[sbpost-2342];player=img;" title="coreseek"><img src="http://vifix.cn/blog/wp-content/uploads/2012/04/coreseek.gif" alt="" title="coreseek" width="180" height="55" class="alignnone size-full wp-image-2344" /></a></p>
<p>今天在archlinux在安装coreseek 4.1-beta时碰到的问题，在g++编译sphinxexpr.cpp时：</p>
<p><span id="more-2342"></span></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">&nbsp;
<span style="color: #c20cb9; font-weight: bold;">g++</span> -DHAVE_CONFIG_H -I. -I..<span style="color: #000000; font-weight: bold;">/</span>config  <span style="color: #660033;">-DSYSCONFDIR</span>=<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span>/opt/coreseek-3.2.14/etc<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span> <span style="color: #660033;">-DDATADIR</span>=<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span>/opt/coreseek-3.2.14/var/data<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span> -I<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>include <span style="color: #660033;">-pthread</span> -I<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>include<span style="color: #000000; font-weight: bold;">/</span>mysql <span style="color: #660033;">-fPIC</span> <span style="color: #660033;">-pipe</span> <span style="color: #660033;">-fstack-protector</span> <span style="color: #660033;">--param</span>=ssp-buffer-size=<span style="color: #000000;">4</span> -D_FORTIFY_SOURCE=<span style="color: #000000;">2</span> <span style="color: #660033;">-fno-strict-aliasing</span> -DBIG_JOINS=<span style="color: #000000;">1</span> <span style="color: #660033;">-fomit-frame-pointer</span>  <span style="color: #660033;">-g</span>  -I<span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>mmseg-3.2.14<span style="color: #000000; font-weight: bold;">/</span>include<span style="color: #000000; font-weight: bold;">/</span>mmseg<span style="color: #000000; font-weight: bold;">/</span>   <span style="color: #660033;">-Wall</span> <span style="color: #660033;">-g</span> -D_FILE_OFFSET_BITS=<span style="color: #000000;">64</span> <span style="color: #660033;">-O3</span> <span style="color: #660033;">-DNDEBUG</span> <span style="color: #660033;">-MT</span> sphinxexpr.o <span style="color: #660033;">-MD</span> <span style="color: #660033;">-MP</span> <span style="color: #660033;">-MF</span> .deps<span style="color: #000000; font-weight: bold;">/</span>sphinxexpr.Tpo <span style="color: #660033;">-c</span> <span style="color: #660033;">-o</span> sphinxexpr.o sphinxexpr.cpp
sphinxexpr.cpp: In constructor ‘ExprParser_t::ExprParser_t<span style="color: #7a0874; font-weight: bold;">&#40;</span>CSphSchema<span style="color: #000000; font-weight: bold;">*</span>, ISphExprHook<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>’:
sphinxexpr.cpp:<span style="color: #000000;">742</span>:<span style="color: #000000;">17</span>: warning: ‘ExprParser_t::m_pExtra’ will be initialized after <span style="color: #7a0874; font-weight: bold;">&#91;</span>-Wreorder<span style="color: #7a0874; font-weight: bold;">&#93;</span>
sphinxexpr.cpp:<span style="color: #000000;">711</span>:<span style="color: #000000;">19</span>: warning:   ‘ISphExprHook<span style="color: #000000; font-weight: bold;">*</span> ExprParser_t::m_pHook’ <span style="color: #7a0874; font-weight: bold;">&#91;</span>-Wreorder<span style="color: #7a0874; font-weight: bold;">&#93;</span>
sphinxexpr.cpp:<span style="color: #000000;">698</span>:<span style="color: #000000;">2</span>: warning:   when initialized here <span style="color: #7a0874; font-weight: bold;">&#91;</span>-Wreorder<span style="color: #7a0874; font-weight: bold;">&#93;</span>
sphinxexpr.cpp: In instantiation of ‘int Expr_In_c<span style="color: #000000; font-weight: bold;">&lt;</span>T<span style="color: #000000; font-weight: bold;">&gt;</span>::IntEval<span style="color: #7a0874; font-weight: bold;">&#40;</span>const CSphMatch<span style="color: #000000; font-weight: bold;">&amp;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> const <span style="color: #7a0874; font-weight: bold;">&#91;</span>with T = float<span style="color: #7a0874; font-weight: bold;">&#93;</span>’:
sphinxexpr.cpp:<span style="color: #000000;">3152</span>:<span style="color: #000000;">1</span>:   required from here
sphinxexpr.cpp:<span style="color: #000000;">1823</span>:<span style="color: #000000;">43</span>: error: ‘ExprEval’ was not declared <span style="color: #000000; font-weight: bold;">in</span> this scope, and no declarations were found by argument-dependent lookup at the point of instantiation <span style="color: #7a0874; font-weight: bold;">&#91;</span>-fpermissive<span style="color: #7a0874; font-weight: bold;">&#93;</span>
sphinxexpr.cpp:<span style="color: #000000;">1823</span>:<span style="color: #000000;">43</span>: note: declarations <span style="color: #000000; font-weight: bold;">in</span> dependent base ‘Expr_ArgVsSet_c<span style="color: #000000; font-weight: bold;">&lt;</span>float<span style="color: #000000; font-weight: bold;">&gt;</span>’ are not found by unqualified lookup
sphinxexpr.cpp:<span style="color: #000000;">1823</span>:<span style="color: #000000;">43</span>: note: use ‘this-<span style="color: #000000; font-weight: bold;">&gt;</span>ExprEval’ instead
sphinxexpr.cpp: In instantiation of ‘int Expr_In_c<span style="color: #000000; font-weight: bold;">&lt;</span>T<span style="color: #000000; font-weight: bold;">&gt;</span>::IntEval<span style="color: #7a0874; font-weight: bold;">&#40;</span>const CSphMatch<span style="color: #000000; font-weight: bold;">&amp;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> const <span style="color: #7a0874; font-weight: bold;">&#91;</span>with T = long long int<span style="color: #7a0874; font-weight: bold;">&#93;</span>’:
sphinxexpr.cpp:<span style="color: #000000;">3152</span>:<span style="color: #000000;">1</span>:   required from here
sphinxexpr.cpp:<span style="color: #000000;">1823</span>:<span style="color: #000000;">43</span>: error: ‘ExprEval’ was not declared <span style="color: #000000; font-weight: bold;">in</span> this scope, and no declarations were found by argument-dependent lookup at the point of instantiation <span style="color: #7a0874; font-weight: bold;">&#91;</span>-fpermissive<span style="color: #7a0874; font-weight: bold;">&#93;</span>
sphinxexpr.cpp:<span style="color: #000000;">1823</span>:<span style="color: #000000;">43</span>: note: declarations <span style="color: #000000; font-weight: bold;">in</span> dependent base ‘Expr_ArgVsSet_c<span style="color: #000000; font-weight: bold;">&lt;</span>long long int<span style="color: #000000; font-weight: bold;">&gt;</span>’ are not found by unqualified lookup
sphinxexpr.cpp:<span style="color: #000000;">1823</span>:<span style="color: #000000;">43</span>: note: use ‘this-<span style="color: #000000; font-weight: bold;">&gt;</span>ExprEval’ instead
sphinxexpr.cpp: In instantiation of ‘int Expr_In_c<span style="color: #000000; font-weight: bold;">&lt;</span>T<span style="color: #000000; font-weight: bold;">&gt;</span>::IntEval<span style="color: #7a0874; font-weight: bold;">&#40;</span>const CSphMatch<span style="color: #000000; font-weight: bold;">&amp;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> const <span style="color: #7a0874; font-weight: bold;">&#91;</span>with T = int<span style="color: #7a0874; font-weight: bold;">&#93;</span>’:
sphinxexpr.cpp:<span style="color: #000000;">3152</span>:<span style="color: #000000;">1</span>:   required from here
sphinxexpr.cpp:<span style="color: #000000;">1823</span>:<span style="color: #000000;">43</span>: error: ‘ExprEval’ was not declared <span style="color: #000000; font-weight: bold;">in</span> this scope, and no declarations were found by argument-dependent lookup at the point of instantiation <span style="color: #7a0874; font-weight: bold;">&#91;</span>-fpermissive<span style="color: #7a0874; font-weight: bold;">&#93;</span>
sphinxexpr.cpp:<span style="color: #000000;">1823</span>:<span style="color: #000000;">43</span>: note: declarations <span style="color: #000000; font-weight: bold;">in</span> dependent base ‘Expr_ArgVsSet_c<span style="color: #000000; font-weight: bold;">&lt;</span>int<span style="color: #000000; font-weight: bold;">&gt;</span>’ are not found by unqualified lookup
sphinxexpr.cpp:<span style="color: #000000;">1823</span>:<span style="color: #000000;">43</span>: note: use ‘this-<span style="color: #000000; font-weight: bold;">&gt;</span>ExprEval’ instead
sphinxexpr.cpp: In instantiation of ‘int Expr_Interval_c<span style="color: #000000; font-weight: bold;">&lt;</span>T<span style="color: #000000; font-weight: bold;">&gt;</span>::IntEval<span style="color: #7a0874; font-weight: bold;">&#40;</span>const CSphMatch<span style="color: #000000; font-weight: bold;">&amp;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> const <span style="color: #7a0874; font-weight: bold;">&#91;</span>with T = float<span style="color: #7a0874; font-weight: bold;">&#93;</span>’:
sphinxexpr.cpp:<span style="color: #000000;">3152</span>:<span style="color: #000000;">1</span>:   required from here
sphinxexpr.cpp:<span style="color: #000000;">1777</span>:<span style="color: #000000;">43</span>: error: ‘ExprEval’ was not declared <span style="color: #000000; font-weight: bold;">in</span> this scope, and no declarations were found by argument-dependent lookup at the point of instantiation <span style="color: #7a0874; font-weight: bold;">&#91;</span>-fpermissive<span style="color: #7a0874; font-weight: bold;">&#93;</span>
sphinxexpr.cpp:<span style="color: #000000;">1777</span>:<span style="color: #000000;">43</span>: note: declarations <span style="color: #000000; font-weight: bold;">in</span> dependent base ‘Expr_ArgVsSet_c<span style="color: #000000; font-weight: bold;">&lt;</span>float<span style="color: #000000; font-weight: bold;">&gt;</span>’ are not found by unqualified lookup
sphinxexpr.cpp:<span style="color: #000000;">1777</span>:<span style="color: #000000;">43</span>: note: use ‘this-<span style="color: #000000; font-weight: bold;">&gt;</span>ExprEval’ instead
sphinxexpr.cpp: In instantiation of ‘int Expr_Interval_c<span style="color: #000000; font-weight: bold;">&lt;</span>T<span style="color: #000000; font-weight: bold;">&gt;</span>::IntEval<span style="color: #7a0874; font-weight: bold;">&#40;</span>const CSphMatch<span style="color: #000000; font-weight: bold;">&amp;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> const <span style="color: #7a0874; font-weight: bold;">&#91;</span>with T = long long int<span style="color: #7a0874; font-weight: bold;">&#93;</span>’:
sphinxexpr.cpp:<span style="color: #000000;">3152</span>:<span style="color: #000000;">1</span>:   required from here
sphinxexpr.cpp:<span style="color: #000000;">1777</span>:<span style="color: #000000;">43</span>: error: ‘ExprEval’ was not declared <span style="color: #000000; font-weight: bold;">in</span> this scope, and no declarations were found by argument-dependent lookup at the point of instantiation <span style="color: #7a0874; font-weight: bold;">&#91;</span>-fpermissive<span style="color: #7a0874; font-weight: bold;">&#93;</span>
sphinxexpr.cpp:<span style="color: #000000;">1777</span>:<span style="color: #000000;">43</span>: note: declarations <span style="color: #000000; font-weight: bold;">in</span> dependent base ‘Expr_ArgVsSet_c<span style="color: #000000; font-weight: bold;">&lt;</span>long long int<span style="color: #000000; font-weight: bold;">&gt;</span>’ are not found by unqualified lookup
sphinxexpr.cpp:<span style="color: #000000;">1777</span>:<span style="color: #000000;">43</span>: note: use ‘this-<span style="color: #000000; font-weight: bold;">&gt;</span>ExprEval’ instead
sphinxexpr.cpp: In instantiation of ‘int Expr_Interval_c<span style="color: #000000; font-weight: bold;">&lt;</span>T<span style="color: #000000; font-weight: bold;">&gt;</span>::IntEval<span style="color: #7a0874; font-weight: bold;">&#40;</span>const CSphMatch<span style="color: #000000; font-weight: bold;">&amp;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> const <span style="color: #7a0874; font-weight: bold;">&#91;</span>with T = int<span style="color: #7a0874; font-weight: bold;">&#93;</span>’:
sphinxexpr.cpp:<span style="color: #000000;">3152</span>:<span style="color: #000000;">1</span>:   required from here
sphinxexpr.cpp:<span style="color: #000000;">1777</span>:<span style="color: #000000;">43</span>: error: ‘ExprEval’ was not declared <span style="color: #000000; font-weight: bold;">in</span> this scope, and no declarations were found by argument-dependent lookup at the point of instantiation <span style="color: #7a0874; font-weight: bold;">&#91;</span>-fpermissive<span style="color: #7a0874; font-weight: bold;">&#93;</span>
sphinxexpr.cpp:<span style="color: #000000;">1777</span>:<span style="color: #000000;">43</span>: note: declarations <span style="color: #000000; font-weight: bold;">in</span> dependent base ‘Expr_ArgVsSet_c<span style="color: #000000; font-weight: bold;">&lt;</span>int<span style="color: #000000; font-weight: bold;">&gt;</span>’ are not found by unqualified lookup
sphinxexpr.cpp:<span style="color: #000000;">1777</span>:<span style="color: #000000;">43</span>: note: use ‘this-<span style="color: #000000; font-weight: bold;">&gt;</span>ExprEval’ instead
sphinxexpr.cpp: In instantiation of ‘int Expr_IntervalConst_c<span style="color: #000000; font-weight: bold;">&lt;</span>T<span style="color: #000000; font-weight: bold;">&gt;</span>::IntEval<span style="color: #7a0874; font-weight: bold;">&#40;</span>const CSphMatch<span style="color: #000000; font-weight: bold;">&amp;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> const <span style="color: #7a0874; font-weight: bold;">&#91;</span>with T = float<span style="color: #7a0874; font-weight: bold;">&#93;</span>’:
sphinxexpr.cpp:<span style="color: #000000;">3152</span>:<span style="color: #000000;">1</span>:   required from here
sphinxexpr.cpp:<span style="color: #000000;">1746</span>:<span style="color: #000000;">43</span>: error: ‘ExprEval’ was not declared <span style="color: #000000; font-weight: bold;">in</span> this scope, and no declarations were found by argument-dependent lookup at the point of instantiation <span style="color: #7a0874; font-weight: bold;">&#91;</span>-fpermissive<span style="color: #7a0874; font-weight: bold;">&#93;</span>
sphinxexpr.cpp:<span style="color: #000000;">1746</span>:<span style="color: #000000;">43</span>: note: declarations <span style="color: #000000; font-weight: bold;">in</span> dependent base ‘Expr_ArgVsSet_c<span style="color: #000000; font-weight: bold;">&lt;</span>float<span style="color: #000000; font-weight: bold;">&gt;</span>’ are not found by unqualified lookup
sphinxexpr.cpp:<span style="color: #000000;">1746</span>:<span style="color: #000000;">43</span>: note: use ‘this-<span style="color: #000000; font-weight: bold;">&gt;</span>ExprEval’ instead
sphinxexpr.cpp: In instantiation of ‘int Expr_IntervalConst_c<span style="color: #000000; font-weight: bold;">&lt;</span>T<span style="color: #000000; font-weight: bold;">&gt;</span>::IntEval<span style="color: #7a0874; font-weight: bold;">&#40;</span>const CSphMatch<span style="color: #000000; font-weight: bold;">&amp;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> const <span style="color: #7a0874; font-weight: bold;">&#91;</span>with T = long long int<span style="color: #7a0874; font-weight: bold;">&#93;</span>’:
sphinxexpr.cpp:<span style="color: #000000;">3152</span>:<span style="color: #000000;">1</span>:   required from here
sphinxexpr.cpp:<span style="color: #000000;">1746</span>:<span style="color: #000000;">43</span>: error: ‘ExprEval’ was not declared <span style="color: #000000; font-weight: bold;">in</span> this scope, and no declarations were found by argument-dependent lookup at the point of instantiation <span style="color: #7a0874; font-weight: bold;">&#91;</span>-fpermissive<span style="color: #7a0874; font-weight: bold;">&#93;</span>
sphinxexpr.cpp:<span style="color: #000000;">1746</span>:<span style="color: #000000;">43</span>: note: declarations <span style="color: #000000; font-weight: bold;">in</span> dependent base ‘Expr_ArgVsSet_c<span style="color: #000000; font-weight: bold;">&lt;</span>long long int<span style="color: #000000; font-weight: bold;">&gt;</span>’ are not found by unqualified lookup
sphinxexpr.cpp:<span style="color: #000000;">1746</span>:<span style="color: #000000;">43</span>: note: use ‘this-<span style="color: #000000; font-weight: bold;">&gt;</span>ExprEval’ instead
sphinxexpr.cpp: In instantiation of ‘int Expr_IntervalConst_c<span style="color: #000000; font-weight: bold;">&lt;</span>T<span style="color: #000000; font-weight: bold;">&gt;</span>::IntEval<span style="color: #7a0874; font-weight: bold;">&#40;</span>const CSphMatch<span style="color: #000000; font-weight: bold;">&amp;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> const <span style="color: #7a0874; font-weight: bold;">&#91;</span>with T = int<span style="color: #7a0874; font-weight: bold;">&#93;</span>’:
sphinxexpr.cpp:<span style="color: #000000;">3152</span>:<span style="color: #000000;">1</span>:   required from here
sphinxexpr.cpp:<span style="color: #000000;">1746</span>:<span style="color: #000000;">43</span>: error: ‘ExprEval’ was not declared <span style="color: #000000; font-weight: bold;">in</span> this scope, and no declarations were found by argument-dependent lookup at the point of instantiation <span style="color: #7a0874; font-weight: bold;">&#91;</span>-fpermissive<span style="color: #7a0874; font-weight: bold;">&#93;</span>
sphinxexpr.cpp:<span style="color: #000000;">1746</span>:<span style="color: #000000;">43</span>: note: declarations <span style="color: #000000; font-weight: bold;">in</span> dependent base ‘Expr_ArgVsSet_c<span style="color: #000000; font-weight: bold;">&lt;</span>int<span style="color: #000000; font-weight: bold;">&gt;</span>’ are not found by unqualified lookup
sphinxexpr.cpp:<span style="color: #000000;">1746</span>:<span style="color: #000000;">43</span>: note: use ‘this-<span style="color: #000000; font-weight: bold;">&gt;</span>ExprEval’ instead
<span style="color: #c20cb9; font-weight: bold;">make</span><span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">2</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>: <span style="color: #000000; font-weight: bold;">***</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>sphinxexpr.o<span style="color: #7a0874; font-weight: bold;">&#93;</span> Error <span style="color: #000000;">1</span>
<span style="color: #c20cb9; font-weight: bold;">make</span><span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">2</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>: Leaving directory <span style="color: #000000; font-weight: bold;">`/</span>home<span style="color: #000000; font-weight: bold;">/</span>mac<span style="color: #000000; font-weight: bold;">/</span>Downloads<span style="color: #000000; font-weight: bold;">/</span>coreseek-<span style="color: #000000;">4.1</span>-beta<span style="color: #000000; font-weight: bold;">/</span>csft-<span style="color: #000000;">4.1</span><span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #ff0000;">'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/mac/Downloads/coreseek-4.1-beta/csft-4.1/src'</span>
<span style="color: #c20cb9; font-weight: bold;">make</span>: <span style="color: #000000; font-weight: bold;">***</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>all-recursive<span style="color: #7a0874; font-weight: bold;">&#93;</span> Error <span style="color: #000000;">1</span></pre></div></div>

<p>在替换为coreseek 3.2.13后仍然发生了类似问题，但是在自己的Mac OS X 10.6.8上类似的编译却没有碰到这个问题，于是觉得很奇怪。</p>
<p>搜索之后，仅找到一个有用的链接：<a href="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=667378" target="_blank" onclick="pageTracker._trackPageview('/outgoing/bugs.debian.org/cgi-bin/bugreport.cgi?bug=667378&amp;referer=');">http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=667378</a>，是关于coreseek上游的sphinx的同样问题的，看了一下了解似乎是gcc 4.7的C++作用域的问题（？），上面的debian bugs里面提供了一个patch，看了下patch的内容，也对自己本地的coreseek的制作了同样的补丁，压缩包发布如下，使用时注意版本：</p>
<p><a href="http://vifix.cn/blog/wp-content/uploads/2012/04/sphinxexpr.cpp_.patch_.zip">sphinxexpr.cpp.patch.zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://vifix.cn/blog/coreseek-cant-make-in-gcc-4-7-enviroment.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>KVM + libvirtd 配置iptables端口转发</title>
		<link>http://vifix.cn/blog/kvm-libvirtd-iptables-port-forward.html</link>
		<comments>http://vifix.cn/blog/kvm-libvirtd-iptables-port-forward.html#comments</comments>
		<pubDate>Sat, 14 Apr 2012 07:43:47 +0000</pubDate>
		<dc:creator>Mac</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[KVM]]></category>
		<category><![CDATA[libvirtd]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://vifix.cn/blog/?p=2328</guid>
		<description><![CDATA[（标题图与文章正文没有关系！ orz） 这个玩意儿不好好找文档看是真心不知道的，中文的iptables和libvirt的资源又比较零碎，所以特此总结下。 这两天在配置一个KVM虚拟机在宿主机（MAIN）上的端口转发，环境如下： 宿主机MAIN： eth0 &#8211; 连接外网，有一个固定IP（例如12.34.56.78），并且可以被外网直接访问到 virbr0 &#8211; libvirtd自动建立的虚拟网卡，用于连接内网，IP:192.168.122.1 虚拟机VM： eth0 &#8211; 连接MAIN的virbr0，IP:192.168.122.100 MySQL在端口3306上提供真实服务 现在要在外网上通过访问外网的MAIN的某个端口（例如12345），实现访问内网VM的3306，最初我想当然的在iptables.rules（CentOS位于/etc/sysconfig/iptables）里面增加了两条规则： *filter #... 其他规则 -A FORWARD -p tcp --dport 3306 -d 192.168.122.100 -j ACCEPT #... 其他规则 COMMIT #... *nat #... 其他规则 -A PREROUTING -p tcp -d 12.34.56.78 --dport 12345 -j DNAT --to 192.168.122.100:80 -A POSTROUTING -p tcp -d 192.168.122.100 [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://vifix.cn/blog/wp-content/uploads/2012/04/snapshot-haiku.png" rel="shadowbox[sbpost-2328];player=img;" title="snapshot-haiku"><img class="alignnone size-medium wp-image-2329" title="snapshot-haiku" src="http://vifix.cn/blog/wp-content/uploads/2012/04/snapshot-haiku-300x240.png" alt="" width="300" height="240" /></a></p>
<p>（标题图与文章正文没有关系！ orz）</p>
<p>这个玩意儿不好好找文档看是真心不知道的，中文的iptables和libvirt的资源又比较零碎，所以特此总结下。</p>
<p>这两天在配置一个KVM虚拟机在宿主机（MAIN）上的端口转发，环境如下：</p>
<blockquote><p>宿主机MAIN：<br />
eth0 &#8211; 连接外网，有一个固定IP（例如12.34.56.78），并且可以被外网直接访问到<br />
virbr0 &#8211; libvirtd自动建立的虚拟网卡，用于连接内网，IP:192.168.122.1</p>
<p>虚拟机VM：<br />
eth0 &#8211; 连接MAIN的virbr0，IP:192.168.122.100<br />
MySQL在端口3306上提供真实服务</p></blockquote>
<p>现在要在外网上通过访问外网的MAIN的某个端口（例如12345），实现访问内网VM的3306，最初我想当然的在iptables.rules（CentOS位于/etc/sysconfig/iptables）里面增加了两条规则：</p>
<p><span id="more-2328"></span></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">*</span>filter
<span style="color: #666666; font-style: italic;">#... 其他规则</span>
<span style="color: #660033;">-A</span> FORWARD <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">--dport</span> <span style="color: #000000;">3306</span> <span style="color: #660033;">-d</span> 192.168.122.100 <span style="color: #660033;">-j</span> ACCEPT
<span style="color: #666666; font-style: italic;">#... 其他规则</span>
COMMIT
<span style="color: #666666; font-style: italic;">#...</span>
<span style="color: #000000; font-weight: bold;">*</span>nat
<span style="color: #666666; font-style: italic;">#... 其他规则</span>
<span style="color: #660033;">-A</span> PREROUTING <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">-d</span> 12.34.56.78 <span style="color: #660033;">--dport</span> <span style="color: #000000;">12345</span> <span style="color: #660033;">-j</span> DNAT <span style="color: #660033;">--to</span> 192.168.122.100:<span style="color: #000000;">80</span>
<span style="color: #660033;">-A</span> POSTROUTING <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">-d</span> 192.168.122.100 <span style="color: #660033;">--dport</span> <span style="color: #000000;">80</span> <span style="color: #660033;">-j</span> SNAT <span style="color: #660033;">--to</span> 192.168.122.1
<span style="color: #666666; font-style: italic;">#... 其他规则</span>
COMMIT</pre></div></div>

<p>结果测试发现，在系统只有这些规则的情况下是没有问题的，但一旦libvirtd启动时自己加入的确保虚拟内网正常访问外网的NAT规则进来的话会产生冲突，原因很简单，就是libvirtd后来加入规则优先级高过我在iptables.rules里面设置的规则，所以就失去作用了。在这里我几乎花费了一天的时间来找问题到底如何解决，其中包括尝试修改iptables的优先级，详细阅读各种iptables的各种文档，用iptables-save导出被libvirtd修改后的iptables表在这基础上进行修改。最后终于搜到了libvirtd官网上的文档，讲libvirt管理下的虚拟机应该如何处理传入的连接，才了解到要用libvirtd的钩子脚本，会在任何虚拟机启动时启动这个脚本，位于/etc/libvirt/hooks/qemu 这个位置，于是编写脚本如下：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
&nbsp;
<span style="color: #007800;">Guest_name</span>=vm-database
<span style="color: #007800;">Host_external_ipaddr</span>=12.34.56.78
<span style="color: #007800;">Host_port</span>=<span style="color: #000000;">12345</span>
<span style="color: #007800;">Host_ipaddr</span>=192.168.122.1
<span style="color: #007800;">Guest_ipaddr</span>=192.168.122.100
<span style="color: #007800;">Guest_port</span>=<span style="color: #000000;">3306</span>
&nbsp;
<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;">${1}</span>&quot;</span> = <span style="color: #ff0000;">&quot;<span style="color: #007800;">${Guest_name}</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
  <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;">${2}</span>&quot;</span> = <span style="color: #ff0000;">&quot;start&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
     iptables <span style="color: #660033;">-t</span> nat <span style="color: #660033;">-A</span> PREROUTING <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">--dport</span> <span style="color: #800000;">${Host_port}</span> <span style="color: #660033;">-d</span> <span style="color: #800000;">${Host_external_ipaddr}</span> \
              <span style="color: #660033;">-j</span> DNAT <span style="color: #660033;">--to</span> <span style="color: #800000;">${Guest_ipaddr}</span>:<span style="color: #800000;">${Guest_port}</span>
     iptables <span style="color: #660033;">-I</span> FORWARD <span style="color: #660033;">-d</span> <span style="color: #800000;">${Guest_ipaddr}</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">32</span> <span style="color: #660033;">-p</span> tcp \
              <span style="color: #660033;">--dport</span> <span style="color: #800000;">${Guest_port}</span> <span style="color: #660033;">-j</span> ACCEPT
<span style="color: #000000; font-weight: bold;">elif</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${2}</span>&quot;</span> = <span style="color: #ff0000;">&quot;stopped&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
     iptables <span style="color: #660033;">-t</span> nat <span style="color: #660033;">-D</span> PREROUTING <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">--dport</span> <span style="color: #800000;">${Host_port}</span> <span style="color: #660033;">-d</span> <span style="color: #800000;">${Host_external_ipaddr}</span> \
              <span style="color: #660033;">-j</span> DNAT <span style="color: #660033;">--to</span> <span style="color: #800000;">${Guest_ipaddr}</span>:<span style="color: #800000;">${Guest_port}</span>
     iptables <span style="color: #660033;">-D</span> FORWARD <span style="color: #660033;">-d</span> <span style="color: #800000;">${Guest_ipaddr}</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">32</span> <span style="color: #660033;">-p</span> tcp \
              <span style="color: #660033;">--dport</span> <span style="color: #800000;">${Guest_port}</span> <span style="color: #660033;">-j</span> ACCEPT
 <span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #000000; font-weight: bold;">fi</span></pre></div></div>

<p>这样的话，就可以确保新建的FORWARD规则的优先级是最高的了，从而不被libvirtd的规则给盖住。不过要注意的是这里无需做SNAT，因为libvirtd自己添加的在NAT表的MASQUERADE规则相当于已经给你做掉了SNAT转换！</p>
<p>这是值得一看的中文iptables文档，对于理解如何配置iptables的NAT配置非常有帮助！：<a href="http://blog.chinaunix.net/space.php?uid=276597&amp;do=blog&amp;id=2014536" target="_blank" onclick="pageTracker._trackPageview('/outgoing/blog.chinaunix.net/space.php?uid=276597_amp_do=blog_amp_id=2014536&amp;referer=');">iptables 应用初探（nat+三层访问控制）</a></p>
<p>libvirt的官网文档：<a href="http://wiki.libvirt.org/page/Networking#Forwarding_Incoming_Connections" target="_blank" onclick="pageTracker._trackPageview('/outgoing/wiki.libvirt.org/page/Networking_Forwarding_Incoming_Connections?referer=');">http://wiki.libvirt.org/page/Networking#Forwarding_Incoming_Connections</a> （里面提供了一个hooks钩子脚本的范例，不过这个里面提供的脚本不够全面，实际的生产环境因为可能更加复杂所以那个无法产生效果，）</p>
<p>最后和本文主题无关的~感谢下<a href="http://haiku-os.org/" target="_blank" onclick="pageTracker._trackPageview('/outgoing/haiku-os.org/?referer=');">Haiku</a>里面的&#8221;PoorMan&#8221;，也就是文章顶图中虚拟机中高亮的窗口，是Haiku内建的一个超级轻量级的http服务器，在我本地archlinux上研究iptables和libvirtd的时候，作为主要测试对象立下了汗马功劳。Haiku是一个开源项目，立足于创立一个与BeOS兼容的操作系统，是一个很有趣的系统，感兴趣的童鞋可以去官网下载一个玩一下~</p>
]]></content:encoded>
			<wfw:commentRss>http://vifix.cn/blog/kvm-libvirtd-iptables-port-forward.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>得瑟下～</title>
		<link>http://vifix.cn/blog/showing-around.html</link>
		<comments>http://vifix.cn/blog/showing-around.html#comments</comments>
		<pubDate>Wed, 07 Mar 2012 09:13:33 +0000</pubDate>
		<dc:creator>Mac</dc:creator>
				<category><![CDATA[Image]]></category>
		<category><![CDATA[Photo]]></category>
		<category><![CDATA[杭州]]></category>

		<guid isPermaLink="false">http://vifix.cn/blog/?p=2278</guid>
		<description><![CDATA[最近在尝试ArchLinux打算作为自己工作的主力环境Kubuntu的替代，在配置KDE的时候竟然发现自己的一张曾经投稿的照片竟然入选了默认壁纸包，于是～这个必须要来得瑟下啊，献丑了献丑了啊 = 。。 =～～～ 嘛，这个是具体的去年的活动链接： http://dot.kde.org/2011/11/20/plasma-workspaces-wallpaper-contest 看起来每个KDE版本的发布都会这样进行一次比赛的样子～ 不过让我奇怪的是入选了咋也不邮件通知下呀 = 。。 =～ 虽然这样一个意外的惊喜也不错 自己一直是KDE（以及其它开源软件）的受益者和用户，如今也算为KDE贡献了回，只是没想到竟然是以照片的形式（而不是代码 = 。 =） 原图最初发表在：杭州，1月19日，雪 完整尺寸： 这是另一张一起参加比赛，但没有被选中的照片：（我自己还是比较喜欢的，就是花苞确实不够完美 = 。 = 现在是我公司电脑的桌面） （两张照片均以LGPL许可证授权！）]]></description>
			<content:encoded><![CDATA[<p><a href="http://vifix.cn/blog/wp-content/uploads/2012/03/snapshot-archlinux-kde4.8-wallpaper-select.png" rel="shadowbox[sbpost-2278];player=img;" title="snapshot-archlinux-kde4.8-wallpaper-select"><img class="alignnone size-medium wp-image-2282" title="snapshot-archlinux-kde4.8-wallpaper-select" src="http://vifix.cn/blog/wp-content/uploads/2012/03/snapshot-archlinux-kde4.8-wallpaper-select-300x180.png" alt="" width="300" height="180" /></a></p>
<p>最近在尝试ArchLinux打算作为自己工作的主力环境Kubuntu的替代，在配置KDE的时候竟然发现自己的一张曾经投稿的照片竟然入选了默认壁纸包，于是～这个必须要来得瑟下啊，献丑了献丑了啊 = 。。 =～～～</p>
<p>嘛，这个是具体的去年的活动链接： <a href="http://dot.kde.org/2011/11/20/plasma-workspaces-wallpaper-contest" target="_blank" onclick="pageTracker._trackPageview('/outgoing/dot.kde.org/2011/11/20/plasma-workspaces-wallpaper-contest?referer=');">http://dot.kde.org/2011/11/20/plasma-workspaces-wallpaper-contest</a> 看起来每个KDE版本的发布都会这样进行一次比赛的样子～</p>
<p>不过让我奇怪的是入选了咋也不邮件通知下呀 = 。。 =～ 虽然这样一个意外的惊喜也不错</p>
<p>自己一直是KDE（以及其它开源软件）的受益者和用户，如今也算为KDE贡献了回，只是没想到竟然是以照片的形式（而不是代码 = 。 =）</p>
<p>原图最初发表在：<a title="Permanent Link to 杭州，1月19日，雪" href="../hangzhou-jan-19th-snow.html" rel="bookmark" target="_blank">杭州，1月19日，雪</a></p>
<p>完整尺寸：</p>
<p><span id="more-2278"></span></p>
<p><a href="http://vifix.cn/blog/wp-content/uploads/2012/03/fog-on-the-west-lake.jpg" rel="shadowbox[sbpost-2278];player=img;" title="fog-on-the-west-lake"><img class="alignnone size-medium wp-image-2280" title="fog-on-the-west-lake" src="http://vifix.cn/blog/wp-content/uploads/2012/03/fog-on-the-west-lake-300x187.jpg" alt="" width="300" height="187" /></a></p>
<p>这是另一张一起参加比赛，但没有被选中的照片：（我自己还是比较喜欢的，就是花苞确实不够完美 = 。 = 现在是我公司电脑的桌面）</p>
<p><a href="http://vifix.cn/blog/wp-content/uploads/2012/03/lotus-in-the-west-lake.jpg" rel="shadowbox[sbpost-2278];player=img;" title="lotus-in-the-west-lake"><img class="alignnone size-medium wp-image-2281" title="lotus-in-the-west-lake" src="http://vifix.cn/blog/wp-content/uploads/2012/03/lotus-in-the-west-lake-300x187.jpg" alt="" width="300" height="187" /></a></p>
<p>（<a href="http://en.wikipedia.org/wiki/GNU_Lesser_General_Public_License" target="_blank" onclick="pageTracker._trackPageview('/outgoing/en.wikipedia.org/wiki/GNU_Lesser_General_Public_License?referer=');">两张照片均以LGPL许可证授权！</a>）</p>
]]></content:encoded>
			<wfw:commentRss>http://vifix.cn/blog/showing-around.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>140byt.es</title>
		<link>http://vifix.cn/blog/140byt-es.html</link>
		<comments>http://vifix.cn/blog/140byt-es.html#comments</comments>
		<pubDate>Tue, 21 Feb 2012 02:40:55 +0000</pubDate>
		<dc:creator>Mac</dc:creator>
				<category><![CDATA[Website]]></category>
		<category><![CDATA[Geeker]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://vifix.cn/blog/?p=2267</guid>
		<description><![CDATA[刚看到的一个很有趣的网站140byt.es，是一帮JS大牛秀js代码的网站，所有的代码的核心部分都在twiiter长度的140字节以内，有很多实用的代码，也有很多不实用——但是可以给写js的带来另一种思维，或者说只是纯粹膜拜的代码…… 例如用正则表达式判断是否是质数（这个真的很神奇啊，正在解读中……）： function&#40;a&#41;&#123;return!/^,?$&#124;^&#40;,,+?&#41;\1+$/.test&#40;Array&#40;-~a&#41;&#41;&#125;; 140个字节核心的俄罗斯方块（应该微博上看到这个的不少了吧）： http://jsbin.com/egiqul/49]]></description>
			<content:encoded><![CDATA[<p><a href="http://vifix.cn/blog/wp-content/uploads/2012/02/140byt.es_.png" rel="shadowbox[sbpost-2267];player=img;" title="140byt.es"><img class="alignnone size-medium wp-image-2268" title="140byt.es" src="http://vifix.cn/blog/wp-content/uploads/2012/02/140byt.es_-300x166.png" alt="" width="300" height="166" /></a></p>
<p>刚看到的一个很有趣的网站<a href="http://140byt.es/" target="_blank" onclick="pageTracker._trackPageview('/outgoing/140byt.es/?referer=');">140byt.es</a>，是一帮JS大牛秀js代码的网站，所有的代码的核心部分都在twiiter长度的140字节以内，有很多实用的代码，也有很多不实用——但是可以给写js的带来另一种思维，或者说只是纯粹膜拜的代码……</p>
<p>例如用正则表达式判断是否是质数（这个真的很神奇啊，正在解读中……）：</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>a<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #000066; font-weight: bold;">return</span><span style="color: #339933;">!/^,?</span>$<span style="color: #339933;">|^</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">,,+?</span><span style="color: #009900;">&#41;</span>\<span style="color: #CC0000;">1</span><span style="color: #339933;">+</span>$<span style="color: #339933;">/</span>.<span style="color: #660066;">test</span><span style="color: #009900;">&#40;</span>Array<span style="color: #009900;">&#40;</span><span style="color: #339933;">-</span>~a<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></pre></div></div>

<p>140个字节核心的俄罗斯方块（应该微博上看到这个的不少了吧）：<br />
<a href="http://jsbin.com/egiqul/49" target="_blank" onclick="pageTracker._trackPageview('/outgoing/jsbin.com/egiqul/49?referer=');">http://jsbin.com/egiqul/49</a></p>
]]></content:encoded>
			<wfw:commentRss>http://vifix.cn/blog/140byt-es.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTML5 修改浏览器url而不刷新页面</title>
		<link>http://vifix.cn/blog/html5-modify-browser-url-without-reloading-page.html</link>
		<comments>http://vifix.cn/blog/html5-modify-browser-url-without-reloading-page.html#comments</comments>
		<pubDate>Tue, 07 Feb 2012 05:46:18 +0000</pubDate>
		<dc:creator>Mac</dc:creator>
				<category><![CDATA[Atelier]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://vifix.cn/blog/?p=2238</guid>
		<description><![CDATA[嘛，起因是黑子大叔在微博上的一条@信息，找起了这个的实现，看了一圈google的中文信息内似乎还没有怎么提到这个的内容，就发表上来。 详细效果就是类似于用Firefox4+/Chrome 5+/Safari 5+/Opera 11.5+登录新浪微博后看到的个人时间轴，在翻页时可以观察到这个效果，地址栏URL变动，但是页面没有刷新，用firebug观察也观察不到刷新整个页面，只有ajax请求的翻页数据。从先前的理解来说，URL的修改必然引起（请注意我不是在说通过锚点修改）浏览器重载页面，但利用HTML5新加入的history.pushState();和history.replaceState();可以完全自己维护一个历史记录列表绕开历史记录完全由浏览器控制的机制，从而实现比锚点更加完美的一种页内更新的体验。 代码方面很简单，只要在需要修改url的地方插入一行： window.history.pushState&#40;&#123;&#34;html&#34;:response.html,&#34;pageTitle&#34;:response.pageTitle&#125;, 'title', urlPath&#41;; //三个参数，分别为：状态对象，标题（目前被浏览器忽略），地址 即可在历史记录里面产生一个新的历史记录（另一个replaceState方法参数完全相同，只是替代掉当前的状态）。 在体验上，非常接近于使用锚点（window.location = &#8220;#foo&#8221;;），但是mozilla的文档提出了以下三点好处： 新的URL可以是和原始页面URL同域下的任何URL，如果用锚点，只能更新#后面的部分 仅在需要时更新URL，锚点的历史记录在相同时不会创建（即当前已经是&#8221;#foo&#8221;的情况下，如果再将当前页面锚点设置为&#8221;#foo&#8221;，不会产生新的历史记录） 可以记录下任意类型的数据，使用锚点的话将要自己维护一份历史数据列表或者把数据转码到一个字符串里 （翻译&#038;描述的有点别扭，见笑了，不过其实应该自己也能体会到这些好处才是） 我自己实现的一个例子： http://vifix.cn/atelier/demos/html5-update-browser-url-without-reloading-page 代码： &#60;?php if&#40;!isset&#40;$_REQUEST&#91;'page'&#93;&#41;&#41;&#123; $page = 1; &#125; else&#123; $page = intval&#40;$_REQUEST&#91;'page'&#93;&#41;; &#125; &#160; if&#40;isset&#40;$_REQUEST&#91;'ajaxload'&#93;&#41;&#41;&#123; echo &#34;第{$page}页的内容&#34;; die; &#125; ?&#62; &#60;!DOCTYPE html&#62; &#60;html&#62; &#60;head&#62; &#60;meta http-equiv=&#34;Content-Type&#34; content=&#34;text/html; charset=UTF-8&#34; /&#62; &#60;title&#62;HTML5 修改浏览器url而不刷新页面&#60;/title&#62; &#60;script type=&#34;text/javascript&#34;&#62; var domLoaded = [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://vifix.cn/blog/wp-content/uploads/2012/02/HTML5_Logo_512.png" rel="shadowbox[sbpost-2238];player=img;" title="HTML5_Logo_512"><img class="alignnone size-thumbnail wp-image-2239" title="HTML5_Logo_512" src="http://vifix.cn/blog/wp-content/uploads/2012/02/HTML5_Logo_512-150x150.png" alt="" width="150" height="150" /></a></p>
<p>嘛，起因是黑子大叔在微博上的一条@信息，找起了这个的实现，看了一圈google的中文信息内似乎还没有怎么提到这个的内容，就发表上来。</p>
<p>详细效果就是类似于用Firefox4+/Chrome 5+/Safari 5+/Opera 11.5+登录新浪微博后看到的个人时间轴，在翻页时可以观察到这个效果，地址栏URL变动，但是页面没有刷新，用firebug观察也观察不到刷新整个页面，只有ajax请求的翻页数据。从先前的理解来说，URL的修改必然引起（请注意我不是在说通过锚点修改）浏览器重载页面，但利用HTML5新加入的<strong>history.pushState();</strong>和<strong>history.replaceState();</strong>可以完全自己维护一个历史记录列表绕开历史记录完全由浏览器控制的机制，从而实现比锚点更加完美的一种页内更新的体验。</p>
<p>代码方面很简单，只要在需要修改url的地方插入一行：</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">window.<span style="color: #660066;">history</span>.<span style="color: #660066;">pushState</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><span style="color: #3366CC;">&quot;html&quot;</span><span style="color: #339933;">:</span>response.<span style="color: #660066;">html</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;pageTitle&quot;</span><span style="color: #339933;">:</span>response.<span style="color: #660066;">pageTitle</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'title'</span><span style="color: #339933;">,</span> urlPath<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #006600; font-style: italic;">//三个参数，分别为：状态对象，标题（目前被浏览器忽略），地址</span></pre></div></div>

<p>即可在历史记录里面产生一个新的历史记录（另一个<strong>replaceState</strong>方法参数完全相同，只是替代掉当前的状态）。<br />
在体验上，非常接近于使用锚点（<strong>window.location = &#8220;#foo&#8221;;</strong>），但是mozilla的文档提出了以下三点好处：</p>
<ul>
<li>新的URL可以是和原始页面URL同域下的任何URL，如果用锚点，只能更新#后面的部分</li>
<li>仅在需要时更新URL，锚点的历史记录在相同时不会创建（即当前已经是&#8221;#foo&#8221;的情况下，如果再将当前页面锚点设置为&#8221;#foo&#8221;，不会产生新的历史记录）</li>
<li>可以记录下任意类型的数据，使用锚点的话将要自己维护一份历史数据列表或者把数据转码到一个字符串里</li>
</ul>
<p>（翻译&#038;描述的有点别扭，见笑了，不过其实应该自己也能体会到这些好处才是）</p>
<p>我自己实现的一个例子：<br />
<a href="http://vifix.cn/atelier/demos/html5-update-browser-url-without-reloading-page" target="_blank">http://vifix.cn/atelier/demos/html5-update-browser-url-without-reloading-page</a></p>
<p><span id="more-2238"></span></p>
<p>代码：</p>

<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: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'page'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$page</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$page</span> <span style="color: #339933;">=</span> <span style="color: #990000;">intval</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'page'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ajaxload'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;第<span style="color: #006699; font-weight: bold;">{$page}</span>页的内容&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">die</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot; /&gt;
&lt;title&gt;HTML5 修改浏览器url而不刷新页面&lt;/title&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
var domLoaded = function(){
	if(ua != null &amp;&amp; ua[1] &lt; 10){
		alert('您的浏览器不支持');
		return ;
	}
&nbsp;
	if(location.href.indexOf(&quot;?&quot;) &gt; -1){
		var urlparts = location.href.match(/(.+?)\?.+/i);
		var urlbase = urlparts[1];
	}
	else{
		var urlbase = location.href;
	}
	var page = <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$page</span><span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>;
	var ua = window.navigator.userAgent.match(/msie (\d\.\d)/i);
	var content = document.getElementById(&quot;content&quot;);
	var loading = document.getElementById(&quot;loading&quot;);
&nbsp;
	window.history.replaceState(
		{
			content:content.innerHTML,
			page:page
		},
		page,
		urlbase + (page &gt; 1 ? '?page=' + page : '' )
	);
&nbsp;
	var ajax = new XMLHttpRequest();
	var ajaxCallback = function(){
		if(ajax.readyState == 4){
			loading.style.display = 'none';
			content.innerHTML = ajax.responseText;
			window.history.pushState(
				{
					content:content.innerHTML,
					page:page
				},
				page,
				urlbase + &quot;?page=&quot; + page
			);
			next.href = urlbase + &quot;?page=&quot; + (page + 1);
		}
	};
&nbsp;
	var next = document.getElementById('next');
	var nextClickEvent = function(event){
		if(loading.style.display != 'block'){
			loading.style.display = 'block';
			page++;
			ajax.open('GET', urlbase + '?page=' + page + '&amp;ajaxload=on', true);
			ajax.onreadystatechange = ajaxCallback;
			ajax.send('');
			event.preventDefault();
		}
	};
	next.addEventListener('click', nextClickEvent, false);
&nbsp;
	var popstate = function(){
		content.innerHTML = history.state.content;
		page = history.state.page;
	};
	window.addEventListener('popstate', popstate, false);
};
&nbsp;
try{
	window.addEventListener('DOMContentLoaded', domLoaded, false);
}
catch(e){
	alert('您的浏览器不支持');	
}
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
	&lt;p id=&quot;content&quot;&gt;
		<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;第<span style="color: #006699; font-weight: bold;">{$page}</span>页的内容&quot;</span><span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
	&lt;/p&gt;
	&lt;p&gt;
		&lt;a id=&quot;next&quot; href=&quot;?page=<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$page</span><span style="color: #339933;">+</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;下一页&lt;/a&gt;
	&lt;/p&gt;
	&lt;div id=&quot;loading&quot; style=&quot;display:none;&quot;&gt;
		加载中
	&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;</pre></div></div>

<p>mozilla的文档<br />
<a href="https://developer.mozilla.org/en/DOM/Manipulating_the_browser_history" target="_blank" onclick="pageTracker._trackPageview('/outgoing/developer.mozilla.org/en/DOM/Manipulating_the_browser_history?referer=');">https://developer.mozilla.org/en/DOM/Manipulating_the_browser_history</a></p>
<p>stackoverflow上的相关问题：<br />
<a href="http://stackoverflow.com/questions/3338642/updating-address-bar-with-new-url-without-hash-or-reloading-the-page" target="_blank" onclick="pageTracker._trackPageview('/outgoing/stackoverflow.com/questions/3338642/updating-address-bar-with-new-url-without-hash-or-reloading-the-page?referer=');">http://stackoverflow.com/questions/3338642/updating-address-bar-with-new-url-without-hash-or-reloading-the-page</a><br />
<a href="http://stackoverflow.com/questions/824349/modify-the-url-without-reloading-the-page" target="_blank" onclick="pageTracker._trackPageview('/outgoing/stackoverflow.com/questions/824349/modify-the-url-without-reloading-the-page?referer=');">http://stackoverflow.com/questions/824349/modify-the-url-without-reloading-the-page</a></p>
]]></content:encoded>
			<wfw:commentRss>http://vifix.cn/blog/html5-modify-browser-url-without-reloading-page.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SimpleSnake &#8211; Hello, Android World</title>
		<link>http://vifix.cn/blog/simplesnake-hello-android-world.html</link>
		<comments>http://vifix.cn/blog/simplesnake-hello-android-world.html#comments</comments>
		<pubDate>Fri, 20 Jan 2012 06:39:13 +0000</pubDate>
		<dc:creator>Mac</dc:creator>
				<category><![CDATA[Atelier]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Game]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://vifix.cn/blog/?p=2229</guid>
		<description><![CDATA[年末了，相对来说工作已经比较清闲，于是趁着机会研究了一下Android的游戏开发，花了一个下午写了这个贪吃蛇的应用。 使用的游戏引擎是libgdx，虽然目前看起来文档比较缺少，但是，最大的好处是可以在Winodows/OSX/Linux上运行，android上则只需要额外几行代码就可以运行，极大的方便了调试和跨平台的工作。 下载apk请点击此处 &#8211; simplesnake （必须要800&#215;480的分辨率才可以正常运行，如果大于这个分辨率仍然可以运行但按钮将错位，低于这个分辨率则可能出现奇怪的问题并且按钮缺失，因为只是hello, world，所以也不打算进一步优化各个分辨率了） 另外推荐下libgdx原作者的博客badlogic，以及他写的书：google book，豆瓣，像我这样的游戏开发初学者看看挺不错的。 一篇国产PC/Android游戏引擎LGame作者cping1982同学的介绍libgx的科普文章也很值得一看：http://blog.csdn.net/cping1982/article/details/6176191]]></description>
			<content:encoded><![CDATA[<p><a href="http://vifix.cn/blog/wp-content/uploads/2012/01/simple-snake.png" rel="shadowbox[sbpost-2229];player=img;"><img class="alignnone size-medium wp-image-2230" src="http://vifix.cn/blog/wp-content/uploads/2012/01/simple-snake-300x276.png" alt="" width="300" height="276" /></a></p>
<p>年末了，相对来说工作已经比较清闲，于是趁着机会研究了一下Android的游戏开发，花了一个下午写了这个贪吃蛇的应用。</p>
<p>使用的游戏引擎是<a href="http://code.google.com/p/libgdx/" target="_blank" onclick="pageTracker._trackPageview('/outgoing/code.google.com/p/libgdx/?referer=');">libgdx</a>，虽然目前看起来文档比较缺少，但是，最大的好处是可以在Winodows/OSX/Linux上运行，android上则只需要额外几行代码就可以运行，极大的方便了调试和跨平台的工作。</p>
<p>下载apk请点击此处 &#8211; <a href="http://vifix.cn/blog/wp-content/uploads/2012/01/simplesnake.zip">simplesnake</a> （必须要800&#215;480的分辨率才可以正常运行，如果大于这个分辨率仍然可以运行但按钮将错位，低于这个分辨率则可能出现奇怪的问题并且按钮缺失，因为只是hello, world，所以也不打算进一步优化各个分辨率了）</p>
<p>另外推荐下libgdx原作者的博客<a href="http://badlogicgames.com/" target="_blank" onclick="pageTracker._trackPageview('/outgoing/badlogicgames.com/?referer=');">badlogic</a>，以及他写的书：<a href="http://books.google.com.hk/books?id=NetBrvVEe3cC&amp;printsec=frontcover&amp;dq=beginning+android+game&amp;hl=en&amp;sa=X&amp;ei=HAsZT_2IJM2ciQf6ronWCw&amp;redir_esc=y&amp;hl=zh-CN&amp;sourceid=cndr#v=onepage&amp;q&amp;f=false" target="_blank" onclick="pageTracker._trackPageview('/outgoing/books.google.com.hk/books?id=NetBrvVEe3cC_amp_printsec=frontcover_amp_dq=beginning+android+game_amp_hl=en_amp_sa=X_amp_ei=HAsZT_2IJM2ciQf6ronWCw_amp_redir_esc=y_amp_hl=zh-CN_amp_sourceid=cndr_v=onepage_amp_q_amp_f=false&amp;referer=');">google book</a>，<a href="http://book.douban.com/subject/4753615/" target="_blank" onclick="pageTracker._trackPageview('/outgoing/book.douban.com/subject/4753615/?referer=');">豆瓣</a>，像我这样的游戏开发初学者看看挺不错的。</p>
<p>一篇国产PC/Android游戏引擎LGame作者cping1982同学的介绍libgx的科普文章也很值得一看：<a href="http://blog.csdn.net/cping1982/article/details/6176191" target="_blank" onclick="pageTracker._trackPageview('/outgoing/blog.csdn.net/cping1982/article/details/6176191?referer=');">http://blog.csdn.net/cping1982/article/details/6176191</a></p>
]]></content:encoded>
			<wfw:commentRss>http://vifix.cn/blog/simplesnake-hello-android-world.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Parted Magic</title>
		<link>http://vifix.cn/blog/parted-magic.html</link>
		<comments>http://vifix.cn/blog/parted-magic.html#comments</comments>
		<pubDate>Thu, 05 Jan 2012 11:10:44 +0000</pubDate>
		<dc:creator>Mac</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://vifix.cn/blog/?p=2224</guid>
		<description><![CDATA[近来在朋友送了个512M的小U盘给我，在这文件动辄上G的年代，这小巧的容量显得并不是那么实用，于是一直在考虑到底该拿它来干吗。然后自己公司里面的PC因为是去年安装的kubuntu，当时出于可能仍然还会双系统的考虑，所以分区划分的太小，一年过去了已经渐渐的不堪用起来了，于是开始考虑把还没利用起来的仍然存在的ntfs分区合并入已有的ext4当中。以前做这种事情都是在Windows下面的Acronis Disk Director这个工具，这次打算在Linux下面处理掉这个问题。所以就google到了一个名为Parted Magic的Linux LiveCD发行版，从名字就可以看得出来，这是在模仿曾经的经典的分区软件Norton PartitionMagic的名字。 gparted是这个发行版最核心的应用，此外还提供了testdisk这个非常优秀的恢复软件（我曾经用过它的windows版本恢复过一个彻底被覆盖的分区表），当然还有其他很多和磁盘相关的应用（包括但不限于磁盘检查，磁盘备份，磁盘镜像等等等等等），并且可以使用firefox随时上网查相关的问题。 照着官网的说明，很容易就做成了自启动U盘，通过在gparted约一个小时的折腾（其中主要是因为分区位置变动所以其自动复制几十G数据时的消耗的时间），搞定了相关的问题，觉得此物还是蛮不错的，所以就写了这篇日志。 PS:  开始的时候还担心移动分区的位置可能会导致uuid变动导致grub2无法正常引导的问题，事实证明（操作前后进行了对比）这个是不会发生变化的，所以可以安心使用移动分区位置的功能（当然还是要小心操作啦～丢了数据还是伤不起的 = 。 =）]]></description>
			<content:encoded><![CDATA[<p><a href="http://vifix.cn/blog/wp-content/uploads/2012/01/partedmagic.png" rel="shadowbox[sbpost-2224];player=img;" title="partedmagic"><img class="alignnone size-medium wp-image-2225" title="partedmagic" src="http://vifix.cn/blog/wp-content/uploads/2012/01/partedmagic-300x240.png" alt="" width="300" height="240" /></a></p>
<p>近来在朋友送了个512M的小U盘给我，在这文件动辄上G的年代，这小巧的容量显得并不是那么实用，于是一直在考虑到底该拿它来干吗。然后自己公司里面的PC因为是去年安装的kubuntu，当时出于可能仍然还会双系统的考虑，所以分区划分的太小，一年过去了已经渐渐的不堪用起来了，于是开始考虑把还没利用起来的仍然存在的ntfs分区合并入已有的ext4当中。以前做这种事情都是在Windows下面的Acronis Disk Director这个工具，这次打算在Linux下面处理掉这个问题。所以就google到了一个名为<a href="http://partedmagic.com/doku.php" target="_blank" onclick="pageTracker._trackPageview('/outgoing/partedmagic.com/doku.php?referer=');">Parted Magic</a>的Linux LiveCD发行版，从名字就可以看得出来，这是在模仿曾经的经典的分区软件<a href="http://zh.wikipedia.org/zh/Norton_PartitionMagic" target="_blank" onclick="pageTracker._trackPageview('/outgoing/zh.wikipedia.org/zh/Norton_PartitionMagic?referer=');">Norton PartitionMagic</a>的名字。</p>
<p>gparted是这个发行版最核心的应用，此外还提供了testdisk这个非常优秀的恢复软件（我曾经用过它的windows版本恢复过一个彻底被覆盖的分区表），当然还有其他很多和磁盘相关的应用（包括但不限于磁盘检查，磁盘备份，磁盘镜像等等等等等），并且可以使用firefox随时上网查相关的问题。</p>
<p>照着官网的说明，很容易就做成了自启动U盘，通过在gparted约一个小时的折腾（其中主要是因为分区位置变动所以其自动复制几十G数据时的消耗的时间），搞定了相关的问题，觉得此物还是蛮不错的，所以就写了这篇日志。</p>
<p>PS:  开始的时候还担心移动分区的位置可能会导致uuid变动导致grub2无法正常引导的问题，事实证明（操作前后进行了对比）这个是不会发生变化的，所以可以安心使用移动分区位置的功能（当然还是要小心操作啦～丢了数据还是伤不起的 = 。 =）</p>
]]></content:encoded>
			<wfw:commentRss>http://vifix.cn/blog/parted-magic.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Arrive Hangzhou</title>
		<link>http://vifix.cn/blog/arrive-hangzhou.html</link>
		<comments>http://vifix.cn/blog/arrive-hangzhou.html#comments</comments>
		<pubDate>Mon, 26 Dec 2011 08:16:16 +0000</pubDate>
		<dc:creator>Mac</dc:creator>
				<category><![CDATA[Website]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://vifix.cn/blog/?p=2221</guid>
		<description><![CDATA[应朋友之邀给一家航空杂志社《Arrive Hangzhou》做的官方网站，从设计到编码均为在下完成 &#8211; 。 &#8211; （虽然在对方boss要求下修改不少），采用WordPress实现。 欢迎大家关注 http://www.arrivehangzhou.com]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.arrivehangzhou.com/" title="arrivehangzhou.com" onclick="pageTracker._trackPageview('/outgoing/www.arrivehangzhou.com/?referer=');"><img class="alignnone size-medium wp-image-2222" title="arrivehangzhou.com" src="http://vifix.cn/blog/wp-content/uploads/2011/12/arrivehangzhou.com_-300x183.jpg" alt="" width="300" height="183" /></a></p>
<p>应朋友之邀给一家航空杂志社《Arrive Hangzhou》做的官方网站，从设计到编码均为在下完成 &#8211; 。 &#8211; （虽然在对方boss要求下修改不少），采用WordPress实现。</p>
<p>欢迎大家关注 <a href="http://www.arrivehangzhou.com" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.arrivehangzhou.com?referer=');">http://www.arrivehangzhou.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://vifix.cn/blog/arrive-hangzhou.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

