The future for Ruby and Emacs is looking hopeful. I learned that a
proper Ruby grammar for the semantic package is being worked on,
which will enable class browsing and intelligent completion.
I am still disappointed that there's no version of Emacs
that uses Xft or Pango for anti-aliased font rendering. To get sharp fonts,
I still need to use a bitmap font like misc-fixed. If I were in the
business of offering bounties for open source development, dragging
Emacs into the GTK2/Pango era would be the biggest one.
Checking the mailing lists indicates that Pango is not
suitable
for Emacs, but no alternative scheme ever seems to bear fruit.
Yet if Aquamacs can do it...
If somebody came along with a decent TextMate-a-like for GNOME, I'd
pay good money for it. I've never been really happy with an editor
since Cygnus
Ed.
Hallski and I keep talking about this,
and only just manage to resist wasting months of time on trying to
write one ourselves.
The following is dedicated to Og Maciel, whose life apparently would be empty and meaningless without it.Yo te hablo de poes a y vos me pregunt s a qu hora comemos. Lo peor es que yo tambi n tengo hambre.
There was a couple Not an underwater couple that controlled the sea But a couple of people on land Who courted one another with the magic of haiku They sent haiku across the country Every day Until the philotes Brought them together physically Then the Great State of California Pronounced them legally wed Because it either didn't know Or didn't care That poetry is supposed to rhyme.
The following is dedicated to Og Maciel, whose life apparently would be empty and meaningless without it.Yo te hablo de poes a y vos me pregunt s a qu hora comemos. Lo peor es que yo tambi n tengo hambre.
There was a couple Not an underwater couple that controlled the sea But a couple of people on land Who courted one another with the magic of haiku They sent haiku across the country Every day Until the philotes Brought them together physically Then the Great State of California Pronounced them legally wed Because it either didn't know Or didn't care That poetry is supposed to rhyme.
Why isn’t the package updated in Debian yet?Well, we have just another C++ ABI transition, this means the libsigc++ is incompatible to the version before and all packages have to be recompiled.
Debian is just too slow, even Ubuntu and Gentoo are faster...Gentoo is source-based and I had, back when I used it, the impressions that some developers do not really try to compile it before they commit the new version, but I think this has changed now. Ubuntu, well yeah, even they are much quicker in transitions, out of various reasons I’m too tired to rehash here. Not only am I blocked by libsigc++-2.0 which I theoretically could NMU away, but by the whole bunch of gtkmm stuff which also needs to be recompiled with all of its dependencies. It will take weeks until the new revision of Gobby could enter at least Debian unstable. I bet that Ubuntu MOTU will update my package by their own before I am able to upload a new one to Debian to get it synced from there.
STDIN.to_a.sort_by rand .each l puts lAs Philipp warns, however: "Ruby is full of fun and power; one must watch out that the scripts remain readable". For a fairly toy example, this solution is still fairly readable, however I can see hair growing on this thing if your program grows large. Next, Pierre-Charles David showed his qualifications for becoming a co-author of the next edition of the Pickaxe (AKA "Programming Ruby: The Pragmatic Programmers' Guide"), with his example and explanation. He's kindly given permission for me to reproduce his e-mail in it's entireity, since it's too good to chop up:
Here is the shortest and most readable version of your "randomize stdin" script I can think of:Pierre, your explanation definitely helped, and I hope it helps others too. The third person to help me out is Decklin Foster, through a post in his blog. What particularly caught me about his solution was the neat demonstration of another feature of Ruby which I think I will really learn to love: the ability to dynamically add methods to an existing class. "Aiee!" I hear all the purists scream -- and I can see the potential for severe misuse, too. But, since every good idea seems to get deeply perverted, we may as well have some real useful features to pervert while we're at it. Decklin has the clever idea of adding methods to the Array class that shuffle the elements of the array in a random fashion. His code is beautiful in it's simplicity:#!/usr/bin/env ruby print ARGF.readlines.sort_by randARGF is a special variable representing either stdin or, in the case where file names are passed on the command line, the content of these files (think of Perl's <>). ARGF behaves like an IO object (although I think it is not one). In particular, it responds to the #readlines method which splits the receiver's content into lines and returns an array. In other words,lines = ARGF.readlinesis the idiomatic way of doinglines = [] while line = gets() do lines << line endin your example. The next part (sort_by) uses a new form of the sort method, which I think is not documented in the Pickaxe. It implements the Schwartzian transform technique. In essence, a random number is associated to each element of the array, which are then sorted based on this index. As a general style remark, note that although Ruby supports "while" and "for x in y" loops, they are rarely used, in favor of iterators and/or higher order methods. For example, to gather all the input lines in an array without using readlines, one might writelines = Array.new ARGF.each_line l lines << lorlines = ARGF.inject([]) lines, l lines << lHope it helps, and welcome to Ruby!
class Array
def swap!(a, b)
self[a], self[b] = self[b], self[a]
self
end
def shuffle!
each_index do i
j = i + rand(length - i)
swap!(i, j)
end
self
end
end
He then goes on to rewrite my bumbling example in probably the most
comprehensible manner I've yet seen:
STDIN.readlines.shuffle!.each line puts lineDecklin writes, "Now that is cool.". I couldn't have put it better myself. My thanks to Philipp, Pierre-Charles, and Decklin, for helping me along the Ruby path. So, two new Ruby Rules for me to live by:
#!/usr/bin/env ruby lines = [] while line = gets() do lines << line end while ! lines.empty? do idx = rand(lines.length) puts lines[idx] lines.delete_at(idx) end(Any Ruby afficionados out there, feel free to e-mail me and tell me what egregious sins I've committed). I think it looks reasonably neat and clean, it's certainly simple, and the use of real Object Orientation makes for a certain readability (I think the method call lines.empty? is particularly cute, although I did initially consider the use of a question mark in a method name to be a crime against humanity). So, will I be using Ruby more in the future? I think so. There are some features in Ruby which I'm hoping to get a lot more cosy with -- the idea of "blocks" looks particularly interesting, and I don't think the utility of languages that have been designed, top-to-bottom, to really live the OO ideal has been explored enough (you SmallTalk bigots can stop glaring at me now -- really, I mean it -- stop it!). It's far too early to tell whether Ruby will become my "go to" language for random development tasks, but anything that stops the nightmares (where I start thinking about using PHP as a general scripting language) cannot be all bad. And, if I continue to make new webapps, Rails will probably come in handy. Update: HTML <pre> tags don't like having < inside them unescaped. Also, Philipp Kern pointed out that the Ruby documentation browser is called ri (not ir as I originally wrote). Philipp was also kind enough to provide a much shorter version of my original script, which shows the power of Ruby so much better:
lines = [] STDIN.each_line line lines << line lines.sort_by rand .each line puts lineNow tell me that isn't a language worth using!

The skyline of South Manhattan
We walked over the Brooklyn bridge, giving me other very cool views of
Manhattan, while I hammered Clint with questions about this and that. I saw
that since 9/11, you can't go past the Town Hall. "Security reasons", of
course. I was very surprised to see police cars in every single street. It's
like a Police State, and if you ask me, it didn't make me feel safer.
After some walk, we finally got in Chinatown, which is the craziest place
ever. People sell stuff on the sidewalks, and many streets are packed with
people. We had to meet with mikah, biella, dilinger and his cat at some Chinese
place for breakfast/lunch. The place, as Chinatown itself, was crazy. As soon
as we sat down a few waitresses landed a few plates on the table, without
asking or anything. A few minutes later I could see that the way they serve you
is going around with carts with lost of food, and you either want it or
not.
We left dilinger at the metro station, and moved on to the SoHo. I wanted to
go to the SoHo Apple Store to see if they knew about replacement Spanish
keyboards for my Powerbook. My powerbook was bought in the US last year, so it
has a US keyboard. This is mostly ok, but only mostly as it's missing a
key.
After SoHo, we went back to Chinatown to pick up bubbles. It was nice to see
her after Debconf, and she made the effort to come just for a few hours even if
she was ill and had lots to do in Philly. We headed to South Street Port, where
I had a long chat about Cuba with micah while we sat on a bench looking at
Brooklyn bridge.
And then, we gathered all our braveness and headed to the heart of the
beast, to the kernel of the system. We walked into the Financial District, and
soon enough I was walking in Wall Street no less. If I breathed hard, I could
smell the money. The road was paved in gold, and there were skyscrapers
everywhere. I discovered the rulers of this world had opened a "public space"
in JP Morgan's building. To their despair, probably, it had been taken over by
the poor. I wonder what Bloomberg will do about it.
As I walked up the street, a strange feeling in my heart grew and grew,
until, behind a corner, I saw it. The source of all evil was ahead of me,
guarded by George Washington himself.

The New York Stock exchange and it's black evil aura of Capitalism
I was standing ahead of this building where so many people behave like
bastards everyday, pushing millions to povery for a bit more profit margin. The
doors were closed and surrounded by security officers, which despite being
asked politely, didn't let us in for "security reasons".
Next to it was the Church of Capitalism, at the end of the street. It's
curious that such an old church still stands where it was build near the
harbour probably a century ago, now surrounded by some of the most modern and
tallest buildings in the planet. And then, we visited the bull, which I didn't
know is the "friendly" symbol of how Capitalism works.

I had Capitalism by the balls
We moved down to Battery Square, past the old US Customs building with the
four statues representing the four continents. We saw the damaged sculpture
which lived in the WTC, and sat down at the pier to watch a beautiful sunset
over the Statue of Liberty.

The Statue of Liberty seen from South Manhattan
At that point, biella and micah had to meet some friends at one cinema to
see the Wal-Mart documentary. We went to a funky place to have some tea,
decided to go see Times Square and then walk to Central Park. At the time, mako
was arriving to NYC on the Chinatown bus, so we agreed to meet in a restaurant
to have lunch. Paul Sladen finally managed to get lost, after many tries during
the day, and wasn't seen until we got back home.
Mako and Mika waited for us at the door of an... ethiopian restaurant in the
SoHo, despite Mako knows I can't stand spicy food. But in the end it wasn't so
bad, I just needed a few more glasses of water than average. And I finally got
to know mika, after lots of time of chatting over IRC. Greg, SPI's lawyer, also
appeared, and was a nice addition to the group.
Mako knew where to take us after that. The Belgian bar was packed, but there
was a private party in one of the spaces and we took over some of that space.
After a few rounds, we were ready to leave the pub and go for Falafel and some
tea. I was terribly falling asleep though, so instead of tea we took a cap back
to Brooklyn, where we found Paul waiting at the door.
After an hour of inflating a mattress, we were ready for sleep, at 4AM. It
didn't look like the morning after would be very productive...
Next.