<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1379905233792953891</id><updated>2011-10-18T00:27:56.271+08:00</updated><category term='csrf'/><category term='javascript'/><category term='柴静'/><category term='security'/><category term='programming'/><category term='decorator'/><category term='quote'/><category term='ed2k'/><category term='ie'/><category term='amuled'/><category term='life'/><category term='做人'/><category term='economics'/><category term='dns_rebinding'/><category term='python'/><category term='frontend'/><category term='ie6'/><category term='twitter'/><category term='html'/><category term='optimization'/><category term='clickjacking'/><category term='xss'/><category term='陈虻'/><category term='heroku'/><category term='redmine'/><category term='database'/><title type='text'>Notepad</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://leechael.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://leechael.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Leechael</name><uri>http://www.blogger.com/profile/11027831722626043108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_d3tblF0J014/Sxkv1Cb4lQI/AAAAAAAAAYE/HerVNh_Fpp0/S220/portrait.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>34</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1379905233792953891.post-2427924007737037290</id><published>2009-12-26T05:44:00.001+08:00</published><updated>2009-12-26T05:45:32.446+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='redmine'/><category scheme='http://www.blogger.com/atom/ns#' term='heroku'/><title type='text'>在 Heroku 上面架设 Redmine</title><content type='html'>如何在 Heroku 上架设 Redmine，可以参见这篇：&lt;a href="http://punk.tw/2009/09/27/943.html"&gt;如何在Heroku上架設免費、開放源碼的專案管理軟體：Redmine&lt;/a&gt;。这里补充几点我在尝试中遇到的问题和解决办法。&lt;br /&gt;&lt;br /&gt;1. 基本环境构建&lt;br /&gt;&lt;br /&gt;这里是 Ubuntu 的例子：&lt;br /&gt;&lt;br /&gt;&lt;code&gt;sudo apt-get install subversion git-core&lt;code&gt;&lt;br /&gt;确保 SVN 和 Git 已被安装。&lt;br /&gt;&lt;br /&gt;&lt;code&gt;sudo apt-get install ruby ruby-dev rubygems sqlite3 libsqlte3-dev rake&lt;code&gt;&lt;br /&gt;&lt;code&gt;sudo gem install rails sqlite3-ruby heroku&lt;code&gt;&lt;br /&gt;部署 RoR 环境。&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;2. 创建数据库。&lt;br /&gt;&lt;br /&gt;文中的 &lt;code&gt;rake db:migrate RAILS_ENV="demo"&lt;code&gt; 改为 &lt;code&gt;rake db:migrate RAILS_ENV="production"&lt;code&gt;，而在此之前，需要对 config/database.yml 进行修改（假设你使用的是 SQLite 储存数据）：&lt;br /&gt;&lt;pre&gt;production:&lt;br /&gt;  adapter: sqlite3&lt;br /&gt;  database: db/test.db&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;然后：&lt;br /&gt;&lt;pre&gt;rake db:migrate RAILS_ENV="production"&lt;br /&gt;rake redmine:load_default_data RAILS_ENV="production"&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;3. RSA&lt;br /&gt;&lt;br /&gt;安装： &lt;code&gt;sudo apt-get install openssh-client&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;生成： &lt;code&gt;ssh-keygen -t dsa&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;保存的位置是 &lt;code&gt;～/.ssh/id_dsa&lt;/code&gt;。&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;4. 测试&lt;br /&gt;&lt;br /&gt;Redmine 中内置了一个简单的 HTTP Server： &lt;code&gt;ruby script/server webrick -e production&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1379905233792953891-2427924007737037290?l=leechael.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://leechael.blogspot.com/feeds/2427924007737037290/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1379905233792953891&amp;postID=2427924007737037290' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/2427924007737037290'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/2427924007737037290'/><link rel='alternate' type='text/html' href='http://leechael.blogspot.com/2009/12/heroku-redmine.html' title='在 Heroku 上面架设 Redmine'/><author><name>Leechael</name><uri>http://www.blogger.com/profile/11027831722626043108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_d3tblF0J014/Sxkv1Cb4lQI/AAAAAAAAAYE/HerVNh_Fpp0/S220/portrait.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1379905233792953891.post-997961227471774378</id><published>2009-12-24T16:06:00.002+08:00</published><updated>2009-12-24T16:32:53.034+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='frontend'/><category scheme='http://www.blogger.com/atom/ns#' term='optimization'/><title type='text'>Note on Non-Blocking Scripts Loading on Desktop Browsers</title><content type='html'>The presentation: &lt;a href="http://stevesouders.com/docs/velocity-20090622.ppt"&gt;http://stevesouders.com/docs/velocity-20090622.ppt&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Now we have six ways to do loading Scripts without blocking, but not all work on all browsers, and not all work as we need.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;XHR Eval&lt;/h3&gt;&lt;pre&gt;&lt;code&gt;var xhrObj = getXHRObject();&lt;br /&gt;xhrObj.onreadystatechange=function()&lt;br /&gt;{&lt;br /&gt;    if (xhrObj.readyState != 4) return;&lt;br /&gt;    eval(xhrObj.responseText);&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Script must have same domain as main page, and script must to be refactored.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;XHR Injection&lt;/h3&gt;&lt;pre&gt;&lt;code&gt;var xhrObj = getXHRObject();&lt;br /&gt;xhrObj.onreadystatechange=function()&lt;br /&gt;{&lt;br /&gt;    if (xhrObj.readyState != 4) return;&lt;br /&gt;    var se = document.createElement('script');&lt;br /&gt;    document.getElementsByTagName('head')[0].appendChild(se);&lt;br /&gt;    se.text = xhrObj.responseText;&lt;br /&gt;}&lt;br /&gt;xhrObj.open('GET', 'A.js', true);&lt;br /&gt;xhrObj.send('');&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Script must have same domain as main page.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Script in iFrame&lt;/h3&gt;Create a page contains the script, like A.html contains A.js, than modify your main page and add iframe like:&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;&amp;lt;iframe src="A.html" width="0" height="0" frameborder="0" id="frame1"&amp;gt;&amp;lt;/iframe&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;But iframe must have same domain as main page, and your scripts in both main page and iframe have to refactor, though the functions in A.js exist in iframe, not main page:&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;// Access iframe from main page: call function createNewDiv()&lt;br /&gt;window.frames&amp;lt;sup&amp;gt;&amp;lt;a href="#fn0"&amp;gt;0&amp;lt;/a&amp;gt;&amp;lt;/sup&amp;gt;.createNewDiv();&lt;/code&gt;&lt;/pre&gt;&lt;pre&gt;&lt;code&gt;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;// Access main page from iframe: add a div element to main page&lt;br /&gt;parent.document.createElement('div');&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;h3&gt;Script DOM Element&lt;/h3&gt;&lt;pre&gt;&lt;code&gt;var se document.createElement('script');&lt;br /&gt;se.src = 'http://anydomain.com/A.js';&lt;br /&gt;document.getElementsByTagName('head')[0].appendChild(se);&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;Script and main page domains can differ, and no need to refactor JavaScript.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Script Defer&lt;/h3&gt;&lt;pre&gt;&lt;code&gt;&amp;lt;script defer="defer" src="A.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;In this trick script and main page domains can differ, no need refactor JavaScript. But only supported in IE, now landed in FF 3.1.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;document.write Script Tag&lt;/h3&gt;&lt;br /&gt;&lt;pre&gt;&lt;code&gt;document.write('&amp;lt;script type="text/javascript" src="A.js"&amp;gt;&amp;lt;/script&amp;gt;');&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Parallel downloads for scripts, nothing else. But all &lt;code&gt;document.write&lt;/code&gt;s must be in same script block, parallelization only works in IE.&lt;br /&gt;&lt;br /&gt;We must ensure scripts ordered execution, cause some scripts have dependencies.&lt;br /&gt;&lt;br /&gt;We must avoid scripts ordered execution, that make faster execution.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;But when inline scripts dependencies on scripts file?&lt;/strong&gt; Script DOM Element works only on FF and Opera. Five techniques cames:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Hardcoded callback in the end of script. Not very flexible, does’t work for 3rd party scripts.&lt;/li&gt;&lt;li&gt;Window onload event. Must use async technique that blocks onload event to ensure scripts loaded before onload event have been fired. Script in iframe does this across most browsers.&lt;/li&gt;&lt;li&gt;Timer. Not smart enough, load if interval too low, delay if too high.&lt;/li&gt;&lt;li&gt;&lt;a href="http://ejohn.org/blog/degrading-script-tags/"&gt;Degrading script tags&lt;/a&gt;. From John Resig, but doesn’t work for 3rd party scripts.&lt;/li&gt;&lt;li&gt;Script onload event. That’s what we want.&lt;/li&gt;&lt;/ul&gt;Example for script onload:&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;var init = function ()&lt;br /&gt;{&lt;br /&gt;    // do something....&lt;br /&gt;}&lt;br /&gt;var se = document.createElement('script');&lt;br /&gt;se.src = 'some.js';&lt;br /&gt;se.onloadDone = false;&lt;br /&gt;se.onload = function ()&lt;br /&gt;{&lt;br /&gt;    if (!se.onloadDone)&lt;br /&gt;    {&lt;br /&gt;        init();&lt;br /&gt;    }&lt;br /&gt;    se.onloadDone = true;&lt;br /&gt;}&lt;br /&gt;se.onreadystatechange = function ()&lt;br /&gt;{&lt;br /&gt;    if ('loaded' === se.readyState)&lt;br /&gt;    {&lt;br /&gt;        if (!se.onloadDone)&lt;br /&gt;        {&lt;br /&gt;            init();&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;document.getElementsByTagName('head')[0].appendChild(se);&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;What about multiple scripts that depend on each other, and inline code that depends on the scripts? We got two solutions: Managed XHR, DOM Element and Doc Write.&lt;br /&gt;&lt;br /&gt;Managed XHR: base XHR Injection than maintains a queue additional, than inline code runs after all scripts in queue load finished. This solution works fine at all browsers, but all scripts must same domain as main page. See example in the presentation page 48 – 50.&lt;br /&gt;&lt;br /&gt;DOM Element and Doc Write: this solution depends on browser. Use Script DOM Element for Firefox and Opera, &lt;code&gt;document.write&lt;/code&gt; for IE. But no benefit for Safari and Chrome, they don’t load scripts in parallel, rely on Safari 4 and Chrome 2. When scripts same domain, order preserved, no blocking (on all browsers). If scripts on different domain, all browsers order preserved, all browsers load scripts in parallel except Safari 3 and Chrome 1, and load script and image in parallel only on Firefox, Safari 4 and Chrome 2.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;best to move inline scripts above stylesheets or below other resources&lt;/h3&gt;Because browsers download stylesheets in parallel with other resources that follow unless the stylesheet is followed by an inline script.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Positioning inline scripts&lt;/h3&gt;&lt;ul&gt;&lt;li&gt;Remember inline scripts carry a cost.&lt;/li&gt;&lt;li&gt;Avoid long-executing inline scripts.&lt;/li&gt;&lt;li&gt;Don’t put inline scripts between stylesheets and other resources.&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1379905233792953891-997961227471774378?l=leechael.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://leechael.blogspot.com/feeds/997961227471774378/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1379905233792953891&amp;postID=997961227471774378' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/997961227471774378'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/997961227471774378'/><link rel='alternate' type='text/html' href='http://leechael.blogspot.com/2009/12/note-on-non-blocking-scripts-loading-on.html' title='Note on Non-Blocking Scripts Loading on Desktop Browsers'/><author><name>Leechael</name><uri>http://www.blogger.com/profile/11027831722626043108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_d3tblF0J014/Sxkv1Cb4lQI/AAAAAAAAAYE/HerVNh_Fpp0/S220/portrait.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1379905233792953891.post-7695848147328392549</id><published>2009-12-24T13:08:00.000+08:00</published><updated>2009-12-24T13:08:42.831+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ie6'/><title type='text'>为什么至今中国大陆用户还在使用 IE6？</title><content type='html'>&lt;ol&gt;&lt;li&gt;组装机。这部分机器几乎都会安装盗版 Windows XP。&lt;/li&gt;&lt;li&gt;网吧。在多个机器上安装系统的方法，最广为被人使用的手段是 Ghost；中国大陆的网吧大部分都会预装大量的游戏，而对游戏兼容性最好的还是 Windows XP。&lt;/li&gt;&lt;li&gt;部分二手电脑用户。基于机器性能问题，Windows XP 是最为合适的操作系统，也相对容易使用。&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;上面三条都说到了 Windows XP。而安装 Windows XP 的方法也很简单：Ghost 版 Windows XP 光盘镜像，或者自定义化后、更便于使用的 Windows XP 安装光盘，在网上随处可得，不会因为捉了“番茄家园”的制作者而消失，但会因为这个事件而开始销声匿迹。而大量遗留在网上的这类光盘镜像，都已经广为被人使用，而其中的浏览器都是 IE6，或者 IE7，预装系统中带有 IE8 光盘镜像很少很少，甚至不被考虑。&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;同时，在国内也有很多基于 IE 内核的浏览器：傲游，360浏览器，腾讯TT，绿色浏览器，等等。这些都只是让用户获得更好的使用体验，并不在乎背后调用的是 IE6、IE7 或是 IE8。&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;如果要普及 IE8：&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;市场上出现大量自动安装 IE8 的 Ghost 版 Windows XP 光盘镜像和自定义化后、更便于使用的 Windows XP&amp;nbsp;系统光盘镜像。&lt;/li&gt;&lt;li&gt;基于 IE 内核的浏览器强制用户升级到 IE8。&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;或者上面说得有些乱，而这结论也只是基于我对周围那些计算机用户的观察，一家之谈，仅供参考。&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1379905233792953891-7695848147328392549?l=leechael.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://leechael.blogspot.com/feeds/7695848147328392549/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1379905233792953891&amp;postID=7695848147328392549' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/7695848147328392549'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/7695848147328392549'/><link rel='alternate' type='text/html' href='http://leechael.blogspot.com/2009/12/ie6.html' title='为什么至今中国大陆用户还在使用 IE6？'/><author><name>Leechael</name><uri>http://www.blogger.com/profile/11027831722626043108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_d3tblF0J014/Sxkv1Cb4lQI/AAAAAAAAAYE/HerVNh_Fpp0/S220/portrait.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1379905233792953891.post-9016200723821917143</id><published>2009-12-24T11:50:00.000+08:00</published><updated>2009-12-24T11:50:27.874+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='陈虻'/><category scheme='http://www.blogger.com/atom/ns#' term='quote'/><category scheme='http://www.blogger.com/atom/ns#' term='柴静'/><category scheme='http://www.blogger.com/atom/ns#' term='做人'/><title type='text'>柴静眼中的陈虻</title><content type='html'>由柴静最近一篇写到陈虻的文章，再找到此前她写的另一篇写陈虻的文章。&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;“我把它放在一个医学家面前，我说请你给我写三千字，他说行，你等着吧，他肯定写尼古丁含量，几支烟的焦油就可以毒死一只小老鼠，吸烟的人肺癌的发病率，是不吸烟人的多少倍，吸烟如何危害健康。还是这盒烟，我把他拿给一个搞美术设计的人，我说哥们请你写三千字，那哥们给你写，这个设计的颜色，它的民族化的特点，它的标识写出来。我给一个经济学家，他告诉你，烟草是国家税收的大户，如果全不吸烟的话，影响经济发展，还有烟草走私对经济影响。”&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;“你有自己认识事物的座标系吗？有几个？”——（我）最怕的该是没有自己认识事物的坐标系。以前的我铁定没有这东西，可以被网上的文字忽悠得人云亦云；做笔记的现今也不确定有这东西，让自己欣慰的进步是，可以同时接受观点对立的两个消息，尽管接受了其中一个而不接受另外一个。看黑泽明的《虾蟆的油》，摘下了里面的一句话，&lt;a href="http://twitter.com/Leechael/status/6903844911"&gt;前几天翻笔记又碰见了&lt;/a&gt;，今天又想起来了：&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;我那时还年轻，对于这一点既不满，也深感不安，于是焦急也强迫自己要有自己的想法。……事情就是这样，很多人年轻时显示欲过强，这样反倒失去了自己。&lt;/blockquote&gt;&lt;br /&gt;&lt;blockquote&gt;“思想、你、你妈这是三个东西，现在你妈看不懂，这是铁定的事实，到底是这思想错了，还是你妈的水平太低，还是你没把这思想表达清楚？我告诉你，你妈是上帝，不会错。思想本身也不会错，是你错了，是你在叙述这个思想的时候，叙述的节奏、信息的密度和它的影像化程度没处理好，所以思想没有被传递。”&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;blockquote&gt;“结论是简单的，关系是深刻的。”&lt;br /&gt;&lt;/blockquote&gt;无论节目还是程序。话说，以英文来说，都是 program？ 那么整个程序的追求，似乎就出来了？&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;“你必须退让的时候，就必须退让。但在你必须选择机会前进的时候，必须前进。这是一种火候的拿捏，需要对自己的终极目标非常清醒，非常冷静，对支撑这种目标的理念非常清醒，非常冷静。只有你非常清楚地知道你的靶子在哪儿，退到一环，甚至脱靶都没有关系。环境需要你脱靶的时候，你可以脱靶，这就是运作的策略，但你不能失去自己的目标。”&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;blockquote&gt;“宽容的基础是理解，你理解么？”&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;- 柴静，&lt;/span&gt;&lt;a href="http://blog.sina.com.cn/s/blog_48b0d37b0100h4p5.html"&gt;&lt;span style="font-size: small;"&gt;我以为我失去了他，但是没有&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;- 柴静，&lt;/span&gt;&lt;a href="http://blog.sina.com.cn/s/blog_48b0d37b0100dn2t.html"&gt;&lt;span style="font-size: small;"&gt;陈虻不死&lt;/span&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1379905233792953891-9016200723821917143?l=leechael.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://leechael.blogspot.com/feeds/9016200723821917143/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1379905233792953891&amp;postID=9016200723821917143' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/9016200723821917143'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/9016200723821917143'/><link rel='alternate' type='text/html' href='http://leechael.blogspot.com/2009/12/blog-post_24.html' title='柴静眼中的陈虻'/><author><name>Leechael</name><uri>http://www.blogger.com/profile/11027831722626043108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_d3tblF0J014/Sxkv1Cb4lQI/AAAAAAAAAYE/HerVNh_Fpp0/S220/portrait.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1379905233792953891.post-7044666026171982724</id><published>2009-12-16T14:06:00.002+08:00</published><updated>2009-12-16T14:10:43.971+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='frontend'/><category scheme='http://www.blogger.com/atom/ns#' term='optimization'/><title type='text'>前端优化笔记</title><content type='html'>&lt;blockquote&gt;&lt;p&gt;注：内容主要来自于日常阅读中读到的一些前端优化相关的文章，或者有所遗漏。&lt;/p&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;p&gt;载入一个页面，分为三个阶段：浏览器打开链接并发送请求，服务器作出响应、客户端开始接收数据直至服务器端的应答完成，浏览器完成页面的渲染。&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3 id="request-sent"&gt;浏览器打开链接并发送请求&lt;/h3&gt;&lt;br /&gt;&lt;h4 id="reduce-dns-lookups"&gt;减少 DNS 查询次数&lt;/h4&gt;&lt;ol&gt;&lt;li&gt;优化使用域名及子域名的数量。在 Let's make the web faster 的系列文章中&lt;sup&gt;&lt;a href="#google-web-faster"&gt;1&lt;/a&gt;&lt;/sup&gt;，Google 推荐使用一个主域名，辅以四个域名用于平行下载可缓存的资源。但不够六个资源时，最好不要使用超过一个域名；每个域名分配的资源不足两个显得十分浪费。最好不使用超过五个域名。&lt;/li&gt;&lt;li&gt;尽可能使用 URL 路径而非域名：例子是，&lt;code&gt;http://example.com/i-am-a-page.html&lt;/code&gt; 及 &lt;code&gt;/i-am-a-page.html&lt;/code&gt;。&lt;/li&gt;&lt;li&gt;对于经常重复引用的文件，尽量处于同一个域名之下，例如脚本、样式文件，这样可以充分利用 DNS 的查询缓存。&lt;/li&gt;&lt;li&gt;对于 DNS 解析结果，IE 缓存 30 分钟，可以通过注册表中的 DnsCacheTimeout 来设置；Firefox 缓存 1 分钟，修改 about:config 中的 network.dnsCacheExpiration 可以更改默认值。&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;h4 id="avoid-redirects"&gt;避免重定向的请求&lt;/h4&gt;&lt;p&gt;发送重定向的请求有数种方式，服务器端返回 30x 并指定重定向地址，通过 meta 标签写 refresh 进行重定向，JavaScript 实现的重定向。无论哪种重定向，对 mobile 版本的网站更为致命。&lt;br /&gt;对于 301/302 重定向，似乎更多是出于 SEO 的考虑，对此，应该考虑使用 &lt;a href="http://googlewebmastercentral.blogspot.com/2009/02/specify-your-canonical.html"&gt;Cononical Meta Tag&lt;/a&gt;。&lt;/p&gt;&lt;br /&gt;&lt;h4 id="use-get-for-ajax-requests"&gt;使用 GET 来完成 AJAX 请求&lt;/h4&gt;&lt;p&gt;在 AJAX 中使用 GET 请求的原因是，GET 请求很多时候只占用一个 TCP 包，而对 URL 长度最为刻薄的 IE 也只是限制 URL 在 2000 字符以内；而 POST 请求则是，先发送响应头，再发送响应中的数据。&lt;/p&gt;&lt;br /&gt;&lt;h4 id="reduce-cookie-size"&gt;减少 cookie 的大小&lt;/h4&gt;&lt;p&gt;每一个请求都会包含该域名下的 cookie，怎么说也是一个不小的负担。谨慎地使用 cookie,减少 cookie 的数量和大小并不是一个坏主意。&lt;/p&gt;&lt;br /&gt;&lt;h4 id="use-cookie-free-domain"&gt;为页面组成元素不需要发送 cookie 的域名&lt;/h4&gt;&lt;p&gt;根据浏览器的同源原则，向同一个域名的请求总会包含该域名下的 cookie，对于静态文件来说，cookie 是不必要的。除了最大化平衡下载页面中的元素以外，无 cookie 的请求也是为静态文件启用不同域名的理由。&lt;/p&gt;&lt;p&gt;另外参见 &lt;a href="#use-a-cdn"&gt;使用CDN&lt;/a&gt;。&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;服务器作出应答，客户端开始接收数据&lt;/h3&gt;&lt;br /&gt;&lt;h4&gt;开启 HTTP 服务器中的 keepalives 选项&lt;/h4&gt;&lt;p&gt;为免受限于浏览器全局的服务器连接数，keepalives 的超时时间可以考虑设得更短，如 5 - 10 秒。而静态文件和动态文件最好分开存在于不同的服务器；当近千个请求发送向静态文件服务器时或许仅是消耗了 10 M 内存，而你的动态文件服务器很轻易地就为每一个请求消耗 10M 内存了。&lt;/p&gt;&lt;br /&gt;&lt;h4&gt;缓存 AJAX 请求的结果&lt;/h4&gt;&lt;p&gt;AJAX 请求也是一个 HTTP 请求，即是说，是可以缓存的，expires/last-modified/cache-control/gzip 都可以用上。另一方面，对 IE 来说，对于指定了 cache-control/expires 的 AJAX 请求，在过期以前是不会重新向服务器发出请求，即使你使用 Ctrl+R 强制刷新页面。参见：&lt;a href="http://blog.httpwatch.com/2009/08/07/ajax-caching-two-important-facts/"&gt;Ajax Caching: Two Important Facts&lt;/a&gt;。&lt;/p&gt;&lt;br /&gt;&lt;h4&gt;将样式文件的引用放到页面的顶部&lt;/h4&gt;&lt;p&gt;将样式文件的引用放在页面的头部，这样页面渲染将会是渐进式的；此外，CSS 文件是并行下载的；浏览器即使还没有完整载入页面，也会发起新的请求下载 CSS 文件。&lt;/p&gt;&lt;br /&gt;&lt;h4&gt;使用 &amp;lt;link&amp;gt; 而非 @import 引用样式文件&lt;/h4&gt;&lt;p&gt;对于 IE 来说，@import 的行为就等于把样式文件放在页面的后面；而这显然不是我们所期望的。&lt;/p&gt;&lt;br /&gt;&lt;h4&gt;将脚本文件的引用放到页面的底部&lt;/h4&gt;&lt;p&gt;和样式文件不同，默认情况下，脚本文件的下载并非并行模式，无论是否属于相同的域名源，载入脚本文件时总会阻止其他文件的并行下载。并行下载脚本的实现，见 &lt;a href="http://piecesofrakesh.blogspot.com/2009/03/downloading-javascript-files-in.html"&gt;Downloading JavaScript Files in Parallel&lt;/a&gt;。&lt;/p&gt;&lt;p&gt;对于已经支持 HTML5 的浏览器，&lt;a href="http://www.websiteoptimization.com/speed/tweak/defer/"&gt;在 script 加上 defer 标签亦有同样的效果&lt;/a&gt;。&lt;/p&gt;&lt;p&gt;最后，&lt;em&gt;避免重复载入同一个脚本&lt;/em&gt;。&lt;/p&gt;&lt;br /&gt;&lt;h4 id="flush-the-buffer-early"&gt;尽早让页面离开缓存&lt;/h4&gt;&lt;p&gt;这里的缓存指的是 &lt;i&gt;Buffer&lt;/i&gt;。在 PHP 中就是在使用 ob_start() 之余，灵活地放置一些 flush()。例如，在页面头确定以后来一次 flush()。这也是实现渐进式渲染中的一个关键。&lt;/p&gt;&lt;br /&gt;&lt;h4&gt;优化 CSS sprites&lt;/h4&gt;&lt;p&gt;在 sprites 中水平地排放图片比垂直地排放图片更能减少生成图片的体积；而将相近颜色的图片合并为 sprites 可以让图片使用的颜色数目更少，甚至一张 256 色的 PNG8 也能满足需要；为了对移动设备更友好，不要在图片之间留太多的空隙，这对图片大小没有太多的影响，但对于客户端来说，这会是使用更少的内存。&lt;/p&gt;&lt;br /&gt;&lt;h4&gt;避免通过 HTML 或者 CSS 代码修改图片大小&lt;/h4&gt;&lt;p&gt;例如，在 &amp;lt;img&amp;gt; 标签中以 width 和 height 重定义图片大小并不是好主意，一张 500x500 的图片并不因此而缩减了大小。&lt;/p&gt;&lt;br /&gt;&lt;h4&gt;缩减页面以及各个文件的体积&lt;/h4&gt;&lt;ol&gt;&lt;li&gt;&lt;em&gt;使用 Gzip 压缩页面&lt;/em&gt;。这是最早被提出的优化手段之一。往响应头里面加上 Accept-Encoding: gzip, deflate，然后使用 deflate 的方式压缩（&lt;a href="http://httpd.apache.org/docs/2.0/mod/mod_deflate.html"&gt;apache 2.x 的 mod_deflate&lt;/a&gt; 和 &lt;a href="http://wiki.nginx.org/NginxHttpGzipModule"&gt;Nginx 中的 Http Gzip Module&lt;/a&gt;）。&lt;br /&gt;另外，脚本以及样式文件也推荐使用 Gzip 压缩。&lt;/li&gt;&lt;li&gt;对于 1KB 以下体积的文件，GZip 压缩的效果并不好。&lt;/li&gt;&lt;li&gt;&lt;em&gt;压缩脚本和样式文件&lt;/em&gt;。对于精简脚本文件，推荐 Google 的 &lt;a href="http://code.google.com/p/closure-compiler/"&gt;Closure-Compiler&lt;/a&gt;；而样式文件可以使用 &lt;a href="http://developer.yahoo.com/yui/compressor/"&gt;YUI Compressor&lt;/a&gt; 或者 &lt;a href="http://www.phpied.com/cssmin-js/"&gt;cssmin.js&lt;/a&gt; 进行处理。&lt;/li&gt;&lt;li&gt;对图片进行优化：选择更合适的图片格式，减少图片的体积。&lt;/li&gt;&lt;li&gt;对于图片来说，开启 Gzip 的作用不大。&lt;/li&gt;&lt;li&gt;&lt;em&gt;设置一个体积很小的、可缓存的 favicon.ico&lt;/em&gt;。无论存在与否，浏览器都会向服务器请求 favicon.ico 这个文件。为了避免返回 404，最好还是让这个小图标存在，并确保：足够小的体积，甚至在 1kb 以下；设置一个遥遥无期的过期时间。&lt;/li&gt;&lt;li&gt;对于页面来说，100KB 以下的页面体积也属于一个 SEO 优化手段。&lt;/li&gt;&lt;li&gt;这主要是针对 iPhone 而非其他移动设备的优化；iPhone 仅能缓存不大于 25 KB 的单个文件，并且这是解压缩后的大小；对于一个页面的所有文件，iPhone 也仅是提供 475 - 500 KB 的缓存；更甚，页面之间是不共享缓存的，即使它们使用了同一个文件。或者对于 iPhone 来说，嵌入的样式和脚本值得考虑。&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;h4&gt;使用 HTML5&lt;sup&gt;&lt;a href="#use-html5"&gt;2&lt;/a&gt;&lt;/sup&gt;&lt;/h4&gt;&lt;ol&gt;&lt;li&gt;更短的 DTD: &amp;lt;!DOCTYPE html&amp;gt;&lt;/li&gt;&lt;li&gt;编码：&amp;lt;meta charset="utf-8"&amp;gt;&lt;/li&gt;&lt;li&gt;对于 style 和 script 标签来说，type 属性可以忽略。&lt;/li&gt;&lt;li&gt;针对脚本载入而制定的新属性 async 和 defer。&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;h4&gt;优化服务器端的程序架构&lt;/h4&gt;&lt;p&gt;好的架构有更良好的页面生成速度。对于 PHP，推荐阅读 &lt;a href="http://toys.lerdorf.com/archives/38-The-no-framework-PHP-MVC-framework.html"&gt;The No-Framework PHP MVC Framework&lt;/a&gt;。&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3 id="page-rendering"&gt;浏览器完成页面的渲染&lt;/h3&gt;&lt;br /&gt;&lt;p&gt;针对这一部分的优化手段较多，来自 Yahoo! 的 14 条优化准测&lt;sup&gt;&lt;a href="#yahoo-performance-rules"&gt;3&lt;/a&gt;&lt;/sup&gt;几乎都是针对这一部分的优化。而在页面渲染的过程中，会继续向服务器的发送请求（脚本、样式文件、图片等等），对于&lt;a href="#request-sent"&gt;发送请求的优化&lt;/a&gt;见第一部分。&lt;/p&gt;&lt;br /&gt;&lt;h4 id="make-fewer-requests"&gt;数量更少的请求&lt;/h4&gt;&lt;p&gt;对于浏览器来说，读取两个小文件比读取相同大小的一个大文件更耗费时间。&lt;/p&gt;&lt;ol&gt;&lt;li&gt;将多个脚本、样式文件合并为一个。实际上读取两个小文件比读取等同大小的一个大文件更耗费时间。&lt;/li&gt;&lt;li&gt;&lt;em&gt;CSS Sprites&lt;/em&gt;。优化页面中的背景图片，将多个背景图片合成一个图片。参见 A List Apart 的文章：&lt;a href="http://www.alistapart.com/articles/sprites/"&gt;CSS Sprites: Image Slicing’s Kiss of Death&lt;/a&gt;，&lt;a href="http://www.alistapart.com/articles/sprites2/"&gt;CSS Sprites2 - It’s JavaScript Time&lt;/a&gt;。&lt;/li&gt;&lt;li&gt;Data:URL&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;h4 id="split-components-across-domains"&gt;使用多个域名/子域名提高下载速度&lt;/h4&gt;&lt;p&gt;子域名的启用可以让页面元素尽可能地平行化下载。例如，启用 &lt;code&gt;static.yourdomain.com&lt;/code&gt; 为站点静态内容的域名，甚至更短的域名：&lt;code&gt;ydcdn.cn&lt;/code&gt;。而利用多个域名/子域名优化的时候，需要考虑 &lt;a href="#reduce-dns-lookups"&gt;DNS 的因素&lt;/a&gt;。&lt;/p&gt;&lt;br /&gt;&lt;h4 id="minimize-the-number-of-iframes"&gt;减少 iframe 的数量&lt;/h4&gt;&lt;p&gt;iframe 等同于向服务器发送一个新的页面请求。事实上为什么要使用 iframe？&lt;/p&gt;&lt;br /&gt;&lt;h4 id="no-404s"&gt;消灭 404 页面&lt;/h4&gt;&lt;p&gt;这一点是基于用户体验出发的；当然，设计出更有用的 404 页面也是一个挑战。;)&lt;/p&gt;&lt;br /&gt;&lt;h4 id="use-a-cdn"&gt;使用 &lt;abbr title="Content Delivery Network"&gt;CDN&lt;/abbr&gt;&lt;/h4&gt;&lt;p&gt;对于 CDN，如果展开了，似乎能说的有很多。首先看这篇：&lt;a href="http://chrismeller.com/2009/10/amazon-cloudfront-vs-rackspace-cloudfiles-cdn-performance/"&gt;Amazon CloudFront vs. Rackspace Cloud Files CDN Performance&lt;/a&gt;。而使用 CDN 服务也得讲究性能：CDN 服务器的 uptime、DNS 解析速度、单包延迟 (single-packet latency)、丢包率等等（&lt;a href="http://blog.llnw.com/2008/10/understanding-cdn-performance/"&gt;Understanding CDN Performance&lt;/a&gt;）。&lt;/p&gt;&lt;p&gt;对于国内的 CDN 服务，甚至说，要对 CDN 有一个更全面的认识，请看这篇：&lt;a href="http://blog.csdn.net/fayu0903/archive/2009/03/25/4022979.aspx"&gt;看上去很美——国内CDN现状与美国对比&lt;/a&gt;。&lt;/p&gt;&lt;br /&gt;&lt;h4 id="expires-and-cache-control"&gt;设置 expires 以及 cache-control 响应头&lt;/h4&gt;&lt;p&gt;这是最早被提出的优化手段之一。推荐给静态文件设置一个牛年马月的过期日期，然后通过版本化的方式来更新文件。对于动态文件，则是通过 Cache-Control 这个响应头来控制缓存 &lt;sup&gt;&lt;a href="#cache-tutorial"&gt;4&lt;/a&gt;&lt;/sup&gt;。&lt;/p&gt;&lt;p&gt;这里对 Cache-Control 常见的值进行一些解释。&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;em&gt;no-cache&lt;/em&gt; - 每一次强迫请求项目的缓存时，向源服务器验证缓存的可用性。&lt;/li&gt;&lt;li&gt;&lt;em&gt;no-store&lt;/em&gt; - 标记任何时间都不建立缓存。&lt;/li&gt;&lt;li&gt;&lt;em&gt;max-age=[seconds]&lt;/em&gt; - 指定缓存的存活时间。与 expires 响应头相似，但这个存活时间是相对于请求发出时的相对时间，并非绝对时间。[seconds] 为请求发出后、你期望缓存存活的秒数。&lt;/li&gt;&lt;li&gt;&lt;em&gt;max-stale[=senconds]&lt;/em&gt; - 标记响应过期后还允许存活的秒数，若不指定一个确切的时间，则是表明缓存任何时候都是有效的。&lt;/li&gt;&lt;li&gt;&lt;em&gt;s-maxage=[seconds]&lt;/em&gt; - 与 max-age 响应头的作用相近，但仅作用于分享缓存（如，代理缓存）。&lt;/li&gt;&lt;li&gt;&lt;em&gt;public&lt;/em&gt; - 标记验证过后的响应为可缓存的；一般情况下，如果 HTTP 验证是必需的，那么响应自动标记为不可缓存的（对于分享缓存来说）。&lt;/li&gt;&lt;li&gt;&lt;em&gt;private&lt;/em&gt; -  标记响应不能被可分享的缓存系统缓存；而私有缓存或许会缓存这个响应。&lt;/li&gt;&lt;li&gt;&lt;em&gt;must-revalidate&lt;/em&gt; - 指定缓存必须严格遵守指定的存活时间信息。在特殊条件下，过期的响应是可以接受的；但这个响应标明，缓存必须遵守你指定的缓存规则。&lt;/li&gt;&lt;li&gt;&lt;em&gt;proxy-revalidate&lt;/em&gt; - 于 proxy-revalidate 相似，但仅作用于代理缓存。&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;h4 id="configure-etags"&gt;设置 Etags 或 Last-Modified 响应头&lt;/h4&gt;&lt;p&gt;只能说，使用 Last-Modified 比使用 ETags 有更多的优势。这里得和 expires 和 cache-control 这两个响应头配合使用。&lt;/p&gt;&lt;br /&gt;&lt;h4 id="post-load-components"&gt;推迟下载页面中相对不那么重要的元素&lt;/h4&gt;&lt;p&gt;将页面中的元素分解、剖析，那些相对不那么重要的元素可以暂缓下载和渲染，例如实现拖动和动画的脚本，无关大雅的图片或广告等等。这也是实现渐进式渲染的一个要素。&lt;/p&gt;&lt;br /&gt;&lt;h4 id="preload-components"&gt;预读取部分页面元素&lt;/h4&gt;&lt;p&gt;同样是实现渐进式渲染的一个步骤，但这一建议是将下一个页面要用到的东西提前缓存。除了有效地利用响应头（&lt;a href="#expires-and-cache-control"&gt;设置 expires 以及 cache-control 响应头&lt;/a&gt;，&lt;a href="#configure-etags"&gt;设置 Etags 或 Last-Modified 响应头&lt;/a&gt;）以外，HTML5 的 client-side storage 亦在考虑之列。&lt;/p&gt;&lt;br /&gt;&lt;h4&gt;减少 DOM 节点数量&lt;/h4&gt;&lt;p&gt;另一种表述方式是，精简页面的 HTML 架构。一个反面学习教材是 Drupal，它的 div 嵌套太多了。&lt;/p&gt;&lt;br /&gt;&lt;h4&gt;减少对 DOM 进行的操作&lt;/h4&gt;&lt;p&gt;访问 DOM 节点很慢；缓存引用 DOM 的变量，让 DOM 脱离文档树进行更新，以及避免使用脚本为 DOM 修改布局，都属于作为减少访问 DOM 节点而衍生的手段。&lt;/p&gt;&lt;p&gt;在进行例如动画这般的操作之前，尽可能把元素从页面流中拖出，然后使用绝对定位来定位。&lt;/p&gt;&lt;br /&gt;&lt;h4&gt;减少不必要的 DOM 嵌套深度&lt;/h4&gt;&lt;p&gt;由于对 DOM 进行的每一次操作，都可能会造成目标元素的重新渲染（reflow），因此，在对 DOM 进行操作时，尽量通过修改 class 完成样式的替换，在进行大量操作之前将其从页面正常的流中拖出，而同理加入一个元素到页面之前、先完成对该元素的操作，也尽可能把多个对页面内的 DOM 操作简化，例如合并 DOM 操作，创建一个 DocumentFragment 对象缓存多个未插入页面的DOM。&lt;/p&gt;&lt;br /&gt;&lt;h4&gt;更合理地为 DOM 节点注册事件&lt;/h4&gt;&lt;p&gt;一个常见的手段是 event delegation，假设你有 10 个按钮并且使用一个 div 节点包括，为 div 节点注册事件比为 10 个按钮各自注册事件更好。相对于浏览器的 onload 事件，在 DOMContentLoaded 事件发生后进行对 DOM 的操作更佳，后者标明页面的所有 DOM 节点已经准备就绪，而前者还需等待其他元素、例如图片的载入完成。&lt;/p&gt;&lt;br /&gt;&lt;h4&gt;优化脚本运行速度&lt;/h4&gt;&lt;p&gt;这是直接能让用户体验到的。糟糕的脚本甚至能让浏览器假死、崩溃。Google 在 Let's make the web faster 系列中有一篇针对 &lt;a href="http://code.google.com/speed/articles/optimizing-javascript.html"&gt;JavaScript 优化&lt;/a&gt; 的文章。&lt;/p&gt;&lt;br /&gt;&lt;h4&gt;避免使用 CSS expressions&lt;/h4&gt;&lt;p&gt;CSS expressions 是 IE 的产物，或者对于 IE 实在没有好感的前端开发者来说，是能够轻易做到的。&lt;/p&gt;&lt;br /&gt;&lt;h4&gt;避免使用 filters&lt;/h4&gt;&lt;p&gt;又一个 IE 产物。最为常用的就是 AlphaImageLoader，用于修改 IE7 以前版本的透明 png 文件。filter 的坏处是，在图片下载时，会阻碍页面的渲染进程以及让浏览器假死，也会增加每一个元素对内存的需求。对于透明 png，更好的方案是使用 gracefully degrading PNG8。&lt;/p&gt;&lt;br /&gt;&lt;h4&gt;优化样式文件&lt;/h4&gt;&lt;ul&gt;&lt;li&gt;减少样式的重复定义。例如，&lt;br /&gt;&lt;code&gt;h1 { color: black; } p { color: black; }&lt;/code&gt; 改为 &lt;code&gt;h1, p { color: black; }&lt;/code&gt;。&lt;/li&gt;&lt;li&gt;适当的使用 !important 有很好的效果。&lt;/li&gt;&lt;li&gt;简化样式定义。去掉无用的样式定义。&lt;/li&gt;&lt;li&gt;合理地分割和合并样式表：Google 的建议是分割为更小的文件，仅为特定页面定制的样式独立一个小文件。&lt;/li&gt;&lt;li&gt;若非在页面载入时就使用到的样式，独立放置到一个样式表中，然后推迟这个样式表在 onload 事件以后载入。&lt;/li&gt;&lt;li&gt;假使你需要用到脚本为页面更改样式，要确保这些代码在未需使用之时不会对页面应用这些样式。&lt;/li&gt;&lt;li&gt;精简定义中的样式选择器。&lt;/li&gt;&lt;li&gt;去掉不必要的样式定义。&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;h4&gt;书写 HTML 时的奇技淫巧&lt;/h4&gt;&lt;ul&gt;&lt;li&gt;让相近样式定义之间的定义语句书写排序尽可能地一致，如按照字母表排序（原话：“Specify CSS key-value pairs in the same order where possible, i.e. alphabetize them”，来自于 Google 的 Let's Make the Web Faster 系列文章&lt;sup&gt;&lt;a href="#google-web-faster"&gt;5&lt;/a&gt;&lt;/sup&gt;）。&lt;/li&gt;&lt;li&gt;让 html 代码中属性值的书写顺序尽可能地一致，例如按照字母表排序。Google 说，在他们的搜索结果页里所有链接的属性按照字母表顺序排序书写，Gzip 压缩时能减少 1.5% 的体积。&lt;/li&gt;&lt;li&gt;保持一致的字母大小写。&lt;/li&gt;&lt;li&gt;在 html 属性的书写中保持一致的引号风格，一致地使用单引号、双引号、或者甚至不使用任何引号。&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;h4&gt;不在页面内嵌入脚本以及样式&lt;/h4&gt;&lt;p&gt;把样式和脚本分别独立成一个文件的好处不需再说。值得注意的是，嵌入的样式和脚本并非都是坏事，适当的使用有想不到的妙用。例如，平行下载脚本文件的方法就是在页面嵌入一段脚本。&lt;/p&gt;&lt;br /&gt;&lt;h4&gt;渐进式渲染&lt;/h4&gt;&lt;p&gt;更快的页面载入应该首先渲染用户可见区域的内容，然后渲染目前不可见的页面区域；其次，先载入和渲染轻量级的资源、如文字，然后载入和渲染如图片和视频那般的重量级资源。此外，使用表格布局、把样式表放置到页面底部都会致使部分浏览器的渐进式渲染失效。&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="#flush-the-buffer-early"&gt;尽早让页面离开缓存&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#preload-components"&gt;预读取部分页面元素&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#post-load-components"&gt;推迟下载和渲染页面中相对不那么重要的元素&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;h4&gt;为移动设备进行优化&lt;/h4&gt;&lt;ul&gt;&lt;li&gt;创建和提供移动版本，使用习惯上指向移动版本的 URL：&lt;code&gt;m.example.com&lt;/code&gt;, &lt;code&gt;wap.example.com&lt;/code&gt;, &lt;code&gt;mobile.example.com&lt;/code&gt;。&lt;/li&gt;&lt;li&gt;为移动设备创建合适的界面。&lt;/li&gt;&lt;li&gt;减少浏览时产生请求的数量和数据传输量。&lt;/li&gt;&lt;li&gt;尽可能地启用那些新功能：程序缓存（application cache），CSS3。&lt;/li&gt;&lt;li&gt;兼容更多常见的设备：不要嵌入 flash，慎重使用 JavaScript。&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;h3&gt;其他&lt;/h3&gt;&lt;br /&gt;&lt;h4&gt;测试&lt;/h4&gt;&lt;ul&gt;&lt;li&gt;经常在苛刻的网络条件下访问你的站点；这样能够更快地发现问题。Linux 2.6 内核中的 netem 和 HTB 模块，都可以结合命令行工具 tc 架设一个慢速网络代理。此外的工具包括，Firefox 的 Tamper Data，windows 下的 Fiddler，Mac OSX 中的 Charles。&lt;/li&gt;&lt;li&gt;在内网/开发环境中对页面进行压力测试。&lt;/li&gt;&lt;li&gt;建议用户为他/她的浏览器开启“流水作业”特性。例如 Firefox，在地址栏中输入 about:config，把 network.http.pipelining 设为 TRUE。&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;h4&gt;扩展阅读&lt;/h4&gt;&lt;ol&gt;&lt;li id="google-web-faster"&gt;&lt;a href="http://code.google.com/speed/articles/"&gt;Let's make the web faster&lt;/a&gt;.&lt;/li&gt;&lt;li id="use-html5"&gt;&lt;a href="http://code.google.com/speed/articles/html5-performance.html"&gt;Using HTML 5 for performance improvements&lt;/a&gt;.&lt;/li&gt;&lt;li id="yahoo-performance-rules"&gt;&lt;a href="http://developer.yahoo.com/performance/rules.html"&gt;Best Practices for Speeding Up Your Web Site&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;Steve Souders, In Search of Speed: &lt;a href="http://www.slideshare.net/SergeyChernyshev/in-search-of-speed"&gt;slides&lt;/a&gt;, &lt;a href="http://stevesouders.com/docs/speedgeeks-20091026.zip"&gt;zip&lt;/a&gt;, &lt;a href="http://speedgeeks-la.blip.tv/file/2831975/"&gt;video&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;&lt;a href="http://en.oreilly.com/velocity2008/public/schedule/detail/3632"&gt;Improving Netflix Performance&lt;/a&gt; @ Velocity 2008.&lt;/li&gt;&lt;li&gt;Aaron Hopkins， &lt;a href="http://www.die.net/musings/page_load_time/"&gt;Optimizing Page Load Time&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;SproutCore Blog, &lt;a href="http://blog.sproutcore.com/post/196959232/how-sproutcore-makes-your-app-run-faster"&gt;How SproutCore Makes Your App Run Faster&lt;/a&gt;.&lt;/li&gt;&lt;li id="cache-tutorial"&gt;&lt;a href="http://www.mnot.net/cache_docs/"&gt;Caching Tutorial for Web Authors and Webmasters&lt;/a&gt;.&lt;/li&gt;&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1379905233792953891-7044666026171982724?l=leechael.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://leechael.blogspot.com/feeds/7044666026171982724/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1379905233792953891&amp;postID=7044666026171982724' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/7044666026171982724'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/7044666026171982724'/><link rel='alternate' type='text/html' href='http://leechael.blogspot.com/2009/12/blog-post_16.html' title='前端优化笔记'/><author><name>Leechael</name><uri>http://www.blogger.com/profile/11027831722626043108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_d3tblF0J014/Sxkv1Cb4lQI/AAAAAAAAAYE/HerVNh_Fpp0/S220/portrait.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1379905233792953891.post-1762617987305632902</id><published>2009-12-02T06:13:00.002+08:00</published><updated>2009-12-02T06:41:17.437+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='life'/><title type='text'>终极问题</title><content type='html'>看了 &lt;a href="http://twitter.com/ashchan"&gt;@ashchan&lt;/a&gt;&amp;nbsp;的『&lt;a href="http://blog.ashchan.com/archive/2009/12/01/freelancer-at-library/"&gt;图书馆里的自由枪骑兵&lt;/a&gt;』，仿似闻到自由的气息，又似是找到了以后生活的样子。虽然到 @ashchan 的 Twitter 上，看到其&lt;a href="http://twitter.com/ashchan/status/6233715762"&gt;提及 freelancer 的几个品质&lt;/a&gt;：懒惰，不爱束缚，不怕（没钱）喝西北风，偶尔善吹嘘（忽悠？）。外部条件：父母理解不会说你不求上进，老婆不会逼你买房。&lt;br /&gt;&lt;br /&gt;不说外部条件。懒惰我是够可以的了，束缚我也受不了。没钱这点实在难受，尤其在大学以后，支出是指数级上升；我可以直白地承认我需要钱，虽然我希望过上梭罗那般的简单生活。不过另一方面说来，现在不可能再让你开荒自食其力，梭罗那种隐居生活已经接近幻想；倒是可以做点其他。例如从《全球通史》中得知，千万年前的石器时代，由于人均土地面积较大，每天只需花数小时觅食即可，每周的工作时间甚低，更多时间花费在玩乐上了。&lt;br /&gt;&lt;br /&gt;这样也有另一个问题：理想。我想创建一个能改变人们生活的网站（或者程序？）。那么我就需要一个惊天地泣鬼神的想法，然后付诸实现。然而前一条是难以寻觅的，现实首先迫使你去面对。当然现在有另一个选择，创业。这点很不错，至少工作是不需要用你的学历/文凭来交换。而细节上还是有很多问题，至今我或许对人生思考了无数次，有了无数个答案，又推翻了无数个答案。若是小学作文书中那些范文作者，写着自己的理想，他们早就完成了对人生的安排，而我的答案至今未见。不过这样也好，人生之意义到成为我现在的终极问题了。&lt;br /&gt;&lt;br /&gt;开支是迫使工作的一个缘由；而我发现我最大的开支，除去书和数码用品，似乎都花在吃喝玩乐上面了。或者&lt;a href="http://www.drunkpiano-liuyu.net/?p=154"&gt;一个人要象一个队伍&lt;/a&gt;：适应孤独，就像适应一种残疾。在踏入大学校门之前我就想着要孤独起来，就像住进了 Sputnik。我知道某些事情是在消耗我的生命力，不做就像空虚填满了全身。或者真的需要真正的绝望。&lt;br /&gt;&lt;br /&gt;最近在看张五常的《经济解释》，看了就是觉得需要继续改进自己的思考能力。某次强迫症地想买《可乐牛奶经济学》给人看——那本也算是解释经济现象的书，我还没有看——最后没有成事，总不能强制他人爱上自己的喜好吧。最后自己买了一本英文的《Freakonomic》，有空才看。&lt;br /&gt;&lt;br /&gt;不过有空这词，实在很微妙。我太多太多的东西没看，太多太多的东西没做，那么相对来说就是没有时间，那么就是没有空，或者需要的只是重新思考，给排一个优先级；那么优先级应该是按照什么定义呢，自己的喜好，完成任务所需的时间，还是任务的紧迫程度？然后做这些东西，真的接近了自己所想的了吗？对自己来说，终极问题的答案是什么？引一段话描述自己在不断绕的圈子好了：&lt;br /&gt;&lt;blockquote&gt;對哲學家來說，一般人並不是真的「知道」他們宣稱他們知道的那些事情，他們只是把自己覺得荒謬而又無法反駁的東西掃到地毯下面不去面對。哲學家比較保守︰ 要合理地支持一個主張，忠實地相信它為真還不夠，你還得確定自己能夠對於檯面上所有反對這個主張的說法給出有道理的回應，而這類有道理的回應，當然不能是 「這個說法的結論很怪」或是「我就是不相信啦」。因此，哲學家認真地研究那些看起來挺有道理，結論卻跟大家相信的完全不同的論證，企圖找出它們的問題。&lt;br /&gt;&lt;/blockquote&gt;我不是哲学家，我却需要学习哲学来寻找我的答案。&lt;br /&gt;&lt;br /&gt;还是继续思考我的终极问题好了。&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1379905233792953891-1762617987305632902?l=leechael.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://leechael.blogspot.com/feeds/1762617987305632902/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1379905233792953891&amp;postID=1762617987305632902' title='1 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/1762617987305632902'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/1762617987305632902'/><link rel='alternate' type='text/html' href='http://leechael.blogspot.com/2009/12/blog-post_3212.html' title='终极问题'/><author><name>Leechael</name><uri>http://www.blogger.com/profile/11027831722626043108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_d3tblF0J014/Sxkv1Cb4lQI/AAAAAAAAAYE/HerVNh_Fpp0/S220/portrait.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1379905233792953891.post-2371187991620831346</id><published>2009-12-02T04:53:00.000+08:00</published><updated>2009-12-02T04:53:36.839+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='economics'/><category scheme='http://www.blogger.com/atom/ns#' term='quote'/><title type='text'>Quote @ Dec. 2ed, 2009</title><content type='html'>&lt;blockquote&gt;經濟分析中的邊際生產理論指出，任何生產要素擁有者對生意額作出的貢獻會反映在他的收入上。&lt;br /&gt;&lt;/blockquote&gt;&lt;div style="text-align: right;"&gt;—— Joe Chan, &lt;a href="http://joetchan.blogspot.com/2009/12/blog-post.html"&gt;黃毓民若補選 欠「邊際生產力」&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1379905233792953891-2371187991620831346?l=leechael.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://leechael.blogspot.com/feeds/2371187991620831346/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1379905233792953891&amp;postID=2371187991620831346' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/2371187991620831346'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/2371187991620831346'/><link rel='alternate' type='text/html' href='http://leechael.blogspot.com/2009/12/quote-dec-2ed-2009.html' title='Quote @ Dec. 2ed, 2009'/><author><name>Leechael</name><uri>http://www.blogger.com/profile/11027831722626043108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_d3tblF0J014/Sxkv1Cb4lQI/AAAAAAAAAYE/HerVNh_Fpp0/S220/portrait.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1379905233792953891.post-7526499318466390742</id><published>2009-12-02T00:52:00.000+08:00</published><updated>2009-12-02T00:52:57.067+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>程序员应有的小习惯？</title><content type='html'>一个 ASP.NET/C# 程序员写了&lt;a href="http://itscommonsensestupid.blogspot.com/2009/11/mistakes-i-made-in-my-programming.html"&gt;一篇东西&lt;/a&gt;，总结自己在五年职业生涯中的错误：没有使用适合的 ORM，没有及时学习和应用 Generics，重复制造轮子，过度编写文档，没有自动化打包，过度依赖视觉检查后进行除错，没有进行单元测试。一共七点。&lt;br /&gt;&lt;br /&gt;对于 ORM 的争论似乎从来没有停止过；对于我这个只有四年非专业程序员来说，ORM 带来的性能问题是致命的，特别是对于 PHP 来说。或者这应该分别而论：对于类似 PHP 这般无状态、运行时编译的语言来说，我觉得不宜用 ORM。或者到了 N 台高性能服务器专门运行 PHP 线程、数据库已经分离至独立的服务器（群）中运行、大规模地部署缓存——这个时候 ORM 就不是瓶颈了；但我还是喜欢不来 ORM。或者我的程序员年龄到五岁的时候，我会喜欢上 ORM？&lt;br /&gt;&lt;br /&gt;第二点说到 Generics，简单看了一下说明，指的是 C# 2.0 中的一个无类型数据结构。对于 PHP/Python/JavaScript 来说，三者都是无类型的；因此强类型的数组造成的复杂性我只能通过想象来了解它的复杂性。这里了解不多，该住嘴。&lt;br /&gt;&lt;br /&gt;重复制造轮子，过度编写文档，没有自动化打包，没有进行单元测试，这四点都是常年讨论的问题了。&lt;br /&gt;&lt;br /&gt;至于“过度依赖视觉检查后进行除错”——这里我自觉翻译得不好，原文是“rely on visual inspection and debugging too much”，大概指的就是因为模块之间的依赖性太大，无法分开测试；而整体编译后再通过输出报错到界面来检查错误是很高成本的。这一点恰恰和是否单元测试组成了一个很有趣的问题。&lt;br /&gt;&lt;br /&gt;这文看看就好了；要检查自己写代码中的习惯，就有很多书和很多文章在讨论了；如果没有实践过，其中的选择还是各自的观点吧。&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1379905233792953891-7526499318466390742?l=leechael.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://leechael.blogspot.com/feeds/7526499318466390742/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1379905233792953891&amp;postID=7526499318466390742' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/7526499318466390742'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/7526499318466390742'/><link rel='alternate' type='text/html' href='http://leechael.blogspot.com/2009/12/blog-post_02.html' title='程序员应有的小习惯？'/><author><name>Leechael</name><uri>http://www.blogger.com/profile/11027831722626043108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_d3tblF0J014/Sxkv1Cb4lQI/AAAAAAAAAYE/HerVNh_Fpp0/S220/portrait.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1379905233792953891.post-8993638678209981406</id><published>2009-12-01T23:13:00.001+08:00</published><updated>2009-12-01T23:19:44.256+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='decorator'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>Python 中多个 decorator class 的属性丢失问题</title><content type='html'>&lt;a href="http://stackoverflow.com/"&gt;Stack Overflow&lt;/a&gt; 上有人问到在 Python 中，&lt;a href="http://stackoverflow.com/questions/666216/decorator-classes-in-python"&gt;为一个函数指定多个 decorator class 时出现的属性丢失问题&lt;/a&gt;。其下就有人贴出了答案，在 decorator class 的 __init__ 中进行属性的复制：&lt;br /&gt;&lt;code&gt;&lt;br /&gt;class NullDecl (object):&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;def __init__ (self, func):&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;self.func = func&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;b&gt;&lt;span style="color: blue;"&gt;for n in set(dir(func)) - set(dir(self)):&lt;/span&gt;&lt;/b&gt;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&lt;span style="color: blue;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;b&gt;&lt;span style="color: blue;"&gt;setattr(self, n, getattr(func, n))&lt;/span&gt;&lt;/b&gt;&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;def __call__ (self, * args):&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;return self.func (*args)&lt;/code&gt;&lt;br /&gt;&lt;code&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;def __repr__(self):&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;return self.func&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: monospace;"&gt;上面贴出的这个答案，最后的 __repr__ 是提问者自己补充的，用于 debug。上述属性的复制看起来真像在 JavaScript 中实现继承的法子。 XD&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1379905233792953891-8993638678209981406?l=leechael.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://leechael.blogspot.com/feeds/8993638678209981406/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1379905233792953891&amp;postID=8993638678209981406' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/8993638678209981406'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/8993638678209981406'/><link rel='alternate' type='text/html' href='http://leechael.blogspot.com/2009/12/python-decorator-class.html' title='Python 中多个 decorator class 的属性丢失问题'/><author><name>Leechael</name><uri>http://www.blogger.com/profile/11027831722626043108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_d3tblF0J014/Sxkv1Cb4lQI/AAAAAAAAAYE/HerVNh_Fpp0/S220/portrait.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1379905233792953891.post-5354753252376402678</id><published>2009-12-01T22:47:00.000+08:00</published><updated>2009-12-01T22:47:14.794+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='frontend'/><category scheme='http://www.blogger.com/atom/ns#' term='optimization'/><category scheme='http://www.blogger.com/atom/ns#' term='database'/><title type='text'>新浪博客的优化经验</title><content type='html'>一个多月前的文章，新浪博客的优化经验：&lt;a href="http://blog.sina.com.cn/s/blog_4b0f52990100foq2.html"&gt;新版博客宣讲会【第五讲】：体验双倍提速博客生活&lt;/a&gt;。&lt;br /&gt;&lt;br /&gt;公开说明做了的数据库层优化有三个。第一个是对位运算的应用，利用位运算来优化二选一的属性判断；&amp;nbsp;&lt;a href="http://twitter.com/xmpp"&gt;@xmpp&lt;/a&gt;&amp;nbsp;老师曾在 &lt;a href="http://www.blogger.com/"&gt;&lt;span id="goog_1259676265675"&gt;&lt;/span&gt;Twitter&lt;span id="goog_1259676265676"&gt;&lt;/span&gt;&lt;/a&gt; 上&lt;a href="http://twitter.com/xmpp/status/5788524546"&gt;向他人解释这点优化&lt;/a&gt;，我感觉这个技巧主要是利用了位运算的速度优势，但实际操作可能需要做点实验，例如在 blob/char 之间进行选择，以及索引添加与否的影响。其次是优化 Slave Server，由于查询需要满足大量条件，而不在 Slave Server 镜像大字段来缩减 Slave Server 上数据的体积，也间接优化了查询速度。最后就是把 Slave Server 按照需要进行设置，例如 Slave A 针对应用 M 重新设置索引，Slave B 则是针对应用 N 设置索引，然后把来自 M 的查询固定导向到 A、把来自 N 的查询固定导向到 B，一个分库的小技巧。&lt;br /&gt;&lt;br /&gt;接下来是对前端的优化。由于可以自定义样式和显示效果，每个用户的界面几乎都是独一无二的。这里说后端是 MDB，我不清楚这里说的 MDB 指的是 Microsoft Access。由于页面是 RIA 的设计（Rich Interface Application），静态页面缓存了，但大量动态内容是在静态页面载入后载入的，动态内容的载入速度受到程序和设计上限制。这里的优化，其实也是很常见的优化手段：把 JavaScript 中修改页面样式的代码改为修改元素属性，把动态修改样式改为通过修改元素的属性（通常是 class）完成，而把样式定义输出到一个可缓存的 CSS 文件。实际上这也是 JavaScript 的优化：由于样式修改操作变为属性修改操作，reflow 的次数减低了，对于用户来说又是一个大大的体验优化，Google 的 &lt;a href="http://code.google.com/speed/articles/"&gt;Let's make the web faster 系列文章&lt;/a&gt;中介绍过&lt;a href="http://code.google.com/speed/articles/optimizing-javascript.html"&gt;通过 DOM 减少 reflow 的这个技巧&lt;/a&gt;，不过就是没有说到这样也间接避免了出现以前新浪博客常见的白屏现象。&lt;br /&gt;&lt;br /&gt;不够他们的总结写得不好，看起来就是容易看晕，不知道在说什么。&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1379905233792953891-5354753252376402678?l=leechael.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://leechael.blogspot.com/feeds/5354753252376402678/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1379905233792953891&amp;postID=5354753252376402678' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/5354753252376402678'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/5354753252376402678'/><link rel='alternate' type='text/html' href='http://leechael.blogspot.com/2009/12/blog-post.html' title='新浪博客的优化经验'/><author><name>Leechael</name><uri>http://www.blogger.com/profile/11027831722626043108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_d3tblF0J014/Sxkv1Cb4lQI/AAAAAAAAAYE/HerVNh_Fpp0/S220/portrait.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1379905233792953891.post-7256929015383443144</id><published>2009-12-01T22:01:00.001+08:00</published><updated>2009-12-01T22:02:39.476+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='frontend'/><category scheme='http://www.blogger.com/atom/ns#' term='ie'/><title type='text'>九个常见的 IE Bugs</title><content type='html'>&lt;span style="font-family: inherit;"&gt;&lt;a href="http://net.tutsplus.com/tutorials/html-css-techniques/9-most-common-ie-bugs-and-how-to-fix-them/"&gt;这篇东西&lt;/a&gt;算是对 IE Bugs 的总结和回顾；这些 bugs 大部分都存在于 IE6 当中。&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="font-family: inherit;"&gt;元素居中。这个 bugs 是最为著名的 bug 了，解决办法是，为元素所在的容器（父元素添上 text-align: center。&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family: inherit;"&gt;阶梯式显示列表元素。用 &lt;/span&gt;&lt;a href="http://code.google.com/p/zen-coding/"&gt;&lt;span style="font-family: inherit;"&gt;Zen Coding&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family: inherit;"&gt; 的语法写出现这个的 HTML 代码是：ul&amp;gt;li*n&amp;gt;a，n &amp;gt; 2。两个解决办法：将 li 设为浮动元素，后者改为 display: inline。&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family: inherit;"&gt;浮动元素的双倍边距。增加 display: inline 即可解决。&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family: inherit;"&gt;无法给元素设置数值较小的高度。原因或者是 IE 假定每个元素中都是有文字的，当然这是无责任的推测，推断自解决方案：一个是设定 font-size: 0，另一个是加上 overflow: hidden。&lt;/span&gt;&lt;/li&gt;&lt;li&gt;可翻页容器中，以相对位置定位的子元素显示错位。继续以 Zen Coding 说明 HTML 的关系： div#element&amp;gt;div#anotherelement。#element 限定高度并设置 overflow 为 auto；#anotherelement 是相对定位，但高度值比其父元素 #element 要大。解决办法就是把父元素 #element 也设置为相对定位。&lt;/li&gt;&lt;li&gt;固定定位元素的宽度问题。问题缘由于 padding 的设置；为固定定位元素设置 padding，其设定值也被计算到宽度中去，解决办法是 IE hacks。&lt;/li&gt;&lt;li&gt;为元素设定最小高度和最小宽度。方案一，通过 !important 来达到目的：设定最小值，然后声明为 auto 并添上 !important 的标记，最后设置一个值：&lt;code&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;#element {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;min-height: 150px;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;height: auto !important;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;height: 150px;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/code&gt;&lt;br /&gt;方案二，利用选择符的实现程度做 IE hacks。&lt;/li&gt;&lt;li&gt;固定宽度浮动元素的宽度异常。解决办法是设置 overflow: hidden。&lt;/li&gt;&lt;li&gt;列表元素之间的空白。与上述第二条的 HTML 架构一模一样：ul&amp;gt;li*n&amp;gt;a，n &amp;gt; 2。方案一是为 a 元素设置一个固定宽度，方案二是设置 a 元素为浮动并添上 clear: left，方案三是设置 li 为 display: inline。&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;总结是，IE sucks。大部分问题都是盒子模型的理解问题，解决方案都是那几个突破口。不过，针对 IE 实现的 IE hacks 最好还是用&amp;lt;--[if lt IE 7]&amp;gt;&amp;lt;[endif]--&amp;gt; 来插入额外的样式表，IE hacks 对其他浏览器来说也算是一个异数。&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1379905233792953891-7256929015383443144?l=leechael.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://leechael.blogspot.com/feeds/7256929015383443144/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1379905233792953891&amp;postID=7256929015383443144' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/7256929015383443144'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/7256929015383443144'/><link rel='alternate' type='text/html' href='http://leechael.blogspot.com/2009/12/ie-bugs.html' title='九个常见的 IE Bugs'/><author><name>Leechael</name><uri>http://www.blogger.com/profile/11027831722626043108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_d3tblF0J014/Sxkv1Cb4lQI/AAAAAAAAAYE/HerVNh_Fpp0/S220/portrait.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1379905233792953891.post-8723898063009072028</id><published>2009-11-27T17:54:00.000+08:00</published><updated>2009-11-27T17:54:11.191+08:00</updated><title type='text'>Quote: Embodiment 6</title><content type='html'>&lt;blockquote&gt;情感是认知中不可分割而又必不可少的一部分。我们所做、所想的一切都伴随着情感，大部分情况我们都意识不到这一点。另一方面，情感影响着我们的想法，不断引导我们感受一切（and serve as constant guides to appreciate behavior），引导我们走出困苦，迈向美好。&lt;br /&gt;&lt;br /&gt;然而，我们在谈论产品可用性的时候，是不能把美学和感知从行为中分离出来。更重要的是，行为不仅是我们做什么，更是让我们感知什么——在交往和产品中直接展现情感。&lt;br /&gt;&lt;/blockquote&gt;&lt;div style="text-align: right;"&gt;&lt;a href="http://chien-ta.blogspot.com/2009/11/embodiment-6.html"&gt;Embodiment 6&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;后一段的原文在这里，感觉翻译得还是不太畅顺：However, the products we talk about usability, aesthetics and perception can't be detached from the acting. Most importantly, the action not just we do, but we make how we feel and know - the expression of emotions bearing on human communication and products directly.&lt;br /&gt;&lt;br /&gt;在这一点，苹果领先太多了。&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1379905233792953891-8723898063009072028?l=leechael.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://leechael.blogspot.com/feeds/8723898063009072028/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1379905233792953891&amp;postID=8723898063009072028' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/8723898063009072028'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/8723898063009072028'/><link rel='alternate' type='text/html' href='http://leechael.blogspot.com/2009/11/quote-embodiment-6.html' title='Quote: Embodiment 6'/><author><name>Leechael</name><uri>http://www.blogger.com/profile/11027831722626043108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_d3tblF0J014/Sxkv1Cb4lQI/AAAAAAAAAYE/HerVNh_Fpp0/S220/portrait.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1379905233792953891.post-6834027281727153151</id><published>2009-11-27T06:03:00.004+08:00</published><updated>2009-11-27T06:23:30.422+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ed2k'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><category scheme='http://www.blogger.com/atom/ns#' term='amuled'/><title type='text'>一个 ed2k 的 wrapper</title><content type='html'>不知道有多少人和我一样，专门有一个机器用于下载和储存；装的是 Ubuntu，通过 ssh 登录后使用 ed2k 来下载 &lt;a href="http://www.verycd.com/"&gt;VeryCD.com&lt;/a&gt; 上的资源。不过有一个问题，ed2k 只能一个一个链接地添加，复制-粘贴从来就是一个体力活，而且传递给 ed2k 的参数必须以引号包围，如 ed2k 'ed2k://some_link' 才能完成添加下载任务的工作。&lt;br /&gt;&lt;br /&gt;为此我写了一个脚本，给 ed2k 加一个 wrapper，传递一个无需引号引用、 VeryCD.com 上任意页面的网址，然后就自动把该页面上所有的 ed2k links 添加到 amuled 的下载列表中。这个脚本用的是 Python，其中使用到了 &lt;a href="http://www.crummy.com/software/BeautifulSoup/"&gt;BeautifulSoup&lt;/a&gt; 解析 HTML。后来发现 BeautifulSoup 并不好使，会出现莫名其妙的错误，就改用了 &lt;a href="http://www.boddie.org.uk/python/libxml2dom.html"&gt;libxml2dom&lt;/a&gt;，事实上这个东西比 BeautifulSoup 更好使。&lt;br /&gt;&lt;br /&gt;这个脚本也有一个问题，就是不能选择性地下载页面中的某些文件。为了解决这个问题，这天我给这个脚本修改了一下，也可以接受一个文件名作为参数；而可以通过建立一个临时的文本文件，每一行就是一个 ed2k link，保存后把文件名当作参数传递给这个脚本则可。&lt;br /&gt;&lt;br /&gt;脚本比较简单，45行代码也不多，可以再缩减几行，不过为了可读性，就没有这般干。在使用这个脚本之前，需要确保为你的 python 装上 libxml2dom。&lt;br /&gt;&lt;br /&gt;libxml2dom 的下载地址：&lt;a href="http://www.boddie.org.uk/python/libxml2dom.html"&gt;&lt;span class="st0"&gt;http://www.boddie.org.uk/python/libxml2dom.html&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;脚本保存在 &lt;a href="http://pastein.com/"&gt;pastein.com&lt;/a&gt; 上：&lt;a href="http://pastebin.com/f7e4b1cde"&gt;http://pastebin.com/f7e4b1cde&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1379905233792953891-6834027281727153151?l=leechael.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://leechael.blogspot.com/feeds/6834027281727153151/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1379905233792953891&amp;postID=6834027281727153151' title='1 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/6834027281727153151'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/6834027281727153151'/><link rel='alternate' type='text/html' href='http://leechael.blogspot.com/2009/11/ed2k-wrapper.html' title='一个 ed2k 的 wrapper'/><author><name>Leechael</name><uri>http://www.blogger.com/profile/11027831722626043108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_d3tblF0J014/Sxkv1Cb4lQI/AAAAAAAAAYE/HerVNh_Fpp0/S220/portrait.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1379905233792953891.post-9124439206729156873</id><published>2009-11-27T04:53:00.003+08:00</published><updated>2009-11-27T06:25:25.441+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='xss'/><category scheme='http://www.blogger.com/atom/ns#' term='twitter'/><category scheme='http://www.blogger.com/atom/ns#' term='security'/><category scheme='http://www.blogger.com/atom/ns#' term='html'/><title type='text'>页面脚本中的 HTML Entities 转化问题</title><content type='html'>&lt;a href="http://www.blogger.com/Twitter%20misidentifying%20context" title="Twitter misidentifying context"&gt;这篇东西&lt;/a&gt; 说了 Twitter 上存在的一个 XSS 漏洞，而这个漏洞是由于没能对嵌入页面中的、动态生成的 JavaScript 代码进行有效的 HTML entities 过滤而引起的。对于动态页面中那些用户输入的字符串，仅是把 '"&amp;lt;&amp;gt;\ 转换为 html entities 还是不够的；例如 &amp;lt;a href="some_uri" onclick="custom_function('[user_input]')"&amp;gt;some text&amp;lt;/a&amp;gt; 这般的代码，假设 [user_input] 是 ');alert(1),', 而仅是把 ' 转换为 html entities —— &amp;amp;apos; 是不够的，因为在嵌入页面的 JavaScript 中，转换为 html entities 的字符仍是有效脚本中的一部分，脚本仍然是可以运行的。&lt;br /&gt;&lt;br /&gt;针对这个问题，暂时我想到的解决办法有两种，但都基于同一个原理：经转换后的数据不在生成页面时嵌入 JavaScript 代码中去，而仅是嵌入到一个指定的元素中去；在页面载入后，通过 DOM 读取该元素中的数据，然后再进行其他操作。&lt;br /&gt;&lt;br /&gt;我写的样例代码见这里：&lt;a href="http://pastebin.com/f333cc832"&gt;http://pastebin.com/f333cc832&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1379905233792953891-9124439206729156873?l=leechael.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://leechael.blogspot.com/feeds/9124439206729156873/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1379905233792953891&amp;postID=9124439206729156873' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/9124439206729156873'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/9124439206729156873'/><link rel='alternate' type='text/html' href='http://leechael.blogspot.com/2009/11/html-entities.html' title='页面脚本中的 HTML Entities 转化问题'/><author><name>Leechael</name><uri>http://www.blogger.com/profile/11027831722626043108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_d3tblF0J014/Sxkv1Cb4lQI/AAAAAAAAAYE/HerVNh_Fpp0/S220/portrait.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1379905233792953891.post-3309994797322926830</id><published>2009-11-20T01:10:00.002+08:00</published><updated>2009-11-27T06:25:02.307+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='csrf'/><category scheme='http://www.blogger.com/atom/ns#' term='xss'/><category scheme='http://www.blogger.com/atom/ns#' term='clickjacking'/><category scheme='http://www.blogger.com/atom/ns#' term='security'/><category scheme='http://www.blogger.com/atom/ns#' term='dns_rebinding'/><title type='text'>三个安全相关的小笔记</title><content type='html'>1. DNS Rebinding 的防范有三种方法（来自 &lt;a href="http://en.wikipedia.org/wiki/DNS_rebinding"&gt;wikipedia&lt;/a&gt;）：&lt;br /&gt;- 将 IP 地址固定于首个 DNS 解析请求。&lt;br /&gt;- 在内网 DNS 服务器中，避免将外网地址解析到内网 IP。&lt;br /&gt;- 对来源请求的 Host 字段进行验证。&lt;br /&gt;其中最后一种是程序中要实现的。重新提起 DNS Rebinding 的原因是，&lt;a href="http://ha.ckers.org/"&gt;ha.ckers.org &lt;/a&gt;最近提及了&lt;a href="http://ha.ckers.org/blog/20091116/session-fixation-via-dns-rebinding/"&gt;通过 DNS Rebinding 实现 Session Fixation&lt;/a&gt;。怎么说这一层简单的验证，做了比没有做要好。&lt;br /&gt;&lt;br /&gt;2. &lt;a href="http://sla.ckers.org/"&gt;sla.ckers.org&lt;/a&gt; 上面则是有一篇东西，使用 XSS 去绕过 CSRF 的保护。思路很简单，假设 CSRF 的防护是通过 token 实现，而请求模式是 GET，那么通过 XSS —— iframe 读入页面，然后 JS 找出 token 再伪做链接。防御 CSRF 的最好办法，还是将请求模式从 GET 改为 POST 并且做双重验证，当然需要耗费的资源相对增加了，这里只是说明了，简单加一个 token 只是权宜之计。&lt;br /&gt;&lt;br /&gt;3. Clickjacking Protection。&lt;a href="http://www.owasp.org/index.php/ClickjackFilter_for_Java_EE"&gt;owasp.org 上列出了两个方案&lt;/a&gt;：x-frame-options 响应头和一段用于自动跳出的 iframe 的 JS。前者由 MSIE 引入，有 allow，deny，sameorigin 三种值。这里权作笔记和回忆。  &lt;br /&gt;--&lt;br /&gt;Twitter: &lt;a href="http://www.twitter.com/leechael"&gt;http://www.twitter.com/leechael&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1379905233792953891-3309994797322926830?l=leechael.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://leechael.blogspot.com/feeds/3309994797322926830/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1379905233792953891&amp;postID=3309994797322926830' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/3309994797322926830'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/3309994797322926830'/><link rel='alternate' type='text/html' href='http://leechael.blogspot.com/2009/11/blog-post_20.html' title='三个安全相关的小笔记'/><author><name>Leechael</name><uri>http://www.blogger.com/profile/11027831722626043108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_d3tblF0J014/Sxkv1Cb4lQI/AAAAAAAAAYE/HerVNh_Fpp0/S220/portrait.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1379905233792953891.post-5221530798641460939</id><published>2009-11-14T18:39:00.002+08:00</published><updated>2009-11-27T06:44:09.763+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='life'/><title type='text'>然后怎样？</title><content type='html'>零&lt;br /&gt;&lt;br /&gt;狠心地把 Instapaper 中的好些链接删掉，最后还是剩下好些文章。Gmail 中还存这 68 篇标记为 "ToRead" 的文章，收藏夹中有十数个起 index 作用的链接，另一个 Firefox 窗口中还打开着近 20 个窗口，书柜里应该还有近 60 本经由他人推荐的好书还没有看。然而我已经很克制地不去下载电子书，因为可以找到下载的好书实在太多。&lt;br /&gt;&lt;br /&gt;尽管如此，我还是感觉被无尽的信息掩埋了。&lt;br /&gt;&lt;br /&gt;昨晚重新阅读钱钟书先生的《围城》，8点左右开始看，11点左右睡觉，中间洗澡大概用30分钟，只是看了近一半。也就 200 页左右。我是不是该感概自己的阅读速度又慢了？或者根本没有可比性？当时两天左右看完《鹿鼎记》，现在的我还可以吗？&lt;br /&gt;&lt;br /&gt;我狠狠地退订了一些 Google Reader 中跟踪的博客。我还会继续退订。&lt;br /&gt;&lt;br /&gt;我又一次地说着要改变，CHANGE，什么时候又变成口号了？&lt;br /&gt;&lt;br /&gt;这几年我看过的技术类信息，我怀疑是否都能完全消化。或者我没有消化掉？我总是浮躁地追逐着下一条信息，然后期待能赶上，却没有时时停下来，想想自己是否应该去追逐那东西。&lt;br /&gt;&lt;br /&gt;一&lt;br /&gt;&lt;br /&gt;前一次这般分章节写东西是什么时候了？&lt;br /&gt;&lt;br /&gt;我多久没有写过这么长的东西了？&lt;br /&gt;&lt;br /&gt;过去的时间在记忆中似乎越拉越长，才过去了的时间在记忆中似乎是那么遥不可及。上个星期还在实习，而现今却在电脑前面打字。当时的人或事，似乎就在隔壁，却无法触摸。这让人想起电影《Lake House》。&lt;br /&gt;&lt;br /&gt;实习期间的生活，我出乎意料地适应；这倒是在我意料之外。我以为我只追求我期许的，老师这份职业不会出现在我的选项里面；而事实上，只是我不选择。我并不排斥。你看，方鸿渐那般的人也能成为大学讲师呢，还是副教授。所以，我为什么做不来老师呢？&lt;br /&gt;&lt;br /&gt;只是我不选择而已。&lt;br /&gt;&lt;br /&gt;二&lt;br /&gt;&lt;br /&gt;还是好好想想接下来怎么样好了。&lt;br /&gt;&lt;br /&gt;恰如我实习时的主题班会题目，然后怎样？&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;-- &lt;br /&gt;Twitter: &lt;a href="http://www.twitter.com/leechael" target="_blank"&gt;http://www.twitter.com/leechael&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1379905233792953891-5221530798641460939?l=leechael.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://leechael.blogspot.com/feeds/5221530798641460939/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1379905233792953891&amp;postID=5221530798641460939' title='2 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/5221530798641460939'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/5221530798641460939'/><link rel='alternate' type='text/html' href='http://leechael.blogspot.com/2009/11/blog-post_14.html' title='然后怎样？'/><author><name>Leechael</name><uri>http://www.blogger.com/profile/11027831722626043108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_d3tblF0J014/Sxkv1Cb4lQI/AAAAAAAAAYE/HerVNh_Fpp0/S220/portrait.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1379905233792953891.post-6171044236223577182</id><published>2009-11-12T14:59:00.002+08:00</published><updated>2009-11-27T06:43:57.734+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='quote'/><title type='text'>Quotes: review of What The Dog Saw</title><content type='html'>&lt;blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"&gt;香港曾是一個充滿活力、容許失敗、鼓勵「馬死落地行」的城市，但從什麼時候起，我們的社會開始害怕轉軌、不再包容主流以外的選擇、人們拒絕冒險？這可會是香港失去動力的原因？&lt;br /&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;br /&gt;&lt;a href="http://wongleona.blogspot.com/2009/11/what-dog-saw.html"&gt;这双手虽然小，《What The Dog Saw》&lt;/a&gt; &lt;br /&gt;&lt;/div&gt;&lt;br /&gt;-- &lt;br /&gt;Twitter: &lt;a href="http://www.twitter.com/leechael"&gt;http://www.twitter.com/leechael&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1379905233792953891-6171044236223577182?l=leechael.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://leechael.blogspot.com/feeds/6171044236223577182/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1379905233792953891&amp;postID=6171044236223577182' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/6171044236223577182'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/6171044236223577182'/><link rel='alternate' type='text/html' href='http://leechael.blogspot.com/2009/11/quotes-review-of-what-dog-saw.html' title='Quotes: review of What The Dog Saw'/><author><name>Leechael</name><uri>http://www.blogger.com/profile/11027831722626043108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_d3tblF0J014/Sxkv1Cb4lQI/AAAAAAAAAYE/HerVNh_Fpp0/S220/portrait.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1379905233792953891.post-5351603802594891632</id><published>2009-11-12T14:52:00.003+08:00</published><updated>2009-11-27T06:43:50.759+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='quote'/><title type='text'>Quotes: 钱学森的最后一次系统谈话 谈科技创新人才的培养</title><content type='html'>&lt;blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"&gt;&lt;span id="fontzoom"&gt;有人说："卡门教授，你把这么好的思想都讲出来了，就不怕别人超过你？"卡门说："我不怕，等他赶上我这个想法，我又跑到前面老远去了。"&lt;/span&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;br /&gt;&lt;blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"&gt;&lt;span id="fontzoom"&gt;不随大流，敢于想别人不敢想的，做别人不敢做的。&lt;/span&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;br /&gt;&lt;blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"&gt;&lt;span id="fontzoom"&gt;不同的学派、不同的学术观点都可以充分发表。&lt;/span&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;br /&gt;为什么能出现传新呢？对异见的包容是很重要的一点。而这一天，在《全球通史》中的文字也向我们描述这个道理。民主的另一个要素是，对异见有足够的包容。这点是我自认为需要好好去学习和处理的。包容之余，还包括辩论，但不包括打压和人身攻击。&lt;br /&gt;&lt;br /&gt;&lt;blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"&gt;&lt;span id="fontzoom"&gt;科学上的创新光靠严密的逻辑思维不行，创新的思想往往开始于形象思维，从大跨度的联想中得到启迪，然后再用严密的逻辑加以验证。&lt;/span&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;br /&gt;不予以对钱学森的评价；我认为我并不了解他。但我对这&lt;a href="http://www.chinanews.com.cn/gn/news/2009/11-05/1947844.shtml" title="钱学森的最后一次系统谈话 谈科技创新人才的培养"&gt;讲话&lt;/a&gt;肃然起敬。&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;--&lt;br /&gt;Twitter: &lt;a href="http://www.twitter.com/leechael"&gt;http://www.twitter.com/leechael&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1379905233792953891-5351603802594891632?l=leechael.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://leechael.blogspot.com/feeds/5351603802594891632/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1379905233792953891&amp;postID=5351603802594891632' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/5351603802594891632'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/5351603802594891632'/><link rel='alternate' type='text/html' href='http://leechael.blogspot.com/2009/11/quotes.html' title='Quotes: 钱学森的最后一次系统谈话 谈科技创新人才的培养'/><author><name>Leechael</name><uri>http://www.blogger.com/profile/11027831722626043108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_d3tblF0J014/Sxkv1Cb4lQI/AAAAAAAAAYE/HerVNh_Fpp0/S220/portrait.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1379905233792953891.post-8514428402132300105</id><published>2009-11-12T14:33:00.001+08:00</published><updated>2009-11-27T06:38:57.832+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='twitter'/><title type='text'>对于 Twitter 的数点思考</title><content type='html'>看完《&lt;a href="http://apple4.us/2009/10/who-is-in-charge-of-twitter.html"&gt;谁在经营 Twitter？&lt;/a&gt;》，一些或许有些意思的想法。&lt;br /&gt;&lt;br /&gt;1. Motions 可以算是一个嗅探用户需求然后迅速作出反应的一个经典案例，hash tag 或许也是，retweets 似乎有不尽人意。Twitter 在这里只是再次证明，产品的开发需要根据用户需要进行调整，而且越快越好。&lt;br /&gt;&lt;br /&gt;2. 文中提及 Twitter 团队的建设理念：精兵，保持激昂的士气。以"熵"的概念来解释，团队人数增多只会增加混乱，管理的复杂维度也随之增大。这里让人想起了《孙子兵法》。&lt;br /&gt;&lt;br /&gt;3. 简洁主义的另一层意义：简单，并且有让用户发挥想象力进行扩展的空间。&lt;br /&gt;&lt;br /&gt;4. 作者与跟随者（Follower）之间的不平衡关系，是现实社会关系中在 Twitter 中的一种影响：在现实中，你把 A 当作好朋友，而 A 可能只当你的泛泛之交。&lt;br /&gt;&lt;br /&gt;5. 开放 API。这里有一个隐含的小前提——简洁主义。如果有让用户发挥想象力的空间，开放 API 的效果可能是指数级的。&lt;br /&gt;&lt;br /&gt;-- &lt;br /&gt;Twitter: &lt;a href="http://www.twitter.com/leechael"&gt;http://www.twitter.com/leechael&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1379905233792953891-8514428402132300105?l=leechael.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://leechael.blogspot.com/feeds/8514428402132300105/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1379905233792953891&amp;postID=8514428402132300105' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/8514428402132300105'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/8514428402132300105'/><link rel='alternate' type='text/html' href='http://leechael.blogspot.com/2009/11/twitter.html' title='对于 Twitter 的数点思考'/><author><name>Leechael</name><uri>http://www.blogger.com/profile/11027831722626043108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_d3tblF0J014/Sxkv1Cb4lQI/AAAAAAAAAYE/HerVNh_Fpp0/S220/portrait.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1379905233792953891.post-5150677551847096170</id><published>2009-06-17T01:59:00.002+08:00</published><updated>2009-11-27T06:43:42.808+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='life'/><title type='text'>Whisper</title><content type='html'>借着手机龟速的网络，温吞吞地看着 LinuxMag 上那篇介绍 Drizzle 的文章，听到数声耳语。&lt;br /&gt;这肯定是一名女子。那声音似是在说着悄悄话。犹如伴侣伏在耳边，轻述密语，或是绵绵情话。&lt;br /&gt;我听不清说什么；旁边也没有人；或者只是幻听。耳边老是听着音乐，片刻的清静，或者这般就听到点什么了。&lt;br /&gt;而这似乎以前也曾听过。那声音熟悉得很，温柔得要融掉一切。或者这是我的守护灵在跟我说话？她只是寥寥数句，我还在迷恋那声音，而这一切业已终结。&lt;br /&gt;Good night Daisy.&lt;br /&gt;Good night Benjamin.&lt;br /&gt;-- &lt;br /&gt;从我的移动设备发送&lt;br /&gt;Twitter: &lt;a href="http://www.twitter.com/leechael"&gt;http://www.twitter.com/leechael&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1379905233792953891-5150677551847096170?l=leechael.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://leechael.blogspot.com/feeds/5150677551847096170/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1379905233792953891&amp;postID=5150677551847096170' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/5150677551847096170'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/5150677551847096170'/><link rel='alternate' type='text/html' href='http://leechael.blogspot.com/2009/06/whisper.html' title='Whisper'/><author><name>Leechael</name><uri>http://www.blogger.com/profile/11027831722626043108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_d3tblF0J014/Sxkv1Cb4lQI/AAAAAAAAAYE/HerVNh_Fpp0/S220/portrait.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1379905233792953891.post-7947361571190692954</id><published>2009-06-08T23:46:00.002+08:00</published><updated>2009-11-27T06:43:33.321+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='life'/><title type='text'>Gone</title><content type='html'>Yeats 很帅。&lt;br /&gt;如何将箭猪或者刺猬描述得很煽情。&lt;br /&gt;或者那些更有趣的话题？&lt;br /&gt;无酒也可。ZY 走后，似乎没有人能说这些了。&lt;br /&gt;大学再大，也大不过整个世界。&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1379905233792953891-7947361571190692954?l=leechael.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://leechael.blogspot.com/feeds/7947361571190692954/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1379905233792953891&amp;postID=7947361571190692954' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/7947361571190692954'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/7947361571190692954'/><link rel='alternate' type='text/html' href='http://leechael.blogspot.com/2009/06/blog-post.html' title='Gone'/><author><name>Leechael</name><uri>http://www.blogger.com/profile/11027831722626043108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_d3tblF0J014/Sxkv1Cb4lQI/AAAAAAAAAYE/HerVNh_Fpp0/S220/portrait.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1379905233792953891.post-3182322062038150020</id><published>2009-05-29T02:10:00.002+08:00</published><updated>2009-11-27T06:43:16.175+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='life'/><title type='text'>I'll see</title><content type='html'>当我写字的时候，或许是寂寞了。&lt;br /&gt;晚上翻《生活经济学》，没看几页，总觉得无差异曲线有点不妥，却说不出来，也想不到不妥在什么地方。希望不是我数学差的原因。说来，我想过好几次恶补数学，都没有执行，实在无语。&lt;br /&gt;寂寞的一般会开着 IM，然后很闷骚地等待某些人来骚扰；如果这个描述不恰当，或者是我观察的数据不对。我的样本出错了。然而闪动的头像不是你所期待的，而期待的头像却说着望你帮忙云云，徒添烦躁。实在不懂得走出那一步，去率先问好，胡扯点什么。那会百无聊赖地找着话题的人，或许早已失去新鲜感，千篇一律的答复，没有什么话题……接下来，是时候收好人卡了。&lt;br /&gt;每次和曾经暗暗喜欢的人说话，总心有感概，仿似走入薄暮。每次都想自己没有做到什么，为什么不适合。而这一切似乎都没有答案。黄秋生说，"當你餓了，就會咬實牙根接受磨練。"。可能是我不足够的饥饿吧。&lt;br /&gt;又想起 You'll See 的歌词：&lt;br /&gt;我看着站在远方的你 / 依然如此美好如往昔 / But you know / 有些话就是不能明说&lt;br /&gt;我看着站在眼前的你 / 依然如此没有如往昔 / But you know / 有些话就是不能明说&lt;br /&gt;多年时光 / 都温柔经过 / 那么多人 / 来了又走 / 但也许我们只能远望不相逢&lt;br /&gt;一个人渐渐成熟 / 就会笑着泪流 / 总有些遗憾要学会放开 / 活到这把年纪也该明白&lt;br /&gt;But I say you'll see, I'd make you see, every detail of this damning life&lt;br /&gt;I say you'll see, I'd make you see, you'll see&lt;br /&gt;在这匆忙的世界里 / 失去什么受不受伤都一样 / But you know / 只有你是如此绝对不同&lt;br /&gt;不奢求哪天 / 我不要人懂 / 总在心底偷藏起着小美梦 / 这样的温柔已经足够&lt;br /&gt;一个人渐渐成熟 / 就会笑着泪流 / 总有些遗憾要学会放开 / 活到这把年纪也该明白&lt;br /&gt;But I say you'll see, I'd make you see, every detail of this damning life&lt;br /&gt;I say you'll see, I'd make you see, you'll see&lt;br /&gt;我不断听你说 / 说着他的美好 / 说着你们的梦 / 这一切真的很重要 / 请你相信我 / 我真的什么都不要&lt;br /&gt;到底怎样才能算是爱 / 请不要靠得太近 / 我背后柔软的伤痛 / 不想让人触摸 / 但在你转身瞬间 / 泪在心底成了河流&lt;br /&gt;不过，怎么说，我还是喜欢张悬来唱这歌，味道都出来了。&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1379905233792953891-3182322062038150020?l=leechael.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://leechael.blogspot.com/feeds/3182322062038150020/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1379905233792953891&amp;postID=3182322062038150020' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/3182322062038150020'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/3182322062038150020'/><link rel='alternate' type='text/html' href='http://leechael.blogspot.com/2009/05/ill-see.html' title='I&apos;ll see'/><author><name>Leechael</name><uri>http://www.blogger.com/profile/11027831722626043108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_d3tblF0J014/Sxkv1Cb4lQI/AAAAAAAAAYE/HerVNh_Fpp0/S220/portrait.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1379905233792953891.post-3506207397998921724</id><published>2009-05-26T01:58:00.002+08:00</published><updated>2009-11-27T06:42:43.073+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='life'/><title type='text'>雨夜</title><content type='html'>睡不着。&lt;br /&gt;好吧，我承认我想正经地找个女朋友；像一个正常的大学生那样。&lt;br /&gt;我懒洋洋地靠在沙发上，她枕着我的大腿，我说 Yeats 的这段不错，她放下手上卡尔维诺，或者毛姆，或者哪个很有才气的人写的书，眼睛瞄向我那书，也说一字妙，或者就此没头没脑地说几句 Yeats，然后继续看各自手中的书。&lt;br /&gt;或者我们都卷缩着腿，坐在沙发上，看着电影，面前有我喜欢的龙井混沏香片，也有她喜欢的饮料，或许更奢侈地有些小点；看着电影，兴许是"拉贝日记"，有一句没一句地说着历史，说着自己的观点和看法。然后又突然重温张国荣的"恋战冲绳"。&lt;br /&gt;或者都太文艺了。可以是各自在电脑前面忙着，她弄着什么，我也兴奋地敲着代码，然后在午饭时说着事后归因和元认知。&lt;br /&gt;这些想象或者太过了，所以现在继续没谱儿地过着日子，深夜里精神饱满，喜欢着不喜欢我的人，在滂滂大雨的夜里，听着张悬，写着如此秀逗的文字。&lt;br /&gt;-- &lt;br /&gt;从我的移动设备发送&lt;br /&gt;Tech-Oriented Blog: &lt;a href="http://leechael.org/"&gt;http://leechael.org/&lt;/a&gt;&lt;br /&gt;Twitter: &lt;a href="http://www.twitter.com/leechael"&gt;http://www.twitter.com/leechael&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1379905233792953891-3506207397998921724?l=leechael.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://leechael.blogspot.com/feeds/3506207397998921724/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1379905233792953891&amp;postID=3506207397998921724' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/3506207397998921724'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/3506207397998921724'/><link rel='alternate' type='text/html' href='http://leechael.blogspot.com/2009/05/blog-post.html' title='雨夜'/><author><name>Leechael</name><uri>http://www.blogger.com/profile/11027831722626043108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_d3tblF0J014/Sxkv1Cb4lQI/AAAAAAAAAYE/HerVNh_Fpp0/S220/portrait.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1379905233792953891.post-9073947457984926030</id><published>2009-05-20T22:27:00.002+08:00</published><updated>2009-11-27T06:42:25.590+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='life'/><title type='text'>@May, 20th. 2009</title><content type='html'>没有了网络，一切都会不一样。&lt;br /&gt;&lt;br /&gt;这晚又突然想到近三年来的境况，而我并不陷入无限的回忆，那预期要做的而做到的，那计划要做的而未做到的，那没有想到发生的事情发生，那避免要出现的情况出现了。&lt;br /&gt;&lt;br /&gt;神给予你的，你可以选择要或是不要；神不给予你的，你没有选择。&lt;br /&gt;&lt;br /&gt;我有想过找寻信仰。我没有隶属任何组织，所以没有组织剥削我信仰的权力。&lt;br /&gt;&lt;br /&gt;不管你是否认为存在马太效应，我认为这一点形容在时间上，也不为过分。那句话或者用英文读起来更为有力：For to all those who have, more will be given, and they will have an abundance; but from those who have nothing, even what they have will be taken away.&lt;br /&gt;&lt;br /&gt;如果清晰地知道现在自己在干什么，然后知道现在该不该继续这样，再进而根据判断决定接下来要做的，再执行。这样我认为就靠谱了。&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1379905233792953891-9073947457984926030?l=leechael.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://leechael.blogspot.com/feeds/9073947457984926030/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1379905233792953891&amp;postID=9073947457984926030' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/9073947457984926030'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/9073947457984926030'/><link rel='alternate' type='text/html' href='http://leechael.blogspot.com/2009/05/may-20th-2009.html' title='@May, 20th. 2009'/><author><name>Leechael</name><uri>http://www.blogger.com/profile/11027831722626043108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_d3tblF0J014/Sxkv1Cb4lQI/AAAAAAAAAYE/HerVNh_Fpp0/S220/portrait.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1379905233792953891.post-1257483531641212047</id><published>2009-04-28T20:49:00.002+08:00</published><updated>2009-11-27T06:42:15.066+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='life'/><title type='text'>写在五月之前</title><content type='html'>写点什么肯定是要取悦自己。若我这假设成立，那般我得天天写点什么，才能让自己保持愉悦了。&lt;br /&gt;&lt;br /&gt;我没去每天写点什么，在我看来，写点什么是需要再三考量的，否则，怎去愉悦自己？&lt;br /&gt;&lt;br /&gt;我是不注重仪态的。数天前踢球，汗湿透了上衣，感觉不舒服，很自然便脱了上衣。然后给同学拍了一张照片，还一边颠球，一边抽烟。罢了，反正就没有什么形象。&lt;br /&gt;&lt;br /&gt;在后阳台洗头，望向校道，多了些光秃秃的树丫，看着觉得挺好看的。今晚的月亮很像一片龙井茶叶。我本想说是像毛尖，想想已经忘记毛尖是怎么的一个样子，罢了。&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1379905233792953891-1257483531641212047?l=leechael.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://leechael.blogspot.com/feeds/1257483531641212047/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1379905233792953891&amp;postID=1257483531641212047' title='1 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/1257483531641212047'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/1257483531641212047'/><link rel='alternate' type='text/html' href='http://leechael.blogspot.com/2009/04/blog-post.html' title='写在五月之前'/><author><name>Leechael</name><uri>http://www.blogger.com/profile/11027831722626043108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_d3tblF0J014/Sxkv1Cb4lQI/AAAAAAAAAYE/HerVNh_Fpp0/S220/portrait.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1379905233792953891.post-47841176866505102</id><published>2009-03-22T04:36:00.001+08:00</published><updated>2009-03-22T04:36:32.383+08:00</updated><title type='text'>大国</title><content type='html'>小国自有&lt;a href="http://m.metroer.com/San_Marino/"&gt;小国的好处&lt;/a&gt;；所谓中庸，也不过如此。地方小了，欲望或许随之缩小，更或有趣之事层出。&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;如监狱，若成了禁锢人的地方，貌似便失去了意义。巴士底，毁掉前一直作为法国上层人士反思之地，却以被作为耻辱的标志。圣马力诺的监狱能听到峭壁之下、友人狂欢，怕是狱中之人自会百感交集，终会改过也不为奇。&lt;/div&gt;&lt;div&gt;&lt;br&gt; &lt;/div&gt;&lt;div&gt;偏隅小国，实比大国之梦更让人向往。&lt;/div&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1379905233792953891-47841176866505102?l=leechael.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://leechael.blogspot.com/feeds/47841176866505102/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1379905233792953891&amp;postID=47841176866505102' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/47841176866505102'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/47841176866505102'/><link rel='alternate' type='text/html' href='http://leechael.blogspot.com/2009/03/blog-post_22.html' title='大国'/><author><name>Leechael</name><uri>http://www.blogger.com/profile/11027831722626043108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_d3tblF0J014/Sxkv1Cb4lQI/AAAAAAAAAYE/HerVNh_Fpp0/S220/portrait.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1379905233792953891.post-8197009777506111110</id><published>2009-03-14T21:22:00.003+08:00</published><updated>2009-11-27T06:41:42.168+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='life'/><title type='text'>混沏龙井红茶</title><content type='html'>今以龙井红茶各半，混合沏之，惊呼佳品。入口先得红茶之香涩，后续龙井之清苦。荐予同好之人，一尝无妨。&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1379905233792953891-8197009777506111110?l=leechael.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://leechael.blogspot.com/feeds/8197009777506111110/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1379905233792953891&amp;postID=8197009777506111110' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/8197009777506111110'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/8197009777506111110'/><link rel='alternate' type='text/html' href='http://leechael.blogspot.com/2009/03/blog-post.html' title='混沏龙井红茶'/><author><name>Leechael</name><uri>http://www.blogger.com/profile/11027831722626043108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_d3tblF0J014/Sxkv1Cb4lQI/AAAAAAAAAYE/HerVNh_Fpp0/S220/portrait.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1379905233792953891.post-5844761103236280440</id><published>2009-02-17T13:00:00.002+08:00</published><updated>2009-11-27T06:41:33.470+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='quote'/><title type='text'>茶</title><content type='html'>&lt;blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;"&gt;父执有名玉贵者，旗人，精于饮馔，居恒以一半香片龙井混合沏之，有香片之浓馥，兼龙井之苦清。吾家效而行之，无不称善。花以人名，乃径呼此茶为"玉贵"，私家秘传，外人无由得知。&lt;br /&gt;&lt;/blockquote&gt;&lt;blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;"&gt;—— 《喝茶》，梁实秋&lt;br /&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;span style="border-collapse: collapse;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="border-collapse: collapse;"&gt;午间自斟自饮，却只是普洱。记得龙井市有的，独没有香片。这秘方只能待日后一试了。&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1379905233792953891-5844761103236280440?l=leechael.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://leechael.blogspot.com/feeds/5844761103236280440/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1379905233792953891&amp;postID=5844761103236280440' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/5844761103236280440'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/5844761103236280440'/><link rel='alternate' type='text/html' href='http://leechael.blogspot.com/2009/02/blog-post_17.html' title='茶'/><author><name>Leechael</name><uri>http://www.blogger.com/profile/11027831722626043108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_d3tblF0J014/Sxkv1Cb4lQI/AAAAAAAAAYE/HerVNh_Fpp0/S220/portrait.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1379905233792953891.post-1601595542458467701</id><published>2009-02-15T03:26:00.004+08:00</published><updated>2009-11-27T06:41:24.202+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='life'/><title type='text'>一元四个</title><content type='html'>&lt;img src="http://lh5.ggpht.com/_d3tblF0J014/SZmGPbfSRbI/AAAAAAAAASY/YsIB6kdJYak/17c476bc906c9575774695c1c9cdcae9-1796.jpg" /&gt;&lt;br /&gt;现在还是觉得有趣。&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1379905233792953891-1601595542458467701?l=leechael.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://leechael.blogspot.com/feeds/1601595542458467701/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1379905233792953891&amp;postID=1601595542458467701' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/1601595542458467701'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/1601595542458467701'/><link rel='alternate' type='text/html' href='http://leechael.blogspot.com/2009/02/blog-post_15.html' title='一元四个'/><author><name>Leechael</name><uri>http://www.blogger.com/profile/11027831722626043108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_d3tblF0J014/Sxkv1Cb4lQI/AAAAAAAAAYE/HerVNh_Fpp0/S220/portrait.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/_d3tblF0J014/SZmGPbfSRbI/AAAAAAAAASY/YsIB6kdJYak/s72-c/17c476bc906c9575774695c1c9cdcae9-1796.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1379905233792953891.post-822730065638435715</id><published>2009-02-13T08:16:00.004+08:00</published><updated>2009-11-27T06:41:09.273+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='quote'/><title type='text'>排队</title><content type='html'>&lt;blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;"&gt;抗战胜利后我回到北平，家人告诉我许多敌伪横行霸道的事迹，其中之一是在前门火车站票房前面常有一名日本警察手持竹鞭来回巡视，遇到不排队就抢先买票的人，就一声不响高高举起竹鞭飕的一声着着实实的抽在他的背上。&lt;br /&gt;&lt;/blockquote&gt;&lt;blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;"&gt;—— 梁实秋，《排队》&lt;br /&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;那次堂姐结婚，正待回家，在车站买票，刚掏出钱包，旁边就窜上一个中年妇女，直接无视而说，"一张到xx的车票"。这里你可以看得出我脑子多么的不好使，记得这事儿却不记得这是到哪里的车票！一般来说，也不好和女性发脾气，这劲儿使不出来；若是悦目的妙龄少女，这或者是一个搭讪的好机会，可惜这只是一会正待回乡的中年村妇。我并不是对文化不高的人怀有偏见，另一次我就老老实实地让一个男人插队，那该是假期刚过的时间，散闲的学生不应和要工作的人抢时间。&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;话说起来，或许这是金融海啸的原因，车站没有多余的经费，雇一名警察手持竹鞭，给不排队的人抽上一记。&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1379905233792953891-822730065638435715?l=leechael.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://leechael.blogspot.com/feeds/822730065638435715/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1379905233792953891&amp;postID=822730065638435715' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/822730065638435715'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/822730065638435715'/><link rel='alternate' type='text/html' href='http://leechael.blogspot.com/2009/02/blog-post_1376.html' title='排队'/><author><name>Leechael</name><uri>http://www.blogger.com/profile/11027831722626043108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_d3tblF0J014/Sxkv1Cb4lQI/AAAAAAAAAYE/HerVNh_Fpp0/S220/portrait.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1379905233792953891.post-5451038619437916371</id><published>2009-02-13T07:57:00.003+08:00</published><updated>2009-11-27T06:40:56.395+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='quote'/><title type='text'>一边捣弄黑莓，一边看《他的国》</title><content type='html'>在太阳出来之前，我就看完了。当然不是书封面的那个太阳，那个太阳才开始看，就已经给翻页压过去了。&lt;br /&gt;&lt;div&gt;&lt;br /&gt;书中的世界很疯狂，很显然是这个世界的镜像，而且这是哈哈镜。看书的时候有摘句回味的小嗜好，可这书我就记下了两句，整本书都很有意思，若是断断续续地读这书，会很痛苦，一口气看完是品味这个故事的最佳方式，所以韩寒也没有划分章节——假若实际上有划分章节，那肯定是我的迷糊，得去睡觉了；一个通宵看完这书，还得捣弄黑莓，真是折腾的活儿。&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;"&gt;后来他装了卫星电视，但是卫星电视让他心情不爽，因为他发现，明明是相同的事情，为什么从卫星电视得知的和从国内电视台得知的有所区别。他不知道相信哪个好，最后，他把卫星大锅拆了，他认为应该相信自己人。&lt;br /&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;上面这话是第一段我觉得有意思的。假若改一些字眼，诸如"卫星电视"改为"代理软件"；这修改并不有趣，或者有些东西，只是出口转内销，到外面转了一圈，最后你发现小纸牌上印的厂址竟是自家隔壁，那间小而吵、在生产劣质产品的小山寨。能发现那个小纸牌就行，用洋文写的"made in China"就是告诉我们，这只是出去逛一圈而已。&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;"&gt;你不应该留在这里，你应该去一个更广阔的世界，你看见的世界有多大，你的心就有多大。&lt;br /&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;黄莹说，这不仅是对"你"左小龙说的；这是对所有男人说的。&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1379905233792953891-5451038619437916371?l=leechael.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://leechael.blogspot.com/feeds/5451038619437916371/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1379905233792953891&amp;postID=5451038619437916371' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/5451038619437916371'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/5451038619437916371'/><link rel='alternate' type='text/html' href='http://leechael.blogspot.com/2009/02/blog-post_13.html' title='一边捣弄黑莓，一边看《他的国》'/><author><name>Leechael</name><uri>http://www.blogger.com/profile/11027831722626043108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_d3tblF0J014/Sxkv1Cb4lQI/AAAAAAAAAYE/HerVNh_Fpp0/S220/portrait.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1379905233792953891.post-6892405374218265556</id><published>2009-02-10T22:08:00.003+08:00</published><updated>2009-11-27T06:40:41.986+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='quote'/><title type='text'>What a wonderful world?</title><content type='html'>&lt;blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;"&gt;我以为科学和艺术的正途不仅不是去关怀弱势群体，而且应当去冒犯强势群体，使最强的人都感受了冒犯，那才叫做成就。&lt;br /&gt;&lt;/blockquote&gt;&lt;blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;"&gt;—— 《艺术与关怀弱势群体》，王小波&lt;br /&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;看到这句话的时候，恰行正放着"What a wonderful world"，陈奕迅在 Eason's Moving On Stage 1 重新演绎的版本。如果某些技术网志能做到冒犯强势群体，或者它的内容会更精彩。可惜，正如 fcicq 所说，"都水了"。&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;或者自己的技术网志能够以此为铭。&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1379905233792953891-6892405374218265556?l=leechael.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://leechael.blogspot.com/feeds/6892405374218265556/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1379905233792953891&amp;postID=6892405374218265556' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/6892405374218265556'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/6892405374218265556'/><link rel='alternate' type='text/html' href='http://leechael.blogspot.com/2009/02/what-wonderful-world.html' title='What a wonderful world?'/><author><name>Leechael</name><uri>http://www.blogger.com/profile/11027831722626043108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_d3tblF0J014/Sxkv1Cb4lQI/AAAAAAAAAYE/HerVNh_Fpp0/S220/portrait.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1379905233792953891.post-8118945331252710901</id><published>2009-02-10T02:47:00.003+08:00</published><updated>2009-11-27T06:40:26.511+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='quote'/><category scheme='http://www.blogger.com/atom/ns#' term='life'/><title type='text'>王小波没有看见</title><content type='html'>&lt;blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;"&gt;听说做特技要用工作站，这种机器不是我能买得起的，软件也难侍候，总得有一帮专家聚在一起，黑天白日地干，做出的东西才能看。有朝一日技术进步了，用一台&amp;nbsp;PC&amp;nbsp;机就能做电影，软件一个人也能侍候过来，那才好呢。&lt;br /&gt;&lt;/blockquote&gt;&lt;blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;"&gt;——《电脑特技与异化》，王小波&lt;br /&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;王小波已经不在了。今夜看到他这话，特有感触：那终是部分实现了。正如土豆的那句 slogan: 每个人都是生活的导演。&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1379905233792953891-8118945331252710901?l=leechael.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://leechael.blogspot.com/feeds/8118945331252710901/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1379905233792953891&amp;postID=8118945331252710901' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/8118945331252710901'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/8118945331252710901'/><link rel='alternate' type='text/html' href='http://leechael.blogspot.com/2009/02/blog-post_10.html' title='王小波没有看见'/><author><name>Leechael</name><uri>http://www.blogger.com/profile/11027831722626043108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_d3tblF0J014/Sxkv1Cb4lQI/AAAAAAAAAYE/HerVNh_Fpp0/S220/portrait.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1379905233792953891.post-5088756077403889938</id><published>2009-02-10T02:37:00.003+08:00</published><updated>2009-11-27T06:40:13.659+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='life'/><title type='text'>小记，低俗小笑话</title><content type='html'>&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;三天两夜，住在水玲珑会馆。收费中等，131 块一天，虽然睡在大厅，但睡的椅子很舒服；有免费饮品和水果，宵夜免费，午餐和晚餐都是 18 块的自助餐；全天候的桑拿、SPA。这也是第一次去这样的地方，比起七天连锁旅店的价格，这收费这服务实在让我觉得挺实惠。&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;以下是低俗小笑话一则。那时我正在湿蒸室，连带我旁边的男人，就两个人赤裸裸地坐着里面；他朝我那里看了看，捧了捧自己的肚子，似有感触地说，"年轻还是好的……肚子出来了，把那话儿也遮住了。"&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1379905233792953891-5088756077403889938?l=leechael.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://leechael.blogspot.com/feeds/5088756077403889938/comments/default' title='帖子评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1379905233792953891&amp;postID=5088756077403889938' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/5088756077403889938'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1379905233792953891/posts/default/5088756077403889938'/><link rel='alternate' type='text/html' href='http://leechael.blogspot.com/2009/02/blog-post.html' title='小记，低俗小笑话'/><author><name>Leechael</name><uri>http://www.blogger.com/profile/11027831722626043108</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://4.bp.blogspot.com/_d3tblF0J014/Sxkv1Cb4lQI/AAAAAAAAAYE/HerVNh_Fpp0/S220/portrait.jpg'/></author><thr:total>0</thr:total></entry></feed>
