<?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>z.flier</title>
	<atom:link href="http://www.zflier.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.zflier.com</link>
	<description>Just another WordPress site</description>
	<lastBuildDate>Wed, 05 Oct 2011 08:35:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Ubuntu 11.04, sudo不再提示输入密码</title>
		<link>http://www.zflier.com/312-ubuntu-11-04-sudo%e4%b8%8d%e5%86%8d%e6%8f%90%e7%a4%ba%e8%be%93%e5%85%a5%e5%af%86%e7%a0%81/</link>
		<comments>http://www.zflier.com/312-ubuntu-11-04-sudo%e4%b8%8d%e5%86%8d%e6%8f%90%e7%a4%ba%e8%be%93%e5%85%a5%e5%af%86%e7%a0%81/#comments</comments>
		<pubDate>Wed, 05 Oct 2011 08:33:40 +0000</pubDate>
		<dc:creator>webflier</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.zflier.com/?p=312</guid>
		<description><![CDATA[bash下输入 sudo visudo 进入编辑状态 将 %admin ALL=(ALL) ALL 改为 %admin ALL=(ALL) NOPASSWD: ALL 即可]]></description>
			<content:encoded><![CDATA[<p>bash下输入<br />
<code>sudo visudo</code><br />
进入编辑状态<br />
将<br />
<code>%admin ALL=(ALL)  ALL</code><br />
改为<br />
<code>%admin ALL=(ALL) NOPASSWD: ALL</code><br />
即可</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zflier.com/312-ubuntu-11-04-sudo%e4%b8%8d%e5%86%8d%e6%8f%90%e7%a4%ba%e8%be%93%e5%85%a5%e5%af%86%e7%a0%81/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HOWTO:安装和配置 lighttpd webserver</title>
		<link>http://www.zflier.com/128-howto%e5%ae%89%e8%a3%85%e5%92%8c%e9%85%8d%e7%bd%ae-lighttpd-webserver/</link>
		<comments>http://www.zflier.com/128-howto%e5%ae%89%e8%a3%85%e5%92%8c%e9%85%8d%e7%bd%ae-lighttpd-webserver/#comments</comments>
		<pubDate>Sat, 16 Aug 2008 10:58:49 +0000</pubDate>
		<dc:creator>webflier</dc:creator>
				<category><![CDATA[i.t.]]></category>

		<guid isPermaLink="false">http://www.zflier.com/2008/08/16/howto%e5%ae%89%e8%a3%85%e5%92%8c%e9%85%8d%e7%bd%ae-lighttpd-webserver/</guid>
		<description><![CDATA[lighttpd是一个可运行在UNIX/Linux和Windows操作系统上的web服务器软件。和Apache类似。lighttped有时也被称为lighty。 lighttpd特别针对速度进行优化，致力于设计一个安全、快速、与标准兼容和灵活的web服务器。它的小内存占用（和其他web服务器相比）、低cpu负载和快速相应使它更适用于面临负载危机的服务器。请移步官方网站获取详细信息。 本文将指导你如何安装lighttpd服务器，并进行简单配置. 安装lighttpd 如果你使用基于RPM的发行版 (RedHat, Fedora 等) 请从此处下载 下载Fedora Core RPM Binary: $ cd /tmp $ wget http://lighttpd.net/download/lighttpd-1.4.13-1.i386.rpm $ su - # rpm -ivh lighttpd-1.4.13-1.i386.rpm 请跳至 配置lighttpd 章节. Debian Linux 用户使用apt-get命令来安装: # apt-get install lighttpd 请跳至 配置lighttpd 章节. 从源码安装 &#8230; <a href="http://www.zflier.com/128-howto%e5%ae%89%e8%a3%85%e5%92%8c%e9%85%8d%e7%bd%ae-lighttpd-webserver/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>lighttpd是一个可运行在UNIX/Linux和Windows操作系统上的web服务器软件。和Apache类似。lighttped有时也被称为lighty。</p>
<p>lighttpd特别针对速度进行优化，致力于设计一个安全、快速、与标准兼容和灵活的web服务器。它的小内存占用（和其他web服务器相比）、低cpu负载和快速相应使它更适用于面临负载危机的服务器。请移步<a href="http://www.lighttpd.net" target="_blank">官方网站</a>获取详细信息。</p>
<p>本文将指导你如何安装lighttpd服务器，并进行简单配置.</p>
<h5>安装lighttpd</h5>
<p>如果你使用基于RPM的发行版 (RedHat, Fedora 等) 请从<a href="http://lighttpd.net/">此处</a>下载</p>
<h6>下载Fedora Core RPM Binary:</h6>
<pre class="text" name="code" xml:space="preserve">$ cd /tmp
$ wget http://lighttpd.net/download/lighttpd-1.4.13-1.i386.rpm
$ su -
# rpm -ivh lighttpd-1.4.13-1.i386.rpm </pre>
<p>请跳至 配置lighttpd 章节.</p>
<h6>Debian Linux 用户使用apt-get命令来安装:</h6>
<pre class="text" name="code" xml:space="preserve">  # apt-get install lighttpd </pre>
<p>请跳至 配置lighttpd 章节.</p>
<h5>从源码安装</h5>
<p>以上的RPM包不包含mod_rewrite等其他东西，所以你可以从源代码进行编译(注意：源代码安装仅推荐有经验的用户使用)：</p>
<pre class="text" name="code" xml:space="preserve"> $ cd /tmp</pre>
<p>取得最新源码：</p>
<pre class="text" name="code" xml:space="preserve"> $ wget http://lighttpd.net/download/lighttpd-1.4.13.tar.gz </pre>
<p>解压：</p>
<pre class="text" name="code" xml:space="preserve">
$ tar -zxvf lighttpd-1.4.13.tar.gz
$ cd lighttpd-1.4.13</pre>
<h6>运行 ./configure </h6>
<pre class="text" name="code" xml:space="preserve">$ ./configure --host=i686-redhat-linux-gnu \
         --build=i686-redhat-linux-gnu \
         --target=i386-redhat-linux \
         --program-prefix= --prefix=/usr \
         --exec-prefix=/usr \
         --bindir=/usr/bin \
         --sbindir=/usr/sbin \
         --sysconfdir=/etc \
         --datadir=/usr/share \
         --includedir=/usr/include \
         --libdir=/usr/lib \
         --libexecdir=/usr/libexec \
         --localstatedir=/var \
         --sharedstatedir=/usr/com \
         --mandir=/usr/share/man \
         --infodir=/usr/share/info \
         --with-openssl \
         --with-pcre \
         --with-zlib \
         --with-bzip2 \
         --disable-ipv6 \
         --with-PACKAGE=mod_redirect \
         --with-rewrite \
         --with-redirect \
         --with-ssi</pre>
<p>以上编译选项使lighttpd支持SSL, mod_rewrite, ssi, mod_redirect etc. 运行一下命令可以得到具体的参数帮助：</p>
<pre class="text" name="code" xml:space="preserve"> $ ./configure --help | less</pre>
<p>安装lighttpd:</p>
<pre class="text" name="code" xml:space="preserve">$ make
# make install</pre>
<p>创建配置目录：</p>
<pre class="text" name="code" xml:space="preserve">   # mkdir /etc/lighttpd/ </pre>
<p>创建lighttp用户和用户组</p>
<pre class="text" name="code" xml:space="preserve"> # groupadd lighttpd
# useradd -g lighttpd -d /var/www/html -s /sbin/nologin lighttpd
OR
# adduser -g lighttpd -d /var/www/html -s /sbin/nologin lighttpd</pre>
<p>创建log目录：</p>
<pre class="text" name="code" xml:space="preserve">   # mkdir /var/log/lighttpd
# chown lighttpd:lighttpd /var/log/lighttpd</pre>
<p>下载配置文件和启动文件的sample：</p>
<pre class="text" name="code" xml:space="preserve"># cd /etc/lighttpd
# wget http://www.cyberciti.biz/tips/wp-content/uploads/2006/07/lighttpd.conf.txt
# mv lighttpd.conf.txt lighttpd.conf
# chown lighttpd:root /etc/lighttpd/lighttpd.conf
# cd /etc/init.d/
# wget http://www.cyberciti.biz/tips/wp-content/uploads/2006/07/lighttpd.txt
# mv lighttpd.txt lighttpd
# chmod +x lighttpd </pre>
<p><a name="lightyconfig"></a></p>
<h5>配置lighttpd</h5>
<p>下面两个文件对lighttpd很重要：</p>
<ul>
<li>默认的lighttpd配置文件: /etc/lighttpd/lighttpd.conf
<li>lighttpd服务启动脚本: /etc/init.d/lighttpd </li>
</ul>
<p>所有的二进制方式安装都会安装这两个文件。 <br />现在lighttpd已安装完成。下面开始配置。</p>
<h6>删除apache </h6>
<p>如果你不准备再使用<strong>Apache v1.3/2.x ，</strong>最好删除它 (确保你备份了数据文件和配置文件):</p>
<pre class="text" name="code" xml:space="preserve"># rpm -e httpd
# yum remove httpd
# apt-get remove apache2</pre>
<h6>理解lighttpd主要配置参数</h6>
<p>下面是lighttpd的主要配置参数：</p>
<ul>
<li><strong>server.document-root = &#8220;/var/www/html&#8221;</strong>: 指定服务器的默认根目录。
<li><strong>server.port = 80</strong>: 指定默认的http端口。
<li><strong>server.username = &#8220;lighttpd&#8221;</strong>
<li><strong>server.groupname = &#8220;lighttpd&#8221;</strong>: 指定开启和停止lighttpd服务的默认用户和用户组。这是一个安全功能（可以不必是root来操作）。
<li><strong>server.bind = &#8220;server-ip-address&#8221;</strong>: 指定服务器IP或域名，如 theos.in.
<li><strong>server.tag =&#8221;lighttpd&#8221;</strong>: 用来设置lighttpd的名称和版本(默认)。 这也是一个安全功能。 你可以设置成如下值：
<pre class="text" name="code" xml:space="preserve">server.tag ="myWebServer v1.0"</pre>
<p>注意，这个信息会在http头中显示。 (可以通过 <a href="http://netcraft.com/">netcraft</a>看到) </p>
<li><strong>server.errorlog = &#8220;/var/log/lighttpd/error.log&#8221;</strong>: 指定错误日志文件。
<li><strong>accesslog.filename = &#8220;/var/log/lighttpd&#8221;</strong>: 指定访问日志文件(可通过日志文件分析得到访问统计信息)。
<li><strong>index-file.names = ( &#8220;index.php&#8221;, &#8220;index.html&#8221; )</strong>: 指定index文件. </li>
</ul>
<p><strong>server.modules = ( <br />&#8220;mod_access&#8221;, <br />&#8220;mod_accesslog&#8221;, <br />&#8220;mod_fastcgi&#8221;, <br />&#8220;mod_rewrite&#8221;, <br />&#8220;mod_auth&#8221; <br />)</strong>: 以上模块会被加载:</p>
<ul>
<li>mod_access: 用来限制访问某些后缀的文件
<li>mod_accesslog: 记录CLF log, 类似与apache
<li>mod_fastcgi : FastCGI调用perl/PHP等
<li>mod_rewrite : 生成SEO友好的url
<li>mod_auth: 验证(用密码保护目录) </li>
</ul>
<p><strong>mimetype.assign = ( <br />&#8220;.pdf&#8221; =&gt; &#8220;application/pdf&#8221;, <br />&#8220;.sig&#8221; =&gt; &#8220;application/pgp-signature&#8221; <br />)</strong>: 设置mimetype映射.</p>
<p>打开文件/etc/lighttpd/lighttpd.conf，设置以上参数：</p>
<pre class="text" name="code" xml:space="preserve">

# vi /etc/lighttpd/lighttpd.conf
</pre>
<p>保存文件，启动lighttpd：</p>
<pre class="text" name="code" xml:space="preserve">

# /etc/init.d/lighttpd start
</pre>
<p>验证lighttpd是否在运行:</p>
<pre class="text" name="code" xml:space="preserve">

$ netstat -ntulp
</pre>
<p>Output:</p>
<pre class="text" name="code" xml:space="preserve">Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      29855/sshd
tcp        0      0 203.111.103.81:80           0.0.0.0:*                   LISTEN      5866/lighttpd
...
.....
..</pre>
<p>打开浏览器，输入url测试: http://your-domain.com/ or http://server-ip/</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zflier.com/128-howto%e5%ae%89%e8%a3%85%e5%92%8c%e9%85%8d%e7%bd%ae-lighttpd-webserver/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Howto: Linux Lighttpd SSL (secure server layer) https 安装和配置</title>
		<link>http://www.zflier.com/127-howto-linux-lighttpd-ssl-secure-server-layer-https-%e5%ae%89%e8%a3%85%e5%92%8c%e9%85%8d%e7%bd%ae/</link>
		<comments>http://www.zflier.com/127-howto-linux-lighttpd-ssl-secure-server-layer-https-%e5%ae%89%e8%a3%85%e5%92%8c%e9%85%8d%e7%bd%ae/#comments</comments>
		<pubDate>Sat, 16 Aug 2008 10:01:28 +0000</pubDate>
		<dc:creator>webflier</dc:creator>
				<category><![CDATA[i.t.]]></category>

		<guid isPermaLink="false">http://www.zflier.com/2008/08/16/howto-linux-lighttpd-ssl-secure-server-layer-https-%e5%ae%89%e8%a3%85%e5%92%8c%e9%85%8d%e7%bd%ae/</guid>
		<description><![CDATA[SSL是一种加密协议，为电子邮件、web网页等Internet服务提供安全的通信。 SSL证书是一种数字证书，用来标识网站并且使用SSL技术加密服务器和客户端通信时的数据。 SSL对电子商务网站特别有用，使用网上银行付款、用户登录和注册等行为都离不开SSL。 为了要购买一个数字证书，你必须先生成一个Certificate Signing Request (CSR)，并提交给Certification Authority (CA)。CSR中包含有你使用证书的程序的相关信息，还有你的public key。你的Web服务器软件可以生成CSR(openssl命令)，同时生成public/private key，这将用来加密和解密你的安全链接。 必备条件 Lighttpd webserver with SSL support 独立IP地址 CA颁发给你的SSL 证书 域名 &#8211; theos.in (为方便举例，这里使用 theos.in ) 服务器上一些重要文件 /etc/lighttpd/theos.in/ &#8211; 存储SSL证书和相关文件的目录 /etc/lighttpd/theos.in/theos.in.key &#8211; 你的private key，永远不要把这个文件给别人，lighttpd用这个文件来加密信息。 /etc/lighttpd/theos.in/theos.in.csr &#8211; 当你去CA处请求颁发SSL证书时，你需要将这个文件的内容提供给他们，这里面有你的public key。 /etc/lighttpd/theos.in/theos.in.pem &#8211; &#8230; <a href="http://www.zflier.com/127-howto-linux-lighttpd-ssl-secure-server-layer-https-%e5%ae%89%e8%a3%85%e5%92%8c%e9%85%8d%e7%bd%ae/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>SSL是一种加密协议，为电子邮件、web网页等Internet服务提供安全的通信。 </p>
<p>SSL证书是一种数字证书，用来标识网站并且使用SSL技术加密服务器和客户端通信时的数据。 </p>
<p>SSL对电子商务网站特别有用，使用网上银行付款、用户登录和注册等行为都离不开SSL。 </p>
<p>为了要购买一个数字证书，你必须先生成一个Certificate Signing Request (CSR)，并提交给Certification Authority (CA)。CSR中包含有你使用证书的程序的相关信息，还有你的public key。你的Web服务器软件可以生成CSR(openssl命令)，同时生成public/private key，这将用来加密和解密你的安全链接。 </p>
<p><strong>必备条件</strong> </p>
<ul>
<li>Lighttpd webserver with SSL support </li>
<li>独立IP地址 </li>
<li>CA颁发给你的SSL 证书 </li>
<li>域名 &#8211; theos.in (为方便举例，这里使用 theos.in ) </li>
</ul>
<p><strong>服务器上一些重要文件 </strong></p>
<ul>
<li>/etc/lighttpd/theos.in/ &#8211; 存储SSL证书和相关文件的目录 </li>
<li>/etc/lighttpd/theos.in/theos.in.key &#8211; 你的private key，永远不要把这个文件给别人，lighttpd用这个文件来加密信息。 </li>
<li>/etc/lighttpd/theos.in/theos.in.csr &#8211; 当你去CA处请求颁发SSL证书时，你需要将这个文件的内容提供给他们，这里面有你的public key。 </li>
<li>/etc/lighttpd/theos.in/theos.in.pem &#8211; 这个文件里面包含了private keys (RSA and DSA), public keys (RSA and DSA) 和 (x509) 证书通常，你的密钥和证书都存放在这个文件中。 </li>
</ul>
<p><strong>CA的一些重要文件</strong> </p>
<ul>
<li>&#160;&#160;&#160; CA_issuing.crt &#8211; 你的 intermediate certificate 或 chained root certificate 文件。 </li>
<li>&#160;&#160;&#160;&#160; theos.in.crt &#8211; 你的域名证书。</li>
</ul>
<p>以下是具体步骤 </p>
<p><strong>Step # 1: 生成certificate signing request (CSR)      <br /></strong>首先，用openssl命令生成域名theos.in的certificate-signing request： </p>
<blockquote><p># mkdir -p /etc/lighttpd/ssl/theos.in      <br /># cd /etc/lighttpd/ssl/theos.in </p>
</blockquote>
<p>创建 RSA key: </p>
<blockquote><p># openssl genrsa -des3 -out theos.in.key 1024 </p>
</blockquote>
<p>创建CSR: </p>
<blockquote><p># openssl req -new -key theos.in.key -out theos.in.csr </p>
</blockquote>
<p>程序会提示你输入域名等信息。如果你申请通配证书(wildcard certificate)，请用*号，比如*.theos.in。这样，你的子域名也可以用这个证书。</p>
<p>然后，把theos.in.csr提交到CA，通常，这是CA要让你交钱，还要验证你是这个域名的所有者。一旦CA批准了你的申请，你就可以下载证书并将其用在lighttpd服务器上了。 </p>
<p><strong>Step # 2: 准备证书</strong>     <br />你的CA已经颁发给你证书，你要做的就是将这个证书安装在lighttpd服务器上。</p>
<p>复制下载下来的证书 (theos.in.crt) 到 /etc/lighttpd/ssl/theos.in </p>
<blockquote><p># cp theos.in.crt /etc/lighttpd/ssl/theos.in </p>
</blockquote>
<p>生成 pem 文件、设置权限： </p>
<blockquote><p># cat theos.in.key theos.in.crt &gt; theos.in.pem      <br /># chmod 0600 theos.in.pem       <br /># chown lighttpd:lighttpd /etc/lighttpd/ssl/theos.in -R </p>
</blockquote>
<p><strong>Step #3: 确保lighttpd支持ssl</strong>     <br />用以下命令检查lighttpd是否支持ssl: </p>
<blockquote><p>[vivek@cyberciti.biz]$ /usr/sbin/lighttpd -v      <br />lighttpd-1.4.11 (ssl) &#8211; a light and fast webserver       <br />Build-Date: Jul 12 2006 13:47:40 </p>
</blockquote>
<p>否则，参考安装和配置lighttpd。</p>
<p><strong>Step #4: 配置lighttpd，是你的域名支持ssl      <br /></strong>打开lighttpd配置文件&#160; </p>
<blockquote><p># vi /etc/lighttpd/lighttpd.conf </p>
</blockquote>
<p>加下面这段信息: </p>
<blockquote><p>$SERVER[&quot;socket&quot;] == &quot;theos.in:443&quot; {      <br />ssl.engine = &quot;enable&quot;       <br />ssl.pemfile = &quot;/etc/lighttpd/theos.in/theos.in.pem&quot;       <br />ssl.ca-file = &quot;/etc/lighttpd/theos.in/CA_issuing.crt&quot;       <br />server.name = &quot;theos.in&quot;       <br />server.document-root = &quot;/home/lighttpd/theos.in/https&quot;       <br />server.errorlog = &quot;/var/log/lighttpd/theos.in/serror.log&quot;       <br />accesslog.filename = &quot;/var/log/lighttpd/theos.in/saccess.log&quot;       <br />} </p>
</blockquote>
<p>其中， </p>
<ul>
<li>ssl.engine = &quot;enable&quot; : 打开lighttpd ssl开关&#160; </li>
<li>ssl.pemfile = &quot;/etc/lighttpd/theos.in/theos.in.pem&quot; &#8211; 你的PEM文件 </li>
<li>ssl.ca-file = &quot;/etc/lighttpd/theos.in/CA_issuing.crt&quot; &#8211; 你的 intermediate certificate 文件 </li>
</ul>
<p>保存并关闭这个文件。重启lighttpd服务器(会提示你输入SSL private key的密码): </p>
<blockquote><p># /etc/init.d/lighttpd restart </p>
</blockquote>
<p>显示: </p>
<blockquote><p>Password: </p>
</blockquote>
<p>打开浏览器输入url: https://yourdomain.com (<a href="https://theos.in">https://theos.in</a>),测试ssl是否工作正常。</p>
<p>翻译自：<a title="http://www.cyberciti.biz/tips/how-to-install-ssl-lighttpd-https-configuration.html" href="http://www.cyberciti.biz/tips/how-to-install-ssl-lighttpd-https-configuration.html">http://www.cyberciti.biz/tips/how-to-install-ssl-lighttpd-https-configuration.html</a></p>
<p>注：一般CA的证书都需要钱，如果需要免费的，可使用self-signed证书，或者去<a href="http://www.cacert.org">http://www.cacert.org</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.zflier.com/127-howto-linux-lighttpd-ssl-secure-server-layer-https-%e5%ae%89%e8%a3%85%e5%92%8c%e9%85%8d%e7%bd%ae/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu 7.10通过USB连接手机GPRS上网</title>
		<link>http://www.zflier.com/113-ubuntu-710%e9%80%9a%e8%bf%87usb%e8%bf%9e%e6%8e%a5%e6%89%8b%e6%9c%bagprs%e4%b8%8a%e7%bd%91/</link>
		<comments>http://www.zflier.com/113-ubuntu-710%e9%80%9a%e8%bf%87usb%e8%bf%9e%e6%8e%a5%e6%89%8b%e6%9c%bagprs%e4%b8%8a%e7%bd%91/#comments</comments>
		<pubDate>Tue, 05 Feb 2008 13:59:24 +0000</pubDate>
		<dc:creator>webflier</dc:creator>
				<category><![CDATA[i.t.]]></category>

		<guid isPermaLink="false">http://www.zflier.com/2008/02/05/ubuntu-710%e9%80%9a%e8%bf%87usb%e8%bf%9e%e6%8e%a5%e6%89%8b%e6%9c%bagprs%e4%b8%8a%e7%bd%91/</guid>
		<description><![CDATA[前提条件：有GPRS Modem功能的手机，并开通GPRS。 激活手机的GPRS Modem功能（如果需要的话，参考手机说明书），用数据线连接电脑。 在terminal输入命令dmesg，查看最后几行，找出手机所在的设备 [ 7462.292000] usb 1-1: new full speed USB device using uhci_hcd and address 16 [ 7462.440000] usb 1-1: configuration #1 chosen from 1 choice [ 7462.452000] ipaq 1-1:1.0: PocketPC PDA converter detected [ 7462.464000] usb &#8230; <a href="http://www.zflier.com/113-ubuntu-710%e9%80%9a%e8%bf%87usb%e8%bf%9e%e6%8e%a5%e6%89%8b%e6%9c%bagprs%e4%b8%8a%e7%bd%91/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<ol>
<li>前提条件：有GPRS Modem功能的手机，并开通GPRS。</li>
<li>激活手机的GPRS Modem功能（如果需要的话，参考手机说明书），用数据线连接电脑。</li>
<li>在terminal输入命令dmesg，查看最后几行，找出手机所在的设备</li>
<pre xml:space="preserve" name="code" class="javascript" cols="60">[ 7462.292000] usb 1-1: new full speed USB device using uhci_hcd and address 16
[ 7462.440000] usb 1-1: configuration #1 chosen from 1 choice
[ 7462.452000] ipaq 1-1:1.0: PocketPC PDA converter detected
[ 7462.464000] usb 1-1: PocketPC PDA converter now attached to ttyUSB0
[ 9148.688000] usb 1-2: USB disconnect, address 14</pre>
<p>比如从以上信息可以看出，手机的设备名是ttyUSB0,记下备用。</p>
<li>以root身份创建文件：/etc/ppp/peers/gprs.chat</li>
<pre xml:space="preserve" name="code" class="javascript" cols="60">TIMEOUT 35
ECHO ONHANGUP ON''      \rAT
OK      ATZ
OK      'AT+CGDCONT=1,"IP","CMNET","",0,0'
OK      ATD*99#
CONNECT ""</pre>
<p>关于最后两行，需要的话请参考说明书，这两行的参数和在windows上用你手机上网时设置的参数是一样的。<br />
第一行为额外命令，第二行为拨的号码。</p>
<li>以root身份创建文件：/etc/ppp/peers/gprs</li>
<pre xml:space="preserve" name="code" class="javascript" cols="60">/dev/ttyUSB0
connect '/usr/sbin/chat -v -f /etc/ppp/peers/gprs.chat'
noauth
defaultroute
usepeerdns
lcp-echo-interval 65535
debug</pre>
<p>以上的ttyUSB0即第3步中记录的设备名，根据自己的实际情况替换。</ol>
<p>那么怎么拨号上网呢？只需在terminal中敲入：pon gprs，随后可以敲plog查看连接信息。如需中断连接，则只需敲入：poff gprs即可。<br />
以上实验在Ubuntu7.10 + dopod 565 + USB线上通过。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zflier.com/113-ubuntu-710%e9%80%9a%e8%bf%87usb%e8%bf%9e%e6%8e%a5%e6%89%8b%e6%9c%bagprs%e4%b8%8a%e7%bd%91/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Controls collection cannot be modified because the control contains code blocks</title>
		<link>http://www.zflier.com/112-the-controls-collection-cannot-be-modified-because-the-control-contains-code-blocks/</link>
		<comments>http://www.zflier.com/112-the-controls-collection-cannot-be-modified-because-the-control-contains-code-blocks/#comments</comments>
		<pubDate>Sun, 03 Feb 2008 02:05:46 +0000</pubDate>
		<dc:creator>webflier</dc:creator>
				<category><![CDATA[i.t.]]></category>

		<guid isPermaLink="false">http://www.zflier.com/2008/02/03/the-controls-collection-cannot-be-modified-because-the-control-contains-code-blocks/</guid>
		<description><![CDATA[原来我在网页中的client javascript ，使用了 &#60;%=%&#62;，如下 function setField() { var strUrl = "InvoiceDisplayFieldSetting.aspx?oid=&#60;%=OID%&#62;"; window.showModalDialog(strUrl,"setField", "dialogWidth:400px;dialogHeight:630px; center:1;scroll:0;help:0;status:0;resizable=0"); } 在 html 中的不会有问题, 但使用了&#60;head runat=&#8221;server&#8221;&#62; 后, client side javacript 就不能使用解法是override OnInit()如下 override protected void OnInit(EventArgs e) { InitializeComponent(); base.OnInit(e); Page.DataBind(); } 然后在 client side javacript &#8230; <a href="http://www.zflier.com/112-the-controls-collection-cannot-be-modified-because-the-control-contains-code-blocks/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>原来我在网页中的client javascript ，使用了 &lt;%=%&gt;，如下<br/></p>
<pre xml:space="preserve" cols="60" name="code" class="javascript">
function setField() {
  var strUrl = "InvoiceDisplayFieldSetting.aspx?oid=&lt;%=OID%&gt;";
  window.showModalDialog(strUrl,"setField",
  "dialogWidth:400px;dialogHeight:630px;
  center:1;scroll:0;help:0;status:0;resizable=0");
  }
</pre>
<p><br/>
<p>在 html 中的不会有问题, 但使用了&lt;head runat=&#8221;server&#8221;&gt; 后, client side javacript 就不能使用<br/>解法是override OnInit()<br/>如下<br/></p>
<pre xml:space="preserve" cols="60" name="code" class="csharp">
override protected void OnInit(EventArgs e)
  {
  InitializeComponent();
  base.OnInit(e);
  Page.DataBind();
  }
</pre>
<p>然后在 client side javacript ，改用 &lt;%# OID%&gt;<br/>大功告成<br/><br/></p>
]]></content:encoded>
			<wfw:commentRss>http://www.zflier.com/112-the-controls-collection-cannot-be-modified-because-the-control-contains-code-blocks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Godaddy cron job 的执行时间最大是36秒</title>
		<link>http://www.zflier.com/111-godaddy-cron-job-%e7%9a%84%e6%89%a7%e8%a1%8c%e6%97%b6%e9%97%b4%e6%9c%80%e5%a4%a7%e6%98%af36%e7%a7%92/</link>
		<comments>http://www.zflier.com/111-godaddy-cron-job-%e7%9a%84%e6%89%a7%e8%a1%8c%e6%97%b6%e9%97%b4%e6%9c%80%e5%a4%a7%e6%98%af36%e7%a7%92/#comments</comments>
		<pubDate>Sat, 12 Jan 2008 13:37:43 +0000</pubDate>
		<dc:creator>webflier</dc:creator>
				<category><![CDATA[i.t.]]></category>

		<guid isPermaLink="false">http://www.zflier.com/2008/01/12/godaddy-cron-job-%e7%9a%84%e6%89%a7%e8%a1%8c%e6%97%b6%e9%97%b4%e6%9c%80%e5%a4%a7%e6%98%af36%e7%a7%92/</guid>
		<description><![CDATA[想想也是，这种相对来说比较便宜的共享空间，也不会让你占用太多的系统资源。 刚写了一个死循环的脚本，跑了一下，得出的时间是36妙。 #!/usr/local/bin/ruby # index.cgi require "time" i=0 tm = Time.now newfile = File.open( "time1.html", "w+",0644) newfile]]></description>
			<content:encoded><![CDATA[<p>想想也是，这种相对来说比较便宜的共享空间，也不会让你占用太多的系统资源。<br />
刚写了一个死循环的脚本，跑了一下，得出的时间是36妙。</p>
<pre name="code" class="ruby" cols="60">
#!/usr/local/bin/ruby
# index.cgi
require "time"

i=0
tm = Time.now
newfile = File.open( "time1.html", "w+",0644)
newfile << tm.min().to_s + ":" + tm.sec().to_s + "\n"
newfile.close

while true
  i=i+1
  if i % 1000000 == 0 then
    tm = Time.now
    newfile = File.open("time2.html", "w+",0644)
    newfile << tm.min().to_s + ":" + tm.sec().to_s + "\n"
    newfile.close
  end

end
</pre>
<p>time1.html和time2.html的时间相差了36妙。<br />
有个老外也碰到了这个问题。<br />
<a href="http://bogdan.org.ua/2007/10/16/godaddy-undocumented-20-second-cpu-time-maximal-execution-limit-python-elf.html">http://bogdan.org.u......html</a><br />
不光跑ruby有这个问题，跑python，ELF等也有这个问题。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zflier.com/111-godaddy-cron-job-%e7%9a%84%e6%89%a7%e8%a1%8c%e6%97%b6%e9%97%b4%e6%9c%80%e5%a4%a7%e6%98%af36%e7%a7%92/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ruby, DateTime class实现rfc2822转换</title>
		<link>http://www.zflier.com/110-ruby-datetime-class%e5%ae%9e%e7%8e%b0rfc2822%e8%bd%ac%e6%8d%a2/</link>
		<comments>http://www.zflier.com/110-ruby-datetime-class%e5%ae%9e%e7%8e%b0rfc2822%e8%bd%ac%e6%8d%a2/#comments</comments>
		<pubDate>Sat, 12 Jan 2008 13:24:38 +0000</pubDate>
		<dc:creator>webflier</dc:creator>
				<category><![CDATA[i.t.]]></category>

		<guid isPermaLink="false">http://www.zflier.com/2008/01/12/ruby-datetime-class%e5%ae%9e%e7%8e%b0rfc2822%e8%bd%ac%e6%8d%a2/</guid>
		<description><![CDATA[比较诡异的事情，ruby的Time类有实现rfc2822()，而DateTime类没有实现。 那我们可以自己动手。 class DateTime def to_rfc2822 sprintf("%.3s, %02d %.3s %04d %02d:%02d:%02d %s", Date::DAYNAMES[self.wday], self.day, Date::MONTHNAMES[self.mon], self.year, self.hour, self.min, self.sec, self.zone) end end 好了，Ruby标准库的DateTime类支持到rfc2822的转换方法了。you see, ruby太灵活，自由了。]]></description>
			<content:encoded><![CDATA[<p>比较诡异的事情，ruby的Time类有实现rfc2822()，而DateTime类没有实现。<br />
那我们可以自己动手。</p>
<pre name="code" class="ruby">class DateTime
    def to_rfc2822
        sprintf("%.3s, %02d %.3s %04d %02d:%02d:%02d %s",
				Date::DAYNAMES[self.wday],
				self.day, Date::MONTHNAMES[self.mon],
				self.year, self.hour, self.min, self.sec,
				self.zone)
    end
end</pre>
<p>好了，Ruby标准库的DateTime类支持到rfc2822的转换方法了。you see, ruby太灵活，自由了。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zflier.com/110-ruby-datetime-class%e5%ae%9e%e7%8e%b0rfc2822%e8%bd%ac%e6%8d%a2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ruby, open-uri发起conditional get</title>
		<link>http://www.zflier.com/109-ruby-open-uri%e5%8f%91%e8%b5%b7conditional-get/</link>
		<comments>http://www.zflier.com/109-ruby-open-uri%e5%8f%91%e8%b5%b7conditional-get/#comments</comments>
		<pubDate>Sat, 12 Jan 2008 13:15:36 +0000</pubDate>
		<dc:creator>webflier</dc:creator>
				<category><![CDATA[i.t.]]></category>

		<guid isPermaLink="false">http://www.zflier.com/2008/01/12/ruby-open-uri%e5%8f%91%e8%b5%b7conditional-get/</guid>
		<description><![CDATA[Conditional GET 有两种，一种是etag, 另一种是last-modified。 关于这两种介绍，请移步：http://www.dbanotes.net/web/http_11_etag_lastmodified.html 我们分别来看一下这两种实现。 1。用ETag require 'open-uri' # 1st request -- save the ETag etag = nil open( "http://redhanded.hobix.com/index.xml" ) do &#124;feed&#124; etag = feed.meta['etag'] end # 2nd request -- only retrieve the file if it has changed &#8230; <a href="http://www.zflier.com/109-ruby-open-uri%e5%8f%91%e8%b5%b7conditional-get/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Conditional GET 有两种，一种是etag, 另一种是last-modified。<br />
关于这两种介绍，请移步：<a href="http://www.dbanotes.net/web/http_11_etag_lastmodified.html">http://www.dbanotes.net/web/http_11_etag_lastmodified.html</a><br />
我们分别来看一下这两种实现。<br />
1。用ETag</p>
<pre name="code" class="ruby" cols="60">require 'open-uri'

 # 1st request -- save the ETag
 etag = nil
 open( "http://redhanded.hobix.com/index.xml" ) do |feed|
   etag = feed.meta['etag']
 end

 # 2nd request -- only retrieve the file if it has changed
 begin
   open( "http://redhanded.hobix.com/index.xml",
         "If-None-Match" => etag ) do |feed|
     puts "File has changed: #{ feed.read.length } bytes read"
   end
 rescue OpenURI::HTTPError
   puts "No file available or file has not changed."
 end</pre>
<p>2。用last-modified</p>
<pre name="code" class="ruby" cols="60">require 'open-uri'

 # 1st request -- save the modification time
 mtime = nil
 open( "http://redhanded.hobix.com/index.xml" ) do |feed|
   mtime = feed.last_modified
 end

 # 2nd request -- only retrieve the file if it has changed
 begin
   open( "http://redhanded.hobix.com/index.xml",
         "If-Modified-Since" => mtime.rfc2822 ) do |feed|
     puts "File has changed: #{ feed.read.length } bytes read"
   end
 rescue OpenURI::HTTPError
   puts "No file available or file has not changed."
 end</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.zflier.com/109-ruby-open-uri%e5%8f%91%e8%b5%b7conditional-get/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>在Godaddy Deluxe运行Ruby脚本</title>
		<link>http://www.zflier.com/108-%e5%9c%a8godaddy-deluxe%e8%bf%90%e8%a1%8cruby%e8%84%9a%e6%9c%ac/</link>
		<comments>http://www.zflier.com/108-%e5%9c%a8godaddy-deluxe%e8%bf%90%e8%a1%8cruby%e8%84%9a%e6%9c%ac/#comments</comments>
		<pubDate>Fri, 11 Jan 2008 12:32:15 +0000</pubDate>
		<dc:creator>webflier</dc:creator>
				<category><![CDATA[i.t.]]></category>

		<guid isPermaLink="false">http://www.zflier.com/2008/01/11/%e5%9c%a8godaddy-deluxe%e8%bf%90%e8%a1%8cruby%e8%84%9a%e6%9c%ac/</guid>
		<description><![CDATA[网上有很多文章介绍怎么在Godaddy的空间上跑Ruby on Rails，但是怎么单独运行Ruby脚本，却很少有提及。和Perl、php相比，Ruby更灵活，更省力。我们看下面这个例子： #!/usr/local/bin/ruby -w # index.cgi puts "Content-Type: text/html" puts puts "Hello World!" 把上面这段脚本上传到Godady的空间里，任意目录都可以。然后将这个文件的属性改为755（大部分FTP软件都能做到）。 这样你就可以看这个脚本运行了，比如：http://www.yoursite.com/main.cgi 注意，脚本的名字一定要以cgi作扩展名，而不是rb。 如果要用gems，可以这样 require "rubygems" require "mysql"]]></description>
			<content:encoded><![CDATA[<p>网上有很多文章介绍怎么在Godaddy的空间上跑Ruby on Rails，但是怎么单独运行Ruby脚本，却很少有提及。和Perl、php相比，Ruby更灵活，更省力。<br/>我们看下面这个例子：</p>
<pre name="code" class="ruby" cols="60">#!/usr/local/bin/ruby -w
# index.cgi
puts "Content-Type: text/html"
puts
puts "Hello World!"</pre>
<p>把上面这段脚本上传到Godady的空间里，任意目录都可以。然后将这个文件的属性改为755（大部分FTP软件都能做到）。</p>
<p>这样你就可以看这个脚本运行了，比如：<a href="http://www.yoursite.com/main.cgi">http://www.yoursite.com/main.cgi</a></p>
<p>注意，脚本的名字一定要以cgi作扩展名，而不是rb。</p>
<p>如果要用gems，可以这样</p>
<pre name="code" class="ruby" cols="60">require "rubygems"
require "mysql"</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.zflier.com/108-%e5%9c%a8godaddy-deluxe%e8%bf%90%e8%a1%8cruby%e8%84%9a%e6%9c%ac/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>svn 版本库的备份和还原</title>
		<link>http://www.zflier.com/107-svn-%e7%89%88%e6%9c%ac%e5%ba%93%e7%9a%84%e5%a4%87%e4%bb%bd%e5%92%8c%e8%bf%98%e5%8e%9f/</link>
		<comments>http://www.zflier.com/107-svn-%e7%89%88%e6%9c%ac%e5%ba%93%e7%9a%84%e5%a4%87%e4%bb%bd%e5%92%8c%e8%bf%98%e5%8e%9f/#comments</comments>
		<pubDate>Thu, 20 Dec 2007 15:11:13 +0000</pubDate>
		<dc:creator>webflier</dc:creator>
				<category><![CDATA[i.t.]]></category>

		<guid isPermaLink="false">http://www.zflier.com/2007/12/20/svn-%e7%89%88%e6%9c%ac%e5%ba%93%e7%9a%84%e5%a4%87%e4%bb%bd%e5%92%8c%e8%bf%98%e5%8e%9f/</guid>
		<description><![CDATA[仓库中版本的备份及还原形式主要有两种：方式一：直接备份仓库整个文件夹（全部版本），重装svn程序后直接还原过去。 方式二：通过svn命令行备份和还原指定版本号的数据全备份：使用svnadmin hotcopy或svnsync来做，例：svnadmin hotcopy path/to/repository path/to/backup &#8211;clean-logs 增量备份：使用svnadmin dump的&#8211;incremental选项来实现svnadmin dump 版本库路径及名称 &#8211;revision 上次导出的版本号:到本次要导出到的版本号 &#8211;incremental &#62; 导出的命名 还原版本：svnadmin load 要恢复的版本库路径及名称 &#60; 导出的命名 svnadmin hotcopy path/to/repository path/to/backup &#8211;clean-logs 一个技巧： 如果你有一个较大的Subsersion版本库而你又想用最少的空间来将它备份下来，用这个命令（请将/repo替换成你的版本库路径）吧： svnadmin dump &#8211;deltas /repo &#124;bzip2 &#124;tee dump.bz2 &#124; md5sum &#62;dump.md5 分步解释：最重要的一步是 -deltas,将消耗更多的CPU资源，但拥有更有效的差异存储办法。 &#8230; <a href="http://www.zflier.com/107-svn-%e7%89%88%e6%9c%ac%e5%ba%93%e7%9a%84%e5%a4%87%e4%bb%bd%e5%92%8c%e8%bf%98%e5%8e%9f/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>仓库中版本的备份及还原形式主要有两种：<br/><strong>方式一</strong>：直接备份仓库整个文件夹（全部版本），重装svn程序后直接还原过去。</p>
<p><strong>方式二</strong>：通过svn命令行备份和还原指定版本号的数据<br/><strong>全备份</strong>：使用svnadmin hotcopy或svnsync来做，例：<br/><span style="COLOR: #ff9900">svnadmin hotcopy path/to/repository path/to/backup &#8211;clean-logs</span></p>
<p><strong>增量备份</strong>：使用svnadmin dump的&#8211;incremental选项来实现<br/>svnadmin dump 版本库路径及名称 &#8211;revision 上次导出的版本号:到本次要导出到的版本号 &#8211;incremental &gt; 导出的命名</p>
<p><strong>还原版本</strong>：svnadmin load 要恢复的版本库路径及名称 &lt; 导出的命名</p>
<p><span style="COLOR: #ff9900">svnadmin hotcopy path/to/repository path/to/backup &#8211;clean-logs</span></p>
<p><strong>一个技巧：</strong></p>
<p>如果你有一个较大的Subsersion版本库而你又想用最少的空间来将它备份下来，用这个命令（请将/repo替换成你的版本库路径）吧：</p>
<p><span style="COLOR: #ff9900">svnadmin dump &#8211;deltas /repo |bzip2 |tee dump.bz2 | md5sum &gt;dump.md5</span></p>
<p>分步解释：<br/>最重要的一步是 -deltas,将消耗更多的CPU资源，但拥有更有效的差异存储办法。</p>
<p>bzip2压缩方案比gzip慢，但换来的更好的压缩率。<br/>更有趣的是，tee方法将压缩的数据流转向到文件dump.bz2,同时将其输出到标准输出，后者有转向给了MD5摘要计算工具。</p>
<p>要恢复这个版本库，检查校验值（md5sum创建的）,创建一个空的版本库，恢复备份：</p>
<p><span style="COLOR: #ff9900">md5sum -c dump.md5 &lt;dump.bz2<br/>svnadmin create newrepo<br/>bzcat dump.bz2 | svnadmin load newrepo</span></p>
<p>请享受压缩后用MD5校验的备份吧，最后别忘记将dump.md5和dump.bz2存储到真正安全的地方！</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zflier.com/107-svn-%e7%89%88%e6%9c%ac%e5%ba%93%e7%9a%84%e5%a4%87%e4%bb%bd%e5%92%8c%e8%bf%98%e5%8e%9f/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic page generated in 0.511 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2012-02-06 17:23:13 -->

