<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	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/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>bintangjatuh</title>
	<atom:link href="http://bintangjatuh.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://bintangjatuh.com</link>
	<description>thank god i can sleep</description>
	<lastBuildDate>Thu, 25 Feb 2010 09:38:41 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Playing With Ruby Metaprogramming</title>
		<link>http://bintangjatuh.com/2010/02/25/playing-with-ruby-metaprogramming/</link>
		<comments>http://bintangjatuh.com/2010/02/25/playing-with-ruby-metaprogramming/#comments</comments>
		<pubDate>Thu, 25 Feb 2010 09:30:29 +0000</pubDate>
		<dc:creator>gozali</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[meta-programming]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://bintangjatuh.com/?p=179</guid>
		<description><![CDATA[
1
2
3
4
5
6
7
8
9
10
11
12
13
14
class Array
  def remove&#40;*args&#41;
    string_params = &#34;&#34;
    args.each do &#124;arg_item&#124;
      string_params += arg_item
    end   
    flatten.collect &#123; &#124;k&#124; k.delete string_params&#125;
  end
&#160;
  def repeat&#40;int&#41;
    initial_array = collect &#123; &#124;j&#124; j.to_s.split * [...]]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> <span style="color:#CC0066; font-weight:bold;">Array</span>
  <span style="color:#9966CC; font-weight:bold;">def</span> remove<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">*</span>args<span style="color:#006600; font-weight:bold;">&#41;</span>
    string_params = <span style="color:#996600;">&quot;&quot;</span>
    args.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>arg_item<span style="color:#006600; font-weight:bold;">|</span>
      string_params <span style="color:#006600; font-weight:bold;">+</span>= arg_item
    <span style="color:#9966CC; font-weight:bold;">end</span>   
    flatten.<span style="color:#9900CC;">collect</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>k<span style="color:#006600; font-weight:bold;">|</span> k.<span style="color:#9900CC;">delete</span> string_params<span style="color:#006600; font-weight:bold;">&#125;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> repeat<span style="color:#006600; font-weight:bold;">&#40;</span>int<span style="color:#006600; font-weight:bold;">&#41;</span>
    initial_array = collect <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>j<span style="color:#006600; font-weight:bold;">|</span> j.<span style="color:#9900CC;">to_s</span>.<span style="color:#CC0066; font-weight:bold;">split</span> <span style="color:#006600; font-weight:bold;">*</span> int<span style="color:#006600; font-weight:bold;">&#125;</span>
    initial_array.<span style="color:#9900CC;">flatten</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>


<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">rb<span style="color:#006600; font-weight:bold;">&#40;</span>main<span style="color:#006600; font-weight:bold;">&#41;</span>:001:<span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&gt;</span> <span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'meta-test.rb'</span>
<span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">true</span>
irb<span style="color:#006600; font-weight:bold;">&#40;</span>main<span style="color:#006600; font-weight:bold;">&#41;</span>:002:<span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&gt;</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;one&quot;</span>, <span style="color:#996600;">&quot;two&quot;</span>, <span style="color:#996600;">&quot;three&quot;</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">repeat</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">3</span><span style="color:#006600; font-weight:bold;">&#41;</span> 
<span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;one&quot;</span>, <span style="color:#996600;">&quot;one&quot;</span>, <span style="color:#996600;">&quot;one&quot;</span>, <span style="color:#996600;">&quot;two&quot;</span>, <span style="color:#996600;">&quot;two&quot;</span>, <span style="color:#996600;">&quot;two&quot;</span>, <span style="color:#996600;">&quot;three&quot;</span>, <span style="color:#996600;">&quot;three&quot;</span>, <span style="color:#996600;">&quot;three&quot;</span><span style="color:#006600; font-weight:bold;">&#93;</span>
irb<span style="color:#006600; font-weight:bold;">&#40;</span>main<span style="color:#006600; font-weight:bold;">&#41;</span>:003:<span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&gt;</span>
&nbsp;
irb<span style="color:#006600; font-weight:bold;">&#40;</span>main<span style="color:#006600; font-weight:bold;">&#41;</span>:003:<span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&gt;</span> <span style="color:#006600; font-weight:bold;">%</span>w<span style="color:#006600; font-weight:bold;">&#123;</span>one two three four five six seven eight nine ten<span style="color:#006600; font-weight:bold;">&#125;</span>.<span style="color:#9900CC;">remove</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;i&quot;</span>,<span style="color:#996600;">&quot;o&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span> 
<span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;ne&quot;</span>, <span style="color:#996600;">&quot;tw&quot;</span>, <span style="color:#996600;">&quot;three&quot;</span>, <span style="color:#996600;">&quot;fur&quot;</span>, <span style="color:#996600;">&quot;fve&quot;</span>, <span style="color:#996600;">&quot;sx&quot;</span>, <span style="color:#996600;">&quot;seven&quot;</span>, <span style="color:#996600;">&quot;eght&quot;</span>, <span style="color:#996600;">&quot;nne&quot;</span>, <span style="color:#996600;">&quot;ten&quot;</span><span style="color:#006600; font-weight:bold;">&#93;</span></pre></div></div>

<p>Metaprogramming with Ruby is fun, isn&#8217;t it? <img src='http://bintangjatuh.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://bintangjatuh.com/2010/02/25/playing-with-ruby-metaprogramming/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Rails Tips : Prawnto PDF Generator Dynamic File Name</title>
		<link>http://bintangjatuh.com/2009/12/29/rails-tips-prawnto-pdf-generator-dynamic-file-name/</link>
		<comments>http://bintangjatuh.com/2009/12/29/rails-tips-prawnto-pdf-generator-dynamic-file-name/#comments</comments>
		<pubDate>Mon, 28 Dec 2009 21:42:54 +0000</pubDate>
		<dc:creator>gozali</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[pdf]]></category>
		<category><![CDATA[prawn]]></category>
		<category><![CDATA[prawnto]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[ruby on rails]]></category>

		<guid isPermaLink="false">http://bintangjatuh.com/?p=172</guid>
		<description><![CDATA[I was getting stuck how to generate dynamic file name for prawn generated pdf file, because there&#8217;s lack of example and document here http://cracklabs.com/prawnto/demos
What is Prawnto? Prawnto is is a rails plugin leveraging the new prawn library to produce compiled pdf views, as for me i&#8217;m using it for custom reporting tools.
OK, let&#8217;s getting back [...]]]></description>
			<content:encoded><![CDATA[<p>I was getting stuck how to generate dynamic file name for prawn generated pdf file, because there&#8217;s lack of example and document here <a href="http://cracklabs.com/prawnto/demos">http://cracklabs.com/prawnto/demos</a></p>
<p>What is Prawnto? <a href="http://cracklabs.com/prawnto/">Prawnto</a> is is a rails plugin leveraging the new <a href="http://github.com/sandal/prawn">prawn library</a> to produce compiled pdf views, as for me i&#8217;m using it for custom reporting tools.</p>
<p>OK, let&#8217;s getting back to the problem, what should you do is place prawnto definition in your method rather than in controller&#8217;s callbacks :</p>
<p><em># /app/controllers/transactions_controller.rb</em></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">def</span> show
    prawnto <span style="color:#ff3333; font-weight:bold;">:prawn</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:page_size</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'A4'</span>,
                                     <span style="color:#ff3333; font-weight:bold;">:left_margin</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006666;">40</span>,
                                     <span style="color:#ff3333; font-weight:bold;">:right_margin</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006666;">30</span>,
                                     <span style="color:#ff3333; font-weight:bold;">:top_margin</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006666;">40</span>,
                                     <span style="color:#ff3333; font-weight:bold;">:bottom_margin</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006666;">30</span><span style="color:#006600; font-weight:bold;">&#125;</span>,
                                     <span style="color:#ff3333; font-weight:bold;">:filename</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;invoice_#{@transaction.id}_customer_#{@transaction.customer_id}.pdf&quot;</span>
    render <span style="color:#ff3333; font-weight:bold;">:layout</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">false</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>

<p><em># /app/views/transactions/show.pdf.prawn</em></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#006600; font-weight:bold;">&lt;%</span>= link_to <span style="color:#996600;">&quot;Generate PDF&quot;</span>, transaction_url<span style="color:#006600; font-weight:bold;">&#40;</span>transaction.<span style="color:#9900CC;">id</span>, <span style="color:#ff3333; font-weight:bold;">:format</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'pdf'</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">%&gt;</span></pre></td></tr></table></div>

<p>Hope this is useful, cheers <img src='http://bintangjatuh.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://bintangjatuh.com/2009/12/29/rails-tips-prawnto-pdf-generator-dynamic-file-name/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Ruby Tips : Mengubah Isi Array Menjadi Tipe Data Tertentu</title>
		<link>http://bintangjatuh.com/2009/12/15/ruby-tips-mengubah-isi-array-menjadi-tipe-data-tertentu/</link>
		<comments>http://bintangjatuh.com/2009/12/15/ruby-tips-mengubah-isi-array-menjadi-tipe-data-tertentu/#comments</comments>
		<pubDate>Tue, 15 Dec 2009 12:14:01 +0000</pubDate>
		<dc:creator>gozali</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[snippets]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://bintangjatuh.com/?p=154</guid>
		<description><![CDATA[Sebagai contoh kita ingin menggabungkan dua buah Array dengan elemen yang bervariasi, misalnya String dan Integer dan membuang elemen yang duplicated.
Ilustrasinya sebagai berikut :

1
2
x = &#91;1, 2, 3, 4&#93;
y = &#91;&#34;1&#34;, &#34;2&#34;, &#34;3&#34;, 5&#93;

Array x memiliki elemen dengan tipe data Integer sedangkan Array y memiliki String dan Integer yang sebenarnya jika String tersebut diubah tipe [...]]]></description>
			<content:encoded><![CDATA[<p>Sebagai contoh kita ingin menggabungkan dua buah Array dengan elemen yang bervariasi, misalnya String dan Integer dan membuang elemen yang <em>duplicated</em>.</p>
<p>Ilustrasinya sebagai berikut :</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;">x = <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">1</span>, <span style="color:#006666;">2</span>, <span style="color:#006666;">3</span>, <span style="color:#006666;">4</span><span style="color:#006600; font-weight:bold;">&#93;</span>
y = <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;1&quot;</span>, <span style="color:#996600;">&quot;2&quot;</span>, <span style="color:#996600;">&quot;3&quot;</span>, <span style="color:#006666;">5</span><span style="color:#006600; font-weight:bold;">&#93;</span></pre></td></tr></table></div>

<p>Array x memiliki elemen dengan tipe data Integer sedangkan Array y memiliki String dan Integer yang sebenarnya jika String tersebut diubah tipe datanya menjadi Integer akan memiliki elemen yang hampir sama dengan Array x. Lalu bagaimana cara agar ketika kedua Array tersebut digabungkan kita mendapatkan Array dengan data yang unik?</p>
<p>Caranya sangat sederhana dan cukup satu baris saja di Ruby :<br />
Dari String ke Integer</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;">irb<span style="color:#006600; font-weight:bold;">&#40;</span>main<span style="color:#006600; font-weight:bold;">&#41;</span>:003:<span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&gt;</span> z = <span style="color:#006600; font-weight:bold;">&#40;</span>x<span style="color:#006600; font-weight:bold;">+</span> y<span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">flatten</span>.<span style="color:#9900CC;">collect</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>i<span style="color:#006600; font-weight:bold;">|</span> i.<span style="color:#9900CC;">to_i</span> <span style="color:#006600; font-weight:bold;">&#125;</span> 
<span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">1</span>, <span style="color:#006666;">2</span>, <span style="color:#006666;">3</span>, <span style="color:#006666;">4</span>, <span style="color:#006666;">1</span>, <span style="color:#006666;">2</span>, <span style="color:#006666;">3</span>, <span style="color:#006666;">5</span><span style="color:#006600; font-weight:bold;">&#93;</span>
irb<span style="color:#006600; font-weight:bold;">&#40;</span>main<span style="color:#006600; font-weight:bold;">&#41;</span>:004:<span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&gt;</span> z.<span style="color:#9900CC;">uniq</span>
<span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">1</span>, <span style="color:#006666;">2</span>, <span style="color:#006666;">3</span>, <span style="color:#006666;">4</span>, <span style="color:#006666;">5</span><span style="color:#006600; font-weight:bold;">&#93;</span></pre></td></tr></table></div>

<p>Dari Integer ke String :</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;">irb<span style="color:#006600; font-weight:bold;">&#40;</span>main<span style="color:#006600; font-weight:bold;">&#41;</span>:005:<span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&gt;</span> z = <span style="color:#006600; font-weight:bold;">&#40;</span>x<span style="color:#006600; font-weight:bold;">+</span> y<span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">flatten</span>.<span style="color:#9900CC;">collect</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>i<span style="color:#006600; font-weight:bold;">|</span> i.<span style="color:#9900CC;">to_s</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
<span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;1&quot;</span>, <span style="color:#996600;">&quot;2&quot;</span>, <span style="color:#996600;">&quot;3&quot;</span>, <span style="color:#996600;">&quot;4&quot;</span>, <span style="color:#996600;">&quot;1&quot;</span>, <span style="color:#996600;">&quot;2&quot;</span>, <span style="color:#996600;">&quot;3&quot;</span>, <span style="color:#996600;">&quot;5&quot;</span><span style="color:#006600; font-weight:bold;">&#93;</span>
irb<span style="color:#006600; font-weight:bold;">&#40;</span>main<span style="color:#006600; font-weight:bold;">&#41;</span>:006:<span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&gt;</span> z.<span style="color:#9900CC;">uniq</span>
<span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;1&quot;</span>, <span style="color:#996600;">&quot;2&quot;</span>, <span style="color:#996600;">&quot;3&quot;</span>, <span style="color:#996600;">&quot;4&quot;</span>, <span style="color:#996600;">&quot;5&quot;</span><span style="color:#006600; font-weight:bold;">&#93;</span></pre></td></tr></table></div>

<p>Atau bahkan Float</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;">irb<span style="color:#006600; font-weight:bold;">&#40;</span>main<span style="color:#006600; font-weight:bold;">&#41;</span>:007:<span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&gt;</span> z = <span style="color:#006600; font-weight:bold;">&#40;</span>x<span style="color:#006600; font-weight:bold;">+</span> y<span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">flatten</span>.<span style="color:#9900CC;">collect</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>i<span style="color:#006600; font-weight:bold;">|</span> i.<span style="color:#9900CC;">to_f</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
<span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">1.0</span>, <span style="color:#006666;">2.0</span>, <span style="color:#006666;">3.0</span>, <span style="color:#006666;">4.0</span>, <span style="color:#006666;">1.0</span>, <span style="color:#006666;">2.0</span>, <span style="color:#006666;">3.0</span>, <span style="color:#006666;">5.0</span><span style="color:#006600; font-weight:bold;">&#93;</span>
irb<span style="color:#006600; font-weight:bold;">&#40;</span>main<span style="color:#006600; font-weight:bold;">&#41;</span>:008:<span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&gt;</span> z.<span style="color:#9900CC;">uniq</span>
<span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">1.0</span>, <span style="color:#006666;">2.0</span>, <span style="color:#006666;">3.0</span>, <span style="color:#006666;">4.0</span>, <span style="color:#006666;">5.0</span><span style="color:#006600; font-weight:bold;">&#93;</span></pre></td></tr></table></div>

<p>Demikian, semoga bermanfaat <img src='http://bintangjatuh.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://bintangjatuh.com/2009/12/15/ruby-tips-mengubah-isi-array-menjadi-tipe-data-tertentu/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Jakarta.rb December 2009</title>
		<link>http://bintangjatuh.com/2009/12/10/jakarta-rb-december-2009/</link>
		<comments>http://bintangjatuh.com/2009/12/10/jakarta-rb-december-2009/#comments</comments>
		<pubDate>Wed, 09 Dec 2009 17:45:47 +0000</pubDate>
		<dc:creator>gozali</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[jakarta.rb]]></category>
		<category><![CDATA[meetup]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[ruby on rails]]></category>

		<guid isPermaLink="false">http://bintangjatuh.com/?p=142</guid>
		<description><![CDATA[The last meeting Jakarta.rb in 2009 is going to be:
When: 
Saturday, December 12nd at 10 AM
Where: 
detikcom office
Gedung Aldevco Octagon Lt. 2,
Jl. Warung Jati Barat Raya No. 75
Jakarta Selatan
Google Map Link
Call me: 0818-0308-1790 if you get lost.
The building is across the street from the Pizza Hut Warung Buncit and Buncit Indah Busway Shelter. The entrance [...]]]></description>
			<content:encoded><![CDATA[<p>The last meeting Jakarta.rb in 2009 is going to be:</p>
<p><strong>When: </strong><br />
Saturday, December 12nd at 10 AM</p>
<p><strong>Where: </strong><br />
detikcom office<br />
Gedung Aldevco Octagon Lt. 2,<br />
Jl. Warung Jati Barat Raya No. 75<br />
Jakarta Selatan<br />
<a href="http://maps.google.com/maps?f=q&#038;hl=en&#038;q=Aldevco+Octagon+Bld%2C+2nd+Floor%2C+Jl.+Warung+Jati+Barat+No.+75%2C+Jakarta%2C+Indonesia">Google Map Link</a></p>
<p>Call me: 0818-0308-1790 if you get lost.</p>
<p>The building is across the street from the <strong>Pizza Hut Warung Buncit</strong> and <strong>Buncit Indah Busway Shelter</strong>. The entrance to the building is in back by the parking lot.</p>
<p>Topics:<br />
We will have 2 presentations no longer then 30 minutes each:<br />
BDD with Cucumber – by Kunto Aji (<a href="http://www.railsmine.net">http://www.railsmine.net</a>)<br />
W2tags Live &#8211; by Widi Harsojo of Koprol (<a href="http://wharsojo.wordpress.com">http://wharsojo.wordpress.com</a>)</p>
<p>We are opening open submission, we welcome all your resources (codes, videos, documentations, slides, presentation) for our next meetup</p>
]]></content:encoded>
			<wfw:commentRss>http://bintangjatuh.com/2009/12/10/jakarta-rb-december-2009/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Snippet Mendapatkan Tweet Terakhir di Wordpress</title>
		<link>http://bintangjatuh.com/2009/12/07/snippet-mendapatkan-tweet-terakhir-di-wordpress/</link>
		<comments>http://bintangjatuh.com/2009/12/07/snippet-mendapatkan-tweet-terakhir-di-wordpress/#comments</comments>
		<pubDate>Sun, 06 Dec 2009 21:25:40 +0000</pubDate>
		<dc:creator>gozali</dc:creator>
				<category><![CDATA[Life]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[wordpress snippet twitter]]></category>

		<guid isPermaLink="false">http://bintangjatuh.com/?p=130</guid>
		<description><![CDATA[Beberapa hari yang lalu plugin Twitter Widget Pro mendapat serangan dari spammer, isinya kurang lebih mengajak hampir semua tweeps yang mem-follow saya untuk mengikuti test IQ, memang isinya test IQ tapi ternyata halaman tersebut mencuri cookies, sehingga beberapa teman ada yang mengirim tweets test IQ tersebut ke account twitter yang lain.
Dan parahnya lagi, status terakhir [...]]]></description>
			<content:encoded><![CDATA[<p>Beberapa hari yang lalu plugin <a href="http://xavisys.com/wordpress-twitter-widget/">Twitter Widget Pro</a> mendapat serangan dari spammer, isinya kurang lebih mengajak hampir semua tweeps yang mem-<em>follow</em> saya untuk mengikuti test IQ, memang isinya test IQ tapi ternyata halaman tersebut mencuri cookies, sehingga beberapa teman ada yang mengirim tweets test IQ tersebut ke account twitter yang lain.</p>
<p>Dan parahnya lagi, status terakhir yang muncul di blog ini selalu tweet tersebut, padahal saya sudah mengubah password dan memasang beberapa status.</p>
<p>Akhirnya saya menonaktifkan plugin tersebut dan menggunakan snippet sederhana seperti <a href="http://xavisys.com/wordpress-twitter-widget/">di sini</a> :</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> wp_echoTwitter<span style="color: #009900;">&#40;</span><span style="color: #000088;">$username</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
     <span style="color: #b1b100;">include_once</span><span style="color: #009900;">&#40;</span>ABSPATH<span style="color: #339933;">.</span>WPINC<span style="color: #339933;">.</span><span style="color: #0000ff;">'/rss.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #000088;">$tweet</span> <span style="color: #339933;">=</span> fetch_rss<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;http://search.twitter.com/search.atom?q=from:&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$username</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;&amp;rpp=1&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$tweet</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">items</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'atom_content'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Copy paste snippet di atas di file functions.php themes anda, jangan lupa filenya disimpan. Lalu tambahkan code seperti ini di themes anda.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> wp_echoTwitter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'gozali'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>simpan dan selesai, insyaAllah aman dari scam :p</p>
]]></content:encoded>
			<wfw:commentRss>http://bintangjatuh.com/2009/12/07/snippet-mendapatkan-tweet-terakhir-di-wordpress/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>W2Tags Live</title>
		<link>http://bintangjatuh.com/2009/11/17/w2tags-live/</link>
		<comments>http://bintangjatuh.com/2009/11/17/w2tags-live/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 21:12:20 +0000</pubDate>
		<dc:creator>gozali</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[w2tags]]></category>

		<guid isPermaLink="false">http://bintangjatuh.com/?p=123</guid>
		<description><![CDATA[Widi Harsojo, a fellow Ruby enthusiast here in Indonesia have released a fancy tools called W2Tags Live. W2Tags itself is a fast-prototyping machine-code gem for ERB. It&#8217;s an open source projects available on github and gemcutter. You can find valid introduction to w2tags on his presentations at Jakarta.rb November 2008 here :
W2Tags Is Haml In [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://wharsojo.wordpress.com">Widi Harsojo</a>, a fellow Ruby enthusiast here in Indonesia have released a fancy tools called W2Tags Live. W2Tags itself is a fast-prototyping machine-code gem for ERB. It&#8217;s an open source projects available on github and gemcutter. You can find valid introduction to w2tags on his presentations at Jakarta.rb November 2008 here :</p>
<div style="width:425px;text-align:left" id="__ss_834153"><a style="font:14px Helvetica,Arial,Sans-serif;display:block;margin:12px 0 3px 0;text-decoration:underline;" href="http://www.slideshare.net/wharsojo/w2-tags-is-haml-in-erb-presentation" title="W2Tags Is Haml In Erb">W2Tags Is Haml In Erb</a><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=w2tagsishamlinerb-1228860853407210-8&#038;rel=0&#038;stripped_title=w2-tags-is-haml-in-erb-presentation" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=w2tagsishamlinerb-1228860853407210-8&#038;rel=0&#038;stripped_title=w2-tags-is-haml-in-erb-presentation" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object>
<div style="font-size:11px;font-family:tahoma,arial;height:26px;padding-top:2px;">View more <a style="text-decoration:underline;" href="http://www.slideshare.net/">documents</a> from <a style="text-decoration:underline;" href="http://www.slideshare.net/wharsojo">widi harsojo</a>.</div>
</div>
<p>With the tools you can try <a href="http://w2tags.heroku.com" target="_blank">w2tags</a> online, you don&#8217;t need to install the gem on your machine, just type your code on the textarea available then it will render the results, as simple as that.</p>
<p><img src="http://bintangjatuh.com/wp-content/uploads/w2tags-live.png" alt="w2tags"></p>
]]></content:encoded>
			<wfw:commentRss>http://bintangjatuh.com/2009/11/17/w2tags-live/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Jakarta.rb Oktober 2009</title>
		<link>http://bintangjatuh.com/2009/09/16/jakarta-rb-oktober-2009/</link>
		<comments>http://bintangjatuh.com/2009/09/16/jakarta-rb-oktober-2009/#comments</comments>
		<pubDate>Tue, 15 Sep 2009 17:18:16 +0000</pubDate>
		<dc:creator>gozali</dc:creator>
				<category><![CDATA[Life]]></category>

		<guid isPermaLink="false">http://bintangjatuh.com/?p=116</guid>
		<description><![CDATA[Our next meeting is Saturday, October 17th, 10 AM at Detik meeting room and we’ve got three great talks lined up. First up Daniel Armanto (Koprol) will be giving a talk on Rails Deployment Using Capistrano, we will discuss the Rails deployment, along with a short demo. 
Next up Gerry Leo Nugroho (Product Planner &#8211; [...]]]></description>
			<content:encoded><![CDATA[<p>Our next meeting is Saturday, October 17th, 10 AM at Detik meeting room and we’ve got three great talks lined up. First up Daniel Armanto (<a href="http://www.koprol.com">Koprol</a>) will be giving a talk on Rails Deployment Using Capistrano, we will discuss the Rails deployment, along with a short demo. </p>
<p>Next up Gerry Leo Nugroho (Product Planner &#8211; <a href="http://www.detik.com">Detik</a>) will be giving a presentation titled &#8220;Internet Product Planning, A Procedure&#8221;. </p>
<p>And Michael Smith (<a href="http://www.klasifikasia.com">Klasifikasia</a>) will close our presentation section with his presentation about Rails Deployment with Vlad and Mercurial.</p>
<p>Looking forward to hangin with you guys at the meeting, hopefully see you there..</p>
<p>You can RSVP via <a href="http://www.facebook.com/event.php?eid=130479721143">Facebook Event</a></p>
]]></content:encoded>
			<wfw:commentRss>http://bintangjatuh.com/2009/09/16/jakarta-rb-oktober-2009/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Rails Tips : Paperclip Only Creates Original Directory?</title>
		<link>http://bintangjatuh.com/2009/09/01/rails-tips-paperclip-only-creates-original-directory/</link>
		<comments>http://bintangjatuh.com/2009/09/01/rails-tips-paperclip-only-creates-original-directory/#comments</comments>
		<pubDate>Tue, 01 Sep 2009 15:03:46 +0000</pubDate>
		<dc:creator>gozali</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Work]]></category>
		<category><![CDATA[imagemagick]]></category>
		<category><![CDATA[paperclip]]></category>
		<category><![CDATA[rmagick]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://bintangjatuh.com/?p=111</guid>
		<description><![CDATA[Pernah mengalami hal yang sama? Anda sudah menginstall plugin paperclip tapi ketika anda mengupload file gambar, paperclip hanya menulis file originalnya saja, tidak menambahkan file thumb atau style lain yang telah anda definisikan di dalam model?
Penyebabnya ternyata adalah ImageMagick dan RMagick belum terinstall di system, untuk kasus yang saya alami adalah menggunakan sistem ubuntu. Berikut [...]]]></description>
			<content:encoded><![CDATA[<p>Pernah mengalami hal yang sama? Anda sudah menginstall plugin paperclip tapi ketika anda mengupload file gambar, paperclip hanya menulis file originalnya saja, tidak menambahkan file thumb atau style lain yang telah anda definisikan di dalam model?</p>
<p>Penyebabnya ternyata adalah ImageMagick dan RMagick belum terinstall di system, untuk kasus yang saya alami adalah menggunakan sistem ubuntu. Berikut langkah &#8211; langkahnya :</p>
<p>Install ImageMagick dan libmagick9-dev terlebih dahulu :</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;">sudo apt<span style="color:#006600; font-weight:bold;">-</span>get install imagemagick libmagick9<span style="color:#006600; font-weight:bold;">-</span>dev</pre></td></tr></table></div>

<p>Jika berhasil dilanjutkan dengan menginstall RMagick</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;">sudo gem install rmagick <span style="color:#006600; font-weight:bold;">--</span>no<span style="color:#006600; font-weight:bold;">-</span>rdoc <span style="color:#006600; font-weight:bold;">--</span>no<span style="color:#006600; font-weight:bold;">-</span>ri</pre></td></tr></table></div>

<p>Tambahkan parameter :styles di model, dan coba upload file kembali, insyaAllah berhasil <img src='http://bintangjatuh.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;">has_attached_file <span style="color:#ff3333; font-weight:bold;">:photo</span>, <span style="color:#ff3333; font-weight:bold;">:styles</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:normal</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;100x100#&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:small</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;70x70&gt;&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:jpg</span><span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#006600; font-weight:bold;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://bintangjatuh.com/2009/09/01/rails-tips-paperclip-only-creates-original-directory/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Scheduling With Rufus Scheduler</title>
		<link>http://bintangjatuh.com/2009/08/20/scheduling-with-rufus-scheduler/</link>
		<comments>http://bintangjatuh.com/2009/08/20/scheduling-with-rufus-scheduler/#comments</comments>
		<pubDate>Wed, 19 Aug 2009 18:13:01 +0000</pubDate>
		<dc:creator>gozali</dc:creator>
				<category><![CDATA[Life]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[rufus-scheduler]]></category>

		<guid isPermaLink="false">http://bintangjatuh.com/?p=37</guid>
		<description><![CDATA[Saya mendapat sebuah proyek kecil, tujuannya sangat sederhana yaitu mengambil semua data dari sebuah website dan menyimpannya ke dalam database untuk kemudian ditampilkan kembali lewat wordpress, data tersebut kemudian harus selalu up-to-date sesuai dengan website yang akan di-crawl. Ini berarti saya membutuhkan sebuah proses penjadwalan tugas untuk memeriksa apakah ada update di website tersebut, karena [...]]]></description>
			<content:encoded><![CDATA[<p>Saya mendapat sebuah proyek kecil, tujuannya sangat sederhana yaitu mengambil semua data dari sebuah website dan menyimpannya ke dalam database untuk kemudian ditampilkan kembali lewat wordpress, data tersebut kemudian harus selalu <em>up-to-date</em> sesuai dengan website yang akan di-<em>crawl</em>. Ini berarti saya membutuhkan sebuah proses penjadwalan tugas untuk memeriksa apakah ada update di website tersebut, karena kita mengambilnya secara <em>&#8220;ilegal&#8221;</em>. Proses crawlingnya sendiri menggunakan hpricot, kurang lebih isinya seperti ini, masih kotor saya pasang di model <code>property.rb</code>.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'rubygems'</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'hpricot'</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'open-uri'</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">class</span> Property <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#6666ff; font-weight:bold;">ActiveRecord::Base</span>
<span style="color:#9966CC; font-weight:bold;">class</span> <span style="color:#006600; font-weight:bold;">&lt;&lt;</span> <span style="color:#0000FF; font-weight:bold;">self</span>
<span style="color:#9966CC; font-weight:bold;">def</span> scrap<span style="color:#006600; font-weight:bold;">&#40;</span>page<span style="color:#006600; font-weight:bold;">&#41;</span>
  resultset = <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span>
  doc = Hpricot <span style="color:#CC0066; font-weight:bold;">open</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;http://www.xxxxx.com/property_list?page=#{page}&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  items = doc.<span style="color:#9900CC;">search</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;html_tag&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  items.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>item<span style="color:#006600; font-weight:bold;">|</span>
    title = item.<span style="color:#9900CC;">at</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;h4&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">innerText</span>.<span style="color:#CC0066; font-weight:bold;">gsub</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">/</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&amp;</span>nbsp;<span style="color:#006600; font-weight:bold;">|</span>\n<span style="color:#006600; font-weight:bold;">|</span>\s<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">+/</span>im, <span style="color:#996600;">' '</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">squeeze</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">' '</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">strip</span> <span style="color:#9966CC; font-weight:bold;">unless</span> item.<span style="color:#9900CC;">at</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;h4&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#0000FF; font-weight:bold;">nil</span>?
    link = item.<span style="color:#9900CC;">at</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;a&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">attributes</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;href&quot;</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#CC0066; font-weight:bold;">gsub</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">/</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&amp;</span>nbsp;<span style="color:#006600; font-weight:bold;">|</span>\n<span style="color:#006600; font-weight:bold;">|</span>\s<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">+/</span>im, <span style="color:#996600;">' '</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">squeeze</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">' '</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">strip</span> <span style="color:#9966CC; font-weight:bold;">unless</span> item.<span style="color:#9900CC;">at</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;a&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#0000FF; font-weight:bold;">nil</span>?
    resultset <span style="color:#006600; font-weight:bold;">&lt;&lt;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:title</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> title, <span style="color:#ff3333; font-weight:bold;">:link</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> link <span style="color:#006600; font-weight:bold;">&#125;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
  resultset
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">def</span> get_latest_update
  Property.<span style="color:#9900CC;">create</span>!<span style="color:#006600; font-weight:bold;">&#40;</span>scrap<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>

<p>Balik lagi ke masalah task scheduling alias penjadwalan tugas, saya biasanya mengandalkan crontab, atau kalau lagi disiplin ya ngelirik ke backgroundDrb, tapi untuk tugas yang satu ini kayaknya terlalu ribet kalo pake BackgroundDrb dan saya lagi nggak pengen pake crontab.</p>
<p>Akhirnya saya menemukan solusi yang menurut saya sangat <em>affordable</em> di <a href="http://www.railsinside.com/misc/234-scheduler-simple-task-scheduling-from-rails-apps.html">Rails Inside</a>. Dan saya pun memutuskan untuk mempelajari Rufus Scheduler dengan proyek kecil tadi sebagai <em>kelinci percobaan</em>nya. Bagaimana caranya?</p>
<p>Pertama pastinya install gem rufus-scheduler. Kalo perlu froze gem-nya ke <code>vendor/gems</code>.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;">sudo gem install rufus<span style="color:#006600; font-weight:bold;">-</span>scheduler</pre></td></tr></table></div>

<p>Lalu buat file bernama task_scheduler.rb di dalam direktori <code>config/initializers</code>. Isinya kurang lebih seperti ini :</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;">scheduler = <span style="color:#6666ff; font-weight:bold;">Rufus::Scheduler</span>.<span style="color:#9900CC;">start_new</span>
&nbsp;
scheduler.<span style="color:#9900CC;">every</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;1h&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
   Property.<span style="color:#9900CC;">get_latest_update</span>!
<span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>

<p>Kita dapat memanggil metode yang ada di model langsung ke file task_scheduler tersebut, layaknya rake task. Mudah dan sederhana bukan? tanpa crontab dan lebih mudah dibaca serta di-maintain dibanding crontab.</p>
]]></content:encoded>
			<wfw:commentRss>http://bintangjatuh.com/2009/08/20/scheduling-with-rufus-scheduler/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Ruby Tips : Add Apidock Ruby Search Engine to Your Firefox</title>
		<link>http://bintangjatuh.com/2009/08/01/ruby-tips-add-apidock-ruby-search-engine-to-your-firefox/</link>
		<comments>http://bintangjatuh.com/2009/08/01/ruby-tips-add-apidock-ruby-search-engine-to-your-firefox/#comments</comments>
		<pubDate>Fri, 31 Jul 2009 17:54:59 +0000</pubDate>
		<dc:creator>gozali</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[apidock]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://bintangjatuh.com/?p=83</guid>
		<description><![CDATA[There are a lot of web app that provides a rich and usable interface for searching Ruby and Ruby on Rails documentation out there. But my favourite is Apidock. One feature that makes Apidock become my favorite is it&#8217;s Search Engine Integration on Mozilla Firefox.
How to add Apidock Search Engine to your Firefox?
Click this url [...]]]></description>
			<content:encoded><![CDATA[<p>There are a lot of web app that provides a rich and usable interface for searching Ruby and Ruby on Rails documentation out there. But my favourite is <a href="http://apidock.com/about">Apidock</a>. One feature that makes Apidock become my favorite is it&#8217;s Search Engine Integration on Mozilla Firefox.</p>
<p><strong>How to add Apidock Search Engine to your Firefox?</strong><br />
Click this url <a href="http://apidock.com/ruby/search?query=Open">http://apidock.com/ruby/search?query=Open</a> and you will find <code>Add Ruby quicksearch to your browser</code> link.</p>
<p><img class="aligncenter size-medium wp-image-84" title="Apidock Search" src="http://bintangjatuh.com/wp-content/uploads/2009/08/Picture-14-300x150.png" alt="Apidock Search" width="300" height="150" /></p>
<p>Click the link and voila! You will get Ruby Search Engine on your browser</p>
<p><img src="http://bintangjatuh.com/wp-content/uploads/2009/08/Picture-15.png" alt="Picture 15" title="Picture 15" width="239" height="281" class="aligncenter size-full wp-image-86" /></p>
<p>Happy searching <img src='http://bintangjatuh.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://bintangjatuh.com/2009/08/01/ruby-tips-add-apidock-ruby-search-engine-to-your-firefox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
