<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>小小子</title>
	<atom:link href="http://www.xiaoxiaozi.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.xiaoxiaozi.com</link>
	<description>Say you say me ,say we together~~</description>
	<lastBuildDate>Mon, 09 Jan 2012 06:49:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>漫漫回家路</title>
		<link>http://www.xiaoxiaozi.com/2012/01/09/2247/</link>
		<comments>http://www.xiaoxiaozi.com/2012/01/09/2247/#comments</comments>
		<pubDate>Mon, 09 Jan 2012 06:49:05 +0000</pubDate>
		<dc:creator>simaopig</dc:creator>
				<category><![CDATA[Myself]]></category>
		<category><![CDATA[闲聊]]></category>

		<guid isPermaLink="false">http://www.xiaoxiaozi.com/?p=2247</guid>
		<description><![CDATA[又是一年春来到，同时“运”也来了。

买车票，以前拼体力，当前讲智力，最终靠的还是运气。

在同学的大力支持下，买到了回家的车票，掰着手指头数日子：还有多少工作要年前完成，还有多少剩饭剩菜要年前打扫。

一年又一年，随着年龄的增长，记忆似乎变的越来越怪。几天前的事情已经忘的差不多了，只能靠当时的聊天记录或者笔记来回忆。而几年前一些无关痛痒的小事却是时常回荡在脑海，总是不经意间跳出来，让你回想一下，或哭、或笑！

今年的北京偶尔就会飘一场雪，为麻木的头脑带来一丝清凉。但，仍然喜欢幻想老家那闪亮的夜空，北京没有星星。

不经意间，自己即将28，到了高中时许诺结婚的年龄，那时候我说晚上要放烟花，为我的老婆。

也同样的不经意间，老爸已经50，每天坐在电脑前玩着“炮幺”，精力还算旺盛。

同样的不经意间，3年前，姥娘去了天国，那里没有旱烟。

回家，去看看家人，去陪陪家人。他们真的爱我，我也很想念你们！]]></description>
			<content:encoded><![CDATA[<p>又是一年春来到，同时“运”也来了。</p>
<p>买车票，以前拼体力，当前讲智力，最终靠的还是运气。</p>
<p>在同学的大力支持下，买到了回家的车票，掰着手指头数日子：还有多少工作要年前完成，还有多少剩饭剩菜要年前打扫。</p>
<p>一年又一年，随着年龄的增长，记忆似乎变的越来越怪。几天前的事情已经忘的差不多了，只能靠当时的聊天记录或者笔记来回忆。而几年前一些无关痛痒的小事却是时常回荡在脑海，总是不经意间跳出来，让你回想一下，或哭、或笑！</p>
<p>今年的北京偶尔就会飘一场雪，为麻木的头脑带来一丝清凉。但，仍然喜欢幻想老家那闪亮的夜空，北京没有星星。</p>
<p>不经意间，自己即将28，到了高中时许诺结婚的年龄，那时候我说晚上要放烟花，为我的老婆。</p>
<p>也同样的不经意间，老爸已经50，每天坐在电脑前玩着“炮幺”，精力还算旺盛。</p>
<p>同样的不经意间，3年前，姥娘去了天国，那里没有旱烟。</p>
<p>回家，去看看家人，去陪陪家人。他们真的爱我，我也很想念你们！</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xiaoxiaozi.com/2012/01/09/2247/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>JSONP与POST方式请求</title>
		<link>http://www.xiaoxiaozi.com/2011/11/25/2239/</link>
		<comments>http://www.xiaoxiaozi.com/2011/11/25/2239/#comments</comments>
		<pubDate>Fri, 25 Nov 2011 11:18:06 +0000</pubDate>
		<dc:creator>simaopig</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jsonp]]></category>
		<category><![CDATA[post]]></category>

		<guid isPermaLink="false">http://www.xiaoxiaozi.com/?p=2239</guid>
		<description><![CDATA[JSONP是一种非官方协议，可以解决AJAX跨域提交数据情况。

安全部门的同事测试发现，都是GET的请求，相比较而言不如POST安全，还是尽量改了吧。

拖啊拖，终于还有别的业务要这个接口，想了想还是改了吧，反正听人劝吃饱饭嘛 。但是，JSONP真的支持POST提交吗？

<!--more-->

先是一天夜里加班无聊，做了一下POST，发现请求发送过去的METHOD为OPTIONS，而不是POST，同时没有得到返回结果。

今天下午抽时间，特意处理一下这个事情。事实证明OPTIONS的状态可能是我拼错东西了，反正今天没有重现。不过当我把数据改为POST后，我发现COOKIE已经生成了，证明我数据提交过去了。但是content里没有返回值，Firebug看不到，但是Fiddler可以看到。

<img src="http://www.xiaoxiaozi.com/wp-content/uploads/2011/11/jsonp_post.jpg" alt="jsonp post 截图" title="jsonp_post" width="606" height="164" class="alignnone size-full wp-image-2241" />

POST提交，firebug之所以看不到的原因是，我的执行跨域了。我执行的域名为localhost，而提交请求的域名为公司域名。

一计不成，又生一计。咋的活人还能让尿憋死？

jQuery里面有N多jsonp的方法，挨个试呗：getScript   getJson   ajax（ 指定dataType为jsonp或script）

发现jQuery的getScript不支持POST，但是其等同于$.ajax(datatype:script)啊，咱再指定type为Post不就成了嘛 。不过改完后，发现还是变成了GET请求，很奇怪，翻看API如下：

<blockquote cite="http://api.jquery.com/jQuery.ajax/">
"script": Evaluates the response as JavaScript and returns it as plain text. Disables caching by appending a query string parameter, "_=[TIMESTAMP]", to the URL unless the cache option is set to true. <strong style="color:red;">Note: This will turn POSTs into GETs for remote-domain requests. </strong>
</blockquote>

看来，你即使设置为POST，jQuery发现是getScript时，也会自动给你转成GET。测试 datatype为jsonp时 POST请求同样会被转化成GET。

难道是JSONP不支持POST方式发起请求吗？

一个外国友人，和咱遇到同样的问题：<a href="http://stackoverflow.com/questions/3860111/how-to-make-a-jsonp-post-request-that-specifies-contenttype-with-jquery" target="_blank">http://stackoverflow.com/questions/3860111/how-to-make-a-jsonp-post-request-that-specifies-contenttype-with-jquery</a>

得到的回答是这样的：

<img alt="" src="http://farm7.staticflickr.com/6039/6399159629_19270a76cd_b.jpg" title="jsonp_answer" width="744" height="389" />

找到这篇文章，<a href="http://www.nowamagic.net/librarys/veda/detail/224" target="_blank">《JSONP跨域的原理解析》</a> 从文中可以看出，其实使用特殊的方法也是可以支持POST的，不过太过繁琐。作者举的例子为：动态创建iframe方式POST跨域。

最后，我想说的是，要想支持POST方式的JSONP很难，咱就别难为自己了，这个接口不改了 - -!!]]></description>
			<content:encoded><![CDATA[<p>JSONP是一种非官方协议，可以解决AJAX跨域提交数据情况。</p>
<p>安全部门的同事测试发现，都是GET的请求，相比较而言不如POST安全，还是尽量改了吧。</p>
<p>拖啊拖，终于还有别的业务要这个接口，想了想还是改了吧，反正听人劝吃饱饭嘛 。但是，JSONP真的支持POST提交吗？</p>
<p><span id="more-2239"></span></p>
<p>先是一天夜里加班无聊，做了一下POST，发现请求发送过去的METHOD为OPTIONS，而不是POST，同时没有得到返回结果。</p>
<p>今天下午抽时间，特意处理一下这个事情。事实证明OPTIONS的状态可能是我拼错东西了，反正今天没有重现。不过当我把数据改为POST后，我发现COOKIE已经生成了，证明我数据提交过去了。但是content里没有返回值，Firebug看不到，但是Fiddler可以看到。</p>
<p><img src="http://www.xiaoxiaozi.com/wp-content/uploads/2011/11/jsonp_post.jpg" alt="jsonp post 截图" title="jsonp_post" width="606" height="164" class="alignnone size-full wp-image-2241" /></p>
<p>POST提交，firebug之所以看不到的原因是，我的执行跨域了。我执行的域名为localhost，而提交请求的域名为公司域名。</p>
<p>一计不成，又生一计。咋的活人还能让尿憋死？</p>
<p>jQuery里面有N多jsonp的方法，挨个试呗：getScript   getJson   ajax（ 指定dataType为jsonp或script）</p>
<p>发现jQuery的getScript不支持POST，但是其等同于$.ajax(datatype:script)啊，咱再指定type为Post不就成了嘛 。不过改完后，发现还是变成了GET请求，很奇怪，翻看API如下：</p>
<blockquote cite="http://api.jquery.com/jQuery.ajax/"><p>
“script”: Evaluates the response as JavaScript and returns it as plain text. Disables caching by appending a query string parameter, “_=[TIMESTAMP]“, to the URL unless the cache option is set to true. <strong style="color:red;">Note: This will turn POSTs into GETs for remote-domain requests. </strong>
</p></blockquote>
<p>看来，你即使设置为POST，jQuery发现是getScript时，也会自动给你转成GET。测试 datatype为jsonp时 POST请求同样会被转化成GET。</p>
<p>难道是JSONP不支持POST方式发起请求吗？</p>
<p>一个外国友人，和咱遇到同样的问题：<a href="http://stackoverflow.com/questions/3860111/how-to-make-a-jsonp-post-request-that-specifies-contenttype-with-jquery" target="_blank">http://stackoverflow.com/questions/3860111/how-to-make-a-jsonp-post-request-that-specifies-contenttype-with-jquery</a></p>
<p>得到的回答是这样的：</p>
<p><img alt="" src="http://farm7.staticflickr.com/6039/6399159629_19270a76cd_b.jpg" title="jsonp_answer" width="744" height="389" /></p>
<p>找到这篇文章，<a href="http://www.nowamagic.net/librarys/veda/detail/224" target="_blank">《JSONP跨域的原理解析》</a> 从文中可以看出，其实使用特殊的方法也是可以支持POST的，不过太过繁琐。作者举的例子为：动态创建iframe方式POST跨域。</p>
<p>最后，我想说的是，要想支持POST方式的JSONP很难，咱就别难为自己了，这个接口不改了 &#8211; -!!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xiaoxiaozi.com/2011/11/25/2239/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>HTML5 每天记录一点 （二）</title>
		<link>http://www.xiaoxiaozi.com/2011/09/14/2233/</link>
		<comments>http://www.xiaoxiaozi.com/2011/09/14/2233/#comments</comments>
		<pubDate>Wed, 14 Sep 2011 15:50:00 +0000</pubDate>
		<dc:creator>simaopig</dc:creator>
				<category><![CDATA[Html]]></category>
		<category><![CDATA[html5]]></category>

		<guid isPermaLink="false">http://www.xiaoxiaozi.com/?p=2233</guid>
		<description><![CDATA[拿blog举例，一般都有侧边栏。在侧边栏，我们可以记录一些友情链接、标签云等等。这些一般都和左侧文章中的正文(article）相关，html5中单独有一个标签：aside，其定义的是正文之外的内容。

[cc lang='html']
<article>
今天啊，爷爷主要给你讲一下粮票的故事：
</article>

<aside>
你想买粮票吗？XXX收藏专家为您服务！
</aside>
[/cc]

<strong>有些文章上面说，aside主要是对应于article的，所以有aside就应该有article标签。但是像<a href='http://www.w3schools.com/html5/tag_aside.asp' target='_blank'>w3schools</a>上面的示例也没有article标签，具体，大家自行分析！</strong>

过去，我们的一个html页面基本结构代码如下：

[cc lang='html']
<div class='header'>
      <div class='nav'>
      </div>
</div>

<div class='content'>
     <div class='left'>
     </div>
     <div class='right'>
     </div>
</div>

<div class=‘footer'>
    <div class='copyright'>
    </div>
</div>
[/cc]

结构冗余，为了描述页头和页尾，我们一般使用div标签，然后通过指定className来设置样式。在html5中，我们可以使用更富有语义的header标签和footer标签，以及nav标签来完成我们的架构，代码如下：

[cc lang='html']
<header>
     <nav></nav>
</header>
<article>
     <section></section>
     <div></div>
</article>
<footer>
</footer>
[/cc]

在过去，我们一个图片下面加描述，其实一般情况下都是加一个新的标签，来写这个图片的意义。但是实际上，在搜索引擎也好，在html的结构中也好，根本无法标识出你写的描述与图片有什么关联。

现在，html5中为我们增加了figure标签，这个标签可以将其他标签与图片（传说中还有代码等）标签合为一个组标签。在里面的文字内容会是对图片的描述：

[cc lang='html']
<figure>
  <p>这张图是360的Logo</p>
  <img src="http://img1.qihoo.com/images/2011/360/logo.png" />
</figure>

<figure>
  <img src="http://img1.qihoo.com/images/2011/360/logo.png" />
  <p>这张图是360的Logo</p>
</figure>
[/cc]

好了，今天到这，赶明咱继续！]]></description>
			<content:encoded><![CDATA[<p>拿blog举例，一般都有侧边栏。在侧边栏，我们可以记录一些友情链接、标签云等等。这些一般都和左侧文章中的正文(article）相关，html5中单独有一个标签：aside，其定义的是正文之外的内容。</p>
<div class="codecolorer-container html4strict dawn" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:500px;"><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&lt;article&gt;</span><br />
今天啊，爷爷主要给你讲一下粮票的故事：<br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>article&gt;</span><br />
<br />
<span style="color: #009900;">&lt;aside&gt;</span><br />
你想买粮票吗？XXX收藏专家为您服务！<br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>aside&gt;</span></div></div>
<p><strong>有些文章上面说，aside主要是对应于article的，所以有aside就应该有article标签。但是像<a href='http://www.w3schools.com/html5/tag_aside.asp' target='_blank'>w3schools</a>上面的示例也没有article标签，具体，大家自行分析！</strong></p>
<p>过去，我们的一个html页面基本结构代码如下：</p>
<div class="codecolorer-container html4strict dawn" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:500px;"><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'header'</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'nav'</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span><br />
<br />
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'content'</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'left'</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp;<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'right'</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp;<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span><br />
<br />
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span>‘footer<span style="color: #ff0000;">'&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'copyright'</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></div></div>
<p>结构冗余，为了描述页头和页尾，我们一般使用div标签，然后通过指定className来设置样式。在html5中，我们可以使用更富有语义的header标签和footer标签，以及nav标签来完成我们的架构，代码如下：</p>
<div class="codecolorer-container html4strict dawn" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:500px;"><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&lt;header&gt;</span><br />
&nbsp; &nbsp; &nbsp;<span style="color: #009900;">&lt;nav&gt;&lt;<span style="color: #66cc66;">/</span>nav&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>header&gt;</span><br />
<span style="color: #009900;">&lt;article&gt;</span><br />
&nbsp; &nbsp; &nbsp;<span style="color: #009900;">&lt;section&gt;&lt;<span style="color: #66cc66;">/</span>section&gt;</span><br />
&nbsp; &nbsp; &nbsp;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>article&gt;</span><br />
<span style="color: #009900;">&lt;footer&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>footer&gt;</span></div></div>
<p>在过去，我们一个图片下面加描述，其实一般情况下都是加一个新的标签，来写这个图片的意义。但是实际上，在搜索引擎也好，在html的结构中也好，根本无法标识出你写的描述与图片有什么关联。</p>
<p>现在，html5中为我们增加了figure标签，这个标签可以将其他标签与图片（传说中还有代码等）标签合为一个组标签。在里面的文字内容会是对图片的描述：</p>
<div class="codecolorer-container html4strict dawn" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:500px;"><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&lt;figure&gt;</span><br />
&nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>这张图是360的Logo<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span><br />
&nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://img1.qihoo.com/images/2011/360/logo.png&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>figure&gt;</span><br />
<br />
<span style="color: #009900;">&lt;figure&gt;</span><br />
&nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://img1.qihoo.com/images/2011/360/logo.png&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span><br />
&nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>这张图是360的Logo<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>figure&gt;</span></div></div>
<p>好了，今天到这，赶明咱继续！</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xiaoxiaozi.com/2011/09/14/2233/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>HTML5 每天记录一点 （一）</title>
		<link>http://www.xiaoxiaozi.com/2011/09/06/2229/</link>
		<comments>http://www.xiaoxiaozi.com/2011/09/06/2229/#comments</comments>
		<pubDate>Tue, 06 Sep 2011 15:50:00 +0000</pubDate>
		<dc:creator>simaopig</dc:creator>
				<category><![CDATA[Html]]></category>
		<category><![CDATA[html5]]></category>

		<guid isPermaLink="false">http://www.xiaoxiaozi.com/?p=2229</guid>
		<description><![CDATA[HTML5， 首先记住的一条就是，Doctype声明短了。

[cc lang='html']
<!-- 原来的声明 -->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<!--HTML5的声明 -->

<!DOCTYPE html>
[/cc]

再来看一下meta的字符集声明，一个字：美！

[cc lang='html']
<!-- 原来的声明 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<!-- HTML5的声明 -->
<meta charset="UTF-8">
[/cc]

HTML5在标签语义化上做了很多处理，原来由于TABLE布局的简单，大家开始使用。但是没有语义，且CSS的发展，大家布局普遍使用div＋css的模式。

可是div也没有啥意义啊，所以，HTML5推出了两个新标签：section和article

从字面意义上来理解，section为段落，而article为文章。凡是可以单拿出来做为文章的，都可以使用article，我是这么理解的，不是很对，但是先这么记着吧。

[cc lang='html']
     <article>
          <section id="mixing">
              <h2>秋天到了</h2>
              <p>说话这天还真是凉了，大家记得多穿衣！</p>
          </section>
          <section id="baking">
              <h2>夏天走了</h2>
              <p>夏天晚上7：00还透亮，现在乌漆马黑的</p>                                                                                   
          </section>
      </article>
[/cc]

今天先白话这么多，明天继续！]]></description>
			<content:encoded><![CDATA[<p>HTML5， 首先记住的一条就是，Doctype声明短了。</p>
<div class="codecolorer-container html4strict dawn" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:500px;"><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #808080; font-style: italic;">&lt;!-- 原来的声明 --&gt;</span><br />
<br />
<span style="color: #00bbdd;">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;</span><br />
<span style="color: #00bbdd;">&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;</span><br />
<br />
<span style="color: #808080; font-style: italic;">&lt;!--HTML5的声明 --&gt;</span><br />
<br />
<span style="color: #00bbdd;">&lt;!DOCTYPE html&gt;</span></div></div>
<p>再来看一下meta的字符集声明，一个字：美！</p>
<div class="codecolorer-container html4strict dawn" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:500px;"><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #808080; font-style: italic;">&lt;!-- 原来的声明 --&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">meta</span> <span style="color: #000066;">http-equiv</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Content-Type&quot;</span> <span style="color: #000066;">content</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/html; charset=UTF-8&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span><br />
<br />
<span style="color: #808080; font-style: italic;">&lt;!-- HTML5的声明 --&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">meta</span> <span style="color: #000066;">charset</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;UTF-8&quot;</span>&gt;</span></div></div>
<p>HTML5在标签语义化上做了很多处理，原来由于TABLE布局的简单，大家开始使用。但是没有语义，且CSS的发展，大家布局普遍使用div＋css的模式。</p>
<p>可是div也没有啥意义啊，所以，HTML5推出了两个新标签：section和article</p>
<p>从字面意义上来理解，section为段落，而article为文章。凡是可以单拿出来做为文章的，都可以使用article，我是这么理解的，不是很对，但是先这么记着吧。</p>
<div class="codecolorer-container html4strict dawn" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:500px;"><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; &nbsp;<span style="color: #009900;">&lt;article&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;section <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;mixing&quot;</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h2</span>&gt;</span>秋天到了<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h2</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>说话这天还真是凉了，大家记得多穿衣！<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>section&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;section <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;baking&quot;</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h2</span>&gt;</span>夏天走了<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h2</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>夏天晚上7：00还透亮，现在乌漆马黑的<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>section&gt;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>article&gt;</span></div></div>
<p>今天先白话这么多，明天继续！</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xiaoxiaozi.com/2011/09/06/2229/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>闲扯</title>
		<link>http://www.xiaoxiaozi.com/2011/09/06/2227/</link>
		<comments>http://www.xiaoxiaozi.com/2011/09/06/2227/#comments</comments>
		<pubDate>Tue, 06 Sep 2011 15:38:43 +0000</pubDate>
		<dc:creator>simaopig</dc:creator>
				<category><![CDATA[Myself]]></category>
		<category><![CDATA[无题]]></category>

		<guid isPermaLink="false">http://www.xiaoxiaozi.com/?p=2227</guid>
		<description><![CDATA[先说些题外话，好久没写blog了。

每天早上都会想的就是：真想早点下班，回家学学啥分布式，学学啥系统运维，学学啥HTML5的。

每天晚上到家都会想的是：TNND这可咋学呢？真TMD累，又打了一天酱油，参加各种会，准备各种酱油。睡觉，不学习了。

第二天，重复今天的事情。

和同事聊天，说了上面的事，过的和行尸走肉一般。一年到头，除了中秋别人给了点月饼这些福利，别的为自己啥也没看见。同事说，这其实就是年龄大了，已经学不进去了。

想想也是，马上而立了，每天脑子里装的都是一些无用的事，比如今天羡慕哪个白痴中了5.4亿巨奖了，明天祈祷那个白痴忘记去领奖了之类的。

貌似这个状态有些日子了，再不治理可不行了。

继续吧，想想两年前，每天一篇blog的日子，真是不错。]]></description>
			<content:encoded><![CDATA[<p>先说些题外话，好久没写blog了。</p>
<p>每天早上都会想的就是：真想早点下班，回家学学啥分布式，学学啥系统运维，学学啥HTML5的。</p>
<p>每天晚上到家都会想的是：TNND这可咋学呢？真TMD累，又打了一天酱油，参加各种会，准备各种酱油。睡觉，不学习了。</p>
<p>第二天，重复今天的事情。</p>
<p>和同事聊天，说了上面的事，过的和行尸走肉一般。一年到头，除了中秋别人给了点月饼这些福利，别的为自己啥也没看见。同事说，这其实就是年龄大了，已经学不进去了。</p>
<p>想想也是，马上而立了，每天脑子里装的都是一些无用的事，比如今天羡慕哪个白痴中了5.4亿巨奖了，明天祈祷那个白痴忘记去领奖了之类的。</p>
<p>貌似这个状态有些日子了，再不治理可不行了。</p>
<p>继续吧，想想两年前，每天一篇blog的日子，真是不错。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xiaoxiaozi.com/2011/09/06/2227/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>这该死的感冒</title>
		<link>http://www.xiaoxiaozi.com/2011/07/28/2218/</link>
		<comments>http://www.xiaoxiaozi.com/2011/07/28/2218/#comments</comments>
		<pubDate>Thu, 28 Jul 2011 08:49:14 +0000</pubDate>
		<dc:creator>simaopig</dc:creator>
				<category><![CDATA[Myself]]></category>
		<category><![CDATA[感冒]]></category>

		<guid isPermaLink="false">http://www.xiaoxiaozi.com/?p=2218</guid>
		<description><![CDATA[感冒真痛苦，周五就预感嗓子不舒服，果断在周一请假。

结果，我预料的很准。周六——周一，这几天就没有消停，嗓子基本说不出话来，然后还高烧。喝了丫头做的可乐姜丝，有点辣，有点甜。

周二上班，一开机，发现攒了60封未读邮件，真想跳起来骂，你们这帮SXXX。。

从二楼搬到了一楼，空调在头顶，相当的给力。结果团队的一位小女生也开始咳嗽，真不是我传染的。

拿了件外套来公司，要不真顶不住 。买了瓶止咳糖浆，还挺甜，喝了后效果也不错。咳的少了。

披着外套，来来往往的人都难免多看一眼，不过看也白看，爱咋咋地，真冷啊。。把挡板调了也不顶用，正在头顶的东西你伤不起啊。

想起小丁了，那个三年前因为冻的感冒，所以离职的孩子。

我很好！]]></description>
			<content:encoded><![CDATA[<p>感冒真痛苦，周五就预感嗓子不舒服，果断在周一请假。</p>
<p>结果，我预料的很准。周六——周一，这几天就没有消停，嗓子基本说不出话来，然后还高烧。喝了丫头做的可乐姜丝，有点辣，有点甜。</p>
<p>周二上班，一开机，发现攒了60封未读邮件，真想跳起来骂，你们这帮SXXX。。</p>
<p>从二楼搬到了一楼，空调在头顶，相当的给力。结果团队的一位小女生也开始咳嗽，真不是我传染的。</p>
<p>拿了件外套来公司，要不真顶不住 。买了瓶止咳糖浆，还挺甜，喝了后效果也不错。咳的少了。</p>
<p>披着外套，来来往往的人都难免多看一眼，不过看也白看，爱咋咋地，真冷啊。。把挡板调了也不顶用，正在头顶的东西你伤不起啊。</p>
<p>想起小丁了，那个三年前因为冻的感冒，所以离职的孩子。</p>
<p>我很好！</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xiaoxiaozi.com/2011/07/28/2218/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Sina OAuth request_token 如何存储？</title>
		<link>http://www.xiaoxiaozi.com/2011/06/18/2215/</link>
		<comments>http://www.xiaoxiaozi.com/2011/06/18/2215/#comments</comments>
		<pubDate>Sat, 18 Jun 2011 03:08:56 +0000</pubDate>
		<dc:creator>simaopig</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[oauth]]></category>
		<category><![CDATA[sina]]></category>

		<guid isPermaLink="false">http://www.xiaoxiaozi.com/?p=2215</guid>
		<description><![CDATA[闲来无事，研究新浪的OAuth接口，来允许新浪用户登录，其过程呢是比较繁琐的。虽然有一些SDK可以下载，但是都不尽如人意。

资源如下：

<ol class="list">
<li><a href='http://open.weibo.com/wiki/index.php/Oauth' target='_blank'>新浪的OAuth API地址</a></li>

<li><a href="http://www.cnblogs.com/liuxinet/archive/2011/01/25/1944752.html" target="_blank">新浪微博开放平台OAuth授权解决方案（含代码</a>） </li>
</ol>

纠结的问题在于此：

<ol>
<li>新浪使用的是OAuth 1.0 ，在用户授权验证前，需要先生成request_token</li>

<li>request_token 应该如何存储？</li>

<li>SDK中的建议是存储在SESSION中，但是如果我有多台前端机，DNS解析又是不靠谱的，那么我的多台机器如何同步SESSION？</li>

<li>SESSION存储在数据库中可以避免此问题，可是问题是我的业务不需要用到数据库，为了存储临时性的一次SESSION而用库，太不划算。</li>

<li>存储到COOKIE中，多台前端机的问题就不用关心了，不过是否会有不安全因素呢？</li>

<li>COOKIE中是否可以存储一个字符串，该串为MEMCACHE的KEY，由MEM来存储这个一次性的request_token 是否可行？</li>

<li>别人拿到COOKIE，COOKIE可以加一些验证，比如签名之类的东西，并不是随便改造就可以破坏我的程序的。</li>
</ol>

分析过程大致如上，具体如何实现还在纠结！]]></description>
			<content:encoded><![CDATA[<p>闲来无事，研究新浪的OAuth接口，来允许新浪用户登录，其过程呢是比较繁琐的。虽然有一些SDK可以下载，但是都不尽如人意。</p>
<p>资源如下：</p>
<ol class="list">
<li><a href='http://open.weibo.com/wiki/index.php/Oauth' target='_blank'>新浪的OAuth API地址</a></li>
<li><a href="http://www.cnblogs.com/liuxinet/archive/2011/01/25/1944752.html" target="_blank">新浪微博开放平台OAuth授权解决方案（含代码</a>） </li>
</ol>
<p>纠结的问题在于此：</p>
<ol>
<li>新浪使用的是OAuth 1.0 ，在用户授权验证前，需要先生成request_token</li>
<li>request_token 应该如何存储？</li>
<li>SDK中的建议是存储在SESSION中，但是如果我有多台前端机，DNS解析又是不靠谱的，那么我的多台机器如何同步SESSION？</li>
<li>SESSION存储在数据库中可以避免此问题，可是问题是我的业务不需要用到数据库，为了存储临时性的一次SESSION而用库，太不划算。</li>
<li>存储到COOKIE中，多台前端机的问题就不用关心了，不过是否会有不安全因素呢？</li>
<li>COOKIE中是否可以存储一个字符串，该串为MEMCACHE的KEY，由MEM来存储这个一次性的request_token 是否可行？</li>
<li>别人拿到COOKIE，COOKIE可以加一些验证，比如签名之类的东西，并不是随便改造就可以破坏我的程序的。</li>
</ol>
<p>分析过程大致如上，具体如何实现还在纠结！</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xiaoxiaozi.com/2011/06/18/2215/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>吞吐率——我们需要了解什么</title>
		<link>http://www.xiaoxiaozi.com/2011/06/09/2206/</link>
		<comments>http://www.xiaoxiaozi.com/2011/06/09/2206/#comments</comments>
		<pubDate>Thu, 09 Jun 2011 15:38:40 +0000</pubDate>
		<dc:creator>simaopig</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[压力测试]]></category>
		<category><![CDATA[吞吐率]]></category>

		<guid isPermaLink="false">http://www.xiaoxiaozi.com/?p=2206</guid>
		<description><![CDATA[<blockquote>
我们一般使用单位时间内服务器处理的请求数来描述WEB服务器的并发处理能力——吞吐率（Throughput)，单位是 reqs/s 
</blockquote>

我们一般使用压力测试，来统计WEB服务器的吞吐率。其包括如下条件：

<ol class='list'>
<li>同一时间，到底有多少人奇迹般的一起向服务器发送请求——并发用户数</li>
<li>上面那些用户，一共向你的服务器发送了多少请求？——总请求数</li>
<li>这些人，疯了般的管你要啥东西呢？——请求资源描述</li>
</ol>
<!--more-->

<h3>让机器更好的干活，让老板更省钱</h3>

我们怎么才能让机器更好的干活？我们需要多少机器才能更好的满足我们的要求？

<ol>
<li>一台机器，完成所有的请求——省钱了，我们是穷人，我们只有一台机器。用户会在漫长的等待后，冷笑着走开。然后老板也会告诉你“滚蛋”</li>

<li>一百台机器，完成所有的请求——用户很开心，老板很疯狂。“奶奶个熊滴，听人说十台机器就够了，你用了一百台，另九十台你想架魔兽私服啊？”。于是，你也走人了。</li>
</ol>

综上，我们需要知道何时才能让最合适数量的资源，来完成我们的需求。

这里面，我们需要掌握两个情况，我们的机器最多能同时满足多少用户；以及我们一共有多少用户！

<h3>时间就是生命</h3>

时间就是生命，当我们渐渐老去时，我们应该把握住生命中的第一分钟，或者冲动，或者寻找冲动。

有些跑题了，我想说的是“时间就是生命”！

在压力测试的过程中，我们需要关心的时间指标有两种：

<blockquote>
<ol class='list'>
<li>用户平均请求等待时间——主要用于衡量服务器在一定并发用户数的情况下，对于单个用户的服务质量。</li>
<li>服务器平均请求处理时间——用于衡量服务器的整体服务质量</li>
</ol>
</blockquote>

<h3>ab 压力测试</h3>

关于压力测试，<a href="http://www.xiaoxiaozi.com/2010/04/16/1745/" target="_blank">之前使用过siege——《第一次使用siege 第一次压力测试》</a>

今天再简单介绍一下ab：ab是Apache自带的压力测试工具。我们先来看一下版本：

[cc lang='bash']
simaopig@simaopig-desktop:/usr/local/apache2/bin$ ./ab -V
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
[/cc]

其简单使用过程如下：

[cc lang='text']
simaopig@simaopig-desktop:/usr/local/apache2/bin$ ./ab -n1000 -c10 http://localhost/test.html
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests


Server Software:        Apache/2.2.15
Server Hostname:        localhost
Server Port:            80

Document Path:          /test.html
Document Length:        77 bytes

Concurrency Level:      10
Time taken for tests:   0.079 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      337000 bytes
HTML transferred:       77000 bytes
Requests per second:    12675.07 [#/sec] (mean)
Time per request:       0.789 [ms] (mean)
Time per request:       0.079 [ms] (mean, across all concurrent requests)
Transfer rate:          4171.39 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.1      0       2
Processing:     0    1   0.3      1       3
Waiting:        0    1   0.3      1       3
Total:          0    1   0.3      1       3

Percentage of the requests served within a certain time (ms)
  50%      1
  66%      1
  75%      1
  80%      1
  90%      1
  95%      1
  98%      2
  99%      2
 100%      3 (longest request)
[/cc]

ab的使用和返回的结果解释如下：

<table border="1" cellpadding="0" cellspacing="0" width="590">
<thead>
<tr>
        <th>使用选项</th>
        <th>意义</th>
</tr>
</thead>
<tbody>
<tr>
       <td>-n1000</td>
       <td>表示总请求数为1000</td>
</tr>
<tr>
       <td>-c10</td>
       <td>表示并发用户数为10，即同时有10个用户发起请求</td>
</tr>
<tr>
       <td>http://localhost/test.html</td>
       <td>表示请求的目标URL</td>
</tr>
<tr>
       <td>-t10</td>
       <td>请求的超时响应时间，单位为秒</td>
</tr>
</tbody>
</table>

<br/>

<table border="1" cellpadding="0" cellspacing="0" width="590">
<thead>
      <tr>
          <th>返回字段</th>
          <th>字段意义</th>
      </tr>
</thead>
<tbody>
      <tr>
          <td>Server Software</td>
          <td>测试的服务器的Web 服务器软件名，这里是Apache/2.2.15</td>
      </tr>
      <tr>
           <td>Server Hostname</td>
           <td>请求的URLK 主机部分名称， 这里值为localhost</td>
      </tr>
      <tr>
           <td>Server Port</td>
           <td>被测试的Web 服务器的端口号</td>
      </tr>
      <tr>
           <td>Document Path</td>
           <td>请求的URL中的根绝对路径</td>
      </tr>
      <tr>
           <td>Document Length</td>
           <td>表示HTTP响应数据的正文长度</td>
      </tr>
      <tr>
           <td>Concurrency Level</td>
           <td>表示并发用户数，这是我们压力测试时，传递过去的值 -c </td>
      </tr>
      <tr>
           <td>Time taken for tests</td>
           <td>表示所有这些请求被处理完成所花费的总时间</td>
      </tr>
      <tr>
           <td>Complete requests</td>
           <td>表示总请求数，我们压力测试时传递过去的参数 -n</td>
      </tr>
      <tr>
           <td>Failed requests</td>
           <td>表示失败的请求数，这里的失败是指请求在连接服务器／发送数据／接收数据等环节发生异常，以及无响应后点击鼠标中时的情况。超时时间可以使用-t设置</td>
      </tr>
      <tr>
           <td>Total transferred</td>
           <td>表示所有请求的响应数据长度总和，包含每个HTTP响应数据的头信息和正文数据的长度</td>
      </tr>
      <tr>
           <td>HTML transferred</td>
           <td>表示所有请求的响应数据中正文数据的总和，也就是减去Total transferred中HTTP响应数据中头信息的长度</td>
      </tr>
      <tr>
          <td>Requests per second</td>
          <td>这就是我们说滴吞吐率啊，等于 Complete requests / Time taken for tests <font color='red'>每秒钟，处理多少请求</font></td>
      </tr>
      <tr>
           <td>Time per request</td>
           <td>这便是我们说的，用户平均请求等待时间，等于 Time taken for tests / (Complete requests / Concurrency Level)</td>
      </tr>
      <tr>
           <td>Time per request(across all concurrent requests)</td>
           <td>这便是前面说的服务器平均请求处理时间，等于 Time taken for tests / Complete requests
                  正是吞详细地址的倒数，为：Time per request / Concurrency Level <font color='red'>每个请求花费了多少秒</font></td>
      </tr>
      <tr>
           <td>Transfer rate</td>
           <td>表示这些请求在单位时间内，从服务器获取的数据长度，等于：Total transferred / Time taken for tests
      </tr>
      <tr>
           <td>Percentage of the requests served within a certain time (ms)</td>
           <td>这部分数据用于描述每个请求处理时间的分页情况，比如在以上测试结果中，99％都不超过1毫秒，100％都不超过3毫秒。这个时间为处理时间，是指前面的Time per request，即对于单个用户而言，平均每个请求处理的时间</td>
      </tr>
</tbody>
</table>]]></description>
			<content:encoded><![CDATA[<blockquote><p>
我们一般使用单位时间内服务器处理的请求数来描述WEB服务器的并发处理能力——吞吐率（Throughput)，单位是 reqs/s
</p></blockquote>
<p>我们一般使用压力测试，来统计WEB服务器的吞吐率。其包括如下条件：</p>
<ol class='list'>
<li>同一时间，到底有多少人奇迹般的一起向服务器发送请求——并发用户数</li>
<li>上面那些用户，一共向你的服务器发送了多少请求？——总请求数</li>
<li>这些人，疯了般的管你要啥东西呢？——请求资源描述</li>
</ol>
<p><span id="more-2206"></span></p>
<h3>让机器更好的干活，让老板更省钱</h3>
<p>我们怎么才能让机器更好的干活？我们需要多少机器才能更好的满足我们的要求？</p>
<ol>
<li>一台机器，完成所有的请求——省钱了，我们是穷人，我们只有一台机器。用户会在漫长的等待后，冷笑着走开。然后老板也会告诉你“滚蛋”</li>
<li>一百台机器，完成所有的请求——用户很开心，老板很疯狂。“奶奶个熊滴，听人说十台机器就够了，你用了一百台，另九十台你想架魔兽私服啊？”。于是，你也走人了。</li>
</ol>
<p>综上，我们需要知道何时才能让最合适数量的资源，来完成我们的需求。</p>
<p>这里面，我们需要掌握两个情况，我们的机器最多能同时满足多少用户；以及我们一共有多少用户！</p>
<h3>时间就是生命</h3>
<p>时间就是生命，当我们渐渐老去时，我们应该把握住生命中的第一分钟，或者冲动，或者寻找冲动。</p>
<p>有些跑题了，我想说的是“时间就是生命”！</p>
<p>在压力测试的过程中，我们需要关心的时间指标有两种：</p>
<blockquote>
<ol class='list'>
<li>用户平均请求等待时间——主要用于衡量服务器在一定并发用户数的情况下，对于单个用户的服务质量。</li>
<li>服务器平均请求处理时间——用于衡量服务器的整体服务质量</li>
</ol>
</blockquote>
<h3>ab 压力测试</h3>
<p>关于压力测试，<a href="http://www.xiaoxiaozi.com/2010/04/16/1745/" target="_blank">之前使用过siege——《第一次使用siege 第一次压力测试》</a></p>
<p>今天再简单介绍一下ab：ab是Apache自带的压力测试工具。我们先来看一下版本：</p>
<div class="codecolorer-container bash dawn" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:500px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">simaopig<span style="color: #000000; font-weight: bold;">@</span>simaopig-desktop:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>apache2<span style="color: #000000; font-weight: bold;">/</span>bin$ .<span style="color: #000000; font-weight: bold;">/</span>ab <span style="color: #660033;">-V</span><br />
This is ApacheBench, Version <span style="color: #000000;">2.3</span> <span style="color: #000000; font-weight: bold;">&lt;</span><span style="color: #007800;">$Revision</span>: <span style="color: #000000;">655654</span> $<span style="color: #000000; font-weight: bold;">&gt;</span><br />
Copyright <span style="color: #000000;">1996</span> Adam Twiss, Zeus Technology Ltd, http:<span style="color: #000000; font-weight: bold;">//</span>www.zeustech.net<span style="color: #000000; font-weight: bold;">/</span><br />
Licensed to The Apache Software Foundation, http:<span style="color: #000000; font-weight: bold;">//</span>www.apache.org<span style="color: #000000; font-weight: bold;">/</span></div></div>
<p>其简单使用过程如下：</p>
<div class="codecolorer-container text dawn" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:500px;height:300px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">simaopig@simaopig-desktop:/usr/local/apache2/bin$ ./ab -n1000 -c10 http://localhost/test.html<br />
This is ApacheBench, Version 2.3 &lt;$Revision: 655654 $&gt;<br />
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/<br />
Licensed to The Apache Software Foundation, http://www.apache.org/<br />
<br />
Benchmarking localhost (be patient)<br />
Completed 100 requests<br />
Completed 200 requests<br />
Completed 300 requests<br />
Completed 400 requests<br />
Completed 500 requests<br />
Completed 600 requests<br />
Completed 700 requests<br />
Completed 800 requests<br />
Completed 900 requests<br />
Completed 1000 requests<br />
Finished 1000 requests<br />
<br />
<br />
Server Software: &nbsp; &nbsp; &nbsp; &nbsp;Apache/2.2.15<br />
Server Hostname: &nbsp; &nbsp; &nbsp; &nbsp;localhost<br />
Server Port: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;80<br />
<br />
Document Path: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/test.html<br />
Document Length: &nbsp; &nbsp; &nbsp; &nbsp;77 bytes<br />
<br />
Concurrency Level: &nbsp; &nbsp; &nbsp;10<br />
Time taken for tests: &nbsp; 0.079 seconds<br />
Complete requests: &nbsp; &nbsp; &nbsp;1000<br />
Failed requests: &nbsp; &nbsp; &nbsp; &nbsp;0<br />
Write errors: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0<br />
Total transferred: &nbsp; &nbsp; &nbsp;337000 bytes<br />
HTML transferred: &nbsp; &nbsp; &nbsp; 77000 bytes<br />
Requests per second: &nbsp; &nbsp;12675.07 [#/sec] (mean)<br />
Time per request: &nbsp; &nbsp; &nbsp; 0.789 [ms] (mean)<br />
Time per request: &nbsp; &nbsp; &nbsp; 0.079 [ms] (mean, across all concurrent requests)<br />
Transfer rate: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;4171.39 [Kbytes/sec] received<br />
<br />
Connection Times (ms)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; min &nbsp;mean[+/-sd] median &nbsp; max<br />
Connect: &nbsp; &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp;0 &nbsp; 0.1 &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp; &nbsp; 2<br />
Processing: &nbsp; &nbsp; 0 &nbsp; &nbsp;1 &nbsp; 0.3 &nbsp; &nbsp; &nbsp;1 &nbsp; &nbsp; &nbsp; 3<br />
Waiting: &nbsp; &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp;1 &nbsp; 0.3 &nbsp; &nbsp; &nbsp;1 &nbsp; &nbsp; &nbsp; 3<br />
Total: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0 &nbsp; &nbsp;1 &nbsp; 0.3 &nbsp; &nbsp; &nbsp;1 &nbsp; &nbsp; &nbsp; 3<br />
<br />
Percentage of the requests served within a certain time (ms)<br />
&nbsp; 50% &nbsp; &nbsp; &nbsp;1<br />
&nbsp; 66% &nbsp; &nbsp; &nbsp;1<br />
&nbsp; 75% &nbsp; &nbsp; &nbsp;1<br />
&nbsp; 80% &nbsp; &nbsp; &nbsp;1<br />
&nbsp; 90% &nbsp; &nbsp; &nbsp;1<br />
&nbsp; 95% &nbsp; &nbsp; &nbsp;1<br />
&nbsp; 98% &nbsp; &nbsp; &nbsp;2<br />
&nbsp; 99% &nbsp; &nbsp; &nbsp;2<br />
&nbsp;100% &nbsp; &nbsp; &nbsp;3 (longest request)</div></div>
<p>ab的使用和返回的结果解释如下：</p>
<table border="1" cellpadding="0" cellspacing="0" width="590">
<thead>
<tr>
<th>使用选项</th>
<th>意义</th>
</tr>
</thead>
<tbody>
<tr>
<td>-n1000</td>
<td>表示总请求数为1000</td>
</tr>
<tr>
<td>-c10</td>
<td>表示并发用户数为10，即同时有10个用户发起请求</td>
</tr>
<tr>
<td>http://localhost/test.html</td>
<td>表示请求的目标URL</td>
</tr>
<tr>
<td>-t10</td>
<td>请求的超时响应时间，单位为秒</td>
</tr>
</tbody>
</table>
<p><br/></p>
<table border="1" cellpadding="0" cellspacing="0" width="590">
<thead>
<tr>
<th>返回字段</th>
<th>字段意义</th>
</tr>
</thead>
<tbody>
<tr>
<td>Server Software</td>
<td>测试的服务器的Web 服务器软件名，这里是Apache/2.2.15</td>
</tr>
<tr>
<td>Server Hostname</td>
<td>请求的URLK 主机部分名称， 这里值为localhost</td>
</tr>
<tr>
<td>Server Port</td>
<td>被测试的Web 服务器的端口号</td>
</tr>
<tr>
<td>Document Path</td>
<td>请求的URL中的根绝对路径</td>
</tr>
<tr>
<td>Document Length</td>
<td>表示HTTP响应数据的正文长度</td>
</tr>
<tr>
<td>Concurrency Level</td>
<td>表示并发用户数，这是我们压力测试时，传递过去的值 -c </td>
</tr>
<tr>
<td>Time taken for tests</td>
<td>表示所有这些请求被处理完成所花费的总时间</td>
</tr>
<tr>
<td>Complete requests</td>
<td>表示总请求数，我们压力测试时传递过去的参数 -n</td>
</tr>
<tr>
<td>Failed requests</td>
<td>表示失败的请求数，这里的失败是指请求在连接服务器／发送数据／接收数据等环节发生异常，以及无响应后点击鼠标中时的情况。超时时间可以使用-t设置</td>
</tr>
<tr>
<td>Total transferred</td>
<td>表示所有请求的响应数据长度总和，包含每个HTTP响应数据的头信息和正文数据的长度</td>
</tr>
<tr>
<td>HTML transferred</td>
<td>表示所有请求的响应数据中正文数据的总和，也就是减去Total transferred中HTTP响应数据中头信息的长度</td>
</tr>
<tr>
<td>Requests per second</td>
<td>这就是我们说滴吞吐率啊，等于 Complete requests / Time taken for tests <font color='red'>每秒钟，处理多少请求</font></td>
</tr>
<tr>
<td>Time per request</td>
<td>这便是我们说的，用户平均请求等待时间，等于 Time taken for tests / (Complete requests / Concurrency Level)</td>
</tr>
<tr>
<td>Time per request(across all concurrent requests)</td>
<td>这便是前面说的服务器平均请求处理时间，等于 Time taken for tests / Complete requests<br />
                  正是吞详细地址的倒数，为：Time per request / Concurrency Level <font color='red'>每个请求花费了多少秒</font></td>
</tr>
<tr>
<td>Transfer rate</td>
<td>表示这些请求在单位时间内，从服务器获取的数据长度，等于：Total transferred / Time taken for tests<br />
      </tr>
<tr>
<td>Percentage of the requests served within a certain time (ms)</td>
<td>这部分数据用于描述每个请求处理时间的分页情况，比如在以上测试结果中，99％都不超过1毫秒，100％都不超过3毫秒。这个时间为处理时间，是指前面的Time per request，即对于单个用户而言，平均每个请求处理的时间</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://www.xiaoxiaozi.com/2011/06/09/2206/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>html5 canvas translate</title>
		<link>http://www.xiaoxiaozi.com/2011/06/03/2123/</link>
		<comments>http://www.xiaoxiaozi.com/2011/06/03/2123/#comments</comments>
		<pubDate>Fri, 03 Jun 2011 04:04:47 +0000</pubDate>
		<dc:creator>simaopig</dc:creator>
				<category><![CDATA[Html]]></category>
		<category><![CDATA[canvas]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[translate]]></category>

		<guid isPermaLink="false">http://www.xiaoxiaozi.com/?p=2123</guid>
		<description><![CDATA[静下心来，开始接触一下HTML5吧，要不然以后连套页面都不会了。:)

在看手册的时候，canvas画布是一项很强大的东西。类似于WEBQQ的动态背景之类的就不说了，咱是菜鸟，从头学。
<!--more-->
先来看一下canvas中的坐标原点，及正、负坐标的取值

<img src="http://www.xiaoxiaozi.com/wp-content/uploads/2011/06/axis.jpg" alt="" title="axis" width="441" height="440" class="alignnone size-full wp-image-2126" />

那就先试着画一个“米”字吧，高手莫笑！

[cc lang='html']
<canvas id="diagonal" style="border: 1px solid blue;" width="200" height="200">

<script type="text/javascript">
	var canvas = document.getElementById('diagonal');
	//指定绘制的类型为2d，并返回其绘画环境
	var context = canvas.getContext('2d');
	context.moveTo(200, 0);
	context.lineTo(0, 200);
	
	context.moveTo(0, 0);
	context.lineTo(200, 200);
	
	context.moveTo(0,100);
	context.lineTo(200,100);
	
	context.moveTo(100,0);
	context.lineTo(100,200);
	
	context.stroke();
</script>
[/cc]

默认的原点坐标是0,0 那么，我们在画图的时候是否可以指定新的原点坐标呢？of course!

<blockquote>
我们可以在更改默认原点之前先对context执行save()方法，相当于做一个标记

使用context的translate()方法，可以指定新的原点坐标，后续的moveTo和lineTo的坐标值都是相对于新的原点坐标来操作取值

使用context的restore()方法，可以回到默认的原点坐标去
</blockquote>

例如，可以使用下面的方法重新画一个“米”字

[cc lang='html']
		<canvas id="diagonal" style="border: 1px solid blue;" width="200" height="200"></canvas>
		<script type="text/javascript">
			var canvas = document.getElementById('diagonal');
			var context = canvas.getContext('2d');
			context.save();
			context.translate(200,0);
			//这个0,0 其实是200，0
			context.moveTo(0,0);
			context.lineTo(-200,200);
			context.moveTo(-200,0);
			context.lineTo(0,200);
			context.moveTo(-100,0);
			context.lineTo(-100,200);
			context.moveTo(-200,100);
			context.lineTo(0,100);
			context.stroke();
		</script>
[/cc]

或者，画到一半，我们把原点坐标返回到0，0 可以这样做：

[cc lang='html']
		<canvas id="diagonal" style="border: 1px solid blue;" width="200" height="200"></canvas>
		<script type="text/javascript">
			var canvas = document.getElementById('diagonal');
			var context = canvas.getContext('2d');
			context.save();
			context.translate(200,0);
			context.moveTo(0,0);
			context.lineTo(-200,200);
			context.moveTo(-200,0);
			context.lineTo(0,200);
			context.restore();
			//这时候的100,0是真正相对于原来的0，0时的100，0
			context.moveTo(100,0);
			context.lineTo(100,200);
			context.moveTo(0,100);
			context.lineTo(200,100);
            context.stroke();
		</script>
[/cc]]]></description>
			<content:encoded><![CDATA[<p>静下心来，开始接触一下HTML5吧，要不然以后连套页面都不会了。:)</p>
<p>在看手册的时候，canvas画布是一项很强大的东西。类似于WEBQQ的动态背景之类的就不说了，咱是菜鸟，从头学。<br />
<span id="more-2123"></span><br />
先来看一下canvas中的坐标原点，及正、负坐标的取值</p>
<p><img src="http://www.xiaoxiaozi.com/wp-content/uploads/2011/06/axis.jpg" alt="" title="axis" width="441" height="440" class="alignnone size-full wp-image-2126" /></p>
<p>那就先试着画一个“米”字吧，高手莫笑！</p>
<div class="codecolorer-container html4strict dawn" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:500px;"><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&lt;canvas <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;diagonal&quot;</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;border: 1px solid blue;&quot;</span> <span style="color: #000066;">width</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;200&quot;</span> <span style="color: #000066;">height</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;200&quot;</span>&gt;</span><br />
<br />
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;</span><br />
&nbsp; &nbsp; var canvas = document.getElementById('diagonal');<br />
&nbsp; &nbsp; //指定绘制的类型为2d，并返回其绘画环境<br />
&nbsp; &nbsp; var context = canvas.getContext('2d');<br />
&nbsp; &nbsp; context.moveTo(200, 0);<br />
&nbsp; &nbsp; context.lineTo(0, 200);<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; context.moveTo(0, 0);<br />
&nbsp; &nbsp; context.lineTo(200, 200);<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; context.moveTo(0,100);<br />
&nbsp; &nbsp; context.lineTo(200,100);<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; context.moveTo(100,0);<br />
&nbsp; &nbsp; context.lineTo(100,200);<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; context.stroke();<br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span></div></div>
<p>默认的原点坐标是0,0 那么，我们在画图的时候是否可以指定新的原点坐标呢？of course!</p>
<blockquote><p>
我们可以在更改默认原点之前先对context执行save()方法，相当于做一个标记</p>
<p>使用context的translate()方法，可以指定新的原点坐标，后续的moveTo和lineTo的坐标值都是相对于新的原点坐标来操作取值</p>
<p>使用context的restore()方法，可以回到默认的原点坐标去
</p></blockquote>
<p>例如，可以使用下面的方法重新画一个“米”字</p>
<div class="codecolorer-container html4strict dawn" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:500px;"><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;canvas <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;diagonal&quot;</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;border: 1px solid blue;&quot;</span> <span style="color: #000066;">width</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;200&quot;</span> <span style="color: #000066;">height</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;200&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span>canvas&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var canvas = document.getElementById('diagonal');<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var context = canvas.getContext('2d');<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; context.save();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; context.translate(200,0);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //这个0,0 其实是200，0<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; context.moveTo(0,0);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; context.lineTo(-200,200);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; context.moveTo(-200,0);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; context.lineTo(0,200);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; context.moveTo(-100,0);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; context.lineTo(-100,200);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; context.moveTo(-200,100);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; context.lineTo(0,100);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; context.stroke();<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span></div></div>
<p>或者，画到一半，我们把原点坐标返回到0，0 可以这样做：</p>
<div class="codecolorer-container html4strict dawn" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:500px;"><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;canvas <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;diagonal&quot;</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;border: 1px solid blue;&quot;</span> <span style="color: #000066;">width</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;200&quot;</span> <span style="color: #000066;">height</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;200&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span>canvas&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var canvas = document.getElementById('diagonal');<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var context = canvas.getContext('2d');<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; context.save();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; context.translate(200,0);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; context.moveTo(0,0);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; context.lineTo(-200,200);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; context.moveTo(-200,0);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; context.lineTo(0,200);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; context.restore();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //这时候的100,0是真正相对于原来的0，0时的100，0<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; context.moveTo(100,0);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; context.lineTo(100,200);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; context.moveTo(0,100);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; context.lineTo(200,100);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; context.stroke();<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span></div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.xiaoxiaozi.com/2011/06/03/2123/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>线上业务为王</title>
		<link>http://www.xiaoxiaozi.com/2011/06/02/2118/</link>
		<comments>http://www.xiaoxiaozi.com/2011/06/02/2118/#comments</comments>
		<pubDate>Thu, 02 Jun 2011 11:03:59 +0000</pubDate>
		<dc:creator>simaopig</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[JOB]]></category>

		<guid isPermaLink="false">http://www.xiaoxiaozi.com/?p=2118</guid>
		<description><![CDATA[唉，这悲催的一天啊。

我多想说，如果我今天不来上班，就不会搞HTTPS;如果不搞HTTPS那么OPS的同事就不会切换虚IP;如果不切换虚IP就不会导致XX业务无法登录半小时;如果业务照常登录，那么今天其实很美好。

可是，我今天依旧踩着阳光邪恶的来到了公司，也注定了我今天的悲剧！
<!--more-->

<ol class='list'>
<li>无论再怎么急，开发永远没有测试重要，尤其是在业务上线的情况下。</li>
<li>新功能也永远没有保证老的业务正常活着重要。</li>
<li>另外，就是不要相信任何人！</li>
</ol>

你说，开了HTTPS，而且是HTTP并行。那么我只测443端口有问题吗？

谁知道80端口你会不开啊？

还有那XX的破业务，这个不急的吧？我为啥要忙着去开发那个而不多测一下啊？

线上业务为王，长个教训吧。]]></description>
			<content:encoded><![CDATA[<p>唉，这悲催的一天啊。</p>
<p>我多想说，如果我今天不来上班，就不会搞HTTPS;如果不搞HTTPS那么OPS的同事就不会切换虚IP;如果不切换虚IP就不会导致XX业务无法登录半小时;如果业务照常登录，那么今天其实很美好。</p>
<p>可是，我今天依旧踩着阳光邪恶的来到了公司，也注定了我今天的悲剧！<br />
<span id="more-2118"></span></p>
<ol class='list'>
<li>无论再怎么急，开发永远没有测试重要，尤其是在业务上线的情况下。</li>
<li>新功能也永远没有保证老的业务正常活着重要。</li>
<li>另外，就是不要相信任何人！</li>
</ol>
<p>你说，开了HTTPS，而且是HTTP并行。那么我只测443端口有问题吗？</p>
<p>谁知道80端口你会不开啊？</p>
<p>还有那XX的破业务，这个不急的吧？我为啥要忙着去开发那个而不多测一下啊？</p>
<p>线上业务为王，长个教训吧。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.xiaoxiaozi.com/2011/06/02/2118/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

