<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6263527</id><updated>2024-08-30T08:32:00.216+08:00</updated><category term="web"/><category term="api"/><category term="programming"/><category term="development"/><category term="news"/><category term="fun"/><category term="mobile"/><category term="random"/><category term="thoughts"/><category term="trip"/><title type='text'>Blog JY</title><subtitle type='html'>Jottings &amp; Yaks from JY</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://blog-jy.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6263527/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://blog-jy.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>JY</name><uri>http://www.blogger.com/profile/06133384347588330758</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>13</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6263527.post-8702882361643673703</id><published>2008-10-07T19:11:00.006+08:00</published><updated>2008-10-07T19:25:07.246+08:00</updated><title type='text'>台北 101 大樓觀景台</title><content type='html'>拿到兩張台北 101 大樓觀景台的票，九月底就要截止了。雖然天氣不好，但眼看號稱今年最強的薔蜜颱風要撲台了，所以趁這個週末跟 Oberon 趕快去參觀，順便測試使用 &lt;a href=&quot;http://www.i-gotu.com/&quot;&gt;i-gotU&lt;/a&gt; 軌跡記錄器，搭配 &lt;a href=&quot;http://www.a-trip.com/&quot;&gt;@trip&lt;/a&gt; 服務的效果。&lt;br /&gt;&lt;br /&gt;點取底下地圖可以看到詳細內容：&lt;br /&gt;&lt;center&gt;&lt;br /&gt;&lt;iframe style=&quot;border: 1px solid gray;&quot; src=&quot;http://www.a-trip.com/tracks/map/4481?color=FF0000&amp;amp;opacity=0.7&amp;amp;type=hybrid&amp;amp;width=4&quot; scrolling=&quot;no&quot; width=&quot;450&quot; frameborder=&quot;0&quot; height=&quot;450&quot;&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;/center&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog-jy.blogspot.com/feeds/8702882361643673703/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6263527/8702882361643673703' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6263527/posts/default/8702882361643673703'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6263527/posts/default/8702882361643673703'/><link rel='alternate' type='text/html' href='http://blog-jy.blogspot.com/2008/10/101.html' title='台北 101 大樓觀景台'/><author><name>JY</name><uri>http://www.blogger.com/profile/06133384347588330758</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6263527.post-8820352698542343989</id><published>2008-09-09T02:28:00.015+08:00</published><updated>2008-09-12T14:40:46.926+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="programming"/><title type='text'>深入 qsort(3)</title><content type='html'>如果你有學過演算法或資料結構，相信對 &lt;a href=&quot;http://en.wikipedia.org/wiki/Quicksort&quot;&gt;quicksort&lt;/a&gt; 一定不會陌生，或許細節忘了，但是至少應該有聽過。實作 quicksort 讓我們學習到重要的「divide and conquer」設計典範 (design paradigm)，並且對於操作邊界值有更精確的體體認。我每隔一段時間都會重新實作幾個典型的排序演算法，例如 quicksort、&lt;a href=&quot;http://en.wikipedia.org/wiki/Insertion_sort&quot;&gt;insertion sort&lt;/a&gt;、&lt;a href=&quot;http://en.wikipedia.org/wiki/Bubble_sort&quot;&gt;bubble sort&lt;/a&gt;、&lt;a href=&quot;http://en.wikipedia.org/wiki/Heapsort&quot;&gt;heapsort&lt;/a&gt;、&lt;a href=&quot;http://en.wikipedia.org/wiki/Merge_sort&quot;&gt;merge sort&lt;/a&gt; 等等。藉此磨練自己的 coding 技巧，靈活一下自己的腦袋。&lt;br /&gt;&lt;br /&gt;實作 quicksort 時，不免讓人想到 standard C library 中的 qsort(3)。從 qsort 這個字眼上，很直覺地想到他可能是由 quicksort 這個名稱來的，甚至直覺地推斷 qsort 就是 quicksort 的實作。實際上只答對了一半，qsort 遠比我原本想像的還要複雜。參考 GNU libc 2.4 中 qsort 的實作部分，在記憶體方面，運用了不少跟硬體平台相關的特性，以加速記憶體的處理。撇開平台相依部分不談，單就演算法設計方面來看也有很多巧妙之處。&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;void qsort(void *&lt;span style=&quot;font-style: italic;&quot;&gt;base&lt;/span&gt;, size_t &lt;span style=&quot;font-style: italic;&quot;&gt;nmemb&lt;/span&gt;, size_t &lt;span style=&quot;font-style: italic;&quot;&gt;size&lt;/span&gt;, &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;           int(*&lt;span style=&quot;font-style: italic;&quot;&gt;compar&lt;/span&gt;)(const void *, const void *));&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;首先，qsort 會先判斷欲排列元素個數 size 是否小於 1024，若小於 1024 則呼叫 &lt;code&gt;msort_with_tmp&lt;/code&gt; 來處理。&lt;code&gt;msort_with_tmp&lt;/code&gt; 實作 merge sort 演算法，最後一個參數是一個 size 大小的 buffer，作為 merge sort 所需的 &lt;span style=&quot;font-style: italic;&quot;&gt;O(n)&lt;/span&gt; 空間之用，可以避免過於頻繁的記憶體配置。若是 size 大於 1024，則會根據目前系統的記憶體狀況，決定該使用什麼演算法。在最壞情況下，merge sort 演算法的時間複雜度是 &lt;span style=&quot;font-style: italic;&quot;&gt;O(n log n)&lt;/span&gt;，好過 quicksort 的 &lt;span style=&quot;font-style: italic;&quot;&gt;O(n&lt;sup&gt;2&lt;/sup&gt;)&lt;/span&gt;。由於 merge sort 需要額外的 &lt;span style=&quot;font-style: italic;&quot;&gt;O(n)&lt;/span&gt; 空間，所以在記憶體空間允許的條件之下，會優先使用 merge sort，否則便呼叫 &lt;code&gt;_quicksort&lt;/code&gt;。&lt;br /&gt;&lt;br /&gt;&lt;code&gt;_quicksort&lt;/code&gt; 實作一個真正的 quicksort 演算法，並採用以下幾點優化的設計：&lt;br /&gt;&lt;ol&gt;&lt;li&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;Non-recursive (非遞迴)&lt;/span&gt; - 使用 stack 資料結構取代遞迴呼叫所需要的 function stack，增進程式執行效率。實際上這個 stack 不用太大，在 32-bit 環境下，最多只需要 32 個元素空間 (在 64-bit 環境下，則為 64 個)。為什麼是 32？因為在 32-bit 環境下 size_t 為 32-bit，&lt;span style=&quot;font-style: italic;&quot;&gt;log 2&lt;/span&gt;&lt;sup style=&quot;font-style: italic;&quot;&gt;32&lt;/sup&gt; 為 32。&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;以 median-of-three 方法決定 pivot&lt;/span&gt; - 一般 quicksort 演算法通常取開頭元素當作 pivot，但這往往不是一個理想的值，尤其對於已排序的陣列來說，會造成最壞的結果。以陣列開頭、最後與中間位置三值的中位數當作 pivot，比較有機會取到較理想的值。&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;混合 insertion sort 增加效率&lt;/span&gt; - 對於元素個數少於某個 threshold 的 partition，使用 insertion sort 能夠大大地增加執行效率。對於小陣列而言，insertion sort 會比 quicksort 來的有效率許多。在 GNU libc 2.4 實作中，此 threshold 值設定為 4 (MAX_THRESH)，個人感覺太小了點。有些實作將它設定為 8，如 Visual C++。&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;較小的 partition 優先處理&lt;/span&gt; - 換言之，較大的 partition 先放入 stack 中，此舉保證 &lt;span style=&quot;font-style: italic;&quot;&gt;log(size)&lt;/span&gt; 不會超過 stack 大小。&lt;/li&gt;&lt;/ol&gt;多讀經典程式碼，實在獲益良多啊！</content><link rel='replies' type='application/atom+xml' href='http://blog-jy.blogspot.com/feeds/8820352698542343989/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6263527/8820352698542343989' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6263527/posts/default/8820352698542343989'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6263527/posts/default/8820352698542343989'/><link rel='alternate' type='text/html' href='http://blog-jy.blogspot.com/2008/09/qsort3.html' title='深入 qsort(3)'/><author><name>JY</name><uri>http://www.blogger.com/profile/06133384347588330758</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6263527.post-6341055712965543457</id><published>2007-12-31T01:48:00.000+08:00</published><updated>2007-12-31T10:35:57.326+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="api"/><category scheme="http://www.blogger.com/atom/ns#" term="development"/><category scheme="http://www.blogger.com/atom/ns#" term="programming"/><category scheme="http://www.blogger.com/atom/ns#" term="web"/><title type='text'>開發 JavaScript 利器 - Prototype</title><content type='html'>最近為了開發 &lt;a href=&quot;http://en.wikipedia.org/wiki/AJAX&quot;&gt;AJAX&lt;/a&gt; 網站，需要找一套支援 AJAX 的程式庫，想到了前一陣子發現的 &lt;a href=&quot;http://script.aculo.us/&quot;&gt;script.aculo.us&lt;/a&gt; 這套 JavaScript 程式庫。script.aculo.us 裡面提供了很多令人讚嘆的 JavaScript 視覺特效，而其是架構在 &lt;a href=&quot;http://www.prototypejs.org/&quot;&gt;Prototype&lt;/a&gt; 這套 JavaScript 框架上。其實要使用 AJAX 功能，只需要 Prototype 即可。再動手寫幾個測試程式之後，發現 Prototype 實在太好用了，尤其是有 Prototype 的 Swiss Army Knife 之稱的 &lt;a href=&quot;http://www.prototypejs.org/api/utility/dollar&quot;&gt;$()&lt;/a&gt; 函式，令人覺得非常神奇。&lt;br /&gt;&lt;br /&gt;當然，作為一個 programmer 不能只是感到神奇而罷休，便開始追蹤 Prototype 的程式碼。在追蹤之後才發現，原來 JavaScript 可不是我原本想像的那樣而已，JavaScript 也決不簡單。在 Prototype 原始碼中看到了很多高段的 JavaScript 技巧，不得不佩服作者的巧思，令我獲益良多。如果能看懂 Prototype 原始碼，我敢說你的 JavaScript 功力已經是很不得了了。&lt;br /&gt;&lt;br /&gt;Prototype 已經變成我開發網頁的必備良藥之一，改天有空開始再來玩玩 script.aculo.us、&lt;a href=&quot;http://openrico.org/&quot;&gt;Rico&lt;/a&gt; 或 &lt;a href=&quot;http://developer.yahoo.com/yui/&quot;&gt;YUI&lt;/a&gt; 等等其他 JavaSctipt 程式庫。</content><link rel='replies' type='application/atom+xml' href='http://blog-jy.blogspot.com/feeds/6341055712965543457/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6263527/6341055712965543457' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6263527/posts/default/6341055712965543457'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6263527/posts/default/6341055712965543457'/><link rel='alternate' type='text/html' href='http://blog-jy.blogspot.com/2007/12/javascript-prototype.html' title='開發 JavaScript 利器 - Prototype'/><author><name>JY</name><uri>http://www.blogger.com/profile/06133384347588330758</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6263527.post-285799294633576047</id><published>2007-12-24T20:56:00.000+08:00</published><updated>2007-12-24T22:03:21.312+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="fun"/><title type='text'>平安夜的無聊小發現</title><content type='html'>大家大概知道，從前一陣子開始，&lt;a href=&quot;http://gmailblog.blogspot.com/2007/10/more-gmail-storage-coming-for-all.html&quot;&gt;Gmail 的容量成長開始加速&lt;/a&gt;，預計明年達到 6 GB 以上。剛剛無聊粗略計算了一下，發現 Gmail 的容量在美國時間平安夜當天 (約中午) 會剛好成長到 6000 MB。不知道是不是 Google 故意設計的？ :)</content><link rel='replies' type='application/atom+xml' href='http://blog-jy.blogspot.com/feeds/285799294633576047/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6263527/285799294633576047' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6263527/posts/default/285799294633576047'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6263527/posts/default/285799294633576047'/><link rel='alternate' type='text/html' href='http://blog-jy.blogspot.com/2007/12/blog-post.html' title='平安夜的無聊小發現'/><author><name>JY</name><uri>http://www.blogger.com/profile/06133384347588330758</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6263527.post-5058622841412626646</id><published>2007-11-16T02:28:00.001+08:00</published><updated>2008-08-30T17:24:16.021+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="fun"/><category scheme="http://www.blogger.com/atom/ns#" term="random"/><category scheme="http://www.blogger.com/atom/ns#" term="thoughts"/><title type='text'>台灣辦公室中常聽到念錯的英文單字</title><content type='html'>在台灣辦公室中，尤其在科技業的，說話時老喜歡夾雜一些英文單字。對於某些外來的專有名詞，直接唸原文會比較直接，避免誤會。但是對於動詞，除非有特殊情況，我個人認為還是盡量使用中文。習慣一旦養成，要改談何容易，但最起碼發音要正確。如果很愛「ㄌㄠ\」英文卻又發音不正確，不是很糗嗎？對於英文非母語的我們，要發音非常標準是有點強人所難啦，但至少要正確吧。&lt;br /&gt;&lt;br /&gt;底下舉幾個常被念錯英文單字 (有些字念錯意思可是差了十萬八千里呢)：&lt;br /&gt;&lt;ol&gt;&lt;li&gt;file&lt;script&gt;play_w(&quot;F0012400&quot;)&lt;/script&gt;&lt;object style=&quot;margin: 3px 3px 5px;&quot; classid=&quot;clsid:d27cdb6e-ae6d-11cf-96b8-444553540000&quot; codebase=&quot;http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0&quot; width=&quot;10&quot; height=&quot;13&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://img.tfd.com/play.swf&quot;&gt;&lt;param name=&quot;menu&quot; value=&quot;false&quot;&gt;&lt;param name=&quot;wmode&quot; value=&quot;transparent&quot;&gt;&lt;param name=&quot;FlashVars&quot; value=&quot;soundpath=http://img.tfd.com/hm/mp3/F0012400&quot;&gt;&lt;embed style=&quot;margin-bottom: 4px;&quot; src=&quot;http://img.tfd.com/play.swf&quot; flashvars=&quot;soundpath=http://img.tfd.com/hm/mp3/F0012400&quot; menu=&quot;false&quot; wmode=&quot;transparent&quot; type=&quot;application/x-shockwave-flash&quot; pluginspage=&quot;http://www.macromedia.com/go/getflashplayer&quot; width=&quot;10&quot; height=&quot;13&quot;&gt;&lt;/embed&gt;&lt;/object&gt; 唸成 fire&lt;script&gt;play_w(&quot;F0133600&quot;)&lt;/script&gt;&lt;object style=&quot;margin: 3px 3px 5px;&quot; classid=&quot;clsid:d27cdb6e-ae6d-11cf-96b8-444553540000&quot; codebase=&quot;http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0&quot; width=&quot;10&quot; height=&quot;13&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://img.tfd.com/play.swf&quot;&gt;&lt;param name=&quot;menu&quot; value=&quot;false&quot;&gt;&lt;param name=&quot;wmode&quot; value=&quot;transparent&quot;&gt;&lt;param name=&quot;FlashVars&quot; value=&quot;soundpath=http://img.tfd.com/hm/mp3/F0133600&quot;&gt;&lt;embed style=&quot;margin-bottom: 4px;&quot; src=&quot;http://img.tfd.com/play.swf&quot; flashvars=&quot;soundpath=http://img.tfd.com/hm/mp3/F0133600&quot; menu=&quot;false&quot; wmode=&quot;transparent&quot; type=&quot;application/x-shockwave-flash&quot; pluginspage=&quot;http://www.macromedia.com/go/getflashplayer&quot; width=&quot;10&quot; height=&quot;13&quot;&gt;&lt;/embed&gt;&lt;/object&gt; 。&lt;br /&gt;例：麻煩你把 fire 傳給我。(不禁讓我想到 &lt;a href=&quot;http://en.wikipedia.org/wiki/Prometheus&quot;&gt;Prometheus&lt;/a&gt;&lt;span style=&quot;text-decoration: underline;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;&quot;&gt; &lt;/span&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Prometheus&quot;&gt;普羅米修斯&lt;/a&gt;&lt;span style=&quot;&quot;&gt;)&lt;/span&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Prometheus&quot;&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;email&lt;script&gt;play_w(&quot;E0099800&quot;)&lt;/script&gt;&lt;object style=&quot;margin: 3px 3px 5px;&quot; classid=&quot;clsid:d27cdb6e-ae6d-11cf-96b8-444553540000&quot; codebase=&quot;http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0&quot; width=&quot;10&quot; height=&quot;13&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://img.tfd.com/play.swf&quot;&gt;&lt;param name=&quot;menu&quot; value=&quot;false&quot;&gt;&lt;param name=&quot;wmode&quot; value=&quot;transparent&quot;&gt;&lt;param name=&quot;FlashVars&quot; value=&quot;soundpath=http://img.tfd.com/hm/mp3/E0099800&quot;&gt;&lt;embed style=&quot;margin-bottom: 4px;&quot; src=&quot;http://img.tfd.com/play.swf&quot; flashvars=&quot;soundpath=http://img.tfd.com/hm/mp3/E0099800&quot; menu=&quot;false&quot; wmode=&quot;transparent&quot; type=&quot;application/x-shockwave-flash&quot; pluginspage=&quot;http://www.macromedia.com/go/getflashplayer&quot; width=&quot;10&quot; height=&quot;13&quot;&gt;&lt;/embed&gt;&lt;/object&gt;  唸成 &lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_0&quot;&gt;emare&lt;/span&gt; (依媚兒)。&lt;br /&gt;例：給我你的依媚兒。&lt;/li&gt;&lt;li&gt;cancel&lt;span class=&quot;hw&quot;&gt;&lt;/span&gt;&lt;script&gt;play_w(&quot;C0061600&quot;)&lt;/script&gt;&lt;object style=&quot;margin: 3px 3px 5px;&quot; classid=&quot;clsid:d27cdb6e-ae6d-11cf-96b8-444553540000&quot; codebase=&quot;http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0&quot; width=&quot;10&quot; height=&quot;13&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://img.tfd.com/play.swf&quot;&gt;&lt;param name=&quot;menu&quot; value=&quot;false&quot;&gt;&lt;param name=&quot;wmode&quot; value=&quot;transparent&quot;&gt;&lt;param name=&quot;FlashVars&quot; value=&quot;soundpath=http://img.tfd.com/hm/mp3/C0061600&quot;&gt;&lt;embed style=&quot;margin-bottom: 4px;&quot; src=&quot;http://img.tfd.com/play.swf&quot; flashvars=&quot;soundpath=http://img.tfd.com/hm/mp3/C0061600&quot; menu=&quot;false&quot; wmode=&quot;transparent&quot; type=&quot;application/x-shockwave-flash&quot; pluginspage=&quot;http://www.macromedia.com/go/getflashplayer&quot; width=&quot;10&quot; height=&quot;13&quot;&gt;&lt;/embed&gt;&lt;/object&gt;  唸成 cancer&lt;span class=&quot;hw&quot;&gt;&lt;/span&gt;&lt;script&gt;play_w(&quot;C0062100&quot;)&lt;/script&gt;&lt;object style=&quot;margin: 3px 3px 5px;&quot; classid=&quot;clsid:d27cdb6e-ae6d-11cf-96b8-444553540000&quot; codebase=&quot;http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0&quot; width=&quot;10&quot; height=&quot;13&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://img.tfd.com/play.swf&quot;&gt;&lt;param name=&quot;menu&quot; value=&quot;false&quot;&gt;&lt;param name=&quot;wmode&quot; value=&quot;transparent&quot;&gt;&lt;param name=&quot;FlashVars&quot; value=&quot;soundpath=http://img.tfd.com/hm/mp3/C0062100&quot;&gt;&lt;embed style=&quot;margin-bottom: 4px;&quot; src=&quot;http://img.tfd.com/play.swf&quot; flashvars=&quot;soundpath=http://img.tfd.com/hm/mp3/C0062100&quot; menu=&quot;false&quot; wmode=&quot;transparent&quot; type=&quot;application/x-shockwave-flash&quot; pluginspage=&quot;http://www.macromedia.com/go/getflashplayer&quot; width=&quot;10&quot; height=&quot;13&quot;&gt;&lt;/embed&gt;&lt;/object&gt;。&lt;br /&gt;例：這個 case 最後被 cancer 了。(怎麼會扯到癌症)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;standard&lt;object style=&quot;margin: 3px 3px 5px;&quot; classid=&quot;clsid:d27cdb6e-ae6d-11cf-96b8-444553540000&quot; codebase=&quot;http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0&quot; width=&quot;10&quot; height=&quot;13&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://img.tfd.com/play.swf&quot;&gt;&lt;param name=&quot;menu&quot; value=&quot;false&quot;&gt;&lt;param name=&quot;wmode&quot; value=&quot;transparent&quot;&gt;&lt;param name=&quot;FlashVars&quot; value=&quot;soundpath=http://img.tfd.com/hm/mp3/S0701800&quot;&gt;&lt;embed style=&quot;margin-bottom: 4px;&quot; src=&quot;http://img.tfd.com/play.swf&quot; flashvars=&quot;soundpath=http://img.tfd.com/hm/mp3/S0701800&quot; menu=&quot;false&quot; wmode=&quot;transparent&quot; type=&quot;application/x-shockwave-flash&quot; pluginspage=&quot;http://www.macromedia.com/go/getflashplayer&quot; width=&quot;10&quot; height=&quot;13&quot;&gt;&lt;/embed&gt;&lt;/object&gt; 字尾 &lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_1&quot;&gt;dar&lt;/span&gt;&lt;/span&gt;d 應該要發的是 &lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_2&quot;&gt;spi&lt;/span&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_3&quot;&gt;der&lt;/span&gt;&lt;/span&gt; 的音，而非 &lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_4&quot;&gt;ra&lt;/span&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_5&quot;&gt;dar&lt;/span&gt;&lt;/span&gt; 的音。&lt;/li&gt;&lt;li&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_6&quot;&gt;im&lt;/span&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_7&quot;&gt;ple&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_8&quot;&gt;ment&lt;/span&gt;&lt;script&gt;play_w(&quot;I0060700&quot;)&lt;/script&gt;&lt;object style=&quot;margin: 3px 3px 5px;&quot; classid=&quot;clsid:d27cdb6e-ae6d-11cf-96b8-444553540000&quot; codebase=&quot;http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0&quot; width=&quot;10&quot; height=&quot;13&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://img.tfd.com/play.swf&quot;&gt;&lt;param name=&quot;menu&quot; value=&quot;false&quot;&gt;&lt;param name=&quot;wmode&quot; value=&quot;transparent&quot;&gt;&lt;param name=&quot;FlashVars&quot; value=&quot;soundpath=http://img.tfd.com/hm/mp3/I0060700&quot;&gt;&lt;embed style=&quot;margin-bottom: 4px;&quot; src=&quot;http://img.tfd.com/play.swf&quot; flashvars=&quot;soundpath=http://img.tfd.com/hm/mp3/I0060700&quot; menu=&quot;false&quot; wmode=&quot;transparent&quot; type=&quot;application/x-shockwave-flash&quot; pluginspage=&quot;http://www.macromedia.com/go/getflashplayer&quot; width=&quot;10&quot; height=&quot;13&quot;&gt;&lt;/embed&gt;&lt;/object&gt; 唸成 &lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_9&quot;&gt;im&lt;/span&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_10&quot;&gt;pri&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;blsp-spelling-error&quot; id=&quot;SPELLING_ERROR_11&quot;&gt;ment&lt;/span&gt;。&lt;/li&gt;&lt;li&gt;exit&lt;script&gt;play_w(&quot;E0277300&quot;)&lt;/script&gt;&lt;object style=&quot;margin: 3px 3px 5px;&quot; classid=&quot;clsid:d27cdb6e-ae6d-11cf-96b8-444553540000&quot; codebase=&quot;http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0&quot; width=&quot;10&quot; height=&quot;13&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://img.tfd.com/play.swf&quot;&gt;&lt;param name=&quot;menu&quot; value=&quot;false&quot;&gt;&lt;param name=&quot;wmode&quot; value=&quot;transparent&quot;&gt;&lt;param name=&quot;FlashVars&quot; value=&quot;soundpath=http://img.tfd.com/hm/mp3/E0277300&quot;&gt;&lt;embed style=&quot;margin-bottom: 4px;&quot; src=&quot;http://img.tfd.com/play.swf&quot; flashvars=&quot;soundpath=http://img.tfd.com/hm/mp3/E0277300&quot; menu=&quot;false&quot; wmode=&quot;transparent&quot; type=&quot;application/x-shockwave-flash&quot; pluginspage=&quot;http://www.macromedia.com/go/getflashplayer&quot; width=&quot;10&quot; height=&quot;13&quot;&gt;&lt;/embed&gt;&lt;/object&gt;。&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;類似 l 與 r 的音不分的情況不勝枚舉，這可能是亞洲國家英文的通病吧。只要把這兩個音分辨清楚，我想英文發音就算是前進一大步了。&lt;br /&gt;&lt;br /&gt;註：聲音檔取自 &lt;a href=&quot;http://www.thefreedictionary.com/&quot;&gt;The Free Dictionary&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog-jy.blogspot.com/feeds/5058622841412626646/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6263527/5058622841412626646' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6263527/posts/default/5058622841412626646'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6263527/posts/default/5058622841412626646'/><link rel='alternate' type='text/html' href='http://blog-jy.blogspot.com/2007/11/blog-post_13.html' title='台灣辦公室中常聽到念錯的英文單字'/><author><name>JY</name><uri>http://www.blogger.com/profile/06133384347588330758</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6263527.post-6856983239256466978</id><published>2007-11-13T11:06:00.000+08:00</published><updated>2007-11-14T17:08:37.373+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="api"/><category scheme="http://www.blogger.com/atom/ns#" term="development"/><category scheme="http://www.blogger.com/atom/ns#" term="mobile"/><category scheme="http://www.blogger.com/atom/ns#" term="web"/><title type='text'>Google&#39;s Android SDK Now Available</title><content type='html'>&lt;div style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;http://code.google.com/android&quot;&gt;&lt;img style=&quot;border: 0px none ;&quot; src=&quot;http://code.google.com/android/images/logo_android.gif&quot; alt=&quot;Android Developer Challenge&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;Google 上星期才公佈了 &lt;a dragover=&quot;true&quot; target=&quot;_blank&quot; href=&quot;http://www.openhandsetalliance.com/&quot;&gt;Open Handset Alliance&lt;/a&gt;，今天隨即開放 &lt;a href=&quot;http://code.google.com/android/&quot;&gt;Android SDK&lt;/a&gt; 下載，讓開發者在 Android 上創造手機應用程式。想當然爾，軟體開發平台充分利用到 open source 的資源：Linux 2.6, Java, &lt;a href=&quot;http://www.eclipse.org/&quot;&gt;Eclipse&lt;/a&gt;, &lt;a href=&quot;http://webkit.org/&quot;&gt;WebKit&lt;/a&gt;, &lt;a href=&quot;http://www.sqlite.org/&quot;&gt;SQLite&lt;/a&gt; 等等。同時也使用較寬鬆的 &lt;a href=&quot;http://en.wikipedia.org/wiki/Apache_License&quot;&gt;Apache License&lt;/a&gt;，讓參與的硬體廠商得以保護其智財。目前公布的 SDK 算是個「搶鮮版」，Google 在廣納開發社群意見後也會不斷地發佈更新版本。&lt;br /&gt;&lt;br /&gt;為了刺激全世界的開發者共襄盛舉，Google 更大手筆端出高達千萬美金的獎金，舉辦 &lt;a dragover=&quot;true&quot; target=&quot;_blank&quot; href=&quot;http://code.google.com/android/adc.html&quot;&gt;Android Developer Challenge&lt;/a&gt;。想必此舉一定讓全世界的高手摩拳擦掌，躍躍欲試。第一輪入選的五十名，每位可以&lt;span&gt;&lt;span&gt;得到 $25,000 美金&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;，第二輪則選出二十名，其中十位可得 $100,000 美金，另外十位可得 $&lt;/span&gt;&lt;/span&gt;275,000&lt;span&gt;&lt;span dragover=&quot;true&quot;&gt; 美金。而這應該只是第一階段而已，因為上述獎金只佔總獎金的一半 (五百萬美金)，沒意外的話還會有第二階段的比賽。看到這樣的獎項，真的令人很心動啊！&lt;br /&gt;&lt;p dragover=&quot;true&quot;&gt;Android 的介紹：&lt;br /&gt;&lt;/p&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;p&gt;&lt;object height=&quot;355&quot; width=&quot;425&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.youtube.com/v/_avwGFsv60U&amp;amp;rel=1&quot;&gt;&lt;param name=&quot;wmode&quot; value=&quot;transparent&quot;&gt;&lt;embed src=&quot;http://www.youtube.com/v/_avwGFsv60U&amp;amp;rel=1&quot; type=&quot;application/x-shockwave-flash&quot; wmode=&quot;transparent&quot; height=&quot;355&quot; width=&quot;425&quot;&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;(看到這段影片第一個反應是：&lt;a href=&quot;http://en.wikipedia.org/wiki/Sergey_Brin&quot;&gt;Sergey Brin&lt;/a&gt; 的頭髮怎麼了！？)&lt;/p&gt;&lt;/span&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog-jy.blogspot.com/feeds/6856983239256466978/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6263527/6856983239256466978' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6263527/posts/default/6856983239256466978'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6263527/posts/default/6856983239256466978'/><link rel='alternate' type='text/html' href='http://blog-jy.blogspot.com/2007/11/googles-android-sdk-now-available.html' title='Google&#39;s Android SDK Now Available'/><author><name>JY</name><uri>http://www.blogger.com/profile/06133384347588330758</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6263527.post-5253806128710280803</id><published>2007-11-12T19:38:00.002+08:00</published><updated>2010-05-06T20:40:48.430+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="trip"/><title type='text'>六福村之旅</title><content type='html'>星期六是公司舉辦的 Family Day，地點在&lt;a href=&quot;http://www.leofoo.com.tw/village/&quot;&gt;六福村主題樂園&lt;/a&gt;。上一次到六福村已經是六年前的事了，還記得那天是 2001 年的國慶日，所以印象比較深刻。現在六福村對我來說已經沒有多大的吸引力了，我對於人工式的樂園沒多大興趣，也不熱衷刺激的遊樂設施。老實說，去玩那些刺激的遊樂設施，心裡多少會毛毛的。人說越老越怕死，一點都不假。不過相較於男生，女生似乎比較喜歡這種刺激的遊樂設施。不知道是不是不懂的害怕，還是喜歡享受尖叫的快感？這天六福村主題樂園的重點項目「笑傲飛鷹」與「大怒神」因風強所以暫停開放，現場抱怨聲連連，我倒是鬆了一口氣。&lt;br /&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEizoerj9Gms6gujBg0RBgQP0XYhJ7Yw5fTSYCBwl7uLUAl7a86iemnzFylqxS8sMmUz43YIhRA7PcEP_RwzubIKoD5LCmbGnoqKbKiapLRm-yA_iq0WvMmA8GqPf6vaOit4McoY/s1600-h/CIMG7045.JPG&quot;&gt;&lt;img style=&quot;margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 279px; height: 209px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEizoerj9Gms6gujBg0RBgQP0XYhJ7Yw5fTSYCBwl7uLUAl7a86iemnzFylqxS8sMmUz43YIhRA7PcEP_RwzubIKoD5LCmbGnoqKbKiapLRm-yA_iq0WvMmA8GqPf6vaOit4McoY/s320/CIMG7045.JPG&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5131927607506054034&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;以往到六福村總是忽略它還有一個野生動物園 (曾幾何時，野生動物園是六福村的招牌項目)，總認為要玩到遊樂設施才算是值回票價，不過這次的六福村之行有了新的體會。常被忽略的野生動物園，才是這次讓我們覺得值回票價的項目。參觀野生動物園有兩條路線，一個是搭乘蒸汽小火車環繞動物園區，另一個是搭乘猛獸遊園巴士。聽說蒸汽小火車 (當然不是用真的蒸汽火車頭) 是前不久才規劃好的，遊客可以近距離觀賞較溫和的動物。跟台北動物園相比，雖然六福村野生動物園的動物種類不多，但是動物們的活動空間比較大，也比較自由，在這裡的動物應該會比較快樂吧！下次如果有機會到六福村一遊，建議可以去逛逛野生動物園。</content><link rel='replies' type='application/atom+xml' href='http://blog-jy.blogspot.com/feeds/5253806128710280803/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6263527/5253806128710280803' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6263527/posts/default/5253806128710280803'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6263527/posts/default/5253806128710280803'/><link rel='alternate' type='text/html' href='http://blog-jy.blogspot.com/2007/11/blog-post_12.html' title='六福村之旅'/><author><name>JY</name><uri>http://www.blogger.com/profile/06133384347588330758</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEizoerj9Gms6gujBg0RBgQP0XYhJ7Yw5fTSYCBwl7uLUAl7a86iemnzFylqxS8sMmUz43YIhRA7PcEP_RwzubIKoD5LCmbGnoqKbKiapLRm-yA_iq0WvMmA8GqPf6vaOit4McoY/s72-c/CIMG7045.JPG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6263527.post-1407591195499830664</id><published>2007-11-09T13:53:00.000+08:00</published><updated>2007-11-12T17:54:23.870+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="development"/><category scheme="http://www.blogger.com/atom/ns#" term="web"/><title type='text'>PHP vs. Ruby on Rails</title><content type='html'>因為工作的需要，必須在有限的時間內開發一個網站。這個網站需要具備使用者帳戶管理與認證的功能，並管理使用者上傳的資料，故與資料庫之間的關係密切。我也希望這個網站能盡量運用到 open source 的力量，所以基本的軟體平台將會以 Linux + Apache + MySQL 為主。網站開發工具方面，目前有三個選項：&lt;br /&gt;&lt;ol&gt;&lt;li&gt;純 &lt;a href=&quot;http://www.php.net/&quot;&gt;PHP&lt;/a&gt; (不使用 PHP framework)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.cakephp.org/&quot;&gt;CakePHP&lt;/a&gt; (或其他 PHP framework)&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://www.rubyonrails.org/&quot;&gt;Ruby on Rails&lt;/a&gt; (RoR)&lt;/li&gt;&lt;/ol&gt;就我自己以往的 web development 經驗來說，我大多只是利用 PHP 寫一些網頁小工具，最多就是開發規模不大的小網站。對於開發一個中型的網站來說，只使用純 PHP 開發是相當辛苦的，除了人力有限之外，未來還要面臨維護與後續擴充的問題。因此，我需要一個 framework，而現在的問題就是該選擇 PHP 的 framework (目前以 CakePHP 為首選) 或是目前當紅的 Ruby on Rails？對我來說，這兩者各有優劣：(我必須再強調，這是根據我個人情況來說 :)&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;CakePHP 的優點&lt;/span&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;我比較熟悉 PHP 語言&lt;/li&gt;&lt;li&gt;PHP 豐富的資源 (容易整合許多現有 PHP 的 open source 計畫)&lt;/li&gt;&lt;li&gt;成熟度高，品質已被廣為驗證 (許多之名網站都是用 PHP 打造的)&lt;/li&gt;&lt;li&gt;執行效率快 (相較之下，&lt;a href=&quot;http://www.radicalbehavior.com/5-question-interview-with-twitter-developer-alex-payne/&quot;&gt;Ruby is slow!&lt;/a&gt;)&lt;/li&gt;&lt;/ol&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;Ruby on Rails 的優點&lt;/span&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Ruby 語言優勢 (如 OO)，以及學習新語言的樂趣。&lt;/li&gt;&lt;li&gt;可能是明日之星 (迅速崛起，目前很火紅的 framework)&lt;/li&gt;&lt;li&gt;Rails framework 肇始者 (比較忠於原味？)&lt;/li&gt;&lt;li&gt;Ruby 社群團結，只有一個 RoR (相對之下，PHP 選擇太多，容易缺乏向心力)&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;學習新語言固然很有趣，但總是需要時間才可以達到某種深度。雖然 CakePHP 可算是 RoR clone，但並非 clone 就會比較遜色。有時候非但不會比較遜色，反而能夠截長補短。CakePHP 以成熟的 PHP 技術為基礎，廣納 Rails 的設計哲學與精神 (MVC, ActiveRecord, 等等)，應該具備相當的實力才是。Ruby 面臨到的最大問題之一就是效率，效率問題牽扯到的層面很廣，包含根本的基礎語言本身。&lt;a href=&quot;http://en.wikipedia.org/wiki/David_Heinemeier_Hansson&quot;&gt;David Heinemeier Hansson&lt;/a&gt; (RoR 之父) 也不穢言，為了解決效率問題，曾經將一段 Ruby 的程式法以 C 改寫。&lt;a href=&quot;http://twitter.com/&quot;&gt;Twitter&lt;/a&gt; 可能是目前以 RoR 開發的網站中的最大者，其開發者也&lt;a href=&quot;http://www.radicalbehavior.com/5-question-interview-with-twitter-developer-alex-payne/&quot;&gt;為 RoR 效率問題所苦&lt;/a&gt;。&lt;br /&gt;&lt;br /&gt;以此來看，CakePHP 似乎是比較符合我的需求。</content><link rel='replies' type='application/atom+xml' href='http://blog-jy.blogspot.com/feeds/1407591195499830664/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6263527/1407591195499830664' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6263527/posts/default/1407591195499830664'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6263527/posts/default/1407591195499830664'/><link rel='alternate' type='text/html' href='http://blog-jy.blogspot.com/2007/11/php-vs-ruby-on-rails.html' title='PHP vs. Ruby on Rails'/><author><name>JY</name><uri>http://www.blogger.com/profile/06133384347588330758</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6263527.post-4676107568836207722</id><published>2007-11-06T00:07:00.000+08:00</published><updated>2007-11-09T22:51:59.240+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="api"/><category scheme="http://www.blogger.com/atom/ns#" term="news"/><category scheme="http://www.blogger.com/atom/ns#" term="web"/><title type='text'>Google&#39;s OpenSocial</title><content type='html'>最近 &lt;a href=&quot;http://code.google.com/&quot;&gt;Google Code&lt;/a&gt; 上最大的消息就是 &lt;a href=&quot;http://code.google.com/apis/opensocial/&quot;&gt;OpenSocial&lt;/a&gt; 了。這幾天在 Google 相關的 blog 上都是她的蹤影，例如&lt;a href=&quot;http://googleblog.blogspot.com/2007/11/opensocial-makes-web-better.html&quot;&gt;這裡&lt;/a&gt;、&lt;a href=&quot;http://google-code-updates.blogspot.com/2007/11/google-developer-podcast-episode-eleven.html&quot;&gt;這裡&lt;/a&gt;還有&lt;a href=&quot;http://googlesystem.blogspot.com/2007/10/opensocial-googles-apis-for-social.html&quot;&gt;這裡&lt;/a&gt;，另外還有Mr.6 的&lt;a href=&quot;http://mr6.cc/?p=1149&quot;&gt;文章&lt;/a&gt;值得一看。OpenSocial 計畫企圖提供一個跨網站的 social network platform (&lt;span style=&quot;font-style: italic;&quot;&gt;&quot;a set of common APIs for building social applications across the web&quot;&lt;/span&gt;)，串連當下眾多社群網站，包括： &lt;a target=&quot;_blank&quot; href=&quot;http://www.myspace.com/&quot; title=&quot;MySpace&quot;&gt;MySpace&lt;/a&gt;, &lt;a target=&quot;_blank&quot; href=&quot;http://www.engage.com/e/home.htm&quot; title=&quot;Engage.com&quot;&gt;Engage.com&lt;/a&gt;, &lt;a target=&quot;_blank&quot; href=&quot;http://www.friendster.com/&quot; title=&quot;Friendster&quot;&gt;Friendster&lt;/a&gt;, &lt;a target=&quot;_blank&quot; href=&quot;http://www.hi5.com/&quot; title=&quot;hi5&quot;&gt;hi5&lt;/a&gt;, &lt;a target=&quot;_blank&quot; title=&quot;Hyves&quot; href=&quot;http://www.hyves.net/&quot;&gt;Hyves&lt;/a&gt;, &lt;a target=&quot;_blank&quot; title=&quot;imeem&quot; href=&quot;http://www.imeem.com/&quot;&gt;imeem&lt;/a&gt;, &lt;a target=&quot;_blank&quot; title=&quot;LinkedIn&quot; href=&quot;http://www.linkedin.com/&quot;&gt;LinkedIn&lt;/a&gt;, &lt;a target=&quot;_blank&quot; title=&quot;Ning&quot; href=&quot;http://www.ning.com/&quot;&gt;Ning&lt;/a&gt;, &lt;a target=&quot;_blank&quot; title=&quot;Oracle&quot; href=&quot;http://www.oracle.com/index.html&quot;&gt;Oracle&lt;/a&gt;, &lt;a target=&quot;_blank&quot; title=&quot;orkut,&quot; href=&quot;https://www.google.com/accounts/ServiceLogin?service=orkut&amp;amp;continue=http%3A%2F%2Fwww.orkut.com%2FRedirLogin.aspx%3Fmsg%3D0%26page%3Dhttp%253A%252F%252Fwww.orkut.com%252F&amp;amp;hl=en-US&amp;amp;rm=false&amp;amp;passive=true&quot;&gt;orkut,&lt;/a&gt; &lt;a target=&quot;_blank&quot; title=&quot;Plaxo&quot; href=&quot;http://www.plaxo.com/info&quot;&gt;Plaxo&lt;/a&gt;, &lt;a target=&quot;_blank&quot; title=&quot;Salesforce.com&quot; href=&quot;http://www.salesforce.com/&quot;&gt;Salesforce.com&lt;/a&gt;, &lt;a target=&quot;_blank&quot; title=&quot;Six Apart&quot; href=&quot;http://www.sixapart.com/&quot;&gt;Six Apart&lt;/a&gt;, &lt;a target=&quot;_blank&quot; title=&quot;Tianji&quot; href=&quot;http://www.tianji.com/index.html&quot;&gt;Tianji&lt;/a&gt;, &lt;a target=&quot;_blank&quot; title=&quot;Viadeo&quot; href=&quot;http://www.viadeo.com/en/connexion/&quot;&gt;Viadeo&lt;/a&gt;, &lt;a target=&quot;_blank&quot; title=&quot;XING&quot; href=&quot;http://www.xing.com/&quot;&gt;XING&lt;/a&gt; 等等。&lt;br /&gt;&lt;br /&gt;簡單的說，OpenSocial 主要目標有二：&lt;br /&gt;&lt;ol&gt;&lt;li&gt;讓使用 &lt;a href=&quot;http://code.google.com/apis/opensocial/docs/index.html&quot;&gt;OpenSocial API&lt;/a&gt; 開發的應用程式 (gadgets/plug-ins, ...) 得以突破社群網站的籓籬，執行在任何社群網站上。&lt;br /&gt;&lt;/li&gt;&lt;li&gt;只要支援 &lt;a href=&quot;http://code.google.com/apis/opensocial/container.html&quot;&gt;OpenSocial SPI&lt;/a&gt;，任何網站都可以當 host，讓這些豐富的應用程式執行其上。&lt;/li&gt;&lt;/ol&gt;如果將來 OpenSocial 大行其道， 社群網站之間的幾乎就沒有什麼隔閡了。也就是說，想用某特定社群網站來綁住會員的作法也越來越難了， 未來將會更重視在內容的創意上面。Google 出招果然了得，是否能夠帶來社群網站的美麗新世界呢？</content><link rel='replies' type='application/atom+xml' href='http://blog-jy.blogspot.com/feeds/4676107568836207722/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6263527/4676107568836207722' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6263527/posts/default/4676107568836207722'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6263527/posts/default/4676107568836207722'/><link rel='alternate' type='text/html' href='http://blog-jy.blogspot.com/2007/11/googles-opensocial.html' title='Google&#39;s OpenSocial'/><author><name>JY</name><uri>http://www.blogger.com/profile/06133384347588330758</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6263527.post-4571735960425999802</id><published>2007-11-01T21:38:00.000+08:00</published><updated>2007-11-09T22:51:17.153+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="api"/><category scheme="http://www.blogger.com/atom/ns#" term="programming"/><category scheme="http://www.blogger.com/atom/ns#" term="web"/><title type='text'>Google Maps API 卡死，CPU 負載飆高</title><content type='html'>最近為了某種特殊的應用，必須透過 &lt;a href=&quot;http://www.google.com/apis/maps/&quot;&gt;Google Maps API&lt;/a&gt; 在 &lt;a href=&quot;http://maps.google.com/&quot;&gt;Google Maps&lt;/a&gt; 上展現行動軌跡圖。軌跡圖繪製的方式是用 polyline 的方式，連接數百點，甚至數千點。該程式在 IE6 與 Firefox 2.x 皆可正常執行，但是在 Firefox 3 alpha、Opera 或 Safari 等瀏覽器上時，執行到一半便會卡死不動，CPU 負載飆高到 9x%。深入追蹤的結果，發現程式會死在 &lt;span style=&quot;font-family:courier new;&quot;&gt;GMap2.panTo&lt;/span&gt; 或 &lt;span style=&quot;font-family:courier new;&quot;&gt;GMap2.setCenter&lt;/span&gt; 之類移動地圖的函式，狀似進入無限迴圈。而且在這幾個瀏覽器上執行都是死在同個地方，看起來很像跟座標資料有關，但我實在很難相信事實會是如此。&lt;br /&gt;&lt;br /&gt;程式卡死在 Google Maps API 函式裡的情況，看起來不大好搞。上網搜尋一下相關討論，發現也有一些人發生類似的問題，雖然沒有找到什麼明確的解決方案，不過大概可以歸納出問題是出現在處理 polyline (&lt;span style=&quot;font-family:courier new;&quot;&gt;GPolyline&lt;/span&gt;) 上。偶然之間，看到有人提到 API 版本不同所引發的其他問題，靈機一動便試著替換不同的 API 版本試看看。最後，我把原來預設的 v=&lt;span style=&quot;font-weight: bold;&quot;&gt;2&lt;/span&gt; 換成 v=&lt;span style=&quot;font-weight: bold;&quot;&gt;2.x&lt;/span&gt;，便神奇地解決了這個問題。而 v=2 與 v=2.x 有什麼差別呢？根據 Google Maps API &lt;a href=&quot;http://www.google.com/apis/maps/documentation/#API_Updates&quot;&gt;官方文件&lt;/a&gt;：&lt;br /&gt;&lt;ul&gt;&lt;li&gt;v=2 (default) 是使用預設的 API 版本。&lt;/li&gt;&lt;li&gt;v=2.x (latest) 是使用&lt;span style=&quot;font-weight: bold;&quot;&gt;最新&lt;/span&gt;的 API 版本，加入新功能與 bugfix，但可能沒有 v=2 來得穩定。&lt;br /&gt;&lt;/li&gt;&lt;li&gt;v=2.s (stable) 是使用&lt;span style=&quot;font-weight: bold;&quot;&gt;最穩定&lt;/span&gt;的 API 版本，但功能可能比較陽春。&lt;/li&gt;&lt;/ul&gt;看來 Google 也有發現處理 polyline 上的瑕疵，在 v=2.x 版上解決了這個問題。事實上，Google Maps 在處理 polyline 上並沒有那麼單純。為了能快速繪製 polyline，Google Maps 使用了不少方法輔助，甚至在伺服器端有一些輔助的設計。細節我就沒有研究了，等有空或有需要的時候再說吧！&lt;br /&gt;&lt;br /&gt;Google Maps API 的版本有實際的數字代碼，而且更新的速度也很快。目前 v=2 代表 2.91a，v=2.x 為 2.92，而 v=2.s 為 2.73。Google Maps API 並沒有提供取得版本資訊的方法，有興趣的想知道確切版本，可以參考 &lt;a href=&quot;http://mapki.com/&quot;&gt;Mapki&lt;/a&gt; 這個網站。如果非得要在程式中動態判斷版本，底下這一段 PHP 程式碼可以提供給你參考：&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;function get_gmaps_api_version($url) {&lt;br /&gt;  if (preg_match(&#39;/mapfiles\/([\d\w]+)\/maps2/&#39;,&lt;br /&gt;                 file_get_contents($url), $m))&lt;br /&gt;      return &quot;2.&quot; . $m[1];&lt;br /&gt;  return &quot;N/A&quot;;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;其中輸入的 $url 是 script URL：&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;v=2 → &lt;code&gt;http://maps.google.com/maps?file=api&amp;amp;&lt;span style=&quot;font-weight: bold;&quot;&gt;v=2&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;v=2.x → &lt;code&gt;http://maps.google.com/maps?file=api&amp;amp;&lt;span style=&quot;font-weight: bold;&quot;&gt;v=2.x&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;v=2.s → &lt;code&gt;http://maps.google.com/maps?file=api&amp;amp;&lt;span style=&quot;font-weight: bold;&quot;&gt;v=2.s&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog-jy.blogspot.com/feeds/4571735960425999802/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6263527/4571735960425999802' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6263527/posts/default/4571735960425999802'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6263527/posts/default/4571735960425999802'/><link rel='alternate' type='text/html' href='http://blog-jy.blogspot.com/2007/11/google-maps-api-cpu.html' title='Google Maps API 卡死，CPU 負載飆高'/><author><name>JY</name><uri>http://www.blogger.com/profile/06133384347588330758</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6263527.post-6412208446123142944</id><published>2007-10-30T20:45:00.000+08:00</published><updated>2007-11-09T22:50:29.162+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="news"/><category scheme="http://www.blogger.com/atom/ns#" term="web"/><title type='text'>Gmail 新面貌</title><content type='html'>據 Gmail 官方 &lt;a href=&quot;http://gmailblog.blogspot.com/2007/10/code-changes-to-prepare-gmail-for.html&quot;&gt;Blog&lt;/a&gt; 所述，Gmail 將會有為幅不小的改進。有些人甚至已經可以搶鮮嘗試&lt;a href=&quot;http://googlesystem.blogspot.com/2007/10/gmails-new-version-is-now-available.html&quot;&gt;新版的 Gmail&lt;/a&gt; 了，不過在我申請的數個帳號中，還不見新版的蹤影，可能還得等上一等。新版 Gmail 主要是改善效能與易用性，最大改變在於通訊錄管理與 mail prefetching，詳情請見 Official Gmail Blog 上的&lt;a href=&quot;http://gmailblog.blogspot.com/2007/10/code-changes-to-prepare-gmail-for.html&quot;&gt;文章&lt;/a&gt;。Gmail 會進步到什麼程度令人期待，不過我覺得有意思的是這篇文章的最後一段：&lt;br /&gt;&lt;blockquote&gt;One side effect of this change is that if you&#39;re using third-party Gmail extensions, they&#39;re likely to stop working. We&#39;ve contacted a number of the developers behind some popular extensions and provided them with an opportunity to create fixes, so check back with them for updates. We&#39;re sorry that it may be a bit of a inconvenience, but we&#39;re trying to make this change as smooth as possible.&lt;/blockquote&gt;由此看來 Google 蠻鼓勵「在 Gmail 上面搞花樣」的，甚至還會主動提醒一些 third-party Gmail 擴充套件的作者有關 Gmail 架構的改變，並提供因應方法。我想，現行有些軟體把 Gmail 源源不絕的儲存空間做為他用，這樣的作法似乎是 Google 所默許的（至少尚未禁止）。&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;[更新]&lt;/span&gt; 2007-11-08 - 我的 Gmail 出現新版了！ (不過目前似乎只支援 Firefox)</content><link rel='replies' type='application/atom+xml' href='http://blog-jy.blogspot.com/feeds/6412208446123142944/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6263527/6412208446123142944' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6263527/posts/default/6412208446123142944'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6263527/posts/default/6412208446123142944'/><link rel='alternate' type='text/html' href='http://blog-jy.blogspot.com/2007/10/gmail.html' title='Gmail 新面貌'/><author><name>JY</name><uri>http://www.blogger.com/profile/06133384347588330758</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6263527.post-7953836908774462235</id><published>2007-10-27T22:00:00.000+08:00</published><updated>2007-11-09T22:48:06.627+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="news"/><category scheme="http://www.blogger.com/atom/ns#" term="web"/><title type='text'>Gmail to Support IMAP</title><content type='html'>前幾天 &lt;a href=&quot;http://www.gmail.com/&quot;&gt;Gmail&lt;/a&gt; 公布 &lt;a href=&quot;http://gmailblog.blogspot.com/2007/10/sync-your-inbox-across-devices-with.html&quot;&gt;IMAP 的支援&lt;/a&gt;，這一個令人期待已久的功能，讓 Gmail 更臻完整。IMAP 的好處就不用多說了，對我來說，腦中第一個浮現的應用就是備份舊信。隨著 Gmail &lt;a href=&quot;http://gmailblog.blogspot.com/2007/10/more-gmail-storage-coming-for-all.html&quot;&gt;容量不斷加大&lt;/a&gt;，再加上 Google 在搜尋方面的強項，把以前舊信件通通塞給 Gmail 管理是個不錯的主意。&lt;br /&gt;&lt;br /&gt;以前就曾經想要把舊信匯入到 Gmail，稍微研究了一下，有幾種方法：&lt;br /&gt;&lt;ol&gt;&lt;li&gt;使用 Gmail 工具，如 &lt;a href=&quot;http://marklyon.org/gmail/&quot;&gt;Gmail Loader&lt;/a&gt;。&lt;/li&gt;&lt;li&gt;使用 Gmail 擷取外部 POP3 的功能。&lt;/li&gt;&lt;/ol&gt;第一種方法是利用 SMTP 將信件一封封寄入 Gmail 信箱，而 Gmail Loader 支援很多種 mailbox 格式。但是使用第一種方法的缺點是，寄入 Gmail 的舊信所顯示的時間並非舊信當時的時間。既然舊信的日期無法保留，這種方法對我來說就沒什麼意義了。&lt;br /&gt;&lt;br /&gt;第二種方法需要架設 Mail Server，想辦法把所有舊信塞到特定帳戶的 mailbox 中，再叫 Gmail 過來擷取。我利用第二種方法，成功地將大部分的舊信匯入 Gmail 中，但某些信件會被 Gmail 認為內含病毒或是垃圾信，需要費一番心力手動調整方能成功匯入。Gmail 的 POP3 取信功能每次最多擷取 200 封信件，每擷取 200 封信件會休息一陣子再繼續擷取。我把大約 22,500 封左右的舊信匯入 Gmail，共費時兩天多。&lt;br /&gt;&lt;br /&gt;現在 Gmail 支援 IMAP 了，要匯入舊信就不用那麼麻煩了。如果你是使用類似 Outlook Express 的電子郵件軟體，直接將舊信複製到 Gmail 帳號目錄下的 &lt;span style=&quot;font-weight: bold;&quot;&gt;[Gmail]/All Mail&lt;/span&gt; 子目錄下，便可以直接將舊信存回 Gmail 了，相當方便。不過，我還沒利用這種方法備份大量的信件，不知道速度如何。</content><link rel='replies' type='application/atom+xml' href='http://blog-jy.blogspot.com/feeds/7953836908774462235/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6263527/7953836908774462235' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6263527/posts/default/7953836908774462235'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6263527/posts/default/7953836908774462235'/><link rel='alternate' type='text/html' href='http://blog-jy.blogspot.com/2007/10/gmail-to-support-imap.html' title='Gmail to Support IMAP'/><author><name>JY</name><uri>http://www.blogger.com/profile/06133384347588330758</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6263527.post-7350769890932768330</id><published>2006-11-23T20:30:00.000+08:00</published><updated>2007-11-09T22:42:36.513+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="programming"/><title type='text'>Array Subscripting in C</title><content type='html'>在 C 語言中，我們這樣宣告一個陣列：&lt;br /&gt;&lt;br /&gt;&lt;code&gt;char c[] = &quot;abcdefgh&quot;;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;一般，我們會用 &lt;code&gt;c[0]&lt;/code&gt;, &lt;code&gt;c[1]&lt;/code&gt;, ... 這樣的語法來存取陣列。在這個例子中，我們知道 &lt;code&gt;c[0]&lt;/code&gt; 為 &lt;code&gt;&#39;a&#39;&lt;/code&gt;，而 &lt;code&gt;a[1]&lt;/code&gt; 為 &lt;code&gt;&#39;b&#39;&lt;/code&gt;，如果是寫成 &lt;code&gt;3[c]&lt;/code&gt; 呢？一般人大概會猜 &lt;code&gt;&#39;d&#39;&lt;/code&gt;，沒錯！跟 &lt;code&gt;c[3]&lt;/code&gt; 的值一樣，就是 &lt;code&gt;&#39;d&#39;&lt;/code&gt;。那如果宣告成 &lt;code&gt;int&lt;/code&gt; 陣列呢？會不會有什麼不一樣的結果呢？&lt;br /&gt;&lt;br /&gt;&lt;code&gt;int i[] = {1, 2, 3, 4, 5, 6, 7, 8};&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;2[i]&lt;/code&gt; 的值應該是多少？沒錯，答案還是跟 &lt;code&gt;i[2]&lt;/code&gt; 一樣，就是 &lt;code&gt;3&lt;/code&gt;。&lt;br /&gt;&lt;br /&gt;類似 &lt;code&gt;3[c]&lt;/code&gt; 這般的寫法看起來很奇怪，令人全身不舒服，但是在 C/C++ 語言中卻是合法的。我們可以大膽假設：&lt;br /&gt;&lt;br /&gt;對於一維陣列來說，如果 &lt;code&gt;x[y]&lt;/code&gt; 符合語法，則 &lt;code&gt;x[y]&lt;/code&gt; 就等於 &lt;code&gt;y[x]&lt;/code&gt;。&lt;br /&gt;&lt;br /&gt;在 C 語言中，指標 (pointer) 與陣列 (array) 之間有著很密切的關係，一般人也常不明就裡地混用。根據 C 語言的規定，&lt;code&gt;x[y]&lt;/code&gt; 跟 &lt;code&gt;*((x) + (y))&lt;/code&gt; 是完全一樣的。換句話說，C 編譯器會把 &lt;code&gt;x[y]&lt;/code&gt; 解讀為 &lt;code&gt;*((x) + (y))&lt;/code&gt;。而 &lt;code&gt;x[y]&lt;/code&gt; 要能夠通過 C 語言文法，&lt;code&gt;x&lt;/code&gt; 或 &lt;code&gt;y&lt;/code&gt; 其中一個必須為指標，另一個必須能夠賦值 (evaluate) 為整數。以 binary operator + (加法) 作用在整數與指標上，最後會賦值為指標型別。因為加法具有可交換性 (commutativity)，所以不管是 &lt;code&gt;((x) + (y))&lt;/code&gt; 或是 &lt;code&gt;((y) + (x))&lt;/code&gt; 都是作指標相加，因此這兩個述式所得到的結果是一樣的。&lt;br /&gt;&lt;br /&gt;當然，類似 &lt;code&gt;0[i]&lt;/code&gt; 這種寫法並不值得鼓勵，除非你是在參加 &lt;a href=&quot;http://www.ioccc.org/&quot;&gt;IOCCC&lt;/a&gt; 比賽。&lt;br /&gt;&lt;br /&gt;參考：&lt;a href=&quot;http://c-faq.com/&quot;&gt;C FAQ: &lt;/a&gt;&lt;a href=&quot;http://c-faq.com/aryptr/joke.html&quot;&gt;Question 6.11&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog-jy.blogspot.com/feeds/7350769890932768330/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6263527/7350769890932768330' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6263527/posts/default/7350769890932768330'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6263527/posts/default/7350769890932768330'/><link rel='alternate' type='text/html' href='http://blog-jy.blogspot.com/2006/11/array-subscripting-in-c.html' title='Array Subscripting in C'/><author><name>JY</name><uri>http://www.blogger.com/profile/06133384347588330758</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>