Perl, Python and Ruby (in 2003)

Posted in programming at 11:10 pm by danvk

By the end of summer 2003, I was tired of Perl and ready to pick up a new scripting language. The only question was which one to choose, Python or Ruby? I staged my own shootout to decide. A hard drive crash prevented me from putting it online at the time, but I recently found the writeup, which you can read here. The short and sweet:

First of all, I’ll throw Perl right out. I love the language, but not for object-oriented programming. To write a purely procedural program I’d take it over both Ruby and Python any day of the week, but not for OO.

If I had my choice in the matter, I would use Ruby. It’s [sic] syntax seems cleaner, and it’s object orientation doesn’t seem hackish in the least. It’s performance, however, left a lot to be desired. Granted, deep recursion probably isn’t the most widely used technique, but there’s no reason it shouldn’t work. For a different sort of problem, I’d likely choose Ruby, though I’m worried I might have to switch over to Python if I ran into similar problems.

It’s interesting to read this in retrospect, knowing that i used Perl for the next three years before switching to Ruby this past summer. It was hard, but I developed a rule that’s helped. If I start writing a Perl program and it’s longer than two lines, I’ll switch over to Ruby. I’m typically glad I did. I’ve often wondered, in retrospect, why I didn’t switch back then.

First of all, why oh why did I have to use the Josephus problem? I’d been reading the Mozart/Oz book that summer and it seemed reasonable. I’d also just completed Rice’s Comp 212 class and thought that Objects were pretty neat. This test came from the Mozart book, used objects, and had a cool name.

Unfortunately, it also exposed a low stack limit in Ruby 1.6. If only I’d known about the ulimit command back then. If only Ruby 1.8 had been released on July 4, 2003 and not August 4. I can run the same Ruby program now and get up to N=547 with no difficulty. Recursion isn’t a particularly common technique in Ruby, so this test artificially punished it.

So why didn’t I follow my own advice and switch to Python back in 2003? Rather than throwing out Perl, I threw out OO. My post-Comp 212 interest in OO faded quickly, and it was back to Perl for those “purely procedural programs.”


First impressions of Firefox 2.0

Posted in reviews at 9:58 pm by danvk

On the off chance that you find out about it from danvk.org, the Mozilla Foundation has released Firefox 2.0, and you should go get it.

I’ll admit, I’m not exactly excited about Firefox 2.0. None of the new features are earth-shattering. The ones I’m most excited about are corrections of idiotic behavior that should have never happened in Firefox 1.5 to begin with.

  • Spellchecking

    Or rather, “spell checking,” as Firefox suggests. Some other words I was surprised not to find in the FF dictionary: ‘toolbar’, ‘firefox’ (!) and ‘frontmost’. It’s a cool feature, but I’ve been using Camino for the past few weeks, so it’s nothing new.

  • RSS

    The “live bookmarks” feature has always been stupid, but now FF is less insistent that you use it. I’ve trained myself to never click the orange feed icon in the location bar. It got mapped to NetNewsWire on my Macbook, and FF 1.5 offered no clear way to unmap it. I use Google Reader now. FF 2.0 is much better. It gave me a list of possible actions to take (including Google Reader) and there’s a place in the Preferences to change my decision later.

  • Tab Bar

    At long last, tabs have their own X’s. There’s also a minimum tab width: if you open up enough, you’ll get scroll arrows on either side of the tab bar. Scrolling through tabs this way seems like it could be pretty obnoxious. If you’ve got a way to do horizontal scrolling with your mouse (or MacBook trackpad), it works much better. Oh, and remember those X’s? They disappear from all but the active tab when you have enough open. It’s good that FF tries to free up space to display more of the title, but if I have that many tabs open, it’s much more likely that I’ll want to close an inactive one!

  • Saving Sessions

    This one’s a major disappointment. I thought Firefox would remember which tabs I had open whenever I quit and restart FF. Apparently not. It only comes into play when there’s an unexpected close, e.g. Firefox crashes. I wish there were an option to always run the session saver when Firefox starts. Also, the “recently closed tabs” menu would be better if it worked across sessions.

  • Another cool feature: it uses Google Suggest to complete your searches. Now I can uninstall Google Toolbar! I’ll use Firefox 2.0 on my laptop until it gets pushed onto the linux machines at work, but unless I find something unexpectedly great, I’ll be heading back to Camino soon.

    Update: Ryan over at Lifehacker points out that there is an option for reopening sessions on startup. It’s Preferences->Main->”When Firefox starts: Show my windows and tabs from last time”.


Shared items in Google Reader

Posted in personal at 7:29 pm by danvk

I’ve added a link in my blogroll to my shared items on Google Reader. I share whatever stories I find particularly interesting. It’s usually fairly low volume: a story every day or two at most. You can view my shared stories here or subscribe to this feed.

Sharing is one of the coolest features of Google Reader, and certainly its most viral. It makes me want to convince all my friends to go on Reader and share their favorite stories.


Delicious Library

Posted in books, programming, reviews at 12:25 am by danvk

Delicious LibraryEarlier today, Ars linked over to a great list of Mac applications that make switching worthwhile. I’ve used plenty of them, (Adium, Transmit, VLC, Firefox, Thunderbird) but there was one app I’d never heard of that especially stood out to me. It’s one of those brilliantly simple ideas that I wish I’d thought of first.

Delicious Library turns your MacBook’s iSight camera into a barcode scanner. Just put wave a book in front of the screen and DL fills in all the details. This is so spectacularly cool that it just must be tried. The scanning was accurate whenever it worked, which was about 90% of the time. Some books have smaller-than-normal ISBN barcodes, and these gave it trouble. The only downside is that it’s a limited demo, and the full application costs an outrageous $40.

Before I discovered the San Jose library, I had an idea for a 20% project at Google. Wouldn’t it be cool if every Google employee made a list of the books they owned and were willing to share? I doubt there’s any library that could beat the Google workforce in sci-fi or CS literature. The problem with this idea is that data entry is painful. I can’t imagine typing every single ISBN of all my hundreds of books onto a computer, let alone convincing other people to do it. Delicious Library turns this problem completely on its head. Not only does it make entering ISBNs easy, it makes it exciting. I wouldn’t have thought that was possible before discovering this program.

I really wish Delicious Library was open source. If it were, I’d implement that Google Book share. But as it is, I’d be stuck learning Apple’s iSight API, the intricacies of barcodes, and probably Objective-C/Cocoa. I’m sure it would all be very interesting, but not when I’m already developing software fifty hours a week…


Excited about a Library

Posted in books, personal at 11:35 pm by danvk

One of the biggest things I miss about not being in school anymore is 24-hour access to a research library. Even though not everyone at Rice sang Fondren’s praises while we were there, we’re realizing that, in retrospect, it was pretty great. Not every university library is open 24 hours. A friend of mine recommended The Leviathan and the Air-Pump recently, and I set out to get a copy.

Fortunately for me, I discovered the MLK Jr. branch of the San Jose library system. (does anyone have more stuff named after him than that guy?) It’s a research library associated w/ San Jose State University, but it’s also open to the public. It had my book, and it also had the greatest math book ever. I don’t know how I’d feel about the public access if I were a SJSU student, but it’s perfect for me.

The library is brand-new and must have been designed by the same people that redid the first floor of Fondren, aka Spaceship Fondren. My favorite “feature” of the library: a giant ticker counting off the number of books that had been checked out from the library. It was up to about 46 million after three years of operation. I told the circulation people that they were ambitious: there was room for at least four more digits. At 15M books/year, it’ll take them 64 years to get to a billion, and just over ten times that to use all the digits. 660 years? I can think of some university libraries that have probably been around that long…

« Previous entries Next Page »