Blog di Rovinare di Sid
Objectivity Implemented in Thought, Action, Computers, and Photography
Archive mode
(Week of 10.04.2005)
Sunday, 10 April 2005
Converting Opera bookmarks to Firefox —
I have decided to give Firefox another try as my primary web browser on the Mac, but Firefox can't import Opera bookmarks. There are a couple of tools available to convert bookmarks between various browsers' formats, but they either suck or are not free or don't work (subcategories of suck). I thus had to write my own converter, so I wrote a short little Ruby script to convert my bookmarks from Opera's to Netscape's format. To use it, just export your bookmarks from Opera and do
$ ruby bmconv.rb opera6.adr > out.html
It's BSD licenced of course.
A couple of observations:
- It sure is nice to add methods to pre-existing classes (Object in this case), although I've done this before with categories in Objective-C.
- Ruby's open-ended slicing syntax is kind of lame. In Python, you
just say
foo[3:], but in Ruby, you sayfoo[3..-1]which doesn't do what you'd think just from looking at it since it turns out that ranges with .. are inclusive and ranges with ... are exclusive. (Pythonfoo[1:-1]is Rubyfoo[1...-1]orfoo[1..-2].)
Update: This file has been moved. See the updated entry.
posted by Sid at 15.35 / 899 [ Comments: 0 ]
Copyright © 2002-2008 Sidney Cammeresi. All rights reserved.
The moral right of the author has been asserted.



