<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

 <title>江湖程序员</title>
 <link href="http://mrluanma.github.io/atom.xml" rel="self"/>
 <updated>2017-02-03T08:07:05+00:00</updated>
 <id>http://mrluanma.github.io/</id>
 <author>
   <name>赵小红</name>
   <email>mrluanma#gmail#com</email>
 </author>

 
 <entry>
   <title>random bits</title>
   <link href="http://mrluanma.github.io//2010/06/30/random-bits.html"/>
   <updated>2010-06-30T00:00:00+00:00</updated>
   <id>http://mrluanma.github.io//2010/06/30/random-bits</id>
   <content type="html">&lt;p&gt;May 28, 2010&lt;/p&gt;

&lt;p&gt;The great thing about mod_rewrite is it gives you all the configurability and flexibility of Sendmail. The downside to mod_rewrite is that it gives you all the configurability and flexibility of Sendmail.  – Brian Behlendorf, Apache Group&lt;/p&gt;

&lt;p&gt;Jun 1, 2010&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ sed -ie '1 i\
## -*- coding: utf-8 -*-
' `find -type f`
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Jun 8, 2010&lt;/p&gt;

&lt;p&gt;A method of en-/decrypting a string can be implemented using the UNIX tr command. For example:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;echo &quot;Or fher gb qevax lbhe Binygvar&quot; | tr 'A-Za-z' 'N-ZA-Mn-za-m'
Be sure to drink your Ovaltine
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Jun 10, 2010&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ seq 10000 | fmt -70
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Jun 30, 2010&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;//tr/td[@class!=&quot;yfnc_d&quot;]/..
//tr[td[@class!=&quot;yfnc_d&quot;]]

//tr[td[not(@class=&quot;yfnc_d&quot;)]]
//tr/td[not(@class=&quot;yfnc_d&quot;)]/..
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Jun 30, 2010&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ sed -n '1251 p' usacompany
HIFN
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Jun 30, 2010&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ for line in `cat usacompany`; do echo [$line] &amp;gt;&amp;gt; yahoo.log; \
curl -sIL &quot;http://finance.yahoo.com/q/cf?s=$line%20Cash%20Flow&amp;amp;annual&quot; &amp;gt;&amp;gt; yahoo.log; done
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>random bits</title>
   <link href="http://mrluanma.github.io//2010/04/29/random-bits.html"/>
   <updated>2010-04-29T00:00:00+00:00</updated>
   <id>http://mrluanma.github.io//2010/04/29/random-bits</id>
   <content type="html">&lt;p&gt;Mar 16, 2010&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;(?&amp;lt;user&amp;gt;[^@]+) @ (?&amp;lt;company&amp;gt;[^.]+) \. (?&amp;lt;top_level_domain&amp;gt;\w{2,4})
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Mar 19, 2010&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;perl -pi -e 's/ipodder/juice/g' `git grep ipodder | gawk -F: '{print $1}' | sort | uniq`
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Mar 19, 2010&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;perl -pi -e 's/,([^\)\]\},\s])/, \1/g' `find -name '*.py'`
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Mar 19, 2010&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;for f in `find -name '*.py' | grep Juice`; do git mv $f `echo $f | tr [A-Z] [a-z]`.bak &amp;amp;&amp;amp; git mv `echo $f | tr [A-Z] [a-z]`.bak `echo $f | tr [A-Z] [a-z]`; done
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Apr 2, 2010&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;irb(main):027:0&amp;gt; h = Hash[*&quot;41 =&amp;gt; 1, 42 =&amp;gt; 4&quot;.scan(/\d+/).collect{|i| i.to_i}]
=&amp;gt; {41=&amp;gt;1, 42=&amp;gt;4}
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Apr 2, 2010&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; l = range(1, 5)
&amp;gt;&amp;gt;&amp;gt; dict(zip(l[::2], l[1::2]))
{1: 2, 3: 4}
&amp;gt;&amp;gt;&amp;gt; dict(zip(*([iter(l)]*2)))
{1: 2, 3: 4}
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Apr 8, 2010&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ sudo apt-get build-dep ruby1.8
$ wget -O- ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-p376.tar.gz | tar zxv
$ cd ruby-1.9.1 &amp;amp;&amp;amp; configure &amp;amp;&amp;amp; make &amp;amp;&amp;amp; sudo make install
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Apr 15, 2010&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;with open(&quot;mydata.txt&quot;) as fp:
for line in iter(fp.readline, &quot;STOP&quot;):
    process_line(line)
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Apr 15, 2010&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; super
&amp;lt;type 'super'&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Apr 19, 2010&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# ASCII space char
u&quot;\u0020&quot;
# HTML &amp;amp;nbsp;
u&quot;\u00A0&quot;
# Chinese space char
u&quot;\u3000&quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>下载 Google 音乐用的脚本</title>
   <link href="http://mrluanma.github.io//2010/03/27/my-google-music-downloader.html"/>
   <updated>2010-03-27T00:00:00+00:00</updated>
   <id>http://mrluanma.github.io//2010/03/27/my-google-music-downloader</id>
   <content type="html">&lt;p&gt;今年 1 月初的时候我担心 google.cn 跑了之后 Google 音乐夭折, 我曾经手动把我 Google 音乐播放列表里的好几 G 歌用鼠标点点点下载到本地硬盘, 不是毅力坚强, 实在是没找到什么好用的批下载工具.&lt;/p&gt;

&lt;p&gt;今天偶然看到这篇&lt;a href=&quot;http://www.lixiaoyong.net/blog/?p=222&quot;&gt;用脚本下载谷歌高质量的音乐&lt;/a&gt;, 试用了一下里边介绍的&lt;a href=&quot;http://www.lixiaoyong.net/Scripts/gmusic.py&quot;&gt;批下载脚本 gmusic.py&lt;/a&gt;, 这个脚本对歌名中有单引号 ‘ 的歌曲处理不好, 比如我很喜欢的专辑&lt;a href=&quot;http://www.google.cn/music/album?id=B66ac250d82c109ae&quot;&gt;《Absolute Garbage》&lt;/a&gt;中的歌曲&lt;a href=&quot;http://www.google.cn/music/top100/musicdownload?id=S1cd4646dd1881445&quot;&gt;I Think I’m Paranoid&lt;/a&gt;解析出来的歌名为 “m Paranoid”.  我也没折腾为什么会这样, 反正我对 HTMLParser 没好感, 我直接把脚本中解析 HTML 的部分用 lxml.html 的 HTML 解析器替换了, 虽然增加了对 lxml 的依赖, 不过 lxml 安装的确是非常方便, 详细步骤请移步&lt;a href=&quot;http://codespeak.net/lxml/installation.html&quot;&gt;lxml 官网&lt;/a&gt;.  修改之后代码简单了不少, 并且也更适合我个人的需要.  会以”歌手/专辑/歌曲名”的格式组织下载的歌曲, 然后不再依赖 wget, 直接用 Python 的 urllib2.&lt;/p&gt;

&lt;script src=&quot;http://gist.github.com/346011.js&quot;&gt;&lt;/script&gt;

&lt;p&gt;使用方法如下:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;python gmusic.py [Google 音乐专辑的 URL]
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;举例如下:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;python c:\projects\gist-346011\gmusic.py http://www.google.cn/music/album?id=B3b6be8937fe6391c
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>老 MP3 播放器无法播放含有某些 ID3 标签的 MP3 文件</title>
   <link href="http://mrluanma.github.io//2010/03/24/old-mp3-player-choke-on-some-id3-tag.html"/>
   <updated>2010-03-24T00:00:00+00:00</updated>
   <id>http://mrluanma.github.io//2010/03/24/old-mp3-player-choke-on-some-id3-tag</id>
   <content type="html">&lt;p&gt;我最近爱上了听&lt;a href=&quot;http://justing.com.cn/&quot;&gt;静雅思听&lt;/a&gt;的中文 Podcast, 但是由于我的 MP3 播放器是读书时候买的 256M 的小霸王炫风 638(当时的价钱现在可以买个 2G 的 iPod shuffle 了), 部分 iTunes 里正常播放的 Podcast 拷到我的 MP3 播放器里之后无法播放, 播放器直接关机, 没有任何提示信息.&lt;/p&gt;

&lt;p&gt;我首先猜测可能是无法处理中文的文件名, 于是用一行 shell 把播放器里的所有文件名改成纯 ASCII:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;for f in *.mp3; do mv $f `echo $f | md5sum | cut -c1-10`.mp3; done
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;这样没能解决问题, 于是我猜是我的播放器无法处理某些格式的 ID3 标签, 我 Google 来&lt;a href=&quot;http://code.activestate.com/recipes/577139-remove-id3-tags-from-mp3-files/&quot;&gt;一小段 python 代码&lt;/a&gt;(依赖 &lt;a href=&quot;http://code.google.com/p/mutagen/&quot;&gt;Mutagen 库&lt;/a&gt;, 可 easy_install mutagen 或者 pip install mutagen 安装), 清除掉所有 ID3 标签, 然后我的老播放器就能正常播放了.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>放最前面的 web server 们</title>
   <link href="http://mrluanma.github.io//2010/03/15/have-fun.html"/>
   <updated>2010-03-15T00:00:00+00:00</updated>
   <id>http://mrluanma.github.io//2010/03/15/have-fun</id>
   <content type="html">&lt;p&gt;突然兴起想看看这些家伙都把什么 web server 放最前面.&lt;/p&gt;

&lt;p&gt;先弄个网站列表回来:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;curl http://hao123.com | grep -o 'href=&quot;\?http:\/\/[^ &quot;&amp;gt;/\?]*' | sed 's/^href=&quot;\?//g' | sort | uniq &amp;gt; urls.txt
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;然后挨个看看 Server HTTP Header 是什么:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;for url in `cat urls.txt`; do echo; echo $url; echo $url | sed 's/./=/g'; echo; curl -I $url | grep Server; done &amp;gt; results.txt
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;最后结果如下:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;http://apps.hi.baidu.com
========================

Server: lighttpd.pxy

http://auto.sina.com.cn
=======================

Server: Apache/2.0.58 (Unix)

http://bai.sohu.com
===================

Server: nginx

http://baike.baidu.com
======================

Server: Apache

http://blog.163.com
===================

Server: nginx

http://blog.sina.com.cn
=======================

Server: nginx/0.7.62

http://blog.sohu.com
====================

Server: nginx

http://book.sina.com.cn
=======================

Server: Apache/2.0.58 (Unix)

http://central.dangdang.com
===========================

Server: Microsoft-IIS/6.0

http://cf.qq.com
================

Server: lighttpd/1.4.20

http://cn.reuters.com
=====================

Server: Apache

http://cn.wsj.com
=================

Server: Microsoft-IIS/6.0

http://cps.gamall.net
=====================

Server: Apache-Coyote/1.1
Set-Cookie: BIGipServerpool_cps=2623776960.20480.0000; path=/

http://dhsh.changyou.com
========================

Server: Apache

http://dict.baidu.com
=====================

Server: Apache

http://dnf.qq.com
=================

Server: lighttpd/1.4.20

http://dzh.mop.com
==================

Server: Resin/3.0.19

http://finance.baidu.com
========================

Server: nginx

http://finance.qq.com
=====================

Server: nginx/0.6.39

http://finance.sina.com.cn
==========================

Server: Apache/2.0.59 (Unix)

http://han.70yx.com
===================

Server: Microsoft-IIS/6.0

http://hi.baidu.com
===================

Server: apache 1.1.26.0

http://hotel.qunar.com
======================

Server: nginx/0.7.64

http://house.sina.com.cn
========================

Server: Apache/2.0.59 (Unix)

http://huangguan.yijia.com
==========================

Server: nginx/0.8.32

http://image.baidu.com
======================

Server: Apache

http://jipiao.kuxun.cn
======================

Server: lighttpd

http://list.mp3.baidu.com
=========================

Server: apache 1.6.14.0

http://list.video.baidu.com
===========================

Server: apache 1.0.5.0

http://mail.139.com
===================


http://mail.163.com
===================

Server: Apache

http://mail.cn.yahoo.com
========================


http://mail.qq.com
==================


http://mail.sina.com.cn
=======================

Server: Apache/2.2.9 (FreeBSD) mod_ssl/2.2.9 OpenSSL/0.9.7e-p1 PHP/5.2.6 with Suhosin-Patch

http://map.baidu.com
====================

Server: lighttpd

http://messenger.live.cn
========================

Server: Microsoft-IIS/6.0

http://mil.news.sina.com.cn
===========================

Server: Apache/2.0.58 (Unix)

http://military.china.com
=========================

Server: nginx/0.7.62

http://mir2.sdo.com
===================

Server: Microsoft-IIS/6.0

http://mobile.pconline.com.cn
=============================

Server: nginx

http://mobile.pcpop.com
=======================

Server: Microsoft-IIS/6.0

http://mobile.zol.com.cn
========================

Server: Apache

http://mp3.baidu.com
====================

Server: apache 1.6.14.0

http://my.91.com
================

Server: Apache/2.2.6 (Unix)

http://my.pcbaby.com.cn
=======================

Server: nginx/0.6.35

http://nba.tom.com
==================

Server: nginx/0.6.32

http://news.baidu.com
=====================


http://news.ifeng.com
=====================

Server: Apache/2.2.3 (Unix)

http://news.qq.com
==================

Server: nginx/0.6.39

http://news.sina.com.cn
=======================

Server: Apache/2.0.58 (Unix)

http://news.sohu.com
====================

Server: Apache/1.3.37 (Unix) mod_gzip/1.3.26.1a

http://open.baidu.com
=====================

Server: Apache

http://passport.webgame.com.cn
==============================

Server: Resin/3.1.9

http://pinyin.sogou.com
=======================

Server: nginx/0.7.62

http://popkart.tiancity.com
===========================

Server: TXN Cache

http://qq.ip138.com
===================

Server: Microsoft-IIS/6.0

http://qzone.qq.com
===================

Server: Apache

http://r.dangdang.com
=====================

Server: nginx/0.7.61

http://scan.duba.net
====================

Server: nginx/0.7.19

http://site.baidu.com
=====================

Server: Apache

http://sports.163.com
=====================

Server: nginx

http://sports.sina.com.cn
=========================

Server: Apache/2.0.59 (Unix)

http://sports.sohu.com
======================

Server: Apache/1.3.39 (Unix) mod_gzip/1.3.26.1a

http://t.sina.com.cn
====================

Server: Apache

http://tech.sina.com.cn
=======================

Server: Apache/2.0.59 (Unix)

http://tg.webgame.com.cn
========================

Server: nginx/0.7.59

http://tieba.baidu.com
======================

Server: apache 2.7.18.0

http://tl.changyou.com
======================

Server: Apache

http://ttplayer.qianqian.com
============================

Server: nginx

http://tv.sohu.com
==================

Server: Apache/1.3.37 (Unix) mod_gzip/1.3.26.1a

http://union.360buy.com
=======================


http://utility.hao123.com
=========================

Server: Apache

http://video.baidu.com
======================

Server: apache 1.0.5.0

http://video.sina.com.cn
========================

Server: Apache/2.0.54 (Unix)

http://war.news.163.com
=======================

Server: nginx

http://web.qq.com
=================


http://www.126.com
==================

Server: Apache

http://www.163.com
==================

Server: nginx

http://www.17173.com
====================

Server: Apache

http://www.1ting.com
====================

Server: nProxy

http://www.2144.cn
==================

Server: Microsoft-IIS/6.0

http://www.265g.com
===================

Server: Microsoft-IIS/6.0

http://www.27.cn
================

Server: nginx/0.6.29
Via: 1.0 ls92:80 (Cdn Cache Server V2.0), 1.0 gm219:8080 (Cdn Cache Server V2.0)

http://www.3533.com
===================

Server: Microsoft-IIS/6.0

http://www.360.cn
=================

Server: Apache

http://www.360quan.com
======================

Server: Apache

http://www.4399.com
===================

Server: Microsoft-IIS/6.0

http://www.51.com
=================

Server: Apache

http://www.5173.com
===================

Server: Microsoft-IIS/6.0

http://www.51jiemeng.com
========================

Server: Apache

http://www.51job.com
====================

Server: Apache/2.2.8 (Unix) PHP/5.2.5

http://www.51mole.com
=====================

Server: WS CDN Server

http://www.51seer.com
=====================

Server: WS CDN Server

http://www.58.com
=================

Server: Microsoft-IIS/6.0

http://www.7fgame.com
=====================

Server: Microsoft-IIS/6.0

http://www.7k7k.com
===================

Server: Microsoft-IIS/6.0

http://www.7shop24.com
======================

Server: Microsoft-IIS/6.0

http://www.91wan.com
====================

Server: lighttpd/1.4.25

http://www.abchina.com
======================

Server: Microsoft-IIS/7.5
Set-Cookie: BIGipServerpool_pt_web=604587195.20480.0000; path=/

http://www.aiting.com
=====================

Server: Microsoft-IIS/6.0

http://www.amazon.cn
====================

Server: Server

http://www.anjuke.com
=====================

Server: nginx

http://www.aobi.com
===================

Server: nginx/0.7.62

http://www.autohome.com.cn
==========================

Server: Microsoft-IIS/6.0

http://www.baidu.com
====================

Server: BWS/1.0

http://www.baihe.com
====================

Server: Apache/2.0.59 (Unix)

http://www.baixing.com
======================

Server: Apache

http://www.bankcomm.com
=======================

Server: IBM_HTTP_SERVER
Set-Cookie: BIGipServerbankcomm_WA_WEB_POOL=3540756672.20480.0000; expires=Wed, 17-Mar-2010 09:21:48 GMT; path=/

http://www.baofeng.com
======================

Server: Apache/2.2.0 (Unix) PHP/5.2.2

http://www.bitauto.com
======================

Server: Microsoft-IIS/6.0

http://www.boc.cn
=================

Server: Microsoft-IIS/7.0

http://www.ccb.com
==================

Server: Apache

http://www.cctv.com
===================

Server: CCTV.com_webserver/1.0

http://www.che168.com
=====================

Server: nginx

http://www.cheshi.com
=====================

Server: nginx

http://www.china.com.cn
=======================

Server: Sun-ONE-Web-Server/6.1

http://www.chinahr.com
======================

Server: Microsoft-IIS/6.0

http://www.chinamobile.com
==========================

Server: Apache

http://www.cjol.com
===================

Server: Microsoft-IIS/6.0

http://www.cmbchina.com
=======================

Server: Microsoft-IIS/6.0

http://www.ctrip.com
====================

Server: Microsoft-IIS/6.0

http://www.dajie.com
====================

Server: nginx/0.7.63

http://www.daodao.com
=====================

Server: Apache

http://www.eastmoney.com
========================

Server: Microsoft-IIS/6.0

http://www.elong.com
====================

Server: Microsoft-IIS/6.0

http://www.fetion.com.cn
========================

Server: Microsoft-IIS/6.0

http://www.ganji.com
====================

Server: nginx/0.7.62

http://www.google.cn
====================

Server: gws

http://www.gougou.com
=====================

Server: Apache/2.2.8 (Unix) mod_fastcgi/2.4.6

http://www.gov.cn
=================

Server: Apache

http://www.hao123.com
=====================

Server: lighttpd

http://www.hd315.gov.cn
=======================

Server: Apache

http://www.hongxiu.com
======================


http://www.hoopchina.com
========================

Server: [SA: xifan hcw/12-10-49 ]

http://www.hotmail.com
======================

Server: Microsoft-IIS/6.0

http://www.hunantv.com
======================

Server: nginx/0.6.35
Via: 1.1 ls92:80 (Cdn Cache Server V2.0), 1.1 gm219:8080 (Cdn Cache Server V2.0)

http://www.icbc.com.cn
======================

Server: Microsoft-IIS/6.0

http://www.ifeng.com
====================

Server: Apache/2.2.3 (Unix)

http://www.ip138.com
====================

Server: Microsoft-IIS/6.0

http://www.ipart.cn
===================

Server: nginx/0.6.32

http://www.it168.com
====================

Server: Microsoft-IIS/6.0

http://www.jiayuan.com
======================

Server: nginx

http://www.jrj.com.cn
=====================


http://www.kaixin001.com
========================

Server: Apache

http://www.ku6.com
==================

Server: Apache
Via: 1.0 gm201:80 (Cdn Cache Server V2.0)

http://www.kugou.com
====================

Server: Microsoft-IIS/6.0

http://www.kuwo.cn
==================

Server: nginx/0.6.34

http://www.lady8844.com
=======================

Server: Apache/2.0.59 (Unix) DAV/2

http://www.lafaso.com
=====================

Server: nginx/0.7.61

http://www.letao.com
====================

Server: Microsoft-IIS/6.0

http://www.linkwan.com
======================

Server: Microsoft-IIS/6.0

http://www.m18.com
==================

Server: Microsoft-IIS/6.0

http://www.m1905.com
====================

Server: nginx/0.7.61

http://www.marry5.com
=====================

Server: Apache
X-Server: lighttpd.l7cc.1738/1.0.0-m5l7-new

http://www.miibeian.gov.cn
==========================


http://www.mod.gov.cn
=====================

Server: Apache

http://www.newegg.com.cn
========================

Server: Microsoft-IIS/6.0

http://www.no5.com.cn
=====================

Server: Microsoft-IIS/6.0

http://www.okaybuy.com.cn
=========================

Server: Apache

http://www.onlinedown.net
=========================

Server: Microsoft-IIS/6.0

http://www.onlylady.com
=======================

Server: nginx/0.6.34

http://www.oyesgo.com
=====================

Server: Apache/2.2.14 (Unix) mod_ssl/2.2.14 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.3.1

http://www.pcauto.com.cn
========================

Server: nginx

http://www.pclady.com.cn
========================

Server: nginx

http://www.pconline.com.cn
==========================

Server: nginx

http://www.pcpop.com
====================

Server: Microsoft-IIS/6.0

http://www.people.com.cn
========================

Server: nginx

http://www.pps.tv
=================

Server: PPStream

http://www.qidian.com
=====================

Server: Microsoft-IIS/6.0
Via: 1.0 stcz155:8102 (Cdn Cache Server V2.0), 1.0 zjls203:8102 (Cdn Cache Server V2.0)

http://www.qq.com
=================

Server: nginx/0.6.39

http://www.qq163.com
====================

Server: Microsoft-IIS/6.0

http://www.qunar.com
====================

Server: nginx/0.7.64

http://www.qvod.com
===================

Server: Microsoft-IIS/6.0

http://www.rayli.com.cn
=======================

Server: Apache

http://www.readnovel.com
========================


http://www.redbaby.com.cn
=========================

Server: Microsoft-IIS/6.0

http://www.renren.com
=====================

Server: nginx/0.7.64

http://www.sclf.org
===================

Server: Microsoft-IIS/6.0

http://www.shopin.net
=====================

Server: nginx/0.7.61

http://www.shumenol.com
=======================

Server: Apache

http://www.sina.com.cn
======================

Server: Apache/2.0.54 (Unix)

http://www.skomart.com
======================

Server: nginx/51086858

http://www.skycn.com
====================

Server: Apache

http://www.sohu.com
===================

Server: Apache/1.3.37 (Unix) mod_gzip/1.3.26.1a

http://www.soufun.com
=====================

Server: nginx

http://www.stockstar.com
========================

Server: Microsoft-IIS/6.0

http://www.taikang.com
======================

Server: IBM_HTTP_Server

http://www.taobao.com
=====================

Server: Apache

http://www.tianya.cn
====================

Server: Microsoft-IIS/6.0

http://www.tiexue.net
=====================

Server: Microsoft-IIS/6.0

http://www.titan24.com
======================

Server: nginx/0.5.38
Via: 1.0 gm221:20069 (Cdn Cache Server V2.0)

http://www.tktang.com
=====================

Server: Resin/3.0.21

http://www.tudou.com
====================

Server: Apache

http://www.uwan.com
===================

Server: nginx/0.6.34

http://www.warcraftchina.com
============================

Server: Apache

http://www.weather.com.cn
=========================

Server: Apache/2.2.6 (Unix) DAV/2 SVN/1.4.6 mod_jk/1.2.26
Set-Cookie: BIGipServerwww_pool=45679677.20480.0000; path=/

http://www.xcar.com.cn
======================

Server: Apache

http://www.xinhuanet.com
========================

Server: Apache

http://www.xs8.cn
=================


http://www.xunlei.com
=====================

Server: nginx/0.6.32

http://www.xxsy.net
===================

Server: Microsoft-IIS/6.0
Via: 1.0 bjgm68:80 (Cdn Cache Server V2.0), 1.0 gm201:80 (Cdn Cache Server V2.0)

http://www.yihaodian.com
========================

Server: nginx/0.6.39

http://www.youku.com
====================

Server: Apache

http://www.zaobao.com
=====================

Server: Apache

http://www.zdface.com
=====================

Via: 1.0 bjgm68:80 (Cdn Cache Server V2.0), 1.0 gm222:8080 (Cdn Cache Server V2.0)

http://www.zhaopin.com
======================

Server: Apache/1.3.37 (Unix)

http://www.zhcw.com
===================

Server: Apache/2.0.63 (Unix) DAV/2

http://www.zhenai.com
=====================

Server: DnionOS/1.0

http://www.zol.com.cn
=====================

Server: Apache

http://x5.qq.com
================

Server: lighttpd/1.4.20

http://xianyu.game2.com.cn
==========================

Server: nginx/0.8.15

http://xiaoyou.qq.com
=====================

Server: Apache

http://xx.qq.com
================

Server: lighttpd/1.4.20

http://youa.baidu.com
=====================

Server: Apache

http://youxi.baidu.com
======================

Server: Apache

http://zhidao.baidu.com
=======================

Server: Apache

http://zhyx.changyou.com
========================

Server: Apache

http://zt.ztgame.com
====================

Server: DnionOS/1.0
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;大致统计一下:&lt;/p&gt;

&lt;p&gt;总个数:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ cat urls.txt | wc -l
218
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Apache:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ cat results.txt | grep -i apache | wc -l
80
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Nginx:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ cat results.txt | grep -i nginx | wc -l
50
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;IIS:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ cat results.txt | grep -i iis | wc -l
49
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Lighty:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ cat results.txt | grep -i lighttpd | wc -l
10
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Other:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ cat results.txt | grep Server | grep -iv apache | grep -iv nginx | grep -iv iis | grep -iv lighttpd | wc -l
29
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>Blog 搬家到 Github Pages</title>
   <link href="http://mrluanma.github.io//2010/02/23/move-blog-to-github-pages.html"/>
   <updated>2010-02-23T00:00:00+00:00</updated>
   <id>http://mrluanma.github.io//2010/02/23/move-blog-to-github-pages</id>
   <content type="html">&lt;p&gt;从 &lt;a href=&quot;http://pages.github.com/&quot;&gt;Github Pages&lt;/a&gt; 出生那天起我就觉得这家伙很酷, 今天终于从&lt;a href=&quot;http://jointheconversation.org/&quot;&gt;Scott Chacon’s blog&lt;/a&gt;那里 git clone 了一套模板过来, 开始正式用 Github Pages 写博客了.&lt;/p&gt;

&lt;p&gt;我喜欢 Github Pages.  我觉得它最大的好处就是你只要祭起你最爱的编辑器(¡sɔɐɯǝ ¡sɔɐɯǝ ¡sɔɐɯǝ)就可以写博了, 从此忘掉浏览器的文本框吧.  当然, 你还得有 git, 不过这也绝对是优点, 我总觉得敲键盘的人应该都是版本控才对, 有 git 记录下每个更改不是很好吗?&lt;/p&gt;

&lt;p&gt;Github Pages 的背后是&lt;a href=&quot;http://github.com/mojombo/jekyll/&quot;&gt;Jekyll&lt;/a&gt;, Jekyll 生成纯静态的 HTML, 你基本可以部署到任何 Hosting 环境, 比如&lt;a href=&quot;http://roylez.github.com/2010/02/04/jekyll-on-heroku.html&quot;&gt;Heroku&lt;/a&gt;.&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>用 PXE 引导方式安装 Ubuntu 8.04 LTS 服务器流水账</title>
   <link href="http://mrluanma.github.io//2010/02/14/install-ubuntu-8.04-server-with-pxe.html"/>
   <updated>2010-02-14T00:00:00+00:00</updated>
   <id>http://mrluanma.github.io//2010/02/14/install-ubuntu-8.04-server-with-pxe</id>
   <content type="html">&lt;p&gt;过春节了, 弄了个古董 PC 回家鼓捣鼓捣(我觉得吧什么 BT 机啊, 路由器啊, 还是 PC 最好玩).  那先得整个 Linux 系统装上啊, 但机器没有软驱, 没 CD-ROM, 弄个 DVD-RW 接上 BIOS 不认, 不支持 USB 引导, 硬盘上也没个可以引导的系统, 折腾了半天反正系统是没装上去, 正愁着呢, 后来发现主板支持 &lt;a href=&quot;http://en.wikipedia.org/wiki/Preboot_Execution_Environment&quot;&gt;PXE&lt;/a&gt; 引导, 一试, 挺顺利, 现在把过程记录一下.&lt;/p&gt;

&lt;p&gt;首先下载 Ubuntu 8.04 LTS server 版的 ISO 文件 ubuntu-8.04.4-server-i386.iso, 选择这个版本是因为它是目前最新的 LTS 版本, LTS 版本可以有比其他版本更久(长达5年)的官方更新维护支持.&lt;/p&gt;

&lt;p&gt;然后因为我家里另外一台电脑是 Windows XP 系统的笔记本, 所以需要安装一个 Windows 下的 TFTP 服务器.  这个 &lt;a href=&quot;http://tftpd32.jounin.net/&quot;&gt;tftpd32&lt;/a&gt; 真是简单又好用, &lt;a href=&quot;http://tftpd32.jounin.net/download/tftpd32.335.zip&quot;&gt;下载&lt;/a&gt;, 解压, 运行 tftpd32.exe 即可.&lt;/p&gt;

&lt;p&gt;运行之后设置 tftpd32.exe 的 Current Directory 为 C:\TFTPD(可按自己喜好设置), 然后切换到 “DHCP server” 标签, 设置如下(可能需要根据你的实际情况作相应的更改):&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;IP pool starting address: 192.168.1.100
Size of pool: 10
Boot file: /pxelinux.0
WINS/DNS server: 8.8.8.8
Default router: 192.168.1.1
Mask: 255.255.255.0
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;其它的设置项不用修改, 然后按”save”按钮.  我还准备了&lt;a href=&quot;/images/1266080377-dhcpd-conf.png&quot;&gt;截图一张&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;如果你的路由器开了 DHCP, 那么需要关闭它, 我用的是 TP-Link 的 WR-150G+, 用 Web 界面关掉 DHCP 之后, 需要重启路由器才能生效, 本本上运行着 tftpd32 的 DHCP 服务器, 无线能正常连接, 刚开始提示连接受限制, 但是很快就可以从 tftpd32 的 DHCP 服务器上拿到分配到的 IP, 192.168.1.100.&lt;/p&gt;

&lt;p&gt;准备做的差不多了, 剩下最后一步, 解压 ubuntu-8.04.4-server-i386.iso 里的 install\netboot\ubuntu-installer\i386\ 目录到 C:\TFTPD\ 文件夹下, 用你喜欢的编辑器打开 C:\TFTPD\pxelinux.cfg\default 文件, 删除所有的 “ubuntu-installer/i386/” (引号内内容), 保存退出.&lt;/p&gt;

&lt;p&gt;把古董机开机, 按 F12 选择 Network boot, 很顺利地进入安装程序, 因为所有的东西都是从因特网上下载, 所以想顺利安装还得有因特网连接, 并且速度不要太慢, 否则有得等了.  建议就用英文安装, 并且引导的时候输入 “cli” 只安装基本命令行系统, 这样可以少下点东西.  我想安装的时候完全可以把 ubuntu-8.04.4-server-i386.iso 解压, 然后把解压之后的文件放到局域网内的某个 web 服务器的目录底下, 在安装的时候选择这个 web 服务器作为源来安装, 这样就不用因特网链接和漫长的等待了.  不过我没有试过, 毕竟我只是想装个系统用一用.&lt;/p&gt;

&lt;p&gt;整个过程其实挺简单, 不过是我第一次弄, 所以可能有点想的复杂了.  半个春晚的功夫, 我的机器顺利装上了, 取名叫做 ma10t.&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>random bits</title>
   <link href="http://mrluanma.github.io//2010/02/12/diary.html"/>
   <updated>2010-02-12T00:00:00+00:00</updated>
   <id>http://mrluanma.github.io//2010/02/12/diary</id>
   <content type="html">&lt;p&gt;Feb 4, 2010&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Being youthful at the time I figured I could design and implement a language --Guido van Rossum
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Feb 4, 2010&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Converting an algorythm from recursion to different kind of stack is pretty easy and I suggest you try that. Here is how you can do it.

def recursive(params)
  if some_conditions(params)
 recursive(update_params(params))
  end
end

recursive(starting_params)

will transform into

stack = [starting_params]
while !stack.empty?
  current_params = stack.delete_at(0)
  if some_conditions(current_params)
stack &amp;lt;&amp;lt; update_params(current_params)
  end
end
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Feb 4, 2010&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;RT @jesusai 和一政法学弟聊天，我说“在司法不独立的社会你学法律有什么用？”，他说“以后你不也还就是个局域网从业者”
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Feb 4, 2010&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;function f() return f() end f() --tail recursion
function c() c() end c() --stack overflow
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Feb 4, 2010&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# stack overflow in Ruby
irb(main):001:0&amp;gt; def s;s;end;s
SystemStackError: stack level too deep
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Feb 4, 2010&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Read this line, and do what it says twice. --recursion
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Feb 4, 2010&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;template &amp;lt;int i&amp;gt;
class Overflow {
typedef typename Overflow&amp;lt;i + 1&amp;gt;::type type;
};

typedef Overflow&amp;lt;0&amp;gt;::type Kaboom;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Feb 4, 2010&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Python:

so=lambda:so();so()

Alternatively:

def so():so()
so()

And if Python optimized tail calls...:

o=lambda:map(o,o());o()
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Feb 4, 2010&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;bash in 10 chars (the space in the function is important):

i(){ i;};i
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Feb 4, 2010&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;(defun x () (1+ (x))) (x)
(error &quot;Lisp nesting exceeds `max-lisp-eval-depth'&quot;)
Debugger entered--Lisp error: (error &quot;Lisp nesting exceeds `max-lisp-eval-depth'&quot;)
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Feb 4, 2010&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;In Scheme, this will cause the interpreter to run out of memory:

(define (x)
  ((x)))

(x)
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Feb 4, 2010&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Haskell:

let x = x
print x
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Feb 4, 2010&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;a{return a*a;};
Compile with:

gcc -D&quot;a=main()&quot; so.c
Expands to:

main() {
return main()*main();
}
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Feb 4, 2010&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;(a=lambda{a.call}).call
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Feb 4, 2010&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;(new function() { arguments.callee();});
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Feb 4, 2010&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Perl in 10 chars

sub x{&amp;amp;x}x
Eventually uses up all available memory.
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Feb 4, 2010&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;MS-DOS batch:

copy CON so.bat
so.bat
^Z
so.bat
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Feb 4, 2010&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;class Overflow
def initialize
    Overflow.new
end
end

Overflow.new
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;Feb 12, 2010&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;For example, to rename all the “v2_*.rb” files to “v3_*.rb” I would type:

for file in *; do mv &quot;$file&quot; &quot;v3_${file#v2_}&quot;; done
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
</content>
 </entry>
 
 <entry>
   <title>Web 架构和我的技术有用论观</title>
   <link href="http://mrluanma.github.io//2010/02/05/web-architecture.html"/>
   <updated>2010-02-05T00:00:00+00:00</updated>
   <id>http://mrluanma.github.io//2010/02/05/web-architecture</id>
   <content type="html">&lt;p&gt;在一个封闭的小圈子里讨论 Web 架构的时候, 我”突发奇想”将一小段内容发到 twitter 上:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;并且大部分的网站都不需要 Google 级别的负载, 所以对于大部分开发者, 创业者来说, “架构”都是最最不重要的事情, 做出好产品, 伺候好用户, 赚到钱才是真的.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;然后 @xmpp 认为我这是”技术无用论”, 我也做了一些解释.  现稍作整理, 权充博文一篇.&lt;/p&gt;

&lt;p&gt;可能我的表达的确存在一些让人误解的地方.  首先是有人问:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;blockquote&gt;
    &lt;p&gt;昨天上网不小心看到了一些关于网站架构的讨论:  有人说将WEB站点用独立的方式, 也就是静态页面放到一服务器, 动态页面放一服务器, 图片放另一服务器, 用它们组起来作为一个站点, 这样会加快浏览速度.&lt;/p&gt;
  &lt;/blockquote&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;blockquote&gt;
    &lt;p&gt;请问这样的原理是怎样的?&lt;/p&gt;
  &lt;/blockquote&gt;
&lt;/blockquote&gt;

&lt;p&gt;然后我半壶水响叮当:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;一般静态页面和图片可以当做一种东西处理, 和动态页面比起来肯定少耗费 CPU, 动态页面的话肯定会比较费 CPU, memcache 专耗内存, DB 基本上整体负载都很高, 所以如果你有一堆机器要”架构”的话, 肯定需要在 CPU, 内存, IO 这三方面来均衡着排布.  比如 memcache 耗内存不耗 CPU, 那就可以把动态页面放 memcache 的机器上一起跑, DB 啥都耗就自己占整个机器跑, 静态文件这些就直接让反向代理的 web 服务器来跑.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;以上讲的是物理机器上的分隔, 其实为了提高访问速度, 一般在 URL 上也要做文章.  因为浏览器 HTTP 协议同时只对一个域名的机器发起最多两个连接, 比如我打开一个动态页面, 这个动态页面里用到 20 个静态文件, 那如果这些文件都是用两个水管来放的话, 是不是没有我同时用 N*2 根水管来放快?  所以一般网站就算只有一台机器提供全部内容, 也会把静动态内容放到不同的二级域名下来提供, 比如说一般的内容用 website.com 来提供, 静态文件就就用 static.website.com 来提供, 这样浏览器就可以向 website.com 发起两个连接要东西, 同时也可以向 static.website.com 发起两个连接要静态文件.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;blockquote&gt;
    &lt;p&gt;没懂, 啥叫水管?&lt;/p&gt;
  &lt;/blockquote&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;其实我说的时候我就感觉没说清楚, 我这里一个水管的意思就是一个 TCP 连接. 我 Google 到以下&lt;a href=&quot;http://blog.joycode.com/musicland/archive/2005/04/16/48690.aspx&quot;&gt;别人解释的更清楚的&lt;/a&gt;, 摘录一段:&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;在HTTP 1.1 Spec 中针对 Persistent Connections 提出了这样的 Practical considerations:  Clients that use persistent connections SHOULD limit the number of simultaneous connections that they maintain to a given server.  A single-user client &lt;strong&gt;SHOULD NOT&lt;/strong&gt; maintain more than 2 connections with any server or proxy.  A proxy SHOULD use up to 2*N connections to another server or proxy, where N is the number of simultaneously active users.  These guidelines are intended to improve HTTP response times and avoid congestion.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;以上内容表明, 为了提高 HTTP 响应时间以及避免产生网络堵塞, HTTP 连接中的客户端不应该与服务器端建立超过&lt;strong&gt;2&lt;/strong&gt;个的 HTTP 连接.  如果有更多的请求需要, 那么这些请求将被 pipeline 到这两个 HTTP 连接之中, 并以异步的方式传送给服务器端.  举个例子:  有上百辆汽车(requests)想从天津开往北京, 但是天津与北京之间最多只允许修建两条公路(HTTP connection), 因此这些汽车要想从天津驶往北京的话, 就只能走这两条公路.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;还有&lt;a href=&quot;http://lvmlvy.javaeye.com/blog/581447&quot;&gt;这篇&lt;/a&gt;, 内容都挺好, 我就不摘录了, 建议都看看.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;忘了说一句, 我是山寨的, 只是看了一堆各个网站的架构, 并没有大型 Web 运营经验, 并且我估计很长时间内也不会有这样的事情做.  &lt;strong&gt;并且大部分的网站都不需要 Google 级别的负载, 所以对于大部分开发者, 创业者来说, “架构”都是最最不重要的事情, 做出好产品, 伺候好用户, 赚到钱才是真的.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;以下是 twitter 上的讨论:&lt;/p&gt;

&lt;p&gt;@xmpp&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;RT: @mrluanma: 大部分的网站都不需要 Google 级别的负载, 所以对于大部分开发者, 创业者来说, “架构”都是最最不重要的事情, 做出好产品,伺候好用户, 赚到钱才是真的 // 技术无用论.  看你站的角度, 如站在孔子学院网站角度, “做出好产品”也是很不重要的.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;@mrluanma(我自己)&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;RT: @xmpp RT: @mrluanma: 大部分的网站都不需要 Google 级别的负载…//技术无用论.  看你站的角度, 如站在孔子学院网站角度, “做出好产品”也是很不重要的 //我绝对不认为技术无用, 我说的是大部分网站不需要担心架构问题, 至少在早期不用.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;@xiaoxiaolu&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;非技术无用论, 是产品导向, 等有负载再解决是务实做法, 换个角度也可以说为啥你丫不进大公司?  我已见过不止一家公司做完技术就准备倒闭 RT @xmpp: RT: @mrluanma: 对于大部分开发者, 创业者, 架构是最最不重要的事情, 做出好产品,伺候好用户// 技术无用论.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;@nepalon&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;市场导向的话对处于生存期的公司比较合适, 只要迎合市场, 功能不算太烂, 一般都可以有市场.  但要进一步发展就要提高技术了, 有了更好的技术, 才能提高性能, 提高用户体验, 提高自己的行业中的地位.  我们的做法是通过销售来发掘市场, 从而根据市场来开发产品, 做技术储备.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;@mrluanma&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;RT @nepalon: 因为我本身就是做开发的, 我觉得把市场看的比架构重是我的一个突破, 当然, 要长远发展, 如果有技术负债, 也肯定是要还的. 这两天用到的产品体验中, 360buy, 邮政的EMS查询, 移动的号薄管家这些的技术负债我觉得都比较严重.&lt;/p&gt;
&lt;/blockquote&gt;

</content>
 </entry>
 
 <entry>
   <title>TL-WR340G+ 和 TL-WR841N 无线桥接的配置</title>
   <link href="http://mrluanma.github.io//2010/02/05/TP-LINK-TL-WR340G+-TL-WR841N-wireless-bridge.html"/>
   <updated>2010-02-05T00:00:00+00:00</updated>
   <id>http://mrluanma.github.io//2010/02/05/TP-LINK-TL-WR340G+-TL-WR841N-wireless-bridge</id>
   <content type="html">&lt;p&gt;我住同一个小区的亲戚家安装了宽带, 我买了个 TL-WR841N(180RMB) 放他家, 想蹭宽带用用.  配置好了之后发现信号不够强, 只有靠窗户的位置才能有两格信号, 时不时的还掉个线啥的, 真是不舒服, 我就准备再买个无线路由器放我家窗口的位置, 做一个无线桥接, 这样就在我家任何一个角落都能舒服地蹭网了.&lt;/p&gt;

&lt;p&gt;出于价格考虑, 这次买了便宜一点的 TL-WR340G+(120RMB), 折腾了一段时间, 最后把两个路由器的位置调换(也就是 TL-WR841N 放我家窗户的位置, 然后 TL-WR340G+ 放亲戚家), 终于设置成功, 现将设置过程大致记录一下.&lt;/p&gt;

&lt;p&gt;先在亲戚家的 TL-WR340G+ 上设置好宽带上网, 启用无线, 设置好无线密码(&lt;strong&gt;请设置高安全等级加密方法, WPA-PSK/WPA2-PSK 安全类型, AES加密算法, 有效防止蹭网&lt;/strong&gt;, &lt;a href=&quot;http://www.tp-link.com.cn/pages/article-detail.asp?result=faq&amp;amp;d=33&quot;&gt;访问本链接了解更多关于防止蹭网的详细内容&lt;/a&gt;.  然后修改”无线网络基本设置”–“信道”为2(&lt;strong&gt;信道要和桥接的另外一个路由器 TL-WR841N 一致&lt;/strong&gt;), 然后我们的第一个路由器就设置完了.&lt;/p&gt;

&lt;p&gt;然后设置 TL-WR841N, 首先关闭 DHCP 服务, 然后修改 LAN 口地址为 192.168.0.2, 然后就可以设置无线桥接了, 在 TL-WR841N 的 Web 管理界面”无线设置”–“基本设置”, 首先修改信道为 2 (&lt;strong&gt;与 TL-WR340G+ 设置的信道保持一致&lt;/strong&gt;), 然后开启 WDS, 扫描到 TL-WR340G+ 的 SSID 及 MAC 地址, 选择 TL-WR340G+ 上设置的无线密码类型并输入无线密码, 保存并重启路由器即可.&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>Quidway AR28-11 路由器内网 PC 通过公网 IP 访问映射的内网 Server 案例</title>
   <link href="http://mrluanma.github.io//2010/02/05/QuidwayAR28-11-router-nat-configuration-demo.html"/>
   <updated>2010-02-05T00:00:00+00:00</updated>
   <id>http://mrluanma.github.io//2010/02/05/QuidwayAR28-11-router-nat-configuration-demo</id>
   <content type="html">&lt;h2 id=&quot;section&quot;&gt;问题描述&lt;/h2&gt;

&lt;p&gt;内网 PC 与内网所在的 Server 在同一个网段, 现在内网 Server 对公网用户提供 WWW 和 FTP 服务, 在公网上有相应的域名.  现在要求内网 PC 可以同时通过公网域名, 公网 IP 和私网 IP 来访问内网的这台 Server.&lt;/p&gt;

&lt;h2 id=&quot;section-1&quot;&gt;过程分析&lt;/h2&gt;

&lt;p&gt;内网主机通过公网域名来访问映射的 Server 在 AR 路由器上都是通过 NAT DNS-MAP 来实现的, 但不能同时通过公网 IP 和私网 IP 来访问 Server.  如果在设备内网口配置 NAT Server 则可以把访问公网地址转换成私网地址, 然后向 Server 发起连接, 但源地址还是内网主机的地址, 此时 Server 给 PC 回应报文时就不会走路由器, 直接发到了内网 PC 上, 内网 PC 认为不是自己要访问的地址, 会把这个报文丢弃, 因此会导致连接中断.  如果让 Server 把报文回给路由器, 路由器再根据 NAT SESSION 就可以正确转发给 PC 了.&lt;/p&gt;

&lt;h2 id=&quot;section-2&quot;&gt;解决方法&lt;/h2&gt;

&lt;p&gt;在内网接口配置一个NAT OUTBOUND 3000就可以了.  具体配置如下:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[H3C]dis cu
#
 sysname H3C
#
 clock timezone gmt+08:004 add 08:00:00
#
 cpu-usage cycle 1min
#
 connection-limit disable
 connection-limit default action deny
 connection-limit default amount upper-limit 50 lower-limit 20
#
 web set-package force flash:/http.zip
#
radius scheme system
#
domain system
#
local-user admin
 password cipher .]@USE=B,53Q=^Q`MAF4&amp;lt;1!!
 service-type telnet terminal
 level 3
 service-type ftp
#
acl number 2000
 rule 0 permit source 192.168.1.0 0.0.0.255
 rule 1 deny
#
acl number 3000
 rule 0 permit ip source 192.168.1.0 0.0.0.255 destination 192.168.1.2 0
#
interface Aux0
 async mode flow
#
interface Ethernet1/0
 ip address 192.168.1.1 255.255.255.0
 nat outbound 3000
 nat server protocol tcp global 200.0.0.2 ftp inside 192.168.1.2 ftp
#
interface Ethernet1/1
#
interface Ethernet1/2
#
interface Ethernet1/3
#
interface Ethernet1/4
#
interface Ethernet1/5
#
interface Ethernet1/6                     
#
interface Ethernet1/7
#
interface Ethernet1/8
#
interface Ethernet2/0
 ip address 200.0.0.2 255.255.255.0
 nat outbound 2000
 nat server protocol tcp global 200.0.0.2 ftp inside 192.168.1.2 ftp
#
interface Ethernet3/0
#
interface NULL0
#
 FTP server enable
#
 ip route-static 0.0.0.0 0.0.0.0 200.0.0.1 preference 60
#
user-interface con 0
user-interface aux 0
user-interface vty 0 4
 authentication-mode scheme
#
return                                    
[H3C]
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;h2 id=&quot;section-3&quot;&gt;说明&lt;/h2&gt;

&lt;ol&gt;
  &lt;li&gt;本案例适用于 R 系列, AR 系列, MSR 系列路由器, secpath 防火墙.&lt;/li&gt;
  &lt;li&gt;R 系列路由器在使用此案例时内网口需要 undo ip fast-forwarding, 并且在使用 FTP 映射时, 客户端只能使用主动模式去访问.&lt;/li&gt;
&lt;/ol&gt;
</content>
 </entry>
 

</feed>
