RSS

Archive for the ‘Beginner’ Category

 Fixing RubyGems in Ubuntu Gutsy Installation

Upgrading to the latest RubyGems in Ubuntu Gutsy is a bit non-straightforward. I’d like to share a quick fix this time. It’s trivial when you know it, but if not, a friend of mine has almost hosed his system just because of this annoying “bug”.

Installing Ruby in Ubuntu is pretty simple:

sudo aptitude install ruby ri irb rdoc rubygems libruby-extras libmysql-ruby ruby1.8-dev

(add other packages as you see fit)

The problem occurs right after you upgrade RubyGems to the latest version:

24 Mar 2008

Fixing RubyGems in Ubuntu Gutsy Installation

Author: ceefour | Filed under: Beginner, Complaints, Ruby, Tips, Tools, Tutorials

A common stumbling block for beginner Rails developers is learning the basics required to write plugins. This is made more complicated by the fact that Ruby is inherently dynamic and offers many techniques for code reuse.

Luckily, if you can write Rails applications you can write plugins by simply drawing on a handful of basic patterns.

Why write plugins?

Writing a plugin will:

  • Help make sharing code more efficient, whether it’s between projects or within the same project
  • Allow you to publish generic code to the community
  • Save time and increase your confidence by testing once and reusing many times
27 Jan 2008

Overview of A Rails Plugin

Author: ceefour | Filed under: Beginner, Plugins, Rails, Tips, Tools, Tutorials

We’ve been doing a lot of scraping and mashups lately. So we’d love to share on how to do this. Fortunately Schadenfreude has written a good tutorial about using Mechanize and Hpricot to scrape Gmail.

The tutorial uses mechanize and hpricot to login to gmail and return a list of Unread emails.

Installation of required tools

gem install mechanize --include-dependencies

This will install both mechanize and hpricot.

Usage

If you simply want to write simple GUI desktop applications, Ruby with Shoes is a quick way to do it.

Example session in my computer:

Shoes01 Shoes, the Ruby Desktop GUI Toolkit

The code for that Timer GUI application is taken from the Shoes samples, which is concise enough for me to put it here:

Shoes.app :height => 150, :width => 250 do
  background rgb(240, 250, 208)
  stack :margin => 10 do
    button "Start" do
      @time = Time.now
      @label.replace "Stop watch started at #@time"
    end
    button "Stop" do
      @label.replace "Stopped, ", strong("#{Time.now - @time}"), " seconds elapsed."
    end
    @label = para "Press ", strong("start"), " to begin timing."
  end
end

To install Shoes on Ubuntu, it needs some dependencies which fortunately are very easy to install:

10 Nov 2007

Shoes, the Ruby Desktop GUI Toolkit

Author: ceefour | Filed under: Beginner, Cool, GUI, Ruby, Tools

1206281509 ce53f3d7ff The Best microformats Resources for Web 2.0 Developers

microformats has been only two years old, yet it has brought significant changes in a relatively short time.

What is it, actually? According to microformats.org, “[microformats is] designed for humans first and machines second, [they] are a set of simple, open data formats built upon existing and widely adopted standards.”

Enough with the fluff, let’s see how it actually works, microformats in action:

1408453688 afda913dd5 The Best microformats Resources for Web 2.0 Developers
Flickr picture source

The above picture is me browsing to the LinkedIn profile of one of Indonesia’s renowned Ruby on Rails experts, Arie Kusuma Atmaja. The overlay window that contains these semantic information is not a LinkedIn feature. Rather, it is the easily usable, cross-browser Microformats Bookmarklet by LeftLogic. Go on… try it if you haven’t!

netbeans6 only Ruby on Rails Developers IDE, NetBeans 6 Beta 1 is Out!

NetBeans 6 Beta 1 is here!!

Let’s rock the boat icon smile Ruby on Rails Developers IDE, NetBeans 6 Beta 1 is Out!

It’s the first significant NetBeans event in probably a year icon smile Ruby on Rails Developers IDE, NetBeans 6 Beta 1 is Out!

NetBeans isn’t only for Java geeks anymore, it has tons of Ruby and Ruby on Rails support now!

What surprises me (and delights me!) about this release is that, not like previous NetBeans 6 milestones where NetBeans-Java is bundled with Ruby, they actually make a special Ruby-only version.

The Ruby-only download is mere 19 MB in size!

 A Better Way to GUI Ruby Apps

Profligacy is a JRuby library that makes building Swing Graphical User Interface much easier than with Raw code. It’s not a builder as with many other projects, but instead a simple Ruby way to structure the UI for the 80% common cases you’ll encounter.

It’s actively used in the Utu iHate client. iHate started as a RubyCocoa project and then convert to JRuby and Swing.

The purpose of Profligacy is not to be a complete way of hiding Swing components from you. You’ll still be making JButtons and JLabels, you’ll just be putting them into a Ruby idiomatic code structure that doesn’t make your eyes hemorrhage diarrhea like when you try to code in Java.

24 Aug 2007

A Better Way to GUI Ruby Apps

Author: ceefour | Filed under: Beginner, Cool, GUI, News, Praises, Ruby, Tools

Some people asked me about SVK so here it is. Quickly written because I am a bit lazy and sleepy right now.

SVK is a distributed version control system. In other words, it allows you to mirror a Subversion repository, have local commits, pull changes from upstream, and synchronize/merge it back to the remote Subversion server if you want.

English version

UPDATE: This is an outdated version. The most up-to-date version with newer tips and tricks is in wiki Ruby Indonesia: SVK, which unfortunately is only available in Indonesian. icon wink SVK Quick Start Guide

Method 1: Use Subversion repository, but SVK working copy

22 Aug 2007

SVK Quick Start Guide

Author: ceefour | Filed under: Beginner, Cool, Enterprise, Indonesia, Praises, Ruby, Tips, Tools, Tutorials

Who said Capistrano is for Ruby on Rails only?

 Deploying Joomla using Capistrano 2.0

That’s probably the major tagline of the whole Capistrano 2.0 saga. You can use it to deploy PHP, Django, or not doing any deployment at all. Let me demonstrate, this time using Joomla:

Capistrano adalah library/tool yang digunakan untuk meng-online-kan aplikasi Ruby on Rails, tapi bisa juga digunakan untuk aplikasi PHP, misalnya Joomla:

Tau gak twitter tuh punya API

 Twitter API, Gampang Koq :))

Ini contoh penggunaannya:

ceefour@ojalanow:~/bin$ salsabeela 'untuk sekarang enak gini'
Sending salsabeela 'untuk sekarang enak gini' '.... OK!
ceefour@ojalanow:~/bin$ salsabeela 'gak perlu mandi tiap hari icon razz Twitter API, Gampang Koq :)) '
Sending salsabeela 'gak perlu mandi tiap hari icon razz Twitter API, Gampang Koq :)) '.... OK!
ceefour@ojalanow:~/bin$ cat salsabeela
#!/usr/bin/ruby
require "#{File.dirname(__FILE__)}/twitter_pm"
send_pm 'salsabeela', ARGV.join(' ')

isi twitter_pm.rb :

ceefour@ojalanow:~/bin$ cat twitter_pm.rb
require 'rubygems'
gem 'twitter4r', '>=0.2.0'
require 'twitter'