Tag Archives: geek

Linux is for everyone :D

When we says that (gnu)Linux is for everyone :D

via (GeekSugar)

How to search on a MediaWiki (Wikipedia) with Ruby On Rails

I have been looking for 3 days how to search on Wikipedia with Ruby.

After having found the solution, this is really simple :

1. I found MediaCloth

MediaCloth is a MediaWiky syntax parser. You feed it with a media wiki syntax and it’s supposed to return a correct html.
It works, it’s not perfect but it works.

There is a gem so : gem install mediacloth will do the job.

MediaCloth on rubyforge

MediaCloth help ?

2. MediaCloth were working, so let’s code an ugly solution

def ugly

feed_url = 'http://en.wikipedia.org/w/api.php?action=opensearch&search=avignon'
output = "Avignon"
open(feed_url) do |http|
response = http.read
output += response
end

@result =  MediaCloth::wiki_to_html(output)

end

It was working, nearly, but it was very ugly.

3. The Wikipedia Client

After that I found the Wikipedia Client (google source code website).

Install it like every plugin : ruby script/plugin install http://wikipedia-client.googlecode.com/svn/trunk/wikipedia

If you try to run the example now, it will crash, you need to install the json gem : gem install json

Then try


def pretty

page = Wikipedia.find('peanut')
@title =  MediaCloth::wiki_to_html(page.title)
@content = MediaCloth::wiki_to_html(page.content)
end

And now, everything is working like a charm.

Just be careful that the MediaWiki api solution is in beta for the moment. So don’t use it in production ;)

France Vs England : Minitel

Image Credit

There are some French inventions wich have never been abroad. And one of these, is the Minitel.

I was speaking with a teammate earlier today, and I made a joke about 3615 Ulla.

When I saw his face, I remembered that only (old?) French people know the Minitel.

Let me explain :

The Minitel looks like a little TV, with a built-in AZERTY keyboard (yes we don’t use QWERTY … this will be for another post) and a very strange brown color. Pluged in the phone plug, it was the ancestor of the Internet, and perhaps of the PC as a Personal Computer.
The first version was in gray scale then a second one took place in color.

With this machine you could be connected to some Minitel pages by some 36 combinations : 3615 yellow pages for example.

Like in Internet we could :

  • Retrieve information and request it
  • Play Games
  • Access pornographic pages and chats (it was the big part of the Minitel success)

The first version appeared in 1982 in France, and the minitel was really established in the French house by 1990.

After that, AOL comes with his 56Ko FREE Unlimited Connection. Then ADSL, then optic fibre … and the minitel is today somewhere in the house, perhaps on a doily, waiting to be open again … just once …

Wikipedia about Minitel