GCI 2012 and Sahana Software Foundation

This is a post about my experience working with the Sahana Software Foundation, a nonprofit organisation that develops software like Eden, Vesuvius and Agasti to help organisations like the UN in disaster management efforts.

(I was selected as one of the Grand Prize Winners for GCI 2012 from SSF. :D)

The Experience

Before working with Sahana, I’d never really used Web2py, only Flask and Django. So, while reading up on Web2py and S3 (Eden’s custom CRUD framework) I started with some stuff that didn’t require intimate knowledge of them. This included some documentation tasks, and bug hunting tasks (something I really don’t like that much!)

That was when Michael helped me get started with some of the Selenium tests. Before long, I realised that doing them by hand would be repetitive and would get complicated rather quickly, so I wrote a few helpers to make it easier. Later, Liezl added to this to enable automatic comparison with results returned from the DB, greatly simplifying the task of writing Selenium tests.

Then, I helped clean up Trac (either by fixing issues, or by triaging tickets) — much of this wasn’t a part of GCI, but I did it anyway because it was a lot of fun ;)

After that, I worked on one of the bigger issues, the image crop widget. Eden is often deployed in very remote locations where a reliable connection isn’t usually available, so it’s essential to ensure that there’s as little data transfer as possible. The image crop widget, completely implemented using HTML5 and Javascript, simply allows a user to crop large images client-side, without having to transfer them to the server. This might sound easy, but in practice, it’s slightly harder, because of several security restrictions that modern browsers put into place, like fakepath and the “dirty” flag for Canvases. The final widget implements both scaling and cropping both on the client side, and on the server side (as a fallback, where it uses PIL)

The image crop widget in action.

This was followed by some more client-side modifications that used HTML5 (eg. the fullscreen API) and the colour picker widget. All this was relatively easy to do.

Finally, I worked on some of Eden’s GIS components — the hard stuff — imports, deduplication and synchronisation. Now, every time you import POIs from OpenStreetMap into Eden, Eden will automatically sync with OSM and ensure that no duplicates are created on new imports.

All the mentors were extremely helpful throughout, and none of this would have been possible without them.

Thanks, Everyone!

First, a big thank you to all the mentors (in no particular order):

  1. Pat, who would always stay around and help, sometimes even at the cost of her own sleep.
  2. Robby, for his encouragement (and showering me with praises! :D)
  3. Dominic, for being the “drill sergeant” (wink) and really helping out when I got into trouble with S3.
  4. Fran, who helped me with a lot of Eden’s internals, and generally guided me around the project.
  5. Michael, who introduced me to Selenium testing (and helped me with some of my first tasks!)

and, to some of the students:

  1. Liezl, a great developer. (We’ll be meeting anyway, so I’ll leave it at this!)
  2. Cynthia, for making GCI about more than just development and showing remarkable resilience, even when dealing with difficult issues. Truly inspiring.
  3. Vijay, for being a gentleman (he knows what I’m talking about!)
  4. Toh(or Zie? [or Jie?]), a fun guy in general, who taught me about Asian names (it’s still rather confusing though, as you can see :P)

and finally, to everyone at OSPO (Carol, Chris, Stephanie, and anyone else I’ve forgotten) The work that you guys put into encouraging students to get involved with Open Source Software is really admirable. I remember many people asking me for guidance on how to get started with OSS dev after GCI 2010, including people who’d never heard of the term before.

Also, thanks to everyone I forgot to mention here! I hope I’ll get to know you better in the future.

About the Future

(if you don’t work on Eden, you could probably stop reading at this point)

While working on Eden I found several issues that were out of scope in terms of GCI, but were pretty interesting on their own. These are pretty major ideas and require significant amounts of work to get done, so I’d definitely need people to work on these ideas with me.

Firstly, I found it odd, that Eden, being a disaster management platform, doesn’t have a “proper” mobile app. So, during GCI, I started working on a native Android app for Eden. (UI/UX sketches are available at http://eden.sahanafoundation.org/wiki/DeveloperGuidelines/Mobile/Android#NativeClient) Some of the XForms code could probably be reused for this, and we could have an “app repackager” to allow deployments to create their own custom versions of the app.

Another idea suggested by Michael, was that we could have a new theme based on Twitter Bootstrap. Not only would this add some spice to the existing UI, but it would also allow us to support other mobile devices easily, as Bootstrap supports RWD (of course, this could be done without Bootstrap, but it’d require much more time and effort.)

During GCI, I implemented two widgets for Eden, a colour picker and an image cropper (that’s based on HTML5 hawtness!) As far as UI widgets and JS goes, these are relatively untested, except on the newest browsers. Compatibility tests need to done for these, and suitable workarounds need to be devised where required.

Since most of Eden’s modules basically do CRUD operations on models, I think it would be a wise idea to consider using something like AngularJS for the client side framework in the future. (I expect a long chat with Dominic about this on IRC :D) This would also enable us to create things like “live widgets” etc. (of course, this is still possible now, but doing that would make it easier)

Finally, I think the static file build system should be replaced with something that’s actually meant for that purpose, like Grunt.

TL;DR

It was: LEGEN-wait for it-DARY.

Some flowers we bought at the local flower show.

Some flowers we bought at the local flower show.

Status Update

I haven’t posted here in a while, so here’s a status update: I’m alive. :)

11th grade doesn’t really leave you with much time for anything. So… anyway, no excuses :)

  • I had my second term exams - and I screwed up pretty bad.

  • Shubham and I came 2nd at the TCS IT WIZ national finals held in Chennai. Prempal and Arnav from Delhi won (on the tie breaker!) — hats off!

  • I started volunteering with Sahana Eden. More about this later.

Learning (or at least trying to learn) how to read and write Bangla… It’s like KG all over again :-)  (Taken with Instagram)

Learning (or at least trying to learn) how to read and write Bangla… It’s like KG all over again :-) (Taken with Instagram)

Shubham and I at the Kolkata edition of TCS IT Wiz ‘12 - first place :)

Shubham and I at the Kolkata edition of TCS IT Wiz ‘12 - first place :)

WikiPDF

TCS IT Wiz is coming up (the Kolkata edition’s on the 9th) and that means a lot of research work, especially from Wikipedia. So, I wrote up a quick tool to export Wikipedia pages as PDFs. First, install Python 2.7 from here and download the following script:

Then, install PIP by downloading and running https://raw.github.com/pypa/pip/master/contrib/get-pip.py and execute the following commands:

aviraldg@aviraldg-netbook:~$ pip install beautifulsoup4
aviraldg@aviraldg-netbook:~$ pip install requests

Now, just create a text file which lists all the topics you want to download, each on a new line, and drag this file on top of the wikipdf script (or execute it from the terminal with the list file as an argument.)

Comment if you have problems or want to offer feedback.

You're an Idiot If You Use PHP.

  • Mohammed: i like coding in PHP :D
  • me: Then you're an idiot. I'll tolerate anything but two languages: PHP and BASIC.
  • Mohammed: hehe
  • BASIC goes for me too
  • me: PHP is brain-damagingly bad.
  • Mohammed: but it is used so widely.......
  • me: That doesn't automatically make it good.
  • Mohammed: but PHP must hv[sic] something which made it the most widely used server side language. I know that Python is a powerful language but you can't just say that PHP is bad
  • me: I can and I am. Here's why it's that popular: because you can just drop HTML into PHP source code and you can just drop PHP code into a directory and it "just works." That makes it easy for newbies. Doesn't mean that it's the safest or the best thing to do. In fact putting source code into a web facing directory is an absolute no-no. The standard library in PHP has no namespaces and is a big messy ball of functions. There's no consistency when it comes to naming: there's functions like strlen and also functions like str_foo. The parameters of these functions, even when they are exactly the same, don't follow the same order. The typecasting system is laughably bad. For example, in PHP:
  • "3 hundred spartans" == 3
  • would evaluate to true. The syntax for many common language features like variables and hashes is poorly thought out and clunky. $and_all_variables_look_like_this and hashes (dicts in Python) use => as a separator. Need more evidence? Newbies using PHP is bad as it is.
  • Mohammed: nah :-|
  • me: But knowing all this and still using PHP is nothing but stupidity.
  • Mohammed: i got my answer (an intelligent answer)
  • me: ?
  • What?
  • Mohammed: now
  • i saw the 'real' face of PHP
  • as always......u tell me things which prove to be very awesome
  • me: lol. Anyway here's more:
  • Mohammed: thanks :D
  • me: The biggest problem with PHP
  • imho
  • is Rasmus Lerdorf (the guy who created it)
  • According to him, "PHP is a language for non-programmers"
  • Mohammed: that's right
  • me: and "PHP is not engineered ... it was just hacked together" (rough quote)
  • Check it up.
  • When I write something, I want it to be fast, readable and bug free.
  • PHP doesn't let me do that (easily.) In fact a lot of PHP itself is very buggy. For example, I remember a case where a standard library function was supposed to return false, but was returning a "falsy" (anything that resolves to false, in this case 0) value and someone reported that it was causing some of his apps to break, but the issue was closed without a fix. Things like that.
  • Is it possible to develop good software in PHP? Yes. But it's extremely difficult. Your programming language should make it as easy as possible for you to develop stuff.
  • <end of rant>
  • (there are a lot more things that are broken in PHP, but I don't know enough of it to tell you about all of them, and frankly speaking, I don't want to know more than I already do; it's bad enough as it is.)

Limbo.

I recently managed to grab Limbo (and a few other excellent videogames) as a part of the 5th Humble Indie Bundle. I’d seen Limbo long before HIB5, but back then it’d only been released on XBLA, which is why I was overjoyed to see it on HIB5 (which usually means Linux compatibility.) Unfortunately it appears that the Linux version is a simple WINE wrapper over the Windows version. Either way, I had to have a go at it (on my dad’s laptop which still runs XP.)

Limbo’s a monochromatic platform-puzzler with an interesting sense of design and a macabre sense of humour which involves having your character impaled by spikes, decapitated and eaten by a spider (among other things) while you try and figure out solutions to its puzzles. It’s almost like Braid in black-and-white. I’ve had a lot of fun with it so far (and I’m about 70% through.) Go buy it if you haven’t bought it yet — it’s totally worth it.

The silhouette of a boy atop that of a tree trunk.

A shadowy image of a raven perched upon a box which hangs above the shadowy protagonist of Limbo.

A giant spider chases the hero of Limbo, who is wrapped in its silky white web.

Learning #1: Flask

This is a new series of posts wherein I’ll post about something at the start of a month, learn about it and experiment with it through the month. At the end of the month, I’ll make a post about all my experiments and learnings.

Flask's logo.

To kick things off, this month, I’ll be doing: Flask, the Python microframework.

Why Flask?

I’ve been using Django for Python web development for years now, and it works rather well. Recently, I saw Kenneth Reitz’s presentation, “Flasky Goodness: Or Why Django Sucks.” While I won’t go all the way and say that Django sucks outright, he definitely makes some valid points. I’ve also heard (mainly good things) about Flask before. Hence, Flask. Also, I’ve used Jinja before and need experience with SQLAlchemy for another (CLI) app I’m building.

In addition to all the points mentioned above, this will also help me test my theory that microframeworks require you to reinvent the wheel, several times over (compared to frameworks like Django.)

Is Academic Performance Related to Age?

Graph. (This data was gathered from my school’s examination results.)

Apparently not. It looks like academic performance has no correlation with age. However there’s a noticeable dip in the graph towards the “19+” end, which might be caused by these students failing and repeating the class (hence the age difference.)

(The dataset consisted of 230 tenth-graders.)

Developer, designer and casual gamer aged sixteen, with a scruffy stubble and a sharpened wit to match.

Freelancing


view archive