<?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-623037388172682225</id><updated>2025-04-07T14:10:58.713+08:00</updated><category term="Programming"/><category term="JavaScript"/><category term="blogger-ext"/><category term="Gadget"/><category term="iGoogle"/><category term="jQuery"/><category term="Java"/><category term="Software"/><category term="心情雜記"/><category term="Linux"/><category term="PHP"/><category term="Gecko"/><category term="Ubuntu"/><category term="Exif"/><category term="FreeBSD"/><category term="Fun"/><category term="Ruby"/><category term="funp"/><category term="LiveScript"/><category term="google"/><category term="jQWebExt"/><category term="Document"/><category term="Flickr"/><category term="PostgreSQL"/><category term="Thinkpad"/><category term="epub"/><category term="hemidemi"/><category term="roodo-ext"/><category term="xuite-ext"/><category term="yam-ext"/><category term="抱怨"/><title type='text'>Racklin&#39;s 阿土伯程式大觀園</title><subtitle type='html'>在這裡寫下我對程式設計相關的心得及筆記.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://racklin.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/623037388172682225/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://racklin.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/623037388172682225/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00734471337083697849</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>95</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-623037388172682225.post-4433579881678237518</id><published>2013-09-12T10:51:00.001+08:00</published><updated>2013-09-12T11:27:13.138+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="JavaScript"/><category scheme="http://www.blogger.com/atom/ns#" term="LiveScript"/><title type='text'>LiveScript do keyword</title><content type='html'>&lt;p&gt;LiveScript 眾多的語法糖衣中， &lt;code&gt;do&lt;/code&gt; 算是被附加最多功能的 keyword . 
所以整理一下目前已知的用法備忘。&lt;/p&gt;&lt;h2 id=&quot;1-execute&quot; class=&quot;wmd-title&quot;&gt;1. execute&lt;/h2&gt;

&lt;p&gt;如同 &lt;code&gt;do&lt;/code&gt; 字面的意思，就是執行。後面可以跟的是 Function or Array .&lt;/p&gt;

&lt;h3 id=&quot;do-function&quot; class=&quot;wmd-title&quot;&gt;do Function&lt;/h3&gt;

&lt;p&gt;如：&lt;/p&gt;

&lt;pre style=&quot;&quot; class=&quot;prettyprint prettyprinted&quot;&gt;&lt;code&gt;&lt;span class=&quot;com&quot;&gt;# anonymous function&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;do&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
  x &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;

&lt;/span&gt;&lt;span class=&quot;com&quot;&gt;# named function&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
a &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
  x &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;do&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; a

&lt;/span&gt;&lt;span class=&quot;com&quot;&gt;# declare named function and execute it&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;do&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; f
  x &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;5&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;會產生出&lt;/p&gt;

&lt;pre style=&quot;&quot; class=&quot;prettyprint prettyprinted&quot;&gt;&lt;code&gt;&lt;span class=&quot;com&quot;&gt;// anonymous function&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(){&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; x&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; x &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;})();&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;

&lt;/span&gt;&lt;span class=&quot;com&quot;&gt;// named function&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; a&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
a &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(){&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; x&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; x &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;};&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
a&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;();&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;

&lt;/span&gt;&lt;span class=&quot;com&quot;&gt;// declare named function and execute it&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; f&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(){&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; x&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; x &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; f&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;();&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;
由上列可知 &lt;code&gt;do&lt;/code&gt; 非常聰明，它能依 anonymous 或是 named Function 決定產生出的 javascript 語法。&lt;/p&gt;

&lt;p&gt;而 &lt;code&gt;do&lt;/code&gt; 後面跟一個 anonymous 非常方便，很適合使用來將一段程式碼包起來，將變數變成區域變數(local scope variables),好處就是避免變數外漏(expose variables).&lt;/p&gt;

&lt;h3 id=&quot;do-array&quot; class=&quot;wmd-title&quot;&gt;do Array&lt;/h3&gt;

&lt;p&gt;如果 &lt;code&gt;do&lt;/code&gt; 後面跟著是 Array , 而 Array 內的元素是可呼叫(callable), 則 &lt;code&gt;do&lt;/code&gt; 會執行 Array 內每一個元素。&lt;/p&gt;

&lt;p&gt;如：&lt;/p&gt;

&lt;pre style=&quot;&quot; class=&quot;prettyprint prettyprinted&quot;&gt;&lt;code&gt;&lt;span class=&quot;kwd&quot;&gt;do&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; b&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; c&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;]&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;pre style=&quot;&quot; class=&quot;prettyprint prettyprinted&quot;&gt;&lt;code&gt;&lt;span class=&quot;pln&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(),&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; b&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(),&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; c&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;();&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;2-omit-parentheses&quot; class=&quot;wmd-title&quot;&gt;2. omit parentheses&lt;/h2&gt;

&lt;p&gt;LiveScript Coding Style 建議我們能省略 parentheses ()，就量省略。所以我們可以利用 &lt;code&gt;do&lt;/code&gt; 來做到。&lt;/p&gt;

&lt;h3 id=&quot;implicit-object&quot; class=&quot;wmd-title&quot;&gt;implicit object&lt;/h3&gt;

&lt;p&gt;如：&lt;/p&gt;

&lt;pre style=&quot;&quot; class=&quot;prettyprint prettyprinted&quot;&gt;&lt;code&gt;&lt;span class=&quot;pln&quot;&gt;func &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;do&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
  a&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
  b&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;2&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;會產生&lt;/p&gt;

&lt;pre style=&quot;&quot; class=&quot;prettyprint prettyprinted&quot;&gt;&lt;code&gt;&lt;span class=&quot;pln&quot;&gt;func&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;({&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
  a&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
  b&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;});&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;h3 id=&quot;list&quot; class=&quot;wmd-title&quot;&gt;list&lt;/h3&gt;

&lt;p&gt;如：&lt;/p&gt;

&lt;pre style=&quot;&quot; class=&quot;prettyprint prettyprinted&quot;&gt;&lt;code&gt;&lt;span class=&quot;pln&quot;&gt;func &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;do&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
  a
  b

&lt;/span&gt;&lt;span class=&quot;com&quot;&gt;# 經常使用在 callback, error_callback&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
func &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;do&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
    x &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
    x &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;1&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;會產生&lt;/p&gt;

&lt;pre style=&quot;&quot; class=&quot;prettyprint prettyprinted&quot;&gt;&lt;code&gt;&lt;span class=&quot;pln&quot;&gt;func&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; b&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;

&lt;/span&gt;&lt;span class=&quot;com&quot;&gt;// 經常使用在 callback, error_callback&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
func&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;){&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; x&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; x &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;err&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;){&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; x&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; x &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;});&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;3-backcalls&quot; class=&quot;wmd-title&quot;&gt;3. Backcalls&lt;/h2&gt;

&lt;p&gt;由於 LiveScript backcalls ，省略了內縮，讓 async callback 程式碼較容易閱讀，也因為省略內縮，如果你某段 code 要在 backcall 後執行就無法做到，這時需要利用 &lt;code&gt;do&lt;/code&gt; 。&lt;/p&gt;

&lt;p&gt;如官方範例：&lt;/p&gt;

&lt;pre style=&quot;&quot; class=&quot;prettyprint prettyprinted&quot;&gt;&lt;code&gt;&lt;span class=&quot;kwd&quot;&gt;do&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
  data &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&amp;lt;-!&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; $&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&#39;ajaxtest&#39;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
  $ &lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&#39;.result&#39;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;html data
  processed &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&amp;lt;-!&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; $&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&#39;ajaxprocess&#39;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; data
  $ &lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&#39;.result&#39;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;append processed

alert &lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&#39;hi&#39;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;產生：&lt;/p&gt;

&lt;pre style=&quot;&quot; class=&quot;prettyprint prettyprinted&quot;&gt;&lt;code&gt;&lt;span class=&quot;pln&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&#39;ajaxtest&#39;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;){&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
  $&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&#39;.result&#39;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
  $&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&#39;ajaxprocess&#39;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; data&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;processed&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;){&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
    $&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&#39;.result&#39;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;processed&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;});&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;});&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
alert&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&#39;hi&#39;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;);&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;4-do-while-loop&quot; class=&quot;wmd-title&quot;&gt;4. Do while loop&lt;/h2&gt;

&lt;p&gt;相容 javascript 的 do-while 迴圈語法&lt;/p&gt;

&lt;p&gt;如：&lt;/p&gt;

&lt;pre style=&quot;&quot; class=&quot;prettyprint prettyprinted&quot;&gt;&lt;code&gt;&lt;span class=&quot;pln&quot;&gt;i &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;do&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
  i&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;while&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; i&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;5&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;產生：&lt;/p&gt;

&lt;pre style=&quot;&quot; class=&quot;prettyprint prettyprinted&quot;&gt;&lt;code&gt;&lt;span class=&quot;pln&quot;&gt;i &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;do&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
  i&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;while&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; i&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;5&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&quot;5-code-block&quot; class=&quot;wmd-title&quot;&gt;5. code block&lt;/h2&gt;

&lt;p&gt;沒什麼特別作用，如同你在 javascript 中的 {} . 
如：&lt;/p&gt;

&lt;pre style=&quot;&quot; class=&quot;prettyprint prettyprinted&quot;&gt;&lt;code&gt;&lt;span class=&quot;kwd&quot;&gt;do&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
  x &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
  x &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;

&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;do&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; 
  x &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;3&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;產生：&lt;/p&gt;

&lt;pre style=&quot;&quot; class=&quot;prettyprint prettyprinted&quot;&gt;&lt;code&gt;&lt;span class=&quot;kwd&quot;&gt;var&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; x&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
x &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
x &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
x &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;blockquote&gt;
  &lt;p&gt;Written with &lt;a href=&quot;http://benweet.github.io/stackedit/&quot;&gt;StackEdit&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;</content><link rel='replies' type='application/atom+xml' href='http://racklin.blogspot.com/feeds/4433579881678237518/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/623037388172682225/4433579881678237518' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/623037388172682225/posts/default/4433579881678237518'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/623037388172682225/posts/default/4433579881678237518'/><link rel='alternate' type='text/html' href='http://racklin.blogspot.com/2013/09/livescript-do-keyword.html' title='LiveScript do keyword'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00734471337083697849</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-623037388172682225.post-6101911408050704481</id><published>2013-07-15T16:48:00.000+08:00</published><updated>2013-07-15T16:48:41.700+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="JavaScript"/><category scheme="http://www.blogger.com/atom/ns#" term="LiveScript"/><category scheme="http://www.blogger.com/atom/ns#" term="Programming"/><title type='text'>LiveScript - tax-free javascript</title><content type='html'>由 &lt;a href=&quot;https://twitter.com/clkao/&quot; target=&quot;_blank&quot;&gt;clkao&lt;/a&gt;&amp;nbsp;在 CUSCOP 2012 介紹的 &quot;LiveScript - tax-free JavaScript&quot; , 我到了 2013 的 HDM 聚會，才經由他介紹才知道，一看真是驚為天人，真是才疏學淺。&lt;br /&gt;
&lt;br /&gt;
對於正在使用 JavaScript 或 CoffeeScript 為解決方案的朋友，可以考慮試試 LiveScript&amp;nbsp;&lt;a href=&quot;http://livescript.net/&quot;&gt;http://livescript.net/&lt;/a&gt;&amp;nbsp;.&lt;br /&gt;
&lt;br /&gt;
由於目前使用者相對於 CoffeeScript 算少，所以很多工具尚很欠缺，請有志青年一起捲起袖子來開發。&lt;br /&gt;
&lt;br /&gt;
目前阿土伯進行的是 LiveScript JetBrains IDEs(IntelliJ , PHPStorm, WebStorm, RubyMine, PyCharm) 的支援。&lt;br /&gt;
Source Code hosting 在 Github&amp;nbsp;&lt;a href=&quot;https://github.com/racklin/livescript-idea&quot;&gt;https://github.com/racklin/livescript-idea&lt;/a&gt;&amp;nbsp;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
clkao 精彩的 LiveScript - tax-free Javascript 簡報：&lt;br /&gt;
&lt;br /&gt;
&lt;script async=&quot;&quot; class=&quot;speakerdeck-embed&quot; data-id=&quot;5030a6d7edfca800020280a7&quot; data-ratio=&quot;1.33333333333333&quot; src=&quot;//speakerdeck.com/assets/embed.js&quot;&gt;&lt;/script&gt;

</content><link rel='replies' type='application/atom+xml' href='http://racklin.blogspot.com/feeds/6101911408050704481/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/623037388172682225/6101911408050704481' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/623037388172682225/posts/default/6101911408050704481'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/623037388172682225/posts/default/6101911408050704481'/><link rel='alternate' type='text/html' href='http://racklin.blogspot.com/2013/07/livescript-tax-free-javascript.html' title='LiveScript - tax-free javascript'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00734471337083697849</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-623037388172682225.post-3658272027256127117</id><published>2013-07-15T16:09:00.000+08:00</published><updated>2013-07-15T16:58:44.044+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><category scheme="http://www.blogger.com/atom/ns#" term="PostgreSQL"/><category scheme="http://www.blogger.com/atom/ns#" term="Programming"/><category scheme="http://www.blogger.com/atom/ns#" term="Software"/><title type='text'>改善 Programmer 生活的 SQL 技巧</title><content type='html'>在 Ruby Tuesday #24 應邀的一場 Lightning Talk.&lt;br /&gt;
&lt;br /&gt;
現在工程師在面對大量方便易用的 MVC Framework 之餘，也應了解 ORM 背後的機制以及 SQL 相關的技巧。&lt;br /&gt;
&lt;br /&gt;
錄影：&lt;a href=&quot;http://www.youtube.com/watch?v=CnJf_KVTfA0&quot;&gt;http://www.youtube.com/watch?v=CnJf_KVTfA0&lt;/a&gt;
&lt;br /&gt;
&lt;br /&gt;
簡報檔：
&lt;br /&gt;
&lt;script async=&quot;&quot; class=&quot;speakerdeck-embed&quot; data-id=&quot;571859e0c4c00130c82d2e39027463f9&quot; data-ratio=&quot;1.33333333333333&quot; src=&quot;//speakerdeck.com/assets/embed.js&quot;&gt;&lt;/script&gt;</content><link rel='replies' type='application/atom+xml' href='http://racklin.blogspot.com/feeds/3658272027256127117/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/623037388172682225/3658272027256127117' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/623037388172682225/posts/default/3658272027256127117'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/623037388172682225/posts/default/3658272027256127117'/><link rel='alternate' type='text/html' href='http://racklin.blogspot.com/2013/07/programmer-sql.html' title='改善 Programmer 生活的 SQL 技巧'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00734471337083697849</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-623037388172682225.post-4513559366314188278</id><published>2011-08-30T09:15:00.000+08:00</published><updated>2011-08-30T09:15:52.809+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="blogger-ext"/><title type='text'>將 jQuery 及 blogger-ext2 由 Blogger 移除了</title><content type='html'>至今還有部份使用者來信問問題, 感謝大家的對 blogger-ext2 的支持及不離不棄, 不過建議大家棄了它吧!&lt;br /&gt;
&lt;br /&gt;
由於 blogger.com 目前已經將大部份的功能都已內建了, 所以該專案已經沒有存在的必要了, 所以建議有在使用的朋友, 請直接使用 blogger.com 內建的 &quot;繼續閱讀&quot; &quot;標籤雲&quot; &quot;社群分享按鈕&quot; 功能!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
</content><link rel='replies' type='application/atom+xml' href='http://racklin.blogspot.com/feeds/4513559366314188278/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/623037388172682225/4513559366314188278' title='2 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/623037388172682225/posts/default/4513559366314188278'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/623037388172682225/posts/default/4513559366314188278'/><link rel='alternate' type='text/html' href='http://racklin.blogspot.com/2011/08/jquery-blogger-ext2-blogger.html' title='將 jQuery 及 blogger-ext2 由 Blogger 移除了'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00734471337083697849</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-623037388172682225.post-7539651181321800423</id><published>2011-04-08T23:18:00.002+08:00</published><updated>2011-08-30T09:46:00.358+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Linux"/><category scheme="http://www.blogger.com/atom/ns#" term="Thinkpad"/><title type='text'>為 Thinkpad T61 Debian Linux 換上 SSD</title><content type='html'>由於身邊越來越多的朋友以及 Twitter 上的朋友換了 MacBook Air, 整體表現, 真的只能用 &quot;輕&quot;&quot;快&quot; 二字形容. 讓我也很心動, 想把服役多年的 Thinkpad T61 換掉, 換成 MacBook Air 13&quot; .&lt;br /&gt;
在比較 &lt;a href=&quot;http://www.apple.com/why-mac/compare/&quot;&gt;MacBook Air 規格&lt;/a&gt; 以及 &lt;a href=&quot;http://www.thinkwiki.org/wiki/Category:T61&quot;&gt;T61 規格&lt;/a&gt; 後, 冷靜想想, MBA 及 T61 有著差距不大的 Intel Core 2 Duo 2.x CPU 及同樣是 Nvidia Graphic .&lt;br /&gt;
由於目前使用的 &lt;a href=&quot;http://www.linuxmint.com/download_lmde.php&quot;&gt;LMDE 64&lt;/a&gt; 加上 &lt;a href=&quot;http://liquorix.net/&quot;&gt;Liquorix Kernel&lt;/a&gt; 其實也夠快了, 開機 15-20s, 程式也沒什麼太慢的感覺, 那麼, 唯一的效能爆點就在 SSD 了, 就這樣, 開始網購相關的昇級配件了. (看來短時間我不會由小黑變小銀了)&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;b&gt;SSD 的選擇&lt;/b&gt;&lt;br /&gt;
本來是要選擇號稱藍星最快的 OCZ 版 SSD, 但是在 OCZ &lt;a href=&quot;http://www.pceva.com.cn/html/2011/storgetech_0313/215_4.html&quot;&gt;爆出&lt;/a&gt;了&lt;a href=&quot;http://blog.macsales.com/9438-not-all-ssd%E2%80%99s-are-created-equal-the-story-continues&quot;&gt;誠信&lt;/a&gt;問題, 連大廠都這麼硬幹, 那還是買安全牌 Intel 的好了, 由於 Intel 新的 310 , 520 series 剛推出, 所以相對的 X25M series 就成了 C/P 值很高的選擇! 就決定是你了, Intel X25M .&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;解除小黑 ICH8M 封印&lt;/b&gt;&lt;br /&gt;
由於小黑使用的 ICH8M 晶片, 其實是支援 SATA2 的, 但由於 IBM 官方的 BIOS 將它限制在 SATA1 也就是 1.5Gb/s , 所以我們需要 &lt;a href=&quot;http://forum.notebookreview.com/lenovo-ibm/459591-t61-x61-sata-ii-1-5-gb-s-cap-willing-pay-solution-8.html#post6501443&quot;&gt;第三方的 BIOS Patch&lt;/a&gt; 來讓它支援 SATA2 3.0Gb/s 的速度. (注意, 使用非官方 BIOS 可能會破壞原廠保固條約, 請自行衡量)&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Partition Alignment&lt;/b&gt;&lt;br /&gt;
由於 &lt;a href=&quot;http://en.wikipedia.org/wiki/Solid-state_drive&quot;&gt;SSD&lt;/a&gt; 的結構和傳統的硬碟差異很大, 所以在效能優化上面, &lt;a href=&quot;https://wiki.archlinux.org/index.php/SSD#Tips_for_Maximizing_SSD_Performance&quot;&gt;Partition Alignment&lt;/a&gt; 就非常的重要(阿土伯機器上, 在 X25M 上會影響到 Automatic TRIM 是否生效).&lt;br /&gt;
一開始踩到個雷, 只是簡單參考 &lt;a href=&quot;https://wiki.ubuntu.com/MagicFab/SSDchecklist&quot;&gt;Ubuntu SSD Checklist&lt;/a&gt; 來設定, 利用 fdisk 來切割, 結果是錯的.!!!這是個雷!!!.&lt;br /&gt;
如果要利用 fdisk 工具, 請參考 &lt;a href=&quot;http://www.nuclex.org/blog/personal/80-aligning-an-ssd-on-linux&quot;&gt;Aligning an SSD on Linux&lt;/a&gt; 或 &lt;a href=&quot;https://wiki.archlinux.org/index.php/SSD_Memory_Cell_Clearing#Post_Process_Observation&quot;&gt;這裡&lt;/a&gt;&lt;br /&gt;
. 如果不想麻煩, 就使用 gdisk (gnu fdisk) 工具, 它會自動為您對齊.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Automatic TRIM&lt;/b&gt;&lt;br /&gt;
在 Linux 目前 EXT4 和 BTRFS 都可以支援 SSD 的 ATA_TRIM , 為了穩定考量, 我選擇老朋友 EXT4, 接著只要在 mount option 中加上 discard 即可.&lt;br /&gt;
詳細可以參考這篇 &lt;a href=&quot;https://sites.google.com/site/lightrush/random-1/howtoconfigureext4toenabletrimforssdsonubuntu&quot;&gt;Howto&lt;/a&gt;.&lt;br /&gt;
一切似乎完美, 想必您和阿土伯一樣, 想知道 Automatic TRIM 是否真的有生效, &lt;br /&gt;
可以參考這篇 &lt;a href=&quot;https://sites.google.com/site/lightrush/random-1/checkiftrimonext4isenabledandworking&quot;&gt;Howto&lt;/a&gt; , 如果您利用 hdparm -I /dev/sdx 確實您的 SSD 支援 TRIM , 而在檔案刪除後, 利用 hdparm --read-sector 郤沒有得到一堆的00, 不用緊張(當然我很緊張), 檢查一下您的 Partition 是否沒有對齊, 或是查看一下您的 Linux kernel 是否 &gt;2.6.33 .&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Journaling&lt;/b&gt;&lt;br /&gt;
大部份的 Linux on SSD 文件都要您關閉 journal , 可以降低 IO 的量, 增加 SSD 的壽命, 但是相對的, 對於檔案因不正常原因斷電或當機損壞機率也增加, 對於阿土伯來說, X25M 保固三年, 且如果由正常壽命 7-8 年降成 5-6 年(T61 應該不會再用三年了吧!!), 也比我的資料或程式碼損壞來的好多了, 那可是會降低阿土伯我的壽命呀~~~~&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Performance Tuning&lt;/b&gt;&lt;br /&gt;
這部份我調整的大致依 WIKI 上所說, 將 I/O Scheduler 改成 noop .&lt;br /&gt;
以及將 /tmp 使用 tmpfs 代替.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
目前, 由 GRUB2 按下 [ENTER] 到 gdm3 出現大約是 10 秒左右, 執行相關的程式&lt;br /&gt;
啟動時間也大幅縮短, 尤其是 Java 相關的 IDE 更是明顯..&lt;br /&gt;
目前除了 &quot;輕&quot; 是先天因素沒的和 MBA 比外, 使用上速度的流暢性上, &lt;br /&gt;
T61 又重新證明它老當益壯, 要再陪我征戰程式設計老宅這條路.</content><link rel='replies' type='application/atom+xml' href='http://racklin.blogspot.com/feeds/7539651181321800423/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/623037388172682225/7539651181321800423' title='2 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/623037388172682225/posts/default/7539651181321800423'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/623037388172682225/posts/default/7539651181321800423'/><link rel='alternate' type='text/html' href='http://racklin.blogspot.com/2011/04/thinkpad-t61-debian-linux-ssd.html' title='為 Thinkpad T61 Debian Linux 換上 SSD'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00734471337083697849</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-623037388172682225.post-6419357565796707741</id><published>2011-01-05T10:34:00.001+08:00</published><updated>2011-01-20T10:57:50.108+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="epub"/><title type='text'>ePubConv.mobi 中文電子書簡繁轉換服務</title><content type='html'>&lt;b&gt; &lt;a href=&quot;http://epubconv.mobi/&quot;&gt;http://epubconv.mobi/&lt;/a&gt; 電子書簡繁互轉網站開張!&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
由於本身是 Kindle 3 的使用者, 除了技術文件和大量免費的英文書之外.&lt;br /&gt;
其實有不少的中文資源可以下載到書, 像是 &lt;a href=&quot;http://www.haodoo.net/&quot;&gt;好讀網站&lt;/a&gt; 或是 &lt;a href=&quot;http://www.cnepub.com/index/&quot;&gt;掌上书苑&lt;/a&gt; .&lt;br /&gt;
&lt;br /&gt;
所以相信大家和我一樣會希望能方便的在 簡-&gt;繁 或 繁-&gt;簡 將下載的 .epub 轉換, 以自己最習慣的文字閱讀.&lt;br /&gt;
然而除了編碼的轉換外, 更支援詞庫的轉換, 因為簡體字一個字可能對映到多個繁體字(如: 干, 后)&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;功能&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
* 支援多種字元編碼: GB2312 , BIG5 , UTF8&lt;br /&gt;
* 不只編碼轉換, 更是正體和簡體中文文字翻譯: ex. 后天，皇后, 主干, 干净 - 後天，皇后, 主幹, 乾淨&lt;br /&gt;
* 部份成語支援: ex. 独占鳌头 - 獨佔鰲頭&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
於是我利用年假做了這個服務, 希望能方便大家能有個更愉快的閱讀體驗!&lt;br /&gt;
當然, epub 電子書不是只有在 Kindle 上能用, iPad / Android / Windows / Linux 上都有相關的閱讀程式.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;參考:&lt;/b&gt;&lt;br /&gt;
手動轉換或利用 convertZ 工具, 可參考以下文章&lt;br /&gt;
&lt;a href=&quot;http://jeremy.tfeng.org/?p=327&quot;&gt;如何將ePub電子書繁體化(簡體化)&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://racklin.blogspot.com/feeds/6419357565796707741/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/623037388172682225/6419357565796707741' title='9 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/623037388172682225/posts/default/6419357565796707741'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/623037388172682225/posts/default/6419357565796707741'/><link rel='alternate' type='text/html' href='http://racklin.blogspot.com/2011/01/epubconvmobi.html' title='ePubConv.mobi 中文電子書簡繁轉換服務'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00734471337083697849</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>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-623037388172682225.post-6086972513593484728</id><published>2010-03-02T16:10:00.008+08:00</published><updated>2011-08-30T09:45:23.956+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Linux"/><category scheme="http://www.blogger.com/atom/ns#" term="Programming"/><category scheme="http://www.blogger.com/atom/ns#" term="Ubuntu"/><title type='text'>CPU frequency selector by dmenu on Ubuntu</title><content type='html'>由於目前改用 &lt;a href=&quot;http://awesome.naquadah.org/&quot;&gt;awesome window manager&lt;/a&gt; 取代了 GNOME Desktop , 所以很多&quot;好用&quot;的 Panel Applets 不能使用了.&lt;br /&gt;
&lt;br /&gt;
尤其是 cpufreq-selector 這個對 Laptop 很常用的 applet 不能用, 實在很可惜.&lt;br /&gt;
所以, 利用 dmenu (part of dwm-tools) 來刻一個簡單的 cpufreq-selector.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;ScreenShot&lt;/b&gt;:&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTze98KrJ7wlUCl9kIC19XJtKwV8bVED7_8tmH-d64_RjYefjlqxkSyE05GDl5XA_hNEPRqQWRyDXCtl0G1ik-j-Au4SvkKolaDAqxczprbLCp7ayNLAmr8qDrdSNo3BHEdlcsNTsLxWM/s1600-h/screenshot_007.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;14&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTze98KrJ7wlUCl9kIC19XJtKwV8bVED7_8tmH-d64_RjYefjlqxkSyE05GDl5XA_hNEPRqQWRyDXCtl0G1ik-j-Au4SvkKolaDAqxczprbLCp7ayNLAmr8qDrdSNo3BHEdlcsNTsLxWM/s640/screenshot_007.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;安裝 dmenu:&lt;/b&gt;&lt;br /&gt;
&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;
sudo apt-get install dwm-tools
&lt;/code&gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;撰寫 cpufreq script:&lt;/b&gt;&lt;br /&gt;
&lt;a href=&quot;https://docs.google.com/leaf?id=0BxRk4nzRGBJXNjlkZTIyZmQtOTYwNS00ODU4LTg1YzMtZDUxN2IwZjMyNWUz&amp;amp;hl=zh_TW&quot; target=&quot;_blank&quot;&gt;或可以由此下載.&lt;/a&gt;&lt;br /&gt;
&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;
#!/bin/sh                                                                                       
cur_governor=`cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor`
avail_governors=`cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors`

# using dmenu to select cpu governor
cpu_governor=$(for i in $avail_governors ;do

    if [ $cur_governor = $i ]; then
       echo &quot;[$i]&quot;
    else
       echo $i
    fi
done | dmenu -p &quot;Select CPU Governor: &quot;| sed &quot;s/\[\([a-z|A-Z]*\)\]/\1/g&quot;)

if [ -n &quot;$cpu_governor&quot; ]; then
    for cpu in `ls -d /sys/devices/system/cpu/cpu?` ; do
        cpu_num=`basename $cpu | sed &quot;s/cpu//&quot;`
        cpufreq-selector -c $cpu_num -g $cpu_governor
    done
fi
&lt;/code&gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;關閉 cpufreq-selector 每次必需輸入密碼(如果你覺得煩):&lt;/b&gt;&lt;br /&gt;
修改 /usr/share/polkit-1/actions/org.gnome.cpufreqselector.policy &lt;br /&gt;
&lt;pre&gt;&lt;code class=&quot;bash&quot;&gt;
gksudo gedit /usr/share/polkit-1/actions/org.gnome.cpufreqselector.policy
&lt;/code&gt;
&lt;/pre&gt;&lt;br /&gt;
找到原始:&lt;br /&gt;
&lt;pre&gt;&lt;code class=&quot;xml&quot;&gt;
    &amp;lt;defaults&amp;gt; 
      &amp;lt;allow_inactive&amp;gt;no&amp;lt;/allow_inactive&amp;gt; 
      &amp;lt;allow_active&amp;gt;auth_admin_keep&amp;lt;/allow_active&amp;gt; 
    &amp;lt;/defaults&amp;gt; 
&lt;/code&gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
修改成:&lt;br /&gt;
&lt;pre&gt;&lt;code class=&quot;xml&quot;&gt;
    &amp;lt;defaults&amp;gt; 
      &amp;lt;allow_inactive&amp;gt;no&amp;lt;/allow_inactive&amp;gt; 
      &amp;lt;allow_active&amp;gt;yes&amp;lt;/allow_active&amp;gt; 
    &amp;lt;/defaults&amp;gt; 
&lt;/code&gt;
&lt;/pre&gt;</content><link rel='enclosure' type='' href='https://docs.google.com/leaf?id=0BxRk4nzRGBJXNjlkZTIyZmQtOTYwNS00ODU4LTg1YzMtZDUxN2IwZjMyNWUz&amp;hl=zh_TW' length='0'/><link rel='replies' type='application/atom+xml' href='http://racklin.blogspot.com/feeds/6086972513593484728/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/623037388172682225/6086972513593484728' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/623037388172682225/posts/default/6086972513593484728'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/623037388172682225/posts/default/6086972513593484728'/><link rel='alternate' type='text/html' href='http://racklin.blogspot.com/2010/03/cpu-frequency-selector-by-dmenu-on.html' title='CPU frequency selector by dmenu on Ubuntu'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00734471337083697849</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/AVvXsEgTze98KrJ7wlUCl9kIC19XJtKwV8bVED7_8tmH-d64_RjYefjlqxkSyE05GDl5XA_hNEPRqQWRyDXCtl0G1ik-j-Au4SvkKolaDAqxczprbLCp7ayNLAmr8qDrdSNo3BHEdlcsNTsLxWM/s72-c/screenshot_007.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-623037388172682225.post-1103969656483306595</id><published>2010-02-16T21:42:00.002+08:00</published><updated>2010-02-16T21:48:14.393+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="心情雜記"/><category scheme="http://www.blogger.com/atom/ns#" term="抱怨"/><title type='text'>新年快樂~大家久違了!</title><content type='html'>&lt;span style=&quot;font-weight:bold;&quot;&gt;新年快樂!&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;看著上一篇更新, 足足有一年之久了!&lt;br /&gt;其間,除了工作的異動, 最大的改變是家中又多了一位新的成員..&lt;br /&gt;&lt;br /&gt;二個成員, 把阿土伯壓的沒力氣寫文章了... &lt;br /&gt;&lt;br /&gt;看到 Mark (&lt;a href=&quot;http://blog.markplace.net/marks_place/11/2009/12/30/406&quot;&gt;一灘死水&lt;/a&gt;) 這篇, &lt;br /&gt;不津笑了出來.. 原來新手爸媽都是一樣.. 連網誌更新變慢的藉口都相同.&lt;br /&gt;&lt;br /&gt;總之, 今年的目標就是能定時更新網誌.</content><link rel='replies' type='application/atom+xml' href='http://racklin.blogspot.com/feeds/1103969656483306595/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/623037388172682225/1103969656483306595' title='2 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/623037388172682225/posts/default/1103969656483306595'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/623037388172682225/posts/default/1103969656483306595'/><link rel='alternate' type='text/html' href='http://racklin.blogspot.com/2010/02/blog-post.html' title='新年快樂~大家久違了!'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00734471337083697849</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-623037388172682225.post-86850715867555920</id><published>2008-11-09T15:01:00.001+08:00</published><updated>2008-11-09T15:01:32.386+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Linux"/><category scheme="http://www.blogger.com/atom/ns#" term="Ubuntu"/><title type='text'>Ubuntu 8.10 at Thinkpad T61</title><content type='html'>&lt;div xmlns=&#39;http://www.w3.org/1999/xhtml&#39;&gt;前幾天把 &lt;a href=&#39;http://www.ubuntu.com/&#39; target=&#39;_blank&#39;&gt;Ubuntu 8.10 Desktop Edition 64Bit&lt;/a&gt; 版本昇級.&lt;br/&gt;昇級方法可以參考官方的這篇說明: &lt;a href=&#39;http://www.ubuntu.com/getubuntu/upgrading&#39; target=&#39;_blank&#39;&gt;http://www.ubuntu.com/getubuntu/upgrading&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;基本上所有 T61 上的硬體都能正確抓到, 包含先前提到的 Intel 4965AGN wireless LED 也一併改善解決.&lt;br/&gt;&lt;br/&gt;然而 nvidia driver 由於 restricted driver 內建是 177.80 , 所以踩到了一個雷.&lt;br/&gt;&lt;br/&gt;&lt;span style=&#39;font-weight: bold; font-size: 110%;&#39;&gt;&lt;br/&gt;無法登出或 Ctrl+Alt+Backspace:&lt;/span&gt;&lt;br/&gt;[G86GL] Latest NVIDIA drivers: X hangs with blank screen after logout. &lt;br/&gt;阿土伯採用的是延長 GDM 等待 nvidia driver 回應的時間.&lt;br/&gt;也就是請修改 /etc/gdm/gdm.conf 中的 GdmXserverTimeout 將它加大到 30 以上, 阿土伯目前使用 40.&lt;br/&gt;沒有太大問題再發生.&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;span style=&#39;font-weight: bold; font-size: 110%;&#39;&gt;2D performance 太慢:&lt;/span&gt;&lt;br/&gt;nvidia driver 在 linux 上 2D 效能一直不怎麼樣, 當然官方也一直在改進, 由於 8.10 直接跳到了 177.80 版, 所以可以&lt;br/&gt;使用一些新的設定, 可以參考:  &lt;a href=&#39;http://www.nvnews.net/vbulletin/showthread.php?t=115916&#39; target=&#39;_blank&#39;&gt;http://www.nvnews.net/vbulletin/showthread.php?t=115916&lt;/a&gt; 討論串.&lt;br/&gt;或直接在 /etc/X11/xorg.conf 加入 &lt;br/&gt;Option &quot;PixmapCacheSize&quot; &quot;1000000&quot;&lt;br/&gt;Option &quot;AllowSHMPixmaps&quot; &quot;0&quot; &lt;br/&gt;&lt;br/&gt;並在 ~/.gnomerc 加入&lt;br/&gt;nvidia-settings -a InitialPixmapPlacement=2 -a GlyphCache=1&lt;br/&gt;&lt;br/&gt;可以獲得很大的改善. &lt;br/&gt;可以利用 firefox 打開 addons 管理視窗, 然後利用 mouse wheel scroll 看看差別有多大...&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://racklin.blogspot.com/feeds/86850715867555920/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/623037388172682225/86850715867555920' title='2 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/623037388172682225/posts/default/86850715867555920'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/623037388172682225/posts/default/86850715867555920'/><link rel='alternate' type='text/html' href='http://racklin.blogspot.com/2008/11/ubuntu-810-at-thinkpad-t61.html' title='Ubuntu 8.10 at Thinkpad T61'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00734471337083697849</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-623037388172682225.post-2459763817964938147</id><published>2008-09-16T09:55:00.001+08:00</published><updated>2008-09-16T09:56:39.509+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="blogger-ext"/><category scheme="http://www.blogger.com/atom/ns#" term="Gadget"/><category scheme="http://www.blogger.com/atom/ns#" term="google"/><category scheme="http://www.blogger.com/atom/ns#" term="iGoogle"/><title type='text'>iGoogle Tab RSS 小工具 Bug Fixed</title><content type='html'>&lt;div xmlns=&#39;http://www.w3.org/1999/xhtml&#39;&gt;感謝幾位網友的提醒, 阿土伯忘了現在 iGoogle 已不建議並(禁用?) html-inline 的 content 了..&lt;br/&gt;所以造成了幾個小工具已不能使用.. 已修復完異.. 謝謝大家愛用..&lt;br/&gt;&lt;br/&gt;什麼是 Tab RSS 請見下圖及參考說明:&lt;br/&gt;&lt;img src=&#39;http://racklin.googlepages.com/tabrss_tw_s.png&#39;/&gt;&lt;br/&gt;&lt;br/&gt;使用說明及介紹:&lt;br/&gt;&lt;a href=&#39;http://racklin.blogspot.com/2007/07/igoogle-tab-rss.html&#39; target=&#39;_blank&#39;&gt;iGoogle Tab RSS 小工具&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://racklin.blogspot.com/feeds/2459763817964938147/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/623037388172682225/2459763817964938147' title='1 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/623037388172682225/posts/default/2459763817964938147'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/623037388172682225/posts/default/2459763817964938147'/><link rel='alternate' type='text/html' href='http://racklin.blogspot.com/2008/09/igoogle-tab-rss-bug-fixed.html' title='iGoogle Tab RSS 小工具 Bug Fixed'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00734471337083697849</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-623037388172682225.post-165070998963447690</id><published>2008-09-01T10:56:00.002+08:00</published><updated>2008-09-03T11:48:19.033+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="心情雜記"/><title type='text'>李斯諫逐客書</title><content type='html'>&lt;div xmlns=&#39;http://www.w3.org/1999/xhtml&#39;&gt;學生時唸到的古文, 沒想到在現在會這麼有感覺. &lt;br /&gt;本土/外來/挺誰/嗆誰/反誰/護誰 一再操作這樣議題昇高人民對立是否得宜...&lt;br /&gt;政治也是一種專業, 程式設計亦然.&lt;br /&gt;當批評別人的設計有問題時, 能謙虛的自省自己的專業, 是否也出現了相同的問題, 並容納多元的意見以及不同團隊間的合作...&lt;br /&gt;共勉之~&lt;br /&gt;&lt;br /&gt;##CONTINUE##&lt;br /&gt;&lt;br /&gt;李斯諫逐客書　　　　李　斯&lt;br /&gt;　　秦宗室大臣皆言秦王曰：「諸侯人來事秦者，祇為其主遊間秦耳，請一切逐客。」李斯&lt;br /&gt;議亦在逐中。斯乃上書曰：「臣聞吏議逐客，竊以為過矣。」&lt;br /&gt;　　「昔穆公求士，西取由余於戎，東得百里奚於宛，迎蹇叔於宋，求丕豹，公孫支於晉。&lt;br /&gt;此五子者，不產於秦，而穆公用之，井國二十，遂霸西戎。孝公用商鞅之法，移風易俗，民&lt;br /&gt;以殷盛，國以富彊，百姓樂用，諸侯親服獲楚，魏之師，舉地千里，至今治強。惠王用張儀&lt;br /&gt;之計，拔三川之地，西井巴蜀，北收上郡，南取漢中。包九夷，制鄢郢，東據成皋之險，割&lt;br /&gt;膏腴之壤，遂散六國之從，使之西面事秦，功施到今。昭王得范雎，廢穰侯，逐華陽，強公&lt;br /&gt;室，杜私門，蠶食諸侯，使秦成帝業。此四君者，皆以客之功。由此觀之，客何負於秦哉！&lt;br /&gt;向使四君卻客而不內，疏士而不與，是使國無富利之實，而秦無強大之名也。」&lt;br /&gt;　　「今陛下致昆山之玉，有隨和之寶，垂明月之珠，服太阿之劍，乘纖離之馬，建翠鳳之&lt;br /&gt;旗，樹靈鼉之鼓：此數寶者，秦不生一焉，而陛下說之，何也？必秦國之所生然後可，則是&lt;br /&gt;夜光之璧，不飾朝廷；犀象之器，不為玩好；鄭衛之女，不充後官；而駿馬駃騠，不實外廄&lt;br /&gt;；江南金錫不為用；西蜀丹青不為采。所以飾後官，充下陳，娛心意，說耳目者，必出於秦&lt;br /&gt;然後可，則是宛珠之簪，傅璣之珥，阿縞之衣？錦繡之飾，不進於前；而隨俗雅化，佳冶窈&lt;br /&gt;窕，趙女不立於側也。夫擊甕叩缶，彈箏搏髀，而歌呼嗚嗚快耳者，真秦之聲也；鄭衛桑間&lt;br /&gt;，韶虞武象者，異國之樂也。今棄擊甕而就鄭衛，退彈箏而取韶虞，若是者何也？快意當前&lt;br /&gt;，適觀而已矣。今取人則不然，不問可否，不論曲直，非秦者去，為客者逐，然則是所重者&lt;br /&gt;在乎笆樂珠玉，而所輕者在乎人民也。此非所以跨海內，致諸侯之術也。」&lt;br /&gt;　　「臣聞地廣者粟多，國大者人眾，兵強者士勇。是以&lt;b&gt;&lt;font color=&#39;#990000&#39;&gt;泰山不讓士壤，故能成其大；河海&lt;br /&gt;不擇細流，故能就其深；王者不卻眾庶，故能明其德。是以地無四，方民無異國，四時充美&lt;br /&gt;，鬼神降福&lt;/font&gt;&lt;/b&gt;。此五帝，三王之所以無敵也。今乃棄黔首以資敵國，卻賓客以業諸侯，使天下&lt;br /&gt;之士退而不敢西向，裹足不入秦，此所謂『藉寇兵而齎盜糧』者也。」&lt;br /&gt;　　「&lt;b&gt;&lt;font color=&#39;#990000&#39;&gt;夫物不產於秦，可寶者多；士不產於秦，而願忠者眾。今逐客以資敵國，損民以益讎&lt;br /&gt;，內自虛而外樹怨於諸侯，求國無危，不可得也&lt;/font&gt;&lt;/b&gt;。」&lt;br /&gt;　　秦王乃除逐客之令，復李斯官。&lt;br /&gt;大意：&lt;br /&gt;　　　(一)自「秦宗室大臣皆言秦王曰」至「竊以為過矣」&lt;br /&gt;　　　　　說明逐客為過。&lt;br /&gt;　　　(二)自「昔穆公求士」至「而秦無強大之名也」&lt;br /&gt;　　　　　（舉繆公、孝公、惠王、昭王例）說明客有功於秦（暗示逐客為不智）。&lt;br /&gt;　　　(三)自「今陛下致昆山之玉」至「致諸侯之術也」&lt;br /&gt;　　　　　說明逐其民人而取其色樂珠玉，非王霸者之所為（以色樂珠玉之取襯客之去為不&lt;br /&gt;　　　　　合理）。&lt;br /&gt;　　　(四)自「臣聞地廣者粟多」至「此所謂藉寇兵而齎盜糧者也」&lt;br /&gt;　　　　　說明卻客而為他國所用，非秦之福（以逐客資敵業諸侯說明爭取人才的重要性）&lt;br /&gt;　　　　　。&lt;br /&gt;　　　(五)自「夫物不產於秦」至「不可得也」&lt;br /&gt;　　　　　說明逐客則國危。&lt;br /&gt;　　　(六)自「秦王乃除逐客之令」至「復李斯官」&lt;br /&gt;　　　　　記敘李斯復官。&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://racklin.blogspot.com/feeds/165070998963447690/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/623037388172682225/165070998963447690' title='2 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/623037388172682225/posts/default/165070998963447690'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/623037388172682225/posts/default/165070998963447690'/><link rel='alternate' type='text/html' href='http://racklin.blogspot.com/2008/09/blog-post.html' title='李斯諫逐客書'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00734471337083697849</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-623037388172682225.post-7492887803680811049</id><published>2008-08-18T11:29:00.003+08:00</published><updated>2008-08-18T17:42:09.130+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Gecko"/><category scheme="http://www.blogger.com/atom/ns#" term="JavaScript"/><category scheme="http://www.blogger.com/atom/ns#" term="Programming"/><title type='text'>GREUtils 1.1 in trunk</title><content type='html'>&lt;div xmlns=&#39;http://www.w3.org/1999/xhtml&#39;&gt;&lt;div style=&#39;padding: 0pt 3em 1.2em 0pt;&#39; id=&#39;wikicontent&#39;&gt;GREUtils 1.1 已經 update 到  http://greutils.googlecode.com/svn/trunk 中, 有興趣參考 Source Code 或使用, 請利用 svn checkout .&lt;br/&gt;&lt;br/&gt;GREUtils 是一個 XULRunner / Firefox extensions Javascript Utilities Libraries.&lt;br/&gt;1.0 到 1.1 基本上是全面改寫, GREUtils 1.1 提供以下功能:&lt;br/&gt;&lt;ul&gt;&lt;li&gt;Object extend function &lt;/li&gt;&lt;li&gt;include / include_once specified URL script. &lt;/li&gt;&lt;li&gt;XPCOM utilities &lt;/li&gt;&lt;li&gt;Charset Convert &lt;/li&gt;&lt;li&gt;Preferences Services  &lt;/li&gt;&lt;li&gt;File IO &lt;/li&gt;&lt;li&gt;&lt;font color=&#39;#990000&#39;&gt;&lt;b&gt;Dialog utilities (all XPCOM implemented, can use in javascript code modules)&lt;/b&gt;&lt;/font&gt;&lt;br/&gt;&lt;/li&gt;&lt;li&gt;Controller and CommandDispatcher&lt;a href=&#39;http://code.google.com/p/greutils/w/edit/CommandDispatcher&#39;&gt;?&lt;/a&gt; Helper &lt;/li&gt;&lt;li&gt;&lt;b&gt;&lt;font color=&#39;#990000&#39;&gt;Cryphto Hash Utilities – md5 / sha1 /sha256 &lt;/font&gt;&lt;/b&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;&lt;font color=&#39;#990000&#39;&gt;JSON encode / decode use XPCOM implemented (VERY FASTer then json.org&#39;s javascript version)&lt;/font&gt;&lt;/b&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;&lt;font color=&#39;#990000&#39;&gt;Threading – Native Multi-Threading support &lt;/font&gt;&lt;/b&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;&lt;font color=&#39;#990000&#39;&gt;&lt;a href=&#39;http://developer.mozilla.org/en/docs/Using_JavaScript_code_modules&#39; target=&#39;_blank&#39;&gt;JavaScript code modules&lt;/a&gt; support&lt;/font&gt;&lt;/b&gt;&lt;br/&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br/&gt;其它改變:&lt;br/&gt;&lt;ul&gt;&lt;li&gt;GREUtils 1.1  全部改寫了 1.0 的 inline document , 由 &lt;a href=&#39;http://www.scriptdoc.org/&#39; target=&#39;_blank&#39;&gt;ScriptDoc&lt;/a&gt; 改成了 &lt;a href=&#39;http://code.google.com/p/jsdoc-toolkit/&#39; target=&#39;_blank&#39;&gt;jsdoc&lt;/a&gt; 格式, 以方便產生出 API Reference.&lt;/li&gt;&lt;li&gt;Makefile for linux user , 以方便產生 minified / packed / jsmodues / jsdoc 等 distribution files.&lt;/li&gt;&lt;li&gt;&lt;b&gt;&lt;font color=&#39;#990000&#39;&gt;singleton support&lt;/font&gt;&lt;/b&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;&lt;font color=&#39;#990000&#39;&gt;inherits / namespace&lt;/font&gt;&lt;/b&gt; support (many idea and source from goog javascript libraries).&lt;/li&gt;&lt;/ul&gt;Project URL: &lt;span style=&#39;font-size: 130%;&#39;&gt;&lt;a href=&#39;http://code.google.com/p/greutils/&#39;&gt;http://code.google.com/p/greutils/&lt;/a&gt;&lt;/span&gt;&lt;br/&gt;&lt;br/&gt;API References:  &lt;span style=&#39;font-size: 130%;&#39;&gt;&lt;a href=&#39;http://greutils.googlecode.com/svn/trunk/jsdoc/index.html&#39; target=&#39;_blank&#39;&gt;http://greutils.googlecode.com/svn/trunk/jsdoc/index.html&lt;/a&gt;&lt;/span&gt;&lt;br/&gt;&lt;br/&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://racklin.blogspot.com/feeds/7492887803680811049/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/623037388172682225/7492887803680811049' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/623037388172682225/posts/default/7492887803680811049'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/623037388172682225/posts/default/7492887803680811049'/><link rel='alternate' type='text/html' href='http://racklin.blogspot.com/2008/08/greutils-11-in-trunk.html' title='GREUtils 1.1 in trunk'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00734471337083697849</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-623037388172682225.post-8959661569322146886</id><published>2008-07-04T00:33:00.009+08:00</published><updated>2008-07-08T09:41:28.438+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Gecko"/><category scheme="http://www.blogger.com/atom/ns#" term="JavaScript"/><category scheme="http://www.blogger.com/atom/ns#" term="Programming"/><title type='text'>Threading in Firefox 3</title><content type='html'>&lt;div xmlns=&#39;http://www.w3.org/1999/xhtml&#39;&gt;Firefox 3 (Gecko 1.9) 新增了許多特色 (&lt;a href=&#39;http://developer.mozilla.org/en/docs/Firefox_3_for_developers#New_developer_features_in_Firefox_3&#39; target=&#39;_blank&#39;&gt;詳見&lt;/a&gt; ), 其中一項重要的特色, 便是導入了 Thread Manager 機制.&lt;br /&gt;&lt;br /&gt;##CONTINUE##&lt;br /&gt;&lt;br /&gt;在 Firefox 3 以前, 我們要讓 Javascript 程式在背景執行, 最簡單的方式便是利用 setTimeout / setInterval 方式:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;function backgroundTask() {&lt;br /&gt;   // Perform a small amount of work&lt;br /&gt; &lt;br /&gt;   window.setTimeout(arguments.callee, 100);&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; window.setTimeout(backgroundTask, 100);&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;以上的方式雖然可以把程式丟到背景執行, 然而, 它依然只是在主執行緒(mainThread)中, 以非同步的方式執行.&lt;br /&gt;&lt;br /&gt;Firefox 3 後, 導入了 Thread Manager , 讓我們可以撰寫平台相關的真正多執行緒程式.  &lt;br /&gt;&lt;br /&gt;要實作多執行緒 Javascript 程式,本身必須是 XPCOM Object, 且實作 nsIRunnable 介面(和 Java Thread 很像不是嗎?).&lt;br /&gt;詳細範例可參考 &lt;a target=&#39;_blank&#39; href=&#39;http://developer.mozilla.org/en/docs/The_Thread_Manager&#39;&gt;Thread Manager &lt;/a&gt; 和 &lt;a target=&#39;_blank&#39; href=&#39;http://developer.mozilla.org/en/docs/nsIThreadManager&#39;&gt;nsIThreadManager&lt;/a&gt; .&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Thread Utils:&lt;/b&gt;&lt;br /&gt;雖然 Firefox 3 已經大大簡化了多執行緒程式的寫作方式(且很有 Java 風格), 但就 Javascript 來說, 就顯的有些麻煩, 我們要為每一個要執行的程式, 一一實作成 XPCOM Object 也是一件很煩人的事..&lt;br /&gt;阿土伯在 GREUtils Rewriting 計劃中, 為 Threading 做了一些封裝, 讓您可以比較容易且直覺的使用 Firefox 3 所帶來的 Multi-Threading 這份大禮.&lt;br /&gt;&lt;br /&gt;有關 Thread 部份的 Code 如下, 已修改過可以獨立運作於 GREUtils 整個專案之外:&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;/**&lt;br /&gt; * Thread - is simple and easy use Thread Manager APIs libraries for GRE (Gecko Runtime Environment).&lt;br /&gt; * ONLY Work with Firefox 3 or XULRunner 1.9&lt;br /&gt; * &lt;br /&gt; * @public &lt;br /&gt; * @name GREUtils.Thread&lt;br /&gt; * @namespace GREUtils.Thread &lt;br /&gt; */&lt;br /&gt;var GREUtils = GREUtils || {};&lt;br /&gt;&lt;br /&gt;GREUtils.Thread = {&lt;br /&gt;    &lt;br /&gt;    _threadManager: Components.classes[&quot;@mozilla.org/thread-manager;1&quot;]&lt;br /&gt;                        .getService(Components.interfaces.nsIThreadManager),&lt;br /&gt;    &lt;br /&gt;    _mainThread: null,&lt;br /&gt;    &lt;br /&gt;    _workerThread: null,&lt;br /&gt;    &lt;br /&gt;    reportError: function(err){&lt;br /&gt;        Components.utils.reportError(err);&lt;br /&gt;    }&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * getThreadManager &lt;br /&gt; * &lt;br /&gt; * @public&lt;br /&gt; * @static&lt;br /&gt; * @function &lt;br /&gt; * @return {Object} nsIThreadManager &lt;br /&gt; */&lt;br /&gt;GREUtils.Thread.getThreadManager = function(){&lt;br /&gt;    return this._threadManager;&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * getMainThread&lt;br /&gt; *&lt;br /&gt; * @public&lt;br /&gt; * @static&lt;br /&gt; * @function &lt;br /&gt; * @return {Object} nsIThread main thread &lt;br /&gt; */&lt;br /&gt;GREUtils.Thread.getMainThread = function(){&lt;br /&gt;    if (this._mainThread == null) {&lt;br /&gt;        this._mainThread = GREUtils.Thread.getThreadManager().mainThread;&lt;br /&gt;        &lt;br /&gt;        // extends magical method to worker thread&lt;br /&gt;        // this._workerThread.dispatchMainThread = GREUtils.Thread.dispatchMainThread;&lt;br /&gt;    }&lt;br /&gt;    return this._mainThread;&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * dispatchMainThread&lt;br /&gt; *&lt;br /&gt; * @public&lt;br /&gt; * @static&lt;br /&gt; * @function &lt;br /&gt; * @return {Object} nsIThreadManager &lt;br /&gt; * @param {Object} aRunnable&lt;br /&gt; * @param {Object} aType&lt;br /&gt; */&lt;br /&gt;GREUtils.Thread.dispatchMainThread = function(aRunnable, aType) {&lt;br /&gt;    var mainThread = GREUtils.Thread.getMainThread();&lt;br /&gt;    var aType = aType || mainThread.DISPATCH_NORMAL;&lt;br /&gt;    try {&lt;br /&gt;       mainThread.dispatch(aRunnable, aType);&lt;br /&gt;    }catch (err) {&lt;br /&gt;        GREUtils.Thread.reportError(err);&lt;br /&gt;    }&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * dispatchWorkerThread&lt;br /&gt; * &lt;br /&gt; * @public&lt;br /&gt; * @static&lt;br /&gt; * @function &lt;br /&gt; * @return {Object} nsIThreadManager &lt;br /&gt; * @param {Object} workerThread&lt;br /&gt; * @param {Object} aRunnable&lt;br /&gt; * @param {Object} aType&lt;br /&gt; */&lt;br /&gt;GREUtils.Thread.dispatchWorkerThread = function(workerThread, aRunnable, aType) {&lt;br /&gt;    var aType = aType || workerThread.DISPATCH_NORMAL;&lt;br /&gt;    try {&lt;br /&gt;       workerThread.dispatch(aRunnable, aType);&lt;br /&gt;    }catch (err) {&lt;br /&gt;        GREUtils.Thread.reportError(err);&lt;br /&gt;    }&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * getWorkerThread in pool&lt;br /&gt; * &lt;br /&gt; * @public&lt;br /&gt; * @static&lt;br /&gt; * @function &lt;br /&gt; * @return {Object} nsIThread worker thread &lt;br /&gt; */&lt;br /&gt;GREUtils.Thread.getWorkerThread = function(){&lt;br /&gt;    // get presist work thread &lt;br /&gt;    // will not create new worker thread&lt;br /&gt;    if (this._workerThread == null) {&lt;br /&gt;        this._workerThread = GREUtils.Thread.getThreadManager().newThread(0);&lt;br /&gt;        &lt;br /&gt;        // extends magical method to worker thread&lt;br /&gt;        // this._workerThread.dispatchMainThread = GREUtils.Thread.dispatchMainThread;&lt;br /&gt;    }&lt;br /&gt;    return this._workerThread;&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * createWorkerThread - create new worker thread.&lt;br /&gt; * &lt;br /&gt; * @public&lt;br /&gt; * @static&lt;br /&gt; * @function &lt;br /&gt; * @return {Object} nsIThread worker thread &lt;br /&gt; */&lt;br /&gt;GREUtils.Thread.createWorkerThread = function(){&lt;br /&gt;    // create new worker thread&lt;br /&gt;    var worker = GREUtils.Thread.getThreadManager().newThread(0);&lt;br /&gt;    &lt;br /&gt;    // extends magical method to worker thread&lt;br /&gt;    //worker.dispatchMainThread = GREUtils.Thread.dispatchMainThread;&lt;br /&gt;    &lt;br /&gt;    return worker;&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * CallbackRunnableAdapter&lt;br /&gt; *&lt;br /&gt; * @public&lt;br /&gt; * @class &lt;br /&gt; * @param {Object} func&lt;br /&gt; * @param {Object} data&lt;br /&gt; */&lt;br /&gt;GREUtils.Thread.CallbackRunnableAdapter = function(func, data) {&lt;br /&gt;    this._func = func;&lt;br /&gt;    this._data = data;&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;GREUtils.Thread.CallbackRunnableAdapter.prototype = {&lt;br /&gt;&lt;br /&gt;        get func() {&lt;br /&gt;            return this._func;&lt;br /&gt;        },&lt;br /&gt;        &lt;br /&gt;        set func(func){&lt;br /&gt;            this._func = func || null;&lt;br /&gt;        },&lt;br /&gt;&lt;br /&gt;        get data() {&lt;br /&gt;            return this._data;&lt;br /&gt;        },&lt;br /&gt;        &lt;br /&gt;        set data(data){&lt;br /&gt;            this._data = data || null;&lt;br /&gt;        },&lt;br /&gt;&lt;br /&gt;        run: function() {&lt;br /&gt;            try {&lt;br /&gt;                 if (this.func) {&lt;br /&gt;                     if(this.data) this.func(this.data);&lt;br /&gt;                    else this.func();&lt;br /&gt;                 }&lt;br /&gt;             } catch (err) {&lt;br /&gt;                Components.utils.reportError(err);&lt;br /&gt;            }&lt;br /&gt;        },&lt;br /&gt;        &lt;br /&gt;        QueryInterface: function(iid) {&lt;br /&gt;            if (iid.equals(Components.Interfaces.nsIRunnable) || iid.equals(Components.Interfaces.nsISupports)) {&lt;br /&gt;                return this;&lt;br /&gt;            }&lt;br /&gt;            throw Components.results.NS_ERROR_NO_INTERFACE;&lt;br /&gt;        }&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * WorkerRunnableAdapter&lt;br /&gt; *&lt;br /&gt; * @public&lt;br /&gt; * @class&lt;br /&gt; * @param {Object} func&lt;br /&gt; * @param {Object} callback&lt;br /&gt; * @param {Object} data&lt;br /&gt; */&lt;br /&gt;GREUtils.Thread.WorkerRunnableAdapter = function(func, callback, data) {&lt;br /&gt;    this._func = func;&lt;br /&gt;    this._callback = callback;&lt;br /&gt;    this._data = data;&lt;br /&gt;&lt;br /&gt;    if(arguments.length == 2 ) {&lt;br /&gt;        this._data = callback;&lt;br /&gt;        this._callback = null;        &lt;br /&gt;    }&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;GREUtils.Thread.WorkerRunnableAdapter.prototype = {&lt;br /&gt;&lt;br /&gt;        get func() {&lt;br /&gt;            return this._func;&lt;br /&gt;        },&lt;br /&gt;        &lt;br /&gt;        set func(func){&lt;br /&gt;            this._func = func || null;&lt;br /&gt;        },&lt;br /&gt;&lt;br /&gt;        get callback() {&lt;br /&gt;            return this._callback;&lt;br /&gt;        },&lt;br /&gt;        &lt;br /&gt;        set callback(callback){&lt;br /&gt;            this._callback = callback || null;&lt;br /&gt;        },&lt;br /&gt;&lt;br /&gt;        get data() {&lt;br /&gt;            return this._data;&lt;br /&gt;        },&lt;br /&gt;        &lt;br /&gt;        set data(data){&lt;br /&gt;            this._data = data || null;&lt;br /&gt;        },&lt;br /&gt;&lt;br /&gt;        run: function() {&lt;br /&gt;            try {&lt;br /&gt;                var result = null;&lt;br /&gt;                 if (this.func) {&lt;br /&gt;                    if(this.data) result = this.func(this.data);&lt;br /&gt;                    else result = this.func();&lt;br /&gt;                 }&lt;br /&gt;                                &lt;br /&gt;                if (this.callback) {&lt;br /&gt;                    GREUtils.Thread.dispatchMainThread(new GREUtils.Thread.CallbackRunnableAdapter(this.callback, result));&lt;br /&gt;                }              &lt;br /&gt;            } catch (err) {&lt;br /&gt;                Components.utils.reportError(err);&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;        },&lt;br /&gt;        &lt;br /&gt;        QueryInterface: function(iid) {&lt;br /&gt;            if (iid.equals(Components.Interfaces.nsIRunnable) || iid.equals(Components.Interfaces.nsISupports)) {&lt;br /&gt;                return this;&lt;br /&gt;            }&lt;br /&gt;            throw Components.results.NS_ERROR_NO_INTERFACE;&lt;br /&gt;        }&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * createWorkerThreadAdapter&lt;br /&gt; *&lt;br /&gt; * @public&lt;br /&gt; * @static&lt;br /&gt; * @function&lt;br /&gt; * @param {Object} workerFunc&lt;br /&gt; * @param {Object} callbackFunc&lt;br /&gt; * @param {Object} data&lt;br /&gt; */&lt;br /&gt;GREUtils.Thread.createWorkerThreadAdapter = function(workerFunc, callbackFunc, data) {&lt;br /&gt;&lt;br /&gt;    return new GREUtils.Thread.WorkerRunnableAdapter(workerFunc, callbackFunc, data);    &lt;br /&gt;};&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;使用方式:&lt;br /&gt;利用 GREUtils.Thread.getMainThread() 可以取得主執行緒.&lt;br /&gt;利用 GREUtils.Thread.createWorkerThread() 產生一個新的執行緒.&lt;br /&gt;&lt;br /&gt;WorkerThreadAdapter:&lt;br /&gt;則是用以簡化自行撰寫 worker / callback 二個 XPCOM Object, 取而代之的是二個 Function handle 以及要傳入 worker thread 的資料.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;var worker = GREUtils.Thread.createWorkerThread();&lt;br /&gt;var execute = GREUtils.Thread.createWorkerThreadAdapter(&lt;br /&gt;  /* worker function */&lt;br /&gt;  function(data) {&lt;br /&gt;    var result = 0;&lt;br /&gt;    var i = 0;&lt;br /&gt;     &lt;br /&gt;    while(i &amp;lt;= data) { &lt;br /&gt;        result += i;&lt;br /&gt;        i++;&lt;br /&gt;    }&lt;br /&gt;    return result;&lt;br /&gt;  },&lt;br /&gt;  /* callback function */&lt;br /&gt;  function(result) {&lt;br /&gt;    alert(&#39;sum = &#39; + result);&lt;br /&gt;  },&lt;br /&gt;  /* data to worker function */&lt;br /&gt;  10000&lt;br /&gt;);&lt;br /&gt;&lt;br /&gt;GREUtils.Thread.dispatchWorkerThread(worker, execute);&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;註1:&lt;/b&gt;&lt;br /&gt;Firefox3 的 Thread 由於是以 XPCOM 實作, 所以您只能用於 extension addons 寫作或是 XULRunner 專案中, 如果您需要在一般 Web Application 中使用多執行緒, 可以參考 &lt;a href=&quot;http://code.google.com/apis/gears/&quot;&gt;Google Gears&lt;/a&gt; 的 WorkerPool 實作.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;註2:&lt;/b&gt;&lt;br /&gt;請特別注意 The Thread Manager 那篇的這句重要的警告.&lt;br /&gt;&lt;span style=&quot;font-style:italic; color:red&quot;&gt;Note: The DOM is not thread safe. You must not access the DOM or user interface from background threads. Doing so will likely crash.&lt;/span&gt;&lt;br /&gt;其中要再注意的是, alert() 也是 DOM global scope 哦, 如果您在 background threads 用了 alert(), Firefox 3 也是會當給你看地.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;忙裡偷閒寫下本篇, 內容有點雜亂簡單, 但還是希望對大家有幫助.&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://racklin.blogspot.com/feeds/8959661569322146886/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/623037388172682225/8959661569322146886' title='6 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/623037388172682225/posts/default/8959661569322146886'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/623037388172682225/posts/default/8959661569322146886'/><link rel='alternate' type='text/html' href='http://racklin.blogspot.com/2008/07/threading-in-firefox-3.html' title='Threading in Firefox 3'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00734471337083697849</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>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-623037388172682225.post-492991440524017301</id><published>2008-05-11T14:09:00.002+08:00</published><updated>2008-05-11T14:10:51.129+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="JavaScript"/><category scheme="http://www.blogger.com/atom/ns#" term="jQuery"/><category scheme="http://www.blogger.com/atom/ns#" term="Programming"/><title type='text'>Processing.js</title><content type='html'>&lt;div xmlns=&#39;http://www.w3.org/1999/xhtml&#39;&gt;&lt;a href=&#39;http://ejohn.org/blog/processingjs/&#39; target=&#39;_blank&#39;&gt;Processing.js&lt;/a&gt;. jQuery 作者 &lt;a href=&#39;http://ejohn.org/blog/&#39; target=&#39;_blank&#39;&gt;John Resig&lt;/a&gt;’s 將 &lt;a href=&#39;http://processing.org/&#39; target=&#39;_blank&#39;&gt;processing.org&lt;/a&gt; Java implementation&#39;s Processing Language port to JavaScript and Canvas.&lt;br/&gt; &lt;br/&gt;而且實測, 在 Firefox 3 執行的很完美, 真是有夠強.&lt;br/&gt;&lt;br/&gt;有興趣的可以玩玩 Processing.js 的 &lt;a href=&#39;http://ejohn.org/apps/processing.js/examples/basic/&#39; target=&#39;_blank&#39;&gt;Basic Demo&lt;/a&gt;. &lt;br/&gt;和 processing.org java 版的 &lt;a href=&#39;http://processing.org/learning/basics/&#39; target=&#39;_blank&#39;&gt;Basic Demo&lt;/a&gt;.&lt;br/&gt;只能說..太酷了..&lt;br/&gt;&lt;br/&gt;其中有幾樣和 Processing Language  無關的 javascript 實作, 也很值得研究.&lt;br/&gt;&lt;br/&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;Types and type casting&lt;/b&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;Classes&lt;/b&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;Method overloading and multiple constructors&lt;/b&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;Inheritance&lt;/b&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://racklin.blogspot.com/feeds/492991440524017301/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/623037388172682225/492991440524017301' title='1 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/623037388172682225/posts/default/492991440524017301'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/623037388172682225/posts/default/492991440524017301'/><link rel='alternate' type='text/html' href='http://racklin.blogspot.com/2008/05/processingjs.html' title='Processing.js'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00734471337083697849</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-623037388172682225.post-2360116485121355409</id><published>2008-05-02T10:10:00.003+08:00</published><updated>2008-05-02T10:33:20.029+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Linux"/><category scheme="http://www.blogger.com/atom/ns#" term="Ubuntu"/><title type='text'>Nimbus Theme on Ubuntu 8.04</title><content type='html'>&lt;div xmlns=&#39;http://www.w3.org/1999/xhtml&#39;&gt;&lt;br /&gt;&lt;a href=&#39;https://nimbus.dev.java.net/&#39; target=&#39;_blank&#39;&gt;Nimbus&lt;/a&gt; ( 各組件詳細 &lt;a href=&#39;https://nimbus.dev.java.net/spec/index.html&#39; target=&#39;_blank&#39;&gt;Nimbus SPEC&lt;/a&gt; ) 是 Sun Solaris Desktop 預設的就相當有質感的 Theme . 在未來的 JDK 6u10 中也將加入 Nimbus LookAndFeel.&lt;br /&gt;所以利用這次重裝 Ubuntu 8.04 之餘, 順便把 Nimbus GTK2 engine 以及 Icons-theme 加入 Ubuntu 8.04 中.&lt;br /&gt;&lt;br /&gt;阿土伯目前的 Ubuntu ScreenShot:&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiw9YIaw257OBJ-w5krtWj697AaiwNneoBovOj5tsynySoujsrfVwaWVYNgTCZHR0o2xs3iWCekQ755GojBo7sDkooY4sIT6NGLB-ppTIoWoSxmHkNzVl4KPrHrpnqE05b4UcirLJUb6YI/s1600-h/Nimbus.png&quot;&gt;&lt;img style=&quot;cursor:pointer; cursor:hand;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiw9YIaw257OBJ-w5krtWj697AaiwNneoBovOj5tsynySoujsrfVwaWVYNgTCZHR0o2xs3iWCekQ755GojBo7sDkooY4sIT6NGLB-ppTIoWoSxmHkNzVl4KPrHrpnqE05b4UcirLJUb6YI/s320/Nimbus.png&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5195598029598626626&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;big&gt;Compile and Install:&lt;/big&gt;&lt;/b&gt;&lt;br /&gt;首先請先確認您有安裝打包 dpkg 相關的開發環境&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;sudo apt-get install fakeroot dpkg-dev devscripts icon-naming-utils&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;接下來就是下載 Nimbus 最新的 0.0.9 Source, 以及 deb 的 patch 包.&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;wget -c http://dlc.sun.com/osol/jds/downloads/extras/nimbus-0.0.9.tar.bz2&lt;br /&gt;wget -c http://zap.tartarus.org/~ds/debian/dists/sid/main/source/nimbus_0.0.6-1.diff.gz&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;big&gt;Compile:&lt;/big&gt;&lt;/b&gt;&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;tar xf nimbus-0.0.9.tar.bz2&lt;br /&gt;cd nimbus-0.0.9&lt;br /&gt;zcat ../nimbus_0.0.6-1.diff.gz | patch -p1&lt;br /&gt;chmod +x debian/rules&lt;br /&gt;debchange -v 0.0.9-1&lt;br /&gt;sudo apt-get build-dep&lt;br /&gt;fakeroot dpkg-buildpackage -us -uc&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;在一陣等待後, 您應該會在您的家目錄得到二個deb, (gtk2-engines-nimbus_0.0.6-1_i386.deb / nimbus-icon-theme_0.0.6-1_all.deb )&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;big&gt;安裝 Nimbus dpkg:&lt;/big&gt;&lt;/b&gt;&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;sudo dpkg -i nimbus-icon-theme_0.0.6-1_all.deb&lt;br /&gt;sudo dpkg -i  gtk2-engines-nimbus_0.0.6-1_i386.deb&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;您應該可以在外觀設定看到 Nimbus 嘍.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;big&gt;懶人包:&lt;/big&gt;&lt;/b&gt;&lt;br /&gt;OK!OK! 阿土伯了解大家的痛苦, 懶人包在此, 請直接下載這二個 deb , 然後依照安裝方式安裝即可.&lt;br /&gt;&lt;a target=&#39;_blank&#39; href=&#39;http://racklin.googlepages.com/gtk2-engines-nimbus_0.0.6-1_i386.deb&#39; title=&#39;Click to view this file&#39; class=&#39;tr_pseudo-link&#39;&gt;gtk2-engines-nimbus_0.0.6-1_i386.deb(45K)&lt;/a&gt;&lt;br /&gt;&lt;a target=&#39;_blank&#39; href=&#39;http://racklin.googlepages.com/nimbus-icon-theme_0.0.6-1_all.deb&#39; title=&#39;Click to view this file&#39; class=&#39;tr_pseudo-link&#39;&gt;nimbus-icon-theme_0.0.6-1_all.deb(9M)&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://racklin.blogspot.com/feeds/2360116485121355409/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/623037388172682225/2360116485121355409' title='4 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/623037388172682225/posts/default/2360116485121355409'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/623037388172682225/posts/default/2360116485121355409'/><link rel='alternate' type='text/html' href='http://racklin.blogspot.com/2008/05/nimbus-theme-on-ubuntu-804.html' title='Nimbus Theme on Ubuntu 8.04'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00734471337083697849</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/AVvXsEiw9YIaw257OBJ-w5krtWj697AaiwNneoBovOj5tsynySoujsrfVwaWVYNgTCZHR0o2xs3iWCekQ755GojBo7sDkooY4sIT6NGLB-ppTIoWoSxmHkNzVl4KPrHrpnqE05b4UcirLJUb6YI/s72-c/Nimbus.png" height="72" width="72"/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-623037388172682225.post-4182379244824525991</id><published>2008-04-29T15:31:00.012+08:00</published><updated>2008-05-05T23:52:50.198+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Linux"/><category scheme="http://www.blogger.com/atom/ns#" term="Ubuntu"/><title type='text'>安裝 Ubuntu 8.04 於 Thinkpad T61 雜記</title><content type='html'>前幾天把 &lt;a target=&quot;_blank&quot; href=&quot;http://www.ubuntu.com/&quot;&gt;Ubuntu 8.04 Desktop Edition&lt;/a&gt; 版本裝在 lenovo Thinkpad T61 上面.&lt;br /&gt;安裝上算是例來版本最順暢的版本, 不用調整 acpi / sata 設定, 一路安裝到底就可以完成安裝嘍.&lt;br /&gt;基本上所有 T61 上的硬體都能正確抓到, 而 nvidia driver 也只需透過 restricted driver 確認的動作便完成了. &lt;br /&gt;當然, 尚許多美中不足的地方需要調效,本篇並不是安裝教學,請參考官方或網路上為數眾多之教學文件.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold; font-size: 110%;&quot;&gt;Wireless LED 不會亮:&lt;/span&gt;&lt;br /&gt;雖說 Intel 4965AGN 的 wireless driver 正確掛上, 且亦可以正確使用, 但是主機上那個 wireless led 不會亮, 就是那麼讓人爽度下降. &lt;br /&gt;所以我們需要自己更新 intel compat wireless driver. (當然, 除了 T61 其它品牌 notebook 亦可照作).&lt;br /&gt;首先先到 http://linuxwireless.org/ 下載最新的 driver, &lt;a href=&quot;http://wireless.kernel.org/download/compat-wireless-2.6/compat-wireless-2.6.tar.bz2&quot;&gt;link here&lt;/a&gt;.&lt;br /&gt;解壓後, 請修改 config.mk 加入 LED 的 options.&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;CONFIG_IWL3945_LEDS=y&lt;br /&gt;CONFIG_IWLWIFI_LEDS=y&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;然後 sudo make install 即可完成更新,由於網路 module 使用中, 通常需要重開.&lt;br /&gt;您就會看到您主機上的 wireless LED 開始可愛的一閃一閃了.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold; font-size: 110%;&quot;&gt;Trackpoint 中間鍵&lt;/span&gt;&lt;br /&gt;加入以下幾行在 /etc/X11/xorg.conf 的 mouse 設定中:&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt; Option  &quot;Device&quot;  &quot;/dev/input/mice&quot;&lt;br /&gt; Option  &quot;Protocol&quot;  &quot;ImPS/2&quot;&lt;br /&gt; Option  &quot;ZAxisMapping&quot;  &quot;4 5&quot;&lt;br /&gt; Option  &quot;Emulate3Buttons&quot; &quot;true&quot;&lt;br /&gt; Option  &quot;EmulateWheel&quot;          &quot;true&quot;&lt;br /&gt; Option  &quot;EmulateWheelButton&quot;    &quot;2&quot;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold; font-size: 110%;&quot;&gt;中文輸入法的更換:&lt;/span&gt;&lt;br /&gt;雖然我對 SCIM 沒有好惡問題, 但是經過半天的使用, 發現 pidgin 在輸入字時, &lt;br /&gt;會始整個視窗 hang 住一下, 然後久久才取得 focus .&lt;br /&gt;一開始以為是 compiz 特效問題, 後來發現是 scim 怪怪的, 沒有去深究為什麼, 換成 gcin 試試.&lt;br /&gt;於是改裝套件庫中的 gcin gcin-qt3-immodule, pidgin 果然不會卡卡的.&lt;br /&gt;但是另一個問題接著而來, 那就是部份程式在結束時會有 segment fault 問題發生, Firefox / MySQL Query Browser 都會.&lt;br /&gt;所以,又要展開昇級的動作, 由於 hardy 套件庫內的版本只到 1.3.7 版本. 新的穩定版是 1.3.9 可以解決這個問題. &lt;br /&gt;於是我們使用 debian etch 套件庫來更新, 請參考 &lt;a target=&quot;_blank&quot; href=&quot;http://www.calno.com/moto/gcin/&quot;&gt;http://www.calno.com/moto/gcin/&lt;/a&gt; 將 &lt;br /&gt;&lt;code&gt;&lt;br /&gt;deb http://www.calno.com etch-backports main &lt;br /&gt;&lt;/code&gt;&lt;br /&gt;加入您 Synaptic 第三方套件列表中-&amp;gt;更新套件.&lt;br /&gt;即可完成 1.3.9 版本的安裝, 現在 firefox / MySQL Query Browser 可以正常使用了.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold; font-size: 110%;&quot;&gt;中文字體 AA 小字不好看:&lt;/span&gt;&lt;br /&gt;由於 Ubuntu 8.04 內建已經使用文泉驛正黑體, 由於 wqy-zenhei 內建含了點陣的明體,所以小字會使用到點陣字.&lt;br /&gt;所以我們需要關掉它. (&lt;a target=&quot;_blank&quot; href=&quot;http://wenq.org/?ZenHei&quot;&gt;詳見官網&lt;/a&gt;).&lt;br /&gt;請下載官網中的 &lt;a href=&quot;http://wenq.org/upload/44-wqy-zenhei.conf&quot;&gt;[44-wqy-zenhei.conf]&lt;/a&gt; , 並換掉系統中的 /etc/fonts/conf.d/44-wqy-zenhei.conf . &lt;br /&gt;在此, 由於官網的 match 只用了 &quot;WenQuanYi Zen Hei&quot; 如果在選字時用了 &quot;文泉驛正黑&quot; 的中文 family name 將不會生效, 建議您將&lt;br /&gt;44-wqy-zenhei.conf  test 部份改成如下:&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;  &amp;lt;test qual=&quot;any&quot; name=&quot;family&quot;&amp;gt;&lt;br /&gt;    &amp;lt;string&amp;gt;WenQuanYi Zen Hei&amp;lt;/string&amp;gt;&lt;br /&gt;    &amp;lt;string&amp;gt;文泉驿正黑&amp;lt;/string&amp;gt;&lt;br /&gt;    &amp;lt;string&amp;gt;文泉驛正黑&amp;lt;/string&amp;gt;&lt;br /&gt;  &amp;lt;/test&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold; font-size: 110%;&quot;&gt;CPU 時脈調整&lt;/span&gt;&lt;br /&gt;預設的 CPU freq 模式是 Ondemand, 會自動依 CPU 使用情況調整 CPU 時脈, 但是常常會造成程式 delay 或切換過慢的問題. 所以我們需要讓 cpufreq-selector 可以調整時脈.&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;sudo dpkg-reconfigure gnome-applets&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;回答 YES , 讓  cpufreq-selector 擁有 SUID root 權限. 將 cpufreq-selector 加入面版,現在可以很容易依需要調整 CPU 時脈.&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhCYs38cCguouYpWgZk5WFcetsjsTWjx-QPFvAPee39uxaveVKIKsxk51HA428-tZa2IoxW_aTn2dw_tE4b4_LeknZsKiOcXy8hAxp7Dbwult4Z8Dgoz5cTPM1K6rCF1SMaVdY6XxHQiOQ/s1600-h/ttt.png&quot;&gt;&lt;img style=&quot;cursor:pointer; cursor:hand;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhCYs38cCguouYpWgZk5WFcetsjsTWjx-QPFvAPee39uxaveVKIKsxk51HA428-tZa2IoxW_aTn2dw_tE4b4_LeknZsKiOcXy8hAxp7Dbwult4Z8Dgoz5cTPM1K6rCF1SMaVdY6XxHQiOQ/s400/ttt.png&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5195665009613607762&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold; font-size: 110%;&quot;&gt;Suspend / Hibernate Support&lt;/span&gt;&lt;br /&gt;讓 fn+f4 suspend 以及 fn+f12 能正常作業.&lt;br /&gt;修改 /etc/default/acpi-support&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;ACPI_SLEEP=true&lt;br /&gt;ACPI_HIBERNATE=true&lt;br /&gt;ACPI_SLEEP_MODE=mem&lt;br /&gt;MODULES=&quot;e1000 iwl4965 nvidia&quot;&lt;br /&gt;HIBERNATE_MODE=platform&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;其中的 modules 則是 &quot;removed before suspend and reloaded on resume&quot; 所以可以有效解決 resume 畫面一片白/無線網路不能連等問題(至少阿土伯電腦沒再出現過了).&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold; font-size: 110%;&quot;&gt;讓 Ubuntu 更好用:&lt;/span&gt;&lt;br /&gt;當然, 不能忘了 &lt;a target=&quot;_blank&quot; href=&quot;http://rt.openfoundry.org/Foundry/Project/Download/?Queue=852&quot;&gt;lazybuntu&lt;/a&gt; 最新的 0.1.5 版也支援 hardy 了.&lt;br /&gt;&lt;br /&gt;以上, 是目前阿土伯安裝的心得, 陸續調適, 再行增加整理.</content><link rel='replies' type='application/atom+xml' href='http://racklin.blogspot.com/feeds/4182379244824525991/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/623037388172682225/4182379244824525991' title='10 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/623037388172682225/posts/default/4182379244824525991'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/623037388172682225/posts/default/4182379244824525991'/><link rel='alternate' type='text/html' href='http://racklin.blogspot.com/2008/04/ubuntu-804-thinkpad-t61.html' title='安裝 Ubuntu 8.04 於 Thinkpad T61 雜記'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00734471337083697849</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/AVvXsEhCYs38cCguouYpWgZk5WFcetsjsTWjx-QPFvAPee39uxaveVKIKsxk51HA428-tZa2IoxW_aTn2dw_tE4b4_LeknZsKiOcXy8hAxp7Dbwult4Z8Dgoz5cTPM1K6rCF1SMaVdY6XxHQiOQ/s72-c/ttt.png" height="72" width="72"/><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-623037388172682225.post-1709217503680409175</id><published>2008-03-10T09:38:00.004+08:00</published><updated>2008-03-10T10:59:42.757+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="google"/><category scheme="http://www.blogger.com/atom/ns#" term="Programming"/><title type='text'>另人遺憾的 Google AuthSub API 有感</title><content type='html'>&lt;div xmlns=&#39;http://www.w3.org/1999/xhtml&#39;&gt;身為一個 Google Fans 及 Programmer, 對於參與開發的 Web Application , 總是極力希望能直接整合 Google Services.  甚而連 User Singup 都不用了, 直接使用 Google Account 或 OpenID 進行 Authenticate , 然後直接使用我們的服務..&lt;br /&gt;&lt;br /&gt;然而 Google Account API 中的 AuthSub API 似乎不能把它拿來當 Account Identification 用. 因為它無法傳回 UID (username / hash or anythings).&lt;br /&gt;&lt;br /&gt;&lt;font color=&#39;#CC0000&#39;&gt;&lt;b&gt;如果我們要拿來識別自己的 local user, 看來只能使用 ClientLogin, 要使用者填入 username (gmail) / password ,.....&lt;br /&gt;這...是怎樣, 在現在釣魚網站這麼多, 而又是一個新創網站而言, 要使用者填入它的 Google  username / password 是幾乎不可能的吧...&lt;/b&gt;&lt;/font&gt;&lt;br /&gt;&lt;br /&gt;建議不用改變太多, 至少擴充一下 AuthSubTokenInfo 多傳一行 user_hash or UID 應該沒有安全性上考量吧..  查了一下 Groups , 很多開發者有和阿土伯相同的困擾, 就差最後一點功夫, 很遺憾的, Google 缺少了它....&lt;br /&gt;&lt;br /&gt;現在我們的 Service 放棄了 Google Login 的功能, 阿土伯身為 GFans , 好不甘心呀~~~~&lt;br /&gt;&lt;br /&gt;建議:&lt;br /&gt;一. 不改變現有任何 API , 但對於同一個 Username 對於同一個 next 同一個 scope 操作, 回傳同一個&lt;br /&gt;session token , 因為目前 session token 並不會失效, 所以我們可以 &quot;暫時&quot; 拿來當同一個使用者的識別之用.&lt;br /&gt;&lt;br /&gt;二. 只改變 AuthSubTokenInfo , 目前有的三行資訊, 多加入一行 user_hash or anything 可以反映相同使用者的資訊都可... &lt;br /&gt;&lt;br /&gt;Google Groups: &lt;a target=&#39;_blank&#39; href=&#39;http://tinyurl.com/2yr8hx&#39;&gt;http://tinyurl.com/2yr8hx&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://racklin.blogspot.com/feeds/1709217503680409175/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/623037388172682225/1709217503680409175' title='15 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/623037388172682225/posts/default/1709217503680409175'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/623037388172682225/posts/default/1709217503680409175'/><link rel='alternate' type='text/html' href='http://racklin.blogspot.com/2008/03/google-authsub-api.html' title='另人遺憾的 Google AuthSub API 有感'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00734471337083697849</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>15</thr:total></entry><entry><id>tag:blogger.com,1999:blog-623037388172682225.post-2276322906982235002</id><published>2008-02-26T10:36:00.014+08:00</published><updated>2008-02-26T11:57:28.648+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Gecko"/><category scheme="http://www.blogger.com/atom/ns#" term="JavaScript"/><category scheme="http://www.blogger.com/atom/ns#" term="jQuery"/><category scheme="http://www.blogger.com/atom/ns#" term="Programming"/><title type='text'>GRE 開發三:  Step by Step 桌面程式快速開發</title><content type='html'>XULRunner + jQuery + GREUtils = Quick Application Platform.&lt;br /&gt;&lt;br /&gt;本篇將利用範例的方式, 一步一步展示如何快速撰寫一個 Windows / Linux / MacOS 上的桌面應用程式, 您會發現利用 XULRunner (Gecko) 寫 Application 是那麼的容易. 這也是前二篇阿土伯專案中選用 XULRunner 而暫時排處 JavaFX 的原因.&lt;br /&gt;基本上和設計 FireFox Extensions 差不多, 但本篇著重在撰寫 standalone application.&lt;br /&gt;##CONTINUE##&lt;br /&gt;&lt;span style=&quot;font-weight: bold;font-size:130%;&quot; &gt;XULRunner 安裝:&lt;/span&gt;&lt;br /&gt;XULRunner 的官方網址在 &lt;a href=&quot;http://developer.mozilla.org/en/docs/XULRunner&quot;&gt;http://developer.mozilla.org/en/docs/XULRunner&lt;/a&gt; , 而各個 build 好的&lt;br /&gt;binary 可在此 FTP 下載 &lt;a href=&quot;http://releases.mozilla.org/pub/mozilla.org/xulrunner/releases/1.8.1.3/contrib/&quot;&gt;http://releases.mozilla.org/pub/mozilla.org/xulrunner/releases/1.8.1.3/contrib/&lt;/a&gt;&lt;br /&gt;在這邊我們下載 xulrunner-1.8.1.3.en-US.win32-20080128.zip  , 然後 解壓到 C:\ &lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;font-size:130%;&quot; &gt;下載 GREUtils 範例&lt;/span&gt;:&lt;br /&gt;請到 &lt;a href=&quot;http://code.google.com/p/greutils/&quot;&gt;http://code.google.com/p/greutils/&lt;/a&gt; , 下載 helloworld 範例 &lt;a href=&quot;http://greutils.googlecode.com/files/greutil-helloworld.zip&quot;&gt;http://greutils.googlecode.com/files/greutil-helloworld.zip&lt;/a&gt;&lt;br /&gt;然後一樣解壓到 C:\ &lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;font-size:130%;&quot; &gt;執行 GREUtils 範例&lt;/span&gt;:&lt;br /&gt;請開啟 Command Prompt (執行-&gt;cmd.exe), 然後鍵入 &lt;pre&gt;&lt;code&gt;&lt;br /&gt;c:\xulrunner\xulrunner.exe c:\greutil-helloworld\application.ini &lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;font-size:130%;&quot; &gt;執行畫面&lt;/span&gt;:&lt;br /&gt;OK~ 您應該可以看到如下的畫面. Linux / MacOS 執行方式及結果應該亦是相同. &lt;br /&gt;應為跨平台亦是 Gecko 的特色之一, 且由於使用 XUL/XHTML/CSS 所以各平台執行結果及承現是一致的.&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-2SKZhqPBPlUt3hor_3n4Qgn44pto0AYI92aMEbyLRhTxiqOt_WNZdVvlzxkG3U1_qpyF1bxxOrHok98J2RPsCjLeKu8uJAS4F4QRwATOlB3E-3VPsVmj-WUfsQyyYthGHU2omiVP7Pc/s1600-h/main.png&quot;&gt;&lt;img style=&quot;cursor:pointer; cursor:hand;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-2SKZhqPBPlUt3hor_3n4Qgn44pto0AYI92aMEbyLRhTxiqOt_WNZdVvlzxkG3U1_qpyF1bxxOrHok98J2RPsCjLeKu8uJAS4F4QRwATOlB3E-3VPsVmj-WUfsQyyYthGHU2omiVP7Pc/s400/main.png&quot; border=&quot;0&quot; alt=&quot;&quot;id=&quot;BLOGGER_PHOTO_ID_5171118312663920770&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;font-size:130%;&quot; &gt;開發環境&lt;/span&gt;:&lt;br /&gt;XULRunner + jQuery + GREUtils 為此範例的主要環境.  &lt;br /&gt;XULRunner 開發細節在此不多作解釋, 請見官網文件. 您可以把它想像成 JavaRuntime 之類的環境, Firefox / ThunderBird 便是架構在 XULRunner 之上.&lt;br /&gt;&lt;br /&gt;jQuery 我們的老朋友嘍, 所有 javascript 和 XUL/XHTML 的互動, 都是利用它來實現, 也就是您原來在 Web 中所使用的技巧(Ajax/DOM/XHR), 都可以搬到 Application 來用嘍.&lt;br /&gt;這樣您有沒有信心大增, 即使您熟悉的是 Web Programming, 現在不用學 Java / VB / VC .... VX 就可以寫一些(簡單?)的應用程式嘍.&lt;br /&gt;&lt;br /&gt;GREUtils 它是阿土伯封裝的一個簡易框架, 讓您可以容易的開發 XULRunner 應用程式.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;font-size:130%;&quot; &gt;application.js&lt;/span&gt;:&lt;br /&gt;application.js 負責配製 Preferences , Initialize , 期望您在此僅撰寫這二件事, 相關的程式, 請將它寫到 Controller 中. &lt;br /&gt;以下為 initialize 片斷 &lt;pre&gt;&lt;code&gt;&lt;br /&gt;    // init controller&lt;br /&gt;    GREUtils.include_once(&#39;appController.js&#39;, window);&lt;br /&gt;    GREUtils.include_once(&#39;mainController.js&#39;, window);&lt;br /&gt;    GREUtils.include_once(&#39;charsetController.js&#39;, window);&lt;br /&gt;    GREUtils.ControllerHelper.appendController(AppController, this);&lt;br /&gt;    GREUtils.ControllerHelper.appendController(MainController, this);&lt;br /&gt;    GREUtils.ControllerHelper.appendController(CharsetController, this);&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;font-size:130%;&quot; &gt;xxxController.js&lt;/span&gt;:&lt;br /&gt;Controller 提供相關的 action 實作. 由於 GREUtils 封裝了 CommandDispatcher , 所以您只要擴展&lt;br /&gt;GREUtils.ControllerAdapter , 您可以僅實作您的 action commands , 它會自動處理  supportsCommand / isCommandEnabled / doCommand / onEvent 等相關細節.&lt;br /&gt;其中 init 為 Controller initialize function , 它會傳入 Application, 讓您可以在您的 Controller 中處理 Preferences 以及 Application wide function.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;font-size:130%;&quot; &gt;jQuery&lt;/span&gt;:&lt;br /&gt;您可以在 Controller , 利用 jQuery 處理畫面上的任何元素, 所以相當容易直覺, 就如同您在設計 Web.&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;  charsetCmdConvert1: function() {&lt;br /&gt;    jQuery(&quot;#charsetList1&quot;).each(function(i) {&lt;br /&gt;        var cs = this.selectedItem.label;&lt;br /&gt;        var input_text = jQuery(&quot;#utf8MsgBoxInput&quot;).val();&lt;br /&gt;        var out = GREUtils.Charset.convertCharset(input_text, &#39;UTF-8&#39;, cs);&lt;br /&gt;        jQuery(&quot;#utf8MsgBoxoutput&quot;).val(out);&lt;br /&gt;    });&lt;br /&gt;  }&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;font-size:130%;&quot; &gt;Append DOM Object&lt;/span&gt;:&lt;br /&gt;如果您發現您直接利用 jQuery.append 等相關的 DOM 操作, 和您想的不一樣, 別感到驚訝.&lt;br /&gt;因為在 XULRunner 中, XUL 和 HTML 的 Namespace 是不同的.&lt;br /&gt;所以您可以利用 GREUtils.domXULString / GREUtils.domHTMLString 來處理.&lt;br /&gt;如 明確的指定您要加入一個 XUL 的 Label Object: &lt;pre&gt;&lt;code&gt;&lt;br /&gt;jQuery(&quot;#testContainer&quot;).append( GREUtils.domXULString(&quot;&amp;lt;label value=&#39;test&#39;/&amp;gt;&quot; ));&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;font-size:130%;&quot; &gt;Debug&lt;/span&gt;:&lt;br /&gt;程式執行起來, 會為您 Popup Error Console 供您 Debug, 當然, 您也可以在 AppController.js &lt;br /&gt;中拿掉它... 您更可以自行安裝 FireBug 為您的 Debuger.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;font-size:130%;&quot; &gt;其它..&lt;/span&gt;:&lt;br /&gt;有關利用 3rd extensions 和提供您的 application add-ons 在下次有機會阿土伯再行解說.&lt;br /&gt;歡迎大家來信/留言討論, 一同成長.</content><link rel='replies' type='application/atom+xml' href='http://racklin.blogspot.com/feeds/2276322906982235002/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/623037388172682225/2276322906982235002' title='10 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/623037388172682225/posts/default/2276322906982235002'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/623037388172682225/posts/default/2276322906982235002'/><link rel='alternate' type='text/html' href='http://racklin.blogspot.com/2008/02/gre-step-by-step.html' title='GRE 開發三:  Step by Step 桌面程式快速開發'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00734471337083697849</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/AVvXsEh-2SKZhqPBPlUt3hor_3n4Qgn44pto0AYI92aMEbyLRhTxiqOt_WNZdVvlzxkG3U1_qpyF1bxxOrHok98J2RPsCjLeKu8uJAS4F4QRwATOlB3E-3VPsVmj-WUfsQyyYthGHU2omiVP7Pc/s72-c/main.png" height="72" width="72"/><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-623037388172682225.post-4087114156437618569</id><published>2008-02-25T11:17:00.006+08:00</published><updated>2008-02-25T19:08:39.918+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Gecko"/><category scheme="http://www.blogger.com/atom/ns#" term="JavaScript"/><category scheme="http://www.blogger.com/atom/ns#" term="Programming"/><title type='text'>GREUtils 1.0 Release</title><content type='html'>&lt;div id=&quot;wikicontent&quot; style=&quot;padding: 0pt 3em 1.2em 0pt;&quot;&gt;GREUtils 是一個輔助您在設計 Firefox extensions 或設計 XULRunner 程式的一個工具程式.&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;封裝了幾個常用的 XPCOM 功能, 讓您可以更方便更直覺的叫用它們.&lt;/li&gt;&lt;li&gt;封裝了 Dialog / Preferences / Sound 等常用 XPCOM.&lt;/li&gt;&lt;li&gt;封裝了 Charset Convert , 您可以利用 Function 進行 charset convert,  如同 php .&lt;br /&gt;&lt;/li&gt;&lt;li&gt;亦加入了如同 PHP 的 include / include_once 的特色, 讓您的程式可以更 MVC , 只有在需要的時侯, 引入適當的 javascript 及模組.&lt;/li&gt;&lt;li&gt;封裝了 Controller 和 CommandDispatch , 讓您的程式有一個良好易於寫作的MVC 架構.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;p&gt;今年比較忙, 一直沒有更新 Blog, 包含之前希望提供給大家的 Gecko 開發工具包, 也一直沒有時間整理(阿土伯很早 2007/09 就投到 google code 開放出來了).&lt;/p&gt; &lt;p&gt;&lt;s&gt;還是沒有時間為大家寫完完整的說明及 Sample code&lt;/s&gt;,  怕一拖下去沒完沒了,&lt;br /&gt;先放出來讓大家使用, 或請大家幫我寫一下 Sample Code   吧~~ :D&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;已補上 hello world 的 xulrunne rsample application, 利用了所有 GREUtils 的特性.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;您可以把 helloworld application 當成您專案的 blank application 來用.&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;大家先看 Source code 或 javadoc 理解一下. 希望對您在撰寫 extension / xulrunner 上有幫助.&lt;br /&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;&lt;br /&gt;專案位址:  &lt;a href=&quot;http://code.google.com/p/greutils/&quot;&gt;http://code.google.com/p/greutils/&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;p&gt;##CONTINUE##&lt;br /&gt;&lt;/p&gt;&lt;p&gt;GREUtils is simple and easy use APIs libraries for GRE (Gecko Runtime Environment). &lt;/p&gt;&lt;p&gt;It provides: &lt;/p&gt;&lt;ul&gt;&lt;li&gt;Object extend function &lt;/li&gt;&lt;li&gt;include / include_once specified URL script. &lt;/li&gt;&lt;li&gt;XPCOM utilities &lt;/li&gt;&lt;li&gt;Charset Convert &lt;/li&gt;&lt;li&gt;Preferences Services  &lt;/li&gt;&lt;li&gt;File IO &lt;/li&gt;&lt;li&gt;Dialog utilities &lt;/li&gt;&lt;li&gt;Controller and CommandDispatcher&lt;a href=&quot;http://code.google.com/p/greutils/w/edit/CommandDispatcher&quot;&gt;?&lt;/a&gt; Helper &lt;/li&gt;&lt;/ul&gt;  &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://racklin.blogspot.com/feeds/4087114156437618569/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/623037388172682225/4087114156437618569' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/623037388172682225/posts/default/4087114156437618569'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/623037388172682225/posts/default/4087114156437618569'/><link rel='alternate' type='text/html' href='http://racklin.blogspot.com/2008/02/greutils-10-release.html' title='GREUtils 1.0 Release'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00734471337083697849</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-623037388172682225.post-5978242762467888466</id><published>2007-11-24T11:02:00.000+08:00</published><updated>2007-11-26T12:08:29.626+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Gadget"/><category scheme="http://www.blogger.com/atom/ns#" term="iGoogle"/><category scheme="http://www.blogger.com/atom/ns#" term="JavaScript"/><category scheme="http://www.blogger.com/atom/ns#" term="Programming"/><title type='text'>iGoogle BossKey 暗黑老板鍵小工具</title><content type='html'>由於 iGoogle 提供的小工具已經非常非常的多元化.. 舉凡&lt;a href=&quot;http://www.google.com.tw/ig/directory?q=%E6%8A%95%E8%B3%87%E7%B5%84%E5%90%88&amp;amp;root=%2Fig&amp;amp;igtab=test&amp;amp;dpos=top&amp;amp;url=http://bizyotw.ig.googlepages.com/Stock.xml&quot;&gt;股市投資組合&lt;/a&gt;, &lt;a href=&quot;http://www.google.com.tw/ig/directory?q=game&amp;amp;root=%2Fig&amp;amp;igtab=test&amp;amp;dpos=top&quot;&gt;打電動&lt;/a&gt;, 看新聞, 聊天, 看&lt;a href=&quot;http://www.google.com.tw/ig/directory?q=diggirl&amp;amp;root=%2Fig&amp;amp;igtab=test&amp;amp;dpos=top&quot;&gt;美女圖&lt;/a&gt;, 都可以在 iGoogle 中全部搞定... 嘿嘿..&lt;br /&gt;頁面停留在 iGoogle 中, 已不見得是用功好學在努力找資料了... 這時就需要 iGoogle &lt;a href=&quot;http://zh.wikipedia.org/wiki/%E8%80%81%E9%97%86%E9%8D%B5&quot;&gt;老板鍵&lt;/a&gt; 功能.&lt;br /&gt;&lt;br /&gt;這是在 &lt;a href=&quot;http://racklin.blogspot.com/2007/11/gtdd2007.html&quot;&gt;GTDD2007&lt;/a&gt; 當天下午分組程式設計時寫的小工具(&lt;a href=&quot;http://spreadsheets.google.com/pub?key=pYjS1RAcmRhu1ClNT-3s_Jg&amp;amp;gid=0&quot;&gt;編號 30&lt;/a&gt;), 可能太害羞還是氣氛的關係, 很少人在各組間走動觀摩討論... 所以得票數一票 :(   (還是同桌投的..呵呵)&lt;br /&gt;阿土伯把它補完整一點並加上設定、多國語.. 放出來和大家分享..&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;功能:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;隱藏 iGoogle 的畫面&lt;/li&gt;&lt;li&gt;帶入 傳統 Google 搜尋頁面&lt;/li&gt;&lt;li&gt;自動在搜尋欄位中填入設定關鍵字&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;span style=&quot;color: #fff; background-color: #fff;&quot;&gt;##CONTINUE##&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;說明:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;暗黑&lt;a href=&quot;http://zh.wikipedia.org/wiki/%E8%80%81%E9%97%86%E9%8D%B5&quot;&gt;老板鍵&lt;/a&gt;小工具說明, 要用情境模式來示範解說.. 大家就了解了.&lt;br /&gt;&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/AVvXsEiDBdLEUPXQNWo0H5-zeMcfb4_AsLhUrL9ZwAlgmW7qdSQsFMQQ4LLPI7r28BqrweN1BCd429vYfpX0WNNdwTPlaEehmdJG7Z8iLUVr_hYY2LntCk83N6fwe92NnbVsQ13gjr8wfuS3xY0/s1600-h/web_screen1.png&quot;&gt;&lt;img style=&quot;cursor: pointer; width: 469px; height: 255px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDBdLEUPXQNWo0H5-zeMcfb4_AsLhUrL9ZwAlgmW7qdSQsFMQQ4LLPI7r28BqrweN1BCd429vYfpX0WNNdwTPlaEehmdJG7Z8iLUVr_hYY2LntCk83N6fwe92NnbVsQ13gjr8wfuS3xY0/s400/web_screen1.png&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5136241520988016610&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;這時老板突然走了過來, 看的正精彩,關掉瀏覽器實在太可惜了(等會要重執行).&lt;br /&gt;趕快使用暗黑老板鍵...(F10). 畫面馬上變成:&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFoTD2XbTCA3V4sD_dKrlrKJSTTDQzOHlefmZcz4uMuSNc1iH3dJxW82dT3Pq_77NtWXW_O_5kErvAzJXgC9z-FmkJt6GaGntfwHYWCWb3mySMAj3xxRhdvbrQpXo6ygqYuPOTfypF46k/s1600-h/web_screen2.png&quot;&gt;&lt;img style=&quot;cursor: pointer; width: 457px; height: 204px;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFoTD2XbTCA3V4sD_dKrlrKJSTTDQzOHlefmZcz4uMuSNc1iH3dJxW82dT3Pq_77NtWXW_O_5kErvAzJXgC9z-FmkJt6GaGntfwHYWCWb3mySMAj3xxRhdvbrQpXo6ygqYuPOTfypF46k/s400/web_screen2.png&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5136242934032257010&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;老板問: 阿土伯你在做什麼...&lt;br /&gt;阿土伯: 報告老板, 我正準備要在 Google 搜尋上查詢有關 google 的相關新聞, 研究 google 的成功模式能不能應用在公司上面.... (呼~~ 要臉不紅氣不喘的回答, 小朋友不要學, 大哥哥是練過的)&lt;br /&gt;&lt;br /&gt;OK~~ 大致上軟體就是這麼用的....&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;設定畫面:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgbUp7Rk7B50j6DQm8VqDpjSv6cNt3ST6Ksy7_phJoW_KWKNQjForGii6gc6UVvccsd0uJc_3-GDb1WiJ5Pobfcrrsd2QAVmicyU3U4BgwcG19S13xe8kr2FAU6fy-wF7DD2yD-ujs53D4/s1600-h/web_screen3.png&quot;&gt;&lt;img style=&quot;cursor: pointer;&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgbUp7Rk7B50j6DQm8VqDpjSv6cNt3ST6Ksy7_phJoW_KWKNQjForGii6gc6UVvccsd0uJc_3-GDb1WiJ5Pobfcrrsd2QAVmicyU3U4BgwcG19S13xe8kr2FAU6fy-wF7DD2yD-ujs53D4/s400/web_screen3.png&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5136243659881730050&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;br /&gt;加入您的 iGoogle:&lt;br /&gt;請點取 Add to Google 直接加入您的 iGoogle 中.&lt;br /&gt;&lt;/span&gt;&lt;a href=&quot;http://www.google.com/ig/add?hl=zh-TW&amp;amp;moduleurl=http://racklin.googlepages.com/bosskey.xml&amp;amp;source=imag&quot;&gt;&lt;br /&gt;&lt;img src=&quot;http://www.google.com.tw/webmasters/add-to-google-plus.gif&quot; border=&quot;0&quot; /&gt;&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;原始程式及小工具 URL:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;http://racklin.googlepages.com/bosskey.xml&lt;br /&gt;&lt;br /&gt;PS.&lt;br /&gt;&lt;blockquote&gt;像這樣的暗黑小工具投到目錄中不知道能不能審核通過..&lt;br /&gt;對不起 kevin, 不小心又弄了一支 html-inline gadget, gtdd2007 當日苦口婆心希望大家寫 html type gadget...&lt;br /&gt;&lt;/blockquote&gt;</content><link rel='replies' type='application/atom+xml' href='http://racklin.blogspot.com/feeds/5978242762467888466/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/623037388172682225/5978242762467888466' title='4 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/623037388172682225/posts/default/5978242762467888466'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/623037388172682225/posts/default/5978242762467888466'/><link rel='alternate' type='text/html' href='http://racklin.blogspot.com/2007/11/igoogle-bosskey.html' title='iGoogle BossKey 暗黑老板鍵小工具'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00734471337083697849</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/AVvXsEiDBdLEUPXQNWo0H5-zeMcfb4_AsLhUrL9ZwAlgmW7qdSQsFMQQ4LLPI7r28BqrweN1BCd429vYfpX0WNNdwTPlaEehmdJG7Z8iLUVr_hYY2LntCk83N6fwe92NnbVsQ13gjr8wfuS3xY0/s72-c/web_screen1.png" height="72" width="72"/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-623037388172682225.post-3295202805975233071</id><published>2007-11-23T17:46:00.000+08:00</published><updated>2007-11-23T17:50:39.861+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Gadget"/><title type='text'>gtdd2007 感想</title><content type='html'>昨天參加了 Google Taipei Developer Day 2007 收獲很多..&lt;br /&gt;最大的收獲就是阿土伯有榮幸能和眾多網路名人一聚, 如 &lt;a href=&quot;http://blog.qing.tw/&quot;&gt;qing&lt;/a&gt; , &lt;a href=&quot;http://www.pocketshark.com/blog/page/tempo&quot;&gt;tempo&lt;/a&gt;,&lt;br /&gt;&lt;a href=&quot;http://blog.xdite.net/&quot;&gt;xdite&lt;/a&gt;, &lt;a href=&quot;http://bawbaw-hu.blogspot.com/&quot;&gt;Bawbaw.hu&lt;/a&gt;, 以及一群年輕、專業又有活力的 &lt;a href=&quot;http://www.funp.com/&quot;&gt;funp&lt;/a&gt; 團隊.&lt;br /&gt;&lt;br /&gt;也非常感謝 Google 評審團對阿土伯設計的小工具支持及肯定, 讓我有幸獲得 &quot;&lt;a href=&quot;http://www.google.com.tw/events/gadgetawards/winners.html&quot;&gt;工程師特別獎&lt;/a&gt;&quot; 的殊榮...&lt;br /&gt;,對我而言，無疑是最大的鼓勵，更加深我在開發以及程式開放分享上熱忱。&lt;br /&gt;&lt;br /&gt;也希望未來能開發/開放更多的小程式小工具和大家分享..&lt;br /&gt;以及和各位網路高手交流, 教學相長...</content><link rel='replies' type='application/atom+xml' href='http://racklin.blogspot.com/feeds/3295202805975233071/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/623037388172682225/3295202805975233071' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/623037388172682225/posts/default/3295202805975233071'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/623037388172682225/posts/default/3295202805975233071'/><link rel='alternate' type='text/html' href='http://racklin.blogspot.com/2007/11/gtdd2007.html' title='gtdd2007 感想'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00734471337083697849</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-623037388172682225.post-1703072299340651510</id><published>2007-11-13T16:44:00.000+08:00</published><updated>2007-11-13T17:23:03.081+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Gecko"/><category scheme="http://www.blogger.com/atom/ns#" term="JavaScript"/><category scheme="http://www.blogger.com/atom/ns#" term="Programming"/><title type='text'>GRE 開發備註二</title><content type='html'>阿土伯手上專案終於完工了, 並 Release 給客戶以及交付生產線試用了.&lt;br /&gt;&lt;br /&gt;看看最後一篇文章, 足足隔了一個多月(手腳變慢了 = =), 各位朋友, 久違了..&lt;br /&gt;&lt;br /&gt;近期會整理一下及發表阿土伯在開發  Gecko / XULRunner Application 時, 所開發的一些 Utilities Libraries.&lt;br /&gt;&lt;br /&gt;這篇主要介紹及回答為什麼當時阿土伯要用 GRE 而不是 Java RCP(eclipse RCP / netbeans RCP...etc,)&lt;br /&gt;&lt;br /&gt;##CONTINUE##&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: rgb(255, 0, 0);font-size:130%;&quot; &gt;GRE/XULRunner 特色&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-weight: bold;font-size:100%;&quot; &gt;* Cross Platform - &lt;/span&gt;&lt;br /&gt;只要是有 mozilla or firefox 都可以執行您的 Application. 這部份的特色和阿土伯喜愛的 Java 一樣可愛.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;font-size:100%;&quot; &gt;* Gecko Rendering Engine - &lt;/span&gt;&lt;br /&gt;有了 Gecko Rendering Engine, 可以用大家最熟悉的 HTML 技術來開發富豐的 GUI.&lt;br /&gt;更可以內崁 Flash Object 來開發更炫麗  GUI.&lt;br /&gt;當然, 你要內崁 Java Applet 來開發 GUI 也可以.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;font-size:100%;&quot; &gt;* Javascript&lt;/span&gt;&lt;br /&gt;使用 Javascript 來開發 Application. 任何您原來在 Web 上開發的技巧都可以直接使用.&lt;br /&gt;再加上豐富大量的 3rd-party Libraries (jQuery / Dojo / YUI) + Firebug 開發效率及入門門檻低.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;font-size:100%;&quot; &gt;* XUL / XML / XBL / SOAP&lt;/span&gt;&lt;br /&gt;做為 Rich Client Platform , XUL+XBL 配合的讓人讚賞.. 而 XBL 讓您利用 CSS Selector 的方式, 讓 XUL / HTML 可以&lt;br /&gt;binding 到 Content / Properties / Methods / Events / Style .&lt;br /&gt;這部份讓您對於開發 XUL 有很大的彈性.&lt;br /&gt;在部份的應用下, 可以開發類似於 jsp / jsf 的 custom tag .&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;font-size:100%;&quot; &gt;* XPCOM&lt;/span&gt;&lt;br /&gt;透過 XPCOM, 可以讓 javascript 使用原生的方法.&lt;br /&gt;利用 XPCOM 開檔 , 網路連線 , 資料庫操作等.&lt;br /&gt;亦可以自行利用 C++ 或 javascript 實作自己的 XPCOM , 有點像 JNI.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold; color: rgb(255, 0, 0);font-size:130%;&quot; &gt;心得&lt;/span&gt;&lt;br /&gt;對於一個中/大型的 Application 專案, 建議採用 Java RCP.&lt;br /&gt;對於一個小型的 Application 專案或設計專案 Prototype 時, 這時利用 GRE/XULRunner 是在適合不過的了..&lt;br /&gt;(大專案也行啦.... firefox/thunderbird 就是, 它們可不是小專案呀...)&lt;br /&gt;&lt;br /&gt;而且...... 還有一個當初我採用的最大原因....... &lt;span style=&quot;font-weight: bold; color: rgb(204, 0, 0);font-size:180%;&quot; &gt;懶&lt;/span&gt;....&lt;br /&gt;若是利用 Java RCP, 每次換個客戶,換個 UI , 或是加點小功能..工作就會再回到我們手上來...&lt;br /&gt;用了 Gecko.. 現在變成美術設計的事了, 除非 XPCOM / XBL 有問題, 才需要 debug 及維護.&lt;br /&gt;這下子, 原來 &quot;軟體部門&quot; 的專案變成了 &quot;設計部門&quot; 的專案... 這才是太極最高奧義呀~&lt;br /&gt;&lt;br /&gt;歡迎大家來信或留言討論...</content><link rel='replies' type='application/atom+xml' href='http://racklin.blogspot.com/feeds/1703072299340651510/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/623037388172682225/1703072299340651510' title='4 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/623037388172682225/posts/default/1703072299340651510'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/623037388172682225/posts/default/1703072299340651510'/><link rel='alternate' type='text/html' href='http://racklin.blogspot.com/2007/11/gre.html' title='GRE 開發備註二'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00734471337083697849</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>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-623037388172682225.post-1676225138613303564</id><published>2007-09-28T12:03:00.000+08:00</published><updated>2007-09-28T12:13:22.969+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="funp"/><category scheme="http://www.blogger.com/atom/ns#" term="iGoogle"/><title type='text'>ifunP 推推王點播台 問題修正</title><content type='html'>由於 &lt;a href=&quot;http://funp.com/&quot;&gt;funp.com&lt;/a&gt; 改版, 在 RSS 上做了部份修改.&lt;br /&gt;link tag 的 URL 變更, 所以造成 ifunP &lt;span style=&quot;color: rgb(255, 0, 0);&quot;&gt;無屁可 fun&lt;/span&gt; 的情況發生. 目前已修正完成並上傳.&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;您無需重新安裝, 在幾小時後 Google Cache 重整後您即可使用到新版的 ifunP.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;當然, 您急著用可以利用以 URL 新增的方式, 在 URL 中加個亂數.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;如 http://racklin.googlepages.com/ifunp.xml?200709271100 這樣也可以跳過 Google Cache 用到即時更新的版本&lt;/span&gt;...&lt;br /&gt;&lt;br /&gt;由於目前閉關趕專案中, 未能即時發現問題並改正, 造成不便在此請大家見諒...&lt;br /&gt;感謝 &lt;a href=&quot;http://blog.markplace.net/&quot;&gt;mark&lt;/a&gt; 的強勢提醒告知(利用 IM 的匿稱讓我看到.... )</content><link rel='replies' type='application/atom+xml' href='http://racklin.blogspot.com/feeds/1676225138613303564/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/623037388172682225/1676225138613303564' title='2 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/623037388172682225/posts/default/1676225138613303564'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/623037388172682225/posts/default/1676225138613303564'/><link rel='alternate' type='text/html' href='http://racklin.blogspot.com/2007/09/ifunp.html' title='ifunP 推推王點播台 問題修正'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00734471337083697849</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-623037388172682225.post-5305191273243450230</id><published>2007-09-17T10:10:00.000+08:00</published><updated>2007-09-17T11:01:49.479+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Gecko"/><category scheme="http://www.blogger.com/atom/ns#" term="JavaScript"/><category scheme="http://www.blogger.com/atom/ns#" term="Programming"/><title type='text'>GRE 開發備註一</title><content type='html'>整整花了一個星期閉關搞 &lt;a href=&quot;http://developer.mozilla.org/en/docs/GRE&quot;&gt;GRE&lt;/a&gt; . 這裡的 GRE 不是指英文的 GRE普通測驗. 而是 Gecko Runtime Environment.&lt;br /&gt;&lt;br /&gt;源起:&lt;br /&gt;由於手上一個 CASE 的需求是需要為公司的硬體週邊做一個檢測程式, 而這些週邊含 Serial Port(RS232) / Parallel Port(IEEE 1284) / USB 裝置 / 以及部份數位 TTL信號.&lt;br /&gt;而這些裝置希要提供 Win32 / Linux(趨勢) 上測試通過. &lt;br /&gt;且這支測試程式還有另一個任務, 就是 Open Source C++ 部份的 API 給買裝置回去整合的廠商參考實作. &lt;br /&gt;本來想用 Java + JNI 把它解決掉, 因為要 Release 的廠商多, 每一家要有自己的版本及 Logo, 所以要一家一家改 JForm 有點麻煩, 本來試試 &lt;a href=&quot;https://openjfx.dev.java.net/&quot;&gt;JavaFX&lt;/a&gt; 來動態搞, 不熟再加上第二個原因.&lt;br /&gt;廠商的工程師都是使用 C++ , 用 Java+JNI 等於我還是要再寫一份 C++ 的 Sample 給廠商.&lt;br /&gt;&lt;br /&gt;最主要的是.....想玩玩 GRE , 於是... 整個架構如下..&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://developer.mozilla.org/en/docs/XUL&quot;&gt;XUL&lt;/a&gt;/XHTML -&gt; Javascript -&gt; &lt;a href=&quot;http://developer.mozilla.org/en/docs/XPConnect&quot;&gt;XPConnect&lt;/a&gt; -&gt; &lt;a href=&quot;http://developer.mozilla.org/en/docs/XPCOM&quot;&gt;XPCOM&lt;/a&gt;(C++ or Javascript)&lt;br /&gt;&lt;br /&gt;##CONTINUE##&lt;br /&gt;所以, 除了最底層的裝置操作用 C++ 實作, 且這部份的 Code 剛好就是要給廠商的 Sample Code. &lt;br /&gt;其它的 GUI 部份及全部的程式流程, 只要在 XUL/XHTML 中寫寫 Javascript , 而 jQuery 部份修改也能操作 XUL ... &lt;br /&gt;所以每個客戶的程式界面要多炫就能有多炫，還可以給個 Flash 單介面和動畫 Splash 呢。&lt;br /&gt;&lt;br /&gt;卻被 Win32 平台搞死：&lt;br /&gt;在 Linux 下開發很順利, 整個實作過程和原始概念差不多, 也開發的很愉快..&lt;br /&gt;沒想到原本以為最容易的 Win32 平台, 由於開始想用 GRE 前沒做太多功課, 卻是惡夢的開始.&lt;br /&gt;&lt;br /&gt;阿土伯是打算使用 VC++ 2005 express edition 來 make , 怎麼搞就是一堆 error.&lt;br /&gt;後來看到 &lt;a href=&quot;http://developer.mozilla.org/en/docs/Windows_Build_Prerequisites&quot;&gt;Windows Build Prerequisites&lt;/a&gt; 差點昏倒, 原來 Gecko 1.8 在 VC++ 2005 express 是 NO .. 問題剩下最後一哩路了, 總不改用 &quot;原版A拷 VC6 / VC7.1&quot; 呀~~&lt;br /&gt;查了很多, &lt;a href=&quot;http://marilab.hp.infoseek.co.jp/buildfx/vc8.html&quot;&gt;日本人寫的這篇&lt;/a&gt;還算詳細, 雖然整個 mozilla 還是無法 build 出來, 但 extensions 及 sdk 都還沒問題. 給使用 VC++ 2005 express 的大家參考.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;建議參考資料：&lt;br /&gt;&lt;a href=&quot;http://developer.mozilla.org/en/docs/XULRunner&quot;&gt;XULRunner&lt;/a&gt; - 一個可以單獨運作的 gecko 開發包, 如果沒有一定要 embed gecko , 由這個開始會很舒服.&lt;br /&gt;&lt;a href=&quot;http://xpcomviewer.mozdev.org/&quot;&gt;XPCOMViewer&lt;/a&gt; - 一個用來 Browse XPCOM 的工具, 您可以看到 Gecko 中一大堆實用的 XPCOM Interface.&lt;br /&gt;&lt;a href=&quot;http://developer.mozilla.org/en/docs/XPCOM:Strings&quot;&gt;XPCOM Strings&lt;/a&gt; / &lt;a href=&quot;http://developer.mozilla.org/en/docs/XPCOM_array_guide&quot;&gt;XPCOM Array&lt;/a&gt; / &lt;a href=&quot;http://developer.mozilla.org/en/docs/XPCOM_hashtable_guide&quot;&gt;XPCOM Hashtable&lt;/a&gt; - 這也是讓阿土伯最無力的文件之一, 資料有點老舊, 如果你是直接使用 Gecko-SDK 而不是由 seamonkey-src 來 build 你的專案, 你會發現文件中說的 class 在 SDK 中都不存在, 因為 frozen / unfrozen API 的關係. 建議直接花時間看看 SDK 中的 .h 看看有什麼 Class 比較快.&lt;br /&gt;這部份等結案後再來整理...&lt;br /&gt;&lt;br /&gt;總之... 忙到爆... 但希望這個工做完.. 以後就能涼到爆....&lt;br /&gt;因為, 不管什麼程式, 都只剩下 XUL/XHTML + Javascript 了.. 這部份要怎麼改都行.</content><link rel='replies' type='application/atom+xml' href='http://racklin.blogspot.com/feeds/5305191273243450230/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/623037388172682225/5305191273243450230' title='1 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/623037388172682225/posts/default/5305191273243450230'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/623037388172682225/posts/default/5305191273243450230'/><link rel='alternate' type='text/html' href='http://racklin.blogspot.com/2007/09/gre.html' title='GRE 開發備註一'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00734471337083697849</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-623037388172682225.post-990739622380467814</id><published>2007-08-27T15:06:00.000+08:00</published><updated>2007-08-27T16:11:28.385+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="JavaScript"/><category scheme="http://www.blogger.com/atom/ns#" term="jQuery"/><category scheme="http://www.blogger.com/atom/ns#" term="Programming"/><title type='text'>AOP for jQuery</title><content type='html'>就在寫 &lt;a href=&quot;http://racklin.blogspot.com/2007/08/jquery-114-release.html&quot;&gt;jQuery 1.1.4&lt;/a&gt; 那篇介紹文的同時, 逛了一下 jQuery plugins , 看到了一個很有意思的專案.&lt;br /&gt;&lt;a href=&quot;http://code.google.com/p/jquery-aop/&quot;&gt;jQuery AOP&lt;/a&gt; , 看起來是一個新的專案,作者於 2007/08/17 上傳第一個 &lt;a href=&quot;http://jquery-aop.googlecode.com/files/jquery-aop-1.0.zip&quot;&gt;release&lt;/a&gt; 檔案.&lt;br /&gt;&lt;br /&gt;aspect-oriented programming (&lt;a href=&quot;http://en.wikipedia.org/wiki/Aspect-oriented_programming&quot;&gt;AOP&lt;/a&gt;) 在 Java 中有幾個流行的 AOP 實作, &lt;a href=&quot;http://www.eclipse.org/aspectj/&quot;&gt;AspectJ&lt;/a&gt; , &lt;a href=&quot;http://aspectwerkz.codehaus.org/&quot;&gt;AspectWerkz &lt;/a&gt;和 &lt;a href=&quot;http://labs.jboss.com/jbossaop/&quot;&gt;JBossAOP&lt;/a&gt;, 所以有關 AOP 的介紹, 請看上面四個 Link, 不在此重覆說明.&lt;br /&gt;&lt;br /&gt;而 jQuery AOP 則是實作了 before / after / around 三個 advice, 雖然名為 jQuery AOP, 其實並未使用到 jQuery 的任何特性及功能, 所以即使您沒有使用 jQuery , 依然可以小改一下 code 來使用哦, 所以一定要堆的啦.&lt;br /&gt;&lt;br /&gt;##CONTINUE##&lt;br /&gt;我們可以很容易的利用 javascript  的 Function.apply() 來 hook function 或 object(&lt;a href=&quot;http://racklin.blogspot.com/2007/02/blogger-hack-tip-1-hacking-blogger.html&quot;&gt;Blogger Hack Tip#1&lt;/a&gt;) , 所以實作起來相當的輕巧, 只有 943 bytes.&lt;br /&gt;&lt;br /&gt;舉一個實例:&lt;br /&gt;任何程式語言, 在程式寫作過程中, 我們少不了要 Log , 然而 Log 的動作和程式本身實際的業務邏輯無關, 若是為每一個業務操作的 function / method 前後都加上 Logger.log(&#39;message&#39;), 對於程式本身而言.. 太過於難看(bad smell).&lt;br /&gt;所以這時我們可以藉由 Dynamic proxy 或 AOP framework 來改善這個 bad smell.&lt;br /&gt;&lt;br /&gt;使用 jQuery AOP 在 javascript 中使用 after / before / around  advices 變的很簡單:&lt;br /&gt;&lt;br /&gt;例1 對 native object 切入:&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;jQuery.aop.before( {target: String, method: &#39;replace&#39;},&lt;br /&gt;function(regex, newString) {&lt;br /&gt; alert(&quot;About to replace string &#39;&quot; + this + &quot;&#39; with &#39;&quot; + newString + &quot;&#39; using regEx &#39;&quot; + regex + &quot;&#39;&quot;);&lt;br /&gt;}&lt;br /&gt;);&lt;br /&gt;&quot;Hello World&quot;.replace(&quot;Hello&quot;, &quot;Hello jQuery&quot;);&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;例2 對 global function 切入:&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;function testEcho ( arg) {&lt;br /&gt; alert(&#39;testEcho: &#39; + arg);&lt;br /&gt;}&lt;br /&gt;jQuery.aop.before( {target: window, method: &#39;testEcho&#39;},&lt;br /&gt;function(arg) {&lt;br /&gt; alert(&quot;About to testEcho arguments is &quot; + arg);&lt;br /&gt;}&lt;br /&gt;);&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;例3 對 instance object 切入:&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;var TestObj = function (name) {&lt;br /&gt;    this.name = name;&lt;br /&gt;};&lt;br /&gt;TestObj.prototype.hello = function (arg) {&lt;br /&gt;    alert(this.name + &#39;:&#39; + arg);&lt;br /&gt;};&lt;br /&gt;var rack = new TestObj(&#39;rack&#39;);&lt;br /&gt;jQuery.aop.before( {target: rack, method: &#39;hello&#39;},&lt;br /&gt;function(arg) {&lt;br /&gt;    alert(&quot;before &quot;+ this.name +&quot; say &quot; + arg);&lt;br /&gt;  }&lt;br /&gt;);&lt;br /&gt;rack.hello(&#39;hello&#39;);&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;其它各位依此類堆.... 有了 jQuery AOP , javascript 也能寫的很優雅嘍.&lt;br /&gt;&lt;span style=&quot;font-style: italic;&quot;&gt;(都已經 Hook Blogger了, 之前怎麼沒想到順便弄一個 plugin , 唉~~ sense 不足.. 被搶頭香了 :D )&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://racklin.blogspot.com/feeds/990739622380467814/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/623037388172682225/990739622380467814' title='3 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/623037388172682225/posts/default/990739622380467814'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/623037388172682225/posts/default/990739622380467814'/><link rel='alternate' type='text/html' href='http://racklin.blogspot.com/2007/08/aop-for-jquery.html' title='AOP for jQuery'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00734471337083697849</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></feed>