<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>

<channel>
	<title>sacha chua :: enterprise 2.0 consultant, storyteller, geek &#187; ruby</title>
	<atom:link href="http://sachachua.com/wp/category/ruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://sachachua.com/wp</link>
	<description>I help people connect through blogs, wikis, other Web 2.0 tools. I'm also writing a book about Emacs.</description>
	<pubDate>Fri, 21 Nov 2008 21:28:16 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.3</generator>
	<language>en</language>
			<item>
		<title>Ruby code to quickly convert titles to ISBNs</title>
		<link>http://sachachua.com/wp/2008/07/10/ruby-code-to-quickly-convert-titles-to-isbns/</link>
		<comments>http://sachachua.com/wp/2008/07/10/ruby-code-to-quickly-convert-titles-to-isbns/#comments</comments>
		<pubDate>Fri, 11 Jul 2008 02:19:33 +0000</pubDate>
		<dc:creator>Sacha Chua</dc:creator>
		
		<category><![CDATA[book]]></category>

		<category><![CDATA[library]]></category>

		<category><![CDATA[reading]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://sachachua.com/wp/2008/07/10/ruby-code-to-quickly-convert-titles-to-isbns/</guid>
		<description><![CDATA[I love the Toronto Public Library system. I can&#039;t say that enough. I particularly love how I can go on a reading spree, place holds on a gazillion books, and have them delivered to the library branch that&#039;s about three blocks away from the house.
Ideally, of course, these books would arrive suitably spaced apart so [...]]]></description>
			<content:encoded><![CDATA[<p>I love the Toronto Public Library system. I can&#039;t say that enough. I particularly love how I can go on a reading spree, place holds on a gazillion books, and have them delivered to the library branch that&#039;s about three blocks away from the house.</p>
<p>Ideally, of course, these books would arrive suitably spaced apart so that a new batch arrives just as I&#039;ve finished another. This happens when I request popular books. Most of the time, though, the books that I want to read fall in the Long Tail&#8211;obscure titles, books that have fallen off the New York Times bestseller lists, and the occasional random find.</p>
<p>All of these books tend to descend on the unsuspecting library branch at the same time.</p>
<p>There were 27 books waiting for me earlier. The librarian thanked me for clearing the shelf. J- greatly enjoyed piling them into the shopping cart we had the foresight to bring. Yes, I&#039;ve got presentations to prepare and things to do&#8211;but reading is fun, and I&#039;m somehow going to find time to read all those books before my three-week loan period is up. I&#039;ll probably be able to renew them, but hey, might as well try.</p>
<p>So I decided I might as well try tracking them on <a href="http://www.librarything.com/catalog/sachachua">LibraryThing</a>. Instead of typing in all the details manually, I grabbed the list of titles from my account on <a href="http://libraryelf.com">LibraryElf</a> (good reminder system for books), used <a href="http://isbndb.com/">ISBNdb</a> to convert the titles into ISBNs (best guess), and imported the list of ISBNs into LibraryThing. Now my profile lists 163 books&#8211;a small fraction of the books that have passed through my hands, but it&#039;s better than nothing. Someday I might even get myself a barcode scanner so that I can just pick up the ISBNs from the book jackets.</p>
<p>Anyway, I promised the Ruby code I&#039;d quickly written to convert the titles to ISBNs:</p>
</p>
<pre>require 'net/http'
require 'CGI'
require 'open-uri'
require 'rexml/document' 

access_key = 'YOURACCESSKEYHERE'
while (s = gets)
  s.chomp!
  url = &quot;http://isbndb.com/api/books.xml?access_key=&quot; + access_key + &quot;&amp;index1=title&amp;value1=&quot; + CGI::escape(s)
  xml = REXML::Document.new(open(url).read)
  if (xml.elements[&quot;ISBNdb/BookList/BookData&quot;])
    puts xml.elements[&quot;ISBNdb/BookList/BookData&quot;].attributes[&quot;isbn&quot;]
  end
end</pre>
<p>Takes titles as standard input, prints out ISBNs. Enjoy!</p>
<div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:8ccb5b36-1157-4aa3-8e2c-cdac22ae4da5" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px">Technorati Tags: <a href="http://technorati.com/tags/isbn" rel="tag">isbn</a>,<a href="http://technorati.com/tags/ruby" rel="tag">ruby</a>,<a href="http://technorati.com/tags/librarything" rel="tag">librarything</a>,<a href="http://technorati.com/tags/isbndb" rel="tag">isbndb</a>,<a href="http://technorati.com/tags/books" rel="tag">books</a>,<a href="http://technorati.com/tags/book" rel="tag">book</a>,<a href="http://technorati.com/tags/reading" rel="tag">reading</a></div>

<!-- start wp-tags-to-technorati 0.95 -->

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://sachachua.com/wp/2008/07/10/ruby-code-to-quickly-convert-titles-to-isbns/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Ruby</title>
		<link>http://sachachua.com/wp/2006/06/08/ruby/</link>
		<comments>http://sachachua.com/wp/2006/06/08/ruby/#comments</comments>
		<pubDate>Thu, 08 Jun 2006 05:10:00 +0000</pubDate>
		<dc:creator>Sacha Chua</dc:creator>
		
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://sachachua.com/notebook/wiki/2006.06.08.php#anchor-1</guid>
		<description><![CDATA[<p>Somewhere along the way, I seem to have turned into a Ruby geek. I
spent the day converting most of my data analysis code to Ruby because
the interactivity of the Ruby shell makes prototyping so much fun. Now
if it were more like Lisp, I would be even happier. I suppose I
_could_ freak everyone out and start using Lisp - maybe Common Lisp? -
within IBM, but... =)</p>

<p>I still haven't quite figured out how to use Eclipse to debug
Ruby programs. I keep getting "abnormal program termination" errors.
Ah, well, that just forces me to write programs with no bugs. ;)</p>

<p>On Technorati: <a href="http://www.technorati.com/tag/ruby" rel="tag">ruby</a></p>

<p>Random Japanese sentence: ÃƒÂ£Ã‚ÂƒÃ‚Â†ÃƒÂ£Ã‚ÂƒÃ‚Â¼ÃƒÂ£Ã‚ÂƒÃ‚Â–ÃƒÂ£Ã‚ÂƒÃ‚Â«ÃƒÂ£Ã‚ÂÃ‚Â«ÃƒÂ§Ã‚ÂŒÃ‚Â«ÃƒÂ£Ã‚ÂÃ‚Â®ÃƒÂ¨Ã‚Â¶Ã‚Â³ÃƒÂ¨Ã‚Â·Ã‚Â¡ÃƒÂ£Ã‚ÂÃ‚ÂŒÃƒÂ¤Ã‚Â»Ã‚Â˜ÃƒÂ£Ã‚ÂÃ‚Â„ÃƒÂ£Ã‚ÂÃ‚Â¦ÃƒÂ£Ã‚ÂÃ‚Â„ÃƒÂ£Ã‚Â‚Ã‚Â‹ÃƒÂ£Ã‚Â€Ã‚Â‚	There are footprints of a cat on the table.</p>
]]></description>
			<content:encoded><![CDATA[<p>Somewhere along the way, I seem to have turned into a Ruby geek. I
spent the day converting most of my data analysis code to Ruby because
the interactivity of the Ruby shell makes prototyping so much fun. Now
if it were more like Lisp, I would be even happier. I suppose I
_could_ freak everyone out and start using Lisp - maybe Common Lisp? -
within IBM, but... =)</p>

<p>I still haven't quite figured out how to use Eclipse to debug
Ruby programs. I keep getting "abnormal program termination" errors.
Ah, well, that just forces me to write programs with no bugs. ;)</p>

<p>On Technorati: <a href="http://www.technorati.com/tag/ruby" rel="tag">ruby</a></p>

<p>Random Japanese sentence: ÃƒÂ£Ã‚ÂƒÃ‚Â†ÃƒÂ£Ã‚ÂƒÃ‚Â¼ÃƒÂ£Ã‚ÂƒÃ‚Â–ÃƒÂ£Ã‚ÂƒÃ‚Â«ÃƒÂ£Ã‚ÂÃ‚Â«ÃƒÂ§Ã‚ÂŒÃ‚Â«ÃƒÂ£Ã‚ÂÃ‚Â®ÃƒÂ¨Ã‚Â¶Ã‚Â³ÃƒÂ¨Ã‚Â·Ã‚Â¡ÃƒÂ£Ã‚ÂÃ‚ÂŒÃƒÂ¤Ã‚Â»Ã‚Â˜ÃƒÂ£Ã‚ÂÃ‚Â„ÃƒÂ£Ã‚ÂÃ‚Â¦ÃƒÂ£Ã‚ÂÃ‚Â„ÃƒÂ£Ã‚Â‚Ã‚Â‹ÃƒÂ£Ã‚Â€Ã‚Â‚	There are footprints of a cat on the table.</p>
]]></content:encoded>
			<wfw:commentRss>http://sachachua.com/wp/2006/06/08/ruby/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Finding geeks</title>
		<link>http://sachachua.com/wp/2006/05/18/finding-geeks/</link>
		<comments>http://sachachua.com/wp/2006/05/18/finding-geeks/#comments</comments>
		<pubDate>Fri, 19 May 2006 02:46:00 +0000</pubDate>
		<dc:creator>Sacha Chua</dc:creator>
		
		<category><![CDATA[geek]]></category>

		<category><![CDATA[philippines]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://sachachua.com/notebook/wiki/2006.05.18.php#anchor-14</guid>
		<description><![CDATA[<p>I don't know why people complain about not being able to find talent.
;) I run across so many interesting people while watching mailing
lists or hanging out with other geeks. For example, if you're looking
for Ruby geeks in the Philippines, Botp PeÃƒÂƒÃ‚Â±a sounds really interesting.
Hey, anyone who advocates Rails and volunteers training has to be cool. ;)</p>

<blockquote>
if you're interested to learn ruby, i can provide training session for free.  just provide the place and at least 10 people to join. dili nako kaya tudlo isa-isa. ma-luoy mo. dapat naa whiteboard (kung wala projector), mga desk/silya, printer para sa handouts/exercises, and notebooks or desktops na ma-gamit ninyo ug nako (wala koy notebook, sorry). Also, dapat naa mo programming background (any language will do. di nako gusto lurat inyo mata. dapat naka-smile pirmi). i prefer to hold trainings monthly/semi-monthly lang kay para dili kaayo ko hago. one training session will cover the whole day (puwede sab ma-hangyo half-day)
</blockquote>

<ul>
<li>PeÃƒÂƒÃ‚Â±a, Botp (botp AT delmonte-phil.com)</li>
</ul>

<p>E-Mail from PeÃƒÂƒÃ‚Â±a</p>

<p>On Technorati: <a href="http://www.technorati.com/tag/ruby" rel="tag">ruby</a>, <a href="http://www.technorati.com/tag/philippines" rel="tag">philippines</a>, <a href="http://www.technorati.com/tag/geek" rel="tag">geek</a></p>

<p>Random Japanese sentence: ÃƒÂ§Ã‚Â§Ã‚ÂÃƒÂ£Ã‚ÂÃ‚Â¯ÃƒÂ£Ã‚ÂÃ‚Â‚ÃƒÂ£Ã‚ÂÃ‚Â®ÃƒÂ¥Ã‚ÂºÃ‚Â—ÃƒÂ£Ã‚ÂÃ‚Â§ÃƒÂ§Ã‚ÂŒÃ‚Â«ÃƒÂ£Ã‚Â‚Ã‚Â’ÃƒÂ¨Ã‚Â²Ã‚Â·ÃƒÂ£Ã‚ÂÃ‚Â£ÃƒÂ£Ã‚ÂÃ‚ÂŸÃƒÂ£Ã‚Â€Ã‚Â‚	I bought a cat at that shop.</p>
]]></description>
			<content:encoded><![CDATA[<p>I don't know why people complain about not being able to find talent.
;) I run across so many interesting people while watching mailing
lists or hanging out with other geeks. For example, if you're looking
for Ruby geeks in the Philippines, Botp PeÃƒÂƒÃ‚Â±a sounds really interesting.
Hey, anyone who advocates Rails and volunteers training has to be cool. ;)</p>

<blockquote>
if you're interested to learn ruby, i can provide training session for free.  just provide the place and at least 10 people to join. dili nako kaya tudlo isa-isa. ma-luoy mo. dapat naa whiteboard (kung wala projector), mga desk/silya, printer para sa handouts/exercises, and notebooks or desktops na ma-gamit ninyo ug nako (wala koy notebook, sorry). Also, dapat naa mo programming background (any language will do. di nako gusto lurat inyo mata. dapat naka-smile pirmi). i prefer to hold trainings monthly/semi-monthly lang kay para dili kaayo ko hago. one training session will cover the whole day (puwede sab ma-hangyo half-day)
</blockquote>

<ul>
<li>PeÃƒÂƒÃ‚Â±a, Botp (botp AT delmonte-phil.com)</li>
</ul>

<p>E-Mail from PeÃƒÂƒÃ‚Â±a</p>

<p>On Technorati: <a href="http://www.technorati.com/tag/ruby" rel="tag">ruby</a>, <a href="http://www.technorati.com/tag/philippines" rel="tag">philippines</a>, <a href="http://www.technorati.com/tag/geek" rel="tag">geek</a></p>

<p>Random Japanese sentence: ÃƒÂ§Ã‚Â§Ã‚ÂÃƒÂ£Ã‚ÂÃ‚Â¯ÃƒÂ£Ã‚ÂÃ‚Â‚ÃƒÂ£Ã‚ÂÃ‚Â®ÃƒÂ¥Ã‚ÂºÃ‚Â—ÃƒÂ£Ã‚ÂÃ‚Â§ÃƒÂ§Ã‚ÂŒÃ‚Â«ÃƒÂ£Ã‚Â‚Ã‚Â’ÃƒÂ¨Ã‚Â²Ã‚Â·ÃƒÂ£Ã‚ÂÃ‚Â£ÃƒÂ£Ã‚ÂÃ‚ÂŸÃƒÂ£Ã‚Â€Ã‚Â‚	I bought a cat at that shop.</p>
]]></content:encoded>
			<wfw:commentRss>http://sachachua.com/wp/2006/05/18/finding-geeks/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Ruby versus Java</title>
		<link>http://sachachua.com/wp/2006/05/13/ruby-versus-java/</link>
		<comments>http://sachachua.com/wp/2006/05/13/ruby-versus-java/#comments</comments>
		<pubDate>Sat, 13 May 2006 19:02:00 +0000</pubDate>
		<dc:creator>Sacha Chua</dc:creator>
		
		<category><![CDATA[barcamp]]></category>

		<category><![CDATA[java]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://sachachua.com/notebook/wiki/2006.05.13.php#anchor-2</guid>
		<description><![CDATA[<p>This is totally cool. I'm in the middle of a geek crowd discussing
Java vs Ruby, but there's none of that "my language is better than
yours" vibe that often comes out in Linux distribution discussions. I
think what's cool about it is that most people here use both, so we're
just figuring out where one is better than the other for something,
and how we can improve things...</p>

<p>On Technorati: <a href="http://www.technorati.com/tag/barcamp" rel="tag">barcamp</a>, <a href="http://www.technorati.com/tag/ruby" rel="tag">ruby</a>, <a href="http://www.technorati.com/tag/java" rel="tag">java</a></p>

<p>Random Japanese sentence: Ã¥Â½Â¼Ã£ÂÂ¯Ã¯Â¼Â’Ã¥ÂŒÂ¹Ã§ÂŒÂ«Ã£Â‚Â’Ã©Â£Â¼Ã£ÂÂ£Ã£ÂÂ¦Ã£ÂÂ„Ã£Â‚Â‹Ã£Â€Â‚Ã¤Â¸Â€Ã¥ÂŒÂ¹Ã£ÂÂ¯Ã©Â»Â’Ã£ÂÂ§Ã£Â‚Â‚Ã£ÂÂ†Ã¤Â¸Â€Ã¥ÂŒÂ¹Ã£ÂÂ¯Ã§Â™Â½Ã£ÂÂ Ã£Â€Â‚	He keeps two cats: one is black, and the other white.</p>
]]></description>
			<content:encoded><![CDATA[<p>This is totally cool. I'm in the middle of a geek crowd discussing
Java vs Ruby, but there's none of that "my language is better than
yours" vibe that often comes out in Linux distribution discussions. I
think what's cool about it is that most people here use both, so we're
just figuring out where one is better than the other for something,
and how we can improve things...</p>

<p>On Technorati: <a href="http://www.technorati.com/tag/barcamp" rel="tag">barcamp</a>, <a href="http://www.technorati.com/tag/ruby" rel="tag">ruby</a>, <a href="http://www.technorati.com/tag/java" rel="tag">java</a></p>

<p>Random Japanese sentence: Ã¥Â½Â¼Ã£ÂÂ¯Ã¯Â¼Â’Ã¥ÂŒÂ¹Ã§ÂŒÂ«Ã£Â‚Â’Ã©Â£Â¼Ã£ÂÂ£Ã£ÂÂ¦Ã£ÂÂ„Ã£Â‚Â‹Ã£Â€Â‚Ã¤Â¸Â€Ã¥ÂŒÂ¹Ã£ÂÂ¯Ã©Â»Â’Ã£ÂÂ§Ã£Â‚Â‚Ã£ÂÂ†Ã¤Â¸Â€Ã¥ÂŒÂ¹Ã£ÂÂ¯Ã§Â™Â½Ã£ÂÂ Ã£Â€Â‚	He keeps two cats: one is black, and the other white.</p>
]]></content:encoded>
			<wfw:commentRss>http://sachachua.com/wp/2006/05/13/ruby-versus-java/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Full day!</title>
		<link>http://sachachua.com/wp/2006/05/08/full-day/</link>
		<comments>http://sachachua.com/wp/2006/05/08/full-day/#comments</comments>
		<pubDate>Mon, 08 May 2006 05:22:00 +0000</pubDate>
		<dc:creator>Sacha Chua</dc:creator>
		
		<category><![CDATA[friends]]></category>

		<category><![CDATA[ruby]]></category>

		<category><![CDATA[samba]]></category>

		<category><![CDATA[social]]></category>

		<guid isPermaLink="false">http://sachachua.com/notebook/wiki/2006.05.08.php#anchor-1</guid>
		<description><![CDATA[<p>I woke up early to check if anyone I knew was online, and I had a nice
chat with Marcelle. I fell asleep waiting for Dominique to come back
online, though, and I had such a vivid dream that I didn't wake up
until an hour or so later - by which time even my mom was starting to
feel like she was talking to cyberspace... =)</p>

<p>Anyway, it was such a nice chat that I didn't mind being late to the
clothing show held at Exhibition Place. Quinn and I eventually made it
there at around 12, and we browsed for an hour or so. I bought a
bracelet and two necklaces, all made of shell. I thought they might go
nicely with my ethnic stuff. I didn't really find anything else that
particularly struck my fancy, as tiered skirts are getting a _little_
too popular for my tastes. I might shift back to nicely colored
skirts, and of course I like wearing stuff from home. I wore the red
malong as a skirt today, matching it with a colorful abaniko fan.
(Thanks, Mom!)</p>

<p>That's why I was late to the Ruby meeting. =) That was cool, too! As
soon as he saw me, Austin said, "You know Steve Perelgut!" (He's one
of my mentors from IBM, and a totally totally cool person. The fact
that he reads me blog (Hi Stephen!) has nothing to do with the
gushiness of the previous statement. =) ) Austin shared what he'd
learned from the Ruby code jam (lesson 1: be better prepared!),
particularly the effectiveness and _fun_ of pair programming. It
worked out really well because Ruby novices were paired up with Ruby
veterans, but the Ruby novices were also good at other aspects that
the Ruby geeks might not have learned about. In this case, they were
porting an archiving library to Ruby. =) Good stuff.</p>

<p>We also had a fun chat about how people can learn to read and write
code. Apparently, I _am_ really weird in that I rather enjoy reading
code... =)</p>

<p>Jed and Quinn were there too, although they dropped in and out of the
conversation, as I fangirled a bit about Ruby and got some interesting
tips. Should check out the Water framework for testing web
applications, although that might need Windows. Also, Austin suggested
SVG + PDF for my graph outputs. Whee!</p>

<p>Jed mentioned a samba jam at an art gallery on Queen Street West. In
keeping with my plan to get to know a wide variety of people and
experience more than what I'd ordinarily get just hanging out with
computer geeks and talking about computers, I decided to go. It was
tons and tons of fun! I told them I had no sense of rhythm and that
I'd be perfectly happy just listening and taking pictures, but Jed
wouldn't take no for an answer. Heck, he didn't even ask if I wanted
to join. Instead, he held up two instruments and asked which one I'd
like to play. &#60;laugh&#62; I opted for a small drum, and I found
myself picking up the rhythm thanks to the coaching of people around
me.</p>

<p>A photographer wandered in, too, so I adopted her. Marie had just
joined a camera club and was thrilled to stumble across such a cool
event. I gave her the tips my dad shared with me about using long
exposures and lower ISO speeds to capture dramatic action, and she had
a lot of fun exploring that, too. =)</p>

<p>I made it back for coffee time at Graduate House. I had so much fun
catching up with Sam. She wants to do really cool things with
accessibility, and she's in a terrific position to do so! I'm also
really excited about her application to be an RA for the dorm. I think
she'd be a terrific one. I told her about what's cool in my life: the
Delta Kappa Gamma fellowship, my research up at IBM, the thrill of
introducing people to other people... She nodded and told me how much
she enjoyed that too. When I learned that she hadn't yet read Tipping
Point, I ran upstairs to grab my copy. I lent it to her, pointing out
the section on Connectors and adding a note about context. I'm also
going to have to get myself a hardcover (if I can find it!) of Love is
the Killer App, which is another thing that she will _so_ be able to
identify with. (Thank you, Maoi, for introducing me to that book!)</p>

<p>Afterwards, I had a wonderfully geeky chat about computer science and
assorted things with Mike and Joe. In particular, Joe's overlapping
clustering algorithms _might_ be fun to run against tag clouds, social
networks, and other cool things. I need to show Mark a sample and see
how we can ask for suitably anonymized data...</p>

<p>Happy girl. Full day. Great fun. =) Lots of interesting people!</p>

<p>On Technorati: <a href="http://www.technorati.com/tag/friends" rel="tag">friends</a>, <a href="http://www.technorati.com/tag/social" rel="tag">social</a>, <a href="http://www.technorati.com/tag/ruby" rel="tag">ruby</a>, <a href="http://www.technorati.com/tag/samba" rel="tag">samba</a></p>

<p>Random Japanese sentence: Ã£ÂƒÂšÃ£ÂƒÂ«Ã£Â‚Â·Ã£ÂƒÂ£Ã§ÂŒÂ«Ã£ÂÂ«Ã©Â–Â¢Ã©Â€Â£Ã£ÂÂ—Ã£ÂÂŸÃ¥ÂÂ¤Ã£ÂÂ„Ã£ÂÂŠÃ¨Â©Â±Ã£ÂÂŒÃ£ÂÂ‚Ã£Â‚ÂŠÃ£ÂÂ¾Ã£ÂÂ™Ã£Â€Â‚	There is a classic story related about a Persian cat.</p>
]]></description>
			<content:encoded><![CDATA[<p>I woke up early to check if anyone I knew was online, and I had a nice
chat with Marcelle. I fell asleep waiting for Dominique to come back
online, though, and I had such a vivid dream that I didn't wake up
until an hour or so later - by which time even my mom was starting to
feel like she was talking to cyberspace... =)</p>

<p>Anyway, it was such a nice chat that I didn't mind being late to the
clothing show held at Exhibition Place. Quinn and I eventually made it
there at around 12, and we browsed for an hour or so. I bought a
bracelet and two necklaces, all made of shell. I thought they might go
nicely with my ethnic stuff. I didn't really find anything else that
particularly struck my fancy, as tiered skirts are getting a _little_
too popular for my tastes. I might shift back to nicely colored
skirts, and of course I like wearing stuff from home. I wore the red
malong as a skirt today, matching it with a colorful abaniko fan.
(Thanks, Mom!)</p>

<p>That's why I was late to the Ruby meeting. =) That was cool, too! As
soon as he saw me, Austin said, "You know Steve Perelgut!" (He's one
of my mentors from IBM, and a totally totally cool person. The fact
that he reads me blog (Hi Stephen!) has nothing to do with the
gushiness of the previous statement. =) ) Austin shared what he'd
learned from the Ruby code jam (lesson 1: be better prepared!),
particularly the effectiveness and _fun_ of pair programming. It
worked out really well because Ruby novices were paired up with Ruby
veterans, but the Ruby novices were also good at other aspects that
the Ruby geeks might not have learned about. In this case, they were
porting an archiving library to Ruby. =) Good stuff.</p>

<p>We also had a fun chat about how people can learn to read and write
code. Apparently, I _am_ really weird in that I rather enjoy reading
code... =)</p>

<p>Jed and Quinn were there too, although they dropped in and out of the
conversation, as I fangirled a bit about Ruby and got some interesting
tips. Should check out the Water framework for testing web
applications, although that might need Windows. Also, Austin suggested
SVG + PDF for my graph outputs. Whee!</p>

<p>Jed mentioned a samba jam at an art gallery on Queen Street West. In
keeping with my plan to get to know a wide variety of people and
experience more than what I'd ordinarily get just hanging out with
computer geeks and talking about computers, I decided to go. It was
tons and tons of fun! I told them I had no sense of rhythm and that
I'd be perfectly happy just listening and taking pictures, but Jed
wouldn't take no for an answer. Heck, he didn't even ask if I wanted
to join. Instead, he held up two instruments and asked which one I'd
like to play. &lt;laugh&gt; I opted for a small drum, and I found
myself picking up the rhythm thanks to the coaching of people around
me.</p>

<p>A photographer wandered in, too, so I adopted her. Marie had just
joined a camera club and was thrilled to stumble across such a cool
event. I gave her the tips my dad shared with me about using long
exposures and lower ISO speeds to capture dramatic action, and she had
a lot of fun exploring that, too. =)</p>

<p>I made it back for coffee time at Graduate House. I had so much fun
catching up with Sam. She wants to do really cool things with
accessibility, and she's in a terrific position to do so! I'm also
really excited about her application to be an RA for the dorm. I think
she'd be a terrific one. I told her about what's cool in my life: the
Delta Kappa Gamma fellowship, my research up at IBM, the thrill of
introducing people to other people... She nodded and told me how much
she enjoyed that too. When I learned that she hadn't yet read Tipping
Point, I ran upstairs to grab my copy. I lent it to her, pointing out
the section on Connectors and adding a note about context. I'm also
going to have to get myself a hardcover (if I can find it!) of Love is
the Killer App, which is another thing that she will _so_ be able to
identify with. (Thank you, Maoi, for introducing me to that book!)</p>

<p>Afterwards, I had a wonderfully geeky chat about computer science and
assorted things with Mike and Joe. In particular, Joe's overlapping
clustering algorithms _might_ be fun to run against tag clouds, social
networks, and other cool things. I need to show Mark a sample and see
how we can ask for suitably anonymized data...</p>

<p>Happy girl. Full day. Great fun. =) Lots of interesting people!</p>

<p>On Technorati: <a href="http://www.technorati.com/tag/friends" rel="tag">friends</a>, <a href="http://www.technorati.com/tag/social" rel="tag">social</a>, <a href="http://www.technorati.com/tag/ruby" rel="tag">ruby</a>, <a href="http://www.technorati.com/tag/samba" rel="tag">samba</a></p>

<p>Random Japanese sentence: Ã£ÂƒÂšÃ£ÂƒÂ«Ã£Â‚Â·Ã£ÂƒÂ£Ã§ÂŒÂ«Ã£ÂÂ«Ã©Â–Â¢Ã©Â€Â£Ã£ÂÂ—Ã£ÂÂŸÃ¥ÂÂ¤Ã£ÂÂ„Ã£ÂÂŠÃ¨Â©Â±Ã£ÂÂŒÃ£ÂÂ‚Ã£Â‚ÂŠÃ£ÂÂ¾Ã£ÂÂ™Ã£Â€Â‚	There is a classic story related about a Persian cat.</p>
]]></content:encoded>
			<wfw:commentRss>http://sachachua.com/wp/2006/05/08/full-day/feed/</wfw:commentRss>
		</item>
		<item>
		<title>RoR: &#034;What&#039;s in My Fridge&#034; now has a shopping list</title>
		<link>http://sachachua.com/wp/2006/04/15/ror-whats-in-my-fridge-now-has-a-shopping-list/</link>
		<comments>http://sachachua.com/wp/2006/04/15/ror-whats-in-my-fridge-now-has-a-shopping-list/#comments</comments>
		<pubDate>Sun, 16 Apr 2006 04:16:00 +0000</pubDate>
		<dc:creator>Sacha Chua</dc:creator>
		
		<category><![CDATA[rails]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://sachachua.com/notebook/wiki/2006.04.16.php#anchor-1</guid>
		<description><![CDATA[<p>I know, I know, it's silly, but it's also so much fun programming little toys like this!</p>

<p>I'm also sketching out a life tracker that does something like <a href="http://erikbenson.typepad.com/mu/2005/11/moraleometer_on.html">Erik Benson's Morale-o-Meter</a>.</p>

<p>On Technorati: <a href="http://www.technorati.com/tag/ruby" rel="tag">ruby</a>, <a href="http://www.technorati.com/tag/rails" rel="tag">rails</a></p>
]]></description>
			<content:encoded><![CDATA[<p>I know, I know, it's silly, but it's also so much fun programming little toys like this!</p>

<p>I'm also sketching out a life tracker that does something like <a href="http://erikbenson.typepad.com/mu/2005/11/moraleometer_on.html">Erik Benson's Morale-o-Meter</a>.</p>

<p>On Technorati: <a href="http://www.technorati.com/tag/ruby" rel="tag">ruby</a>, <a href="http://www.technorati.com/tag/rails" rel="tag">rails</a></p>
]]></content:encoded>
			<wfw:commentRss>http://sachachua.com/wp/2006/04/15/ror-whats-in-my-fridge-now-has-a-shopping-list/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Girl!</title>
		<link>http://sachachua.com/wp/2006/04/13/girl-2/</link>
		<comments>http://sachachua.com/wp/2006/04/13/girl-2/#comments</comments>
		<pubDate>Fri, 14 Apr 2006 04:43:00 +0000</pubDate>
		<dc:creator>Sacha Chua</dc:creator>
		
		<category><![CDATA[girl]]></category>

		<category><![CDATA[rails]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://sachachua.com/notebook/wiki/2006.04.14.php#anchor-1</guid>
		<description><![CDATA[<p>I play around with Ruby on Rails, and what do I do?</p>

<p>Build one webapp to keep track of what's in my fridge, and another
webapp to keep track of what's in my closet.</p>

<p>I'm going to do it in _pink_, too... ;)</p>

<p>On Technorati: <a href="http://www.technorati.com/tag/rails" rel="tag">rails</a>, <a href="http://www.technorati.com/tag/ruby" rel="tag">ruby</a>, <a href="http://www.technorati.com/tag/girl" rel="tag">girl</a></p>

<p>Random Japanese sentence: Ã§ÂŒÂ«Ã£ÂÂ¯Ã©Â³Â¥Ã£Â‚ÂÃ£ÂÂŒÃ£ÂÂ‘Ã£ÂÂ¦Ã©Â£Â›Ã£ÂÂ³Ã¨Â·Â³Ã£ÂÂ­Ã£ÂÂŸÃ£Â€Â‚	The cat sprang at the bird.</p>
]]></description>
			<content:encoded><![CDATA[<p>I play around with Ruby on Rails, and what do I do?</p>

<p>Build one webapp to keep track of what's in my fridge, and another
webapp to keep track of what's in my closet.</p>

<p>I'm going to do it in _pink_, too... ;)</p>

<p>On Technorati: <a href="http://www.technorati.com/tag/rails" rel="tag">rails</a>, <a href="http://www.technorati.com/tag/ruby" rel="tag">ruby</a>, <a href="http://www.technorati.com/tag/girl" rel="tag">girl</a></p>

<p>Random Japanese sentence: Ã§ÂŒÂ«Ã£ÂÂ¯Ã©Â³Â¥Ã£Â‚ÂÃ£ÂÂŒÃ£ÂÂ‘Ã£ÂÂ¦Ã©Â£Â›Ã£ÂÂ³Ã¨Â·Â³Ã£ÂÂ­Ã£ÂÂŸÃ£Â€Â‚	The cat sprang at the bird.</p>
]]></content:encoded>
			<wfw:commentRss>http://sachachua.com/wp/2006/04/13/girl-2/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The Year in Bookmarks</title>
		<link>http://sachachua.com/wp/2005/12/16/the-year-in-bookmarks/</link>
		<comments>http://sachachua.com/wp/2005/12/16/the-year-in-bookmarks/#comments</comments>
		<pubDate>Fri, 16 Dec 2005 22:37:00 +0000</pubDate>
		<dc:creator>Sacha Chua</dc:creator>
		
		<category><![CDATA[code]]></category>

		<category><![CDATA[del.icio.us]]></category>

		<category><![CDATA[emacs]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://sachachua.com/notebook/wiki/2005.12.16.php#anchor-1</guid>
		<description><![CDATA[<table class="muse-table" border="2" cellpadding="5">
  <tbody>
    <tr>
      <td>Top 10 tags for 2005</td>
      <td><a href="http://del.icio.us/sachac/productivity">productivity</a>(104) <a href="http://del.icio.us/sachac/web2.0">web2.0</a>(88) <a href="http://del.icio.us/sachac/digitalpinay">digitalpinay</a>(88) <a href="http://del.icio.us/sachac/social">social</a>(84) <a href="http://del.icio.us/sachac/useful">useful</a>(83) <a href="http://del.icio.us/sachac/business">business</a>(80) <a href="http://del.icio.us/sachac/blogs">blogs</a>(70) <a href="http://del.icio.us/sachac/research">research</a>(69) <a href="http://del.icio.us/sachac/lifehacks">lifehacks</a>(68) <a href="http://del.icio.us/sachac/blogging">blogging</a>(60)</td>
    </tr>
  </tbody>
</table>

<p>Check out <a href="http://sacha.free.net.ph/notebook/wiki/2005.12.16.php">my year in bookmarks</a> for more detail. =) If you want me to analyze yours, just save <a href="http://del.icio.us/api/posts/all">http://del.icio.us/api/posts/all</a> to all.xml and run this Ruby script. You can also e-mail me (<a href="mailto:sacha@plannerlove.com">sacha@plannerlove.com</a>) your all.xml if you don't want to go through the hassle yourself.</p>

<p>Much fun!</p>

<pre class="example">
#!/usr/bin/ruby

require 'rexml/document'
require 'date'

include REXML

YEAR = 2005
USER = "sachac"
doc = Document::new(File::new('all.xml'))

month_hash = {}
month_total = {}
tag_total = {}
doc.elements[1].elements.each {
  &#124;x&#124;
  date = DateTime::parse(x.attributes['time'])
  if (date.year == YEAR)
    x.attributes['tag'].split(' ').each {
      &#124;tag&#124;
      month_hash[date.month] &#124;&#124;= {}
      month_hash[date.month][tag] &#124;&#124;= 0
      month_hash[date.month][tag] += 1
      tag_total[tag] &#124;&#124;= 0
      tag_total[tag] += 1
    }
    month_total[date.month] &#124;&#124;= 0
    month_total[date.month] += 1
  end
}

s = "Top 10 tags for " + YEAR.to_s + " &#124;"
tag_total.sort_by { &#124;tag,total&#124; -total }.slice(0, 10).each { &#124;tag,total&#124;
  s += ' <a href="http://del.icio.us/' + USER + '/' + tag + "\">" + tag + "</a>(" + total.to_s + ")"
}
puts s

month_hash.sort.each { &#124;month,tags&#124;
  s = Date::MONTHNAMES[month] + "<br/>(" + month_total[month].to_s + " bookmarks) &#124;"
  tags.sort_by { &#124;tag,total&#124; -total }.each {
    &#124;tag,total&#124;
    s += ' <a href="http://del.icio.us/' + USER + '/' + tag + "\">" + tag + "</a>(" + total.to_s + ")"
  }
  puts s
}
</pre>

<p>On Technorati: <a href="http://www.technorati.com/tag/ruby" rel="tag">ruby</a>, <a href="http://www.technorati.com/tag/code" rel="tag">code</a>, <a href="http://www.technorati.com/tag/del.icio.us" rel="tag">del.icio.us</a></p>
]]></description>
			<content:encoded><![CDATA[<table class="muse-table" border="2" cellpadding="5">
  <tbody>
    <tr>
      <td>Top 10 tags for 2005</td>
      <td><a href="http://del.icio.us/sachac/productivity">productivity</a>(104) <a href="http://del.icio.us/sachac/web2.0">web2.0</a>(88) <a href="http://del.icio.us/sachac/digitalpinay">digitalpinay</a>(88) <a href="http://del.icio.us/sachac/social">social</a>(84) <a href="http://del.icio.us/sachac/useful">useful</a>(83) <a href="http://del.icio.us/sachac/business">business</a>(80) <a href="http://del.icio.us/sachac/blogs">blogs</a>(70) <a href="http://del.icio.us/sachac/research">research</a>(69) <a href="http://del.icio.us/sachac/lifehacks">lifehacks</a>(68) <a href="http://del.icio.us/sachac/blogging">blogging</a>(60)</td>
    </tr>
  </tbody>
</table>

<p>Check out <a href="http://sacha.free.net.ph/notebook/wiki/2005.12.16.php">my year in bookmarks</a> for more detail. =) If you want me to analyze yours, just save <a href="http://del.icio.us/api/posts/all">http://del.icio.us/api/posts/all</a> to all.xml and run this Ruby script. You can also e-mail me (<a href="mailto:sacha@plannerlove.com">sacha@plannerlove.com</a>) your all.xml if you don't want to go through the hassle yourself.</p>

<p>Much fun!</p>

<pre class="example">
#!/usr/bin/ruby

require 'rexml/document'
require 'date'

include REXML

YEAR = 2005
USER = "sachac"
doc = Document::new(File::new('all.xml'))

month_hash = {}
month_total = {}
tag_total = {}
doc.elements[1].elements.each {
  |x|
  date = DateTime::parse(x.attributes['time'])
  if (date.year == YEAR)
    x.attributes['tag'].split(' ').each {
      |tag|
      month_hash[date.month] ||= {}
      month_hash[date.month][tag] ||= 0
      month_hash[date.month][tag] += 1
      tag_total[tag] ||= 0
      tag_total[tag] += 1
    }
    month_total[date.month] ||= 0
    month_total[date.month] += 1
  end
}

s = "Top 10 tags for " + YEAR.to_s + " |"
tag_total.sort_by { |tag,total| -total }.slice(0, 10).each { |tag,total|
  s += ' <a href="http://del.icio.us/' + USER + '/' + tag + "\">" + tag + "</a>(" + total.to_s + ")"
}
puts s

month_hash.sort.each { |month,tags|
  s = Date::MONTHNAMES[month] + "<br/>(" + month_total[month].to_s + " bookmarks) |"
  tags.sort_by { |tag,total| -total }.each {
    |tag,total|
    s += ' <a href="http://del.icio.us/' + USER + '/' + tag + "\">" + tag + "</a>(" + total.to_s + ")"
  }
  puts s
}
</pre>

<p>On Technorati: <a href="http://www.technorati.com/tag/ruby" rel="tag">ruby</a>, <a href="http://www.technorati.com/tag/code" rel="tag">code</a>, <a href="http://www.technorati.com/tag/del.icio.us" rel="tag">del.icio.us</a></p>
]]></content:encoded>
			<wfw:commentRss>http://sachachua.com/wp/2005/12/16/the-year-in-bookmarks/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Ruby: Turn bash.org quotes into a fortune file</title>
		<link>http://sachachua.com/wp/2005/12/08/ruby-turn-bashorg-quotes-into-a-fortune-file/</link>
		<comments>http://sachachua.com/wp/2005/12/08/ruby-turn-bashorg-quotes-into-a-fortune-file/#comments</comments>
		<pubDate>Thu, 08 Dec 2005 23:27:00 +0000</pubDate>
		<dc:creator>Sacha Chua</dc:creator>
		
		<category><![CDATA[code]]></category>

		<category><![CDATA[programming]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://sachachua.com/notebook/wiki/2005.12.08.php#anchor-6</guid>
		<description><![CDATA[<p>The following code turns XML quotes from bash.org (a popular IRC quotes server) into a fortune-cookie file.
Handy for using with <a href="http://sachachua.com/notebook/emacs/flashcard.el">../emacs/flashcard.el</a> and my <a href="http://sachachua.com/notebook/emacs/flashcard-config.el">../emacs/flashcard-config.el</a>, which pops up a fortune
every time I get a correct answer.</p>

<p>bash-org-to-fortune.rb:</p>

<pre class="example">
require 'rss/1.0'
require 'cgi'
require 'net/http'
host = Net::HTTP.new('bash.org', 80)
if ARGV[0] then
   resp, data = host.get('http://bash.org/xml/?top&#038;below=' + ARGV[0], nil)
else
   resp, data = host.get('http://bash.org/xml/?top', nil)
end
parsed = RSS::Parser.parse(data, false)
parsed.items.each { &#124;x&#124; puts CGI::unescapeHTML(x.description.gsub('<br />', "\n")); puts "%\n" }
</pre>

<p>Call like this:</p>

<pre class="example">
ruby bash-org-to-fortune.rb > bash; strfile bash; fortune bash

# or to get the top quotes with score < 1000
ruby bash-org-to-fortune.rb 1000 > bash; strfile bash; fortune bash
</pre>

<p>On Technorati: <a href="http://www.technorati.com/tag/ruby" rel="tag">ruby</a>, <a href="http://www.technorati.com/tag/code" rel="tag">code</a>, <a href="http://www.technorati.com/tag/programming" rel="tag">programming</a></p>
]]></description>
			<content:encoded><![CDATA[<p>The following code turns XML quotes from bash.org (a popular IRC quotes server) into a fortune-cookie file.
Handy for using with <a href="http://sachachua.com/notebook/emacs/flashcard.el">../emacs/flashcard.el</a> and my <a href="http://sachachua.com/notebook/emacs/flashcard-config.el">../emacs/flashcard-config.el</a>, which pops up a fortune
every time I get a correct answer.</p>

<p>bash-org-to-fortune.rb:</p>

<pre class="example">
require 'rss/1.0'
require 'cgi'
require 'net/http'
host = Net::HTTP.new('bash.org', 80)
if ARGV[0] then
   resp, data = host.get('http://bash.org/xml/?top&below=' + ARGV[0], nil)
else
   resp, data = host.get('http://bash.org/xml/?top', nil)
end
parsed = RSS::Parser.parse(data, false)
parsed.items.each { |x| puts CGI::unescapeHTML(x.description.gsub('<br />', "\n")); puts "%\n" }
</pre>

<p>Call like this:</p>

<pre class="example">
ruby bash-org-to-fortune.rb > bash; strfile bash; fortune bash

# or to get the top quotes with score < 1000
ruby bash-org-to-fortune.rb 1000 > bash; strfile bash; fortune bash
</pre>

<p>On Technorati: <a href="http://www.technorati.com/tag/ruby" rel="tag">ruby</a>, <a href="http://www.technorati.com/tag/code" rel="tag">code</a>, <a href="http://www.technorati.com/tag/programming" rel="tag">programming</a></p>
]]></content:encoded>
			<wfw:commentRss>http://sachachua.com/wp/2005/12/08/ruby-turn-bashorg-quotes-into-a-fortune-file/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Adventures with Ruby</title>
		<link>http://sachachua.com/wp/2005/02/04/adventures-with-ruby/</link>
		<comments>http://sachachua.com/wp/2005/02/04/adventures-with-ruby/#comments</comments>
		<pubDate>Fri, 04 Feb 2005 23:12:00 +0000</pubDate>
		<dc:creator>Sacha Chua</dc:creator>
		
		<category><![CDATA[emacs]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://sachachua.com/notebook/wiki/2005.02.04.php#anchor-4</guid>
		<description><![CDATA[<p>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.)</p>

<p>Yesterday's script parsed schedule data and checked that monthly cost
and day constraints were observed. Today I wanted to visualize the verified schedule.</p>

<p>At first I tried working with planner (formerly known as
<nop>MrProject and not to be confused with <a href="http://sachachua.com/notebook/wiki/PlannerMode">PlannerMode</a>). I wrote a <a href="http://sachachua.com/notebook/ruby/schedule-to-planner.rb">Ruby program</a> 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.</p>

<p>It was surprisingly easy to write <a href="http://sachachua.com/notebook/ruby/schedule-to-image.rb">a Gantt-like visualizer</a> for the schedule
and even easier to manipulate it once I had written it. For example, I could do silly things like</p>


<p>s.to_image((s.schedule.sort { &#124;a,b&#124; a.start <=> b.start }, 0, 2500, 1800, image)</p>


<p><a href="http://sachachua.com/notebook/pics/japan/20050204-gantt1.png">Sorted by start date</a></p>

<p>to see the tasks sorted by start date. Being a Lisp girl, I had no problems writing silly things like</p>


<p>s.to_image((s.schedule.collect { &#124;x&#124; x if x.person_id == '08-1' } - [ nil ]).sort { &#124;a,b&#124; a.start <=> b.start }, 0, 2500, 1800, image)</p>


<p>but then I realized that this was much cleaner:</p>


<p>s.to_image((s.schedule.sort { &#124;a,b&#124; x = a.person_id <=> b.person_id; if x == 0 then a.start <=> b.start else x end }, 0, 2500, 1800, image)</p>

<br />
<a href="http://sachachua.com/notebook/pics/japan/20050204-gantt2.png">Sorted by person and then start date</a>

<p>Ruby is so cute!</p>

<p>On Technorati: <a href="http://www.technorati.com/tag/ruby" rel="tag">ruby</a></p>
]]></description>
			<content:encoded><![CDATA[<p>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.)</p>

<p>Yesterday's script parsed schedule data and checked that monthly cost
and day constraints were observed. Today I wanted to visualize the verified schedule.</p>

<p>At first I tried working with planner (formerly known as
<nop>MrProject and not to be confused with <a href="http://sachachua.com/notebook/wiki/PlannerMode">PlannerMode</a>). I wrote a <a href="http://sachachua.com/notebook/ruby/schedule-to-planner.rb">Ruby program</a> 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.</p>

<p>It was surprisingly easy to write <a href="http://sachachua.com/notebook/ruby/schedule-to-image.rb">a Gantt-like visualizer</a> for the schedule
and even easier to manipulate it once I had written it. For example, I could do silly things like</p>


<p>s.to_image((s.schedule.sort { |a,b| a.start <=> b.start }, 0, 2500, 1800, image)</p>


<p><a href="http://sachachua.com/notebook/pics/japan/20050204-gantt1.png">Sorted by start date</a></p>

<p>to see the tasks sorted by start date. Being a Lisp girl, I had no problems writing silly things like</p>


<p>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)</p>


<p>but then I realized that this was much cleaner:</p>


<p>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)</p>

<br>
<a href="http://sachachua.com/notebook/pics/japan/20050204-gantt2.png">Sorted by person and then start date</a>

<p>Ruby is so cute!</p>

<p>On Technorati: <a href="http://www.technorati.com/tag/ruby" rel="tag">ruby</a></p>
]]></content:encoded>
			<wfw:commentRss>http://sachachua.com/wp/2005/02/04/adventures-with-ruby/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Nifty Japanese stuff: Kakasi</title>
		<link>http://sachachua.com/wp/2005/01/28/nifty-japanese-stuff-kakasi/</link>
		<comments>http://sachachua.com/wp/2005/01/28/nifty-japanese-stuff-kakasi/#comments</comments>
		<pubDate>Fri, 28 Jan 2005 15:36:00 +0000</pubDate>
		<dc:creator>Sacha Chua</dc:creator>
		
		<category><![CDATA[emacs]]></category>

		<category><![CDATA[japanese]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://sachachua.com/notebook/wiki/2005.01.28.php#anchor-3</guid>
		<description><![CDATA[<p><a href="http://kakasi.namazu.org/">Kakasi</a> is an external utility for
converting Japanese text between coding systems. It can also add
furigana after kanji or convert a text file to romaji.</p>

<p>Debian users can <code>apt-get install kakasi kakasi-dic</code>.
There's an <a href="http://komatsu.webmasters.gr.jp/elisp/kakasi/">Emacs interface</a>,
a <a href="http://search.cpan.org/dist/Text-Kakasi/Kakasi.pm">Perl module (Text::Kakasi)</a>,
and a <a href="http://raa.ruby-lang.org/list.rhtml?name=Ruby%2FKAKASI">Ruby library</a>.</p>

<p>On Technorati: <a href="http://www.technorati.com/tag/japanese" rel="tag">japanese</a>, <a href="http://www.technorati.com/tag/emacs" rel="tag">emacs</a>, <a href="http://www.technorati.com/tag/linux" rel="tag">linux</a>, <a href="http://www.technorati.com/tag/ruby" rel="tag">ruby</a></p>
]]></description>
			<content:encoded><![CDATA[<p><a href="http://kakasi.namazu.org/">Kakasi</a> is an external utility for
converting Japanese text between coding systems. It can also add
furigana after kanji or convert a text file to romaji.</p>

<p>Debian users can <code>apt-get install kakasi kakasi-dic</code>.
There's an <a href="http://komatsu.webmasters.gr.jp/elisp/kakasi/">Emacs interface</a>,
a <a href="http://search.cpan.org/dist/Text-Kakasi/Kakasi.pm">Perl module (Text::Kakasi)</a>,
and a <a href="http://raa.ruby-lang.org/list.rhtml?name=Ruby%2FKAKASI">Ruby library</a>.</p>

<p>On Technorati: <a href="http://www.technorati.com/tag/japanese" rel="tag">japanese</a>, <a href="http://www.technorati.com/tag/emacs" rel="tag">emacs</a>, <a href="http://www.technorati.com/tag/linux" rel="tag">linux</a>, <a href="http://www.technorati.com/tag/ruby" rel="tag">ruby</a></p>
]]></content:encoded>
			<wfw:commentRss>http://sachachua.com/wp/2005/01/28/nifty-japanese-stuff-kakasi/feed/</wfw:commentRss>
		</item>
		<item>
		<title>More Ruby stuff</title>
		<link>http://sachachua.com/wp/2005/01/21/more-ruby-stuff/</link>
		<comments>http://sachachua.com/wp/2005/01/21/more-ruby-stuff/#comments</comments>
		<pubDate>Sat, 22 Jan 2005 02:20:00 +0000</pubDate>
		<dc:creator>Sacha Chua</dc:creator>
		
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://sachachua.com/notebook/wiki/2005.01.21.php#anchor-5</guid>
		<description><![CDATA[<p>Poignant guide, <a href="http://ww.poignantguide.net">http://ww.poignantguide.net</a>  . Possibly the weirdest introduction to a programming language that I will ever see in my life . - Dave</p>

<p>Also, read Why the Lucky Stiff.</p>

<p>On Technorati: <a href="http://www.technorati.com/tag/ruby" rel="tag">ruby</a></p>
]]></description>
			<content:encoded><![CDATA[<p>Poignant guide, <a href="http://ww.poignantguide.net">http://ww.poignantguide.net</a>  . Possibly the weirdest introduction to a programming language that I will ever see in my life . - Dave</p>

<p>Also, read Why the Lucky Stiff.</p>

<p>On Technorati: <a href="http://www.technorati.com/tag/ruby" rel="tag">ruby</a></p>
]]></content:encoded>
			<wfw:commentRss>http://sachachua.com/wp/2005/01/21/more-ruby-stuff/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
