July 24th, 2008
I have finally been able to get another visualization working for the report/visual plug-in. This one is a Grade Distribution line graph that can show the distribution of grades for any group or item in a course including aggregated items like course total (a students overall mark in a course). Some screen shots of the new visualization can be seen below:
Currently the grades are being place in groups of 10% (0% - 9.99..%, 10% - 19.99…, and so on) witch is used as the x axis and the number of students is used as the y axis. As with the other visualization, the axis are invertible and the same UI and features are used.
Unfortunately the changes to the back and front ends of the plug-in to make them dynamic as possible and to allow creation of new visualizations simply by making a PHP class in Moodle was more complicated then anticipated and has set me some what behind my original schedule for the project. Hopefully i will be able to make up for some of the lost time and still be able to get in all the features i wanted.
Posted in Moodle | 2 Comments »
July 21st, 2008
Well looking for the Moodle library file, “weblib.php”, i came across an oddly named file called “womenslib.php“. After wondering what kind of library could possible be called that and what could it do for a few seconds i opened it up and found the fallowing code:
<?php
include(’../config.php’);
redirect(’http://en.wikipedia.org/wiki/Women%27s_liberation’);
?>
This file also seems to be on the main moodle.org site: http://moodle.org/lib/womenslib.php
It would seem that the Moodle core developers have a senses of humor.
Posted in Moodle | 1 Comment »
July 19th, 2008
One of the requirements of my project is to develop the stats and visual plug-in for Moodle 2.0, a version of Moodle witch is still under development. This means that if done right my plug-in will be compatible with the new release of Moodle once it comes out as well as take advantages of the new functions and frame works that are being added and are introduced in PHP5 (Moodle 2.x is moving from PHP4 to PHP5). However it also means that some of the functions i am using from the Moodle frame work are still buggy and at rare times new bugs are introduced to the development branch as the core developers work towards the new release.
Such seems to be the case tonight where a new bug showed up once i updated from development branch and all of a sudden the group (class/course sections) functions started messing up in my plug-in. After searching my own code for some time, thinking it was something i changed, i traced the bug back in to the Moodle core functions where there was a check that was failing as a side effect of a change to a seemingly unrelated piece of code.
So i whipped up a bug report and a patch to fix the bug and summited it to the Moodle tracker in the hopes that some one would look over my report in a day or two and look in to it. After all i was posting it at 3:37 AM on the week end, however to my amazement 30 minutes latter my report had been looked in to, commented on, a patch (based on mine but better) was committed to the development branch and the tracker issue was closed.
This is one of the reasons why i love the Open Source Ideology so much. In a closed source corporate environment a bug like this could take days to get from begin reported, to being looked in to, to being fixed (especially since it was reported early in the morning on Saturday) causing untold amount of frustration to the users and delays to developers working on the code effected by the bug. If Moodle was closed source software for witch i was creating the same plug-in from a limited plug-in API available to the public my bug report would have not be any where as nearly detailed in to the cause of and how to fix the bug and would be limited to simply saying “hey X is not working for some reason” and i deftly would not haven been able to give a patch that the core developers could base a fix on, causing lost man hours for the payed developers looking in to and tracking down a bug in a vague report that could be better spent.
There is also a great feeling knowing that you where able to help out an Open Source project and that your patch (as simple as it may be in this case) got in to the code base and will help others. It is also great thing to be able to fix the bugs you come across in software, change it in any way you may feel like or just see how things work under the hood.
Now if i could only get the bugs in windows mobile on my phone fixed….
Posted in Moodle, Open Source | 1 Comment »
July 16th, 2008
In addition to the printer issue i am also working on making the flex with flare interface more dynamic in that it can be heavily changed from the Moodle back end with out the need for touching the actionscript code.
As Moodle is a PHP project there may be few developers willing to update the flex side of the application i am making, so in an effort to making the project maintainable in the future i am try to keep as many settings in the Moodle side as possible. The way i am accomplishing this in an elegent manner is to have a dynamically generated XML file with each setting for the current visualizations being displayed to the user, witch will be read in by the flex application and determine how and what visualization is being displayed.
This XML settings file will have everything needed to define a
visualization (except the raw data) including the language strings, the flare layout type to use, what encoders to use, the legends to be displayed, what data is on the axes, and even the fonts and colors to be used. This XML file will be generated based on a visualization class for each visualization witch will be dynamically loaded in. In theory this should allow for new visualizations to be added in with no need to change the actionscript code that makes up the flex application or to change any code in the plug-in (just drop the new class in the visualization dir).
The parsing of the XML in to the flex application is made impressively easy in Flex 3 with the XML class. As can be seen from this relay cool example provided by adobe, XML code can be read in (in this example hard coded) in about one line and then be tread like a class but with some additional tricks and abilities to share. To make things even easier this XML functionality can be used with the URLLoader and URLRequest classes witch my application already uses to load tab formated data for flare such as in this example (also from adobe).
On the Moodle side of things there is also some functions for dealing with XML however they are apparently a bit out of date. Moodle includes an XML library in it’s framework (/lib/phpxml/xml.php) witch has a function for converting a PHP array into an XML string. Unfortunately this library seems to have been made for an older version of PHP and now spits out:
Notice: Only variable references should be returned by reference in /var/www/localhost/htdocs/moodle/lib/phpxml/xml.php on line 50
when used due to it returning a reference to a string rather then the value of it when debugging is on. This normally would not be a big problem but it breaks the XML format and makes the loading of the settings from the flex application fail. As a temporary fix i have added the fallowing to turn off the reporting of any error messages in the generated XML file as no human would be reading it:
error_reporting(0);
It’s nice when there are APIs and library’s so you can constraint on the problem and making the solution and not messing around formating XML
Posted in Adobe Flex, Moodle | No Comments »
July 15th, 2008
CONTRIB-497
Cleaned up some of the code for report/visual and the flex based application for viewing the visualizations.Improved the UI of the visualization.Added documentation to both the php and actionscript 3 (flex) code.Removed some unneeded files.TODO:
*Add more visualizations.
*Add printer firendly version.
*Make flex appplications settings less hardcoded and loaded from moodle.
*Load lang files from moodle to flex for full language support.
*Add a settings page for the report.
Posted in Version Control | No Comments »
July 14th, 2008
One of the popular requests relating to the grade statics project from the Moodle community was a printer versions of the statics and visualizations. This is rather trivial to do for the report/stats plug-in as all the content is text based however it becomes some what more complicated for report/visual as the content is flash based and more dynamic.
Some browsers play nice when printing a page with flash content on it and will treat it like an image (as shown in scan below of a print out of the demo site in fire fox).
This would allow for a printer friendly page to be made that would work with browsers that print flash content by creating a page with just the visualizations on it and a slightly modified interface. However there is another method that i have started looking in to that might give even better results.
Flash it’s self has support for printing witch can be some what controlled from the flash (or flex in this case) application running in the browser, allowing for better resolution prints (as flash graphics are vector based) and allows for printing with in the application rather then having to load a new page.
A simple example of this can be seen in the right click menu over a flash application witch gives a print option.
Unfortunately, currently my application dose not quite print an accurate representation of the visualization using this method as can be seen below in a scan of the printed page.
So the next step in the goal for a printer friendly flash/flex application is research the printing functions and abilities of action script and flex and then to try implementing a solution witch will ideally hide the visualization’s controls (buttons) and then print the visualization at the correct size to match that of the paper it is being printed on.
Posted in Adobe Flex, Moodle | 2 Comments »
July 2nd, 2008
This week i have been working on the user interface (UI) for the Flare based visualizations that will be shown in the report/visual plug-in.
So far i have the ability to invert the axis (with a cool animation), show and hide any item in the legends, click on a data point to show the information related to it and highlight all the data points related to a legend item.
A demo of one visualization with this UI can be found on the test site at http://compsci.ca/~dan/moodle where you can select “Moodle Tests“, login in as guest, select “Grades” in the lower left and then pick “Visual Report” from the drop down menu. You will have to have flash 9 installed (if you don’t it should try to install if for you).
Here are some screen shots of the visual report so far:
Posted in Moodle | 3 Comments »
July 1st, 2008
CONTRIB-497
Start of the grade/report/visual plug-in for displaying charts and graphs using flare as part of the GSoC animated grade statistics report project.
Currently only one visualization has been added and it is still in a rough state.
The code for the swf can be found in the flare_visualization dir.
Lots more work ahead to get the plug-in 100%.
Posted in Version Control | No Comments »
July 1st, 2008
CONTRIB-496
Removed a temporary work around for a bug that has been fixed in the moodle 2.X core.
Posted in Version Control | No Comments »
June 26th, 2008
After many hours of trying to get Moodle and Flex with Flare to play nice, i finally have been able to get a simple visualization working using the grade book data from Moodle.
The first visual is a scatter plot of Normalized Grades vs Students. The different colors represent different items that have grades associated with them and the different shapes are the groups/sections the students are in. It’s not much to show for UI or labeling of the chart yet but provides a starting point to make the report/visual plug-in and has gotten me on my way learning the Flare API.
Hopefully i will have some more polished visuals and UI to show off in the coming weeks.
Posted in Flare, Adobe Flex, Moodle | 1 Comment »