My name is Ramindu Deshapriya. By profession, I’m a Software Engineer. I revel in being a diverse programmer and have worked with PHP, C, Java, Android, MySQL, SAP ABAP and quite a few others. The world is full of knowledge, and there’s so much more to learn!

I’m an open-source enthusiast. I’ve worked on the Bug Squad for the Joomla! project, and am currently involved in development of Sahana Vesuvius for the Sahana Software Foundation. I also used to work as the Assitant Editor for the Free and Open Source Software User Magazine of Sri Lanka.
In my spare time I play rhythm guitar for Dhishti. I also love reading, computer gaming, watching movies, and swimming.
To me, life, with all its ups and downs, is worth all the bad times as well as the good, and I would not change a single aspect of my personal history even if given the chance to do so.

GSoC 2015 – Moorsp Plugin for Moodle – Wrap Up

It has been a hectic few months as a Google Summer of Code student for 2015 for Moodle, and it has come to a successful conclusion.

It was my greatest pleasure to work on Moodle throughout this period, to get to know and respect my awesome mentor, Dan Marsden, to learn about how Moodle and its community functions, and to eventually be able to help that community with a successfully completed GSoC project.

I set out to develop a skeleton plugin known as Moorsp for Moodle’s Plagiarism Framework, to incorporate the latest and greatest of Moodle’s framework goals within a testable plugin that wouldn’t need commercial logins to run automated tests. At the end of the project, all my code has been successfully integrated in to the Moorsp base code , and I have been awarded a pass by the Moodle community, both in terms of my contribution in code and community engagement. This makes me extremely happy.

I hope to continue my work on Moodle and have already started to help Dan with integrating some of the newer concepts in the Moodle framework in to some of the older plagiarism plugins such as the Urkund Plagiarism Plugin which is maintained by Dan himself. I believe that the most important part of me doing a GSoC project is gaining the ability to integrate and work closely with the Moodle community, an opportunity which I absolutely will not let go to waste.

Finally, I will leave you with the lovely Moodle GSoC 2015 Student Badge awarded to me by moodle.org. Thank you, Moodle, for this lovely token of appreciation. I shall always cherish it.


GSoC 2015 – Moorsp Plugin for Moodle – Update 11

This is my first update on the project in 2 weeks – mainly due to the fact that I have completed the bulk of the work required for the project and am now engaged in minor documentation and bug fixing tasks.

I brought the PHPUnit tests up-to-speed to be compatible with some of the changes I introduced to Moorsp during the Behat test writing phase – most notably that of a div being loaded along with submission content in the assignment module.

I had a discussion with Dan, my mentor, regarding sending a pull request to the main repository for Moorsp, and wish to merge the 44 extra commits listed here.

I also updated the README.md on the repository to give a guideline on Behat testing and unit testing Moorsp.

Moorsp README file

GSoC 2015 – Moorsp Plugin for Moodle – Update 10

The 10th week of my GSoC project for Moodle passed with me writing more Behat tests for the Moorsp plugin, completing the Behat test writing phase of development.

During writing tests I found some interesting bugs that were present in the code of Moorsp, most notable being that in onlinetext submission in the assign plugin, the content to be evaluated for plagiarism was being returned with <div class=”no-overflow”> tags around them, causing the filehashes to be mismatched and those text submissions not to be evaluated. I managed to build a workaround for this by hashing the contents with the offending tags included for onlinetext submissions.

Behat tests are running smoothly, with the main Behat tests implemented here.

Here is a sample of the final Behat test, show_teacher_plagiarism_status.feature, in action:


Behat tests in action

GSoC 2015 – Moorsp Plugin for Moodle – Update 9

The past week was spent continuing writing Behat tests for the Moorsp plugin. During writing the test for the feature where students are shown the plagiarism status on their submissions, I discovered that students were not being shown their plagiarism status even if the course manager had set a particular assignment, workshop or forum to show students this information. So I was able to fix this issue thanks to writing tests.

GSoC 2015 – Moorsp Plugin for Moodle – Update 8

The past week saw me reconfiguring my complete Moodle instance to get Behat testing working again, and the beginning of writing Behat tests for the Moorsp Plagiarism Plugin. I began writing tests for the following functionality:

  1. Enable/Disable Moorsp plugin – Completed
  2. Enable/Disable Moorsp submissions for assign – Completed
  3. Enable/Disable Moorsp submissions for workshop – Completed
  4. Enable/Disable Moorsp submissions for forum – Completed
  5. Show student plagiarism disclosure when submitting – Completed
  6. Show plagiarism level (whether plagiarised or not) on grading screen
  7. Show/hide plagiarism info from student

I will continue to write Behat and PHPUnit tests for the plugin next week.


Running PHP applications in Apache Tomcat 7

Apache Tomcat 7 is a popular server for running Java applications – but say you have a unique instance where you want to run both PHP and Java applications on Tomcat but don’t want to run two separate servers (i.e. Apache HTTPD + Tomcat) to achieve it?


For this we’re going to use the PHP – Java Bridge for Tomcat, which is a handy little package that will sort out PHP execution on top of Tomcat.

The first step is to download the Javabridge template from this link at SourceForge. This will give you a WAR file that you can directly drop in to your Tomcat server’s webapps folder.

For Windows users, the next step is to download PHP and extract it somewhere:



For Linux users, just install php5 using apt-get, yum, or your preferred package management tool.

Next step is to add PHP to the PATH variable. Append the path to your PHP folder to the end of your respective PATH variable.

Next, drop the JavaBridgeTemplate61.war file in to your Tomcat server’s webapps folder and start Tomcat.

When you navigate to your server’s Java Bridge folder (this is http://localhost:8080/JavaBridgeTemplate61/ by default), you’ll be able to see the Java Bridge’s index page:

Javabridge welcome page


If you go to javabridge/test.php, you’ll be able to see the output from the phpinfo() function:



If you open up test.php in the JavaBridgeTemplate folder in your Tomcat’s webapp folder, you can edit some of the code:





Now you can deploy any PHP application within the JavaBridgeTemplate folder and rename the folder to whatever you want. You can add many folders like this for different PHP applications.

Note that the JavaBridge runs PHP as CGI. If you want to enable/disable specific PHP extensions you can simply enable them as you would do normally on your php.ini file.

GSoC 2015 – Moorsp Plugin for Moodle – Update 7

During the past week, I’ve been busy working on testing the Moorsp plugin – through Unit Tests and Behat tests. I set up the PHPUnit environment for my Moodle instance and got it up and running. I also wrote most of the unit tests needed to test the class functions in the plugin, and had an interesting discussion on the Moodle forum whether form building functions should be tested on PHPUnit or Behat.

I also ran in to a slight problem running Behat tests after running PHPUnit, I posted a question on the forum and hope someone will be able to clarify that for me.

The current tests can be found here, and I will be adding to them continuously.

That’s it for this week!

GSoC 2015 – Moorsp Plugin for Moodle – Update 6

Another week in GSoC 2015 has gone by, and I’ve been busy working on the Moorsp Plugin for Moodle.

My main task during the past week was to complete the functionality of the Moorsp plugin and to ensure that it checks for duplicate submissions by comparing the filehashes of uploaded files.

Moodle takes two forms of submissions for assignments, forums and workshops; file uploads and online text. To store online text in the plagiarism_moorsp_files table, I hash the contents of the submission and store it with content_hashvalue as the filename.

The get_links() function is called, which in turn calls the get_file_results() function which carries out the actual comparison of files in the context of Moorsp. This will add a checked image to each submission as follows (green check mark for files that are not plagiarised, red warning sign for those that have been plagiarised).

Plagiarised submission


The next step is to start writing Unit Tests and Behat tests to provide test coverage for the Moorsp plugin.

GSoC 2015 – Moorsp Plugin for Moodle – Update 5

Another week of GSoC 2015 passes by and I have managed to make some advances in my project of building the Moorsp plugin for Moodle.

During the past week, I migrated the plugin to the new Events API described here, and in the process added an Observer class to watch for Moodle Plagiarism events.

The Observer in Moorsp is currently configured to handle events related to assessable_uploaded, with more event support to be built in during the coming week.

Dan, my mentor for the project, has suggested that I move the observer to a /classes folder within the plugin to enable autoloading.

During the past week I found the debugging framework in Moodle to be extremely helpful in finding out the values of various params without having to use an external debugger.

The $observers array in Moorsp currently takes the form of;


$observers = array (
 * Event observers
 'eventname' => '\assignsubmission_file\event\assessable_uploaded',
 'callback' => 'plugin_moorsp_observer::assignsubmission_file_uploaded',
 'includefile' => '/plagiarism/moorsp/observer.php'
 'eventname' => '\mod_workshop\event\assessable_uploaded',
 'callback' => 'plugin_moorsp_observer::moorsp_observer_content_uploaded'
 'eventname' => '\mod_forum\event\assessable_uploaded',
 'callback' => 'plugin_moorsp_observer::moorsp_observer_content_uploaded'
 'eventname' => '\assignsubmission_onlinetext\event\assessable_uploaded',
 'callback' => 'plugin_moorsp_observer::moorsp_observer_content_uploaded'

That’s it for this week. See you soon!

GSoC 2015 – Moorsp Plugin for Moodle – Update 4

The 4th week of GSoC 2015 has gone by and I’ve been continuing to work on the Moorsp plugin for Moodle.

During the past week, I completed the following tasks:

  • Fixed issues in Moorsp showing the student disclosure message during a submission
  • Continued to work on the file_uploaded and files_done event functions in Moorsp. The files_uploaded event is fired whenever a student uploads a file as part of a submission. The files_done event is fired when students have sent in their submissions for grading. Both of these methods need to check whether the file included in the event data has been added to the moorsp_files table, and add it if it has not.
  • Wrote code to store content hashes of files in the moorsp_files table. This is an important part of the initial version of Moorsp as the goal is to check the filehashes of two files together as a very basic plagiarism check. Since Moorsp is more of a plugin developed to execute tests on the plagiarism framework, it is not necessary to have more complicated plagiarism checks.