February 4, 2005

Bulk view

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)

Sorted by start date

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)

Sorted by person and then start date

Ruby is so cute!

On Technorati:

ri-mode bug when there is no current word

I replaced the stock implementation of ruby-default-ri-entry with the
following code so that I could use it even if I didn’t have a current

(defun ruby-default-ri-entry ()
  (let (word)
      (setq word (or (current-word) ""))
      (if (string-match "[._]+$" word)
	  (setq word (substring word 0 (match-beginning 0))))
      (format "%s%s"


On Technorati:

Upgrade yourself! =)

Creating Passionate Users
is a great blog just full of insights. The latest gem is about upgrading users.

Right, that’s you. (If you don’t use Planner, read on; maybe I can
convince you to try it out.)

Planner probably isn’t interesting in itself. _You_ make Planner way
cool. You aren’t just an anonymous person who uses Planner. You are a
bundle of unique ways of doing things and maybe I can come up with
things that fit you better. I want to know how you think. What makes
you tick. How you keep yourself from going crazy even though you have
to keep track of so many things.

(If this is starting to freak you out, don’t worry; you can pretend
I’m just like any other maintainer out there. ;) Ignore that large
BBDB in the corner.)

I don’t think of myself as hacking just Emacs Lisp. I’m hacking your
process. Your way of doing things. _Real_ planner development happens
inside _your_ head when you come up with a nifty idea or something
you’d like improved. Real planner development happens when you take a
look at the way you do things and wonder if you can do them better. My
job is to keep track of all these little things people want to do and
see if someone else has already done it, I can help you do it, or I
can hack it in myself. The Japanese have a word for continuous
improvement—kaizen. Process optimization.

We make a lot of progress in small steps. Take that +tue feature. It’s
not a big thing, but it brings Planner _juuust_ a little closer to the
way a lot of people think. Who knows what kind of hacks it just made
easier? John Sullivan has plans for that feature, mainly for his
template hacks.

The end result is that Planner is this strange, almost bewildering
personal information manager that just keeps growing and growing.
Sure, the quickstart introduces the essential parts of the system, but
there’s much more to it. I’m here to guide you through it. I’d love to
ask questions to help you figure out how you plan. I’d love to suggest
ways of doing things. =) Whether you’re a Franklin/Covey or GTD geek
or you’re using a funky home-brew kind of planning method that changes
all the time (I’m like that!), I’d like to think we can get Planner or
some other Emacs-based PIM to dance to your tune.

(Of course, there’s the danger of spending too much time hacking your
process and too little time actually doing things, but I think we can
keep ourselves from going overboard.)

So there. Sure, the mailing list is usually where software updates are
announced, but think of it as meant for user upgrading.

Keep the suggestions coming. Share your thoughts!

Creating Passionate Users: Upgrade your users, not just your product

On Technorati:


687 words

Linlin couldn’t wait for the fireworks to start. While her parents
watched the New Year’s special on TV, Linlin sat by the window, never
taking her eyes off the sky.

A loud wail cut through the cool night air. She didn’t know they made
firecrackers that sounded like alarm clocks, and she looked around to
find out what part of the city had already started celebrating. The
sky was still dark. It was as if the whole city was holding its

The ringing continued. She looked down and was surprised to find a cat
nestled against a big alarm clock that was ringing so hard it

The cat was fast asleep.

It was not every day that she saw a stray cat on her balcony (they
were on the 15th floor, after all) and this was certainly the only cat
she’d ever seen with an alarm clock. She shook the cat gently. “Excuse
me, Mr. Cat, wake up, wake up…”

The cat yawned and mumbled, “Just a few more minutes, Mouse…”
It then turned over and went back to sleep.

A talking cat! She talked to animals all the time, but this was the
first time one talked to her! New Year’s Eve was really magical. She
wanted the cat to wake up and talk to her.

Linlin had a great idea. She went to the kitchen and got some cat
food. She didn’t think her cat Yumyum would be angry if she gave the
strange cat something to eat. After opening the can, she went back the
balcony and waved it near the cat. “Wake up, wake up, I’ve got food
for you.”

A lazy eye creaked open. The cat’s nose twitched and dove into the
food, followed by the rest of the cat as it slowly woke up.
After finishing the tuna, the cat sat back and licked its paws.
“You’re not Mouse,” the cat said.

“No, I’m Linlin. Pleased to meet you.”

“Thank you, Linlin. I’m Cat. If you hadn’t woken me up, I would have
been late for an important New Year’s party. Hey, would you like to
come? I think the Jade Emperor would be happy to see you.”

“Jade Emperor? Party?” Something clicked in her head. “Who else is going?”

“Don’t worry, it’s just the usual gang: Rooster, Ox, Goat, and lots of
other people… Even Dragon is taking time out from his busy

The animals from the calendar! Her teacher had told that story on the
last day of class. Cat and Mouse used to be great friends, he said,
but then Mouse tricked Cat by not waking him up even though Mouse
promised. That’s why the Cat isn’t part of the Chinese zodiac,
the animals that protect each year.

Maybe this year Cat could make it!

Cat flicked his tail impatiently. “So, would you like to come?”

She really loved fireworks, but how many times did she get to go with
a talking cat to a party? “Let me ask permission first.” She turned
toward the living room and shouted, “Mom, Dad, can I go with Cat to
the Jade Emperor’s New Year’s Party?”

Without looking away from the television set, they said, “Sure, have fun.”

She grinned and turned back to the cat. “Let’s go!” Cat held his paw
out to her. When she took it, she found herself in front of an
elaborate palace. She was shy, but Cat urged her along and introduced
her to the whole gang. They feasted for what seemed like hours and
Linlin made many friends.

When she got back, she was surprised to find out it was still night.
She looked at the alarm clock on the balcony. It was just a minute to
midnight! As Cat bowed and waved goodbye, the sky exploded into

“Wait! Your alarm clock!” She scooped the clock up and held it out to
the cat.

“Keep it to remember me.” Cat smiled and disappeared.

As the second hand on the alarm clock hit 12, she grinned to herself.
No one would believe her if she told them where she was last night!

(Written in response to the “Last Night” prompt on flashxer)

On Technorati: , ,