<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title>budsus's blog</title>
  <link rel="alternate" type="text/html" href="http://www.thinkruby.org/blog/budsus"/>
  <link rel="self" type="application/atom+xml" href="http://www.thinkruby.org/blog/7/atom/feed"/>
  <id>http://www.thinkruby.org/blog/7/atom/feed</id>
  <updated>2007-03-30T00:57:12-06:00</updated>
  <entry>
    <title>Aptana: the best IDE for RoR</title>
    <link rel="alternate" type="text/html" href="http://www.thinkruby.org/2008/06/53" />
    <id>http://www.thinkruby.org/2008/06/53</id>
    <published>2008-06-21T22:10:55-06:00</published>
    <updated>2008-06-21T22:13:55-06:00</updated>
    <author>
      <name>budsus</name>
    </author>
    <category term="Aptana" />
    <summary type="html"><![CDATA[<p>Hi all, I just want to share about an IDE that already replaced the RadRails for Ruby on Rails IDE, i.e. <a href="http://aptana.com">Aptana</a>. I use this new kind of IDE to create static HTML/XHTML, CSS, JavaScript, Ruby on Rails. This is a greate IDE. I think some of you already use this too. OK..we have to migrate to Aptana.. not RadRails again!</p>
    ]]></summary>
    <content type="html"><![CDATA[<p>Hi all, I just want to share about an IDE that already replaced the RadRails for Ruby on Rails IDE, i.e. <a href="http://aptana.com">Aptana</a>. I use this new kind of IDE to create static HTML/XHTML, CSS, JavaScript, Ruby on Rails. This is a greate IDE. I think some of you already use this too. OK..we have to migrate to Aptana.. not RadRails again!</p>
    ]]></content>
  </entry>
  <entry>
    <title>Game Programming with Ruby</title>
    <link rel="alternate" type="text/html" href="http://www.thinkruby.org/2008/02/51" />
    <id>http://www.thinkruby.org/2008/02/51</id>
    <published>2008-02-22T19:20:05-07:00</published>
    <updated>2008-02-22T19:20:05-07:00</updated>
    <author>
      <name>budsus</name>
    </author>
    <category term="game" />
    <category term="ruby" />
    <summary type="html"><![CDATA[<p>Hi all, I really sorry 'cause I never write at this blog for very long time :D. I want to try to start it again with a small share information. This article is very interested me to figure out about how to programming it with Ruby. Sorry if this blog just like a bookmark.</p>
<p><a href="http://www.oreillynet.com/pub/a/ruby/2007/12/04/creating-games-in-ruby.html">Creating Games in Ruby</a></p>
<p>May be we can try to make ruby as our base language programming. </p>
    ]]></summary>
    <content type="html"><![CDATA[<p>Hi all, I really sorry 'cause I never write at this blog for very long time :D. I want to try to start it again with a small share information. This article is very interested me to figure out about how to programming it with Ruby. Sorry if this blog just like a bookmark.</p>
<p><a href="http://www.oreillynet.com/pub/a/ruby/2007/12/04/creating-games-in-ruby.html">Creating Games in Ruby</a></p>
<p>May be we can try to make ruby as our base language programming. </p>
    ]]></content>
  </entry>
  <entry>
    <title>Ruby for Symbian S60 3rd Edition</title>
    <link rel="alternate" type="text/html" href="http://www.thinkruby.org/2007/08/43" />
    <id>http://www.thinkruby.org/2007/08/43</id>
    <published>2007-08-04T22:57:34-06:00</published>
    <updated>2007-08-04T23:00:46-06:00</updated>
    <author>
      <name>budsus</name>
    </author>
    <category term="Ruby for Symbian" />
    <summary type="html"><![CDATA[<p>I have upload the Ruby Intepreter for Symbian S60 3rd Edition. You can download from this <a href="http://www.thinkruby.org/files/S60RubySigned1.0.2.sis">link</a>, and install it on your Symbian s60 3rd phone cell. There are some limitation features that you can not find in this version. For example, after I tried this intepreter on my N73, I could not pass a parameter when run a script that receive a parameter. Once again, please refer to the <a href="http://developer.symbian.com/main/tools/opensrc/ruby/index.jsp">official Ruby for Symbian</a> site.</p>
    ]]></summary>
    <content type="html"><![CDATA[<p>I have upload the Ruby Intepreter for Symbian S60 3rd Edition. You can download from this <a href="http://www.thinkruby.org/files/S60RubySigned1.0.2.sis">link</a>, and install it on your Symbian s60 3rd phone cell. There are some limitation features that you can not find in this version. For example, after I tried this intepreter on my N73, I could not pass a parameter when run a script that receive a parameter. Once again, please refer to the <a href="http://developer.symbian.com/main/tools/opensrc/ruby/index.jsp">official Ruby for Symbian</a> site.</p>
    ]]></content>
  </entry>
  <entry>
    <title>Ruby on Rails in Netbean 6</title>
    <link rel="alternate" type="text/html" href="http://www.thinkruby.org/2007/05/32" />
    <id>http://www.thinkruby.org/2007/05/32</id>
    <published>2007-05-24T04:57:46-06:00</published>
    <updated>2007-05-24T04:57:46-06:00</updated>
    <author>
      <name>budsus</name>
    </author>
    <category term="Netbean" />
    <category term="Ruby on Rails" />
    <summary type="html"><![CDATA[<p>This is a big jump step for Netbean 6 preview (M9) which is including Ruby and Ruby on Rails plugin in it. I use Netbean since 3.2 version to develop any desktop java application. Now with Netbean 6, I also can develop Ruby on Rails application easily. Here are some Ruby/RoR features that you can use with Netbean 6 :</p>
<p>* Tools > Ruby Gems<br />
this tool will provide you gems package management easily. Netbean 6 will include automatically ActiveRecord-JDBC gems module.</p>
<p>* There are two sample interesting Ruby on Rails applications, i.e. Flickr on Rails Sample App and Ruby Weblog Sample App. With this sample, we can learn many things about Ruby on Rails tips and trick.</p>
<p>* You can create Ruby / Ruby on Rails projects easily </p>
<p>* JRuby is a default ruby intepreter in Netbean 6.</p>
<p>I will continue this conversation with how to develop a simple RoR application with Netbean 6.</p>
    ]]></summary>
    <content type="html"><![CDATA[<p>This is a big jump step for Netbean 6 preview (M9) which is including Ruby and Ruby on Rails plugin in it. I use Netbean since 3.2 version to develop any desktop java application. Now with Netbean 6, I also can develop Ruby on Rails application easily. Here are some Ruby/RoR features that you can use with Netbean 6 :</p>
<p>* Tools > Ruby Gems<br />
this tool will provide you gems package management easily. Netbean 6 will include automatically ActiveRecord-JDBC gems module.</p>
<p>* There are two sample interesting Ruby on Rails applications, i.e. Flickr on Rails Sample App and Ruby Weblog Sample App. With this sample, we can learn many things about Ruby on Rails tips and trick.</p>
<p>* You can create Ruby / Ruby on Rails projects easily </p>
<p>* JRuby is a default ruby intepreter in Netbean 6.</p>
<p>I will continue this conversation with how to develop a simple RoR application with Netbean 6.</p>
    ]]></content>
  </entry>
  <entry>
    <title>Accessing Oracle10g in Ruby On Rails</title>
    <link rel="alternate" type="text/html" href="http://www.thinkruby.org/2007/05/31" />
    <id>http://www.thinkruby.org/2007/05/31</id>
    <published>2007-05-24T02:40:10-06:00</published>
    <updated>2007-05-24T04:29:46-06:00</updated>
    <author>
      <name>budsus</name>
    </author>
    <category term="Oracle10g" />
    <category term="Ruby on Rails" />
    <summary type="html"><![CDATA[<p>If you want to build Ruby on Rails application to connect to Oracle10g database, you have to  install <a href="http://rubyforge.org/projects/ruby-oci8/">Ruby/OCI8</a> from Rubyforge. After downloading and extracting the file, please read README file. Before compiling, I have to check the Oracle connection and prepare some environment variables :</p>
<p><code class="geshifilter">ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE<br />
ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1; export ORACLE_HOME<br />
ORACLE_SID=budsus; export ORACLE_SID<br />
ORACLE_TERM=xterm; export ORACLE_TERM<br />
PATH=$ORACLE_HOME/bin:$PATH; export PATH<br />
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:${LD_LIBRARY_PATH}</code></p>
<p>Here is the sqlplus command to check the Oracle database connection from my session :</p>
<p><code class="geshifilter">sqlplus hr/hr@localhost:1521/budsus</code></p>
<p>If you get the SQL> prompt from SQL*Plus environment, you have successfull to connect to Oracle database.</p>
<p>Here are some steps to create a simple RoR application to access HR.EMPLOYEES table :</p>
<p>1. <code class="geshifilter">rails hr</code></p>
<p>2. I read a helpful documentation from <a href="http://wiki.rubyonrails.org/rails/pages/Oracle">http://wiki.rubyonrails.org/rails/pages/Oracle </a> to help me to understand about the database configuration. Here is my database.yml configuration :</p>
<p><code class="geshifilter">development:<br />
  adapter: oci<br />
  host: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=localhost)(Port=1521))(CONNECT_DATA=(SID=budsus)))<br />
  username: hr<br />
  password: hr</code></p>
<p>(note: if you are using OracleXE, you must use XE as SID)</p>
<p>3. <code class="geshifilter">ruby script/generate model Employee</code></p>
<p>4. <code class="geshifilter">ruby script/generate scaffold Employee</code></p>
<p>5. <code class="geshifilter">ruby script/server</code></p>
<p>From my browser, I can access <code class="geshifilter">http://localhost:3000/employees/list</code>. I hope this article can help you. Thanks</p>
    ]]></summary>
    <content type="html"><![CDATA[<p>If you want to build Ruby on Rails application to connect to Oracle10g database, you have to  install <a href="http://rubyforge.org/projects/ruby-oci8/">Ruby/OCI8</a> from Rubyforge. After downloading and extracting the file, please read README file. Before compiling, I have to check the Oracle connection and prepare some environment variables :</p>
<p><code class="geshifilter">ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE<br />
ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1; export ORACLE_HOME<br />
ORACLE_SID=budsus; export ORACLE_SID<br />
ORACLE_TERM=xterm; export ORACLE_TERM<br />
PATH=$ORACLE_HOME/bin:$PATH; export PATH<br />
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:${LD_LIBRARY_PATH}</code></p>
<p>Here is the sqlplus command to check the Oracle database connection from my session :</p>
<p><code class="geshifilter">sqlplus hr/hr@localhost:1521/budsus</code></p>
<p>If you get the SQL> prompt from SQL*Plus environment, you have successfull to connect to Oracle database.</p>
<p>Here are some steps to create a simple RoR application to access HR.EMPLOYEES table :</p>
<p>1. <code class="geshifilter">rails hr</code></p>
<p>2. I read a helpful documentation from <a href="http://wiki.rubyonrails.org/rails/pages/Oracle">http://wiki.rubyonrails.org/rails/pages/Oracle </a> to help me to understand about the database configuration. Here is my database.yml configuration :</p>
<p><code class="geshifilter">development:<br />
&nbsp; adapter: oci<br />
&nbsp; host: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=localhost)(Port=1521))(CONNECT_DATA=(SID=budsus)))<br />
&nbsp; username: hr<br />
&nbsp; password: hr</code></p>
<p>(note: if you are using OracleXE, you must use XE as SID)</p>
<p>3. <code class="geshifilter">ruby script/generate model Employee</code></p>
<p>4. <code class="geshifilter">ruby script/generate scaffold Employee</code></p>
<p>5. <code class="geshifilter">ruby script/server</code></p>
<p>From my browser, I can access <code class="geshifilter">http://localhost:3000/employees/list</code>. I hope this article can help you. Thanks</p>
    ]]></content>
  </entry>
  <entry>
    <title>Rails in Short Time Workshop</title>
    <link rel="alternate" type="text/html" href="http://www.thinkruby.org/2007/05/30" />
    <id>http://www.thinkruby.org/2007/05/30</id>
    <published>2007-05-24T00:06:56-06:00</published>
    <updated>2007-05-24T00:08:41-06:00</updated>
    <author>
      <name>budsus</name>
    </author>
    <category term="bahasa" />
    <category term="indonesia" />
    <category term="rails in short time" />
    <summary type="html"><![CDATA[<p>In my last workshop, I delivered about how to build a simple Blog application with Ruby on Rails. This workshop was held at Duta Wacana Christian University Yogyakarta, Indonesia from May 21 - 22, 2007. You can download my material of workshop at <a href="/files/rails_in_short_time.odp">here</a> (The document is still in BAHASA Indonesia. I am working to translate it in English). This document is formatted with OpenDocument Presentation (ODP) from OpenOffice.</p>
    ]]></summary>
    <content type="html"><![CDATA[<p>In my last workshop, I delivered about how to build a simple Blog application with Ruby on Rails. This workshop was held at Duta Wacana Christian University Yogyakarta, Indonesia from May 21 - 22, 2007. You can download my material of workshop at <a href="/files/rails_in_short_time.odp">here</a> (The document is still in BAHASA Indonesia. I am working to translate it in English). This document is formatted with OpenDocument Presentation (ODP) from OpenOffice.</p>
    ]]></content>
  </entry>
  <entry>
    <title>Ruby on Symbian/PocketPC</title>
    <link rel="alternate" type="text/html" href="http://www.thinkruby.org/2007/04/25" />
    <id>http://www.thinkruby.org/2007/04/25</id>
    <published>2007-04-12T00:16:24-06:00</published>
    <updated>2007-04-13T11:19:59-06:00</updated>
    <author>
      <name>budsus</name>
    </author>
    <category term="pocketpc" />
    <category term="ruby" />
    <category term="Symbian" />
    <summary type="html"><![CDATA[<p>I tried to install Ruby intepreter on my Nokia 6600. As we know, Nokia 6600 use Symbian 60 2nd edition. <a href="http://ruby-symbian.rubyforge.org/">Ruby intepreter for Symbian 60</a> is a project that will try to port Ruby language for Symbian 60 platform. At the first time installation, my phone is hang. I did'nt know why. Then I restart my phone, and try to install it again. After that, the installation was successful.<br />
How about Ruby for PocketPC? I tried to search on prof. Google :D. And I found very little precisely information about that. One interesting information is "please try to search again with <i>gcc PocketPC</i> keyword" :D. With those keyword, I got <a href="http://www.windowsfordevices.com/articles/AT3563056498.html">http://www.windowsfordevices.com/articles/AT3563056498.html</a>. Hmm..interesting. But, after I tried to visit <a href="http://mifki.ru/pocketgcc">http://mifki.ru/pocketgcc</a> about 10 times, the domain is not exist anymore. :(( Did anybody have any other information about porting Ruby for PocketPC? If we can get GCC cross compiler for pocketpc, may be we can compile Ruby on that too. I hope....hope..and hope.</p>
    ]]></summary>
    <content type="html"><![CDATA[<p>I tried to install Ruby intepreter on my Nokia 6600. As we know, Nokia 6600 use Symbian 60 2nd edition. <a href="http://ruby-symbian.rubyforge.org/">Ruby intepreter for Symbian 60</a> is a project that will try to port Ruby language for Symbian 60 platform. At the first time installation, my phone is hang. I did'nt know why. Then I restart my phone, and try to install it again. After that, the installation was successful.<br />
How about Ruby for PocketPC? I tried to search on prof. Google :D. And I found very little precisely information about that. One interesting information is "please try to search again with <i>gcc PocketPC</i> keyword" :D. With those keyword, I got <a href="http://www.windowsfordevices.com/articles/AT3563056498.html">http://www.windowsfordevices.com/articles/AT3563056498.html</a>. Hmm..interesting. But, after I tried to visit <a href="http://mifki.ru/pocketgcc">http://mifki.ru/pocketgcc</a> about 10 times, the domain is not exist anymore. :(( Did anybody have any other information about porting Ruby for PocketPC? If we can get GCC cross compiler for pocketpc, may be we can compile Ruby on that too. I hope....hope..and hope.</p>
    ]]></content>
  </entry>
  <entry>
    <title>Ruby on Collaboration</title>
    <link rel="alternate" type="text/html" href="http://www.thinkruby.org/2007/04/24" />
    <id>http://www.thinkruby.org/2007/04/24</id>
    <published>2007-04-11T23:56:19-06:00</published>
    <updated>2007-04-12T00:03:13-06:00</updated>
    <author>
      <name>budsus</name>
    </author>
    <category term="collaboa" />
    <category term="Collaboration" />
    <category term="devalot" />
    <category term="ruby" />
    <category term="trac" />
    <summary type="html"><![CDATA[<p>Today, I have been reminded about web based collaboration products that possibly could be used also by the Thinkruby.org community to try to develop a small project with Ruby. There are some interested products for collaboration which was developed with Ruby on Rails. Here are some of those :<br />
* <a href="http://collaboa.org/">Collaboa</a><br />
* <a href="http://software.pmade.com/devalot">Devalot</a><br />
* <a href="http://trac.typosphere.org/">Typo</a></p>
<p>As long as I know, all of those products have some features that support for almost of software project management tools. I still need to try and evaluate about those products beside of still to keep study about software project management.</p>
    ]]></summary>
    <content type="html"><![CDATA[<p>Today, I have been reminded about web based collaboration products that possibly could be used also by the Thinkruby.org community to try to develop a small project with Ruby. There are some interested products for collaboration which was developed with Ruby on Rails. Here are some of those :<br />
* <a href="http://collaboa.org/">Collaboa</a><br />
* <a href="http://software.pmade.com/devalot">Devalot</a><br />
* <a href="http://trac.typosphere.org/">Typo</a></p>
<p>As long as I know, all of those products have some features that support for almost of software project management tools. I still need to try and evaluate about those products beside of still to keep study about software project management.</p>
    ]]></content>
  </entry>
  <entry>
    <title>Calling Java Class from in Ruby</title>
    <link rel="alternate" type="text/html" href="http://www.thinkruby.org/2007/04/21" />
    <id>http://www.thinkruby.org/2007/04/21</id>
    <published>2007-04-03T22:34:57-06:00</published>
    <updated>2007-04-06T18:26:38-06:00</updated>
    <author>
      <name>budsus</name>
    </author>
    <category term="gem" />
    <category term="java" />
    <category term="rjb" />
    <category term="ruby" />
    <summary type="html"><![CDATA[<p>Last sunday evening (02/04), I tried to use rjb package. rjb is ruby-java bridge using JNI (Java Native Interface) which is with this package we can call java class from Ruby script. rjb package was started as one of rubyforge.org projects since 2006-08-01 by Arton Tajima. I tried this package in my Fedora Core 6 machine with JDK 6.0. Here some steps that I used to install and run rjb :</p>
<p>1. be sure that you have JRE/JDK 1.4.2 or higher in your machine<br />
2. you have to setup two environment shell variables JAVA_HOME and LD_LIBRARY_PATH. Here is an example of those variables :</p>
<p><pre class="geshifilter"><ol><li style=""><div style="font-weight: normal;"><span style="color: #000066;">export</span> <span style="color: #0000ff;">JAVA_HOME=</span>/usr/java/jdk1<span style="color: #cc66cc;">.6</span><span style="color: #cc66cc;">.0</span></div></li><li style=""><div style="font-weight: normal;"><span style="color: #0000ff;">PATH=</span><span style="color: #0000ff;">$PATH</span>:<span style="color: #0000ff;">$HOME</span>/bin:<span style="color: #0000ff;">$JAVA_HOME</span>/bin</div></li><li style=""><div style="font-weight: normal;"><span style="color: #000066;">export</span> <span style="color: #0000ff;">LD_LIBRARY_PATH=</span><span style="color: #0000ff;">$LD_LIBRARY_PATH</span>:<span style="color: #0000ff;">$JAVA_HOME</span>/jre/lib/i386:<span style="color: #0000ff;">$JAVA_HOME</span>/jre/lib/i386/client</div></li></ol></pre></p>
<p>3. then, you can install rjb with gem tool like this</p>
<p><pre class="geshifilter"><ol><li style=""><div style="font-weight: normal;">gem install rjb --include-dependencies</div></li></ol></pre></p>
<p>4. if your installation successful, then you can try to create a new Java class. Here is an example, Circle class. This class have some methods to get/set R and calculations about a circle, like area and circumference.</p>
    ]]></summary>
    <content type="html"><![CDATA[<p>Last sunday evening (02/04), I tried to use rjb package. rjb is ruby-java bridge using JNI (Java Native Interface) which is with this package we can call java class from Ruby script. rjb package was started as one of rubyforge.org projects since 2006-08-01 by Arton Tajima. I tried this package in my Fedora Core 6 machine with JDK 6.0. Here some steps that I used to install and run rjb :</p>
<p>1. be sure that you have JRE/JDK 1.4.2 or higher in your machine<br />
2. you have to setup two environment shell variables JAVA_HOME and LD_LIBRARY_PATH. Here is an example of those variables :</p>
<p><pre class="geshifilter"><ol><li style=""><div style="font-weight: normal;"><span style="color: #000066;">export</span> <span style="color: #0000ff;">JAVA_HOME=</span>/usr/java/jdk1<span style="color: #cc66cc;">.6</span><span style="color: #cc66cc;">.0</span></div></li><li style=""><div style="font-weight: normal;"><span style="color: #0000ff;">PATH=</span><span style="color: #0000ff;">$PATH</span>:<span style="color: #0000ff;">$HOME</span>/bin:<span style="color: #0000ff;">$JAVA_HOME</span>/bin</div></li><li style=""><div style="font-weight: normal;"><span style="color: #000066;">export</span> <span style="color: #0000ff;">LD_LIBRARY_PATH=</span><span style="color: #0000ff;">$LD_LIBRARY_PATH</span>:<span style="color: #0000ff;">$JAVA_HOME</span>/jre/lib/i386:<span style="color: #0000ff;">$JAVA_HOME</span>/jre/lib/i386/client</div></li></ol></pre></p>
<p>3. then, you can install rjb with gem tool like this</p>
<p><pre class="geshifilter"><ol><li style=""><div style="font-weight: normal;">gem install rjb --include-dependencies</div></li></ol></pre></p>
<p>4. if your installation successful, then you can try to create a new Java class. Here is an example, Circle class. This class have some methods to get/set R and calculations about a circle, like area and circumference.<br />
<!--break--><br />
<pre class="geshifilter"><ol><li style=""><div style="font-weight: normal;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Circle <span style="color: #66cc66;">&#123;</span></div></li><li style=""><div style="font-weight: normal;">  <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #993333;">double</span> r;</div></li><li style=""><div style="font-weight: normal;">  <span style="color: #000000; font-weight: bold;">public</span> Circle<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">r</span> = <span style="color: #cc66cc;">0</span>.0D; <span style="color: #66cc66;">&#125;</span></div></li><li style=""><div style="font-weight: normal;">  <span style="color: #000000; font-weight: bold;">public</span> Circle<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">double</span> r<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span> setR<span style="color: #66cc66;">&#40;</span>r<span style="color: #66cc66;">&#41;</span>; <span style="color: #66cc66;">&#125;</span></div></li><li style=""><div style="font-weight: normal;">  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #993333;">void</span> setR<span style="color: #66cc66;">&#40;</span><span style="color: #993333;">double</span> r<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">r</span> = r;<span style="color: #66cc66;">&#125;</span></div></li><li style=""><div style="font-weight: normal;">  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #993333;">double</span> getR<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006600;">r</span>; <span style="color: #66cc66;">&#125;</span></div></li><li style=""><div style="font-weight: normal;">  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #993333;">double</span> getArea<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div></li><li style=""><div style="font-weight: normal;">    <span style="color: #000000; font-weight: bold;">return</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AMath+java.sun.com&amp;bntI=I%27m%20Feeling%20Lucky"><span style="color: #aaaadd; font-weight: bold;">Math</span></a>.<span style="color: #006600;">PI</span> * getR<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> * getR<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style=""><div style="font-weight: normal;">  <span style="color: #66cc66;">&#125;</span></div></li><li style=""><div style="font-weight: normal;">  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #993333;">double</span> getCircum<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>  <span style="color: #808080; font-style: italic;">// Circumference</span></div></li><li style=""><div style="font-weight: normal;">    <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #cc66cc;">2</span> * <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AMath+java.sun.com&amp;bntI=I%27m%20Feeling%20Lucky"><span style="color: #aaaadd; font-weight: bold;">Math</span></a>.<span style="color: #006600;">PI</span> * getR<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style=""><div style="font-weight: normal;">  <span style="color: #66cc66;">&#125;</span></div></li><li style=""><div style="font-weight: normal;"><span style="color: #66cc66;">&#125;</span></div></li></ol></pre></p>
<p>save it with Circle.java.</p>
<p>5. compile with javac</p>
<p><pre class="geshifilter"><ol><li style=""><div style="font-weight: normal;">javac Circle.java</div></li></ol></pre></p>
<p>6. If there are no errors after compilation, you will get a new file called Circle.class.<br />
7. Now, we will start to make a program in Ruby which will use rjb to call our java Circle class in from Ruby program. Please type this program below in your editor :</p>
<p><pre class="geshifilter"><ol><li style=""><div style="font-weight: normal;"><span style="color:#008000; font-style:italic;">#!/usr/bin/ruby -w</span></div></li><li style=""><div style="font-weight: normal;"><span style="color:#CC0066; font-weight:bold;">require</span> 'rubygems'</div></li><li style=""><div style="font-weight: normal;">gem 'rjb'</div></li><li style=""><div style="font-weight: normal;"><span style="color:#CC0066; font-weight:bold;">require</span> 'rjb'</div></li><li style=""><div style="font-weight: normal;">Rjb::<span style="color:#CC0066; font-weight:bold;">load</span><span style="color:#006600; font-weight:bold;">&#40;</span>classpath = '.', jvmargs=<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div></li><li style=""><div style="font-weight: normal;">circle = Rjb::import<span style="color:#006600; font-weight:bold;">&#40;</span>'Circle'<span style="color:#006600; font-weight:bold;">&#41;</span></div></li><li style=""><div style="font-weight: normal;">c = circle.<span style="color:#9900CC;">new</span></div></li><li style=""><div style="font-weight: normal;">c.<span style="color:#9900CC;">setR</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">10.0</span><span style="color:#006600; font-weight:bold;">&#41;</span></div></li><li style=""><div style="font-weight: normal;"><span style="color:#CC0066; font-weight:bold;">puts</span> c.<span style="color:#9900CC;">getArea</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div></li><li style=""><div style="font-weight: normal;"><span style="color:#CC0066; font-weight:bold;">puts</span> c.<span style="color:#9900CC;">getCircum</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div></li></ol></pre></p>
<p>save it as rjbtest.rb for example.</p>
<p>8. you can call our script with command:<br />
    <pre class="geshifilter"><ol><li style=""><div style="font-weight: normal;"><span style="color: #808080; font-style: italic;"># ruby rjbtest.rb</div></li><li style=""><div style="font-weight: normal;"></span>    <span style="color: #cc66cc;">314.159265358979</span></div></li><li style=""><div style="font-weight: normal;">    <span style="color: #cc66cc;">62.8318530717959</span></div></li></ol></pre></p>
<p>In this example, we have successfully called a java class in Ruby program. Enjoy the Ruby.</p>
    ]]></content>
  </entry>
  <entry>
    <title>Accessing Yahoo! Finance Currency Rate Service</title>
    <link rel="alternate" type="text/html" href="http://www.thinkruby.org/2007/03/18" />
    <id>http://www.thinkruby.org/2007/03/18</id>
    <published>2007-03-29T23:29:36-06:00</published>
    <updated>2007-03-30T00:57:12-06:00</updated>
    <author>
      <name>budsus</name>
    </author>
    <category term="currency converter" />
    <category term="ruby" />
    <category term="Yahoo! Finance" />
    <summary type="html"><![CDATA[<p>Every of you absolutely know about Yahoo!. There are many services in there, and all of that services can be accessed either free or not. In this moment, we will use Yahoo! Finance to get currency rate information in CSV (Comma Separate Value) format. With this format, we can parse it more easily. We will use Ruby language to develop a class, which we will called it YahooCurrency class. The purpose of this development is to provide a generic class that can be used to access Yahoo currency rate information easily.</p>
<p>First of all, we should know about Yahoo Currency Rate information in CSV format. You can try to visit this url address: </p>
<p><a href="http://quote.yahoo.com/d/quotes.csv?s=USDIDR=X&amp;f=nl1d1t1" title="http://quote.yahoo.com/d/quotes.csv?s=USDIDR=X&amp;f=nl1d1t1">http://quote.yahoo.com/d/quotes.csv?s=USDIDR=X&amp;f=nl1d1t1</a></p>
<p>From those address, we will get a CSV file which provides an information about currency rate from USD to ID Rupiah currency, including the date of access. Here are an example of the result:</p>
<p>USD to IDR,9795.00,"8/9/2005","7:19am"</p>
<p>We also can get more simple result, i.e. only one value of currency rate. You can try this:</p>
<p><a href="http://finance.yahoo.com/d/quotes.csv?s=USDIDR=X&amp;f=l1" title="http://finance.yahoo.com/d/quotes.csv?s=USDIDR=X&amp;f=l1">http://finance.yahoo.com/d/quotes.csv?s=USDIDR=X&amp;f=l1</a></p>
<p>If you want to know more about HTTP GET request format for Yahoo! Quote or Finance, please visit  <a href="http://gummy-stuff.org/forex.htm" title="http://gummy-stuff.org/forex.htm">http://gummy-stuff.org/forex.htm</a>.</p>
<p>In Ruby, there is a class that we can use it to access web server with HTTP Protocol. The name of class is Net::HTTP which is come from net/http package. If you want to make HTTP Get request behind of a proxy, you also can use class Net::HTTP::Proxy. You can see <a href="/node/19">the code of my class</a> which have some methods to access Yahoo! Finance Currency Rate information. If you want to use that class, here is an example of using that class:</p>
<p><pre class="geshifilter"><ol><li style=""><div style="font-weight: normal;"><span style="color:#008000; font-style:italic;">#!/usr/bin/ruby -w</span></div></li><li style=""><div style="font-weight: normal;"><span style="color:#008000; font-style:italic;">#@2007 by Budi Susanto</span></div></li><li style=""><div style="font-weight: normal;"><span style="color:#008000; font-style:italic;">#an example of how to use YahooCurrency class</span></div></li><li style=""><div style="font-weight: normal;"><span style="color:#008000; font-style:italic;">#</span></div></li><li style=""><div style="font-weight: normal;"><span style="color:#CC0066; font-weight:bold;">require</span> 'yahoo_currency'</div></li><li style=""><div style="font-weight: normal;"><span style="color:#008000; font-style:italic;">#format the arguments</span></div></li><li style=""><div style="font-weight: normal;">from = ARGV<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&#93;</span></div></li><li style=""><div style="font-weight: normal;">to = ARGV<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">1</span><span style="color:#006600; font-weight:bold;">&#93;</span></div></li><li style=""><div style="font-weight: normal;">amnt = ARGV<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">2</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">to_f</span></div></li><li style=""><div style="font-weight: normal;">ycurr = YahooCurrency.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div></li><li style=""><div style="font-weight: normal;">ycurr.<span style="color:#9900CC;">setupProxy</span><span style="color:#006600; font-weight:bold;">&#40;</span>'<span style="color:#006666;">192.168</span><span style="color:#006666;">.2</span><span style="color:#006666;">.51</span>', <span style="color:#006666;">8080</span><span style="color:#006600; font-weight:bold;">&#41;</span></div></li><li style=""><div style="font-weight: normal;">ycurr.<span style="color:#9900CC;">setFrom</span><span style="color:#006600; font-weight:bold;">&#40;</span>from<span style="color:#006600; font-weight:bold;">&#41;</span></div></li><li style=""><div style="font-weight: normal;">ycurr.<span style="color:#9900CC;">setTo</span><span style="color:#006600; font-weight:bold;">&#40;</span>to<span style="color:#006600; font-weight:bold;">&#41;</span></div></li><li style=""><div style="font-weight: normal;"><span style="color:#CC0066; font-weight:bold;">printf</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;Convertion Results: %10.5f %s<span style="color:#000099;">\n</span>&quot;</span>, ycurr.<span style="color:#9900CC;">doConversion</span><span style="color:#006600; font-weight:bold;">&#40;</span>amnt<span style="color:#006600; font-weight:bold;">&#41;</span>, to<span style="color:#006600; font-weight:bold;">&#41;</span></div></li></ol></pre></p>
<p>If you have any suggestion about my script, please fill free to contact me. :D<br />
(Just for ThinkRuby.org...)</p>
    ]]></summary>
    <content type="html"><![CDATA[<p>Every of you absolutely know about Yahoo!. There are many services in there, and all of that services can be accessed either free or not. In this moment, we will use Yahoo! Finance to get currency rate information in CSV (Comma Separate Value) format. With this format, we can parse it more easily. We will use Ruby language to develop a class, which we will called it YahooCurrency class. The purpose of this development is to provide a generic class that can be used to access Yahoo currency rate information easily.</p>
<p>First of all, we should know about Yahoo Currency Rate information in CSV format. You can try to visit this url address: </p>
<p><a href="http://quote.yahoo.com/d/quotes.csv?s=USDIDR=X&amp;f=nl1d1t1" title="http://quote.yahoo.com/d/quotes.csv?s=USDIDR=X&amp;f=nl1d1t1">http://quote.yahoo.com/d/quotes.csv?s=USDIDR=X&amp;f=nl1d1t1</a></p>
<p>From those address, we will get a CSV file which provides an information about currency rate from USD to ID Rupiah currency, including the date of access. Here are an example of the result:</p>
<p>USD to IDR,9795.00,"8/9/2005","7:19am"</p>
<p>We also can get more simple result, i.e. only one value of currency rate. You can try this:</p>
<p><a href="http://finance.yahoo.com/d/quotes.csv?s=USDIDR=X&amp;f=l1" title="http://finance.yahoo.com/d/quotes.csv?s=USDIDR=X&amp;f=l1">http://finance.yahoo.com/d/quotes.csv?s=USDIDR=X&amp;f=l1</a></p>
<p>If you want to know more about HTTP GET request format for Yahoo! Quote or Finance, please visit  <a href="http://gummy-stuff.org/forex.htm" title="http://gummy-stuff.org/forex.htm">http://gummy-stuff.org/forex.htm</a>.</p>
<p>In Ruby, there is a class that we can use it to access web server with HTTP Protocol. The name of class is Net::HTTP which is come from net/http package. If you want to make HTTP Get request behind of a proxy, you also can use class Net::HTTP::Proxy. You can see <a href="/node/19">the code of my class</a> which have some methods to access Yahoo! Finance Currency Rate information. If you want to use that class, here is an example of using that class:</p>
<p><pre class="geshifilter"><ol><li style=""><div style="font-weight: normal;"><span style="color:#008000; font-style:italic;">#!/usr/bin/ruby -w</span></div></li><li style=""><div style="font-weight: normal;"><span style="color:#008000; font-style:italic;">#@2007 by Budi Susanto</span></div></li><li style=""><div style="font-weight: normal;"><span style="color:#008000; font-style:italic;">#an example of how to use YahooCurrency class</span></div></li><li style=""><div style="font-weight: normal;"><span style="color:#008000; font-style:italic;">#</span></div></li><li style=""><div style="font-weight: normal;"><span style="color:#CC0066; font-weight:bold;">require</span> 'yahoo_currency'</div></li><li style=""><div style="font-weight: normal;"><span style="color:#008000; font-style:italic;">#format the arguments</span></div></li><li style=""><div style="font-weight: normal;">from = ARGV<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&#93;</span></div></li><li style=""><div style="font-weight: normal;">to = ARGV<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">1</span><span style="color:#006600; font-weight:bold;">&#93;</span></div></li><li style=""><div style="font-weight: normal;">amnt = ARGV<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">2</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">to_f</span></div></li><li style=""><div style="font-weight: normal;">ycurr = YahooCurrency.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div></li><li style=""><div style="font-weight: normal;">ycurr.<span style="color:#9900CC;">setupProxy</span><span style="color:#006600; font-weight:bold;">&#40;</span>'<span style="color:#006666;">192.168</span><span style="color:#006666;">.2</span><span style="color:#006666;">.51</span>', <span style="color:#006666;">8080</span><span style="color:#006600; font-weight:bold;">&#41;</span></div></li><li style=""><div style="font-weight: normal;">ycurr.<span style="color:#9900CC;">setFrom</span><span style="color:#006600; font-weight:bold;">&#40;</span>from<span style="color:#006600; font-weight:bold;">&#41;</span></div></li><li style=""><div style="font-weight: normal;">ycurr.<span style="color:#9900CC;">setTo</span><span style="color:#006600; font-weight:bold;">&#40;</span>to<span style="color:#006600; font-weight:bold;">&#41;</span></div></li><li style=""><div style="font-weight: normal;"><span style="color:#CC0066; font-weight:bold;">printf</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;Convertion Results: %10.5f %s<span style="color:#000099;">\n</span>&quot;</span>, ycurr.<span style="color:#9900CC;">doConversion</span><span style="color:#006600; font-weight:bold;">&#40;</span>amnt<span style="color:#006600; font-weight:bold;">&#41;</span>, to<span style="color:#006600; font-weight:bold;">&#41;</span></div></li></ol></pre></p>
<p>If you have any suggestion about my script, please fill free to contact me. :D<br />
(Just for ThinkRuby.org...)</p>
    ]]></content>
  </entry>
</feed>
