<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:posterous="http://posterous.com/help/rss/1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">
  <channel>
    <title>Domon's Programming Notes</title>
    <link>http://domon.posterous.com</link>
    <description>記錄 programming 相關筆記。</description>
    <generator>posterous.com</generator>
    <link xmlns="http://www.w3.org/2005/Atom" href="http://posterous.com/api/sup_update#590ffaedb" type="application/json" rel="http://api.friendfeed.com/2008/03#sup" />
    
    
    <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/domon-posterous" /><feedburner:info uri="domon-posterous" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://posterous.superfeedr.com/" /><feedburner:feedFlare href="http://add.my.yahoo.com/rss?url=http%3A%2F%2Ffeeds.feedburner.com%2Fdomon-posterous" src="http://us.i1.yimg.com/us.yimg.com/i/us/my/addtomyyahoo4.gif">Subscribe with My Yahoo!</feedburner:feedFlare><feedburner:feedFlare href="http://www.bloglines.com/sub/http://feeds.feedburner.com/domon-posterous" src="http://www.bloglines.com/images/sub_modern11.gif">Subscribe with Bloglines</feedburner:feedFlare><feedburner:feedFlare href="http://fusion.google.com/add?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2Fdomon-posterous" src="http://buttons.googlesyndication.com/fusion/add.gif">Subscribe with Google</feedburner:feedFlare><feedburner:feedFlare href="http://mix.excite.eu/add?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2Fdomon-posterous" src="http://image.excite.co.uk/mix/addtomix.gif">Subscribe with Excite MIX</feedburner:feedFlare><item>
      <pubDate>Thu, 22 Sep 2011 05:10:00 -0700</pubDate>
      <title>Keynote - Brad Fitzpatrick | DjangoCon on blip.tv</title>
      <link>http://feedproxy.google.com/~r/domon-posterous/~3/pSO5Ayit_C0/keynote-brad-fitzpatrick-djangocon-on-bliptv</link>
      <guid isPermaLink="false">http://domon.posterous.com/keynote-brad-fitzpatrick-djangocon-on-bliptv</guid>
      <description>&lt;p&gt;
	&lt;div class="posterous_bookmarklet_entry"&gt;
&lt;object data="http://a.blip.tv/scripts/flash/stratos.swf" type="application/x-shockwave-flash" height="282" width="500"&gt;
&lt;param name="allowfullscreen" value="true" /&gt;
&lt;param name="allowscriptaccess" value="always" /&gt;
&lt;param name="wmode" value="transparent" /&gt;
&lt;param name="flashvars" value="showplayerpath=http://a.blip.tv/scripts/flash/stratos.swf&amp;amp;enablejs=true&amp;amp;skin=BlipSmooth&amp;amp;onsite=true&amp;amp;nopostroll=true&amp;amp;useoldendcap=true&amp;amp;showsharebutton=false&amp;amp;captionson=true&amp;amp;referrer=http://www.blip.tv&amp;amp;file=http://blip.tv/rss/flash/5572560&amp;amp;feedUrl=http://blip.tv/djangocon/rss/flash&amp;amp;page=episode&amp;amp;nopreroll=false" /&gt;
&lt;/object&gt;
&lt;div class="posterous_quote_citation"&gt;via &lt;a href="http://blip.tv/djangocon/keynote-brad-fitzpatrick-5572560"&gt;blip.tv&lt;/a&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;並非別人就是天才，自己就是笨蛋。
&lt;ul&gt;
&lt;li&gt;自己知道自己哪裡癢、怎麼癢，會癢就抓！&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;為什麼要自己來？
&lt;ul&gt;
&lt;li&gt;可以是為了學習，也可以是因為不想學習。自己來是有多難？&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;簡單 != 很快可以解決&lt;br /&gt;花時間 != 困難&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;東西放出去，就要有心理準備持續收到 mail，即使那只是自己一時的小玩具。
&lt;ul&gt;
&lt;li&gt;技巧：減少自己的 address 曝光、提早建立社群&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
	
&lt;/p&gt;

&lt;p&gt;&lt;a href="http://domon.posterous.com/keynote-brad-fitzpatrick-djangocon-on-bliptv"&gt;Permalink&lt;/a&gt; 

	| &lt;a href="http://domon.posterous.com/keynote-brad-fitzpatrick-djangocon-on-bliptv#comment"&gt;Leave a comment&amp;nbsp;&amp;nbsp;&amp;raquo;&lt;/a&gt;

&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/9g-kBFIQMrWjMAQXUPEHglqemEU/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/9g-kBFIQMrWjMAQXUPEHglqemEU/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/9g-kBFIQMrWjMAQXUPEHglqemEU/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/9g-kBFIQMrWjMAQXUPEHglqemEU/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/domon-posterous/~4/pSO5Ayit_C0" height="1" width="1"/&gt;</description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/102428/Domon.JPG</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/jXCw9O0zRL</posterous:profileUrl>
        <posterous:firstName>Domon</posterous:firstName>
        <posterous:lastName />
        <posterous:nickName>Domon</posterous:nickName>
        <posterous:displayName>Domon</posterous:displayName>
      </posterous:author>
    <feedburner:origLink>http://domon.posterous.com/keynote-brad-fitzpatrick-djangocon-on-bliptv</feedburner:origLink></item>
    <item>
      <pubDate>Fri, 05 Aug 2011 03:37:00 -0700</pubDate>
      <title>The protocol-relative URL « Paul Irish</title>
      <link>http://feedproxy.google.com/~r/domon-posterous/~3/dewzrXSeyn4/the-protocol-relative-url-paul-irish</link>
      <guid isPermaLink="false">http://domon.posterous.com/the-protocol-relative-url-paul-irish</guid>
      <description>&lt;p&gt;
	&lt;div class="posterous_bookmarklet_entry"&gt;
      &lt;blockquote class="posterous_long_quote"&gt;&lt;p&gt;There's this little trick you can get away with that'll save you some headaches:&lt;/p&gt;

&lt;div class="wp_syntax"&gt;&lt;div class="code"&gt;&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;&amp;lt;img src=&amp;quot;//domain.com/img/logo.png&amp;quot;&amp;gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;img src="http://paulirish.com/wp-content/uploads/2010/10/this-page-contains-both-secure-and-nonsecure-items.gif" align="right" height="100" style="margin: 0 0 10px 10px;" width="222" /&gt;If the browser is viewing that current page in through HTTPS, then it'll request that asset with the HTTPS protocol, otherwise it'll typically* request it with HTTP. This prevents that awful "This Page Contains Both Secure and Non-Secure Items" error message in IE, keeping all your asset requests within the same protocol.&lt;/p&gt;
&lt;p&gt;*Of course, if you're viewing the file locally, it'll try to request the file with the &lt;code&gt;file://&lt;/code&gt; protocol. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="posterous_quote_citation"&gt;via &lt;a href="http://paulirish.com/2010/the-protocol-relative-url/"&gt;paulirish.com&lt;/a&gt;&lt;/div&gt;
    &lt;p&gt;https 的頁面中若送出 http 的 request，就會收到 browser 的警告。
&lt;/p&gt;&lt;p&gt;若該 resource 同時可以透過 https 和 http 取得，則不要把 protocol 寫出來，在 https 的頁面中 browser 會自行決定採 https。&lt;/p&gt;&lt;/div&gt;
	
&lt;/p&gt;

&lt;p&gt;&lt;a href="http://domon.posterous.com/the-protocol-relative-url-paul-irish"&gt;Permalink&lt;/a&gt; 

	| &lt;a href="http://domon.posterous.com/the-protocol-relative-url-paul-irish#comment"&gt;Leave a comment&amp;nbsp;&amp;nbsp;&amp;raquo;&lt;/a&gt;

&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/W-aolaO8N7efe-FyODhuDDfxwdE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/W-aolaO8N7efe-FyODhuDDfxwdE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/W-aolaO8N7efe-FyODhuDDfxwdE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/W-aolaO8N7efe-FyODhuDDfxwdE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/domon-posterous/~4/dewzrXSeyn4" height="1" width="1"/&gt;</description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/102428/Domon.JPG</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/jXCw9O0zRL</posterous:profileUrl>
        <posterous:firstName>Domon</posterous:firstName>
        <posterous:lastName />
        <posterous:nickName>Domon</posterous:nickName>
        <posterous:displayName>Domon</posterous:displayName>
      </posterous:author>
    <feedburner:origLink>http://domon.posterous.com/the-protocol-relative-url-paul-irish</feedburner:origLink></item>
    <item>
      <pubDate>Wed, 29 Jun 2011 04:27:00 -0700</pubDate>
      <title>Documentation is freaking awesome // Speaker Deck</title>
      <link>http://feedproxy.google.com/~r/domon-posterous/~3/mYLomWEM0mg/documentation-is-freaking-awesome-speaker-dec</link>
      <guid isPermaLink="false">http://domon.posterous.com/documentation-is-freaking-awesome-speaker-dec</guid>
      <description>&lt;p&gt;
	&lt;div class="posterous_bookmarklet_entry"&gt;
&lt;blockquote class="posterous_long_quote"&gt;
&lt;h1&gt;&lt;span style="font-size: 13px; font-weight: normal;"&gt;&lt;iframe src="//speakerdeck.com/embed/4d51eed25753083721000005?size=preview"&gt;&lt;/iframe&gt;&lt;/span&gt;&lt;/h1&gt;
&lt;/blockquote&gt;
&lt;div class="posterous_quote_citation"&gt;via &lt;a href="http://speakerdeck.com/u/kneath/p/documentation"&gt;speakerdeck.com&lt;/a&gt;&lt;/div&gt;
&lt;p&gt;寫文件有很多好處，包含讓更多人了解你的 project，進而願意使用甚至 contribute； &lt;br /&gt;寫文件也是個機會，讓自己停下來了解自己的 code 是否有問題。&lt;/p&gt;
&lt;p&gt;slide 中提到不少產生 doc 的好工具，像是 RDoc、YARD、TomDoc&amp;hellip;&amp;hellip;等。&lt;/p&gt;
&lt;/div&gt;
	
&lt;/p&gt;

&lt;p&gt;&lt;a href="http://domon.posterous.com/documentation-is-freaking-awesome-speaker-dec"&gt;Permalink&lt;/a&gt; 

	| &lt;a href="http://domon.posterous.com/documentation-is-freaking-awesome-speaker-dec#comment"&gt;Leave a comment&amp;nbsp;&amp;nbsp;&amp;raquo;&lt;/a&gt;

&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/eJOIjnmUTN2Ki4GBejw8UppUHE0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/eJOIjnmUTN2Ki4GBejw8UppUHE0/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/eJOIjnmUTN2Ki4GBejw8UppUHE0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/eJOIjnmUTN2Ki4GBejw8UppUHE0/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/domon-posterous/~4/mYLomWEM0mg" height="1" width="1"/&gt;</description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/102428/Domon.JPG</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/jXCw9O0zRL</posterous:profileUrl>
        <posterous:firstName>Domon</posterous:firstName>
        <posterous:lastName />
        <posterous:nickName>Domon</posterous:nickName>
        <posterous:displayName>Domon</posterous:displayName>
      </posterous:author>
    <feedburner:origLink>http://domon.posterous.com/documentation-is-freaking-awesome-speaker-dec</feedburner:origLink></item>
    <item>
      <pubDate>Fri, 14 May 2010 23:22:00 -0700</pubDate>
      <title>Quick Tip: Understanding CSS Specificity | Nettuts+</title>
      <link>http://feedproxy.google.com/~r/domon-posterous/~3/Nq8fZii-wAQ/quick-tip-understanding-css-specificity-nettu</link>
      <guid isPermaLink="false">http://domon.posterous.com/quick-tip-understanding-css-specificity-nettu</guid>
      <description>&lt;p&gt;
	&lt;div class="posterous_bookmarklet_entry"&gt;
&lt;object height="376" width="500"&gt;
&lt;param name="movie" value="http://www.youtube.com/v/In78mSOHmls&amp;amp;hl=en_US&amp;amp;fs=1&amp;amp;hd=1&amp;amp;color1=0x3a3a3a&amp;amp;color2=0x999999" /&gt;
&lt;param name="allowFullScreen" value="true" /&gt;
&lt;param name="allowscriptaccess" value="always" /&gt;
&lt;embed src="http://www.youtube.com/v/In78mSOHmls&amp;amp;hl=en_US&amp;amp;fs=1&amp;amp;hd=1&amp;amp;color1=0x3a3a3a&amp;amp;color2=0x999999" type="application/x-shockwave-flash" height="376" width="500"&gt;&lt;/embed&gt;
&lt;/object&gt;
&lt;div class="posterous_quote_citation"&gt;via &lt;a href="http://net.tutsplus.com/tutorials/html-css-techniques/quick-tip-understanding-css-specificity/"&gt;net.tutsplus.com&lt;/a&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;CSS rule 的 specificity 越高，priority 越高。&lt;/li&gt;
&lt;li&gt;specificity 可由該 rule 包含的 selector 計算總分
&lt;ul&gt;
&lt;li&gt;HTML element: 1&lt;/li&gt;
&lt;li&gt;class: 10&lt;/li&gt;
&lt;li&gt;id: 100&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
	
&lt;/p&gt;

&lt;p&gt;&lt;a href="http://domon.posterous.com/quick-tip-understanding-css-specificity-nettu"&gt;Permalink&lt;/a&gt; 

	| &lt;a href="http://domon.posterous.com/quick-tip-understanding-css-specificity-nettu#comment"&gt;Leave a comment&amp;nbsp;&amp;nbsp;&amp;raquo;&lt;/a&gt;

&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/WOvUGrsz79c6N_dj54Dwv6Ix0E0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/WOvUGrsz79c6N_dj54Dwv6Ix0E0/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/WOvUGrsz79c6N_dj54Dwv6Ix0E0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/WOvUGrsz79c6N_dj54Dwv6Ix0E0/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/domon-posterous/~4/Nq8fZii-wAQ" height="1" width="1"/&gt;</description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/102428/Domon.JPG</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/jXCw9O0zRL</posterous:profileUrl>
        <posterous:firstName>Domon</posterous:firstName>
        <posterous:lastName />
        <posterous:nickName>Domon</posterous:nickName>
        <posterous:displayName>Domon</posterous:displayName>
      </posterous:author>
    <feedburner:origLink>http://domon.posterous.com/quick-tip-understanding-css-specificity-nettu</feedburner:origLink></item>
    <item>
      <pubDate>Tue, 04 May 2010 07:16:00 -0700</pubDate>
      <title>Why Ruby</title>
      <link>http://feedproxy.google.com/~r/domon-posterous/~3/wjdPa_MzrXE/why-ruby</link>
      <guid isPermaLink="false">http://domon.posterous.com/why-ruby</guid>
      <description>&lt;p&gt;
	&lt;div class="posterous_bookmarklet_entry"&gt;
&lt;object height="417" width="500"&gt;
&lt;param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=whyruby-090524054353-phpapp02&amp;amp;stripped_title=why-ruby-1481119" /&gt;
&lt;param name="allowFullScreen" value="true" /&gt;
&lt;param name="allowScriptAccess" value="always" /&gt; &lt;embed src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=whyruby-090524054353-phpapp02&amp;amp;stripped_title=why-ruby-1481119" type="application/x-shockwave-flash" height="417" width="500"&gt;&lt;/embed&gt;
&lt;/object&gt;
&lt;div class="posterous_quote_citation"&gt;via &lt;a href="http://www.slideshare.net/lgn21st/why-ruby-1481119"&gt;slideshare.net&lt;/a&gt;
&lt;/div&gt;
&lt;p&gt;1. 好的語言不該限制思考； &lt;br /&gt;2. 簡潔 != 簡單。&lt;/p&gt;
&lt;p&gt;作者在別場演講的講稿（應該是同份 slide）： &lt;br /&gt;&lt;a href="http://www.rubyist.net/~matz/slides/oscon2003/power.txt"&gt;http://www.rubyist.net/~matz/slides/oscon2003/power.txt&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
	
&lt;/p&gt;

&lt;p&gt;&lt;a href="http://domon.posterous.com/why-ruby"&gt;Permalink&lt;/a&gt; 

	| &lt;a href="http://domon.posterous.com/why-ruby#comment"&gt;Leave a comment&amp;nbsp;&amp;nbsp;&amp;raquo;&lt;/a&gt;

&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/ISvmAn0rJQV-qoQ6dPoKw14j-J0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ISvmAn0rJQV-qoQ6dPoKw14j-J0/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/ISvmAn0rJQV-qoQ6dPoKw14j-J0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ISvmAn0rJQV-qoQ6dPoKw14j-J0/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/domon-posterous/~4/wjdPa_MzrXE" height="1" width="1"/&gt;</description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/102428/Domon.JPG</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/jXCw9O0zRL</posterous:profileUrl>
        <posterous:firstName>Domon</posterous:firstName>
        <posterous:lastName />
        <posterous:nickName>Domon</posterous:nickName>
        <posterous:displayName>Domon</posterous:displayName>
      </posterous:author>
    <feedburner:origLink>http://domon.posterous.com/why-ruby</feedburner:origLink></item>
    <item>
      <pubDate>Thu, 29 Apr 2010 09:42:00 -0700</pubDate>
      <title>Ruby製アプリケーションを配布するn個の方法 (1/2) - 原 悠‐ニコニコ動画(9)</title>
      <link>http://feedproxy.google.com/~r/domon-posterous/~3/D1eObbOKXSY/rubyn-12-9</link>
      <guid isPermaLink="false">http://domon.posterous.com/rubyn-12-9</guid>
      <description>&lt;p&gt;
	&lt;div class="posterous_bookmarklet_entry"&gt;
&lt;iframe scrolling="no" src="http://ext.nicovideo.jp/thumb/sm9138852" frameborder="0" height="176" width="312"&gt;&lt;a href="http://www.nicovideo.jp/watch/sm9138852"&gt;【ニコニコ動画】Ruby製アプリケーションを配布するn個の方法 (1/2) - 原 悠&lt;/a&gt;&lt;/iframe&gt;
&lt;div class="posterous_quote_citation"&gt;via &lt;a href="http://www.nicovideo.jp/watch/sm9138852"&gt;nicovideo.jp&lt;/a&gt;
&lt;/div&gt;
&lt;p&gt;1. RubyScript2Exe：把所有檔案在 temp dir 展開，速度比較慢。作者很久沒更新了，Ruby 1.8.6 之後無法使用。 &lt;br /&gt;2. Exerb：不使用 temp dir 的方式，有 RubyGems 相關問題，作者自己沒什麼在用了。 &lt;br /&gt;3. OCRA：只包進需要的檔案，所以比較快。建議使用。 &lt;br /&gt;4. Crate：把 code 和 lib 存在 sqlite3 db 裡。 &lt;br /&gt;5. Zip：把 win32 版 ruby 和所寫的程式放一起，寫個 .bat 檔啟動。Exerb 的作者現在用這方法。&lt;/p&gt;
&lt;p&gt;個人經驗： &lt;br /&gt;之前嘗試的時候，RubyScript2Exe 失敗；OCRA 在 XP 上可以，Win7 x64 不行；Exerb 想試還沒試（作者還有在更新）；Crate 好像值得一試；zip 真是最後的終極解法（但和沒解差不多）。&lt;/p&gt;
&lt;p&gt;演講的下半段，是把 web app 包起來當做桌面程式。&lt;/p&gt;
&lt;/div&gt;
	
&lt;/p&gt;

&lt;p&gt;&lt;a href="http://domon.posterous.com/rubyn-12-9"&gt;Permalink&lt;/a&gt; 

	| &lt;a href="http://domon.posterous.com/rubyn-12-9#comment"&gt;Leave a comment&amp;nbsp;&amp;nbsp;&amp;raquo;&lt;/a&gt;

&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/50fbYQ4aWnX3GkWbvtiL17HZuqM/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/50fbYQ4aWnX3GkWbvtiL17HZuqM/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/50fbYQ4aWnX3GkWbvtiL17HZuqM/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/50fbYQ4aWnX3GkWbvtiL17HZuqM/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/domon-posterous/~4/D1eObbOKXSY" height="1" width="1"/&gt;</description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/102428/Domon.JPG</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/jXCw9O0zRL</posterous:profileUrl>
        <posterous:firstName>Domon</posterous:firstName>
        <posterous:lastName />
        <posterous:nickName>Domon</posterous:nickName>
        <posterous:displayName>Domon</posterous:displayName>
      </posterous:author>
    <feedburner:origLink>http://domon.posterous.com/rubyn-12-9</feedburner:origLink></item>
    <item>
      <pubDate>Thu, 29 Apr 2010 02:06:57 -0700</pubDate>
      <title>OSDC.tw - Building a platform from open source</title>
      <link>http://feedproxy.google.com/~r/domon-posterous/~3/Dj_KH8n7I1c/osdctw-building-a-platform-from-open-source</link>
      <guid isPermaLink="false">http://domon.posterous.com/osdctw-building-a-platform-from-open-source</guid>
      <description>&lt;p&gt;
	&lt;div class="posterous_bookmarklet_entry"&gt;
      &lt;object height="417" width="500"&gt;
&lt;param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=osdc-building-a-platform-from-open-source-100424205623-phpapp01&amp;stripped_title=osdctw-building-a-platform-from-open-source" /&gt;
&lt;param name="allowFullScreen" value="true" /&gt;&lt;param name="allowScriptAccess" value="always" /&gt;
&lt;embed allowfullscreen="true" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=osdc-building-a-platform-from-open-source-100424205623-phpapp01&amp;stripped_title=osdctw-building-a-platform-from-open-source" allowscriptaccess="always" type="application/x-shockwave-flash" height="417" width="500"&gt;&lt;/embed&gt;
&lt;/object&gt;

&lt;div class="posterous_quote_citation"&gt;via &lt;a href="http://www.slideshare.net/dustin.whittle/osdctw-building-a-platform-from-open-source"&gt;slideshare.net&lt;/a&gt;&lt;/div&gt;
    &lt;p&gt;- Ability to scale != performance
&lt;br /&gt;- Premature optimization is the root of all evil. e.g. " v.s. ', echo v.s. print
&lt;br /&gt;- Do not use .htaccess (move to real apache config)&lt;/p&gt;&lt;/div&gt;
	
&lt;/p&gt;

&lt;p&gt;&lt;a href="http://domon.posterous.com/osdctw-building-a-platform-from-open-source"&gt;Permalink&lt;/a&gt; 

	| &lt;a href="http://domon.posterous.com/osdctw-building-a-platform-from-open-source#comment"&gt;Leave a comment&amp;nbsp;&amp;nbsp;&amp;raquo;&lt;/a&gt;

&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/eO5dVIeTU69pK3atvD4VWxB-w4s/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/eO5dVIeTU69pK3atvD4VWxB-w4s/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/eO5dVIeTU69pK3atvD4VWxB-w4s/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/eO5dVIeTU69pK3atvD4VWxB-w4s/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/domon-posterous/~4/Dj_KH8n7I1c" height="1" width="1"/&gt;</description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/102428/Domon.JPG</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/jXCw9O0zRL</posterous:profileUrl>
        <posterous:firstName>Domon</posterous:firstName>
        <posterous:lastName />
        <posterous:nickName>Domon</posterous:nickName>
        <posterous:displayName>Domon</posterous:displayName>
      </posterous:author>
    <feedburner:origLink>http://domon.posterous.com/osdctw-building-a-platform-from-open-source</feedburner:origLink></item>
    <item>
      <pubDate>Fri, 29 Jan 2010 07:23:15 -0800</pubDate>
      <title>Assigning property values, Cascading, and Inheritance</title>
      <link>http://feedproxy.google.com/~r/domon-posterous/~3/vPDN2O5TgzY/assigning-property-values-cascading-and-inher</link>
      <guid isPermaLink="false">http://domon.posterous.com/assigning-property-values-cascading-and-inher</guid>
      <description>&lt;p&gt;
	&lt;div class="posterous_bookmarklet_entry"&gt;
      &lt;blockquote class="posterous_long_quote"&gt;
&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;/* From the user's style sheet */
p { text-indent: 1em ! important }
p { font-style: italic ! important }
p { font-size: 18pt }

/* From the author's style sheet */
p { text-indent: 1.5em !important }
p { font: normal 12pt sans-serif !important }
p { font-size: 24pt }&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;/blockquote&gt;&lt;/div&gt;
&lt;div class="posterous_quote_citation"&gt;via &lt;a href="http://www.w3.org/TR/CSS2/cascade.html#important-rules"&gt;w3.org&lt;/a&gt;&lt;/div&gt;
    &lt;p&gt;- 加上 ! important 的 declaration 會蓋過普通的 declaration 。
&lt;br /&gt;- 一般情況下，author 的 style 會蓋過 user 的 style；但加上 ! important 時，則是 user 蓋過 author。
&lt;br /&gt;- 例子中，前兩行 declaration 是 user 勝，第三行則是 author 勝。&lt;/p&gt;
	
&lt;/p&gt;

&lt;p&gt;&lt;a href="http://domon.posterous.com/assigning-property-values-cascading-and-inher"&gt;Permalink&lt;/a&gt; 

	| &lt;a href="http://domon.posterous.com/assigning-property-values-cascading-and-inher#comment"&gt;Leave a comment&amp;nbsp;&amp;nbsp;&amp;raquo;&lt;/a&gt;

&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/RxYsJDkzRs9OYaHP4Xbgn3rolSo/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/RxYsJDkzRs9OYaHP4Xbgn3rolSo/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/RxYsJDkzRs9OYaHP4Xbgn3rolSo/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/RxYsJDkzRs9OYaHP4Xbgn3rolSo/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/domon-posterous/~4/vPDN2O5TgzY" height="1" width="1"/&gt;</description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/102428/Domon.JPG</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/jXCw9O0zRL</posterous:profileUrl>
        <posterous:firstName>Domon</posterous:firstName>
        <posterous:lastName />
        <posterous:nickName>Domon</posterous:nickName>
        <posterous:displayName>Domon</posterous:displayName>
      </posterous:author>
    <feedburner:origLink>http://domon.posterous.com/assigning-property-values-cascading-and-inher</feedburner:origLink></item>
    <item>
      <pubDate>Sun, 24 Jan 2010 17:55:00 -0800</pubDate>
      <title>The GNU General Public License - GNU Project - Free Software Foundation (FSF)</title>
      <link>http://feedproxy.google.com/~r/domon-posterous/~3/bixErkZipC4/the-gnu-general-public-license-gnu-project-fr</link>
      <guid isPermaLink="false">http://domon.posterous.com/the-gnu-general-public-license-gnu-project-fr</guid>
      <description>&lt;p&gt;
	&lt;div class="posterous_bookmarklet_entry"&gt;
&lt;blockquote class="posterous_long_quote"&gt;
&lt;p&gt;To do so, attach the following notices to the program.  It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the &amp;ldquo;copyright&amp;rdquo; line and a pointer to where the full notice is found.&lt;/p&gt;
&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;&amp;lt;one line to give the program's name and a brief idea of what it does.&amp;gt;
    Copyright (C) &amp;lt;year&amp;gt;  &amp;lt;name of author&amp;gt;

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see &amp;lt;http://www.gnu.org/licenses/&amp;gt;.&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Also add information on how to contact you by electronic and paper mail.&lt;/p&gt;
&lt;p&gt;If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode:&lt;/p&gt;
&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;&amp;lt;program&amp;gt;  Copyright (C) &amp;lt;year&amp;gt;  &amp;lt;name of author&amp;gt;
    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
    This is free software, and you are welcome to redistribute it
    under certain conditions; type `show c' for details.&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License.  Of course, your program's commands might be different; for a GUI interface, you would use an &amp;ldquo;about box&amp;rdquo;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;div class="posterous_quote_citation"&gt;via &lt;a href="http://www.gnu.org/licenses/gpl-3.0.html#howto"&gt;gnu.org&lt;/a&gt;&lt;/div&gt;
&lt;p&gt;細節可參考「&lt;a href="http://www.gnu.org/licenses/gpl-howto.html" title="How to use GNU licenses for your own software" target="_blank"&gt;How to use GNU licenses for your own software&lt;/a&gt;」。&lt;/p&gt;
&lt;p&gt;- 隨軟體附上檔名 COPYING，內容是 &lt;a href="http://www.gnu.org/licenses/gpl.txt" title="the text version of the GPL" target="_blank"&gt;GPL 的純文字版&lt;/a&gt;。&lt;/p&gt;
&lt;p&gt;- 每個檔案開頭最好都要寫「This file is part of &amp;lt;program&amp;gt;.」，接著是 copyright notice（誰寫的）和 copying permission statement（表明使用 GPL）。把 &amp;lt;program&amp;gt; 和「this program」換成軟體名稱。&lt;/p&gt;
&lt;p&gt;- 可以要求工作的雇主或學校簽署 copyright disclaimer，以免未來他們說著作權是屬於他們的。&lt;/p&gt;
&lt;/div&gt;
	
&lt;/p&gt;

&lt;p&gt;&lt;a href="http://domon.posterous.com/the-gnu-general-public-license-gnu-project-fr"&gt;Permalink&lt;/a&gt; 

	| &lt;a href="http://domon.posterous.com/the-gnu-general-public-license-gnu-project-fr#comment"&gt;Leave a comment&amp;nbsp;&amp;nbsp;&amp;raquo;&lt;/a&gt;

&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/O5L-2Tmemcp_z9UFmhvOfbMsAAA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/O5L-2Tmemcp_z9UFmhvOfbMsAAA/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/O5L-2Tmemcp_z9UFmhvOfbMsAAA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/O5L-2Tmemcp_z9UFmhvOfbMsAAA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/domon-posterous/~4/bixErkZipC4" height="1" width="1"/&gt;</description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/102428/Domon.JPG</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/jXCw9O0zRL</posterous:profileUrl>
        <posterous:firstName>Domon</posterous:firstName>
        <posterous:lastName />
        <posterous:nickName>Domon</posterous:nickName>
        <posterous:displayName>Domon</posterous:displayName>
      </posterous:author>
    <feedburner:origLink>http://domon.posterous.com/the-gnu-general-public-license-gnu-project-fr</feedburner:origLink></item>
    <item>
      <pubDate>Sat, 23 Jan 2010 21:58:27 -0800</pubDate>
      <title>jLinq - LINQ for JSON</title>
      <link>http://feedproxy.google.com/~r/domon-posterous/~3/qnoUVnZeW1c/jlinq-linq-for-json-0</link>
      <guid isPermaLink="false">http://domon.posterous.com/jlinq-linq-for-json-0</guid>
      <description>&lt;p&gt;
	&lt;div class="posterous_bookmarklet_entry"&gt;
      &lt;blockquote class="posterous_long_quote"&gt;
    
    &lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;var results = jLinq.from(data.users)
    .is(&amp;quot;admin&amp;quot;)
    .greater(&amp;quot;age&amp;quot;, 25)
    .orderBy(&amp;quot;-age&amp;quot;) //the '-' means descending
    .select();&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;

    
&lt;/blockquote&gt;&lt;div class="posterous_quote_citation"&gt;via &lt;a href="http://www.hugoware.net/Projects/jLinq"&gt;hugoware.net&lt;/a&gt;&lt;/div&gt;
    &lt;p&gt;LINQ 是 .NET 的 lib，選取部分資料時，可以 method chaining 方式，達到類似 SQL 的 operator，如 select、where……等的效果。
&lt;br /&gt;jlinq 這個 lib 則讓使用者可以對 JSON 裡的 object 下 LINQ style query。&lt;/p&gt;&lt;/div&gt;
	
&lt;/p&gt;

&lt;p&gt;&lt;a href="http://domon.posterous.com/jlinq-linq-for-json-0"&gt;Permalink&lt;/a&gt; 

	| &lt;a href="http://domon.posterous.com/jlinq-linq-for-json-0#comment"&gt;Leave a comment&amp;nbsp;&amp;nbsp;&amp;raquo;&lt;/a&gt;

&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/boZQ15D_9LtiDNyk9wZ9pzjPVlQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/boZQ15D_9LtiDNyk9wZ9pzjPVlQ/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/boZQ15D_9LtiDNyk9wZ9pzjPVlQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/boZQ15D_9LtiDNyk9wZ9pzjPVlQ/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/domon-posterous/~4/qnoUVnZeW1c" height="1" width="1"/&gt;</description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/102428/Domon.JPG</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/jXCw9O0zRL</posterous:profileUrl>
        <posterous:firstName>Domon</posterous:firstName>
        <posterous:lastName />
        <posterous:nickName>Domon</posterous:nickName>
        <posterous:displayName>Domon</posterous:displayName>
      </posterous:author>
    <feedburner:origLink>http://domon.posterous.com/jlinq-linq-for-json-0</feedburner:origLink></item>
    <item>
      <pubDate>Sat, 23 Jan 2010 04:52:00 -0800</pubDate>
      <title>Using Git to manage a web site</title>
      <link>http://feedproxy.google.com/~r/domon-posterous/~3/DAIA0Q7vUak/using-git-to-manage-a-web-site</link>
      <guid isPermaLink="false">http://domon.posterous.com/using-git-to-manage-a-web-site</guid>
      <description>&lt;p&gt;
	&lt;div class="posterous_bookmarklet_entry"&gt;
&lt;blockquote class="posterous_long_quote"&gt;
&lt;h2&gt;The remote repository&lt;/h2&gt;
&lt;p&gt;On the server, we create a new repository to mirror the local one.&lt;/p&gt;
&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;$ mkdir website.git &amp;amp;&amp;amp; cd website.git
$ git init --bare
Initialized empty Git repository in /home/ams/website.git/&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Although this mirror starts out "bare" (i.e., with no work tree of its own), we add a detached work tree that corresponds to the web server's &lt;code&gt;DocumentRoot&lt;/code&gt; (this directory must exist; Git will not create it for you.)&lt;/p&gt;
&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;$ mkdir /var/www/www.example.org
$ git config core.worktree /var/www/www.example.org
$ git config core.bare false
$ git config receive.denycurrentbranch ignore&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Then we define (and enable) a &lt;code&gt;post-receive&lt;/code&gt; hook.&lt;/p&gt;
&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;$ cat &amp;gt; hooks/post-receive
#!/bin/sh
git checkout -f
$ chmod +x hooks/post-receive&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Back on the workstation, we define a name for the remote mirror, and then mirror to it, creating a new "&lt;code&gt;master&lt;/code&gt;" branch there.&lt;/p&gt;
&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;$ git remote add web ssh://server.example.org/home/ams/website.git
$ git push web +master:refs/heads/master&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;On the server, &lt;code&gt;/var/www/www.example.org&lt;/code&gt; should now contain a copy of your files, independent of any &lt;code&gt;.git&lt;/code&gt; metadata.&lt;/p&gt;
&lt;h2&gt;The update process&lt;/h2&gt;
&lt;p&gt;Nothing could be simpler. In the local repository, just run&lt;/p&gt;
&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;$ git push web&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;This will transfer any new commits to the remote repository, where the &lt;code&gt;post-receive&lt;/code&gt; hook will immediately update the &lt;code&gt;DocumentRoot&lt;/code&gt; for you.&lt;/p&gt;
&lt;p&gt;(This is more convenient than defining your workstation as a remote on the server, and running "&lt;code&gt;git pull&lt;/code&gt;" by hand or from a cron job, and it doesn't require your workstation to be accessible by ssh.)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;div class="posterous_quote_citation"&gt;via &lt;a href="http://toroid.org/ams/git-website-howto"&gt;toroid.org&lt;/a&gt;&lt;/div&gt;
&lt;p&gt;概念：local repo &amp;lt;-&amp;gt; remote repo (bare repo + work tree)&lt;/p&gt;
&lt;p&gt;平常工作在 local repo，推到 remote 的 bare repo，由 hook 自動更新到 work tree（亦即網站 code 的所在，和 bare repo 不同目錄）。&lt;/p&gt;
&lt;/div&gt;
	
&lt;/p&gt;

&lt;p&gt;&lt;a href="http://domon.posterous.com/using-git-to-manage-a-web-site"&gt;Permalink&lt;/a&gt; 

	| &lt;a href="http://domon.posterous.com/using-git-to-manage-a-web-site#comment"&gt;Leave a comment&amp;nbsp;&amp;nbsp;&amp;raquo;&lt;/a&gt;

&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/t4WrxtEIMeSOKONBZS2hc1haI6M/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/t4WrxtEIMeSOKONBZS2hc1haI6M/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/t4WrxtEIMeSOKONBZS2hc1haI6M/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/t4WrxtEIMeSOKONBZS2hc1haI6M/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/domon-posterous/~4/DAIA0Q7vUak" height="1" width="1"/&gt;</description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/102428/Domon.JPG</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/jXCw9O0zRL</posterous:profileUrl>
        <posterous:firstName>Domon</posterous:firstName>
        <posterous:lastName />
        <posterous:nickName>Domon</posterous:nickName>
        <posterous:displayName>Domon</posterous:displayName>
      </posterous:author>
    <feedburner:origLink>http://domon.posterous.com/using-git-to-manage-a-web-site</feedburner:origLink></item>
    <item>
      <pubDate>Fri, 22 Jan 2010 04:20:33 -0800</pubDate>
      <title>Is there an "exists" function for jQuery - Stack Overflow</title>
      <link>http://feedproxy.google.com/~r/domon-posterous/~3/m5i3Oz8XFbI/is-there-an-exists-function-for-jquery-stack</link>
      <guid isPermaLink="false">http://domon.posterous.com/is-there-an-exists-function-for-jquery-stack</guid>
      <description>&lt;p&gt;
	&lt;div class="posterous_bookmarklet_entry"&gt;
      &lt;blockquote class="posterous_long_quote"&gt;&lt;span class="pln"&gt;jQuery&lt;/span&gt;&lt;span class="pun"&gt;.&lt;/span&gt;&lt;span class="pln"&gt;fn&lt;/span&gt;&lt;span class="pun"&gt;.&lt;/span&gt;&lt;span class="pln"&gt;exists &lt;/span&gt;&lt;span class="pun"&gt;=&lt;/span&gt;&lt;span class="pln"&gt; &lt;/span&gt;&lt;span class="kwd"&gt;function&lt;/span&gt;&lt;span class="pun"&gt;(){&lt;/span&gt;&lt;span class="kwd"&gt;return&lt;/span&gt;&lt;span class="pln"&gt; jQuery&lt;/span&gt;&lt;span class="pun"&gt;(&lt;/span&gt;&lt;span class="kwd"&gt;this&lt;/span&gt;&lt;span class="pun"&gt;).&lt;/span&gt;&lt;span class="pln"&gt;length&lt;/span&gt;&lt;span class="pun"&gt;&gt;&lt;/span&gt;&lt;span class="lit"&gt;0&lt;/span&gt;&lt;span class="pun"&gt;;}&lt;/span&gt;&lt;p /&gt;&lt;span class="kwd"&gt;if&lt;/span&gt;&lt;span class="pln"&gt; &lt;/span&gt;&lt;span class="pun"&gt;(&lt;/span&gt;&lt;span class="pln"&gt;$&lt;/span&gt;&lt;span class="pun"&gt;(&lt;/span&gt;&lt;span class="pln"&gt;selector&lt;/span&gt;&lt;span class="pun"&gt;).&lt;/span&gt;&lt;span class="pln"&gt;exists&lt;/span&gt;&lt;span class="pun"&gt;())&lt;/span&gt;&lt;span class="pln"&gt; &lt;/span&gt;&lt;span class="pun"&gt;{&lt;/span&gt;&lt;span class="pln"&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span class="com"&gt;// Do something&lt;/span&gt;&lt;span class="pln"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="pun"&gt;}&lt;/span&gt;&lt;/blockquote&gt;

&lt;div class="posterous_quote_citation"&gt;via &lt;a href="http://stackoverflow.com/questions/31044/is-there-an-exists-function-for-jquery"&gt;stackoverflow.com&lt;/a&gt;&lt;/div&gt;
    &lt;p&gt;使用 jQuery 時，想知道 element 是否存在，可從 length 判斷。
&lt;br /&gt;若大於 0 則代表選到 1 個以上的 element。
&lt;br /&gt;把這個判斷的動作寫成 exists 函式，是個方便的作法。&lt;/p&gt;&lt;/div&gt;
	
&lt;/p&gt;

&lt;p&gt;&lt;a href="http://domon.posterous.com/is-there-an-exists-function-for-jquery-stack"&gt;Permalink&lt;/a&gt; 

	| &lt;a href="http://domon.posterous.com/is-there-an-exists-function-for-jquery-stack#comment"&gt;Leave a comment&amp;nbsp;&amp;nbsp;&amp;raquo;&lt;/a&gt;

&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/aHF3tzU9dCtp0vdN9S0fAmja9Vk/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/aHF3tzU9dCtp0vdN9S0fAmja9Vk/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/aHF3tzU9dCtp0vdN9S0fAmja9Vk/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/aHF3tzU9dCtp0vdN9S0fAmja9Vk/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/domon-posterous/~4/m5i3Oz8XFbI" height="1" width="1"/&gt;</description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/102428/Domon.JPG</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/jXCw9O0zRL</posterous:profileUrl>
        <posterous:firstName>Domon</posterous:firstName>
        <posterous:lastName />
        <posterous:nickName>Domon</posterous:nickName>
        <posterous:displayName>Domon</posterous:displayName>
      </posterous:author>
    <feedburner:origLink>http://domon.posterous.com/is-there-an-exists-function-for-jquery-stack</feedburner:origLink></item>
    <item>
      <pubDate>Sun, 20 Dec 2009 21:07:09 -0800</pubDate>
      <title>Do you say "Click the button" or "Click ON the button" ? - Stack Overflow</title>
      <link>http://feedproxy.google.com/~r/domon-posterous/~3/AhkZadYOulw/do-you-say-click-the-button-or-click-on-the-b</link>
      <guid isPermaLink="false">http://domon.posterous.com/do-you-say-click-the-button-or-click-on-the-b</guid>
      <description>&lt;p&gt;
	&lt;div class="posterous_bookmarklet_entry"&gt;
      &lt;blockquote class="posterous_long_quote"&gt;&lt;p&gt;Although it's not fashionable to give props to Microsoft these days,
the &lt;a href="http://rads.stackoverflow.com/amzn/click/0735617465" rel="nofollow"&gt;Microsoft Manual of Style For Technical Publications&lt;/a&gt; is a great reference
for answering these sorts of questions.&lt;/p&gt;

&lt;p&gt;If anything, it sets a familiar standard that can be applied throughout your documentation.&lt;/p&gt;

&lt;p&gt;For this particular case, it recommends:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The words &lt;i&gt;the&lt;/i&gt; and &lt;i&gt;button&lt;/i&gt; should be omitted.&lt;/li&gt;
&lt;li&gt;Do not use &lt;i&gt;click on&lt;/i&gt;.&lt;/li&gt;
&lt;li&gt;Dialog box options should be boldface.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So, do not write:&lt;/p&gt;

&lt;p&gt;Click the Cancel button to close the window. &lt;/p&gt;

&lt;p&gt;Instead, write:&lt;/p&gt;

&lt;p&gt;Click &lt;b&gt;Cancel&lt;/b&gt;.&lt;/p&gt;

&lt;p&gt;Also, since users usually do not &lt;a href="http://en.wikipedia.org/wiki/RTFM" rel="nofollow"&gt;RTFM&lt;/a&gt;, and certainly will not RTFM to find out what the &lt;b&gt;Cancel&lt;/b&gt; button does, they will appreciate fewer words getting in the way of the information they really need to find.&lt;/p&gt;&lt;/blockquote&gt;

&lt;div class="posterous_quote_citation"&gt;via &lt;a href="http://stackoverflow.com/questions/435449/do-you-say-click-the-button-or-click-on-the-button"&gt;stackoverflow.com&lt;/a&gt;&lt;/div&gt;
    &lt;p&gt;- "Click on" 的 "on" 絕對是多餘的，不要用。
&lt;br /&gt;- "the ... button" 其實也很多餘。
&lt;br /&gt;- 對一般使者為對象時，"to ..." 也可以不用寫。
&lt;br /&gt;- 結論：例如 "Click Cancel." 這樣寫就好，然後按鈕名稱 "Cancel" 要粗體。&lt;/p&gt;&lt;/div&gt;
	
&lt;/p&gt;

&lt;p&gt;&lt;a href="http://domon.posterous.com/do-you-say-click-the-button-or-click-on-the-b"&gt;Permalink&lt;/a&gt; 

	| &lt;a href="http://domon.posterous.com/do-you-say-click-the-button-or-click-on-the-b#comment"&gt;Leave a comment&amp;nbsp;&amp;nbsp;&amp;raquo;&lt;/a&gt;

&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/LJMdFobNb1i0vO2JwMHKgP_KLFo/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/LJMdFobNb1i0vO2JwMHKgP_KLFo/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/LJMdFobNb1i0vO2JwMHKgP_KLFo/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/LJMdFobNb1i0vO2JwMHKgP_KLFo/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/domon-posterous/~4/AhkZadYOulw" height="1" width="1"/&gt;</description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/102428/Domon.JPG</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/jXCw9O0zRL</posterous:profileUrl>
        <posterous:firstName>Domon</posterous:firstName>
        <posterous:lastName />
        <posterous:nickName>Domon</posterous:nickName>
        <posterous:displayName>Domon</posterous:displayName>
      </posterous:author>
    <feedburner:origLink>http://domon.posterous.com/do-you-say-click-the-button-or-click-on-the-b</feedburner:origLink></item>
    <item>
      <pubDate>Fri, 28 Aug 2009 06:58:56 -0700</pubDate>
      <title>Ruby Programming/Syntax/Operators - Wikibooks, collection of open-content textbooks</title>
      <link>http://feedproxy.google.com/~r/domon-posterous/~3/fLv877ByFnY/ruby-programmingsyntaxoperators-wikibooks-col</link>
      <guid isPermaLink="false">http://domon.posterous.com/ruby-programmingsyntaxoperators-wikibooks-col</guid>
      <description>&lt;p&gt;
	&lt;div class="posterous_bookmarklet_entry"&gt;
      &lt;blockquote class="posterous_long_quote"&gt;&lt;p&gt;&lt;b&gt;Conditional assignment&lt;/b&gt;&lt;/p&gt;
&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;x = find_something() #=&amp;gt;nil
 x ||= &amp;quot;default&amp;quot;      #=&amp;gt;&amp;quot;default&amp;quot; : value of x will be replaced with &amp;quot;default&amp;quot;, but only if x is nil or false
 x ||= &amp;quot;other&amp;quot;        #=&amp;gt;&amp;quot;default&amp;quot; : value of x is not replaced if it already is other than nil or false&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Operator ||= is a shorthand form of the expression:&lt;/p&gt;
&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;x = x || &amp;quot;default&amp;quot;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Operator ||= can be shorthand for code like:&lt;/p&gt;
&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;x = &amp;quot;(some fallback value)&amp;quot; if x.nil?&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/blockquote&gt;

&lt;div class="posterous_quote_citation"&gt;via &lt;a href="http://en.wikibooks.org/wiki/Ruby_Programming/Syntax/Operators"&gt;en.wikibooks.org&lt;/a&gt;&lt;/div&gt;
    &lt;p&gt;x = ... if x.nil?
&lt;/p&gt;&lt;p&gt;可以簡單寫成：
&lt;/p&gt;&lt;p&gt;x ||= ...&lt;/p&gt;&lt;/div&gt;
	
&lt;/p&gt;

&lt;p&gt;&lt;a href="http://domon.posterous.com/ruby-programmingsyntaxoperators-wikibooks-col"&gt;Permalink&lt;/a&gt; 

	| &lt;a href="http://domon.posterous.com/ruby-programmingsyntaxoperators-wikibooks-col#comment"&gt;Leave a comment&amp;nbsp;&amp;nbsp;&amp;raquo;&lt;/a&gt;

&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/OaLABvaLv9SZ4IHL7looRPzR5os/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/OaLABvaLv9SZ4IHL7looRPzR5os/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/OaLABvaLv9SZ4IHL7looRPzR5os/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/OaLABvaLv9SZ4IHL7looRPzR5os/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/domon-posterous/~4/fLv877ByFnY" height="1" width="1"/&gt;</description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/102428/Domon.JPG</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/jXCw9O0zRL</posterous:profileUrl>
        <posterous:firstName>Domon</posterous:firstName>
        <posterous:lastName />
        <posterous:nickName>Domon</posterous:nickName>
        <posterous:displayName>Domon</posterous:displayName>
      </posterous:author>
    <feedburner:origLink>http://domon.posterous.com/ruby-programmingsyntaxoperators-wikibooks-col</feedburner:origLink></item>
    <item>
      <pubDate>Mon, 24 Aug 2009 09:13:00 -0700</pubDate>
      <title>Joseph Smarr: "High-performance JavaScript: Why Everything You've Been on Yahoo! Video</title>
      <link>http://feedproxy.google.com/~r/domon-posterous/~3/B6bwP47Sj0s/joseph-smarr-high-performance-javascript-why</link>
      <guid isPermaLink="false">http://domon.posterous.com/joseph-smarr-high-performance-javascript-why</guid>
      <description>&lt;p&gt;
	&lt;div class="posterous_bookmarklet_entry"&gt;&lt;embed src="http://d.yimg.com/ht/yep/YV_YEP.swf" type="application/x-shockwave-flash" height="310" flashvars="event_function=YAHOO.yv.Player.SWFInterface&amp;amp;forceProxy=1&amp;amp;id=3881103&amp;amp;vid=1041101&amp;amp;autoPlay=0&amp;amp;onsite=1&amp;amp;site=video.yahoo.com&amp;amp;page=792730258&amp;amp;lang=en-US&amp;amp;intl=us&amp;amp;thumbUrl=http://l.yimg.com/a/i/us/sch/cn/v/v2/w1005/1041101_100_70.jpeg?x=158&amp;amp;y=111&amp;amp;sig=.7GNZXv8LnB.mF6jjzNl7A--" width="500"&gt;&lt;/embed&gt;
&lt;div class="posterous_quote_citation"&gt;via &lt;a href="http://video.yahoo.com/watch/1041101"&gt;video.yahoo.com&lt;/a&gt;&lt;/div&gt;
&lt;p&gt;- 網頁速度很重要。 &lt;br /&gt;- js 越多行，下載、執行時間越久。 &lt;br /&gt;- js lib 只用需要的部份。 &lt;br /&gt;- js 在需要的時候再 load，UI 用到時再 draw。 &lt;br /&gt;- js 放網頁最後，讓使用者先看到網頁。 &lt;br /&gt;- UI 一步步 load，看起來就不覺得慢。 &lt;br /&gt;- 使用者動作先處理，設 setTimeout(0) 晚點繼續。 &lt;br /&gt;- server 端在一定範圍內做 cache，如 address book 往上轉馬上讀到。 &lt;br /&gt;- 別做 DOM manipulation，用 innerHTML 和 array.join("")。 &lt;br /&gt;- 避免 dynamic CSS-class 和 CSS math。 &lt;br /&gt;- 避免 memory allocation，如 string-splitting。&lt;/p&gt;
&lt;p&gt;p.s. 那影片是兩年前的東西，從&lt;a href="http://andrew.hedges.name/experiments/innerhtml/" title="Speed test: innerHTML versus DOM manipulation" target="_blank"&gt;這裡&lt;/a&gt;和&lt;a href="http://www.quirksmode.org/dom/innerhtml.html" title="Benchmark - W3C DOM vs. innerHTML" target="_blank"&gt;這裡&lt;/a&gt;的實際測試看來，現在 DOM 比 innerHTML 快？&lt;/p&gt;
&lt;/div&gt;
	
&lt;/p&gt;

&lt;p&gt;&lt;a href="http://domon.posterous.com/joseph-smarr-high-performance-javascript-why"&gt;Permalink&lt;/a&gt; 

	| &lt;a href="http://domon.posterous.com/joseph-smarr-high-performance-javascript-why#comment"&gt;Leave a comment&amp;nbsp;&amp;nbsp;&amp;raquo;&lt;/a&gt;

&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/_in7SLegd6y2UUNpXK8Ybyr-hb4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/_in7SLegd6y2UUNpXK8Ybyr-hb4/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/_in7SLegd6y2UUNpXK8Ybyr-hb4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/_in7SLegd6y2UUNpXK8Ybyr-hb4/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/domon-posterous/~4/B6bwP47Sj0s" height="1" width="1"/&gt;</description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/102428/Domon.JPG</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/jXCw9O0zRL</posterous:profileUrl>
        <posterous:firstName>Domon</posterous:firstName>
        <posterous:lastName />
        <posterous:nickName>Domon</posterous:nickName>
        <posterous:displayName>Domon</posterous:displayName>
      </posterous:author>
    <feedburner:origLink>http://domon.posterous.com/joseph-smarr-high-performance-javascript-why</feedburner:origLink></item>
    <item>
      <pubDate>Thu, 20 Aug 2009 02:26:00 -0700</pubDate>
      <title>Testing if an array is empty - PHP  answers</title>
      <link>http://feedproxy.google.com/~r/domon-posterous/~3/hwx8-VIQ7ZI/testing-if-an-array-is-empty-php-answers</link>
      <guid isPermaLink="false">http://domon.posterous.com/testing-if-an-array-is-empty-php-answers</guid>
      <description>&lt;p&gt;
	&lt;div class="posterous_bookmarklet_entry"&gt;
&lt;blockquote class="posterous_long_quote"&gt;if(array_filter($ary))&lt;br /&gt; $ary contains at least one non-empty element&lt;br /&gt; else&lt;br /&gt; $ary contains 0 elements or all elements are empty&lt;/blockquote&gt;
&lt;div class="posterous_quote_citation"&gt;via &lt;a href="http://bytes.com/topic/php/answers/692118-testing-if-array-empty"&gt;bytes.com&lt;/a&gt;&lt;/div&gt;
&lt;p&gt;empty() 能判斷不含任何 key 或 value 的空 array。&lt;/p&gt;
&lt;p&gt;如果要做「不管有沒有 key，全部 value 都是空的」這樣的判斷，可以利用 array_filter( $input [, $callback] )。 &lt;br /&gt;$input 是要被 filter 的 array，$callback 是要把 value 送去處理的 function 名稱，array_filter() 會把 callback function 回傳 false 的 element 移除，傳回 filter 後的 array。&lt;/p&gt;
&lt;p&gt;不設 callback function 時，它會把 array 的 value 轉換成 bool，空字串轉成 bool 後是 false。 &lt;br /&gt;所以，如果 array 所有的 value 都是空的，便會得到一個空 array，亦即範例中的 else 部份（if 亦是將變數轉為 bool 判斷）。&lt;/p&gt;
&lt;/div&gt;
	
&lt;/p&gt;

&lt;p&gt;&lt;a href="http://domon.posterous.com/testing-if-an-array-is-empty-php-answers"&gt;Permalink&lt;/a&gt; 

	| &lt;a href="http://domon.posterous.com/testing-if-an-array-is-empty-php-answers#comment"&gt;Leave a comment&amp;nbsp;&amp;nbsp;&amp;raquo;&lt;/a&gt;

&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/ag1sq9yG6PX_534S0-zEPuMzvjo/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ag1sq9yG6PX_534S0-zEPuMzvjo/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/ag1sq9yG6PX_534S0-zEPuMzvjo/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ag1sq9yG6PX_534S0-zEPuMzvjo/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/domon-posterous/~4/hwx8-VIQ7ZI" height="1" width="1"/&gt;</description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/102428/Domon.JPG</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/jXCw9O0zRL</posterous:profileUrl>
        <posterous:firstName>Domon</posterous:firstName>
        <posterous:lastName />
        <posterous:nickName>Domon</posterous:nickName>
        <posterous:displayName>Domon</posterous:displayName>
      </posterous:author>
    <feedburner:origLink>http://domon.posterous.com/testing-if-an-array-is-empty-php-answers</feedburner:origLink></item>
    <item>
      <pubDate>Thu, 06 Aug 2009 09:32:57 -0700</pubDate>
      <title>Ruby 程式語言簡介</title>
      <link>http://feedproxy.google.com/~r/domon-posterous/~3/sCsPZ5sAY6k/ruby-126</link>
      <guid isPermaLink="false">http://domon.posterous.com/ruby-126</guid>
      <description>&lt;p&gt;
	&lt;div class="posterous_bookmarklet_entry"&gt;
      &lt;embed name="player" src="http://static.slidesharecdn.com/swf/player.swf" allowfullscreen="true" allowscriptaccess="always" type="application/x-shockwave-flash" height="406" flashvars="sessid=BAhDOh9BY3RpdmVTdXBwb3J0OjpPcmRlcmVkSGFzaFsNWwciCmZsYXNoSUM6%250AJ0FjdGlvbkNvbnRyb2xsZXI6OkZsYXNoOjpGbGFzaEhhc2h7AAY6CkB1c2Vk%250AewBbBzoNbGFuZ3VhZ2UiByoqWwc6CXRlc3QwWwc6CXVzZXJ7BiIJdXNlcmkE%250AWTVTAVsHOgtub3RpY2UwWwc6CmluYm94aQBbBzoMY29udGFjdCIlYzA1OGY1%250ANDRjNzM3NzgyZGVhY2VmYTUzMmQ5YWRkNGNbBzoSbm90aWZpY19jb3VudGkG--a1d157bb6e6e137ba6e91c65315c4d22ededce78&amp;amp;pvt=0&amp;amp;doc=ruby-introduction-090417050753-phpapp01&amp;amp;version_no=1240129582&amp;amp;presentationId=1304833&amp;amp;totalSlides=58&amp;amp;startSlide=1&amp;amp;inContest=0&amp;amp;preview=no&amp;amp;stitle=ruby-1304833&amp;amp;userName=ihower&amp;amp;has_form=null&amp;amp;form_after_slide_number=null&amp;amp;form_is_blocking=false&amp;amp;hostedIn=slideshare&amp;amp;useHttp=1" quality="high" width="500" style="" /&gt;

&lt;div class="posterous_quote_citation"&gt;via &lt;a href="http://www.slideshare.net/ihower/ruby-1304833"&gt;slideshare.net&lt;/a&gt;&lt;/div&gt;
    &lt;p&gt;- 只有 false 和 nil 是假，其他為真（0 也是真、空字串也是真）。
&lt;br /&gt;- 方便的 iterators：map（修改各元素）、find_all、delete_if、sort!、inject（跑過各元素取得一統計值，如總和）等。
&lt;br /&gt;- 在 function 定義中使用 yield 敘述，傳 code block 給 function，該 code block 將在 yield 的位置執行 。
&lt;br /&gt;- 可將 code block 設為一個 Proc 物件。
&lt;br /&gt;- module 裡可以放 method 和 constant，而 class 可以 include module（此動作稱為 mixin），解決多重繼承的問題。
&lt;br /&gt;- duck typing：不需 inheritance 即可達到 polymorphism。即使 class 內容不完全相，method 同名即可。
&lt;br /&gt;- meta programming（用程式寫程式）：define_method（動態定義 method）、method_missing（程式指定的 method 未定義時就執行它）
&lt;br /&gt;- rails clone：PHP on TRAX、CakePHP、TurboGears（Python）、Catalyst（Perl）、Grails（Groovy）等。
&lt;br /&gt;- Active Record：定義、存取 DB 等皆可由 object method 操作。&lt;/p&gt;&lt;/div&gt;
	
&lt;/p&gt;

&lt;p&gt;&lt;a href="http://domon.posterous.com/ruby-126"&gt;Permalink&lt;/a&gt; 

	| &lt;a href="http://domon.posterous.com/ruby-126#comment"&gt;Leave a comment&amp;nbsp;&amp;nbsp;&amp;raquo;&lt;/a&gt;

&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/PZBDFwPY73378Us-RMwtHtOHiGs/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/PZBDFwPY73378Us-RMwtHtOHiGs/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/PZBDFwPY73378Us-RMwtHtOHiGs/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/PZBDFwPY73378Us-RMwtHtOHiGs/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/domon-posterous/~4/sCsPZ5sAY6k" height="1" width="1"/&gt;</description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/102428/Domon.JPG</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/jXCw9O0zRL</posterous:profileUrl>
        <posterous:firstName>Domon</posterous:firstName>
        <posterous:lastName />
        <posterous:nickName>Domon</posterous:nickName>
        <posterous:displayName>Domon</posterous:displayName>
      </posterous:author>
    <feedburner:origLink>http://domon.posterous.com/ruby-126</feedburner:origLink></item>
    <item>
      <pubDate>Fri, 17 Jul 2009 20:50:00 -0700</pubDate>
      <title>Random Numbers in Ruby</title>
      <link>http://feedproxy.google.com/~r/domon-posterous/~3/a-f9KQaiQkw/5more-about-methods</link>
      <guid isPermaLink="false">http://domon.posterous.com/5more-about-methods</guid>
      <description>&lt;p&gt;
	&lt;div class="posterous_bookmarklet_entry"&gt;
&lt;blockquote class="posterous_long_quote"&gt;
&lt;h2&gt;&lt;span style="font-size: 13px; font-weight: normal;"&gt;Ruby comes with a pretty nice random number generator.  The method to get       a randomly chosen number is &lt;span class="L2Pcode"&gt;rand&lt;/span&gt;.  If you call &lt;span class="L2Pcode"&gt;rand&lt;/span&gt; just like       that, you'll get a float greater than or equal to &lt;span class="L2Pcode"&gt;&lt;span class="L2Pnumber"&gt;0.0&lt;/span&gt;&lt;/span&gt; and less       than &lt;span class="L2Pcode"&gt;&lt;span class="L2Pnumber"&gt;1.0&lt;/span&gt;&lt;/span&gt;.  If you give &lt;span class="L2Pcode"&gt;rand&lt;/span&gt; an integer (&lt;span class="L2Pcode"&gt;&lt;span class="L2Pnumber"&gt;5&lt;/span&gt;&lt;/span&gt; for example), it will give you an integer greater than or equal to       &lt;span class="L2Pcode"&gt;&lt;span class="L2Pnumber"&gt;0&lt;/span&gt;&lt;/span&gt; and less than &lt;span class="L2Pcode"&gt;&lt;span class="L2Pnumber"&gt;5&lt;/span&gt;&lt;/span&gt; (so five possible numbers,       from &lt;span class="L2Pcode"&gt;&lt;span class="L2Pnumber"&gt;0&lt;/span&gt;&lt;/span&gt; to &lt;span class="L2Pcode"&gt;&lt;span class="L2Pnumber"&gt;4&lt;/span&gt;&lt;/span&gt;).&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;Let's see &lt;span class="L2Pcode"&gt;rand&lt;/span&gt; in action.&lt;/p&gt;
&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;puts rand
puts rand
puts rand
puts(rand(100))
puts(rand(100))
puts(rand(100))
puts(rand(1))
puts(rand(1))
puts(rand(1))
puts(rand(99999999999999999999999999999999999999999999999999999999999))
puts('The weatherman said there is a '+rand(101).to_s+'% chance of rain,')
puts('but you can never trust a weatherman.')&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;div class="CodeRay"&gt;
  &lt;div class="code"&gt;&lt;pre&gt;0.866769322351658
0.155609260113273
0.208355946789083
61
46
92
0
0
0
22982477508131860231954108773887523861600693989518495699862
The weatherman said there is a 47% chance of rain,
but you can never trust a weatherman.&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Note that I used &lt;span class="L2Pcode"&gt;rand(&lt;span class="L2Pnumber"&gt;101&lt;/span&gt;)&lt;/span&gt; to get back numbers from &lt;span class="L2Pcode"&gt;&lt;span class="L2Pnumber"&gt;0&lt;/span&gt;&lt;/span&gt; to &lt;span class="L2Pcode"&gt;&lt;span class="L2Pnumber"&gt;100&lt;/span&gt;&lt;/span&gt;, and that &lt;span class="L2Pcode"&gt;rand(&lt;span class="L2Pnumber"&gt;1&lt;/span&gt;)&lt;/span&gt; always       gives back &lt;span class="L2Pcode"&gt;&lt;span class="L2Pnumber"&gt;0&lt;/span&gt;&lt;/span&gt;.  Not understanding the range of possible return       values is the biggest mistake I see people make with &lt;span class="L2Pcode"&gt;rand&lt;/span&gt;; even professional       programmers; even in finished products you can buy at the store.  I even       had a CD player once which, if set on "Random Play," would play every song but       the last one...  (I wonder what would have happened if I had put in a CD with       only one song on it?)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;div class="posterous_quote_citation"&gt;via &lt;a href="http://pine.fm/LearnToProgram/?Chapter=05"&gt;pine.fm&lt;/a&gt;&lt;/div&gt;
&lt;p&gt;如果 n 是 int，rand(n) 會跑出的亂數是 0 ~ (n-1)。 &lt;br /&gt;所以，想要 0 ~ 100，就要用 rand(101)。&lt;/p&gt;
&lt;p&gt;C++ 如果用 rand() %100，也是產生 0 ~ 99； &lt;br /&gt;php 則是 rand(min, max)，直接指定最大、最小值。&lt;/p&gt;
&lt;/div&gt;
	
&lt;/p&gt;

&lt;p&gt;&lt;a href="http://domon.posterous.com/5more-about-methods"&gt;Permalink&lt;/a&gt; 

	| &lt;a href="http://domon.posterous.com/5more-about-methods#comment"&gt;Leave a comment&amp;nbsp;&amp;nbsp;&amp;raquo;&lt;/a&gt;

&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/1zflAGiPNonlpCNKCJf8-G3D6Ig/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/1zflAGiPNonlpCNKCJf8-G3D6Ig/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/1zflAGiPNonlpCNKCJf8-G3D6Ig/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/1zflAGiPNonlpCNKCJf8-G3D6Ig/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/domon-posterous/~4/a-f9KQaiQkw" height="1" width="1"/&gt;</description>
      <posterous:author>
        <posterous:userImage>http://files.posterous.com/user_profile_pics/102428/Domon.JPG</posterous:userImage>
        <posterous:profileUrl>http://posterous.com/users/jXCw9O0zRL</posterous:profileUrl>
        <posterous:firstName>Domon</posterous:firstName>
        <posterous:lastName />
        <posterous:nickName>Domon</posterous:nickName>
        <posterous:displayName>Domon</posterous:displayName>
      </posterous:author>
    <feedburner:origLink>http://domon.posterous.com/5more-about-methods</feedburner:origLink></item>
  </channel>
</rss>

