Thursday, June 25, 2009

GSoC 2009: GHOP - Fourth Week Status update!

Hello everyone,
It has been a long time since I ever gave an update about my project. Here it is. After I came back from exams, I have been able to get Task Quota Assignments to working state. I have created sub classes of Org Admins and Mentors and one can now create them.

For creating Org Admins and Mentors some small changes in URL patterns for mentor and org_admin views modules were needed, they have been done. Also a new access check method has been defined for the same. I am now working on creating tasks by org admins and mentors.

I have updated my demo instance at, You can try creating a New GHOP Program, GHOP Organizations for the program, You can create GHOP Org Admins and GHOP Mentors. However if you want to test assigning task quota limits, for now, you need to use the admin interface of the app engine, edit the GHOPOrganization entity to have status as "active". This is a temporary work around and will be fixed soon. If you want developer access on this instance, please feel free to ping me.

Creation of tasks by org admins is possible now, but this code has not been updated on the demo instance, since I still need to write code on how history of tasks gets updated upon editing the task.

So my work for the upcoming week is to make it possible for org admins and mentors to create tasks, edit them (and history gets updated automagically :P on each edit). If time permits I will start working on Student side of the tasks, like viewing tasks, claiming them, logic to restrict student to claim, max simultaneous tasks set in program configuration among other things.

Last but not the least, I have updated my code into the patch queue of the bitbucket repository at: Please take a look at it if you are interested.

Thank you all.

Monday, June 22, 2009

Testing Links for Survey Samples

Testing Links for Survey Samples

Surveys are now live and ready for testing! Check it out, "kick the tires", and provide feedback on all the ways you think it can improve.

(Update: You must be logged in and fill out the "Create Profile" form in the sidebar to be able to access any of these pages)

Sample Student Midterm:


Take (as Student):

Sample Mentor Midterm:


Take (as Mentor):

Permissions are set such that any user can read or write these surveys. These permissions can be changed via the Survey Read Access and Survey Write Access controls.

Also, make sure to keep an evaluation survey Survey Taking Access set to "mentor evaluation" or "student evaluation".

Notes About Editing Surveys

When you create a new question, you can fill in a custom prompt. The selection field gives you several choices for how options are rendered - either as dropdown fields, checkboxes, or radio buttons.

We realize that it is tedious to re-create a long midterm over and over again, so the next release should include the ability to save and load survey questions.

Notes About Taking Surveys

For evaluations, you must choose a project while taking a survey. If you are a mentor with more than one project, you should take the survey for each project of yours, and nag messages will be sent for your unfilled surveys.

When you choose a different project, your last saved responses for the survey should be loaded.

If you have any bugs or requests, file a ticket at Google Code or or just contact me directly.

GSoC09: Statistics module 3rd weekly report: up and running!

This week has been mainly focused on solving hopefully with best practices some tasks needed for the Javascript side and on setting up proper syncronization with Daniel's work.

First of all I got to know JSMock and how to use mocks, but I thought to have it integrated (if needed) later in the future. Looking around in the web I also found a great library called Functional Javascript, that supports functional constructs (lambdas and so on): that was interesting because IE doesn't support Javascript 1.7 statements, so it might be a way to workaround the limitation. Saved for later, too :)

On Tuesday we had a meeting with Daniel, where we decided to go for daily meetings, and, afterwards, during conference call I was asked to post meeting agenda and notes in the wiki and then mail the dev list about it every day.

Then I had to deal with a great issue: I was going to write a simple (at least I hoped so) test to check if my function that loads Google API dynamically worked properly. I've lost nearly one day on trying to do that properly with JSUnit, which seemed not to like async testing. I've found that someone had a sort of workaround but didn't publish the modified JSUnit code.

So I gave up for the moment, and, as we were talking about it with the mentors by mail, I've put some effort on retrieving parameters from a script tag instead of having them injected by Django templates right into Javascript variables. That meant separate completely those templates from the Javascript that lives inside that template. I took the Dojo way as an example, and it was very simple, using jQuery selectors (especially with the help of this awesome article) to get variables from attributes inside the script tag and add it, for example, in the melange package configuration, with very concise code:

$m.config = {};

(function () {
var configuration = jQuery("script[melangeConfig][src$='melange.js']").attr("melangeConfig");
if (configuration) {
var configuration_object = eval("({ "+configuration+" })");

But there was a problem: eval is evil! :)
So i found some guides to parse JSON without using eval (1,2,3), and I think I'll go for something like that, because json2 library doesn't like JSON strings like

{key: "value"}

but wants

{"key": "value"}

which is not something gviz gives us as an output. So we need to hack gviz or json2, or do something different like said before. So I've postponed the problem :)

On Thursday I worked on creating a _baseTemplate more abstract object to handle scripts outside Django templates with context taken from attributes in the script tag, and pushed an example in the repository. Then I made a simple example of content transclusion, which will take care, when all will be in place, to understand "melange" tags in HTML Django templates and substitute them, for example, with a graph.

After that, I returned working on the former JSUnit with Ajax issue, and then I found an article about YUITest, which I liked much and integrated in the repository and made it work again with JSCoverage. I had an issue on writing a test with it, because, when calling a wait() to make YUITest waiting for an ajax callback, the function inside the callback had a different scope so I couldn't send a resume(). But all went fine as soon as I discovered this great trick to keep context in ajax callbacks. And so here it is, working :)

The same day I had the idea to set up an issue tracker for our bitbucket statistic branch repository to better sync tasks with Daniel.

Saturday was more or less a "free day", even if I did some work, studying Selenium and integrating Selenium RC, with an example test using Python, generated from Selenium IDE Firefox extension.
Then I worked to integrate a new version of jQuery spin in the main Melange repository, and then...

My first Melange push!
(without dots :P)

Then I've explored libraries for Browser Side Templates, and I'm trying to find a winner between JBST and Pure. In that way, not only we will separate Javascript code from Django templates, but also we will separate Javascript logic from Javascript templates!
Last but not least, I've given my first code review for Daniel Diniz and James Levy JS libraries integration for Survey module in Rietveld :) Great work men!

Open Source Works Because of Awesome People

It's just not right to start off this week's blog post with anything else but a thank-you to Daniel Diniz (ajaksu IIUC) for his help getting the survey feature ready for midterm evaluations. Preparing surveys has been more difficult then I predicted, and his help has been indispensable.

When first asked about how long it would take to get surveys ready, I gave 'a week' as a ballpark figure. I was initially only thinking about the problem on the level of creating and saving HTML form fields.

And grading didn't seem that it would be too difficult. Just make a Boolean property, right?

I wasn't considering the various complexities involved. For example, if a mentor is mentoring several students, and surveys were given that asked that the mentor filled it out for each student, it is no longer simply a matter of loading some saved HTML.

There should be a very simple method to pair the results of the survey taken by a student and the survey taken by the student's mentor, as well as distinguish between x number of evaluation surveys, and properly pair groups of saved survey records.

Anyways, this is where ajaksu comes in. He's helped to keep momentum in survey development, and since GSOC started we've been pinging and relaying new work just as the other gets distracted or exhausted. The result is a survey feature that should perform admirably this summer.

The last week and all of the collaboration involved also been a good lesson about better living through version control. Which reminds me to link to our repositories:

You can keep track of the progress as ajaksu and I are preparing to merge surveys into production.

There's also the Github issue tracker:

I'd like to take the initiative in a "dry run" for surveys, before the midterm opening. While a lot of development effort has been going towards the midterm component, it's also important that non-evaluation surveys can also be successfully administered.

In this next week, I plan to do a code review for the news feed code and finish all the outstanding tickets for both surveys and news feeds.

Reblog this post [with Zemanta]