Saturday, July 30, 2011

GSoC 2011 Melange Testing Project: CP W9 & W10

Hi,

I could not write a blog post for the work I did during last week because of the
the university work and some other factors. This post summarises the work I did in last two weeks.

  Last week, I fixed some tests which were failing due to the recent change done to the mentor property. The tests for soc.modules.gsoc.tasks.test_survey_conversion failed because the models were seeded(Model.put()) by explicitly defining the model properties. This method is definitely not a robust one since if we happen to add other required properties in future, the tests will fail again due to the missing properties while seeding. The solution is to use the data seeder which randomly seeds the properties not mentioned in the properties parameter. If there is no data provider for a property, we can patch the data provider to seed such properties and the tests would run fine. So, I edited the tests for gsoc.tasks.survey_conversion and made them to use data seeder to seed the models.

     I also fixed the profile_utils.createStudent() method which had been bugging me while testing gsoc.views.student_forms. My tests failed 1 out every 7-8 test runs. It was because of the failing access checks which resulted because of the number_of_projects property being seeded other than 0 for a student without a project. This problem bugged me for quite sometime and Madhu helped me to figure out that this was actually the problem. Also, I submitted some patches to remove the unused imports in some modules in gsoc.views.

   This week I tested a couple of views namely views.org_profile, views.profile_show and submitted them for review. Leo has reviewed them and I will be fixing them today. I also added createInactiveProfile() and createInactiveStudent() method to profile_utils which I needed while testing views.org_profile. I discovered a defect in DownloadForm request handler in student_forms and I filed a issue for that. The defect was that a student without a project should not be allowed to download the enrollment and tax forms and in the present case a 500 error is returned which should be 403 instead. As told by Sverre, I need to add an access check to fix this.
 
    Since I get very less time during the week days to work on the project, I will be working on Friday, Saturday and Sunday as I don't have classes on these days.

Thursday, July 28, 2011

GSoC 2011 GUI Overhaul: Uploadable Logo with Area Selection

Hi everyone,

When I discovered a problem with the logo url rendered in the homepage, I believe blobstore for the organization logo will be fine. Yeah, until I took pains with redirect response. So here's the specification to implement image area selection in blobstore, so you can crop the uploaded image:

  1. We need coordinate fields, x1 as a horizontally starting-point where the area selection begins, x2 as horizontally end-point, y1 as vertically starting-point where the area selection begins and y2 as vertically end-point. Since we're using blobstore, we need to set BlobReferenceProperty field.
  2. Create the form similar to the tax or enrollment form, but only set the BlobReferenceProperty field. To make it clear, the uploaded file will be handled by Blobstore API and handover to our written handler afterward. In our handler we can set initial values for coordinate fields and redirect again to upload form.
  3. When the blob key is available, we need another handler to request the blob.
  4. To render the uploaded image in the form, we can follow how Google Map is rendered in the profile form.
  5. Image area selection was implemented using jQuery imgAreaSelect. The documentation is pretty obvious.
  6. There should be coordinate fields update handler which is posted when we made selection over the image. There's onSelectEnd paramater that we can passed over when instantiate imgAreaSelect.
  7. To serve the image with area selection, we need to create a handler that reads the blob based on provided blob key. Resized and cropped image will be manipulated here by using Image API.
I can't give you live demo for uploadable logo. I don't have a dashboard in billing-mode. Here's the screenshot if you're wondering:



Monday, July 25, 2011

GSoC 2011 Integration with External APIs: Melange Lists and GData API Protocol - W9

Hi,
Last week, I started to work on "Melange list exporting to GDocs" that will be second deliverable of my project. I've been searcing through GData Protocol to use JavaScript for  Spreadsheets API. This API is used required to create a spreadsheet and manage it. Unfortunately there isn't a JS API for this provided by Google. But GData APIs are built on REST like protocols over HTTP. This gives possibilty to anyone to use them with any language as long as correct HTTP requests are provided.

Well, we want to use Spreadsheets API with JS, but i haven't tell the reason yet. Reason is we can not trust how big the data is. For example it's quite big enough for accepted stundents page. GAE has a limitatation, max 30 seconds per request. Melange loads some of the lists with multiple requests, but when we want to create and upload a list we can't make it with multiple request (or that would be really harder). So we need to export data on client side.

This also saves time preventing reprocessing of query. Another benefit is that, it allows uploading modified list on client-side. For example, user may filter list for a parameter, or sort it on client side. With this approach we present user a feature like, "what you see is what you export" that is exactly what user wants.

Tuesday, July 19, 2011

GSoC 2011 Integration with External APIs: Proposal Sync - W8

Sorry for late blog post. First evaluation results of GSoC 2011 was announced. I passed first evaluation and I'm very happy for it :) My first deliverable "proposal sync" is still in review process. But my guess is it's mainly complete and just needs code design fixes. I'm busy with fixing my patches for a few days. My patches are mostly contains JS code and I wasn't writing quality JavaScript code before but just ones that saved my days. Not suprisingly Mario pointed out lots of bad design choices in my code. I want to mention a few of i learned :

* Always use === and !== instead of == and !=, These operators also checks if operands are same type besides their values are equal.

* Do not rely on content of DOM elements. Do not use them as variables. Create global variables instead.

* Using if and else without braces if they have only one statement is tricky. This later may cause someone not to notice there are no braces, and put a statment outside of else scope, while thinking it's in the scope.

* Melange JavaScript Guide also has good tips, for readibilty and quality of source code.

From now on, i will also start to work on Melange lists. We basicly want all Melange lists to have upload option to Google Docs. Melange lists are built-on jqgrid library which allows easily create and manage interactive HTML tables. We need a generic button that will work for every list without extra configuration, so someone creating a new list will not take care about how it forms it's data and uploads itself to GDocs.

That's all about me. See you next week and cheers :)

Sunday, July 17, 2011

GSoC 2011 Melange Testing Project: CP W8 Mid-term

Hi,
I have completed the logic tests and the task for post mid-term period is to write the tests for all the gsoc.views modules. Leo and I had a discussion after the last conference call and we decided to prioritise which modules should be tested first. A survey of the modules which have tests and which needs to be tested can be found at [0]. Accordingly, I have to first test gsoc.views and gsoc.tasks and then go on to write the functional tests. I am presently working on gsoc.views.student_forms and stopped working on soc.views.helper.access_checker.
I have no experience with Django and I spent some time studying the basics and  then asked Madhu some doubts that I had got while studying the view's code. I will develop pace as I get experience with the views.
    This week was also assigned for mid-term evaluations and Leo has passed me :). My classes are starting from 20th July and I need to manage both gsoc and classes. The last two days went in travelling to the university and the next two days will go in registration and shifting to the new hostel room.

[0] https://spreadsheets.google.com/spreadsheet/ccc?key=0AuENNrqFbxWEdDJMclZySzFUalpsUTd6bzNJTjJGVlE&hl=en_US#gid=0

GSoC 2011 GUI Overhaul: Things that I've been working on last week

Hi everyone,

As we already knew, mid term evaluation already passed. I contacted my mentor, Daniel, about the result of my mid term evaluation. Daniel told me to focus on the remaining works that need to be done. If you're following my discussion on the mailing list, there are obviously requested features in accordance with my project scope. Here's the list of thins I've been working on from the last week :
  • Account management. Sverre posted on mailing list about the problem he encountered by manually modify accounts using stats.py. Sverre gave some possible use cases:
    1. People have their profile migrated, their email address stays the
      same but their user_id changes, the User.user_id property needs to be
      set to None.
    2. People have a @gmail.com or @googlemail.com address attached to
      their @some.domain.com address, and their User.account needs to be set
      to the new address.
    3. Lennie added his suggestion for ban user feature.
  • Regular dashboard using iconic information. Daniel said to me give a shot for iconic dashboard for regular users (students and mentors). This means there will be two options to vote later, toggleable list and iconic dashboard. Toggleable list has been reviewed by Mario and I've made some adjustments (not posted yet).
  • Leo gave some review on my test for withdraw projects view. I need to fix the test.
  • Lennie asked me to make the evaluation links 3 level deep. I've sent the patch, no response yet.
  • Participant locations statistic.
I will post the patch for the above features on Monday, or lately Tuesday. After that there will be one week to review all the patches before going to be pushed.

Monday, July 11, 2011

GCI 2011 GCI with New Architecture - W7

Hello all,

This week I started with the Public Task view which first showed all the static fields and then I have created a Form to publish comments for the task and to retrieve the work submissions on that view.In the meanwhile my redirects patch got reviewed and I refactored the GSoC Redirects module but due to my mistake, it broke the existing code, I sincerely apologize for that.I have again written the GCI Redirects module avoiding these mistakes.I then wrote the GCI Timeline Helper class and moved some common code to the core.This got reviewed and will be committing this after the previous patches gets approved.After this I wrote the views to create and edit a GCI Task and have learnt some new things in this process and I sent this one for review too and then as advised by Madhu I moved onto to the task workflow, as the first step I have written a form with a drop down that has the list of actions that are available to the Org Admin, Mentor or Student depending upon the task status.I will be sending this to review now in bit.This week I have spent much more time with my project and in communicating with Madhu which helped me clear many doubts and work better, I feel I have this week's progress is better than the previous ones and I'm happy about it.I will be increasing my time on the project this coming week and will try my best to cover the lag.