WikiBrowse

From OLPC
Revision as of 13:33, 2 May 2008 by Mchua (talk | contribs) (Introduction)
Jump to: navigation, search


Olpc logo.jpg
Wiki server

Introduction

The Wikipedia on an Iphone (WOAI) project by Patrick Collision makes it possible to have a working, usable mediawiki (read: wikipedia) dump in a very small space (read: the XO's flash drive).

How it works

The mediawiki data dump is stored as a .bz2 file, which is made of smaller compressed blocks (of individual articles). The WOAI code, among other things, goes through and makes an index of which block each article is in. That way, when you want to read an article, your computer only uncompresses the tiny block it's in - the rest of the huge mediawiki dump stays compressed. This means that (1) it's really fast, since you're working with tiny compressed bundles and (2) it's really small, since you're only decompressing one tiny bundle at a time.


What we're doing

We'd love to make this into an XO activity.

The first step is to port the code from Ruby to Python so it'll run natively on the XO - details below in #Help wanted. After that, we'd love to have a few more things done, like...

  • Wrapping this as a Sugar activity (code)
  • Article selection and curation for wiki dumps to use the Activity with (content, curation)
  • Finding some way to handle images - the current code only works with text, and image links are broken. (code)
  • Removing the wikitext parser from the server and rewriting it as an independent plugin/middleware/etc architecture so that other wiki syntaxes can be supported. Javascript, slimming down the current Mediawiki php parser, and Python middleware are all options. (code)

Help wanted

Chris Ball is the person to contact if you're unsure of how to get started.

Porting server code from Ruby to Python

We need a Python programmer (or a small team of Python programmers working together) to start the project off by porting the server code from Ruby to Python so it'll be easier to run on the XO. Ruby's quite easy to read and you don't have to be a Ruby programmer to do this (but it helps if you know Python). The code is very simple and short (less than 300 lines), so this should take no more than a weekend. Here's a suggested how-to-do-it procedure.

  1. Read this page to get an idea of what we're trying to do.
  2. Read the project homepage to get an overview of what the app does. Also see the google code project.
  3. Download the source code and take a look around. Notice how most of the code is either shell scripts or C, but there's a folder of ruby (rb) code. This is the stuff we want to port.
  4. (Optional but recommended): Download and install Ruby and test out the existing code so you can see the app in action. Follow the instructions in the "Getting Started" section of the README file (in the source code you just downloaded) to get a wikipedia datafile parsed and the web server running. We'd recommend using a smaller wikipedia than the English language one.
  5. Take a look at the files in the rb folder. There are four main ones to port to Python (the rest are very short "helper" files and should take just a few minutes to rewrite).
    1. bzipreader.rb (ruby interface to c/bzipreader.c; supports streaming bz2 files) - probably the most difficult, since you'll have to interface your python code with C (bzipreader.c). If someone has a tutorial or resources on how to do this, please post the link here.
    2. index.rb (generate an article-to-block index using bzipreader.rb)
    3. server.rb (Mongrel-based server for using WP dumps with a web browser) - we'd suggest using the built-in Python webserver, BaseHTTPServer, for this.
    4. xmlprocess.rb (generate stripped, XML-less file from a vanilla WP dump)
  6. Put the new files (bzipreader.py, index.py, server.py... etc) in a "py" folder and delete the "rb" one when you're done porting.
  7. Remember to license your work under the GPL (you must, since the original code is GPL) by putting a copy of the license in your folder (or just leaving the COPYING file from the original source in).
  8. Write a README on how to run your ported code and include it in the bundle.
  9. When you have the first hint of functional progress (and definitely when you finish)...
    • let Chris Ball, the library list, and the wikireader list know.
    • It would also be super nice to contact Patrick, the original "wikipedia on the iphone" developer, and work with that community to integrate your code into theirs.
    • This would also be a good time to apply for Project hosting.
    • Contact the testers who have signed up below, and give them instructions on how you'd like them to try out the code you've written, and what kind of feedback you're looking for.

Testers

If you're willing to test code once the developers have it working, place your name below (make sure it links to some form of contact information).