Read and Epub and beyond

For the past few weeks, I have been spending most of my time implementing Epub support for Sugar’s Read activity. Epub is gaining increasing acceptance, and a few weeks back, Project Gutenberg started distributing many of their material in the format, and Google + Sony also seem to have started to distribute a large chunk of public domain books as Epubs.

Today I finally reached the stage where the work could be tested on an actual XO, and here’s how it looks:
Read opening a Epub file on an XO

The rendering is done using WebkitGTK (the Python bindings) and I was a bit concerned about the possible performance issues on the XO-1 (which has a relatively ancient processor, slow filesystem access, only 256 MB of RAM and no swap). The biggest worry was the loading time – since it involves pre-rendering the entire book to gather metrics for pagination (most Epub books I have come across do not have clearly defined page-breaks, so that has to be figured out), but to my surprise (and relief) the load time turned out to be quite acceptable.

Right now, the viewer supports a very limited subset of the Epub standard (and works only with XHTML based Epubs), but so far it has managed to handle all the files I have tested it with. The viewer is a standalone widget used by the , which should make it possible reuse the work to develop a Epub reader for GNOME as well.

Once the Epub support in Read reaches an acceptable state, the plan is to start working on implementing support for the draft Open Publication Distribution System specs, which allows ebook distributors to distribute e-books via XML catalogues. It makes sense to support this in Read, as well as in the school server, to ease the e-books distribution process. For example, if we have a large e-book collection for a particular deployment, it may not make sense to put all of them in individual laptops – instead allowing the user to browse/search the catalogue and download the books as and when required would probably be a better option.

ভাল আছি, ভালো থেকো

Listened to a wonderful rendition of ভাল আছি, ভালো থেকো by an old school-friend of mine, and I couldn’t resist posting the lyrics. Apologies to my non-Bengali readers.

আমার ভিতর বাহিরে অন্তরে অন্তরে
আছো তুমি হৃদয় জুড়ে।

ঢেকে রাখে যেমন কুসুম,
পাপড়ির আবডালে ফসলের ঘুম
তেমনি তোমার নিবিড় চলা
মরমের মূল পথ ধরে।

পুষে রাখে যেমন ঝিনুক,
খোলসের আবরনে মুক্তর সুখ
তেমনি তোমার গভীর ছোঁয়া
ভিতরের নীল বন্দরে।

ভাল আছি, ভালো থেকো,
আকাশের ঠিকানায় চিঠি লিখো
দিও তোমার মালাখানি,
বাউলের এই মনটা রে।

Updates

  • A global dictionary for Sugar:: While working on the bookreader capabilities of the XO, I remembered how on almost each and every birthday during my primary school years, someone would give me one of those “pocket” dictionaries. Even in college, I would see students coming from Bengali medium schools studying their engineering textbooks with a dictionary by their side. Thinking that it would be useful to have such a dictionary built into the Read Activity, I started coding, and after sometime, I had a utility which worked for not only Read, but for any random Sugar Activity. Just select some text, hit a shortcut key, and you get a model dialog with the definition of the highlighted word(s) (we are considering whether instead of only a shortcut, this should be triggerable via a persistent icon on the frame). Here is a video of the (prototype) feature in action.
  • L10n infra migration::Over the past few weeks, we migrated our Pootle based translation system to a new server. The transition seems to have succeeded without major hiccups, and I also managed to sneak in a feature which would show the status of a PO file (results of msgfmt –check, as well whether the file has been committed to the VCS or not) in the statistics view.
    New features in Pootle

Why should I bother ?

Warning: This is a rant. Feel free to ignore

I love coding in Python, and in spite of some of the occasional issues it can cause, I feel that it lets one accomplish whatever one wants to do with the minimal amount of magic incantations. So naturally, I have been trying to convince my friends from college to try out Python, but after a few incidents I’m not so sure if I have been doing the right thing. Couple of events will explain the situation:

Scene I – Interview for positions in one of the “big four” Indian IT companies:
Friend of mine has Python listed under the skills sections in his CV
Interviewer: ওরে বাবা তুমি তো পাইথন জানো। (TRANS:Wow (in the sarcastic sense) – you seem to know Python)
Friend: হ্যাঁ (TRANS:Yes)
Interviewer: আচ্ছা Java জানো কি ? (TRANS:So, do you know Java)
Friend: যতটুকু কলেজে পড়িয়েছে, ওইটুকু, তার থেকে বেশী জানি নাহ (TRANS:Not much, just whatever they have taught in college) (the college course covers Java as an example of a Object Oriented language, so it does not go very deep)
Interviewer: আচ্ছা, এটা বল তো… (TRANS:All right then, answer this)
Interviewer: pretty convoluted question from Java – involving complicated API stuff and such
Friend: বলতে পারবো নাহ (TRANS:Sorry, I can’t answer this)
Interviewer: যা, এইটুকুই জানো না, আর পাইথন ফাইথন কী সব শিখে ফেলেছ ? (TRANS:Bah! You don’t know such basic stuff, and on the other hand, you have learn’t Python and whatnot!!)

Needless to say – the guy did not get selected, and got rid of Python from his CV.


Scene II – Yet another interview, this time for a “research” position in academia
Friend of mine has been learning PIL, PyGTK, etc and has Python listed in his CV
Interviewer: আচ্ছা, এই পাইথনটা কি ? (everyone in interview panel make weird facial expressions) (TRANS:So, what is this Python “thing”?)
Friend: <explains>
Interviewer: আচ্ছা এটার এরকম বিচ্ছিরি নাম কেন ? (TRANS:So, why does this have such a weird sounding name?)
Friend: <explains, mentioning Monty Python, etc>
Interviewer: দেখো, আমরা তো এসব জানিনা, আমরা সাবজেক্ট জানি। তুমি বরং কি সাবজেক্ট জানো বল (TRANS:Look, we do not know these things, we know “subjects”. What “subjects do you know ?)
<..and the interview continued with some very standard (and stupid, IMHO) questions (most of which, I believe are lifted from this particular book). My friend answered all of the questions, except for one.>


Friend later tells me: ওইরকম মুখ বানালো – ওই দেখেই বুঝলাম হবে নাহ্‌ । আমি আর কোথাও পাইথন জানি বলছি নাহ্‌ । (TRANS:From their expression on hearing the word Python, I knew I was not going to crack this interview. I’m not going to mention Python in any future interview.)


When the first incident happened, I thought it was a isolated case. But after the second one, I don’t think it is (and there has been at least one other similar case as well). In fact, when the campus recruitment started for our batch in college, a very senior and respected faculty member told me that my chances of getting placed from college was very slim. I did not appear for any of the recruitment programs (and almost got fined by the college authorities for being “absent”), so I did not get the chance to test out his theory – but that’s a different story altogether.
For the second incident, one may claim that the interviewers were perhaps looking for someone who had a good “theoretical understanding” or had “strong fundamentals”, but I have my doubts (primarily due to the generic crappy questions that were asked afterwards). The first incident on the other hand, points clearly towards something being very wrong with the interviewer.
The question that arises after all this is, why should I ask people to learn Python, or for that matter anything that is not covered by the officially sanctioned syllabus ? On one hand, our “progressive” political leaders and leaders of our various industries speak about nurturing and enhancing “talent” to build a better India, and what not. In the real world on the other hand, at the very ground level, the same institutions that the leaders are supposed to be the patrons and creators of, encourage nothing but mediocrity. End result: each year, thousands of bright young students get turned into zombies. What a terrible waste… what a terrible waste…

Updates..

This blog has not seen much activity in a while, so here goes:

  • Bought a HCL touch-screen based netbook. It’s somewhat ancient hardware, but most of the stuff works out of the box (except for the webcam, which does not even show up in lshal or lsusb). The touchscreen required a binary driver – but a Free/Open Source version seems to exist, though I could not get to calibrate the screen with the FOSS driver variant
    [Update: The webcam works - I had to press Fn-F5 to enable it. It is turned off by default to conserve battery.]
  • Taught myself (this was long overdue – but at least now I can admit that I did not know what I used not to know) how to properly write Python extensions in C. I started out with bindings for Hunspell (I’m reading up a bit on morphology nowadays, and finding it to be tremendously entertaining). There was a Python extension for Hunspell already, but it did not compile for me, and that pushed me to decide to figure out how to do this myself. One thing led to another, and so, as of now, there is (in progress) extensions for handling:
    • Hunspell. Usage instructions here
    • libgettext-po. This should be faster than the existing pure Python based PO file parsers out there. (maybe at some point, I could make Pootle/Translate Toolkit use this, and make the work of OLPC/Sugarlabs translation team members somewhat less frustrating.
    • XKB. I must admit that I took a shortcut for this, and this extension is actually based on the awesome libxklavier. The final plan is to develop a Sugar extension for managing the keyboard options and layouts using this extension. The code in the main git repository, though fairly complete in terms of what is required for Sugar at the moment, is not implemented via (py)gobject. Implementing the pygobject-based wrapper is turning out to be a bit more complicated than I initially thought, but some code for that is also available in this repository (it is somewhat easier now, since I know (at least most of of) what is happening under the hood).
  • Released a newer version of the FBReader activity, which is much more improved in terms of usability (eg: response to the game keys keys while the XO-1 is in tablet mode is much more smoother, and all the keys do something useful). People seem to be happy with the new release.
  • Coming back to the present, right now, among other things, I’m working on a few interesting (and important) enhancements for the book-reader(s). Some of them include support for long keypresses (eg: pressing the “square” game key for two seconds will show the table of contents), notification of critical power events (I realized to my horror during dogfooding, that in tablet mode, while the book reader is open in full screen, there is no way to tell how much battery-charge is left), etc. The bookmark support feature that I came up with a few months back needs a bit of polish, but I think I can make this show up in the next release of Read.

19th March, 2009

  • Sucrose 0.84, the latest stable version of the Sugar educational platform has been released. A large number of bugfixes, new features, improvements and tweaks have gone in during the past six months, and to try out this release, you can use Sugar on a Stick.
  • Sugarlabs (the organisation which is currently driving the development of Sugar) is a mentor organization for Google Summer of Code 2009. A list of ideas is currently on the Sugarlabs wiki.
  • It looks like Google has decided to publish out-of-copyright books as ePub files for the Sony Reader. This is awesome news, all the more so since some of us have been working for the past few weeks to ensure that more ebook formats are supported in Sugar. As a part of that, I have created a Sugarized version of FBReader, which handles epub files superbly:
    FBReader Activity for Sugar

    FBReader Activity for Sugar

The GNOME.Asia Summit, 2009

We have been informally discussing the idea of hosting GNOME Asia 2009 in India this year, and a initial TODO list and a set of ideas has been just posted on the gnome-india mailing list.
We would need a lot of effort to make this happen successfully, and if you are interested in helping out, by all means, please jump in :-) . Join the mailing list, and start taking part in the discussion. There is also a set of pages on the wiki, please feel free to put in your thoughts and suggestions in those page as well.

16th February, 2009

  • Pootle migration: We are moving the OLPC/Sugarlabs Pootle instance to a newer dedicated server, which should speed it up considerably. This has also given me some opportunity to fine-tune and polish our l10n workflow – things should be a bit more easier and smoother (and faster) for translators. I also managed to gather some interesting data from the log and user registration files. It turns out that we have more than 1000 translators registered with the system, among whom about half have actively contributed translations in the past one year. I’m not sure what the user statistics for other Pootle installations are like, but it seems that we are one of the larger users of Pootle out there.
  • Read hacking: I have been also spending some time hacking on Read. While Mr Super Awesome Tomeu has been pushing our Evince patches upstream, I have been working on a few interesting features for Read (we have moved to Gitorious, which is so cool):
    • Support for books from the Universal Library: Many of the scanned childrens’ book from the Universal Library Project are too graphics heavy for the XO hardware to be handled in PDF form. However, it looks like the project also stores the book as zip files with each scanned page archived inside the zip file as individual jpegs – which in other words, is very similar to the comic book archive format which Evince (Read’s backend) supports quite nicely. More importantly, this format seems to have lesser performance issues on the XO hardware (compared to graphics heavy PDF files). So I have been making sure that Read also handles this format gracefully.
      Book from the Universal Library in Read
    • Bookmarks support:This has been one of the oft requested features for Read, apart from annotations. The original design specs for Read already provided me with ideas on how the UI should look like, so with some amount of coding, I have bookmark support which mostly works :-) . I am also trying to do the implementation in such a way so that it would be easy to add support for sharing of bookmarks later on in the future. If anyone is interested in doing a project, contact me (hint.. hint ;-) )
      Bookmarks in Read

    Code for the above lives in the sayamindu-sandbox branch of Read’s Git repository. I plan to take a stab at annotations during the next few weeks – I have some ideas which, with some luck, may work. I also have some plans about a saner full-screen/ebook mode for Read – let’s see if I get the time to implement those as well.

  • This came up in one of the mailing lists a few days back. Serves as a reminder as to why the work we all do is so relevant and so important.

Christmas in Mumbai

From my friend Shamashis’s blog:

We took the route down Colaba Causeway, across Metro Plaza, Food Inn, Café Leopold and then turned once again towards Gateway. It was the same scene everywhere. Santa poured out gifts to toddlers, infants, teenagers, the policemen on the street, the security guards of Taj and the shopkeepers on the pavement. Santa went to the kid who sold vada pav and gave him his share. Everyone smiled, everyone was happy. We had achieved our goal. Every moment was turning out to be priceless.

His entire experience is narrated in two parts (1, 2).

FOSS.in 2008

Last week, I attended FOSS.in, and in short, it was awesome. The organisation was superb, the weather was fine (well, maybe not for people who do not like a drizzle or two), and the food was excellent. Many people had doubts regarding the efficacy of the workouts, and in the end, almost all of the workouts had some concrete results to show, which, I would say is a major achievement, considering that each workout lasted for only around 3 hours. There was occasional problems with the bandwidth, but with an event of this size, minor glitches are bound to happen.
Workout in progress
My Sugar/OLPC talk went OK-ish, though it did seem to generate a lot of enthusiastic queries and discussions. It was quite a pleasant surprise on the next day, when a few guys came up to me, asking me to help them with their Sugar installation in Ubuntu and Fedora. Moreover, on the penultimate day, Nirbheek, Piyush and I stayed up till late in the night, excitedly discussing possible Sugar activities that can be developed/adopted. The XO-s, as usual were crowd pullers, and since there were three of them (I was carrying two, Kushal one), we also ran stock Fedora 10 with GNOME on one of them (booting off a SD card). At a certain point, we also ran the Fedora KDE spin on one of the XOs, much to the delight of Pradeepto-da and the rest of the gang in the KDE stall.
Pradeepto Bhattacharya with KDE running on an XOFedora table, taken by Kushal Das
I spent most of the time in the Fedora stall, and it’s really awesome to see the enthusiasm of the Fedora guys. The most common query seemed to be “Do you guys have a copy of F-10?”, and unfortunately, initially, we did not have that. Afterward though, thanks to t3rmin4t0r, we had ISOs available, and quite a few enthusiastic visitors copied them into their portable hard drives/usb sticks. Kushal was slightly over-enthusiastic with his camera (both the still and motion varieties), though he did come up with some totally amazing stuff. Going by the number of DSLR carrying shutterbugs at the event (including yours truly), some have proposed renaming the event to Camera.in for 2009. While talking with the rest of the Fedora guys, I also discovered Kobold, which can be quite useful for distributing Sugar based live images to interested people at events.
The Fedora Table
KarunakarCamera.in ??Kushal
I also had some interesting discussions on various Indic related stuff (going back to my roots ;-) with Gora, Santhosh, Rahul and Pravin. It was mostly comparing notes, and I figured out that this bug in glibc affects all Indic scripts, and not just Bengali. Gora’s session on collation and spell-checking was also pretty interesting, especially since doing affix support in Aspell for Bengali has been on my TODO list for a long time.
In the end, Foss.in is one of those few conferences, which reinforce the feeling of belonging to a community in you. It turns IRC nicks into real human beings, and takes your sense involvement in the community to a new level altogether. Free/Open Source is about more than sharing a common set of beliefs, or a common set of ideas, or having a common set of skills. Free Software brings people having similar passions together, and then creates a bond of friendship between them. It’s about enjoying something together, having fun together, and personally to me, that is perhaps the most important thing. Thanks to FOSS.in, and the Fedora project for letting me have this wonderful opportunity.
Rehearsing the KDE song
My only disappointment during the conference was Karunakar. This was the first time in nearly five years, where both of us have been to the same conference, and I have not been able to take a picture of him dozing off. However, Kushal did manage to get an awesome picture of his teeth, and unknown to him, this picture was the subject of a headline in the first page of the Indlinux wiki, for around an hour or so. :-D

Karunakar's teeth

Karunakar's teeth


And, here’s a picture of yet another amazing thing done by the conference organisers, this one specially for the speakers… a T-shirt with your IRC nick printed on it:
unmadindu, taken by Kushal das

G1G1 2.0

  • G1G1 is back (and we are shipping to Europe as well for this edition). This time, with Amazon around, the delivery issues would hopefully be a lot better.
  • It looks like the XO is topping the Amazon bestsellers list in the computer category today.
  • The laptops can also run GNOME with Fedora as an option (put in an SD card, and it will boot Fedora, pull the card out, and you’ll get Sugar). Someone is already selling Fedora pre-installed SD cards for the XO on Amazon. (of course, you can always create an image, and put it on a SD card yourself)
  • Apparently there is still confusion about OLPC and Microsoft – Greg’s post should clear things up.
  • Among the G1G1 related marketing efforts, there’s a pretty awesome video (I’m trying to find out if there is a Ogg version somewhere), and a cool (though flash based…) “equations to change the world” website, equation.laptop.org.




Just booked the flight tickets for….

Sundarbans

Last week I took a mini vacation and went to a trip to the Sundarbans (the largest Mangrove forest in the world, formed on the delta of the Ganga and the Bramhaputra). I hadn’t realized that it was so close – Gosaba, which is the gateway to the forests is only around 2 and a half hours drive from my house. (we took a “package tour”, which minimized the hassles as we got a car taking us from Kolkata to Gosaba, and at Gosaba a launch was waiting to take us into the forest)

We arrived on a day when Cyclone Reshmi was approaching the region, and the first night in the forest was to put it mildly… interesting :-) . Fortunately the skies cleared up on the second day, and for the next two days, we had an awesome experience, including one of the most beautiful sunsets I’ve ever seen in my life.

Painted boats on a painted river

Sunset

Neel Kantha

Dragonfly

Fishermen

Water Monitor

Stork

Mangrove forests

More photos in this Flickr set.

..and no – I did not see any tigers – we were busy hopping around from one watchtower to another.

l10n: More than one language

Falling back to English when translation of a particular string is not found is not always the best solution. As a practical example, our Aymara users would prefer that the fallback language be Spanish, and only if the Spanish translation is not found, English should be shown.

I was wondering how to implement this for Sugar and its activities, and I realized that something like this is already implemented in Python’s gettext implementation. So after some changes to Sugar, I had the following:

In the screenshot, the Restart Game pop-up is not translated into Aymara, and so it shows up in Spanish as Reiniciar Juego, while the rest of the strings are in Aymara.

Of course, there is a lot more to be done – the Sugar control panel language selector needs to be changed to allow selection and ordering of multiple languages, and currently this works for activities, core Sugar needs to support this feature as well.

XO Software Release 8.2.0

After many months of hard work, OLPC XO Software Release 8.2.0 has been unleashed. This release includes a much improved Sugar 0.82, a transition to Fedora 9, and many more changes and fixes under the hood to increase reliability and security.

Upgrade instructions are available here.