NEW: For a prettier blog interface, see the Wordpress version!
Tasks
| B | C | Check out http://rubyforge.org/projects/ri-emacs/ : Chat with :kuribas on sterling.freenode.net#ruby-lang (nil) |
| B | X | File bug for ruby-default (2005.02.09) |
| B | X | File bug for require (2005.02.09) |
| B | X | Track down ri maintainer : planner (2005.02.09) |
| B | X | Check out Ruby stuff : 2005.01.21:5 (nil) |
Notes
1. Adventures with Ruby
This is my second day of Ruby, a programming language that is rather popular in Japan. I'm in love. It's now my second-favorite programming language. (Emacs Lisp is, of course, the first.)
Yesterday's script parsed schedule data and checked that monthly cost and day constraints were observed. Today I wanted to visualize the verified schedule.
At first I tried working with planner (formerly known as MrProject and not to be confused with PlannerMode). I wrote a Ruby program that converted my schedule.csv into XML, and planner loaded it successfully. However, I didn't think planner would let me do funky color coding. I thought about using etask, but ended up deciding to write something using libgd-ruby.
It was surprisingly easy to write a Gantt-like visualizer for the schedule and even easier to manipulate it once I had written it. For example, I could do silly things like
s.to_image((s.schedule.sort { |a,b| a.start <=> b.start }, 0, 2500, 1800, image)
to see the tasks sorted by start date. Being a Lisp girl, I had no problems writing silly things like
s.to_image((s.schedule.collect { |x| x if x.person_id == '08-1' } - [ nil ]).sort { |a,b| a.start <=> b.start }, 0, 2500, 1800, image) but then I realized that this was much cleaner:
s.to_image((s.schedule.sort { |a,b| x = a.person_id <=> b.person_id; if x == 0 then a.start <=> b.start else x end }, 0, 2500, 1800, image)
Ruby is so cute!
I'd love to hear about any questions, comments, suggestions or links that you might have. Your comments will not be posted on this website immediately, but will be e-mailed to me first. You can use this form to get in touch with me, or e-mail me at sacha@sachachua.com .