Ruby

RSpactor

rubyphunk:

RSpactor is a little command line tool to automatically run your changed specs (much like autotest). As you may expect, it concentrates on the use of RSpec. It was especially designed to use filesystem events like FSEvent on Leopard (MacOS 10.5) instead of permanently polling a directory structure. RSpactor is currently only working on Mac OS 10.5. But hey: I’m very confident that the next version of RSpactor will work on Linux boxes, too.

LPIC, Oracle, MySQL, Ruby: Certifications

I decided to study for LPIC-1. I already have basic skills of Unix, but not so much about administrating. Also, as my background is unusual, I would like my employer and collegues to make sure what skills I already have. LPIC sounds reasonable because the knowledge is applicable to any Linux systems.

After that, I may study for Oracle Bronze, which is the lowest level in Oracle Certificates. As the lowest level, the exam doesn’t require much knowledge about Oracle-specific skills. Most of the contents are usable in MySQL. Or I may simply take MySQL exams.

In terms of programming, there’s a Ruby certificate. While this sounds promissing, I’m not really sure if it’s worth in everyday programming. The exam just seems to be asking memorization. Look at the sample questions someone else made.. Also, there’s no established book or resources available at this time. I can’t throw $150 for that sort of exam yet.

I’m not a big fan of certificates, but they will help me in some way or other.

P.S.: CompTIA seems less known here in Japan. Also there are some certificates that an organization supported by the govement offers, but they are only taken twice a year (spring and fall), I will avoid them for now.

Using Ruby within TextMate snippets and commands

Unix command: cheat

I found the Unix command cheat very useful. You can invoke text-based cheat sheets from Terminal.

The list of all the cheatsheets is available.

YAML for Ruby

YAML is just a format and is independent from any language. Yaml Cookbook is a good read for those who use YAML with Ruby.

(via Matt Neuburg)

Installing ImageMagick and rmagick in Leopard

Make sure you have have MacPorts installed. Run the command to update your port command and ports available.

sudo port selfupdate
sudo port sync

Note: Run port version. As of this writing, the latest version is 1.600.

Let’s get ImageMagick using port intall.

sudo port install ImageMagick

When it’s done, run port installed and make sure you find ImageMagick. Next, we install Rmagick via gem. Run the command below:

sudo gem install rmagick

Note: It’s rmagick not Rmagick. sudo gem install Rmagick will result in ERROR: could not find Rmagick locally or in a repository.

When it’s done, check if rmagick is installed properly by running gem list. Now we are going to test if rmagick works properly. Create a file called test_rmagick.rb, and copy and paste the code below.

#!/usr/bin/env ruby -wKU

# Test if rmagick is working properly or not.
# When run, this file creates a image file 'path.gif' in the same directory.

# the sample code is from http://rmagick.rubyforge.org/portfolio3.html

require 'rubygems'
require 'rmagick' # Don't use a capital 'R'.

canvas = Magick::Image.new(240, 300,
              Magick::HatchFill.new('white','lightcyan2'))
gc = Magick::Draw.new

gc.fill('red')
gc.stroke('blue')
gc.stroke_width(2)
gc.path('M120,150 h-75 a75,75 0 1, 0 75,-75 z')
gc.fill('yellow')
gc.path('M108.5,138.5 v-75 a75,75 0 0,0 -75,75 z')
gc.draw(canvas)

canvas.write('path.gif')

If you find an image file titled “path.gif” after running the script, your installation is successful.

Ruby and Ruby on Rails Boot Camp

I’m concentrating on learning Ruby and Ruby on Rails. I’ve been learning a lot about Ruby on Rails, but I need to fasten my speed of learning. Here is my plan.

  1. Follow Ruby Cookbook to review String, Numbers, Date, Time, Arrays, Hashes, Code Blocks, Iteration, Objects and Classes
  2. Follow Programming Ruby and complete the tutorial in Part 1.
  3. Follow Programming Ruby and read through Part 2.
  4. Follow Rails for PHP Developers and complete the instruction.
  5. Learn about finder methods in ActiveRecord.
  6. Learn about every validate method in ActiveRecord (plus ActiveRecord:Errors)
  7. Go through helpers especially form-related helpers.
  8. Make a depot app in Agile Web Development with Rails using Rails 2.0.
  9. Read Part 3 in the book above to get a deeper understanding of Rails framework.
  10. Learn a bit about Ajax and Rails.
  11. Learn REST and new routings in Rails.
  12. Learn Testing in Ruby and Ruby on Rails.
  13. Learn a bit about RSpec.

I decided to spend less time on Ajax, caching and deployment. My time is limited, so I need a trade-off. What I really need first is to be more fluent with use of forms, validations and model relationships (one to many, many to many and so forth). I don’t spend a lot in #1 to #3. Understanding one language fully isn’t possible, but following #1 to #3 will give me an overview. (I never get Proc stuff.) #5 to #7 is the most important. Finishing these will give me a good start. Around the time when I work on #8, I will start to create my new app that uses many of the Rails features. I’m not sure how much time is available for #10 to #12. During the learning, I will take notes, and build my own cheat sheets and TextMate snippets. After all of this, I will have more time on Ajax, Web Service, Rails plugins, i18n, popular gems, caching and deployment.

Note: I now use Rails 2.0.

PeepCode Unlimited Subscription

139 dollars for one year. It’s worth. I will start the subscription when I get the next pay.

Installing Ruby on Rails on Leopard

Even though Leopard comes with Ruby on Rails develop environment, we have every reason to install the more recent/better versions.

Dan Benjamin finally released the Leopard edition of the installation tutorial. One of the most trusted sources for installing ruby and other tools.

PHP: Attacking and Defending

For those who subscribe to Matz’s website, the PHP vs Ruby was a hot topic.

My background is:

  • I had basic skills in PHP without OOP.
  • I started to learn a MVC framework in PHP (i.e., symfony).

I just spent a day with ruby. I started to feel the programmer’s happiness.

Syndicate content