<?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"?><!-- 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>Fri, 23 Oct 2009 02:24:20 +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" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
		<title>再次把玩 Heroku（Rails Hosting) 的一些心得</title>
		<link>http://handlino.com/blog/2009/03/31/91/</link>
		<comments>http://handlino.com/blog/2009/03/31/91/#comments</comments>
		<pubDate>Tue, 31 Mar 2009 15:51:21 +0000</pubDate>
		<dc:creator>xdite</dc:creator>
		
		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://handlino.com/blog/2009/03/31/91/</guid>
		<description><![CDATA[Heroku 是一個 Rails Hosting Sevice。剛推出的時候，以可以「在線上撰寫 Rails Application」（Ajax Console）這項神奇的 Feature 為著稱。

不過現在筆者撰寫 Web Application 的習慣一向是在 local 端寫好之後，配合 SCM （svn / git ）加上 Deploy Tool ( Capistrano）推出去。因此線上撰寫 Application 對我來說只能說是「炫而不實」XD 當初只把玩一下就放著了

今天聽老闆 hlb 說，在 Heroku 上 Deploy Application 似乎變簡單了，便開張票要我練一下把某 Service 搬上去。

我大概玩了一下，整理了一些重點（詳細 Detail 可見他們的 Document）：


需要 熟悉 Git 指令：

Heroku 目前的策略，取消了「在線上撰寫 Rails Application」。而改成類似 SCM + Deploy Tool 的方式。Heroku 有自己的 rubygems。而 git push heroku [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://heroku.com">Heroku</a> 是一個 Rails Hosting Sevice。剛推出的時候，以可以「在線上撰寫 Rails Application」（Ajax Console）這項神奇的 Feature 為著稱。</p>

<p>不過現在筆者撰寫 Web Application 的習慣一向是在 local 端寫好之後，配合 SCM （svn / git ）加上 Deploy Tool ( Capistrano）推出去。因此線上撰寫 Application 對我來說只能說是「炫而不實」XD 當初只把玩一下就放著了</p>

<p>今天聽老闆 <a href="http://hlb.yichi.org/blog/">hlb</a> 說，在 Heroku 上 Deploy Application 似乎變簡單了，便開張票要我練一下把某 Service 搬上去。</p>

<p>我大概玩了一下，整理了一些重點（詳細 Detail 可見他們的 <a href="http://heroku.com/docs">Document</a>）：</p>

<ol>
<li><p>需要 <em>熟悉</em> Git 指令：</p>

<p>Heroku 目前的策略，取消了「在線上撰寫 Rails Application」。而改成類似 SCM + Deploy Tool 的方式。Heroku 有自己的 rubygems。而 git push heroku master 等於 git push + deploy。</p></li>
<li><p>必須手動撰寫 .gems 檔 ：</p>

<p><strong>require 的 gems 必須寫成一個 .gems 檔，一起 commit 上去</strong>，這樣 git push heroku 上去就會自動安裝。上面的 Rails 似乎是 2.2.2 版，所以如果 Rails 版本比較低（如 2.1.x），必須也要當成一個 require 的 rubygems 寫在 .gems 裡。我的建議是，如果想省時間，也許<strong>可以考慮把 rubygems unpack 成 plugin 的方式掛上去</strong>。</p></li>
<li><p>只支援 PostgreSQL：</p>

<p>Heroku 的內建 db 是 PostgreSQL，似乎沒有其他選擇。如果 Application 都是用 ActiveRecord 生 query 倒還好，如果有手刻 SQL 語法的份就必須要注意一下。有可以把舊有 db 推上去的選項，但我試用的心得是 MySQL 倒進去轉成 PostgreSQL 會遇上 schema_migration 版本號的 integer out of range 問題，直接導致 import 失敗。</p></li>
</ol>

<p>結論：</p>

<p>Heroku 適合當 stagging / demo site ，而不適合當 production 環境。原因是 deploy 方式很便利，但效能似乎不佳以及有先天環境上的限制。而 Heroku 有<strong> DNS mapping，拿來當個測試用的站台不錯（自己找機器架好 Rails deploy 是一件累人的事）</strong>。以後如果在 <a href="http://www.railsenvy.com/">RailsEnvy</a> 上面看到什麼 powerful 的 opensource cms or application，可以扔上 Heroku 玩看看。</p>
]]></content:encoded>
			<wfw:commentRss>http://handlino.com/blog/2009/03/31/91/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Markapl - Mark up as Perl.</title>
		<link>http://handlino.com/blog/2008/12/27/90/</link>
		<comments>http://handlino.com/blog/2008/12/27/90/#comments</comments>
		<pubDate>Fri, 26 Dec 2008 23:35:05 +0000</pubDate>
		<dc:creator>gugod</dc:creator>
		
		<category><![CDATA[Perl]]></category>

		<category><![CDATA[devel::declare]]></category>

		<category><![CDATA[jesse]]></category>

		<category><![CDATA[jifty]]></category>

		<category><![CDATA[markaby]]></category>

		<category><![CDATA[markapl]]></category>

		<category><![CDATA[template::declare]]></category>

		<guid isPermaLink="false">http://handlino.com/blog/2008/12/27/90/</guid>
		<description><![CDATA[Markapl 是最近在嘗試著實做的一個實驗性模組，主要的想法是試試 Devel::Declare 的能力，有沒有辨法讓 Perl 能用很近似於 Markaby (Mark up as Ruby) 的語法來產生 HTML。

閱讀全文&#8230;
]]></description>
			<content:encoded><![CDATA[<p>Markapl 是最近在嘗試著實做的一個實驗性模組，主要的想法是試試 Devel::Declare 的能力，有沒有辨法讓 Perl 能用很近似於 Markaby (Mark up as Ruby) 的語法來產生 HTML。</p>

<p><a href="http://chupei.pm.org/2008/12/markapl---mark-up-as-perl.html">閱讀全文&#8230;</a></p>
]]></content:encoded>
			<wfw:commentRss>http://handlino.com/blog/2008/12/27/90/feed/</wfw:commentRss>
		</item>
		<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>
	</channel>
</rss>
