<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

  <title><![CDATA[Category: moodle | Dan Poltawski's Blog]]></title>
  <link href="http://blog.danpoltawski.co.uk/blog/categories/moodle/atom.xml" rel="self"/>
  <link href="http://blog.danpoltawski.co.uk/"/>
  <updated>2013-04-03T00:37:00+08:00</updated>
  <id>http://blog.danpoltawski.co.uk/</id>
  <author>
    <name><![CDATA[Dan Poltawski]]></name>
    
  </author>
  <generator uri="http://octopress.org/">Octopress</generator>

  
  <entry>
    <title type="html"><![CDATA[Notifying the end of phpunit executions on OSX]]></title>
    <link href="http://blog.danpoltawski.co.uk/2013/04/notifiying-end-of-phpunit-executions/"/>
    <updated>2013-04-02T23:32:00+08:00</updated>
    <id>http://blog.danpoltawski.co.uk/2013/04/notifiying-end-of-phpunit-executions</id>
    <content type="html"><![CDATA[<p><img class="right" src="/images/2013/20130403-phpunit.png"></p>

<p>Whilst <a href="http://blog.danpoltawski.co.uk/2012/04/integrating-a-bug-fix-into-moodle-core-the-mechanics/">integrating issues into Moodle</a> it's a multiple times per day occurrence to run phpunit tests on the whole Moodle codebase. Each day we add more and more tests and so the time taken to run these tests increases gradually. I'm not one for <a href="http://xkcd.com/303/">sword fighting on wheely chairs</a>, so whilst waiting for phpunit tests to run I'll generally move onto another task, then frequently i'd forget completely that the phpunit run was going on in the background and not know what the phpunit output was showing me, need to run the tests again and fall into the same trap!</p>

<p>In order to resolve this situation I was inspired by <a href="http://brettterpstra.com/2012/08/01/mountain-lion-notifications-from-terminal-with-terminal-notifier/">Brett Terpstra's post</a> about using the ruby gem <code>terminal-notifier</code> to send messages to Mountain Lion's notification center and decided to use this to remind me of phpunit executions.</p>

<p>After installing terminal-notifier and using Bret's <code>finished.rb</code> script I added a bash function for phpunit:</p>

<pre><code>function phpunit() {
    vendor/bin/phpunit $@
    if [[ $? == 0 ]]; then
        finished "phpunit OK"
    else
        finished "phpunit FAILED"
    fi
}
</code></pre>

<p>In order that I don't miss a phpunit run I've configured the notifications to be 'Alert style notifications' (configured in OS X Preferences > Notifications > terminal-notifier) which works great, the only remaining issue is there does not seem to be a way to dismiss alerts using keyboard shortcuts.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Microsoft Skydrive repository plugin for Moodle 2.3]]></title>
    <link href="http://blog.danpoltawski.co.uk/2012/06/microsoft-skydrive-repository-plugin-for-moodle-2-3/"/>
    <updated>2012-06-29T01:25:50+08:00</updated>
    <id>http://blog.danpoltawski.co.uk/2012/06/microsoft-skydrive-repository-plugin-for-moodle-2-3</id>
    <content type="html"><![CDATA[<p><a href="http://blog.danpoltawski.co.uk/images/2012/Screen-Shot-2012-06-28-at-23.48.57.png"><img class="right" src="/images/2012/Screen-Shot-2012-06-28-at-23.48.57-300x140.png"></a>
<a href="https://skydrive.live.com">Microsoft Skydrive</a> provides 25GB of free storage and has integration with Windows, Mac, iPhone, iPad and <a href="http://moodle.org/plugins/view.php?plugin=repository_skydrive">now Moodle</a>!</p>

<p>I have <a href="http://moodle.org/plugins/view.php?plugin=repository_skydrive">just released</a> a Moodle plugin for Skydrive in <a href="http://moodle.org/plugins/">moodle.org/plugins/</a>. Please try it out, enjoy and help improve the documentation!</p>

<!--more-->




<h2>Some developer background..</h2>


<p>In Moodle 2.3, <a href="http://docs.moodle.org/23/en/Google_OAuth_2.0_setup#OAuth_2.0">I converted</a> the Google repository/portfolio plugins to authenticate using OAuth 2.0 as this was the recommended way forward from Google. Much of this work was simplified as I had already created a skydrive plugin for 2.2 using OAuth 2.0 (there were no good php OAuth 2.0 libraries at the time). Both Google and Microsoft now authenticate for their apis using OAuth 2.0 and so in <a href="http://git.moodle.org/gw?p=moodle.git;a=blob;f=lib/oauthlib.php;h=587ba195b60a2a824a931de01accae715ed7da38;hb=6be7840ce6a0bc03a8b68ab5bdd18f00963d9c9f#l357">lib/oauthlib.php</a> we now have an OAuth 2.0 client class which is used for both Microsoft and Google. This plugin was updated to work with the new class in Moodle 2.3. Hopefully all the rest of the repository plugin providers will convert to OAuth 2.0 soon. Hurray for open standards :)</p>

<h2>Thanks</h2>


<p>Thanks to <a href="http://www.inacap.cl/">Universidad Teconológica de Chile (INACAP)</a> who funded this plugin to be created by <a href="http://www.luns.net.uk/">LUNS</a> and to LUNS for releasing this work open source, allowing me to continue to work on this for Moodle 2.3.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Integrating a bug fix into Moodle core: the mechanics]]></title>
    <link href="http://blog.danpoltawski.co.uk/2012/04/integrating-a-bug-fix-into-moodle-core-the-mechanics/"/>
    <updated>2012-04-11T08:23:25+08:00</updated>
    <id>http://blog.danpoltawski.co.uk/2012/04/integrating-a-bug-fix-into-moodle-core-the-mechanics</id>
    <content type="html"><![CDATA[<p>Having seen <a href="http://tjhunt.blogspot.com.au/2012/03/fixing-bug-in-moodle-core-mechanics.html">Tim's post</a> about fixing a bug in Moodle core I thought I should take the opportunity to follow up with the next part of the process - integrating the changes into the Moodle core. Once a developer has produced a fix which is ready for integration and requests a integration review then the bug is 'handed over' to the integration team.</p>

<h3>The integration team</h3>


<p>The integration team is staffed by a group of developers at Moodle HQ. We are a geographically disparate team, spread across the world in order to prevent natural disasters and political unrest from affecting the Moodle weekly release cycle. ((That might not be the reason.. ;-) )) <a href="http://moodle.org/user/profile.php?id=1146834">Aparup</a> and I are located in Perth, Australia; <a href="http://moodle.org/user/profile.php?id=3176">Eloy</a> in Lardero, Spain and <a href="http://moodle.org/user/profile.php?id=865279">Sam</a> in Nelson, New Zealand.</p>

<p><a href="http://g.co/maps/2d72v"><img src="/images/2012/Screen-Shot-2012-04-10-at-20.54.42-1024x533.png" title="" ></a></p>

<!--more-->


<p>Together we have 20 years of Moodle development experience and this collective experience is an important part of how we work together as a team - knowing the idiosyncrasies of Moodle - how parts of the system have come to being and understanding how changes can potentially affect different areas which might otherwise be missed. I should say that since i'm the newest member of this team  (and still learning the ropes) I hope that my comments are accurate!</p>

<h3>The integration review</h3>


<p>The integration team is responsible for 'pulling' code from all developers around the world, reviewing and bringing it together (integrating it!) to make up the Moodle core release. This process is the same for all developers no matter whether they work for Moodle HQ, a University, Moodle Partner or none of the above.</p>

<p>The purpose of the integration review could be misconceived simply as as a final technical code review before code gets into core. That is certainly a large part of it - we are striving to continually increase the quality of Moodle releases through technical reviews, increased testing and other processes. But the integration review is also about examining the impact of each change from our users point of view - ensuring that we don't loose focus of Moodle as supporting education! Other aspects of the integration review include ensuring that discussion has taken place with interested parties before a change lands and facilitating that if it hasn't as well as providing guidance and feedback to contributors - helping developers learn why we might want changes or if there is something that could be useful for next time.</p>

<p>Anyway enough preamble, the title promised mechanics so..</p>

<h2>Down to mechanics</h2>


<p><a href="http://blog.danpoltawski.co.uk/images/2012/Screen-Shot-2012-04-02-at-11.40.54.png"><img class="left" src="/images/2012/Screen-Shot-2012-04-02-at-11.40.54-300x202.png"></a>At the start of each week we being a new integration cycle and on average there are 30-40 issues waiting for integration into Moodle core. The process begins with an integrator moving issues waiting for integration into the 'current integration'. Issues marked as in the 'current integration' are those which we will work on for this cycle. We make this distinction simply to avoid the bucket of issues we are working to integrate for the weekly release from constantly refilling.
The integrators work through the queue of issues waiting for integration one by one - in this case I cheated a bit and allocated myself <a href='http://tracker.moodle.org/browse/MDL-32039'>MDL-32039</a> early, as I thought it'd be a good opportunity to do a follow up post to Tim.</p>

<h3>Reviewing the History</h3>


<p>The first step is to mark an issue as 'in integration review' in the tracker workflow (pictured) and starting to read back the comments in the issue - learning about the history of this change. In this case the change is fairly obvious and straight forward so there is not too much to consider. But sometimes there might be debate about a particular approach or how to solve an issue and comments from peer reviewers or watchers of the issue. Or indeed there might be no discussion at all when someone is proposing do something particularly radical which is equally important to note.
As a brief side note - I personally encourage all developers to 'vocalise' even their internal though process through bug comments and commit messages. Its an often forgoten about communication method but comments on a bug like this can help reviewers now understand the decisions without too much back and forth. And perhaps more importantly months and years down the line it can be used by other developers to understand why a change was introduced even if you are no longer working on Moodle or if you've forgotten.</p>

<h3>Reviewing the code</h3>


<p>At the point of integration review, we review changes 'in situation' to see how the fit with other integrated issues. So the first step is to pull the change into the master integration branch.</p>

<pre>
danp@marge ~/git/integration> git checkout master
Switched to branch 'master'
danp@marge ~/git/integration> git fetch origin
danp@marge ~/git/integration> git reset --hard origin/master 
HEAD is now at abd2899 MDL-31768 - it is not possible to add a picture to the thanks page in feedback
</pre>


<p>Some notes about this first step. On git.moodle.org we have two repositories, the production moodle.git (which almost everyone should be using) is the result of what the integration process produces. We also have integration.git which is our 'staging' repository where we pull changes, integrate and test - this is where integration work happens before deploying to moodle.git. integration.git is intentionally separate and volatile, this is where we iron out the kinks before pushing to the production moodle.git. I have a separate integration checkout which I am using here for reviewing changes and pushing to the integration repository.
To explain what I did -  I first checked out the master branch of the integration repository and brutally reset this to the current state of the integration repository to accept new changes. In most git workflows this is not an advisable strategy but the way I use my integration repository I always want it to be completely clean and blow away any changes (in fact I have a script which does this on all branches) so I am happy to do this.
Now to pull Tim's changes:</p>

<pre>
danp@marge ~/git/integration> git pull git://github.com/timhunt/moodle.git MDL-32039
From git://github.com/timhunt/moodle
 * branch            MDL-32039  -> FETCH_HEAD
Merge made by the 'recursive' strategy.
 .../lang/en/tool_qeupgradehelper.php               |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
</pre>


<p>I now have Tim's changes in the master integration branch and it merged successfully without issue. This was straight forward - which is not surprising as its a fairly self contained issue and nobody else has been working on that language file this week. But simple merges are not always the case. We ask developers to rebase their changes against the latest weekly release to reduce the frequency of conflicts, but sometimes the integrator will have two changes integrated during the same week and there will be conflicts. Common examples of merge conflicts are multiple changes to the major version number in one week. This is where integrators need to examine the differences and either resolve the conflict manually or delay an issue as it might be affected by another issue which is conflicting.
Since that was straight forward I can move straight onto reviewing the change:</p>

<pre>
danp@marge ~/git/integration> git diff origin/master..master --stat
 .../lang/en/tool_qeupgradehelper.php               |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
danp@marge ~/git/integration> git diff origin/master..master
</pre>


<p>First I look at a quick summary of lines changed - this is useful to find if there are any unexpected places where lines are changed. Then I look at a diff in unified format - which when reviewing open source code you get very used to. But since this is a language change I actually decide to review it in a more readable format by using the --word-diff option of git diff.</p>

<pre>
danp@marge ~/git/integration> git diff origin/master..master --word-diff
</pre>


<p><a href="http://blog.danpoltawski.co.uk/images/2012/Screen-Shot-2012-04-02-at-11.50.06.png"><img class="left" src="/images/2012/Screen-Shot-2012-04-02-at-11.50.06-300x152.png"></a>
In --word-diff format we are much more easily able to see this change and it looks good. In other circumstances the --ignore-space-change option can also be useful to find just the changes that have happened ignoring space changes such as indentations (when introducing a conditional and so forth). We will also look around the files in full form and history of file changes around the area in question. I tend to use the command line and vim, others will use IDEs such as netbeans and eclipse.</p>

<h3>Commence pre-flight checks</h3>


<p><a href="http://blog.danpoltawski.co.uk/images/2012/Screen-Shot-2012-04-02-at-12.01.14.png"><img class="right" src="/images/2012/Screen-Shot-2012-04-02-at-12.01.14-300x168.png"></a>
At this stage I have reviewed the change, tested it and understood the impact and i'm confident in the code change that i'm ready to integrate the change. However, we have another tool up our sleeves for checking changes before integrating - our loyal servant <a href='http://jenkins-ci.org/content/about-jenkins-ci'>Jenkins</a>. Jenkins is a continuous integration server which we are in the early stages of integrating into the Moodle workflow thanks to some great work by Eloy.<a href="http://blog.danpoltawski.co.uk/images/2012/Screen-Shot-2012-04-02-at-12.21.54.png"><img class="left" src="/images/2012/Screen-Shot-2012-04-02-at-12.21.54-300x186.png"></a></p>

<p>I am able to run a pre-check on Tims branch before integrating. This pre-check will run the various code checkers against Tim's change to spot problems and then produce a report on this. In the future its planned that this will happen without an integrators involvement automatically when an issue is submitted for integration.
Luckily (and as expected) the checks ran successfully and no issues were found so I am now ready to push to integration.</p>

<h3>Rinse and repeat</h3>


<p>Since the change in question affects multiple branches and not just master I need to repeat the review process for all other branches required (2.1 and 2.2 in this case). In the interests of keeping you awake, i've spared you this process. :)</p>

<h3>Pushing.. done [1] </h3>


<p>The time has come to push to the integration repository:</p>

<pre>
danp@marge ~/git/integration> git push integration-push master MOODLE_22_STABLE MOODLE_21_STABLE
Compressing objects: 100% (24/24), done.
Writing objects: 100% (26/26), 3.14 KiB, done
   21cadef..7d7331b  MOODLE_21_STABLE -> MOODLE_21_STABLE
   18ca35b..41b4bb0  MOODLE_22_STABLE -> MOODLE_22_STABLE
   abd2899..6461e14  master -> master
</pre>


<p>Done? Well not quite.. at this point the previously mentioned continuous integration server notices the change in the integration repository which has been pushed and starts running a series of tests on the changed branches. There are too many checks to go into here and they continually being evolved, but for example we will run all unit tests and ensure 'the build is not broken' as well as conduct fresh installs and upgrades and compare that upgraded data is exactly matching newly installed data. This automated testing stage can prevent serious and difficult to spot regressions before they make their way into production and indeed in last weeks integration cycle it caught two such bugs.</p>

<h3>Mark as Integrated</h3>


<p>Once the change has been pushed, we will then mark the change as integrated in the tracker and the worflow will change to mark the issue as ready for testing.</p>

<h3>Unresolved</h3>


<p>Since this blog post has grown to much longer than I expected, I will stop my description of the integration process as this point. I hope some of you made it to the end :) <a href="http://blog.danpoltawski.co.uk/images/2012/Screen-Shot-2012-04-02-at-12.00.06.png"><img class="left" src="/images/2012/Screen-Shot-2012-04-02-at-12.00.06-300x90.png"></a></p>

<p>[1] The title is a little in-joke as we integrators have a simple <a href="http://en.wikipedia.org/wiki/Semaphore_(programming)">semaphore</a> system to help avoid unnecessary conflicts by first calling out 'pushing' (on a chat channel) when starting the process of pushing branches and releasing 'our lock' completing with another shout of 'done'.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[The beer is about to get a lot colder..]]></title>
    <link href="http://blog.danpoltawski.co.uk/2011/11/the-beer-is-about-to-get-a-lot-colder/"/>
    <updated>2011-11-30T06:21:28+08:00</updated>
    <id>http://blog.danpoltawski.co.uk/2011/11/the-beer-is-about-to-get-a-lot-colder</id>
    <content type="html"><![CDATA[<p>When <a href="http://tjhunt.blogspot.com/">Tim</a> first returned to the UK from his time at <a href="http://moodle.com/hq/">Moodle HQ</a>, the first thing he did ((Well, the first thing I knew about, anyway)) was to invite me to come to <a href="http://gbbf.camra.org.uk/home">The Great British Beer Festival</a> with him. Apparently i'd taunted him with reports of <a href="http://www.camra.org.uk/page.aspx?o=100330">Real Ale</a> whilst he was in Perth. Well.. it's time for Tim to get his own back! <a href="http://blog.danpoltawski.co.uk/images/2011/lancaster-today.jpeg"><img class="right" src="/images/2011/lancaster-today-300x225.jpeg" title="" ></a></p>

<p>After seven years working at <a href="http://www.luns.net.uk/">LUNS</a> and nine years living in Lancaster, I've decided to have a change of scenery and i'm going to be leaving many great friends and colleagues behind to move to Moodle HQ in Perth, Australia. Needless to say, this was not an easy decision to make. (Although the weather like Lancaster demonstrated today could convince me otherwise!)</p>

<p>My involvement with Moodle started with LUNS and it has been a great journey. We were newcomers to the Moodle community with a small project to move a few keen high-schools onto supported hosting platform in 2005. My first post to moodle.org was <a href="http://moodle.org/mod/forum/discuss.php?d=38138">asking the theme forums</a> for advice on how to do multiple themes on a single codebase and the first patch I remember getting accepted was to help us solve that problem six months later: <a href="http://tracker.moodle.org/browse/MDL-6784">MDL-6784</a>. Although the git history suggests my first fix was actually <a href="http://git.moodle.org/gw?p=moodle.git;a=commit;h=57bdc37ddb339ed4811e68cd517db4e396280c74">a horrible JS change</a> which surprises me more than anyone!)) Today LUNS is one of the largest non-HQ code contributors to recent Moodle releases and have provided hundreds of thousands of people with access to Moodle through our various clients - primary school students[1], university lecturers[2], high school teachers, company employees and charity workers. I've thoroughly enjoyed that journey and the great people who have made it what it is.</p>

<p>I'm really looking forward to working for Moodle HQ! Despite being so close to Moodle as a developer, I continue to be amazed and motivated by how many people I can touch by working on Moodle. Friends from my days at school and university use Moodle as part of their job on a daily basis, my youngest sister is currently studying and supported with Moodle (unfortunately only at <a href='http://www.slideshare.net/moodler/moodle-pedagogy-at-online-educa-2009/32'>stage 1</a> of Martin's pedagogical stages) and I meet more and more moodlers ever day! I'm hoping that my time working as external developer working on the other side of the world to Perth will be a great new perspective to add to the team.</p>

<p>I'll be working for LUNS for a while yet, but it feels like a good opporunity to thank everyone i've worked with over the years at LUNS, clients and community members who accepted my patches. :) I'm touched by the kind <a href="http://www.luns.net.uk/2011/10/27/luns-developer-gets-moodle-hq-post/">post about my leaving</a>. I expect to continue working with you if more indirectly at Moodle HQ. :)</p>

<p>Happy Moodling!</p>

<p>[1] Making their initial steps to learning how to use a computer
[2] No comment</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Siri Interface to the Moodle Tracker]]></title>
    <link href="http://blog.danpoltawski.co.uk/2011/11/siri-interface-to-the-moodle-tracker/"/>
    <updated>2011-11-21T01:44:02+08:00</updated>
    <id>http://blog.danpoltawski.co.uk/2011/11/siri-interface-to-the-moodle-tracker</id>
    <content type="html"><![CDATA[<p>Earlier today I came across an <a href="https://github.com/plamoni/SiriProxy">interesting project</a> which provides a 'proxy interface' to Siri on the iPhone 4S allowing custom plugins to be created to respond to requests from Siri.</p>

<p>Eager to try this I hacked together a Moodle plugin for the siri proxy which would do lookups to the Moodle tracker. So, welcome Siri - <a href="http://www.youtube.com/embed/iLB1sTMr0iM">the newest aid</a> to the Moodle 2.2 QA testing effort :-)</p>

<iframe width="640" height="360" src="http://www.youtube.com/embed/iLB1sTMr0iM?hd=1" frameborder="0" allowfullscreen></iframe>


<p>(The plugin I wrote is <a href="https://github.com/danpoltawski/SiriProxy/blob/moodlesiri/plugins/moodle/moodle.rb">available on github</a>. It is my first ruby script and its not particularly elegant as it was just for fun :-) )</p>
]]></content>
  </entry>
  
</feed>
