Monthly Archive for January, 2006

Commuting from Hell when Hell freezes over

Just when I thought the worst was behind me, having avoided the airline workers’ strike, the fiercest snow storm in the latest 30 years hits Northern Italy, rendering most airports almost inoperative. I give myself one chance in about 100,000 to actually make it there tonight and not having to spend another night in Amsterdam. Actually I hope to board the 7.20 plane tomorrow morning.

The photo below, which was sent to me by a colleague, demonstrates just how bad the situation is down there.

smart.jpg

Update: this was written from a hotel room near Schiphol airport. I’m booked on the 7.20 plane, but I’m not sure it will take off on time, if at all.

Final update: 7.20 plane was cancelled, made it on the 9.40 flight to Rome and took a train from Rome to Milan. Made it home about 21 hours later than expected, but at least I made it.

Ruby for Java Programmers, Part III

Just tried to perform the same test I did in Part II using YAJB instead of rjb. Unfortunately, I wasn’t able to obtain any result, since even a simple program like:

require 'yajb/jbridge'
include JavaBridge
jimport "java.io.*"

fails with a java.lang.OutOfMemoryError. This is on OS X 10.4, YMMV.

Ruby for Java Programmers, Part II

Part I is here.

As promised, I will now try to invoke some more complex Java classes from Ruby code. Since I might need this for a real project and one of the things I find missing in Ruby is an RSS/Atom parser that offers the same features as Rome, I figured I might just try fetch and parse an RSS feed using Rome via Ruby.

Even something simple as fetching a single feed using Rome involves a handful of classes and methods. If all you need is getting at feed entries from your Ruby code, you’d be much better of if you encapsulate API calls in some higher-level class that is intended to be called from Ruby. This will avoid you the hassle of importing more than one class and calling overridden methods for which you’ll have to supply signatures and such trivia. This is just what I did in Fetcher.java:

import java.net.URL;
import com.sun.syndication.feed.synd.SyndFeed;
import com.sun.syndication.fetcher.FeedFetcher;
import com.sun.syndication.fetcher.impl.FeedFetcherCache;
import com.sun.syndication.fetcher.impl.HashMapFeedInfoCache;
import com.sun.syndication.fetcher.impl.HttpURLFeedFetcher;

public class Fetcher {
	public static SyndFeed fetch(String url) throws Exception {
		URL feedUrl = new URL(url);
		FeedFetcherCache feedInfoCache = HashMapFeedInfoCache.getInstance();
		FeedFetcher fetcher = new HttpURLFeedFetcher(feedInfoCache);
		SyndFeed feed = fetcher.retrieveFeed(feedUrl);
		return feed;
	}
}

Calling this class from Ruby is straightforward enough:

require 'rjb'

Rjb::load('.:rome-0.7.jar:rome-fetcher-0.7.jar:jdom.jar:jdom.jar', [])

fetcher = Rjb::import('Fetcher')
feed = fetcher.fetch(ARGV[0])
p feed.getTitle
entries = feed.getEntries.iterator
while entries.hasNext do
    entry = entries.next
    p "#{entry.getPublishedDate.toString} #{entry.getTitle}"
end

Two things to note here. First, it would be great if the Ruby-Java bridge would pick up JavaBeans conventions and allow you to simply write entry.title instead of entry.getTitle.

Second, I will probably need to convert Java dates to Ruby Time objects by formatting as a string and then parsing it back. It would also be useful if the Ruby-Java bridge could provide more automatic type conversions, where such convertions are possible, besides simple strings.

Ruby for Java programmers, Part I

This is the first article in a series that I plan to write in order to describe my experiments with combining together Ruby and Java. The reason I’m doing this is that, as much as I find Ruby on Rails to be fun and agile and all-around great, still I haven’t grasped much of Ruby the language yet, so I sometimes find myself wanting to reuse some Java code (and there’s a helluva lot of it around, free for grabs) instead of thinking about a rewrite.

One of the things I’d really want to be able to do is call Java code from Ruby. There are some projects intended to provide a Ruby-to-Java bridge, even though none of them seems to be really mature. The ones I found mentioned more often seem to be RubyJavaBridge and YAJB.

Let’s start with the former. After downloading and unzipping the file, you should read the provided readme.txt file, as there don’t seem to be instructions on the website for actually performing the build. If you’re under OS X, make sure the JAVA_HOME environment variable is set (should be something like /Library/Java/Home, unless your setup is peculiar). Also, ignore everything about the LD_LIBRARY_PATH variable, again if you’re on OS X.

Then you can try configuring and compiling the sources with:

    ruby setup.rb config
    ruby setup.rb setup

On OS X, this will fail, as the off_t type is used but never declared. I assume it gets defined in one of the included C header files in Linux and Windows, but under OS X it’s to be found in <sys/types.h>, which is not included. You can fix it by adding the following statement:

#include <sys/types.h>

to file ext/rjb.h, around line 25 should be fine. After this, everything should compile and install fine just by following the instructions.

Next I did a series of tests with simple Java types to confirm that the JVM was loaded and that the basic functionality of the bridge was fine. In the coming days I plan to invoke some more complex library and report my findings in further installments of this series.

My “Commute from Hell”

I’m in Amsterdam again this week, against all odds. I say this because the Alitalia workers canceled today’s strike at the last moment, otherwise I’m not sure my plane would have taken off at all. Borrowing a moniker from Ron from Xooglers, I might start to label these trips my commute from hell:

  • Wake up at 4.15AM.
  • Board a bus at 5.00.
  • Check-in, security control, board plane.
  • Take off at 6.55.
  • Landing at around 8.40.
  • Taxing on the runway for 20 minutes (yes, Schiphol is big).
  • Board a train at around 9.20.
  • Board the subway, three stops.
  • Be at the customer’s at about 10.00.

Five hours from leaving to arrival is not that bad, actually.

The trip back is even worse, having to land at a different airport and with a margin of about 15 minutes to take the 9.10PM train home. Of course, if the plane is 20 minutes late like last week’s, I have to take the 10.25 train. Otherwise I can make it in just a but less than six hours. In order to maximize my chances of making it, I decided to travel with carry-on baggage only and cram everything that I need for five days inside there.

The real problem is that, given the semi-permanent state of conflict between Alitalia and its employees, no flight is really guaranteed. And I can’t find a KLM flight at decent times.

Luckily, this state of things is going to last until the end of February at most, so it’s not like Ron who commuted from hell for more than a year.

Moreover, the weather is nice and I was able to get some rest this last week-end, which makes the travel more acceptable. I plan to go skiing next week-end, however. I just hope I’m not going to die of exhaustion on the following Monday.

New “Google: Evil or Not?” features

As promised, here’s a couple new features for Google: Evil or Not?. First, by popular request, gone are the percent values on the vote labels, substituted by textual labels like: “Real good”, “Almost good”, “Not too bad”, “Almost evil”, and “Real evil”. Not a big deal, since besides the labels the rating system works just like before. The trend graph is also still showing non-negative percent values, but that’s just because the graphing library I’m using does not correctly plot negative values.

More interesting is the option of voting for the removal of items that are not pertinent, giving users a certain amount of editorial review. After a certain number of removal requests has been received, the item disappears from the page. I hope that users will be able to keep the site clean by themselves and not find clever ways to abuse it, but I’ll try to keep an eye on it.

Last but not the least: The page for yesterday will be shown if there aren’t yet any items for the current day, instead of showing an empty list. This fix has actually been online since a few days ago.

Gmail delete button is here!

Everybody, including yours truly, has been clamoring for it for ages. Now they’ve done it. The Gmail user interface now includes the most requested feature ever: A “Delete” button!

Gmail delete button.png

Google’s evilness low as a result of refusing to give in to Bush

patriotsearch.gifGoogle’s stance on the DOJ request to turn over its search records was really appreciated by people, as yesterday’s 16% evilness rating (with 1084 votes so far) shows. I really think we need similar pages for Microsoft and Yahoo! I’m sure we’d have seen a pretty significant difference.

I have some changes for Google: Evil or Not? that I plan to publish this week-end, if I can make it, but adding new targets to track is going to take more time.

In the meantime, if you actively want to contribute to the war on terror with your searches, head over to Philipp’s Patriot Search engine. I would myself, but before I do, I want assurance that they won’t turn any of this dat over to Karl Rove ;) .

Amsterdam Java Meetup – 24 February

Alef: “After the first successful Java Meetup in Amsterdam, held last November 11th, I’d like to promote all this to a quarterly event. That’s why you’ll have to block February 24th in your agenda coz’ from 6 o’clock on, there will be beers again in a place yet to be announced.”

As I am in Amsterdam now, and will probably be here most of the time between now and the end of February, it would be interesting to join. However, I’m wondering whether the official language of the meetup will be Dutch or English and, if the former is the case, whether my knowledge of Dutch can be brought up to the level required to follow a conversation about Java in slightly more than a month ;) .

Update: I just noticed that the 24 is a Friday. Too bad, as even if I’ll probably be in Amsterdam that week, I’ll be taking a plane back home by Friday afternoon.

The “Evil or Not” Google homepage module

Just got news, from Corsin, of a Google personalized homepage module for displaying the current evilness rating from Google: Evil or Not?. Check it out!

If some people are wanting to display the current evilness trend graph on their website or blog, please feel free to link directly to http://evilornot.info/browse/trend.png, maybe scaling the size down if you like.

Trend

Best blonde joke ever

I don’t usually link to blonde jokes. But this one is too good to pass on. Possibly the best blonde joke ever.

More on “Google: Evil or Not?”

Looks like Google: Evil or Not? arose a bit of a buzz in the blogosphere. Thanks to everyone who linked to it (and Philipp in primis), we gathered more than 5000 votes. Keep them votes coming!

I also got some interesting suggestions towards a better implementation of the concept. Some people complained that the “0% – 100% evil” scale is confusing and I actually agree. I’m thinking of substituting the numerical values with something like “Totally good”, “Almost good”, “Indifferent”, “Almost evil”, “Totally evil”. What do you think?

TDavid asked for some editorial control on the relevance of the aggregated items. This would certainly make the website more interesting, but would require that I dedicate some time to manually filtering posts. While not much, I’m not sure I can sustain this activity in the long run. You see, Google: Evil or Not? is just a fun application that I hacked together in a couple of evenings during my year-end vacations, mostly to learn programming with Ruby on Rails. I am grateful for all the suggestions and critiques I received, but people shouldn’t expect to much out of it, unless I can find some way to monetize the traffic, a thing that I don’t foresee yet, at least in the near future.

One option might be giving user the option to filter out irrelevant items by voting them out. If a certain threshold is exceeded, the item goes automatically in the trash bin. Shouldn’t be too hard to implement. I’ll have to think about it.

Google: Evil or Not?

Do you still believe the “Do no evil” Google mantra? Do you think Google Book Search, the AOL deal, and Larry and Sergey’s 767 point to Google losing it’s pristine morality and turning over to the dark side?

Now you can discover what the world thinks and contribute your own opinion. Head over to Google: Evil or Not? and vote with your mouse. Every day, the site presents you with a selection of relevant news snippets and, for each one of them, you can select the level of Google evilness, or lack thereof, that is suggested by it. Let the collective wisdom of the Web decide whether Google is evil or not!

Alright, it’s a silly little app, but it could be fun. It’s also my first application developed with Ruby on Rails and it’s fully Web 2.0 compliant, uses RSS and Ajax and leverages the power of the community. What more could you ask? ;)

(Belated) First Re-blogiversary

Pardon the horribly twisted title, but I just realized that it’s been a little more than one year since I’ve resumed blogging, with a new domain and a renovated resolve to keep it up seriously. My first post was on Jan 4th, 2005, so I’m eight days late in celebrating, but that’s not important.

For most of 2005 I wasn’t attracting much traffic, but things started to pick up well at the beginning of November, probably due to an update of Google’s index. I can now count on 600 average daily visitors, excluding feed readers, of whom I have no idea how many there are. I seem to remember that a few years ago, when I started blogging for the first time, attracting visitors was much easier, as there was probably much less competition around.

Anyway, it’s been a good year for blogging and the perspective on 2006 looks brighter still.

Tunatic

Tunatic.pngTunatic is a nifty little app that listens on your microphone and connects to a server to identify the song that it is listening to. While this might be useful for the times when you’re hearing a song on the radio or the TV and can’t make out what the song name or artist is, it can also become mildly addictive, as you throw at it more and more songs to see which ones it recognizes and which ones it doesn’t.

I have to admit it’s pretty good at guessing most songs, which makes it even more addictive, even though it failed to recognize a classic like Jethro Tull’s “Aqualung”.

I wonder what the business model is. It’s true that when a song is recognized, you can click on the little arrow at the right to open a page with some affiliate links, but I’m not sure this will be enough to cover bandwidth costs if it ever becomes successful.

In any case, kudos to Sylvain Demongeot. Tunatic is a cool idea that has been brilliantly executed.

Via Torsten.

Give me more leeches

I totally agree with Jason Calacanis here: “This the studipest thing I’ve read in a long time.”

Looks like Jakob has a big problem distinguishing between organic and sponsored search results. The picture below is from this site’s statistics in January:

Visits by source

As you can see, direct and non-search-engine referral hits are a tiny minority for me. Almost 85% of my traffic came from Google alone! How much did it cost me? Zero!

A decent percentage of these visitors also do click on ads, which brings the net value of search engine traffic to a net positive. If search engines are leeches on the Web, give me more of them!

It’s a bird! It’s a plane… It’s a MacBook!

graphicsinsidedisplay.pngAnyone wants to buy a 1.25GHz 15″ PowerBook for cheap? I’m really thinking of putting my hands on one of the new Intel MacBooks. I was prepared to be disappointed by this year’s Macworld keynote, as I didn’t expect much more than an Intel Mac Mini or iBook, but Jobs surprised all of us with the new products. Hereby some impressions on the announcements.

Sporting a brand new Intel Core Duo (Yonah) in a laptop, Apple is once again at the head of the pack, even in the hardware arena. And to think that it’s been barely seven months since the Intel move has been announced. Many observers predicted that it would have taken much longer for Cupertino to deliver its first significant Intel models, and that the wait would have cost them a significant drop in market share in the meantime. Nothing of this has happened and we can expect to see more and more Apple laptops around. With the new MacBook, there is no compelling reason (apart from the price maybe) for geeks and even most ordinary people to use a Wintel machine.

The price difference between the 1.67GHz and the 1.83GHz models is huge, even after upgrading memory and disk on the slower one. I’m not sure I’d take the latter.

The absence of an internal modem and a FireWire 800 port is mildly annoying. But I used the former only occasionally and never the latter, so I can live with that.

The new iMac and the software: nothing interesting to me here. My recently bought iMac G5 20″ is still a great machine and the software is nothing more than updates, apart from iWeb for which I have no use, personally.

For Gianugo: to me the MacBook looks the same color as the PowerBook, that is aluminum (not titanium). The darker color in some photos looks like an artifact of lighting.

Yahoo! Go not for me

ma_y_go.gifI just installed Yahoo! Go on my Nokia 6630, after reading Russell’s announcement.

I don’t think I’ll be using it much, though. Messenger is cool, and most of my co-workers are on Y! Messenger, but not all of them and not all my friends. This is why I mostly use Adium on the Powerbook.

Being able to send photos from the phone is also nice, but as I’m using Flickr (note to self: upgrade to pro account and upload all the recent holiday photos) and not Yahoo! Photo, it’s not much use to me. Fortunately, Russ says they’re working on Flickr support, so maybe it could become more useful in the future.

I don’t have much use for the other services as well, but still I think it’s an interesting development.