Because surveys need to be ready for the upcoming midterms, my attention has been shifted back towards surveys, with three tasks I'm working on:
- Getting survey taking permissions working. (This is complete, but needs some more testing)
- Complete seed_db to include projects, students, and mentors (to make testing surveys much easier)
- Multiple-project support. For mentors who are overseeing more than one project, the handler needs to be updated to redirect to the correct form when a mentor selects a different project.
- Notifications. If you haven't completed your survey yet, you should be pestered until you do! This could involve a notification (or an update to the program newsfeed) but will require e-mail updates, since that's the most guaranteed way of getting someone's attention.
For the news feed module, I'm excited to be working on a demonstration PubSub support. This is fairly low-priority, but it will be nice to have built-in support for real-time applications like chat.
Tuesday, June 16, 2009
Statistic Module update
I am sorry for a fewer number of my commits for the last couple of days. As I wrote, I was quite busy with some other things for some time, but I also worked on Melange related stuff.
First of all, I added service for a few more statistics. They are also quite simple, but I did this boring job to match all countries with thier continents. Of course I am still in dilema about some countries - to which continent they actually belong. The most importatnt are Russia and Turkey, but for now I assigned them to Europe.
The most important thing that I did for the last week was to find a way how to deal with stats that does not belong to a particular program.
Basically, we can divide all kind of stats that we already have into two types: stats that depend on data from one program and global stats that get data from various programs. Anyway, each models that is a subclass of Linkable has attributes like link_id, scope and scope_path. For most existing models (or I can say, for all models that I checked) scope is well-defined. For example, we know that a scope for a program is sponsor or a scope for a student project is organization. However, for statistics it would be better if the scope could be determined dynamically (depending whether the statistic is global or not). So, it took some time and several attempts before I came up with a good (IMHO:) solution.
I will try to explain the final solution. First of all, it is a compromise in some way. It does not have any dynamic scope assigment, because I have to admit that I do not know how to do it. I mean it could be possible, but I think it would require an awful lot of new code and it would be like reinventing the wheel. Therefore, each statistic is still defined for a particular program, but there is a new property in statistic model: access_for_other_programs. It may have one of three possible values: invisible, visible or collectable. If a statistic is marked as invisible, it is local for a program in scope - on other programs have access to it. For statistics that should be global, there are the two other options. Visible means that a statistic which is defined for a certain program may be also read-only accessed by other programs, while collectable stats may be also collected by other program administrators.
I will update statistic module wiki page with description of those changes by tomorrow.
First of all, I added service for a few more statistics. They are also quite simple, but I did this boring job to match all countries with thier continents. Of course I am still in dilema about some countries - to which continent they actually belong. The most importatnt are Russia and Turkey, but for now I assigned them to Europe.
The most important thing that I did for the last week was to find a way how to deal with stats that does not belong to a particular program.
Basically, we can divide all kind of stats that we already have into two types: stats that depend on data from one program and global stats that get data from various programs. Anyway, each models that is a subclass of Linkable has attributes like link_id, scope and scope_path. For most existing models (or I can say, for all models that I checked) scope is well-defined. For example, we know that a scope for a program is sponsor or a scope for a student project is organization. However, for statistics it would be better if the scope could be determined dynamically (depending whether the statistic is global or not). So, it took some time and several attempts before I came up with a good (IMHO:) solution.
I will try to explain the final solution. First of all, it is a compromise in some way. It does not have any dynamic scope assigment, because I have to admit that I do not know how to do it. I mean it could be possible, but I think it would require an awful lot of new code and it would be like reinventing the wheel. Therefore, each statistic is still defined for a particular program, but there is a new property in statistic model: access_for_other_programs. It may have one of three possible values: invisible, visible or collectable. If a statistic is marked as invisible, it is local for a program in scope - on other programs have access to it. For statistics that should be global, there are the two other options. Visible means that a statistic which is defined for a certain program may be also read-only accessed by other programs, while collectable stats may be also collected by other program administrators.
I will update statistic module wiki page with description of those changes by tomorrow.
Monday, June 15, 2009
GSoC09: Statistics module 2nd "weekly report"
It's been about 10 days since my last post, but since I've posted my first weekly report late, I waited for Monday to write another post, so I'm sync with the others too :)
These days have been quite busy on refining JavaScript architecture for the stats module, and, in the meantime, in drawing a design that could be useful for the overall Melange project's JavaScript layer.
First of all, I've watched an interesting Best Practise in Javascript Library Design video linked by a John Resig's blog post, then I've spent some time on studying or improving my knowledge about best JavaScript practises like:

I've integrated a slightly modified source code of the jsLint rhino version, to be compliant with the following options of the online version.




Clicking on the name of the Javascript file, you can know which lines are actually covered by the tests and how many times they have been called


However, Packer produces a really unreadable code, acting also as a sort of obfuscator, something that probably we don't want to have. Furthermore, Shrinksafe doesn't delete new lines (which can be harmful if we forget to add a semicolon at the end of a line of code), is a little bit more "conservative" and behaves pretty good as well

After committed all these stuff, from Tuesday to Thursday I've attended the wonderful iQ Boot Camp 2009 event here in Dublin. I will never have enough words to describe how thankful I am to iQ Content for giving me the opportunity to attend it.
On Friday I've met with James Crook: we had a great afternoon together, and talked a lot about Melange and a rough architecture for the Python side to support what will be useful to accomplish Javascript frontend tasks.
On Saturday and Sunday I've committed some code to start the melange.graph.chart package (improving tests and adding jLinq code to the repository, too), which will behave as a layer to play with Google Visualization API (also starting to write code to integrate the new Google Ajax API, and, in particular, its dynamic loading, something we will need to integrate according also to Melange issue 634).
To do that, I've used some OOP inheritance, studying some articles (1,2,3). I've also found an interesting jQuery inheritance plugin, but I decided not to go with it for the moment, as it seems to me a sort of constraint more than an opportunity. I will test it later (perhaps this week), and eventually I'll change my mind :)
Furthermore, I've found an interesting site, AjaxPatterns, in which I've found informations about JSON Frameworks and Browser Side Templating, which will be really a must-have for us. I've not yet explored them into depth, but I'll decide with the community which one between JsonML, Ajax Pages, Pure and Two Birds will fit our needs better.
Last but not least, I've updated JavascriptRefactoring and JavaScriptStyleGuide Melange wiki pages according to what I've found throughout these 10 days.
These days have been quite busy on refining JavaScript architecture for the stats module, and, in the meantime, in drawing a design that could be useful for the overall Melange project's JavaScript layer.
First of all, I've watched an interesting Best Practise in Javascript Library Design video linked by a John Resig's blog post, then I've spent some time on studying or improving my knowledge about best JavaScript practises like:
- Error handling
- Closures
- Common patterns (and more infos about Module, Decorator and durable objects)
- Some articles about Javascript tips, how to write efficient Javascript, and antipatterns like global namespace pollution, misuse of for..in and with statement.
- jsLint, testing it against some of my example code

I've integrated a slightly modified source code of the jsLint rhino version, to be compliant with the following options of the online version.

- JSDocToolkit: it's been a little bit difficult to explain in JSDoc syntax the architecture, but finally I came up with something sensible :)

- JSUnit, for Javascript unit testing. I've also put some example unit tests in the repository.

- JSCoverage, and this is, to me, the most exciting tool to work together with JSUnit. Changing JSUnit's source code a bit as explained in their FAQs, and using a proper script to instrument our JS source code, after you've run unit tests, you are shown a page like the following one, that shows how much of the source code has been covered by the tests

Clicking on the name of the Javascript file, you can know which lines are actually covered by the tests and how many times they have been called

- Shrinksafe, to minify our Javascript code before releasing. I've also put some effort on using, for example, JSMin and Packer, and I've found the latter being the most efficient, also trying packing some example code using this wonderful online compressor rater

However, Packer produces a really unreadable code, acting also as a sort of obfuscator, something that probably we don't want to have. Furthermore, Shrinksafe doesn't delete new lines (which can be harmful if we forget to add a semicolon at the end of a line of code), is a little bit more "conservative" and behaves pretty good as well

After committed all these stuff, from Tuesday to Thursday I've attended the wonderful iQ Boot Camp 2009 event here in Dublin. I will never have enough words to describe how thankful I am to iQ Content for giving me the opportunity to attend it.
On Friday I've met with James Crook: we had a great afternoon together, and talked a lot about Melange and a rough architecture for the Python side to support what will be useful to accomplish Javascript frontend tasks.
On Saturday and Sunday I've committed some code to start the melange.graph.chart package (improving tests and adding jLinq code to the repository, too), which will behave as a layer to play with Google Visualization API (also starting to write code to integrate the new Google Ajax API, and, in particular, its dynamic loading, something we will need to integrate according also to Melange issue 634).
To do that, I've used some OOP inheritance, studying some articles (1,2,3). I've also found an interesting jQuery inheritance plugin, but I decided not to go with it for the moment, as it seems to me a sort of constraint more than an opportunity. I will test it later (perhaps this week), and eventually I'll change my mind :)
Furthermore, I've found an interesting site, AjaxPatterns, in which I've found informations about JSON Frameworks and Browser Side Templating, which will be really a must-have for us. I've not yet explored them into depth, but I'll decide with the community which one between JsonML, Ajax Pages, Pure and Two Birds will fit our needs better.
Last but not least, I've updated JavascriptRefactoring and JavaScriptStyleGuide Melange wiki pages according to what I've found throughout these 10 days.
Thursday, June 11, 2009
Google Summer of Code 2009: Mid Third Week - status update!
Hello everyone,
I am leaving for the bachelor degree final end semester examination. The progress of this week is short and swift. Fixed up the problems Lennard indicated in the GHOP Program view I had submitted. The timeline now works properly for GHOP. In this regard, I added a GHOP Timeline view. Made changes to soc.logic.models.program by replacing the TIMELINE_LOGIC dictionary with self.timeline_logic property in the model to point to GSoC timeline logic. Added an identical property in soc.modules.ghop.logic.models.program to point to GHOP timeline logic.
Added getExtraMenus for GHOP Program view and a GHOP Organization view. Further I am still working on task quota limits. But I am quite sure, it is almost close to complete, given that the background work, i.e its dependencies are already in place.
Catch you all on June 19th. See you!
I am leaving for the bachelor degree final end semester examination. The progress of this week is short and swift. Fixed up the problems Lennard indicated in the GHOP Program view I had submitted. The timeline now works properly for GHOP. In this regard, I added a GHOP Timeline view. Made changes to soc.logic.models.program by replacing the TIMELINE_LOGIC dictionary with self.timeline_logic property in the model to point to GSoC timeline logic. Added an identical property in soc.modules.ghop.logic.models.program to point to GHOP timeline logic.
Added getExtraMenus for GHOP Program view and a GHOP Organization view. Further I am still working on task quota limits. But I am quite sure, it is almost close to complete, given that the background work, i.e its dependencies are already in place.
Catch you all on June 19th. See you!
Monday, June 8, 2009
Newsfeed Status Update
Working on the news_feed feature has required work in all the different sections of the codebase (Model, logic, caching, view, template) and has required updates to about a dozen existing modules. As you can imagine, merging upstream is a fun exercise in getting aquainted with some of the more advanced features of version control.
The mechanics behind the news feed are very simple, at least to start with. Whenever an entity - a document, for instance - is created, updated, or deleted, it gathers a list of receivers. The implementation right now is limited to the scope of linkable models, but luckily that covers almost all of the use-cases where we'd want the news feed to be updated.
A new FeedItem entity is created for each receiver - since the receiver in the current implementation is the scope, the receiver is only one entity, but I'm working on a method to propagate news feed updates like an event bubbling up through a hierarchy.
A news feed is constructed for the receiver entities - such as Program, Organization, Club, etc. - and aggressively cached. The template for the news feed itself is very similar to how blogs are formatted in Melange.
One part of the template has been a big headache - the link redirecting to the sender entity.
Right now, this is what the link HTML template looks like -
Yes, it's hacky. But it works...most of the time. When the sender's kind name is "Document", then this translates to /document/, which is what we want. But when the sender's kind name is "StudentProject", this is rendered as /studentproject/, while it should be /student_project/. I'm still figuring out how to properly linkify an arbitrary entity...and I tried using the redirect views helper, but I was hoping to do something that wouldn't require any additional server-side code.
The next week has a lot of challenging tasks ahead. Now that the basic implementation is working, I'm going to work on automation and testing. I'm also going to code up an ATOM feed that can be used to export news feed updates. (This shouldn't be a security issue, since news feed updates only include very basic information and a link to the entity for further information)
Surveys also need to have their ACL component finished so they can be taken for midterms...I've struggled with this when attempting it before, but GSOC needs this feature working, so I'm going to have to figure out a way to do it.
Finally, I've also updated logic for surveys and documents so that based on the prefix of the document, it creates a scope property. This way, the scope doesn't have to be retrieved at runtime and the document model is more in sync with the rest of Linkable entities.
The mechanics behind the news feed are very simple, at least to start with. Whenever an entity - a document, for instance - is created, updated, or deleted, it gathers a list of receivers. The implementation right now is limited to the scope of linkable models, but luckily that covers almost all of the use-cases where we'd want the news feed to be updated.
A new FeedItem entity is created for each receiver - since the receiver in the current implementation is the scope, the receiver is only one entity, but I'm working on a method to propagate news feed updates like an event bubbling up through a hierarchy.
A news feed is constructed for the receiver entities - such as Program, Organization, Club, etc. - and aggressively cached. The template for the news feed itself is very similar to how blogs are formatted in Melange.
One part of the template has been a big headache - the link redirecting to the sender entity.
Right now, this is what the link HTML template looks like -
href="/{{ item.sender.kind.lower }}/show/{{ item.sender.key.name }}"
Yes, it's hacky. But it works...most of the time. When the sender's kind name is "Document", then this translates to /document/, which is what we want. But when the sender's kind name is "StudentProject", this is rendered as /studentproject/, while it should be /student_project/. I'm still figuring out how to properly linkify an arbitrary entity...and I tried using the redirect views helper, but I was hoping to do something that wouldn't require any additional server-side code.
The next week has a lot of challenging tasks ahead. Now that the basic implementation is working, I'm going to work on automation and testing. I'm also going to code up an ATOM feed that can be used to export news feed updates. (This shouldn't be a security issue, since news feed updates only include very basic information and a link to the entity for further information)
Surveys also need to have their ACL component finished so they can be taken for midterms...I've struggled with this when attempting it before, but GSOC needs this feature working, so I'm going to have to figure out a way to do it.
Finally, I've also updated logic for surveys and documents so that based on the prefix of the document, it creates a scope property. This way, the scope doesn't have to be retrieved at runtime and the document model is more in sync with the rest of Linkable entities.
Google Summer of Code 2009: Second Week - status update!
Hi everyone,
Time for status update of the second week spanning from June 1st-7th! This week was a very productive one from my point of view. Spent most of the time, rather all of my time coding for Melange this week without any other distractions (especially University :D ). As set out in the previous week's post, I completed moving all the code from app/ghop to app/soc/modules/ghop.
The respective templates and contents of ghop also have been moved from app/ghop/templates to app/soc/templates/modules/ghop and app/ghop/content to app/soc/content/modules/ghop. A callback.py python module was added to ghop module and necessary changes have been made in app/app.yaml.template and app/settings.py.
Secondly all the logic modules corresponding to each model defined specifically for GHOP (app/soc/modules/ghop/models/*) have been defined and committed. These logics are, "do nothing special" logic modules. They just inherit from their respective super classes, but do nothing specific about GHOP yet. The GHOP specific functionality is added in the due course for the necessary logic modules.
Thirdly, as I had said, I mostly concentrated on writing views. My first view, view for GHOPProgram create/edit is almost ready for commit. There are few small changes that are need to be made. I might send the updated patch by tonight. So everything required to get the views working is in place by now. I am also working on writing the second GHOPProgram view required, i.e the task quota limit view. I realized, to define this view, we also require view for GHOPOrganization to be in place. So this is a work in progress for now. I will be completing it as soon as possible.
Unfortunately I could not complete the work GHOPProgram views this week, because of unexpected delays in moves and defining the necessary logic. Also could not take time to include taggable-mixin support in models and could not move to GHOPOrganization views.
I will work on GHOPOrganization views for most of the time this week, along with completing the GHOPProgram views, since the latter is dependent on the former. Also unfortunately, because of my bachelor degree's final semester's end sem examination, I need to break from 11th of June upto 18th of June. I will have no time to work on Melange or anything else other than performing muggathons in long stretches of time(sleepless nights) :( I will not be able to attend conference calls next week, neither will I be able to update the blog/wiki, nor I will be available in GTalk/IRC. But I am quite sure I will compensate for this loss, by slogging in the subsequent weeks to come.
See you all, 2 weeks later :(
Time for status update of the second week spanning from June 1st-7th! This week was a very productive one from my point of view. Spent most of the time, rather all of my time coding for Melange this week without any other distractions (especially University :D ). As set out in the previous week's post, I completed moving all the code from app/ghop to app/soc/modules/ghop.
The respective templates and contents of ghop also have been moved from app/ghop/templates to app/soc/templates/modules/ghop and app/ghop/content to app/soc/content/modules/ghop. A callback.py python module was added to ghop module and necessary changes have been made in app/app.yaml.template and app/settings.py.
Secondly all the logic modules corresponding to each model defined specifically for GHOP (app/soc/modules/ghop/models/*) have been defined and committed. These logics are, "do nothing special" logic modules. They just inherit from their respective super classes, but do nothing specific about GHOP yet. The GHOP specific functionality is added in the due course for the necessary logic modules.
Thirdly, as I had said, I mostly concentrated on writing views. My first view, view for GHOPProgram create/edit is almost ready for commit. There are few small changes that are need to be made. I might send the updated patch by tonight. So everything required to get the views working is in place by now. I am also working on writing the second GHOPProgram view required, i.e the task quota limit view. I realized, to define this view, we also require view for GHOPOrganization to be in place. So this is a work in progress for now. I will be completing it as soon as possible.
Unfortunately I could not complete the work GHOPProgram views this week, because of unexpected delays in moves and defining the necessary logic. Also could not take time to include taggable-mixin support in models and could not move to GHOPOrganization views.
I will work on GHOPOrganization views for most of the time this week, along with completing the GHOPProgram views, since the latter is dependent on the former. Also unfortunately, because of my bachelor degree's final semester's end sem examination, I need to break from 11th of June upto 18th of June. I will have no time to work on Melange or anything else other than performing muggathons in long stretches of time(sleepless nights) :( I will not be able to attend conference calls next week, neither will I be able to update the blog/wiki, nor I will be available in GTalk/IRC. But I am quite sure I will compensate for this loss, by slogging in the subsequent weeks to come.
See you all, 2 weeks later :(
Thursday, June 4, 2009
Google Summer of Code 2009: Statistics module weekly report
So, here we are up and running! The Statistics project, which I'm really happy to share with Daniel, aims on collecting and displaying statistics data out of Melange.
I've spent my first week mainly on research and on the design of the Javascript layer that will be used for the Stats module, studying and testing libraries that will be of some use (hopefully) generally to the whole Melange project, too. The first thing I've done has been writing some code to get a first chart with Google Visualization API using Google API Playground, then I worked on studying how to use jQueryUI to get an iGoogle style dashboard interface for statistics module, finding this great tutorial from NetTuts, that could lead us to a cool interface. Then I had a meeting with Daniel, who had a great patience on giving me guidance on the Python code he started to write for the module backend, and we discussed on how to join our code, then Daniel set up the bitbucket repository he mentioned in his post.
During that meeting and afterwards, I've found Gviz lib and we agreed with Daniel that it would have lead to a smoother code for the communication between Python and Javascript. That library outputs "ready-to-serve" JSONs to Google Visualizations. Now it's already integrated in the main Melange trunk by Pawel for us to use it.
From that library on, I've got to know Google Visualization Query Language, which I thought it would be very powerful for us to show dynamic charts based on dynamic data. Unfortunately, there are no implementations for Python, so I tried to find something to get similar power in JavaScript. In that way I've found three great projects to query over JSON objects: JSONPath, JSONQuery and jLinq. I really like the functional way in which jLinq works, but I'm going to explore in the next week also the "XPath-like" ways, to have a better view on what's out there on JSON objects querying and what could be better for us to integrate.
Apart from that, I've started threads in the dev list and then put in the wiki some thoughts and contributes about a "medium-term" refactoring of Melange JavaScript layer and a draft proposal for JavaScript code style guidelines.
This week I will explore (or, better, I'm exploring, as I'm posting the report late :)) the JSON querying libraries, write on the wiki the design of the JS layer, and, hopefully, get a first skeleton code out of that design.
I've spent my first week mainly on research and on the design of the Javascript layer that will be used for the Stats module, studying and testing libraries that will be of some use (hopefully) generally to the whole Melange project, too. The first thing I've done has been writing some code to get a first chart with Google Visualization API using Google API Playground, then I worked on studying how to use jQueryUI to get an iGoogle style dashboard interface for statistics module, finding this great tutorial from NetTuts, that could lead us to a cool interface. Then I had a meeting with Daniel, who had a great patience on giving me guidance on the Python code he started to write for the module backend, and we discussed on how to join our code, then Daniel set up the bitbucket repository he mentioned in his post.
During that meeting and afterwards, I've found Gviz lib and we agreed with Daniel that it would have lead to a smoother code for the communication between Python and Javascript. That library outputs "ready-to-serve" JSONs to Google Visualizations. Now it's already integrated in the main Melange trunk by Pawel for us to use it.
From that library on, I've got to know Google Visualization Query Language, which I thought it would be very powerful for us to show dynamic charts based on dynamic data. Unfortunately, there are no implementations for Python, so I tried to find something to get similar power in JavaScript. In that way I've found three great projects to query over JSON objects: JSONPath, JSONQuery and jLinq. I really like the functional way in which jLinq works, but I'm going to explore in the next week also the "XPath-like" ways, to have a better view on what's out there on JSON objects querying and what could be better for us to integrate.
Apart from that, I've started threads in the dev list and then put in the wiki some thoughts and contributes about a "medium-term" refactoring of Melange JavaScript layer and a draft proposal for JavaScript code style guidelines.
This week I will explore (or, better, I'm exploring, as I'm posting the report late :)) the JSON querying libraries, write on the wiki the design of the JS layer, and, hopefully, get a first skeleton code out of that design.
Subscribe to:
Posts (Atom)