<?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>泛城科技技术博客Linux &#187; 泛城科技技术博客</title>
	<atom:link href="http://tech.lezi.com/archives/tag/linux/feed" rel="self" type="application/rss+xml" />
	<link>http://tech.lezi.com</link>
	<description></description>
	<lastBuildDate>Fri, 04 Jan 2013 09:18:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>一行Linux命令查找所有非UTF-8编码的文件，再一行命令，都转换成UTF-8</title>
		<link>http://tech.lezi.com/archives/194</link>
		<comments>http://tech.lezi.com/archives/194#comments</comments>
		<pubDate>Thu, 06 Jan 2011 14:12:27 +0000</pubDate>
		<dc:creator>neilxp</dc:creator>
				<category><![CDATA[一行Linux命令]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[一行命令]]></category>

		<guid isPermaLink="false">http://tech.lezi.com/?p=194</guid>
		<description><![CDATA[开始之前，请先安装enca这个软件包。enca是Linux等系统下用来查看文件编码和转换文件编码的工具。 下面一行Linux命令能够查找当前目录下所有文件中，哪些文件不是UTF-8编码。我对文件加了些限制，用find命令时候，排除了所有目录下的.svn目录，且只查找后缀为.php的文件。 命令1 jw@~/sqlite&#62; find . ! -iregex '.*\.svn.*' -type f -name '*.php' -exec bash -c "enca -L zh_CN {}&#124;grep GB2312 &#62; /dev/null &#38;&#38; echo {}" \; ./sqlite_utility.php ./sqlite_result.php ./sqlite_forge.php ./sqlite_driver.php 既然找到了这些非UTF8编码的文件，接下来再用一条命令将他们都转换成UTF8编码 命令2 jw@~/sqlite&#62; find . ! -iregex '.*\.svn.*' -type f -name '*.php' -exec bash -c "enca -L zh_CN {} &#124; grep GB2312 &#62;/dev/null &#38;&#38; [...]]]></description>
			<content:encoded><![CDATA[<p>开始之前，请先安装enca这个软件包。enca是Linux等系统下用来查看文件编码和转换文件编码的工具。</p>
<p>下面一行Linux命令能够查找当前目录下所有文件中，哪些文件不是UTF-8编码。我对文件加了些限制，用find命令时候，排除了所有目录下的.svn目录，且只查找后缀为.php的文件。</p>
<p>命令1</p>
<pre class="brush:bash">jw@~/sqlite&gt;
find . ! -iregex '.*\.svn.*' -type f -name '*.php' -exec bash -c "enca -L zh_CN {}|grep GB2312 &gt; /dev/null &amp;&amp; echo {}" \;
./sqlite_utility.php
./sqlite_result.php
./sqlite_forge.php
./sqlite_driver.php</pre>
<p>既然找到了这些非UTF8编码的文件，接下来再用一条命令将他们都转换成UTF8编码</p>
<p>命令2</p>
<pre class="brush:bash">jw@~/sqlite&gt;
find . ! -iregex '.*\.svn.*' -type f -name '*.php' -exec bash -c "enca -L zh_CN {}  | grep GB2312 &gt;/dev/null &amp;&amp; enconv -L zh_CN -x UTF-8 {}" \;</pre>
<p>当你用命令2 全部转换完成后，如果你期待命令1的输出为空，那么你就错了。实际上英语字母的utf8编码和ASCII编码是一样的。当一个全是英文字母的文件用UTF8 w/o BOM编码保存，那么enca会识别他是一个ACSII编码的文件。所以，你猜到了，命令2做了一些无用功:)</p>

	<h2>您也许会对以下文章感兴趣</h2>
	<ul class="st-related-posts">
	<li><a href="http://tech.lezi.com/archives/47" title="解决近期linux下yum更新出现HTTP Error 404 NOT FOUND错误的办法 (十月 28, 2010)">解决近期linux下yum更新出现HTTP Error 404 NOT FOUND错误的办法</a> (评论：3)</li>
	<li><a href="http://tech.lezi.com/archives/40" title="给rdesktop加一个图形界面GUI (十月 27, 2010)">给rdesktop加一个图形界面GUI</a> (评论：0)</li>
	<li><a href="http://tech.lezi.com/archives/75" title="Fedora/Ubuntu Linux下用wine安装腾讯通RTX成功 (十二月 8, 2010)">Fedora/Ubuntu Linux下用wine安装腾讯通RTX成功</a> (评论：1)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://tech.lezi.com/archives/194/feed</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Fedora/Ubuntu Linux下用wine安装腾讯通RTX成功</title>
		<link>http://tech.lezi.com/archives/75</link>
		<comments>http://tech.lezi.com/archives/75#comments</comments>
		<pubDate>Wed, 08 Dec 2010 13:28:11 +0000</pubDate>
		<dc:creator>neilxp</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[wine]]></category>

		<guid isPermaLink="false">http://tech.lezi.com/?p=75</guid>
		<description><![CDATA[Fedora/Ubuntu Linux下用wine安装腾讯通RTX，方法，问题，版本记录，注意事项]]></description>
			<content:encoded><![CDATA[<p>腾讯的企业通信软件RTX俨然已经成为我们公司开源化的一大障碍。目前也没有合适的开源软件替代之，只有通过wine上安装RTX来解决。</p>
<p>装好后效果如下：</p>
<p><a href="http://tech.lezi.com/wp-content/uploads/2010/12/winemain.png"><img class="alignnone size-full wp-image-89" title="winemain" src="http://tech.lezi.com/wp-content/uploads/2010/12/winemain.png" alt="" width="241" height="661" /></a><br />
<span id="more-75"></span><br />
<a href="http://tech.lezi.com/wp-content/uploads/2010/12/chat_windows.png"><img class="alignnone size-full wp-image-81" title="chat_windows" src="http://tech.lezi.com/wp-content/uploads/2010/12/chat_windows.png" alt="" width="570" height="554" /></a></p>
<p>具体实现方法网上很多：<a title="链接" href="http://www.google.com.hk/search?hl=zh-CN&amp;safe=strict&amp;client=firefox-a&amp;hs=FNf&amp;rls=org.mozilla%3Aen-US%3Aofficial&amp;q=linux+%E5%AE%89%E8%A3%85+rtx&amp;btnG=Google+%E6%90%9C%E7%B4%A2&amp;aq=f&amp;aqi=&amp;aql=&amp;oq=&amp;gs_rfai=">链接</a>，主要的思想是</p>
<ol>
<li>安装Wine</li>
<li>使用<a href="http://wiki.winehq.org/winetricks">winetricks</a>安装RTX要用的库，包括riched20 msxml3 msxml6 vcrun6 win2k。<br />
winetricks是一个很方便的小工具。使用wine时，如果需要安装运用程序依赖的库，如msxml, mfc，就可以使用winetricks很方便地下载安装，像yum/apt一样的使用理念。</li>
<li>通过wine安装rtx客户端</li>
<li>设置中文字体:
<ol>
<li>将中文字体复制到~/.wine/drive_c/windows/Fonts下面。</li>
<li>命令行输入regedit会启动wine的注册表编辑器</li>
<li>注册表里HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\FontLink\SystemLink添加相关字体的健值。<br />
如Tohama添加Tohama=”SimSun.ttc,SimSun”，其他字体也如此办法添加对应</li>
</ol>
</li>
<li>启动rtx, 要确保环境变量LANG是zh_CN.utf8
<pre class="brush:bash">env LANG=zh_CN.utf8 WINEPREFIX="/home/neilxp/.wine" wine C:\\Program\ Files\\Tencent\\RTXC\\RTX.exe</pre>
</li>
</ol>
<h3>Wine下的RTX存在的问题</h3>
<ol>
<li>住窗口列表里的用户名前两个字不能显示</li>
<li>CPU使用率稍微高，有5%左右</li>
<li>无法发送和接受图片、表情</li>
</ol>
<h3>参考版本号</h3>
<ul>
<li>Linux: Fedora 14</li>
<li>wine: 1.3.8</li>
<li>winetricks: 20101106</li>
<li>rtx: 2009formal</li>
</ul>

	<h2>您也许会对以下文章感兴趣</h2>
	<ul class="st-related-posts">
	<li><a href="http://tech.lezi.com/archives/47" title="解决近期linux下yum更新出现HTTP Error 404 NOT FOUND错误的办法 (十月 28, 2010)">解决近期linux下yum更新出现HTTP Error 404 NOT FOUND错误的办法</a> (评论：3)</li>
	<li><a href="http://tech.lezi.com/archives/40" title="给rdesktop加一个图形界面GUI (十月 27, 2010)">给rdesktop加一个图形界面GUI</a> (评论：0)</li>
	<li><a href="http://tech.lezi.com/archives/194" title="一行Linux命令查找所有非UTF-8编码的文件，再一行命令，都转换成UTF-8 (一月 6, 2011)">一行Linux命令查找所有非UTF-8编码的文件，再一行命令，都转换成UTF-8</a> (评论：12)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://tech.lezi.com/archives/75/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>解决近期linux下yum更新出现HTTP Error 404 NOT FOUND错误的办法</title>
		<link>http://tech.lezi.com/archives/47</link>
		<comments>http://tech.lezi.com/archives/47#comments</comments>
		<pubDate>Thu, 28 Oct 2010 02:35:27 +0000</pubDate>
		<dc:creator>neilxp</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://tech.lezi.com/?p=47</guid>
		<description><![CDATA[最近两天使用yum的163源，出现404错误 [root@localhost yum.repos.d]# yum makecache ... ... http://mirrors.163.com/centos/5/os/i386/repodata/repomd.xml: [Errno 14] HTTP Error 404: Not Found Trying other mirror. ... 用浏览器却可以打开http://mirrors.163.com/centos/5/os/i386/repodata/repomd.xml这个文件。后来发现是ipv6的问题，使用curl，不带-4参数也是404错误，使用-4参数后就能访问到该文件。 [root@localhost yum.repos.d]# curl http://mirrors.163.com/centos/5/os/i386/repodata/repomd.xml &#60;!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"&#62; &#60;html&#62;&#60;head&#62; &#60;title&#62;404 Not Found&#60;/title&#62; &#60;/head&#62;&#60;body&#62; &#60;h1&#62;Not Found&#60;/h1&#62; &#60;p&#62;The requested URL /centos/5/os/i386/repodata/repomd.xml was not found on this server.&#60;/p&#62; &#60;hr&#62; &#60;address&#62;Apache Server at mirrors.163.com Port 80&#60;/address&#62; &#60;/body&#62;&#60;/html&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>最近两天使用yum的163源，出现404错误</p>
<pre class="brush:plain text">[root@localhost yum.repos.d]# yum makecache
...
...
http://mirrors.163.com/centos/5/os/i386/repodata/repomd.xml: [Errno 14] HTTP Error 404: Not Found
Trying other mirror.
...</pre>
<p><span id="more-47"></span>用浏览器却可以打开http://mirrors.163.com/centos/5/os/i386/repodata/repomd.xml这个文件。后来发现是ipv6的问题，使用curl，不带-4参数也是404错误，使用-4参数后就能访问到该文件。</p>
<pre class="brush:plain text">[root@localhost yum.repos.d]# curl http://mirrors.163.com/centos/5/os/i386/repodata/repomd.xml
&lt;!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"&gt;
&lt;html&gt;&lt;head&gt;
&lt;title&gt;404 Not Found&lt;/title&gt;
&lt;/head&gt;&lt;body&gt;
&lt;h1&gt;Not Found&lt;/h1&gt;
&lt;p&gt;The requested URL /centos/5/os/i386/repodata/repomd.xml was not found on this server.&lt;/p&gt;
&lt;hr&gt;
&lt;address&gt;Apache Server at mirrors.163.com Port 80&lt;/address&gt;
&lt;/body&gt;&lt;/html&gt;</pre>
<p>强制使用IPv4</p>
<pre class="brush:plain text">[root@localhost yum.repos.d]# curl http://mirrors.163.com/centos/5/os/i386/repodata/repomd.xml -4
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;repomd xmlns="http://linux.duke.edu/metadata/repo"&gt;
&lt;data type="other_db"&gt;
...
...
&lt;checksum type="sha"&gt;c0745a5c86eabe53dfc06811be5344544a21089e&lt;/checksum&gt;
&lt;timestamp&gt;1272326316&lt;/timestamp&gt;
&lt;/data&gt;
&lt;/repomd&gt;</pre>
<h3>解决方案</h3>
<p>以下方案二者选一即可</p>
<ol>
<li>将mirrors.163.com的IPv4地址写入到/etc/hosts文件
<pre class="brush:bash">[root@localhost ~]# echo `host mirrors.163.com|cut -d' ' -f 4` mirrors.163.com &gt;&gt; /etc/hosts</pre>
</li>
<li>重命名/lib/modules/2.6.x/kernel/net/ipv6后重启。
<pre class="brush:bash">[root@localhost ~]# mv /lib/modules/2.6.x/kernel/net/ipv6 /lib/modules/2.6.x/kernel/net/ipv6.bak
[root@localhost ~]# init 6</pre>
</li>
</ol>
<p>ps: 如果你在你的linux机器上用git clone复制sourceforge.net的源代码时，提示密码错误，而Windows上同样的密码可以，也是这个问题，使用方案2即可。</p>

	<h2>您也许会对以下文章感兴趣</h2>
	<ul class="st-related-posts">
	<li><a href="http://tech.lezi.com/archives/40" title="给rdesktop加一个图形界面GUI (十月 27, 2010)">给rdesktop加一个图形界面GUI</a> (评论：0)</li>
	<li><a href="http://tech.lezi.com/archives/194" title="一行Linux命令查找所有非UTF-8编码的文件，再一行命令，都转换成UTF-8 (一月 6, 2011)">一行Linux命令查找所有非UTF-8编码的文件，再一行命令，都转换成UTF-8</a> (评论：12)</li>
	<li><a href="http://tech.lezi.com/archives/75" title="Fedora/Ubuntu Linux下用wine安装腾讯通RTX成功 (十二月 8, 2010)">Fedora/Ubuntu Linux下用wine安装腾讯通RTX成功</a> (评论：1)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://tech.lezi.com/archives/47/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>给rdesktop加一个图形界面GUI</title>
		<link>http://tech.lezi.com/archives/40</link>
		<comments>http://tech.lezi.com/archives/40#comments</comments>
		<pubDate>Wed, 27 Oct 2010 07:46:01 +0000</pubDate>
		<dc:creator>neilxp</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://tech.lezi.com/?p=40</guid>
		<description><![CDATA[公司的会议室电脑安装Fedora 12操作系统，以提倡开源节流（使用开源软件，省钱）。 开会有时候需要远程连接到Windows计算机，因此装了rdesktop这个Windows远程连接客户端。但是客户端使用时，IP地址是命令行输入的。为了能降低使用门槛，特了做一个rdesktop的图形界面前端。使用前需要安装xdialog这个程序。 #!/bin/bash DIA=Xdialog LOG_FILE=~/.rdesktop-gui.log DEFAULT_HOST=192.168.7.102 PROMPT="请输入要连接的主机IP地址\n进入/退出全屏，按\"Ctrl+Alt+回车\"" HOST=$($DIA --stdout --inputbox "$PROMPT" 10 40 $DEFAULT_HOST ) if [ $? -ne 0 ]; then exit 0 fi echo `date`": $HOST" &#62;&#62; $LOG_FILE rdesktop $HOST -g1024x768 您也许会对以下文章感兴趣 解决近期linux下yum更新出现HTTP Error 404 NOT FOUND错误的办法 (评论：3) 一行Linux命令查找所有非UTF-8编码的文件，再一行命令，都转换成UTF-8 (评论：12) Fedora/Ubuntu Linux下用wine安装腾讯通RTX成功 (评论：1)]]></description>
			<content:encoded><![CDATA[<p><a href="http://tech.lezi.com/wp-content/uploads/2010/10/rdesktop-gui.png"><img class="size-full wp-image-41 alignright" title="rdesktop-gui" src="http://tech.lezi.com/wp-content/uploads/2010/10/rdesktop-gui.png" alt="rdesktop-gui" width="248" height="157" /></a>公司的会议室电脑安装Fedora 12操作系统，以提倡开源节流（使用开源软件，省钱）。</p>
<p>开会有时候需要远程连接到Windows计算机，因此装了rdesktop这个Windows远程连接客户端。但是客户端使用时，IP地址是命令行输入的。为了能降低使用门槛，特了做一个rdesktop的图形界面前端。<span id="more-40"></span>使用前需要安装xdialog这个程序。</p>
<pre class="brush:bash">#!/bin/bash
DIA=Xdialog
LOG_FILE=~/.rdesktop-gui.log
DEFAULT_HOST=192.168.7.102
PROMPT="请输入要连接的主机IP地址\n进入/退出全屏，按\"Ctrl+Alt+回车\""
HOST=$($DIA --stdout --inputbox "$PROMPT" 10 40 $DEFAULT_HOST )
if [ $? -ne 0 ]; then
exit 0
fi
echo `date`": $HOST" &gt;&gt; $LOG_FILE
rdesktop $HOST -g1024x768</pre>

	<h2>您也许会对以下文章感兴趣</h2>
	<ul class="st-related-posts">
	<li><a href="http://tech.lezi.com/archives/47" title="解决近期linux下yum更新出现HTTP Error 404 NOT FOUND错误的办法 (十月 28, 2010)">解决近期linux下yum更新出现HTTP Error 404 NOT FOUND错误的办法</a> (评论：3)</li>
	<li><a href="http://tech.lezi.com/archives/194" title="一行Linux命令查找所有非UTF-8编码的文件，再一行命令，都转换成UTF-8 (一月 6, 2011)">一行Linux命令查找所有非UTF-8编码的文件，再一行命令，都转换成UTF-8</a> (评论：12)</li>
	<li><a href="http://tech.lezi.com/archives/75" title="Fedora/Ubuntu Linux下用wine安装腾讯通RTX成功 (十二月 8, 2010)">Fedora/Ubuntu Linux下用wine安装腾讯通RTX成功</a> (评论：1)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://tech.lezi.com/archives/40/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
