<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Idea Grapes</title>
	
	<link>http://blog.yoren.info</link>
	<description>Think Different</description>
	<lastBuildDate>Fri, 15 May 2009 16:57:29 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<geo:lat>25</geo:lat><geo:long>121</geo:long><creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/2.0/</creativeCommons:license><image><link>http://creativecommons.org/licenses/by-nc-sa/2.0/</link><url>http://creativecommons.org/images/public/somerights20.gif</url><title>Some Rights Reserved</title></image><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/IdeaGrapes" type="application/rss+xml" /><feedburner:emailServiceId>IdeaGrapes</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><feedburner:browserFriendly>This is an XML content feed. It is intended to be viewed in a newsreader or syndicated to another site.</feedburner:browserFriendly><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
		<title>在有序清單（ordered list）的編號和內文使用不同字型</title>
		<link>http://feedproxy.google.com/~r/IdeaGrapes/~3/RN1H0_MGGD0/</link>
		<comments>http://blog.yoren.info/2009/05/ol-%e7%b7%a8%e8%99%9f-%e5%ad%97%e5%9e%8b/#comments</comments>
		<pubDate>Fri, 15 May 2009 16:57:29 +0000</pubDate>
		<dc:creator>yoren</dc:creator>
				<category><![CDATA[Webdev]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[xhtml]]></category>

		<guid isPermaLink="false">http://blog.yoren.info/?p=810</guid>
		<description><![CDATA[
來自Web Designer Wall的一篇舊文「Style Your Ordered List」，介紹如何讓有序清單（ordered list，ol元素）的編號和內文使用不同的字型。
方法很簡單，編號的字型設定在ol的CSS樣式裡面，內文的字型則設定在ol p裡面（我之前一直沒想到可以這樣設）：

ol {
  font: italic 1em Georgia, Times, serif;
  color: #999999;
}


ol p {
  font: normal .8em Arial, Helvetica, sans-serif;
  color: #000000;
}

最後的成品就會長成這樣（編號的數字是用Georgia字型，內文則是Arial）：

]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.webdesignerwall.com/tutorials/style-your-ordered-list/"><img src="http://blog.yoren.info/wp-content/uploads/2009/05/ol-overview.gif" alt="Style Your Ordered List" title="Style Your Ordered List" width="480" height="132" class="alignnone size-full wp-image-811" /></a></p>
<p>來自<a href="http://www.webdesignerwall.com/">Web Designer Wall</a>的一篇舊文「<a href="http://www.webdesignerwall.com/tutorials/style-your-ordered-list/">Style Your Ordered List</a>」，介紹如何讓有序清單（ordered list，ol元素）的編號和內文使用不同的字型。</p>
<p>方法很簡單，編號的字型設定在<code>ol</code>的CSS樣式裡面，內文的字型則設定在<code>ol p</code>裡面（我之前一直沒想到可以這樣設）：</p>
<pre class="brush: css">
ol {
  font: italic 1em Georgia, Times, serif;
  color: #999999;
}
</pre>
<pre class="brush: css">
ol p {
  font: normal .8em Arial, Helvetica, sans-serif;
  color: #000000;
}
</pre>
<p>最後的成品就會長成這樣（編號的數字是用Georgia字型，內文則是Arial）：<br />
<img src="http://blog.yoren.info/wp-content/uploads/2009/05/ol-3.gif" alt="stylish ordered list" title="stylish ordered list" width="132" height="87" class="alignnone size-full wp-image-812" /></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/IdeaGrapes?a=RN1H0_MGGD0:ot5r86L1A5s:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/IdeaGrapes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/IdeaGrapes?a=RN1H0_MGGD0:ot5r86L1A5s:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/IdeaGrapes?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/IdeaGrapes?a=RN1H0_MGGD0:ot5r86L1A5s:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/IdeaGrapes?i=RN1H0_MGGD0:ot5r86L1A5s:D7DqB2pKExk" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/IdeaGrapes/~4/RN1H0_MGGD0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.yoren.info/2009/05/ol-%e7%b7%a8%e8%99%9f-%e5%ad%97%e5%9e%8b/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://blog.yoren.info/2009/05/ol-%e7%b7%a8%e8%99%9f-%e5%ad%97%e5%9e%8b/</feedburner:origLink></item>
		<item>
		<title>Firefinder for Firebug</title>
		<link>http://feedproxy.google.com/~r/IdeaGrapes/~3/7LX0tkPN3x8/</link>
		<comments>http://blog.yoren.info/2009/05/firefinder-for-firebug/#comments</comments>
		<pubDate>Wed, 13 May 2009 16:10:44 +0000</pubDate>
		<dc:creator>yoren</dc:creator>
				<category><![CDATA[Webdev]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[extensions]]></category>
		<category><![CDATA[firebug]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[xpath]]></category>

		<guid isPermaLink="false">http://blog.yoren.info/?p=806</guid>
		<description><![CDATA[
Firefinder是Firebug的擴充套件，用來快速找到網頁中，符合特定CSS選擇器或是XPath表達式的HTML元素。
Firefinder的面板內會顯示符合的筆數並將這些元素條列出來，在網頁中也會用紅色虛線框將他們標示出來；當滑鼠指向面板內列出的某個元素時，網頁內相應的元素則會用藍色虛線框標示。
安裝完畢後，開啟Firefinder面板的快捷鍵是Ctrl（Command）+ Shift + V。
]]></description>
			<content:encoded><![CDATA[<p><a href="http://robertnyman.com/firefinder/"><img src="http://blog.yoren.info/wp-content/uploads/2009/05/firefinder-500x308.png" alt="firefinder" title="firefinder" width="500" height="308" class="alignnone size-large wp-image-807" /></a></p>
<p><a href="http://robertnyman.com/firefinder/">Firefinder</a>是Firebug的擴充套件，用來快速找到網頁中，符合特定CSS選擇器或是XPath表達式的HTML元素。</p>
<p>Firefinder的面板內會顯示符合的筆數並將這些元素條列出來，在網頁中也會用紅色虛線框將他們標示出來；當滑鼠指向面板內列出的某個元素時，網頁內相應的元素則會用藍色虛線框標示。</p>
<p>安裝完畢後，開啟Firefinder面板的快捷鍵是Ctrl（Command）+ Shift + V。</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/IdeaGrapes?a=7LX0tkPN3x8:_QMBqDdJMXY:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/IdeaGrapes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/IdeaGrapes?a=7LX0tkPN3x8:_QMBqDdJMXY:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/IdeaGrapes?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/IdeaGrapes?a=7LX0tkPN3x8:_QMBqDdJMXY:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/IdeaGrapes?i=7LX0tkPN3x8:_QMBqDdJMXY:D7DqB2pKExk" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/IdeaGrapes/~4/7LX0tkPN3x8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.yoren.info/2009/05/firefinder-for-firebug/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.yoren.info/2009/05/firefinder-for-firebug/</feedburner:origLink></item>
		<item>
		<title>[圖解版] 如果世界是100人村</title>
		<link>http://feedproxy.google.com/~r/IdeaGrapes/~3/Ri8u-mM9KIU/</link>
		<comments>http://blog.yoren.info/2009/05/%e5%a6%82%e6%9e%9c%e4%b8%96%e7%95%8c%e6%98%af100%e4%ba%ba%e6%9d%91/#comments</comments>
		<pubDate>Fri, 08 May 2009 17:56:47 +0000</pubDate>
		<dc:creator>yoren</dc:creator>
				<category><![CDATA[ideagrapes]]></category>
		<category><![CDATA[art]]></category>
		<category><![CDATA[gay]]></category>
		<category><![CDATA[illustration]]></category>
		<category><![CDATA[sex]]></category>

		<guid isPermaLink="false">http://blog.yoren.info/?p=797</guid>
		<description><![CDATA[
Toby Ng Kwong To的創作：圖解版如果世界是100人村（If the world were a village of 100 people），用相關的圖像隱喻來展示這些數據。我特別喜歡的是上面這張香蕉：
如果世界是 100 人村，有 10 人是同性戀，90 人是異性戀。
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.toby-ng.com/graphic-design/the-world-of-100/"><img src="http://blog.yoren.info/wp-content/uploads/2009/05/33_100-print12.jpg" alt="原文是：89 人是異性戀，11 人是同性戀" title="原文是：89 人是異性戀，11 人是同性戀" width="354" height="500" class="alignnone size-full wp-image-798" /></a></p>
<p>Toby Ng Kwong To的創作：<a href="http://www.toby-ng.com/graphic-design/the-world-of-100/">圖解版如果世界是100人村</a>（If the world were a village of 100 people），用相關的圖像隱喻來展示這些數據。我特別喜歡的是上面這張香蕉：</p>
<blockquote><p>如果世界是 100 人村，有 10 人是同性戀，90 人是異性戀。</p></blockquote>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/IdeaGrapes?a=Ri8u-mM9KIU:EtpzNHF203Y:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/IdeaGrapes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/IdeaGrapes?a=Ri8u-mM9KIU:EtpzNHF203Y:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/IdeaGrapes?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/IdeaGrapes?a=Ri8u-mM9KIU:EtpzNHF203Y:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/IdeaGrapes?i=Ri8u-mM9KIU:EtpzNHF203Y:D7DqB2pKExk" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/IdeaGrapes/~4/Ri8u-mM9KIU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.yoren.info/2009/05/%e5%a6%82%e6%9e%9c%e4%b8%96%e7%95%8c%e6%98%af100%e4%ba%ba%e6%9d%91/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.yoren.info/2009/05/%e5%a6%82%e6%9e%9c%e4%b8%96%e7%95%8c%e6%98%af100%e4%ba%ba%e6%9d%91/</feedburner:origLink></item>
		<item>
		<title>TimThumb：PHP縮圖程式</title>
		<link>http://feedproxy.google.com/~r/IdeaGrapes/~3/Zrw7YrK7_Wc/</link>
		<comments>http://blog.yoren.info/2009/05/php%e7%b8%ae%e5%9c%96%e7%a8%8b%e5%bc%8f-timthumb/#comments</comments>
		<pubDate>Wed, 06 May 2009 17:22:06 +0000</pubDate>
		<dc:creator>yoren</dc:creator>
				<category><![CDATA[Webdev]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://blog.yoren.info/?p=791</guid>
		<description><![CDATA[
TimThumb原本是應用在Mimbo Pro這套WordPress佈景主題裡面的PHP縮圖程式，後來開發團隊將它獨立為一個開放原始碼專案，造福更多的使用者。
TimThumb用更精簡的程式碼來達成phpThumb的功能，並且加入PNG和GIF圖檔的支援，也使用快取來提高程式的效能。
使用時請將TimThumb.php引入後，使用以下語法載入網站上的圖片：

&#60;img src=&#34;/scripts/timthumb.php?src=/images/whatever.jpg&#38;h=150&#38;w=150&#38;zc=1&#34; alt=&#34;&#34;&#62;

參數的意義如下：

w: 縮圖寬度
h: 縮圖高度
zc: 是否裁切圖片 (0 或 1)
q: 壓縮品質 (預設為 75，最大值為 100)

而其他需要注意的事項有：

請開啟主機上的GD library。
程式會在所在位置建立名為「cache」的子資料夾，如果主機權限不允許的話，請手動建立同名資料夾，並將此資料夾權限設定為 777。
此外，TimThumb所在的資料夾，其權限也需要開到 777。
如同範例網頁顯示，請使用絕對路徑來表示程式和圖片的位置。
想要更加快圖片載入速度的話，請將這些規則加到你的 .htaccess檔案中。

]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.darrenhoyt.com/2008/04/02/timthumb-php-script-released/"><img src="http://blog.yoren.info/wp-content/uploads/2009/05/picture-1-500x390.png" alt="TimThumb" title="TimThumb" width="500" height="390" class="alignnone size-large wp-image-792" /></a></p>
<p><a href="http://timthumb.googlecode.com/svn/trunk/timthumb.php" title="放在GoogleCode的程式原始碼">TimThumb</a>原本是應用在<a href="http://www.darrenhoyt.com/2009/03/15/mimbo-pro-20-released/">Mimbo Pro</a>這套<span class='bm_keywordlink'><a href="http://wordpress.org">WordPress</a></span>佈景主題裡面的PHP縮圖程式，後來開發團隊將它獨立為一個開放原始碼專案，造福更多的使用者。</p>
<p><a href="http://timthumb.googlecode.com/svn/trunk/timthumb.php" title="放在GoogleCode的程式原始碼">TimThumb</a>用更精簡的程式碼來達成<a href="http://phpthumb.sourceforge.net/">phpThumb</a>的功能，並且加入PNG和GIF圖檔的支援，也使用快取來提高程式的效能。</p>
<p>使用時請將TimThumb.php引入後，使用以下語法載入網站上的圖片：</p>
<pre class="brush: xhtml">
&lt;img src=&quot;/scripts/timthumb.php?src=/images/whatever.jpg&amp;h=150&amp;w=150&amp;zc=1&quot; alt=&quot;&quot;&gt;
</pre>
<p>參數的意義如下：</p>
<ul>
<li>w: 縮圖寬度</li>
<li>h: 縮圖高度</li>
<li>zc: 是否裁切圖片 (0 或 1)</li>
<li>q: 壓縮品質 (預設為 75，最大值為 100)</li>
</ul>
<p>而其他需要注意的事項有：</p>
<ul>
<li>請開啟主機上的GD library。</li>
<li>程式會在所在位置建立名為「cache」的子資料夾，如果主機權限不允許的話，請手動建立同名資料夾，並將此資料夾權限設定為 777。</li>
<li>此外，TimThumb所在的資料夾，其權限也需要開到 777。</li>
<li>如同<a href="http://www.darrenhoyt.com/demo/timthumb/">範例網頁</a>顯示，請使用絕對路徑來表示程式和圖片的位置。</li>
<li>想要更加快圖片載入速度的話，請將<a href="http://code.google.com/p/timthumb/source/browse/trunk/.htaccess">這些規則</a>加到你的 .htaccess檔案中。</li>
</ul>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/IdeaGrapes?a=Zrw7YrK7_Wc:fY5okg1eV-Y:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/IdeaGrapes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/IdeaGrapes?a=Zrw7YrK7_Wc:fY5okg1eV-Y:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/IdeaGrapes?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/IdeaGrapes?a=Zrw7YrK7_Wc:fY5okg1eV-Y:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/IdeaGrapes?i=Zrw7YrK7_Wc:fY5okg1eV-Y:D7DqB2pKExk" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/IdeaGrapes/~4/Zrw7YrK7_Wc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.yoren.info/2009/05/php%e7%b8%ae%e5%9c%96%e7%a8%8b%e5%bc%8f-timthumb/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://blog.yoren.info/2009/05/php%e7%b8%ae%e5%9c%96%e7%a8%8b%e5%bc%8f-timthumb/</feedburner:origLink></item>
		<item>
		<title>多行 JavaScript</title>
		<link>http://feedproxy.google.com/~r/IdeaGrapes/~3/gvyR3CJ3Oa0/</link>
		<comments>http://blog.yoren.info/2009/05/javascript-multiline/#comments</comments>
		<pubDate>Tue, 05 May 2009 11:19:27 +0000</pubDate>
		<dc:creator>yoren</dc:creator>
				<category><![CDATA[Webdev]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://blog.yoren.info/?p=777</guid>
		<description><![CDATA[在Snook.ca看到的，在寫JavaScript的時候，脫逸字元「\」也可以用來讓程式碼換行：

var a = &#039;You can start here \
and continue here \
and then finish it up here.&#039;;

— I can&#8217;t believe I didn&#8217;t know that. 筆記&#8230;
]]></description>
			<content:encoded><![CDATA[<p>在<a href="http://snook.ca/archives/javascript/multi-line-javascript" title="Multi-line JavaScript">Snook.ca看到的</a>，在寫JavaScript的時候，脫逸字元「\」也可以用來讓程式碼換行：</p>
<pre class="brush: javascript">
var a = &#039;You can start here \
and continue here \
and then finish it up here.&#039;;
</pre>
<p>— I can&#8217;t believe I didn&#8217;t know that. 筆記&#8230;</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/IdeaGrapes?a=gvyR3CJ3Oa0:u0xiee5bggY:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/IdeaGrapes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/IdeaGrapes?a=gvyR3CJ3Oa0:u0xiee5bggY:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/IdeaGrapes?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/IdeaGrapes?a=gvyR3CJ3Oa0:u0xiee5bggY:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/IdeaGrapes?i=gvyR3CJ3Oa0:u0xiee5bggY:D7DqB2pKExk" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/IdeaGrapes/~4/gvyR3CJ3Oa0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.yoren.info/2009/05/javascript-multiline/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.yoren.info/2009/05/javascript-multiline/</feedburner:origLink></item>
		<item>
		<title>解析jQuery Selectors的效能</title>
		<link>http://feedproxy.google.com/~r/IdeaGrapes/~3/y6ZP7pJddKo/</link>
		<comments>http://blog.yoren.info/2009/05/jquery-selectors-%e6%95%88%e8%83%bd/#comments</comments>
		<pubDate>Thu, 30 Apr 2009 17:50:13 +0000</pubDate>
		<dc:creator>yoren</dc:creator>
				<category><![CDATA[Webdev]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://blog.yoren.info/?p=772</guid>
		<description><![CDATA[
Stéphane Caron在解析jQuery Selectors的效能這篇文章中，比較了三種selector的執行效能，有以下的發現：

$(’.element’) > $(’div.element’) > $(’div.element:first’)，表示使用selector的時候，越簡單（層級越少）越好。
在position selectors的部份，也有相同的結果（越簡單越好）：$(’.sample-elements:first’) > $(’.sample-elements .last:last’), $(’.sample-elements div.last:last’) > $(’.sample-elements div:first’) > $(’.sample-elements div:eq(2)’)。
ID selectors 如 $(’#second’) 效能遠大於 class selectors，不但執行時間最短，呼叫次數也是最少的。

]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.no-margin-for-errors.com/projects/how-to-optimize-jquery-selectors/"><img src="http://blog.yoren.info/wp-content/uploads/2009/05/graph_3.gif" alt="pictures from http://www.no-margin-for-errors.com/" title="pictures from http://www.no-margin-for-errors.com/" width="462" height="251" class="alignnone size-full wp-image-773" /></a></p>
<p>Stéphane Caron在<a href="http://www.no-margin-for-errors.com/2009/04/28/demystifying-the-jquery-selectors-optimization/" title="Demystifying the jQuery selectors optimization">解析jQuery Selectors的效能</a>這篇文章中，<a href="http://www.no-margin-for-errors.com/projects/how-to-optimize-jquery-selectors/" title="How to: Optimize your jQuery selectors by: Stéphane Caron">比較了三種selector的執行效能</a>，有以下的發現：</p>
<ol>
<li>$(’.element’) > $(’div.element’) > $(’div.element:first’)，表示使用selector的時候，<strong>越簡單（層級越少）越好</strong>。</li>
<li>在position selectors的部份，也有相同的結果（越簡單越好）：$(’.sample-elements:first’) > $(’.sample-elements .last:last’), $(’.sample-elements div.last:last’) > $(’.sample-elements div:first’) > $(’.sample-elements div:eq(2)’)。</li>
<li><strong>ID selectors</strong> 如 $(’#second’) 效能遠大於 class selectors，不但執行時間最短，呼叫次數也是最少的。</li>
</ol>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/IdeaGrapes?a=y6ZP7pJddKo:hGpWq3XYMJI:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/IdeaGrapes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/IdeaGrapes?a=y6ZP7pJddKo:hGpWq3XYMJI:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/IdeaGrapes?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/IdeaGrapes?a=y6ZP7pJddKo:hGpWq3XYMJI:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/IdeaGrapes?i=y6ZP7pJddKo:hGpWq3XYMJI:D7DqB2pKExk" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/IdeaGrapes/~4/y6ZP7pJddKo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.yoren.info/2009/05/jquery-selectors-%e6%95%88%e8%83%bd/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://blog.yoren.info/2009/05/jquery-selectors-%e6%95%88%e8%83%bd/</feedburner:origLink></item>
		<item>
		<title>Gameboy Timeline</title>
		<link>http://feedproxy.google.com/~r/IdeaGrapes/~3/ltyd832Jdt8/</link>
		<comments>http://blog.yoren.info/2009/04/gameboy-timeline/#comments</comments>
		<pubDate>Tue, 28 Apr 2009 16:33:37 +0000</pubDate>
		<dc:creator>yoren</dc:creator>
				<category><![CDATA[ideagrapes]]></category>
		<category><![CDATA[gameboy]]></category>
		<category><![CDATA[Nintendo]]></category>

		<guid isPermaLink="false">http://blog.yoren.info/?p=749</guid>
		<description><![CDATA[
任天堂的Gameboy陪伴我們度過美好的童年時光，近來更有成為台北通勤族標準配備的趨勢，20年前的4月21日是它誕生的日子。Gizmodo上面有人分享了一張Gameboy Timeline的精彩大圖，帶領我們往回追溯到一世紀以前的紙牌，再一路追蹤到今年新上市的DSi。值得一看。
]]></description>
			<content:encoded><![CDATA[<p><a href="http://cache.gawker.com/assets/images/gizmodo/2009/04/gameboy-timeline-HD2.jpg" rel="lightbox"><img src="http://blog.yoren.info/wp-content/uploads/2009/04/gameboy-timeline-ld2-500x337.jpg" alt="Gameboy Timeline" title="Gameboy Timeline" width="500" height="337" class="alignnone size-large wp-image-750" /></a></p>
<p>任天堂的Gameboy陪伴我們度過美好的童年時光，近來更有成為台北通勤族標準配備的趨勢，20年前的4月21日是它誕生的日子。<a href="http://gizmodo.com/5222211/the-definitive-game-boy-timeline">Gizmodo上面</a>有人分享了一張<a href="http://cache.gawker.com/assets/images/gizmodo/2009/04/gameboy-timeline-HD2.jpg">Gameboy Timeline的精彩大圖</a>，帶領我們往回追溯到一世紀以前的紙牌，再一路追蹤到今年新上市的<a href="http://en.wikipedia.org/wiki/Nintendo_DSi">DSi</a>。值得一看。</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/IdeaGrapes?a=ltyd832Jdt8:5NXUquWjVOQ:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/IdeaGrapes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/IdeaGrapes?a=ltyd832Jdt8:5NXUquWjVOQ:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/IdeaGrapes?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/IdeaGrapes?a=ltyd832Jdt8:5NXUquWjVOQ:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/IdeaGrapes?i=ltyd832Jdt8:5NXUquWjVOQ:D7DqB2pKExk" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/IdeaGrapes/~4/ltyd832Jdt8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.yoren.info/2009/04/gameboy-timeline/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.yoren.info/2009/04/gameboy-timeline/</feedburner:origLink></item>
		<item>
		<title>介紹短網址服務：u.nu及其API</title>
		<link>http://feedproxy.google.com/~r/IdeaGrapes/~3/kT9md1Z4IJk/</link>
		<comments>http://blog.yoren.info/2009/04/unu-api/#comments</comments>
		<pubDate>Tue, 28 Apr 2009 08:18:51 +0000</pubDate>
		<dc:creator>yoren</dc:creator>
				<category><![CDATA[Webdev]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[tinyURL]]></category>

		<guid isPermaLink="false">http://blog.yoren.info/?p=727</guid>
		<description><![CDATA[
u.nu是一個新興的短網址服務（常見的有：tinyURL、0rz.tw等），它的特色有：

u.nu是最短的網址。
u.nu不使用相似的字元，例如 l, 1, I, 0, 和 O。
u.nu將大小寫字母視為相同，因此可方便地念給朋友聽，或用手機傳簡訊給他們。
u.nu是回文（正讀反讀都相同的詞組，忽略那個點的話）。

而David Walsh介紹了怎麼使用u.nu的API：

function get_unu_url($url)
{
	$url = &#039;http://u.nu/unu-api-simple?url=&#039;.urlencode($url);
	$ch = curl_init();
	$timeout = 5;
	curl_setopt($ch,CURLOPT_URL,$url);
	curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
	curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
	$url = curl_exe*c($ch); // 請注意這邊的星號要移除
	curl_close($ch);
	return trim($url);
}

$short_url = get_unu_url(&#039;http://blog.yoren.info&#039;);
//returns http://u.nu/78x

比起其他短網址服務的API，u.nu沒有用到xml或json，單單就回傳網址，十分簡潔。
有趣的是David文章的回應裡面，有人問到了網域名稱可以使用一個字元而已嗎？根據wiki上 .nu網域的說明，一個字元的網域名稱，年費為500歐元，兩個字元為250歐，其餘則是30歐。而似乎所有的單字元網址都被註冊了。
附註：上面的原始碼中，第9行的地方我多加了一個 * 號，是因為我如果直接寫出curl_exec，就會引起HTTP 503錯誤，非常奇怪。
]]></description>
			<content:encoded><![CDATA[<p><a href="http://u.nu"><img src="http://blog.yoren.info/wp-content/uploads/2009/04/picture-12.png" alt="短網址服務：u.nu" title="短網址服務：u.nu" width="461" height="244" class="alignnone size-full wp-image-744" /></a></p>
<p><a href="http://u.nu">u.nu</a>是一個新興的短網址服務（常見的有：<a href="http://tinyurl.com">tinyURL</a>、<a href="http://0rz.tw/">0rz.tw</a>等），它的特色有：</p>
<ol>
<li><span class='bm_keywordlink'><a href="http://u.nu">u.nu</a></span>是最短的網址。</li>
<li>u.nu不使用相似的字元，例如 l, 1, I, 0, 和 O。</li>
<li>u.nu將大小寫字母視為相同，因此可方便地念給朋友聽，或用手機傳簡訊給他們。</li>
<li>u.nu是回文（正讀反讀都相同的詞組，忽略那個點的話）。</li>
</ol>
<p>而<a href="http://davidwalsh.name/">David Walsh</a>介紹了<a href="http://davidwalsh.name/create-short-urls-unu" title="Create Short URLs Using U.Nu">怎麼使用u.nu的API</a>：</p>
<pre class="brush: php">
function get_unu_url($url)
{
	$url = &#039;http://u.nu/unu-api-simple?url=&#039;.urlencode($url);
	$ch = curl_init();
	$timeout = 5;
	curl_setopt($ch,CURLOPT_URL,$url);
	curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
	curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
	$url = curl_exe*c($ch); // 請注意這邊的星號要移除
	curl_close($ch);
	return trim($url);
}

$short_url = get_unu_url(&#039;http://blog.yoren.info&#039;);
//returns http://u.nu/78x
</pre>
<p>比起其他短網址服務的API，u.nu沒有用到xml或json，單單就回傳網址，十分簡潔。</p>
<p>有趣的是<a href="http://davidwalsh.name/create-short-urls-unu" title="Create Short URLs Using U.Nu">David文章</a>的回應裡面，有人問到了網域名稱可以使用一個字元而已嗎？根據<a href="http://en.wikipedia.org/wiki/.nu">wiki上 .nu網域的說明</a>，一個字元的網域名稱，年費為500歐元，兩個字元為250歐，其餘則是30歐。而似乎所有的單字元網址都被註冊了。</p>
<p>附註：上面的原始碼中，第9行的地方我多加了一個 * 號，是因為我如果直接寫出curl_exec，就會引起HTTP 503錯誤，非常奇怪。</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/IdeaGrapes?a=kT9md1Z4IJk:ze593Vk__Qs:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/IdeaGrapes?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/IdeaGrapes?a=kT9md1Z4IJk:ze593Vk__Qs:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/IdeaGrapes?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/IdeaGrapes?a=kT9md1Z4IJk:ze593Vk__Qs:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/IdeaGrapes?i=kT9md1Z4IJk:ze593Vk__Qs:D7DqB2pKExk" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/IdeaGrapes/~4/kT9md1Z4IJk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.yoren.info/2009/04/unu-api/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://blog.yoren.info/2009/04/unu-api/</feedburner:origLink></item>
	</channel>
</rss>
