<?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>ZheX Blog</title>
	<atom:link href="http://www.zhex.net/feed" rel="self" type="application/rss+xml" />
	<link>http://www.zhex.net</link>
	<description>Idea来源于生活的经验</description>
	<lastBuildDate>Mon, 25 Jan 2010 10:41:00 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>DOCTYPE对CSS及JS的影响</title>
		<link>http://www.zhex.net/effect-on-css-and-js-by-doctype.html#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://www.zhex.net/effect-on-css-and-js-by-doctype.html#comments</comments>
		<pubDate>Mon, 25 Jan 2010 10:41:00 +0000</pubDate>
		<dc:creator>ZheX</dc:creator>
				<category><![CDATA[前端设计]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[doctype]]></category>
		<category><![CDATA[js]]></category>

		<guid isPermaLink="false">http://www.zhex.net/?p=461</guid>
		<description><![CDATA[也许你已经发现选用或不用DOCTYPE对你的页面的影响是非常大的，甚至对于不同浏览器结果也不一样。下文以对一段javascript的影响说明：

&#60;!DOCTYPE html PUBLIC &#34;-//W3C//DTD XHTML 1.0 Transitional//EN&#34; &#34;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#34;&#62;
&#60;html xmlns=&#34;http://www.w3.org/1999/xhtml&#34;&#62;
&#60;head&#62;
&#60;meta http-equiv=&#34;Content-Type&#34; content=&#34;text/html; charset=gb2312&#34;&#62;
&#60;title&#62;divTest&#60;/title&#62;
&#60;script&#62;
function changeHeight&#40;&#41;
&#123;
document.getElementById&#40;&#34;content&#34;&#41;.style.height=&#34;360&#34;;
alert&#40;document.getElementById&#40;&#34;content&#34;&#41;.style.height&#41;;
alert&#40;document.getElementById&#40;&#34;content&#34;&#41;.offsetHeight&#41;;
&#125;
&#60;/script&#62;
&#60;/head&#62;
&#60;body&#62;
&#60;div id=&#34;content&#34; style=&#34;height: 60px; border: 1px solid #FF0000;&#34;&#62;&#60;a href=&#34;javascript:changeHeight()&#34;&#62;aa&#60;/a&#62;&#60;/div&#62;
&#60;/body&#62;


上文页面是通过按aa超链接表现javascript控制div的高度，读者可以自己试一下
1. IE浏览（我用的是IE 6），content的高度会变大，同时alert出height:360，offsetHeight:362
2. firefox，content的高度不会变，同时alert出height:60，offsetHeight:62
3. 去掉最上面的一句
在firefox下将得到content的高度会变大，同时alert出height:360，offsetHeight:362
我曾看到好多人运行到这里就会得到一个结论去他的DOCTYPE，用了它好多东西都不对了。我以为不是这样的，DOCTYPE定义了一个规范集，去检验你代码的正确性规范性，去掉了DOCTYPE也许只会在你当前机器上的浏览器正确运行，也就是说你的程序不能做到通用，难道这是你追求的吗？这时你会说那上面的问题怎么办呢，难道在firefox就不能那么做吗？回答是当然可以，仔细看一下上面的代码其实是有问题的，在标准中对象的高度、大小必须指定单位的如px,pt等，如果不指定那就要依赖于应用浏览器的默认或支持情况了，因此修改代码如下：

&#60;script&#62;
function changeHeight&#40;&#41;
&#123;
    document.getElementById&#40;&#34;content&#34;&#41;.style.height=&#34;360px&#34;;
    alert&#40;document.getElementById&#40;&#34;content&#34;&#41;.style.height&#41;;
    alert&#40;document.getElementById&#40;&#34;content&#34;&#41;.offsetHeight&#41;;
&#125;
&#60;/script&#62;

运行一下看看是不是对了呢？ 定义DOCTYPE是个好习惯，也希望大家能写出标准规范的代码。


No related posts.


No related posts.]]></description>
			<content:encoded><![CDATA[<p>也许你已经发现选用或不用DOCTYPE对你的页面的影响是非常大的，甚至对于不同浏览器结果也不一样。下文以对一段javascript的影响说明：</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;!</span>DOCTYPE html <span style="color: #000000; font-weight: bold;">PUBLIC</span> <span style="color: #0000ff;">&quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;</span> <span style="color: #0000ff;">&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>html xmlns<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://www.w3.org/1999/xhtml&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>head<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>meta http<span style="color: #339933;">-</span>equiv<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Content-Type&quot;</span> content<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/html; charset=gb2312&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>title<span style="color: #339933;">&gt;</span>divTest<span style="color: #339933;">&lt;/</span>title<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>script<span style="color: #339933;">&gt;</span>
<span style="color: #000000; font-weight: bold;">function</span> changeHeight<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
document<span style="color: #339933;">.</span>getElementById<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;content&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>style<span style="color: #339933;">.</span>height<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;360&quot;</span><span style="color: #339933;">;</span>
alert<span style="color: #009900;">&#40;</span>document<span style="color: #339933;">.</span>getElementById<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;content&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>style<span style="color: #339933;">.</span>height<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
alert<span style="color: #009900;">&#40;</span>document<span style="color: #339933;">.</span>getElementById<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;content&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>offsetHeight<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">&lt;/script&gt;</span>
<span style="color: #339933;">&lt;/</span>head<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>body<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;content&quot;</span> style<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;height: 60px; border: 1px solid #FF0000;&quot;</span><span style="color: #339933;">&gt;&lt;</span>a href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;javascript:changeHeight()&quot;</span><span style="color: #339933;">&gt;</span>aa<span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;&lt;/</span>div<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>body<span style="color: #339933;">&gt;</span></pre></div></div>

<p><span id="more-461"></span><br />
上文页面是通过按aa超链接表现javascript控制div的高度，读者可以自己试一下</p>
<p>1. IE浏览（我用的是IE 6），content的高度会变大，同时alert出height:360，offsetHeight:362</p>
<p>2. firefox，content的高度不会变，同时alert出height:60，offsetHeight:62</p>
<p>3. 去掉最上面的一句<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><br />
在firefox下将得到content的高度会变大，同时alert出height:360，offsetHeight:362</p>
<p>我曾看到好多人运行到这里就会得到一个结论去他的DOCTYPE，用了它好多东西都不对了。我以为不是这样的，DOCTYPE定义了一个规范集，去检验你代码的正确性规范性，去掉了DOCTYPE也许只会在你当前机器上的浏览器正确运行，也就是说你的程序不能做到通用，难道这是你追求的吗？这时你会说那上面的问题怎么办呢，难道在firefox就不能那么做吗？回答是当然可以，仔细看一下上面的代码其实是有问题的，在<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">标准中对象的高度、大小必须指定单位的如px,pt等，如果不指定那就要依赖于应用浏览器的默认或支持情况了，因此修改代码如下：</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script<span style="color: #339933;">&gt;</span>
<span style="color: #000000; font-weight: bold;">function</span> changeHeight<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    document<span style="color: #339933;">.</span>getElementById<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;content&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>style<span style="color: #339933;">.</span>height<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;360px&quot;</span><span style="color: #339933;">;</span>
    alert<span style="color: #009900;">&#40;</span>document<span style="color: #339933;">.</span>getElementById<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;content&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>style<span style="color: #339933;">.</span>height<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    alert<span style="color: #009900;">&#40;</span>document<span style="color: #339933;">.</span>getElementById<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;content&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>offsetHeight<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">&lt;/script&gt;</span></pre></div></div>

<p>运行一下看看是不是对了呢？ 定义DOCTYPE是个好习惯，也希望大家能写出标准规范的代码。</p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.zhex.net/effect-on-css-and-js-by-doctype.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Div CSS absolute与relative的区别小结</title>
		<link>http://www.zhex.net/div-css-absolute%e4%b8%8erelative%e7%9a%84%e5%8c%ba%e5%88%ab%e5%b0%8f%e7%bb%93.html#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://www.zhex.net/div-css-absolute%e4%b8%8erelative%e7%9a%84%e5%8c%ba%e5%88%ab%e5%b0%8f%e7%bb%93.html#comments</comments>
		<pubDate>Thu, 21 Jan 2010 23:19:05 +0000</pubDate>
		<dc:creator>ZheX</dc:creator>
				<category><![CDATA[前端设计]]></category>
		<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://www.zhex.net/?p=452</guid>
		<description><![CDATA[先看个例子

&#60;!DOCTYPE html PUBLIC &#34;-//W3C//DTD XHTML 1.0 Transitional//EN&#34; &#34;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#34;&#62; 
&#60;html xmlns=&#34;http://www.w3.org/1999/xhtml&#34;&#62; 
&#60;head&#62; 
&#60;meta http-equiv=&#34;Content-Type&#34; content=&#34;text/html; charset=gb2312&#34; /&#62; 
&#60;title&#62;Div + CSS Example, Wayhome's Blog&#60;/title&#62; 
&#60;style type=&#34;text/css&#34;&#62; 
&#60;!-- 
body,td,th{font-family:Verdana;font-size:9px;} 
--&#62; 
&#60;/style&#62;&#60;/head&#62; 
&#60;body&#62; 
&#60;div style=&#34;position:absolute; top:5px; right:20px; width:200px; height:180px; background:#00FF00;&#34;&#62; 
　position: absolute;&#60;br /&#62; 
　top: 5px;&#60;br /&#62; 
　right: 20px;&#60;br /&#62; 
　&#60;div style=&#34;position:absolute; left:20px; bottom:10px; width:100px; height:100px; background:#00FFFF;&#34;&#62; 
position: absolute;&#60;br /&#62; [...]


Related posts:<ol><li><a href='http://www.zhex.net/what-is-web3.html' rel='bookmark' title='Permanent Link: 什么是 web 3.0'>什么是 web 3.0</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>先看个例子</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #00bbdd;">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;</span> 
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">html</span> xmlns<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.w3.org/1999/xhtml&quot;</span>&gt;</span> 
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">head</span>&gt;</span> 
<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=gb2312&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span> 
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">title</span>&gt;</span>Div + CSS Example, Wayhome's Blog<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">title</span>&gt;</span> 
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">style</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/css&quot;</span>&gt;</span> 
<span style="color: #808080; font-style: italic;">&lt;!-- </span>
<span style="color: #808080; font-style: italic;">body,td,th{font-family:Verdana;font-size:9px;} </span>
<span style="color: #808080; font-style: italic;">--&gt;</span> 
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">style</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">head</span>&gt;</span> 
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">body</span>&gt;</span> 
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;position:absolute; top:5px; right:20px; width:200px; height:180px; background:#00FF00;&quot;</span>&gt;</span> 
　position: absolute;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span> 
　top: 5px;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span> 
　right: 20px;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span> 
　<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;position:absolute; left:20px; bottom:10px; width:100px; height:100px; background:#00FFFF;&quot;</span>&gt;</span> 
position: absolute;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span> 
left: 20px;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span> 
bottom: 10px;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span> 
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span> 
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span> 
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;position:absolute; top:5px; left:5px; width:100px; height:100px; background:#00FF00;&quot;</span>&gt;</span> 
　position: absolute;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span> 
　top: 5px;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span> 
　left: 5px;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span> 
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span> 
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;position:relative; left:150px; width:300px; height:50px; background:#FF9933;&quot;</span>&gt;</span> 
　position: relative;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span> 
　left: 150px;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span> 
　<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span> 
　width: 300px; height: 50px; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span> 
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span> 
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text-align:center; background:#ccc;&quot;</span>&gt;</span> 
　　<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;margin:0 auto; width:600px; background:#FF66CC; text-align:left;&quot;</span>&gt;</span> 
　 <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>1<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span> 
　 <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>2<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span> 
　 <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>3<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span> 
　 <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>4<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span> 
　 <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>5<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span> 
　 <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;padding:20px 0 0 20px; background:#FFFF00;&quot;</span>&gt;</span> 
　　　 padding: 20px 0 0 20px; 
　　<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;position:absolute; width:100px; height:100px; background:#FF0000;&quot;</span>&gt;</span>position: <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">span</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;color:#fff; &quot;</span>&gt;</span>absolute<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">span</span>&gt;</span>;<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span> 
　　<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;position:relative; left:200px; width:500px; height:300px; background:#FF9933;&quot;</span>&gt;</span> 
　　　　position: <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">span</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;color:blue;&quot;</span>&gt;</span>relative<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">span</span>&gt;</span>;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span> 
　　 left: 200px;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span> 
　　 <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span> 
　　 width: 300px;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span> 
　　 height: 300px;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span> 
　　 <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;position:absolute; top:20px; right:20px; width:100px; height:100px; background:#00FFFF;&quot;</span>&gt;</span> 
　　　 position: absolute;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span> 
　　　 top: 20px;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span> 
　　　 right: 20px;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span> 
　　 <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;position:absolute; bottom:20px; left:20px; width:100px; height:100px; background:#00FFFF;&quot;</span>&gt;</span> 
　　　 position: absolute;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span> 
　　bottom: 20px;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span> 
　　left: 20px;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span> 
　　<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span> 
　　<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span> 
　 <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span> 
　 
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span> 
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span> 
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">body</span>&gt;</span> 
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">html</span>&gt;</span></pre></div></div>

<p>absolute：绝对定位，CSS 写法“ position: absolute; ”，它的定位分两种情况，如下：<br />
　　<br />
1. 没有设定 Top、Right、Bottom、Left 的情况，默认依据父级的“内容区域原始点”为原始点，上面例子红色部分(父级黄色区域有 Padding 属性，“坐标原始点”和“内容区域原始点”不一样)。<br />
　　<br />
2. 有设定 Top、Right、Bottom、Left 的情况，这里又分了两种情况如下：<br />
　　<br />
(1). 父级没 position 属性，浏览器左上角(即 Body)为“坐标原始点”进行定位，位置由 Top、Right、Bottom、Left 属性决定，上面例子绿色部分。<br />
　　<br />
(2). 父级有 position 属性，父级的“坐标原始点”为原始点，上面例子浅蓝色部分。<br />
　　<br />
relative：相对定位，CSS 写法“ position: relative; ”，参照父级的“内容区域原始点”为原始点，无父级则以 Body 的“内容区域原始点”为原始点，位置由 Top、Right、Bottom、Left 属性决定，且有“撑开或占据高度”的作用，上面例子橙色部分。 </p>


<p>Related posts:<ol><li><a href='http://www.zhex.net/what-is-web3.html' rel='bookmark' title='Permanent Link: 什么是 web 3.0'>什么是 web 3.0</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.zhex.net/div-css-absolute%e4%b8%8erelative%e7%9a%84%e5%8c%ba%e5%88%ab%e5%b0%8f%e7%bb%93.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>有趣的项目管理图</title>
		<link>http://www.zhex.net/interesting-project-cartoon.html#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://www.zhex.net/interesting-project-cartoon.html#comments</comments>
		<pubDate>Sat, 09 Jan 2010 05:02:28 +0000</pubDate>
		<dc:creator>ZheX</dc:creator>
				<category><![CDATA[休闲娱乐]]></category>
		<category><![CDATA[项目管理]]></category>
		<category><![CDATA[项目]]></category>

		<guid isPermaLink="false">http://www.zhex.net/?p=431</guid>
		<description><![CDATA[在Project Catoon 网站上看到了一套有趣的项目管理图片，这系列套图用风趣讽刺的手法解释了项目开发中的种种现象，看完以后相信大家就会明白为什么项目开发过程中总是会出现大大小小的偏差。
下面是此套图的1.5版本。
此外大家可以去这个网站建立自己对项目看法的排列组合。 2.0 beta也可以在这个网站上找到。


No related posts.


No related posts.]]></description>
			<content:encoded><![CDATA[<p>在<a href="http://www.projectcartoon.com">Project Catoon</a> 网站上看到了一套有趣的项目管理图片，这系列套图用风趣讽刺的手法解释了项目开发中的种种现象，看完以后相信大家就会明白为什么项目开发过程中总是会出现大大小小的偏差。</p>
<p>下面是此套图的1.5版本。<br />

<a href='http://www.zhex.net/interesting-project-cartoon.html/cell_01' title='cell_01'><img width="150" height="150" src="http://www.zhex.net/wp-content/uploads/2010/01/cell_01-150x150.jpg" class="attachment-thumbnail" alt="你的“上帝”是怎么期望的" title="cell_01" /></a>
<a href='http://www.zhex.net/interesting-project-cartoon.html/cell_02' title='cell_02'><img width="150" height="150" src="http://www.zhex.net/wp-content/uploads/2010/01/cell_02-150x150.jpg" class="attachment-thumbnail" alt="项目经理是如何理解的" title="cell_02" /></a>
<a href='http://www.zhex.net/interesting-project-cartoon.html/cell_03' title='cell_03'><img width="150" height="150" src="http://www.zhex.net/wp-content/uploads/2010/01/cell_03-150x150.jpg" class="attachment-thumbnail" alt="设计师么是怎么设计的" title="cell_03" /></a>
<a href='http://www.zhex.net/interesting-project-cartoon.html/cell_04' title='cell_04'><img width="150" height="150" src="http://www.zhex.net/wp-content/uploads/2010/01/cell_04-150x150.jpg" class="attachment-thumbnail" alt="程序员们是如何开发的" title="cell_04" /></a>
<a href='http://www.zhex.net/interesting-project-cartoon.html/cell_05' title='cell_05'><img width="150" height="150" src="http://www.zhex.net/wp-content/uploads/2010/01/cell_05-150x150.jpg" class="attachment-thumbnail" alt="测试员们得到的" title="cell_05" /></a>
<a href='http://www.zhex.net/interesting-project-cartoon.html/cell_06' title='cell_06'><img width="150" height="150" src="http://www.zhex.net/wp-content/uploads/2010/01/cell_06-150x150.jpg" class="attachment-thumbnail" alt="你的商业顾问是怎么形容的" title="cell_06" /></a>
<a href='http://www.zhex.net/interesting-project-cartoon.html/cell_07' title='cell_07'><img width="150" height="150" src="http://www.zhex.net/wp-content/uploads/2010/01/cell_07-150x150.jpg" class="attachment-thumbnail" alt="项目档案是如何纪录的" title="cell_07" /></a>
<a href='http://www.zhex.net/interesting-project-cartoon.html/cell_08' title='cell_08'><img width="150" height="150" src="http://www.zhex.net/wp-content/uploads/2010/01/cell_08-150x150.jpg" class="attachment-thumbnail" alt="它是怎么付诸于实际的" title="cell_08" /></a>
<a href='http://www.zhex.net/interesting-project-cartoon.html/cell_09' title='cell_09'><img width="150" height="150" src="http://www.zhex.net/wp-content/uploads/2010/01/cell_09-150x150.jpg" class="attachment-thumbnail" alt="顾客如何买你的帐" title="cell_09" /></a>
<a href='http://www.zhex.net/interesting-project-cartoon.html/cell_10' title='cell_10'><img width="150" height="150" src="http://www.zhex.net/wp-content/uploads/2010/01/cell_10-150x150.jpg" class="attachment-thumbnail" alt="它是如何被支持的" title="cell_10" /></a>
<a href='http://www.zhex.net/interesting-project-cartoon.html/cell_11' title='cell_11'><img width="150" height="150" src="http://www.zhex.net/wp-content/uploads/2010/01/cell_11-150x150.jpg" class="attachment-thumbnail" alt="广告是如何做的" title="cell_11" /></a>
<a href='http://www.zhex.net/interesting-project-cartoon.html/cell_13' title='cell_13'><img width="150" height="150" src="http://www.zhex.net/wp-content/uploads/2010/01/cell_13-150x150.jpg" class="attachment-thumbnail" alt="客户到底需要的是什么" title="cell_13" /></a>
</p>
<p>此外大家可以去这个网站建立自己对项目看法的排列组合。 2.0 beta也可以在这个网站上找到。</p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.zhex.net/interesting-project-cartoon.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>什么是DNS轮循?</title>
		<link>http://www.zhex.net/what-is-dns-round-robin.html#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://www.zhex.net/what-is-dns-round-robin.html#comments</comments>
		<pubDate>Wed, 06 Jan 2010 23:55:10 +0000</pubDate>
		<dc:creator>ZheX</dc:creator>
				<category><![CDATA[WEB 知识]]></category>
		<category><![CDATA[DNS]]></category>

		<guid isPermaLink="false">http://www.zhex.net/?p=429</guid>
		<description><![CDATA[传统的DNS解析都是一个域名对应一个IP地址,但是通过DNS轮循技术(负载平衡技术)可以做到一个域名对应到多个IP 上. 这样大家难免就会问,这个技术有什么用呢?
DNS轮循是指将相同的域名解释到不同的IP，随机使用其中某台主机的技术,该项技术可以智能的调整网站的访问量到不同服务器上，减轻网站服务器的压力， 实现负载匀衡;如果您感觉到单一的主机已经不堪负载你网站日益增长的访问，那么建议您采用我们的DNS轮循技术。
DNS轮循系统可以根据您的需求设置N台主机作为WEB服务器。目前已有越来多大型的WEB服务器使用DNS轮循来实现负载均衡，服务的分布规划更便捷，扩展性更好，从而提高了网站的稳定性和访问效率，那些大量数据文件请求的客户也得到了更快的响应。
DNS轮循还将给您的网站提供这样的改进，诸如您的网站的数据使用量一直处于不断的增长当中，当达到服务器资源运行瓶颈的情况下，由于采用了 DNS轮循技术，您只需要增加服务器数量就可以平滑升级，而且偶然故障或其他意外情况造成的损失得以避免，7×24小时可靠性的持续的运行成为可能。
如果您真的希望自己的网站能够一直稳定的在线运行，尽量的减少宕机的比率，那么除了采用比较好的网站空间技术支持之外，还可以采用时代互联域名的DNS轮循功能来实现网站的永久在线。


No related posts.


No related posts.]]></description>
			<content:encoded><![CDATA[<p>传统的DNS解析都是一个域名对应一个IP地址,但是通过DNS轮循技术(负载平衡技术)可以做到一个域名对应到多个IP 上. 这样大家难免就会问,这个技术有什么用呢?</p>
<p>DNS轮循是指将相同的域名解释到不同的IP，随机使用其中某台主机的技术,该项技术可以智能的调整网站的访问量到不同服务器上，减轻网站服务器的压力， 实现负载匀衡;如果您感觉到单一的主机已经不堪负载你网站日益增长的访问，那么建议您采用我们的DNS轮循技术。</p>
<p>DNS轮循系统可以根据您的需求设置N台主机作为WEB服务器。目前已有越来多大型的WEB服务器使用DNS轮循来实现负载均衡，服务的分布规划更便捷，扩展性更好，从而提高了网站的稳定性和访问效率，那些大量数据文件请求的客户也得到了更快的响应。</p>
<p>DNS轮循还将给您的网站提供这样的改进，诸如您的网站的数据使用量一直处于不断的增长当中，当达到服务器资源运行瓶颈的情况下，由于采用了 DNS轮循技术，您只需要增加服务器数量就可以平滑升级，而且偶然故障或其他意外情况造成的损失得以避免，7×24小时可靠性的持续的运行成为可能。</p>
<p>如果您真的希望自己的网站能够一直稳定的在线运行，尽量的减少宕机的比率，那么除了采用比较好的网站空间技术支持之外，还可以采用时代互联域名的DNS轮循功能来实现网站的永久在线。</p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.zhex.net/what-is-dns-round-robin.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Crazy Sand</title>
		<link>http://www.zhex.net/crazy-sand.html#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://www.zhex.net/crazy-sand.html#comments</comments>
		<pubDate>Thu, 31 Dec 2009 07:54:42 +0000</pubDate>
		<dc:creator>ZheX</dc:creator>
				<category><![CDATA[休闲娱乐]]></category>

		<guid isPermaLink="false">http://www.zhex.net/?p=427</guid>
		<description><![CDATA[什么叫nb？ 看完就知道了



No related posts.


No related posts.]]></description>
			<content:encoded><![CDATA[<p>什么叫nb？ 看完就知道了</p>
<p style="text-align: center;"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="480" height="400" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="align" value="middle" /><param name="src" value="http://player.youku.com/player.php/sid/XMTE5Njc2MDg0/v.swf" /><param name="quality" value="high" /><embed type="application/x-shockwave-flash" width="480" height="400" src="http://player.youku.com/player.php/sid/XMTE5Njc2MDg0/v.swf" quality="high" align="middle"></embed></object></p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.zhex.net/crazy-sand.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>巴西广告节创意</title>
		<link>http://www.zhex.net/%e5%b7%b4%e8%a5%bf%e5%b9%bf%e5%91%8a%e8%8a%82%e5%88%9b%e6%84%8f.html#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://www.zhex.net/%e5%b7%b4%e8%a5%bf%e5%b9%bf%e5%91%8a%e8%8a%82%e5%88%9b%e6%84%8f.html#comments</comments>
		<pubDate>Thu, 17 Dec 2009 08:57:16 +0000</pubDate>
		<dc:creator>ZheX</dc:creator>
				<category><![CDATA[休闲娱乐]]></category>
		<category><![CDATA[创意]]></category>
		<category><![CDATA[广告节]]></category>

		<guid isPermaLink="false">http://www.zhex.net/?p=422</guid>
		<description><![CDATA[看下这次巴西广告节的创意。广告语标语为：Many try, a few get it（很多人尝试，很少人成功）。广告中那么多颗脑袋争先恐后地去“钓”点子，可惜最后赢家一般只有一个，所以大多数脑袋只有看着别人谈情说爱的份儿。


第二副图异曲同工



No related posts.


No related posts.]]></description>
			<content:encoded><![CDATA[<p>看下这次巴西广告节的创意。广告语标语为：Many try, a few get it（很多人尝试，很少人成功）。广告中那么多颗脑袋争先恐后地去“钓”点子，可惜最后赢家一般只有一个，所以大多数脑袋只有看着别人谈情说爱的份儿。<br />
<img src="http://www.zhex.net/wp-content/uploads/2009/12/2009124133646111.jpg" alt="2009124133646111" title="2009124133646111" width="700" height="461" class="aligncenter size-full wp-image-423" /><br />
<span id="more-422"></span><br />
第二副图异曲同工<br />
<img src="http://www.zhex.net/wp-content/uploads/2009/12/2009124133652675.jpg" alt="2009124133652675" title="2009124133652675" width="700" height="461" class="aligncenter size-full wp-image-424" /></p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.zhex.net/%e5%b7%b4%e8%a5%bf%e5%b9%bf%e5%91%8a%e8%8a%82%e5%88%9b%e6%84%8f.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>解决PHP内存溢出</title>
		<link>http://www.zhex.net/solve-out-of-memory-in-php.html#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://www.zhex.net/solve-out-of-memory-in-php.html#comments</comments>
		<pubDate>Thu, 17 Dec 2009 01:55:11 +0000</pubDate>
		<dc:creator>ZheX</dc:creator>
				<category><![CDATA[Yii Framework]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[内存溢出]]></category>

		<guid isPermaLink="false">http://www.zhex.net/?p=418</guid>
		<description><![CDATA[有时候我们在运行php程序的时候会发现 Fatal Error: Out of memory 这样的提示。 这有可能是程序中用到了大量了变量和对象，导致分配的内存不够用。
我们可以在php.ini文件中把memory_limit参数默认的128M修改为256M或者更大：

memory_limit = 128M

如果是虚拟主机，我们可以在程序需要用到大内存的地方添加：

init_set&#40;&#34;memory_limit&#34;, &#34;128M&#34;&#41;;

这些可以在硬件环境方面解决我们的问题，不过最好的方法还是严格控制程序中内存的损耗。及时unset一些大而不用的变量或对象。


No related posts.


No related posts.]]></description>
			<content:encoded><![CDATA[<p>有时候我们在运行php程序的时候会发现 Fatal Error: Out of memory 这样的提示。 这有可能是程序中用到了大量了变量和对象，导致分配的内存不够用。</p>
<p>我们可以在php.ini文件中把memory_limit参数默认的128M修改为256M或者更大：</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">memory_limit <span style="color: #339933;">=</span> 128M</pre></div></div>

<p>如果是虚拟主机，我们可以在程序需要用到大内存的地方添加：</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">init_set<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;memory_limit&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;128M&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>这些可以在硬件环境方面解决我们的问题，不过最好的方法还是严格控制程序中内存的损耗。及时unset一些大而不用的变量或对象。</p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.zhex.net/solve-out-of-memory-in-php.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL分区的优点</title>
		<link>http://www.zhex.net/mysql%e5%88%86%e5%8c%ba%e7%9a%84%e4%bc%98%e7%82%b9.html#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://www.zhex.net/mysql%e5%88%86%e5%8c%ba%e7%9a%84%e4%bc%98%e7%82%b9.html#comments</comments>
		<pubDate>Tue, 15 Dec 2009 22:13:23 +0000</pubDate>
		<dc:creator>ZheX</dc:creator>
				<category><![CDATA[数据库]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://www.zhex.net/?p=416</guid>
		<description><![CDATA[数据库分区是一种物理数据库设计技术，DBA和数据库建模人员对其相当熟悉。虽然分区技术可以实现很多效果，但其主要目的是为了在特定的SQL操作中减少数据读写的总量以缩减响应时间。
分区主要有两种形式：//这里一定要注意行和列的概念（row是行，column是列）
1. 水平分区（Horizontal Partitioning）这种形式分区是对表的行进行分区，通过这样的方式不同分组里面的物理列分割的数据集得以组合，从而进行个体分割（单分区）或集体分割（1个或多个分区）。所有在表中定义的列在每个数据集中都能找到，所以表的特性依然得以保持。
举个简单例子：一个包含十年发票记录的表可以被分区为十个不同的分区，每个分区包含的是其中一年的记录。（朋奕注：这里具体使用的分区方式我们后面再说，可以先说一点，一定要通过某个属性列来分割，譬如这里使用的列就是年份）

2. 垂直分区（Vertical Partitioning） 这种分区方式一般来说是通过对表的垂直划分来减少目标表的宽度，使某些特定的列 被划分到特定的分区，每个分区都包含了其中的列所对应的行。
举个简单例子：一个包含了大text和BLOB列的表，这些text和BLOB列又不经常被访问，这时候就要把这些不经常使用的text和BLOB了划分到另一个分区，在保证它们数据相关性的同时还能提高访问速度。
在数据库供应商开始在他们的数据库引擎中建立分区（主要是水平分区）时，DBA和建模者必须设计好表的物理分区结构，不要保存冗余的数据（不同表中同时都包含父表中的数据）或相互联结成一个逻辑父对象（通常是视图）。这种做法会使水平分区的大部分功能失效，有时候也会对垂直分区产生影响
分区的一些优点包括：
与单个磁盘或文件系统分区相比，可以存储更多的数据。
对于那些已经失去保存意义的数据，通常可以通过删除与那些数据有关的分区，很容易地删除那些数据。相反地，在某些情况下，添加新数据的过程又可以通过为那些新数据专门增加一个新的分区，来很方便地实现。
通常和分区有关的其他优点包括下面列出的这些。MySQL 分区中的这些功能目前还没有实现，但是在我们的优先级列表中，具有高的优先级；我们希望在5.1的生产版本中，能包括这些功能。
一些查询可以得到极大的优化，这主要是借助于满足一个给定WHERE 语句的数据可以只保存在一个或多个分区内，这样在查找时就不用查找其他剩余的分区。因为分区可以在创建了分区表后进行修改，所以在第一次配置分区方案时还不曾这么做时，可以重新组织数据，来提高那些常用查询的效率。
涉及到例如SUM() 和 COUNT()这样聚合函数的查询，可以很容易地进行并行处理。这种查询的一个简单例子如 “SELECT salesperson_id, COUNT(orders) as order_total FROM sales GROUP BY salesperson_id；”。通过“并行”， 这意味着该查询可以在每个分区上同时进行，最终结果只需通过总计所有分区得到的结果。
通过跨多个磁盘来分散数据查询，来获得更大的查询吞吐量。


No related posts.


No related posts.]]></description>
			<content:encoded><![CDATA[<p>数据库分区是一种物理数据库设计技术，DBA和数据库建模人员对其相当熟悉。虽然分区技术可以实现很多效果，但其主要目的是为了在特定的SQL操作中减少数据读写的总量以缩减响应时间。</p>
<p>分区主要有两种形式：//这里一定要注意行和列的概念（row是行，column是列）</p>
<p>1. 水平分区（Horizontal Partitioning）这种形式分区是对表的行进行分区，通过这样的方式不同分组里面的物理列分割的数据集得以组合，从而进行个体分割（单分区）或集体分割（1个或多个分区）。所有在表中定义的列在每个数据集中都能找到，所以表的特性依然得以保持。</p>
<p>举个简单例子：一个包含十年发票记录的表可以被分区为十个不同的分区，每个分区包含的是其中一年的记录。（朋奕注：这里具体使用的分区方式我们后面再说，可以先说一点，一定要通过某个属性列来分割，譬如这里使用的列就是年份）<br />
<span id="more-416"></span><br />
2. 垂直分区（Vertical Partitioning） 这种分区方式一般来说是通过对表的垂直划分来减少目标表的宽度，使某些特定的列 被划分到特定的分区，每个分区都包含了其中的列所对应的行。</p>
<p>举个简单例子：一个包含了大text和BLOB列的表，这些text和BLOB列又不经常被访问，这时候就要把这些不经常使用的text和BLOB了划分到另一个分区，在保证它们数据相关性的同时还能提高访问速度。</p>
<p>在数据库供应商开始在他们的数据库引擎中建立分区（主要是水平分区）时，DBA和建模者必须设计好表的物理分区结构，不要保存冗余的数据（不同表中同时都包含父表中的数据）或相互联结成一个逻辑父对象（通常是视图）。这种做法会使水平分区的大部分功能失效，有时候也会对垂直分区产生影响</p>
<p>分区的一些优点包括：</p>
<p>与单个磁盘或文件系统分区相比，可以存储更多的数据。</p>
<p>对于那些已经失去保存意义的数据，通常可以通过删除与那些数据有关的分区，很容易地删除那些数据。相反地，在某些情况下，添加新数据的过程又可以通过为那些新数据专门增加一个新的分区，来很方便地实现。</p>
<p>通常和分区有关的其他优点包括下面列出的这些。MySQL 分区中的这些功能目前还没有实现，但是在我们的优先级列表中，具有高的优先级；我们希望在5.1的生产版本中，能包括这些功能。</p>
<p>一些查询可以得到极大的优化，这主要是借助于满足一个给定WHERE 语句的数据可以只保存在一个或多个分区内，这样在查找时就不用查找其他剩余的分区。因为分区可以在创建了分区表后进行修改，所以在第一次配置分区方案时还不曾这么做时，可以重新组织数据，来提高那些常用查询的效率。</p>
<p>涉及到例如SUM() 和 COUNT()这样聚合函数的查询，可以很容易地进行并行处理。这种查询的一个简单例子如 “SELECT salesperson_id, COUNT(orders) as order_total FROM sales GROUP BY salesperson_id；”。通过“并行”， 这意味着该查询可以在每个分区上同时进行，最终结果只需通过总计所有分区得到的结果。</p>
<p>通过跨多个磁盘来分散数据查询，来获得更大的查询吞吐量。</p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.zhex.net/mysql%e5%88%86%e5%8c%ba%e7%9a%84%e4%bc%98%e7%82%b9.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>利用 Yii Component 的特性为 Model 添加额外属性</title>
		<link>http://www.zhex.net/add-property-for-model-by-using-component-feature.html#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://www.zhex.net/add-property-for-model-by-using-component-feature.html#comments</comments>
		<pubDate>Sat, 12 Dec 2009 23:51:53 +0000</pubDate>
		<dc:creator>ZheX</dc:creator>
				<category><![CDATA[Yii Framework]]></category>
		<category><![CDATA[component]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.zhex.net/?p=408</guid>
		<description><![CDATA[Yii的使用者都知道Yii是一个基于Component开发的框架，我们平时用到的Controller，Model等其实都是Component，因此我们也可以利用Component的特性来为我们的model添加一些功能。
平时我们建立的user表总是会涉及到first_name， last_name, 而在系统中我们要用到的却经常是完整人名。

//action
$user = User::model&#40;&#41;-&#62;findByPk&#40;$id&#41;;
$this-&#62;render&#40;'show', array&#40;'user' =&#62; $user&#41;&#41;;


//view
&#60;span&#62;&#60;?php echo $user-&#62;first_name . ' '  . $user-&#62;last_name ?&#62;&#60;/span&#62;


这是我们经常会采用的方法，其实我们可以为user model 添加一个fullname属性来显示用户全名, 然后在view中直接调用这个属性就可以了

&#60;?php
//user model
class User extends CActiveRecord
&#123;
    //.......
&#160;
    public function getFullname&#40;&#41;
    &#123;
        if &#40;$this-&#62;first_name &#38;&#38; $this-&#62;last_name&#41; &#123;
      [...]


Related posts:<ol><li><a href='http://www.zhex.net/cform-in-yii-1-1.html' rel='bookmark' title='Permanent Link: Yii 1.1 新元素 CForm'>Yii 1.1 新元素 CForm</a></li>
<li><a href='http://www.zhex.net/blog-tutorial-for-yii-framework-9.html' rel='bookmark' title='Permanent Link: 教程翻译：用 Yii Framework 编写博客 – 9'>教程翻译：用 Yii Framework 编写博客 – 9</a></li>
<li><a href='http://www.zhex.net/yii-framework-generate-select-option-from-model.html' rel='bookmark' title='Permanent Link: Yii Framework: 从 model 中生成 select option'>Yii Framework: 从 model 中生成 select option</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Yii的使用者都知道Yii是一个基于Component开发的框架，我们平时用到的Controller，Model等其实都是Component，因此我们也可以利用Component的特性来为我们的model添加一些功能。</p>
<p>平时我们建立的user表总是会涉及到first_name， last_name, 而在系统中我们要用到的却经常是完整人名。</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//action</span>
<span style="color: #000088;">$user</span> <span style="color: #339933;">=</span> User<span style="color: #339933;">::</span><span style="color: #004000;">model</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">findByPk</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">render</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'show'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'user'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$user</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">//view
&lt;span&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">first_name</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">' '</span>  <span style="color: #339933;">.</span> <span style="color: #000088;">$user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">last_name</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/span&gt;</pre></div></div>

<p><span id="more-408"></span><br />
这是我们经常会采用的方法，其实我们可以为user model 添加一个fullname属性来显示用户全名, 然后在view中直接调用这个属性就可以了</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">//user model</span>
<span style="color: #000000; font-weight: bold;">class</span> User <span style="color: #000000; font-weight: bold;">extends</span> CActiveRecord
<span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">//.......</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getFullname<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">first_name</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">last_name</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">first_name</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">' '</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">last_name</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">'Unknown'</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">//view
&lt;span&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$user</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">fullname</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/span&gt;</pre></div></div>

<p>这样代码是不是清晰了很多， 我们还可以在属性那个设定函数中实现不同的现实方法。</p>


<p>Related posts:<ol><li><a href='http://www.zhex.net/cform-in-yii-1-1.html' rel='bookmark' title='Permanent Link: Yii 1.1 新元素 CForm'>Yii 1.1 新元素 CForm</a></li>
<li><a href='http://www.zhex.net/blog-tutorial-for-yii-framework-9.html' rel='bookmark' title='Permanent Link: 教程翻译：用 Yii Framework 编写博客 – 9'>教程翻译：用 Yii Framework 编写博客 – 9</a></li>
<li><a href='http://www.zhex.net/yii-framework-generate-select-option-from-model.html' rel='bookmark' title='Permanent Link: Yii Framework: 从 model 中生成 select option'>Yii Framework: 从 model 中生成 select option</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.zhex.net/add-property-for-model-by-using-component-feature.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>奋斗和蜗居</title>
		<link>http://www.zhex.net/%e5%a5%8b%e6%96%97%e5%92%8c%e8%9c%97%e5%b1%85.html#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://www.zhex.net/%e5%a5%8b%e6%96%97%e5%92%8c%e8%9c%97%e5%b1%85.html#comments</comments>
		<pubDate>Fri, 11 Dec 2009 03:00:20 +0000</pubDate>
		<dc:creator>ZheX</dc:creator>
				<category><![CDATA[休闲娱乐]]></category>
		<category><![CDATA[奋斗]]></category>
		<category><![CDATA[蜗居]]></category>

		<guid isPermaLink="false">http://www.zhex.net/?p=406</guid>
		<description><![CDATA[奋斗的编剧叫石康，纯爷们，确切年龄51岁；
蜗居的编剧叫六六，纯娘们，大概年龄36岁。 
奋斗是一个老男人写的浪漫主义的奇幻故事；
蜗居是一个小女人写的现实主义的恐怖小说。 
看了奋斗，觉得故事好假；
看了蜗居，觉得人生好假。 
奋斗也许会给人带来希望；
蜗居一定会给人带来绝望。

奋斗说的是北京那旮旯的事儿；
蜗居说的是上海一面德额事体。 
奋斗讲的是年轻人如何盖房子；
蜗居讲的是年轻人如何买房子。 
奋斗讲了几对年轻无知的男女的混乱爱情故事，主讲‘情’；
蜗居讲了一帮青春渐逝的男女的疯狂同居故事，主讲‘性’。 
奋斗努力把青涩理想的青年慢慢塑造成成熟稳重的男人；
蜗居试图把抛妻弃子的男人快速改造成重情重义的男子。 
奋斗让女人不相信男人；
蜗居让男人不相信女人。 
喜欢奋斗的观众有些真的去奋斗了；
喜欢蜗居的观众有些真的当二奶了。 
奋斗是冷酷现实的迷幻剂；
蜗居是残酷现实的催化剂。 
奋斗满足了80后最后逝去的一丝幻想情节；
蜗居刺痛了80后正在面临的一个严酷现实。


No related posts.


No related posts.]]></description>
			<content:encoded><![CDATA[<p>奋斗的编剧叫石康，纯爷们，确切年龄51岁；<br />
蜗居的编剧叫六六，纯娘们，大概年龄36岁。 </p>
<p>奋斗是一个老男人写的浪漫主义的奇幻故事；<br />
蜗居是一个小女人写的现实主义的恐怖小说。 </p>
<p>看了奋斗，觉得故事好假；<br />
看了蜗居，觉得人生好假。 </p>
<p>奋斗也许会给人带来希望；<br />
蜗居一定会给人带来绝望。<br />
<span id="more-406"></span><br />
奋斗说的是北京那旮旯的事儿；<br />
蜗居说的是上海一面德额事体。 </p>
<p>奋斗讲的是年轻人如何盖房子；<br />
蜗居讲的是年轻人如何买房子。 </p>
<p>奋斗讲了几对年轻无知的男女的混乱爱情故事，主讲‘情’；<br />
蜗居讲了一帮青春渐逝的男女的疯狂同居故事，主讲‘性’。 </p>
<p>奋斗努力把青涩理想的青年慢慢塑造成成熟稳重的男人；<br />
蜗居试图把抛妻弃子的男人快速改造成重情重义的男子。 </p>
<p>奋斗让女人不相信男人；<br />
蜗居让男人不相信女人。 </p>
<p>喜欢奋斗的观众有些真的去奋斗了；<br />
喜欢蜗居的观众有些真的当二奶了。 </p>
<p>奋斗是冷酷现实的迷幻剂；<br />
蜗居是残酷现实的催化剂。 </p>
<p>奋斗满足了80后最后逝去的一丝幻想情节；<br />
蜗居刺痛了80后正在面临的一个严酷现实。</p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.zhex.net/%e5%a5%8b%e6%96%97%e5%92%8c%e8%9c%97%e5%b1%85.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
