<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/rss2full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/itemcontent.css" type="text/css" media="screen"?><!-- generator="wordpress/2.3.3" --><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">

<channel>
	<title>Handlino</title>
	<link>http://handlino.com</link>
	<description>Same but different, less is more</description>
	<pubDate>Wed, 05 Nov 2008 14:31:02 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.3</generator>
	<language>en</language>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/handlino" type="application/rss+xml" /><item>
		<title>About Handlino</title>
		<link>http://handlino.com/blog/2008/11/05/85/</link>
		<comments>http://handlino.com/blog/2008/11/05/85/#comments</comments>
		<pubDate>Wed, 05 Nov 2008 09:15:14 +0000</pubDate>
		<dc:creator>hlb</dc:creator>
		
		<category><![CDATA[Announcement]]></category>

		<guid isPermaLink="false">http://handlino.com/blog/2008/11/05/85/</guid>
		<description><![CDATA[If you want to know more about us, we have just published a slide on slideshare.
]]></description>
			<content:encoded><![CDATA[<p>If you want to know more about us, we have just published a slide on slideshare.</p>

<p><a href="http://handlino.com/blog/2008/11/05/85/#more-85" class="more-link">(more&#8230;)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://handlino.com/blog/2008/11/05/85/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Yahoo! Open Hackday 2008 in Taiwan.</title>
		<link>http://handlino.com/blog/2008/09/22/82/</link>
		<comments>http://handlino.com/blog/2008/09/22/82/#comments</comments>
		<pubDate>Mon, 22 Sep 2008 08:46:10 +0000</pubDate>
		<dc:creator>gugod</dc:creator>
		
		<category><![CDATA[Announcement]]></category>

		<category><![CDATA[twopenhack08]]></category>

		<guid isPermaLink="false">http://handlino.com/blog/2008/09/22/82/</guid>
		<description><![CDATA[We are very excited to announce that we&#8217;ve won the second prize in this event. Grateful thanks to the judges who likes our idea for having a fun product, RandomLife, it is a pleasure and honored to be in this event.



Handlino and David Flio, the co-founder of Yahoo!


RandomLife is a bingo machine generator. Whenever you [...]]]></description>
			<content:encoded><![CDATA[<p>We are very excited to announce that we&#8217;ve won the second prize in this event. Grateful thanks to the judges who likes our idea for having a fun product, <a href="http://bingo.handlino.com/">RandomLife</a>, it is a pleasure and honored to be in this event.</p>

<div style="text-align: center; border: 1px solid #555; padding: 5px 0; background: #fff;">
<a href="http://www.flickr.com/photos/gugod/2878172174/" title="Handlino and David Filo by gugod, on Flickr"><img src="http://farm4.static.flickr.com/3005/2878172174_3f315c87be.jpg" width="400" height="300" alt="Handlino and David Filo" /></a>
<p style="font-style: italic;">Handlino and David Flio, the co-founder of Yahoo!</p>
</div>

<p>RandomLife is a bingo machine generator. Whenever you find yourself failed to decide among many options, you can use this machine to randomly choose one. Or you can play bingo created by other users. It can help you decide your dinning plan, next movie to see, what to do in the weekend besides hacking, or anything else. It is now available online at <a href="http://bingo.handlino.com">bingo.handlino.com</a>, let&#8217;s have fun together!.</p>

<p><a href="http://handlino.com/blog/2008/09/22/82/#more-82" class="more-link">(more&#8230;)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://handlino.com/blog/2008/09/22/82/feed/</wfw:commentRss>
		</item>
		<item>
		<title>簡單地將訊息做成 QRCode 吧</title>
		<link>http://handlino.com/blog/2008/09/17/81/</link>
		<comments>http://handlino.com/blog/2008/09/17/81/#comments</comments>
		<pubDate>Tue, 16 Sep 2008 17:00:28 +0000</pubDate>
		<dc:creator>gugod</dc:creator>
		
		<category><![CDATA[Opmsg]]></category>

		<category><![CDATA[japanese]]></category>

		<category><![CDATA[marquee]]></category>

		<category><![CDATA[qrcode]]></category>

		<guid isPermaLink="false">http://handlino.com/blog/2008/09/17/81/</guid>
		<description><![CDATA[過了一個中秋颱風假期， opmsg 就多了些有趣的更新。

1. 全文訊息 QRCode

先來個有圖有真相：



那麼，要如何產生呢？
]]></description>
			<content:encoded><![CDATA[<p>過了一個中秋颱風假期， opmsg 就多了些有趣的更新。</p>

<p><strong>1. 全文訊息 QRCode</strong></p>

<p>先來個有圖有真相：</p>

<p><a href="http://www.flickr.com/photos/gugod/2862386779/" title="opmsg-qrcode by gugod, on Flickr"><img src="http://farm4.static.flickr.com/3113/2862386779_7bff548f74.jpg" width="400" height="167" alt="opmsg-qrcode" /></a></p>

<p>那麼，要如何產生呢？</p>

<p><a href="http://handlino.com/blog/2008/09/17/81/#more-81" class="more-link">(more&#8230;)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://handlino.com/blog/2008/09/17/81/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Testing your Jifty apps with fixtures</title>
		<link>http://handlino.com/blog/2008/09/12/80/</link>
		<comments>http://handlino.com/blog/2008/09/12/80/#comments</comments>
		<pubDate>Fri, 12 Sep 2008 04:05:34 +0000</pubDate>
		<dc:creator>gugod</dc:creator>
		
		<category><![CDATA[Jifty]]></category>

		<category><![CDATA[Opmsg]]></category>

		<category><![CDATA[Perl]]></category>

		<category><![CDATA[jifty]]></category>

		<category><![CDATA[test]]></category>

		<guid isPermaLink="false">http://handlino.com/blog/2008/09/12/80/</guid>
		<description><![CDATA[Testing in web applications always require developers to setup the required records in database to a certain state. One way to do this in Jifty is to maintain a SQLite file as the data set to test with. However this is not good enough since it&#8217;s not easily maintainable. If there is a new migration, [...]]]></description>
			<content:encoded><![CDATA[<p>Testing in web applications always require developers to setup the required records in database to a certain state. One way to do this in Jifty is to maintain a SQLite file as the data set to test with. However this is not good enough since it&#8217;s not easily maintainable. If there is a new migration, developers also need to update the SQLite data, which could be a pain in the neck. Other solutions will involve pre-populating the data with Perl, and here&#8217;s a very quick sexy way to do it.</p>

<p>In <a href="http://opmsg.com/">Opmsg</a>, we have a <tt>Opmsg::Test::Fixtures</tt> that let you do this in your test files:</p>

<pre><code>
use Opmsg::Test::Fixtures qw(users messages);
</code></pre>

<p>The Perl code of Fixtures module looks like this:</p>

<pre><code>
package Opmsg::Test::Fixtures;
use strict;
use warnings;
use utf8;
use encoding 'utf8';
use JiftyX::ModelHelpers;

sub import {
    my ($class, @fixtures) = @_;
    for(@fixtures) {
        if ($class->can($_)) {
            $class->$_();
        } 
    }
}

sub users {
    User->create(name => "user1", openid => "http://user1.example.org");
    User->create(name => "user2", openid => "http://user2.example.org");
    User->create(name => "user3", openid => "http://user3.example.org");
}

sub messages {
    my $u1 = Jifty->app_class("CurrentUser")->new;
    $u1->user_object( User(name => "user1") );
    
    my $m = Message->new(current_user => $u1);
    $m->create(content => "Test Content A");
    $m->create(content => "Test Content B");
    $m->create(content => "測試中文");
} 

1;
</code></pre>

<p>Played a little bit <code>import</code> magic here to take arguments from <code>use</code> statement, but not too much.</p>

<p>Using the recently released <a href="http://search.cpan.org/dist/JiftyX-ModelHelpers/">JiftyX::ModelHelpers</a> module, you&#8217;ll find it very readable to write these fixtures. You should be able to easily understand that it&#8217;s creating 3 users and 3 messages that belongs to &#8220;user1&#8243;, even without too much Jifty-fu in your body.</p>

<p>So this is one good way to test your Jifty apps with fixtures.</p>
]]></content:encoded>
			<wfw:commentRss>http://handlino.com/blog/2008/09/12/80/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Opmsg 新視覺</title>
		<link>http://handlino.com/blog/2008/08/25/79/</link>
		<comments>http://handlino.com/blog/2008/08/25/79/#comments</comments>
		<pubDate>Mon, 25 Aug 2008 09:20:54 +0000</pubDate>
		<dc:creator>gugod</dc:creator>
		
		<category><![CDATA[Announcement]]></category>

		<category><![CDATA[Jifty]]></category>

		<category><![CDATA[Opmsg]]></category>

		<category><![CDATA[Perl]]></category>

		<category><![CDATA[chatlino]]></category>

		<category><![CDATA[message]]></category>

		<category><![CDATA[microblogging]]></category>

		<category><![CDATA[text]]></category>

		<guid isPermaLink="false">http://handlino.com/blog/2008/08/25/79/</guid>
		<description><![CDATA[



就在 COSCUP 2008 結束的當天，新的 Opmsg 面貌稍稍地上線了。

Opmsg 是今年筆者(gugod) 於有點閒時間時寫的 OpenID 版的 Twitter，全名也叫做「open message」，主要的目標是想做出開放性的萬用訊息流通平台。目前慢慢地在參考 Jaiku、Plurk、Ident.ca 等其他同性質的網站，整理出一套「和而不同」的風格。

此次最主要的更新是視覺設計，十分感謝 underfire++ 與 hlb++ 的大力協助，雖然是很困難的三欄式格局、雖然是有那麼多的圓角框，但整個 HTML 語意仍然十分簡單，足見此二人 CSS 能力之深之巧是也。有興趣了解的讀者不妨參考一下前篇文章： CSS技巧 欄位自動互相適應高度

這個網站也因此正式成為和多的服務網站之一，目前功能陽春，完全免費。日後也會不斷地加上新的服務項目，比如手機簡訊通知、站台機器人等等。筆者也正在考慮要參考 identi.ca 將其站台的源碼做為開放源碼的專案來開發。有興趣的讀者，敬請不吝指教，回覆本篇部落格文章、或是利用 opmsg.com 頁面左欄的意見回覆表格都可以。

除了視覺設計，還計有以下小更新：


增加中、英文語系切換
頻道 Badge 程式碼更新
頻道 RSS 路徑更新
使用者可以離開先前加入的頻道  
使用者 nickname 與他人重覆時的 URL 修正
增加使用者頁面： 如 http://opmsg.com/user/gugod


除了 Opmsg 之外，和多尚有一關於文字的產品：Chatlino，這是個既時文字聊天室，目前有個產示站台：Chatlino Demo（需以 OpenID 或註冊的帳號登入）。若有興趣在自家企業中架設即時或非即時文字聊天的讀者，歡迎 與我們聯絡，讓我們替您服務。
]]></description>
			<content:encoded><![CDATA[<div style="float:right;width:110px;height:114px;">
<img src="http://opmsg-cdn.handlino.com/static/images/icon-rss-big.png" alt="RSS Reading Man" />
</div>

<p>就在 <a href="http://coscup.org">COSCUP 2008</a> 結束的當天，新的 <a href="http://opmsg.com">Opmsg</a> 面貌稍稍地上線了。</p>

<p>Opmsg 是今年筆者(gugod) 於有點閒時間時寫的 OpenID 版的 Twitter，全名也叫做「open message」，主要的目標是想做出開放性的萬用訊息流通平台。目前慢慢地在參考 Jaiku、Plurk、Ident.ca 等其他同性質的網站，整理出一套「和而不同」的風格。</p>

<p>此次最主要的更新是視覺設計，十分感謝 <a href="http://www.i-design.tw/">underfire++</a> 與 <a href="http://hlb.yichi.org/">hlb++</a> 的大力協助，雖然是很困難的三欄式格局、雖然是有那麼多的圓角框，但整個 HTML 語意仍然十分簡單，足見此二人 CSS 能力之深之巧是也。有興趣了解的讀者不妨參考一下前篇文章： <a href="http://handlino.com/blog/2008/08/21/78/">CSS技巧 欄位自動互相適應高度</a></p>

<p>這個網站也因此正式成為和多的服務網站之一，目前功能陽春，完全免費。日後也會不斷地加上新的服務項目，比如手機簡訊通知、站台機器人等等。筆者也正在考慮要參考 <a href="http://identi.ca">identi.ca</a> 將其站台的源碼做為開放源碼的專案來開發。有興趣的讀者，敬請不吝指教，回覆本篇部落格文章、或是利用 <a href="http://opmsg.com">opmsg.com</a> 頁面左欄的意見回覆表格都可以。</p>

<p>除了視覺設計，還計有以下小更新：</p>

<ul>
<li>增加中、英文語系切換</li>
<li>頻道 Badge 程式碼更新</li>
<li>頻道 RSS 路徑更新</li>
<li>使用者可以離開先前加入的頻道  </li>
<li>使用者 nickname 與他人重覆時的 URL 修正</li>
<li>增加使用者頁面： 如 <a href="http://opmsg.com/user/gugod">http://opmsg.com/user/gugod</a></li>
</ul>

<p>除了 Opmsg 之外，和多尚有一關於文字的產品：Chatlino，這是個既時文字聊天室，目前有個產示站台：<a href="http://chat.handlino.com/">Chatlino Demo</a>（需以 OpenID 或註冊的帳號登入）。若有興趣在自家企業中架設即時或非即時文字聊天的讀者，歡迎 <a href="http://handlino.com/contact/">與我們聯絡</a>，讓我們替您服務。</p>
]]></content:encoded>
			<wfw:commentRss>http://handlino.com/blog/2008/08/25/79/feed/</wfw:commentRss>
		</item>
		<item>
		<title>CSS技巧 欄位自動互相適應高度</title>
		<link>http://handlino.com/blog/2008/08/21/78/</link>
		<comments>http://handlino.com/blog/2008/08/21/78/#comments</comments>
		<pubDate>Thu, 21 Aug 2008 11:12:45 +0000</pubDate>
		<dc:creator>underfire</dc:creator>
		
		<category><![CDATA[Web Standard]]></category>

		<category><![CDATA[css]]></category>

		<guid isPermaLink="false">http://handlino.com/blog/2008/08/21/78/</guid>
		<description><![CDATA[網頁設計版面中的欄位當有運用到背景圖時，為了整體視覺效果，常會遇到需要能夠互相適應高度（視覺上）的問題，而這對於 CSS 的確是個麻煩，當然這可以利用 JavaScript 去處理，但若不想靠程式時，只好利用一些小技巧去達到這個目的。

不同的需求通常有不同的解決方案，在這筆者以最近設計的 Opmsg 為例子（參考畫面），在這三欄的設計中，需求是中間欄位能夠自動適應左欄的高度，當中間欄位內容高度少於左欄時，其背景仍能高於左欄（參考畫面）。

首先把中、左兩欄合併定義成為一個欄位取名 #column-1 並 &#8220;float: left&#8221;，最右欄取名 #column-2 並 &#8220;float: right&#8221;，右欄由於打算讓它完全依內容決定高度，因此接下來依一般方式處理即可。

回過頭來，剛剛的 #column-1 先放置中間欄位的背景圖上半部，並將圖片靠上靠右，#column-1 底下再放置一個 div 取名 #bd，然後將中間欄位下半部的背景圖切大張（高度）一點，放置在 #column-1 #bd 靠下靠右，這時中間欄位雖然還沒切，但背景已經出來。

#column-1 #bd 底下再切出兩個欄位分別為 #left（float: left） 與 #right（float: right），而這裡的 #right 其實就等於擁有背景圖的中間欄位了。#left 左欄依前面 #column-1 的方式將背景圖放上基本上就大功告成。

在這個案例中，中間欄位的背景圖片放在最外層，因此在裡頭的左欄可以實際控制著中間欄位在視覺上的最小高度，雖然並非真的讓欄位互相適應高度，但還是可以滿足實際的視覺需求，有點像是在變把戲（trick）XD。

當然 opmsg 的 CSS 實際上要複雜一些，不過基本上就是這個原理。
]]></description>
			<content:encoded><![CDATA[<p>網頁設計版面中的欄位當有運用到背景圖時，為了整體視覺效果，常會遇到需要能夠互相適應高度（視覺上）的問題，而這對於 CSS 的確是個麻煩，當然這可以利用 JavaScript 去處理，但若不想靠程式時，只好利用一些小技巧去達到這個目的。</p>

<p>不同的需求通常有不同的解決方案，在這筆者以最近設計的 <a href="http://opmsg.com/">Opmsg</a> 為例子（<a href="http://www.flickr.com/photos/underfire/2708870081/sizes/l/">參考畫面</a>），在這三欄的設計中，需求是中間欄位能夠自動適應左欄的高度，當中間欄位內容高度少於左欄時，其背景仍能高於左欄（<a href="http://www.flickr.com/photos/underfire/2700151863/sizes/o/">參考畫面</a>）。</p>

<p>首先把中、左兩欄合併定義成為一個欄位取名 <strong>#column-1</strong> 並 <em>&#8220;float: left&#8221;</em>，最右欄取名 <strong>#column-2</strong> 並 <em>&#8220;float: right&#8221;</em>，右欄由於打算讓它完全依內容決定高度，因此接下來依一般方式處理即可。</p>

<p>回過頭來，剛剛的 #column-1 先放置中間欄位的背景圖上半部，並將圖片靠上靠右，<strong>#column-1</strong> 底下再放置一個 div 取名 <strong>#bd</strong>，然後將中間欄位下半部的背景圖切大張（高度）一點，放置在 <strong>#column-1 #bd</strong> 靠下靠右，這時中間欄位雖然還沒切，但背景已經出來。</p>

<p><strong>#column-1 #bd</strong> 底下再切出兩個欄位分別為 <strong>#left</strong>（<em>float: left</em>） 與 <strong>#right</strong>（<em>float: right</em>），而這裡的 <strong>#right</strong> 其實就等於擁有背景圖的中間欄位了。#left 左欄依前面 #column-1 的方式將背景圖放上基本上就大功告成。</p>

<p>在這個案例中，中間欄位的背景圖片放在最外層，因此在裡頭的左欄可以實際控制著中間欄位在視覺上的最小高度，雖然並非真的讓欄位互相適應高度，但還是可以滿足實際的視覺需求，有點像是在變把戲（trick）XD。</p>

<p>當然 opmsg 的 CSS 實際上要複雜一些，不過基本上就是這個原理。</p>
]]></content:encoded>
			<wfw:commentRss>http://handlino.com/blog/2008/08/21/78/feed/</wfw:commentRss>
		</item>
		<item>
		<title>[Rails] attachment_fu 內部拷貝檔案的實作方式</title>
		<link>http://handlino.com/blog/2008/07/25/72/</link>
		<comments>http://handlino.com/blog/2008/07/25/72/#comments</comments>
		<pubDate>Fri, 25 Jul 2008 08:41:16 +0000</pubDate>
		<dc:creator>xdite</dc:creator>
		
		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://handlino.com/blog/2008/07/25/72/</guid>
		<description><![CDATA[As we known, VeryXD 的上傳功能是使用 attchement_fu 這個 plugin 做出來的。

不過筆者當初在實做 VeryXD 時卻遇到了一個難題，官方的範例只講解了如何用 file upload 的方式丟檔案，沒有說如果要玩內部拷貝的話要怎麼作 &#60;囧&#62;，這樣是要怎麼不停的拷貝生圖啊，總不能合成的方式使用自己再丟 HTTP post 這種方式鳥方式塞進去吧。

所以當時花了一兩天在研究到底要怎麼內部扔 &#8230;（從 Photo Model 扔到 Gphoto Model去），幾乎看遍了當時所有 Google 上能找到的所有資料 :(，還好最後是有暴力幹出來，不然就沒有 VeryXD了。

最近在寫 DEMOMO SHOW 用的比賽網站，又用到這招，找了一下還是沒有人提這個 trick，乾脆來貼一下要怎麼做好了。

@photo = Photo.find(1)
@award_photo = AwardPhoto.new
@award_photo.content_type = @photo.content_type
@award_photo.filename = @photo.filename
@award_photo.temp_path = "#{RAILS_ROOT}/public"+@photo.public_filename
@award_photo.save


就這麼簡單，希望對大家有一點幫助。
]]></description>
			<content:encoded><![CDATA[<p>As we known, <a href="http://veryxd.net">VeryXD</a> 的上傳功能是使用 attchement_fu 這個 plugin 做出來的。</p>

<p>不過筆者當初在實做 VeryXD 時卻遇到了一個難題，官方的範例只講解了如何用 file upload 的方式丟檔案，沒有說如果要玩內部拷貝的話要怎麼作 &lt;囧&gt;，這樣是要怎麼不停的拷貝生圖啊，總不能合成的方式使用自己再丟 HTTP post 這種方式鳥方式塞進去吧。</p>

<p>所以當時花了一兩天在研究到底要怎麼內部扔 &#8230;（從 Photo Model 扔到 Gphoto Model去），幾乎看遍了當時所有 Google 上能找到的所有資料 :(，還好最後是有暴力幹出來，不然就沒有 <a href="http://veryxd.net">VeryXD</a>了。</p>

<p>最近在寫 DEMOMO SHOW 用的比賽網站，又用到這招，找了一下還是沒有人提這個 trick，乾脆來貼一下要怎麼做好了。</p>

<pre><code>@photo = Photo.find(1)
@award_photo = AwardPhoto.new
@award_photo.content_type = @photo.content_type
@award_photo.filename = @photo.filename
@award_photo.temp_path = "#{RAILS_ROOT}/public"+@photo.public_filename
@award_photo.save
</code></pre>

<p>就這麼簡單，希望對大家有一點幫助。</p>
]]></content:encoded>
			<wfw:commentRss>http://handlino.com/blog/2008/07/25/72/feed/</wfw:commentRss>
		</item>
		<item>
		<title>[Ruby] CSV to Hash</title>
		<link>http://handlino.com/blog/2008/07/25/71/</link>
		<comments>http://handlino.com/blog/2008/07/25/71/#comments</comments>
		<pubDate>Fri, 25 Jul 2008 08:40:44 +0000</pubDate>
		<dc:creator>xdite</dc:creator>
		
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://handlino.com/blog/2008/07/25/71/</guid>
		<description><![CDATA[這一小段程式是將 CSV 塞成 Hash 的暴力方式 ..。初衷是希望讀入 CSV 的第一行為各 Hash 的 KEY，其餘行為 VALUE。

也就是

name,number,country
alice,1,TAIWAN
bob,2,USA
cindy,3,JAPAN


能被包成
    [ { :name =&#62; &#8220;alice&#8221;, :number =&#62; &#8220;1&#8243;, :country =&#62; &#8220;TAIWAN&#8221; } ,{ :name =&#62; &#8220;bob&#8221;, :number =&#62; &#8220;2&#8243;, :country =&#62; &#8220;USA&#8221; },{ :name =&#62; &#8220;cindy&#8221;, :number =&#62; &#8220;3&#8243;, :country =&#62; &#8220;JAPAN&#8221; } ]

require "csv"

class &#38;lt;&#38;lt; Hash
def create(keys, values)
self[*keys.zip(values).flatten]
end
end

sp_array = [...]]]></description>
			<content:encoded><![CDATA[<p>這一小段程式是將 CSV 塞成 Hash 的暴力方式 ..。初衷是希望讀入 CSV 的第一行為各 Hash 的 KEY，其餘行為 VALUE。</p>

<p>也就是</p>

<pre><code>name,number,country
alice,1,TAIWAN
bob,2,USA
cindy,3,JAPAN
</code></pre>

<p>能被包成
    [ { :name =&gt; &#8220;alice&#8221;, :number =&gt; &#8220;1&#8243;, :country =&gt; &#8220;TAIWAN&#8221; } ,{ :name =&gt; &#8220;bob&#8221;, :number =&gt; &#8220;2&#8243;, :country =&gt; &#8220;USA&#8221; },{ :name =&gt; &#8220;cindy&#8221;, :number =&gt; &#8220;3&#8243;, :country =&gt; &#8220;JAPAN&#8221; } ]</p>

<pre><code>require "csv"

class &amp;lt;&amp;lt; Hash
def create(keys, values)
self[*keys.zip(values).flatten]
end
end

sp_array = Array.new

first = true
first_row = []

CSV.open("XXX.csv","r"){|row|
if first
first = false
first_row = row.to_a
else
result = Hash.create(first_row,row.to_a)
sp_array &amp;lt;&amp;lt; result
end
}
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://handlino.com/blog/2008/07/25/71/feed/</wfw:commentRss>
		</item>
		<item>
		<title>RubyKaigi 2008 筆記</title>
		<link>http://handlino.com/blog/2008/06/23/70/</link>
		<comments>http://handlino.com/blog/2008/06/23/70/#comments</comments>
		<pubDate>Sun, 22 Jun 2008 23:19:47 +0000</pubDate>
		<dc:creator>gugod</dc:creator>
		
		<category><![CDATA[Ruby]]></category>

		<category><![CDATA[rubykaigi]]></category>

		<category><![CDATA[rubykaigi2008]]></category>

		<guid isPermaLink="false">http://handlino.com/blog/2008/06/23/70/</guid>
		<description><![CDATA[這一次抱著嘗試新鮮的態度到來參加 RubyKaigi。身為聽眾而非講者，見識到了
Ruby 社群許多不同於 Perl 社群的一面。

深入研究者多

在議程方面，有不少關於 Ruby VM 的發表。第一天一開始就有兩場，除了 Ruby 1.9 的 YARV 的主持人「笹田」之外，還有 Rubinus 以及 jruby，第二天則有 MacRuby。

笹田把 Ruby VM 當成學術研究計畫，並且在東大中爭取到了研究室，目前正在招生：東京大学大学院 情報理工学系研究科 創造情報学専攻 笹田研究室 (非常長的全名)。

Rubini.us 是來自 Engine Yard 的員工 Evan Phoenix 的計畫，它也是實做 Ruby VM，但著重於將許多 VM 本身才能得知的資訊，以 first class object 的形式提供出來，像是 Method (讓函式可以取得自身的資料)、SendSite (method caller / callee) 等等。Evan 的全職工作就是做此 VM 的研究。實在是非常令人羨慕的工作。

MacRuby 是 Apple 員工 Laurent Sansonetti 的做品，基本上的概念是把 [...]]]></description>
			<content:encoded><![CDATA[<p>這一次抱著嘗試新鮮的態度到來參加 RubyKaigi。身為聽眾而非講者，見識到了
Ruby 社群許多不同於 Perl 社群的一面。</p>

<h3>深入研究者多</h3>

<p>在議程方面，有不少關於 Ruby VM 的發表。第一天一開始就有兩場，除了 Ruby 1.9 的 YARV 的主持人「笹田」之外，還有 Rubinus 以及 jruby，第二天則有 MacRuby。</p>

<p>笹田把 Ruby VM 當成學術研究計畫，並且在東大中爭取到了研究室，目前正在招生：<a href="http://www.ci.i.u-tokyo.ac.jp/~sasada/">東京大学大学院 情報理工学系研究科 創造情報学専攻 笹田研究室</a> (非常長的全名)。</p>

<p><a href="http://rubini.us/">Rubini.us</a> 是來自 Engine Yard 的員工 Evan Phoenix 的計畫，它也是實做 Ruby VM，但著重於將許多 VM 本身才能得知的資訊，以 first class object 的形式提供出來，像是 Method (讓函式可以取得自身的資料)、SendSite (method caller / callee) 等等。Evan 的全職工作就是做此 VM 的研究。實在是非常令人羨慕的工作。</p>

<p><a href="http://ruby.macosforge.org/trac/wiki/MacRuby">MacRuby</a> 是 Apple 員工 <a href="http://chopine.be/lrz/">Laurent Sansonetti</a> 的做品，基本上的概念是把 Ruby 1.9 放在 Objective C Runtime 上面執行。或者也可以說，Objective C 的 Runtime environment 就是 Ruby VM。這樣一來便可以直接利用其能力，主要重點還是在於 GC。</p>

<p>由於 CRuby (官方釋出的 ruby) 的 GC 使用的 Main Thread ，只要 GC 一開始進行，程式的所有部份都必需要暫停，因此每個 VM 實做都有強調如何改善 GC。若像 jruby 本身是 java vm，或 macruby 是 objc runtime，都是已經有長久深遠實做的 vm，多半沒有這個問題。</p>

<p>第二天有位講者在台上問：「這裡有讀過 gc.c 原始碼的請舉個手」，台下有百來位聽眾竟有二十幾位舉手。可見這個社群中深入了解 ruby 計畫的人不少。</p>

<h3>商業支持層面廣泛而深入</h3>

<p>前述所說的幾種 Ruby VM 全都是屬於企業的研究，jruby 現在也是 sun 的計畫，MacRuby 則是 Apple 的計畫，Rubinus 則屬於 Engine Yard。這些研究計畫的研究者也都全職付出在計畫上。</p>

<p>而這些都是 Ruby VM 而以，還沒談到關於 Ruby on Rails、或是 Ruby IDE 等等其他「週邊」產品。由於 jruby，基於 Eclipse 或 Netbeans 的 IDE 編輯器也相當的完整，會場上另有發表一套 <a href="http://www.codegear.com/">Code Gear</a>。不過台上在示範開發 Rails Demo App 時，跑 db migrate 竟然導致 IDE Crash，引得大家一陣笑。Never live demo。</p>

<h3>與 Perl 社群重疊</h3>

<p>與會者當中有許多曾在 YAPC::Asia 看到的熟面孔。再加上我本身也是 Perl 社群的人，Ruby 會會長高橋征義本身也在閉幕的致詞中強調會多多向 YAPC::Asia 學習。我想在日本這個軟體開發資源充沛的環境當中，會同時使用 Perl、Ruby 或更多語言的程式設計師想必不在少數。</p>

<p>最後我以我這兩天玩的 Ruby Golf 做個結尾</p>

<p><a href="http://www.shinh.org/p.rb?Japanese+numeral+for+Ruby+kaigi">Japanese numeral</a></p>

<pre>
U='個十百千'
D='零一二三四五六七八九'
$<.each{|l|v=-2;l.scan(/([#{D}])?([#{U}]|$)/u){|m|v+=D.index($1||"一")/3*10**(U.index($2)/3)};p v}
</pre>

<p><a href="http://www.shinh.org/p.rb?Compound+interest">Compound interest</a></p>

<pre>
$/=":";a,b,c=$<.to_a;1.upto(a.to_i){puts b=b.to_i;b*=1+c.to_f/100}
</pre>

<p>同一題的 Perl 版</p>

<pre>
($a,$b,$c)=split":",<>;print$b,$/and$b+=0|$b*$c/100for1..$a;
</pre>

<p>學著玩 Ruby Golf，自已的知識又增加了不少，大家也不妨試試。</p>
]]></content:encoded>
			<wfw:commentRss>http://handlino.com/blog/2008/06/23/70/feed/</wfw:commentRss>
		</item>
		<item>
		<title>淺談 OpenID</title>
		<link>http://handlino.com/blog/2008/06/10/69/</link>
		<comments>http://handlino.com/blog/2008/06/10/69/#comments</comments>
		<pubDate>Mon, 09 Jun 2008 19:54:54 +0000</pubDate>
		<dc:creator>gugod</dc:creator>
		
		<category><![CDATA[Web Standard]]></category>

		<category><![CDATA[openid]]></category>

		<guid isPermaLink="false">http://handlino.com/blog/2008/06/10/69/</guid>
		<description><![CDATA[OpenID 的設計裡，一個 ID (identiier) 就是一個 URL。真是奇怪，不過
習慣之後也還好。

Flickr 跟 Google 提供的 OpenID URL 都是利用現有的 URL，相當方便。
Yahoo 的 OpenID URL 則是需要去啟用一下。而
且他們不建議直接把yahoo username 放在 OpenID URL 中，username 見光
之後就會出現 SPAM 等問題。

Google 的話，則是 Blog URL，由於跟 google username 原本就沒有一對
一的對應關係，所以不會衍生出 SPAM 問題。


Flickr: http://flickr.com/photos/
Google: blog website URL.
Yahoo: http://me.yahoo.com/a/


這也讓我不斷的思考：倒底 OpenID 這個 URL 應不應該是個公開的資訊？
Yahoo 的做法相當的正確，因為 yahoo username 直接會對應到 Email，造
成有心人士可能藉由 OpenID URL 取得 Email 名單。雖然 SPAM 問題早已
成災，但若因此視而不見，也只是在製造出更多可能的問題。

而 Flickr [...]]]></description>
			<content:encoded><![CDATA[<p>OpenID 的設計裡，一個 ID (identiier) 就是一個 URL。真是奇怪，不過
習慣之後也還好。</p>

<p>Flickr 跟 Google 提供的 OpenID URL 都是利用現有的 URL，相當方便。
Yahoo 的 OpenID URL 則是需要去<a href="http://me.yahoo.com">啟用</a>一下。而
且他們不建議直接把yahoo username 放在 OpenID URL 中，username 見光
之後就會出現 SPAM 等問題。</p>

<p>Google 的話，則是 Blog URL，由於跟 google username 原本就沒有一對
一的對應關係，所以不會衍生出 SPAM 問題。</p>

<ul>
<li>Flickr: http://flickr.com/photos/<id></li>
<li>Google: blog website URL.</li>
<li>Yahoo: http://me.yahoo.com/a/<generated_id></li>
</ul>

<p>這也讓我不斷的思考：倒底 OpenID 這個 URL 應不應該是個公開的資訊？
Yahoo 的做法相當的正確，因為 yahoo username 直接會對應到 Email，造
成有心人士可能藉由 OpenID URL 取得 Email 名單。雖然 SPAM 問題早已
成災，但若因此視而不見，也只是在製造出更多可能的問題。</p>

<p>而 Flickr 會不會有這個問題？其實也有，Flickr 上的 comment spam 已
經不少。但比較幸運的是，Flickr 的訊息傳送是自家的，比起 Email 來說，
較容易在server 端加上防 SPAM 的機制。如果是照片的存取控制的話，就
算引來許多有心人士將你加入好友列表，只要你不將他們也加入好友列表，
你的私有照片就不會曝光，因此，也不會有太大影響。另外一個觀點嘛，反
正放在 Flickr 上的相片本質上就是拿來共享的，因此，拿 OpenID URL 當
做一個廣告手段也沒什麼不好。換句話說，這種 OpenID URL 就算是公開了，
也沒什麼不妥的。</p>

<p><a href="http://clickpass.com">Cilckpass</a> 則提供了十分有意思的做法。這家
OpenID 提供商所提供的 OpenID URL 完全是亂數產生的。註冊成為會員之
後，它會引導你進入其他可以使用 OpenID 的網站，但是，他提供給每個網
站的OpenID URL 都不一樣。雖然對應到 Clickpass 上都是同一位會員，但
這樣的資訊只存於 clickpass 網站上。整體來說， clickpass 的會員跟本
不需要知道自已的 OpenID URL 是什麼，只消點擊 clickpass 站上的各網
站的按鈕，就能直接登入其他站。好處是相當的方便，但反過來說，
clickpass 就鉗住通往各網站的大門了，能逛的網站就被 Clickpass 給限
制住了。以這層意思來說，似乎有那麼一點點違反 OpenID 原本設計的原意
了。</p>

<p>最近<a href="http://handlino.com">公司</a>所開發的新 Web 2.0 服務
<a href="http://sudomake.com">SudoMake</a> 就鼓勵使用 OpenID。有別於其他能用
OpenID 登入的網站，SudoMake 能讓你使用多重 OpenID 登入。這是個十分
貼心的功能。大家都有 Yahoo 帳號、Google 帳號、Flickr 帳號，因此你
可能有三個能用的 OpenID 了。你可能會忘了你當初在網站甲是用 Google
OpenID 登入，還是 Yahoo OpenID 登入、還是其他家的 OpenID。在
SudoMake 上可以登入後一次加好所有的 OpenID，這樣以後就算你忘了也沒
問題，用哪個都行。</p>
]]></content:encoded>
			<wfw:commentRss>http://handlino.com/blog/2008/06/10/69/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
