OU blog

Personal Blogs

New blog post

Visible to anyone in the world

Rant time! (Wait. That's every time... Well, this time I'm actually typing it into my blog.) This is all about computer programming so if you don't know anything about computer programming you are officially off the hook! (Enjoy your day!)

Coding style guidelines are usually a matter of opinion. But here's one of my opinions, and in my opinion, it's not an opinion, it's a fact. smile

Apart from normal start-of-line indent, trying to align lines of code horizontally is always wrong.

Here are three examples. For each one I'll give WRONG then RIGHT.

WRONG:

$this->something = $something;
$this->x = $x;

Right:

$this->something = $something;
$this->x = $x;

WRONG:

$thing = array(
'value' => 1,
'anothervalue' => 2,
'more' => 3);

Right:

$thing = array(
'value' => 1,
'anothervalue' => 2,
'more' => 3);

WRONG:

$something->function1()->function2($variable, $anothervariable,
$yetanothervariable) {

Right:

$something->function1()->function2($variable, $anothervariable,
$yetanothervariable) {

etc.

The wrong examples are wrong because computer code is not carved in stone, nor even printed on paper. (When you're grave-carving or desktop-publishing, feel free to make things line up. When you're computer-programming, stop it! Now!) Unlike gravestones and newsprint, computer code changes.

Let's say I add a variable called $slightlylonger to the list of assignments. With the right code, this involves me adding one code line. With the wrong code, I have to add one code line, but now I have to modify 2 other code lines as well to make the stupid thing consistent.

Similarly if I change the name of one of the functions I would now have to go around changing all the following lines as well, where it wrapped to multiple lines. (The function example is also bad because horizontal space is usually at a premium, which is why you're having to wrap lines in the first place; when you wrap the line, you want to get a useful amount of increased space for adding more parameters in future. That doesn't happen if the wrap point is artificially shifted to way up near the end.)

Having to modify extra lines matters for two reasons: first, making the changes is annoying, and second, the more lines you touch then the more chance of a conflict in your version control system.

In addition, as I'm sure the newspaper designer would tell you, both these approaches are bad even from a layout and visual design perspective. They result in 'columns' that start every which way at random points. It's messy.

So, much better not to make it line up in the first place. If you disagree... well there's a word in bold in this post... let's leave it there smile

Rant over!

And no this wasn't directed at any particular developer, or even the Moodle project. Just, grr.

I'll try to write a blog post about something more specific to do with our Moodle developments next time. But this is better than nothing, right? smile

 

Permalink 5 comments (latest comment by kenn, Monday, 12 Dec 2011, 21:27)
Share post

New blog post

Visible to anyone in the world

I was at one day of the UK Moodle Moot conference this year. If anyone's interested in my presentation (which was about how to work with Moodle HQ), they've just published the video versions now.

Videos for all the presentations - mine is on day 2; you might also be interested in Anthony's presentation about mobile view, also on day 2. Tim's presentation isn't up yet, I guess something broke there.

The audio is really quiet on my presentation so you'll have to turn it up to max in a quiet room. It's surely worth the effort though as otherwise you will miss 17 minutes of brilliant aural gems like 'I think it's a good idea to write good code'. Exclusive!

If you do decide to miss that, you could also just look at the slides only.

Incidentally I just watched the presentation back; I think this is the first time I've seen me giving a presentation on video (I've heard recordings before but normally the video channel is just the slides; this time they're using some clever system that does both slides and video). I should probably not sway from side to side quite so much.

Permalink 1 comment (latest comment by Dan Poltawski, Monday, 23 May 2011, 20:12)
Share post

New blog post

Visible to anyone in the world

Sorry I've been neglecting this blog again. I'll do a proper post sometime (er I guess) but I just wanted to throw in a quick post that might be of interest to Moodle 2 developers.

Have you ever needed to test the 'restore' of a course (e.g. that includes your new module) and got annoyed because restoring involves clicking through about a million screens?

I've written a plugin that you can use to do temporary restore in one click (once you have set up the backup file you want to use). Then you can view the restored course in one click, delete it also in one click, restore it again (in, yes, one click), and repeat as much as you like while fixing bugs.

(I guess I said one click enough times that it's technically like three clicks now, but still. It's a lot better than doing the same thing manually.)

Plugin is called Broom (thanks to Tim for acronym help) because it's both fast and it also helps you keep your database clean by deleting all those courses.

https://github.com/sammarshallou/moodle-local_broom

 

 

Permalink Add your comment
Share post

OU contrib modules for Moodle 2

Visible to anyone in the world
Edited by Sam Marshall, Monday, 12 Mar 2012, 10:48

Edit: This post is now out of date and there are new versions available on our GitHub site - see newer posts. I have deleted the files from Google Docs to avoid confusion.

I've been ridiculously busy over the past weeks but having hit (or, at least, passed) one deadline I now have time at least to write a blog post...

As promised, except slightly late, I'm now releasing the main OU contrib modules - oublog, ouwiki, and forumng - in their Moodle 2 versions.

These are not very tested alpha versions and are bound to be broken in various ways. (I probably don't want bug reports at the moment, because basically I know lots of things are wrong.) We are not using these in live production systems and I would recommend that other people don't either.

Link to Google Docs folder containing the three zip files

If you're familiar with these modules you will note that these are basically exactly the same as the 1.9 version except with support for the Moodle 2 attachments system. (So that, if we were actually running Moodle 2 here, I could actually attach files to a blog post instead of having to stick them on a random google docs site.) OU blog and wiki (but not yet ForumNG) also support the Moodle 2 portfolio API as well. All three support activity completion.

There is one notable case of reduced functionality in the wiki - we have been phasing out the 'comments' facility because it is confusing (timid students add comments when they should be editing the page - having two communication mechanisms is confusing) and it is now not present. The 'annotations' facility that lets teachers 'mark' work and add comments to it is still there. (but, no gradebook integration yet.)

OU wiki and OU blog were converted by Catalyst developers. ForumNG was converted by us (actually, me). All are released under GPL.

The required Moodle version is 2.0.2, except for annotation in ouwiki requires 2.0.2+ or 2.0.3 to work properly. These versions are probably not correctly defined in the 'requires' variable in version.php...

Anyway, this is definitely an 'at your own risk' thing (but then it always is). If you want to use them, good luck ;)

We hope to release 'more tested' versions of these modules after the OU deploys them in live systems this autumn.

Permalink 1 comment (latest comment by Gillies Kleboe, Wednesday, 27 Apr 2011, 10:42)
Share post

New blog post

Visible to anyone in the world
Edited by Sam Marshall, Friday, 4 Feb 2011, 18:40

A few things to update on with regard to the Moodle 2-related work I'm doing at the OU.

These are quite geeky but might be partially comprehensible by non-programmers this time? Maybe? I'm not sure. Oh well, not forcing anyone to read it.

1. No OU public repository. It's been discussed here and we have agreed that our Moodle 2-based source code repository won't be public after all, which is a bit disappointing. There were concerns about what happens if a developer commits code that contains a system password or something like that (this should be found in code review, but by that point, it's already in the repository).

However I still want to ensure that we release more things more reliably than last time (where we used manual processes). This should be easier because we are trying to keep core modifications as near to zero as possible, and to make our key customisations into standard, independent plugins wherever we can - so they're more practical for other people to use. The current plan is to put out all this stuff... in some as-yet-undetermined but automated way... from about September which is roughly when real live students start using the system, so it's the first time that really fully-tested code would be available.

So anyway, all our code that is suitable for use elsewhere will be public; that also means much more code will be public than under our Moodle 1.9 system; but you probably won't be able to point and laugh at all the core-Moodle customisations we might still be forced to make. Or to steal our passwords.

Before September I will probably do manual releases of a few key modules if anyone else is relying on them.

2. First outsourced project is complete

We've finished the testing process on a small admin report that was developed by Netspot. It works! Hopefully the whole outsourcing thing will actually be a success this time around.

I think the detailed test scripts I've been doing are pretty important to ensuring we actually get what we need (along with sensible selection of companies to do the work). Hopefully, anyhow, because it took ages to make them.

3. ForumNG nearly working in Moodle 2

ForumNG (our forum system) is more or less working in Moodle 2.

This has been a bit of an effort: according to git, ForumNG is about 28,700 lines of code. During the process I have added about 800 lines of code, deleted about 2800 lines of code, and modified about 25,700 lines of code. (If I modified the same line four times in separate commits, it counts for 4 in these stats, so I haven't really touched every line... yet.) Obviously some of these were search-and-replace modifications but I've done an awful lot of manual changes too.

It isn't finished yet. The big thing that doesn't work is the JavaScript, which needs converting to YUI3 (easy but tedious) and to support the new HTML editor and file manager (difficult and may possibly turn out to be a significant rewrite of certain areas). Apart from that I have decided that in order to check things I definitely need to write a comprehensive manual test script that covers all features. This is going to take quite a long time.

4. I got a fairly major change into Moodle 2...

As mentioned last blog post, I did a fairly big chunk of work for core Moodle 2 that will allow plugins (such as, for instance, ForumNG) to do more interesting things on the main course page (such as, for instance, add an 'Unread' indicator - not previously possible without hacks to core). It also improves a bunch of related areas of code, documentation, etc.

Anyhow, this work is now actually included in standard core Moodle 2. Yay - and many thanks to Petr (who came up with much of the overall concept, reviewed the design, reviewed the code, and fixed bugs) and Eloy and others at Moodle HQ.

5 ...but it kind of broke this week's release.

Sorry if you got this week's Moodle 2 release and hit one of the bits that were broken as a result of the change smile And, um, if you didn't get this week's release yet, here's a tip - wait for next week. We did actually test the change - I mean I tested it lots while I was developing it, then Moodle HQ tested it - but there have been just a couple of odd side effects in apparently unrelated areas.

Of course nobody runs random Moodle weekly releases on their live server straight away without any testing of their own, so this is okay, right? .... Right .....? smile

6. I proposed a presentation for the UK Moodle Moot.

We're going to the UK moot again, and I've proposed a short presentation about working together with Moodle HQ. Not counting chickens though: I think last time I proposed a presentation too, and it was going to be totally awesome*, but they rejected it.

* Safe to make that claim about a presentation that never existed, I think. smile

 

Permalink Add your comment
Share post

New blog post

Visible to anyone in the world
Edited by Sam Marshall, Friday, 21 Jan 2011, 18:11

Here's a blog entry to let you (=anyone who cares) know what I've been doing so far this year. Apart from thinking 'wtf how is it another year already'.

This is another very technical post, because I don't really have anything non-technical to say this time, so apologies to anyone who isn't a programmer, it may be time to make a swift exit...

I've made several small changes to core Moodle 2. The new process for external developers to get changes included in the core system is a bit cumbersome but it really seems to be working quite well, at least when the tracker hasn't fallen over.

Also thanks to Petr (Moodle HQ developer) for helping with a proposal for letting modules do more things to the front page, which basically means third party developers can create modules that behave like label (displaying content on the front page instead of just a link) or like forum (showing dynamic, in this case unread-messages, information on the front page). It also tidies up and documents the infrastructure around this area. I've done all the work now but this hasn't been accepted into Moodle code yet; I'm typing with crossed fingers right now. smile (By the way, if it is accepted, I don't know whether it will be accepted into Moodle 2.0.x or 2.1.)

One last thing while talking about core stuff - I made a teensy little plugin for Moodle 2 strictly for developers that lets you one-button toggle between your normal (presumably 'debug') settings, and some faster 'production'-style settings, for when you want to realistically profile performance using Eloy's nice xhprof integration. No point profiling something that's running slowly because of extra debugging calculations, after all. If anybody wants this, please grab it from my GoogleDocs area.

Back with OU custom developments, I've done some of the work to convert ForumNG to Moodle 2, including converting all the database code to the new API. That took quite a while as the search for affected lines that needed to be changed initially found over 600 results.

As for the three other members of my team, Ray has been working on Structured Content [the system that turns XML into textbook-style content on our Moodle websites]. This is working quite well on Moodle 2 now. Alan is also converting a necessary subsystem for that, and Al is working on the 'log in as example student' administrative feature that we use instead of the core switch role feature.

This is the type of thing we're supposed to be doing. Unfortunately I have also had to fix some fairly serious bugs in ForumNG this week, and Ray's had to do some in Structured Content, both in our current 1.9 system. Obviously bugs are especially annoying because we have to fix them in both versions now. (Public notice to all staff and students: stop finding bugs in our current system! I'm trying to work on the new one!)

In addition to the actual bugs, there are also other support issues I have to investigate which aren't likely to be bugs with our system, probably just some weird configuration problem between us and other university systems - like at the moment, somebody doesn't seem to be able to get into the system when they totally should be allowed access. (Public notice to all staff and students: stop not being able to log in to our current system! I'm- wait, that doesn't really work, does it.)

smile

Anyway, that's how things are going so far this year. Maybe I can think of something more interesting to put in the next blog entry, but I wouldn't bet on it!

Permalink 2 comments (latest comment by Mark Pearson, Monday, 21 Feb 2011, 15:21)
Share post

OU development process using Git

Visible to anyone in the world
Edited by Sam Marshall, Friday, 17 Dec 2010, 16:48

For those not familiar with Git - no I'm not being rude. (Perish the ****ing thought!) Actually, 'Git' is a popular version control system for organising software development.

And to be honest, if you didn't know that already, you should probably skip the rest of this post because it isn't going to make any sense. smile Really this is not a very exciting post at all. Sorry.

That said - as mentioned previously, developers here are getting ready to start work on developments for our Moodle 2-based course website system (aka 'VLE2').

We are using Git to host the code. That's good news because (a) it is probably the best (widely-used) version control system in existence, and (b) it's the same one that Moodle core developers are using. But there are three problems:

  • For most (not all) of our developers, their only experience of version control systems has been the CVS-based process we have previously used here. Hardly any have any previous Git experience.
  • Git is really complicated (=powerful) and includes loads of new concepts (the basic concept of any kind of distributed version control at all is probably the biggest and scariest of these).
  • Git's GUI integration into developer tools (Eclipse) is frankly only about half written so far.

None of these problems are insoluble (we hope). The approach we're taking is to define a very specific way to use the software and the system that avoids as many of the complexities as possible, while retaining the key benefits we need. And to document that in a really clear manner.

The documentation is why I'm making this post. I know there are other institutions who are trying to switch to Git and I thought maybe the documents I wrote about this might be useful as a base to work on for your own plans. Understand these aren't generic documents in any way - they're specifically about our own system and our process and they can't directly be used by anyone else. But if you're trying to help a bunch of developers to switch to Git, you might want to use our documents (or possibly even our process) as a reference when putting together your own material.

Or to put it another way, if you really want a Word document that tells you how to install git on a Windows computer, with like a zillion screenshots, congratulations! This is your lucky day.

There are actually three documents - one about installing Git, configuring Eclipse to work with it, and setting up an account on our Redmine system; one about 'ordinary' developers doing work on the system; and one about lead developers merging in those changes after review.

Link to the three documents

These have been 'tested' to the extent that other people have tried going through these processes and it worked (of course, the documents were initially wrong, but have since been corrected), but no further.

Of course the most important question regarding all this is... does our process actually work? If anyone's interested in the answer to that, please get back to me in about six, seven months. smile

Permalink 2 comments (latest comment by Sam Marshall, Tuesday, 18 Jan 2011, 10:59)
Share post

Moodle 2 conversion

Visible to anyone in the world
Edited by Sam Marshall, Monday, 22 Nov 2010, 10:56

Just a quick update here about our Moodle 2 conversion plans (two people have asked already so I thought I'd post here and save effort later). If anyone's using any of the main OU custom modules and wants to know, it's good news! We will be converting these to Moodle 2. Specifically:

  • ForumNG we'll be converting in-house soon. I'm hoping it will be finished around January. Same applies for the OU search block that provides live full-text search facilities to all these tools.
  • OU blog and OU wiki we are currently trying to outsource - I wrote some specifications with really detailed test cases... We are hoping to get the code probably a bit later than ForumNG, maybe end January.

In both cases we are hoping to put these in with other code for final integration testing etc for an internal release at the start of March. First real usage (along with some other features) will be with our second-phase release in June, and it's likely students won't use it until July.

So basically, we should have the basic converted modules ready quite soon, but the more reliable 'same code we are using for live students' versions will be later.

I know Moodle 2 is theoretically about to be released very soon, so there might be some people out there thinking 'argh! but i'm about to upgrade and you're telling me I will lose my reliable ForumNG version for another seven months!' - but the version that's coming out now is the first one and in my opinion you'd be very unwise to use it on a live system. I'd recommend you wait at least another three, four months to upgrade live systems, even if you don't use any OU custom modules...

 

So anyway that was the good news - now for the... wait, it's more good news! Of a sort. We're planning to do a similar public release (with similar timescales) of our OU content module, which provides online content within Moodle based on XML document files, which are basically equivalent to textbooks but can include audio, video, Flash, Java applets, and some interactive thingies, etc. (By the way, this is also the same XML format we use to produce most of our actual printed textbooks, although the 'print' part is done in a separate system and won't be included in this release.) Example of current 1.9 version on OpenLearn

However, there might not be sufficient documentation etc. for anyone to actually use it as we have quite enough trouble supporting this system in-house without supporting other people too. It will definitely be an 'if you're stuck, better start looking at the code' type system. Still if you're interested, that's something to look forward to; I will post in this blog when it's available.

 

Also, I'm not quite sure this blog post can withstand yet more lashings of good news, but we're trying to make our entire Moodle 2 code repository public, which will mean that even if we don't officially 'release' and support something that is used in-house, anyone can come and get almost anything we do. Alternatively it will be a great resource for those who just want to point and laugh at our code quality, or count the number of customisations in core code, etc...

However, it's not me doing the public repository, and I don't know how it is going, so this part is a bit less sure than the other parts. smile Just thought I'd mention it since it seemed to fit in with the topic.

Permalink Add your comment
Share post

Moodle Monday 4

Visible to anyone in the world

Another Moodle Monday development event happened this week here at the Open University, but I'm a bit late reporting it partly because we did some tidying up in other days too.

The big news is:

114/119 test cases complete: 3804 passes, 0 fails and 0 exceptions.

Imagine that line in green, because it is smile This is the complete unit tests running correctly (ignore the difference of 5 in the 'test cases complete' number). Yay.

I am going to try to get Moodle HQ to fix the script that automaticaly runs unit tests nightly, so they (and others) can try to avoid breakage in future.

In total, OU developers did the following:

10 bugfixes committed or with patch attached for review.

1 QA test completed (unfortunately it failed); this was the only open test case apart from a Mahara one which we are leaving for others as we won't be using Mahara.

2 bugs resolved as duplicates or can't reproduce.

And about 6 other bugs investigated in some way, possibly with comments added to bug to clarify.

I think Tim is this week's winner in terms of number of bugs dealt with in some way... but as he is quiz maintainer he has lots more bugs that are his responsibility than anyone else, which could be seen as cheating!

Not sure if we will be doing this again next week as we are now gearing up to start work on our own in-house Moodle 2 developments (ie converting our custom modules, etc). We'll see.

Permalink Add your comment
Share post

New blog post

Visible to anyone in the world
Edited by Sam Marshall, Tuesday, 2 Nov 2010, 17:18

For the third Moodle Monday event here at the Open University, we (the VLE development team) decided to try fixing the unit tests in Moodle 2.

(If anyone's reading this who doesn't know what a unit test is, basically it is an automatic software test that checks part of the software is working as expected. The main purpose is to make sure that later changes don't break something which previously used to work. Moodle 2 has quite a few unit tests, although they probably cover only a small portion of the code base.)

The unit tests were really comprehensively broken. They ran a bit and then crashed with a fatal error. So it's not the case that tests just failed: they couldn't even complete.

Personally, I think it would be unacceptable to release software if the unit tests don't pass, even though in this case most of the failures are due to people not properly maintaining the unit tests rather than actual problems with the software being tested - so (at least in my assumption), this should prevent the release of Moodle 2.

I investigated it using MDL-24905 as the tracker bug, and filed (some during the day, as we got past other issues) 21 subtasks for each problem that was discovered. Plus Tim filed another one.

Of these, we fixed 13; 4 were duplicates of those; another 2 went away for unknown reasons (i.e. probably duplicates too). One more was partially fixed. So that will only leave two and a bit that we didn't deal with. There's a possibility we might handle some of these too, during the week.

After our changes the unit tests run to completion, though obviously they do not all pass. Here are the current results on our developer server:

114/119 test cases complete: 3781 passes, 0 fails and 59 exceptions.

Time taken: 31 mins 2 secs.

I think all the remaining breakage is in portfolio unit tests, which are generally in a mess.

Hopefully all Moodle developers can ensure that unit tests don't break in future. It would be nice if moodle.org had a system which automatically runs full unit tests each night and emails key people if they fail...

Permalink 1 comment (latest comment by Tim Hunt, Tuesday, 2 Nov 2010, 17:47)
Share post

New blog post

Visible to anyone in the world
Update to my last post: thanks to Petr Skoda at Moodle HQ for reviewing and committing all the patches we contributed! Even my horribly large one.
Permalink Add your comment
Share post

New blog post

Visible to anyone in the world

We had the second Moodle Monday event at the OU. This time we were attempting to fix bugs in Moodle 2, instead of just doing QA testing. Or in other words...

lolcat

I'm not doing an individual score table this time (although depending on how you count it, Jenny is the winner smile but here's the outcome summary:

We looked at 27 bugs.

We potentially fixed (either attaching a patch to the bug, or actually committing) 12 of them. (Mostly these were just submitted as patches, so they might not necessarily all be accepted as correct fixes by the community.)

In 6 other cases we were able to determine that the bug isn't reproducible, is invalid, or is a duplicate.

For the other cases, either it was too difficult to fix or we just ran out of time. In some cases we were able to add comments to the bug describing our investigation, possibly helping whoever works on that bug next.

Hopefully this has been helpful to the Moodle project. I don't know yet if we're going to do Moodle Monday next week as well, let's see. smile

Permalink 2 comments (latest comment by Tom Murdock, Tuesday, 26 Oct 2010, 14:59)
Share post

Moodle 2 QA testing

Visible to anyone in the world

久しぶりですね… ahem, okay, that's silly (but I did think of it in dubious Japanese first and I can't remember how to - oh yes) - it's been a long time, hasn't it! Sorry for not updating this blog more frequently. Anyway, I just wanted to make a blog post at the end of our (Open University's) Moodle 2 QA testing day.

In an attempt to help (in a very small way) the Moodle core team get toward release of Moodle 2, or at least get better informed about its status, we decided to get nearly all the developers here to take part in the Moodle QA testing cycle 2 for one day. Mostly our developers have no experience of Moodle 2, and we also need them to learn about it, so taking part in the testing was a good opportunity to improve that knowledge. We got them to install Moodle 2 on their own virtual dev server here as well, so they know how to install it and such too.

I was hoping we would be able to go through all the remaining test cases but we didn't quite manage it. Still there are only 7 open test cases now which is a lot fewer than there were at the start of the day! We found quite a lot of bugs, and some things that weren't bugs smile and personally I also fixed a few bugs in my part of the code [completion]. I think Tim fixed some things too, even though he didn't do any test cases.

Here are the test stats for today (assuming my dubious Jira query worked):

  • Al did 2 test cases (both passed)
  • Anthony did 14! (3 failed)
  • Colin did 3 (1 failed)
  • Derek did 1 (failed)
  • James did 5 (2 failed)
  • Jason did 4 (1 failed)
  • Jes did 3 (all passed)
  • Mahmoud did 2 (both passed) (these show as me in the tracker because I clicked the 'pass' button)
  • I (sam) did 7 (2 failed)

So Anthony wins the test day by a factor of 2. smile And that's 41 test cases altogether. [By the way, it wasn't a fair competition - a few of these people weren't actually able to dedicate the whole day to it, and also, some test cases take more effort than others. Some people were struggling to get their system installed, etc.]

I don't think this will have helped a lot in terms of the release of Moodle 2 - unfortunately in most cases we aren't in a position to actually fix the bugs we might have found, yet at least - but it probably helped a bit and it's good that we did it!

Permalink Add your comment
Share post

Public comments now working

Visible to anyone in the world

Just an update on my previous post. Public comments in OU blog are now working (I hope - I'm about to test it), so you can leave comments on this post even if you don't have an OU login.

If you have an OU blog like this one and you want to use the feature, see the previous post for information about how to turn it on for your own blog posts. You have to select it for each post, it won't happen by accident.

 

Permalink 5 comments (latest comment by Sarah Ashley, Thursday, 7 Oct 2010, 15:30)
Share post

OU blog public comments

Visible to anyone in the world
Edited by Sam Marshall, Thursday, 19 Aug 2010, 16:27

It's all about OU blog recently! Well, it isn't, but that's what I'm going to post about.

First, just to mention, we started releasing a new 'stable version' yesterday. See the relevant Moodle forum if you're interested, or just go to the information/download page.

Second, I've made a new screencast about the public comments feature. This might be of interest to people at the OU as well as to Moodle community users; at the OU, we ought to be getting public comments next month.

Screencast about public blog comments (4.5MB) - click the Open link at top left of the Google Docs page

One thing to clarify since I'm not sure I made it totally clear in the video - the new feature is totally optional. Public comments will not be allowed on any blog post anyone makes anywhere on the system, unless that person specifically selects it.

 

The public comments feature was actually coded a little while back, but it's been tested just recently. Apart from fixing bugs (which is the story of my life right now, at least when I'm not in meetings) we've also been working on stuff for the December release which is going to have some nice features.

I think the best one is probably being able to subscribe to specific groups within ForumNG (which Ray is coding). This should be particularly useful for course* staff and some tutors, and for generally making the subscription logic more comprehensible. There's also some improvements to the search-all-forums feature that Mahmoud did.

* I'm not sure I'm allowed to still say 'course'! Maybe somebody will jump out and kill me.

Permalink
Share post

OU blog questions

Visible to anyone in the world
Edited by Sam Marshall, Friday, 13 Aug 2010, 14:28

I got asked some questions about oublog (I mean, from somebody who is considering using it on their Moodle system), and I thought the answers might be useful to other people, so I'm reposting here.

What is the Personal blogs link on the front page?

The link on the home page takes you to the personal blog for the current user. I don't think there is a way to remove it, so please just hide it if you don't want the personal blog facility (if you are only using course blogs).

How can I set a course blog up for use as a journal where only the student involved, and a teacher on the course, can see that student's personal blog?

a - Set 'Individual blogs' option on blog settings to 'Separate individual blogs' (means students can't see each others' blogs)

b - Make sure your teacher role(s) has the 'View individual blogs' capability (I think they should have this by default but just to check)

c - Decide whether or not to use group mode:

i. If you only have one teacher there is no point.

ii. If you have lots of different teachers, each of which has their own group of students, then use group mode. Use visible groups if the teachers are allowed to see each others' students, or separate groups (and of course make sure the teachers belong to the groups) if they are only allowed to see their own students.

Who can edit comments?

You can delete comments (your own; or whoever posted the blog post can delete all comments; so can admins obviously), but not edit them. We didn't provide an edit facility for comments because they're supposed to be kind of trivial. [Also because, since we have to make sure everything's auditable, making them editable adds a lot of complexity.]

Could you add a grading option when upgrading the module to Moodle 2?

I will see what we can do but can't promise anything unless we manage to get some internal users to request it.

If we added grading, how should it work? Would you want the teacher to grade the student's participation (i.e. a single grade) or to rate each post like on forum (i.e. ratings per post with some kind of aggregation feature, like taking the average, to come up with an overall grade)?

My guess is that the former is more useful - but it's also something you can achieve already by manually adding a grade for the activity in the gradebook and having teachers use the gradebook interface to set the grade, so we'd only be making the interface a bit nicer.

Permalink
Share post

ForumNG stable version

Visible to anyone in the world
Edited by Sam Marshall, Friday, 13 Aug 2010, 14:28

There's now a 'stable version' of ForumNG. This is intended for anyone else who wants to use it on a production Moodle 1.9 site. From September, this should be exactly the same as the live, fully-tested version used with students on the OU system.

Since I made a long forum post about it, I'll just suggest you should please read that for full information if you're interested! Or for the lazy, the download link can be found on the standard information/download page for ForumNG.

Also: I apologise to anyone whose comments I didn't reply to, or replied crazy late. I do now have a feed reader set up to monitor the Atom feed of blog comments, so I should be able to respond quickly to any comments you leave on this bug in future (assuming I have anything to add, that is). That is, if it (said feed reader) works. I am not at all sure it does...

Permalink 2 comments (latest comment by Sam Marshall, Wednesday, 11 Aug 2010, 17:18)
Share post

State of the browser

Visible to anyone in the world
Edited by Sam Marshall, Friday, 9 Jul 2010, 18:18

I just ran browser stats on the last week of web logs (kind of wanted to do trends, but haven't found any data earlier than that yet).

This might be of interest to Moodle people in general (as well as us) given that Moodle 2 ditches support for Internet Explorer 6.

Anyhow, here are the details for OU course web sites, considering only external use i.e. all our students and tutors. (For campus-based staff there is a specific computer policy which obviously biases the results.) These are calculated using a program I wrote, based on the number of requests to 'interesting' pages (excluding images, javascript, etc). Percentages exclude things like search engines, feed readers, anything else identified that isn't a browser, plus user agents my system doesn't recognise (approx 2% of total). For all browsers except IE, I picked a version that covers the vast majority of users and only included that version and above; older versions are in 'other'.

  • IE8: 39%
  • Firefox 3+: 22%
  • IE7: 19%
  • IE6 and below: 7%
  • Chrome 5+: 6%
  • Safari 4+: 5%
  • Mobile: 2%
  • Other: 1%

(Adds up to 101% due to rounding, sorry.)

Anyway, the good news is that on our system, IE6 is down below 7%. A year ago, it was double that. Eventually, that monster's really going to die!

Good luck anyone waiting for IE9 to become current so we can all use HTML5, though...

Permalink
Share post

New blog post

Visible to anyone in the world
Edited by Sam Marshall, Tuesday, 6 Jul 2010, 18:01

Two things this post, first a part for almost-normal people, then one just for geeks, er, I mean, Moodle developers.

The almost-normal part: if you're reading this, you're seeing the OU blog activity module. So you might be interested in a change to OU blog in our upcoming release. In September we will launch public comments on OU blog, so that people without an OU login can leave comments on your post. If you turn this on, you (the blog author) will have to approve public comments, so that there isn't any spam. Want to learn more in harder-to-understand detail? Read this exciting functionality document (PDF). It hasn't been tested yet; hopefully the system doesn't completely fall over and get turned off before we release it. smile

Now the geek bit. Basically I wanted to warn about a Moodle coding antipattern. Here it is:

// $thing is some object we previously got 
// from the mdl_thing table. It has the
// current values of a row from that table.
$thing->numericfield = $newvalue;
update_record('thing', $thing);

Don't do that!

For those who didn't immediately go 'yeah duh, of course not' - here's why. Let's say the $thing has some other field you didn't change. When you call update_record, Moodle doesn't know you didn't change it, so it'll update that as well. Which means if it contains any apostrophes, it will create a database error; and you've just made an opportunity for an SQL injection attack.

Even if $thing currently doesn't have other fields (or they aren't text fields, or you manually addslashes to them), another field might be added to that table later - et voila! A lovely security hole in code you didn't even change.

So, the only correct way to use update_record is this pattern:

$update = (object)array('id' => $thing->id);
$update->numericfield = $newvalue;
update_record('thing', $update);

Well, you could use different syntax (and should probably check the return value), but basically, what I'm getting at is that you should always call update_record with an entirely new object that only contains the ID and the fields you are actually changing (which should have slashes added if required).

As you might have guessed, I'm not writing about this just for fun smile This precise hole was recently discovered in part of our VLE code (actually a part written by outsourcers, but I'm not saying we wouldn't have done it in house). I waited to make this post about it until our live server has been patched, so this security hole isn't in our system any more...

This hole wasn't discovered by developers or testers here, but by a student who reported something broken (which turned out to be related to an apostrophe in another data item). Luckily I don't think they realised it was a security hole! Anyway, many thanks going out to Jeanette Stephenson');UPDATE mdl_grade SET totalscore=100 WHERE userid=157790021;--!

smile

(Yes that is an old joke. And no the person who found the bug wasn't really called Jeanette Stephenson, and didn't really have that user id, I just made both up. But, if you do recognise yourself - I think rather unlikely since I was cagey about where this problem actually was - thanks. Really. smile

In reality there are some extra layers which might protect against actual attacks of this nature, but even so, I think Moodle 2 (which doesn't require you to get slashes right) will be a big security improvement. Still good practice not to update_record with all the fields, though!

 

 

 

 

Permalink 2 comments (latest comment by Sam Marshall, Wednesday, 11 Aug 2010, 15:18)
Share post

Eclipse 3.6 for Moodle developers

Visible to anyone in the world

Eclipse 'Helios' (3.6), which was released this month, includes the new version of PDT (PHP development tools). I tried this out for Moodle development at work today. In my workspace I've got about six copies of Moodle (various OU and core versions) plus the plugins CVS, plus a few Java projects kicking around. So it's a fairly large PHP workspace.

Good news:

1) The new DLTK indexing means that referencing PHP functions (i.e. ctrl-click to jump to definition) is lightning-quick.

2) There's a beta version of Git support as part of Helios - I wouldn't recommend using this until it hits 1.0 personally, and um I don't think it can do merge/pull yet which is a bit of a snag... but moving toward mainstream support is still great news.

Bad news:

1) It uses more RAM than 3.5; you definitely need to increase heap in eclipse.ini from Eclipse default (384MB) to at least 1GB. Note - on 32-bit windows, the max you can set for this is slightly over a gig even if you have 3+GB RAM, so use 64-bit if possible.

Sometimes I saw it peg the RAM at around the 1GB, dragging performance to a crawl; pretty sure this is a memory leak.

2) When editing PHP files I get frequent errors, mostly stack overflow somewhere in DLTK analysis.

3) Because the git stuff is beta, although it shouldn't affect these projects (they don't use git) I thought maybe it might, so I uninstalled that. Didn't make any difference.

Basically I am sure Eclipse Helios is a great release in general and for Java development but, not entirely surprisingly, the PDT folks (Zend I guess) have dropped the ball again; this will probably be better once they get it fixed, but right now it isn't ready for use. I've gone back to the previous version - it might not be able to to reliably find definitions of things, but at least it can usually keep up with my typing and doesn't show an error dialog every ten minutes.

Eclipse Helios SR1 (aka 3.6.1) is due on September 24th. If you're considering upgrading, that would seem like a good date to try. smile

Permalink
Share post

New blog post

Visible to anyone in the world

Today's fun Internet Explorer feature (7 and 8 both): there's an accessibility option which lets you override website colours, so that for example, everything becomes green on black. Great, right? Except, it doesn't work properly in our forums. All the forum posts have a white background.

Turns out that in Internet Explorer, if you specify a background image for something while leaving the background colour transparent, it always draws it with a white background when in this accessibility mode.

To put that another way, the fix I made to get rid of this unwanted white background? I set the background colour to be white. Yes, really.

Permalink
Share post

New blog post

Visible to anyone in the world

Quick post to mention something I also posted in Moodle developer forums. I've been helping to investigate how much work it will be to move the OU from our current Moodle 1.9-based system to Moodle 2.

As part of that I converted the Structured Content module (oucontent), which is what displays textbook-like content within the OU VLE.

The non-techie version of this is 'it took about four or five days to convert this module'. If anyone's interested in the techie version, however, you can find it in this Word document which is my notes of the process.

Permalink
Share post

New blog post

Visible to anyone in the world
Edited by Sam Marshall, Friday, 21 May 2010, 22:58

Here's an update on what we've been coding recently in the area of the OU where I work! I've done a few things, some of which may be of interest to other Moodle users, others not so much.

  • I fixed final glitches etc. in the courses dashboard for tutors (mentioned before; it uses a webservice to access information from our Moodle system, and other systems, about which forums a tutor can access across all courses and whether they contain unread messages, then displays all these links in one place for convenient access).
  • I wrote a block for the glossary in Moodle 2. Teachers can add this block to a glossary then use it to search all the other glossaries they can access. The idea is, if they want a glossary entry about something for a course they're writing, they can search all other courses to see if somebody already wrote one. I'd love if people try it out (and I'd love even more if you can manage to convince the Moodle HQ folk that it should be included in core Moodle).
    There will be a version of this feature in OU Moodle 1.9, but I haven't written that version yet. This development was part of our current project to learn more about coding for Moodle 2.0, which several developers here are involved in as we work out how to plan for a possible upgrade of our systems. Coding in Moodle 2 is definitely nicer than in 1.9, so I hope we can go ahead with it...
  • I updated the Java audio recording applet I have, which is designed for students to record themselves. It's basically just to save them having to download a standalone application; everything it does is local. Anyway, it now looks nicer (we didn't have graphic design resource, but I tidied it up based on the upcoming new OU styles that were already designed) and a few usability glitches have been ironed out. The applet's open source; you can get the code here, or try it out on this temporary prototype site. Assuming we don't find any horrible problems with it, this will be used to replace the current Audio Recording Tool for Languages courses.
  • I added support for .mp4 in more places in OU Moodle (it was already supported in some places). We're transitioning from .flv. Now we're going to be fully ready for the .mp4 video format just in time for it to become obsolete. Awesome!
  • Thanks to the current round of testing from our Technical Testing team, I fixed lots and lots of bugs in OU Moodle (for our June releases) including some in our publicly-available modules (ForumNG, OU wiki) and just a couple in core Moodle 1.9 and 2.0 as well.

I've done some other things in the last couple of weeks too, but I think I'll stop there; this is supposed to just give you an idea, not to be an exhaustive list... sorry about that! However, I should also mention the others on my team:

  • Ray has nearly finished auto-archiving for ForumNG. The idea is you can set forums to automatically delete discussions when they're inactive for a number of months. If you prefer, you can also make it move the discussions to another forum (presumably a hidden 'archive forum' or something). This means that very busy, very long-running forums won't eat up too much database space and won't reduce in performance as the number of discussions climbs into many thousands.
  • Mahmoud has nearly finished advanced search for ForumNG. In addition to the existing free-text search (powered by the ousearch block), you can search by date or by user (full name, partial name, or username).

I hope we'll do the public 'stable version' ForumNG release in a couple of weeks (shortly after the OU's update on June 1st). The idea is that this will be maintained in line with the fully-tested OU updates, rather than getting every new (and possibly broken) feature as soon as we finish it. So it won't have the two features mentioned above, but it should be useful if you want to run ForumNG on a major site.

Finally, a side note: I just bought a tune called Theme From HTML (Steve Hill & Technikal; Dark by Design mix; on Masif). Playing it now. It's very ugly indeed. If you imagine the 4:4 kick/snare is your head and the bassline is a brick wall, it sounds just like coding HTML for Internet Explorer! Awesome.

Permalink
Share post

New blog post

Visible to anyone in the world
Edited by Sam Marshall, Tuesday, 4 May 2010, 11:33

Hi! Since I'm late with another blog entry, here's a very short one: I thought you might like to see the initial design document for the forum advanced search feature.

This is still sort of subject to consultation, but not very, because we're about to start development (by which I mean, Mahmoud is). Still, if you see anything horrible in there you want to comment about, please feel free.

Design document (Word format)

 

Permalink 3 comments (latest comment by Sam Marshall, Sunday, 23 May 2010, 01:07)
Share post

UK Moodle Moot 2010

Visible to anyone in the world
Edited by Sam Marshall, Friday, 23 Apr 2010, 22:39

Sorry, I have been totally neglecting this blog. It's so busy at work I don't have time to write entries...

Anyway, along with a bunch of other OU people, I went to the UK moodle moot last week. It was terrible! No, not the moot, but I had to get up at 07:00 one day and 06:30 the other day. It was like living in another time zone or something.

The moot was okay. I didn't like most of the keynotes. (And said so in a meeting afterwards... forgetting my boss had given one. Ooops.) But there were several interesting presentations, particularly one about how higher education institutions handle Moodle development and one about different models for funding open source development. I didn't give a presentation - I submitted a proposal but either it was rejected or they lost it. Oh well, it would only have been another boring demo of ForumNG anyhow!

More of a personal blog thing (but it's not like I'm writing this on work time)... I took my camera one day and took a few photos. I stuck the selected ones on Flickr which is where I put random collections of not very good photos... Anyway, if anyone's interested, there are 8 pictures starting here (click picture then use 'next' link at right to go through them):

Labs

The reflections in that are about the most people you'll see in any of them. I don't do pictures of people. smile But the moot was held in the University of London's Senate House building, which is a really impressive landmark building. Unfortunately, we tried, but we couldn't get to the top floor or anywhere near it... Ah well.

I'll try to do another post soon (...ish) about development work, which is of course ongoing!

Permalink
Share post

This blog might contain posts that are only visible to logged-in users, or where only logged-in users can comment. If you have an account on the system, please log in for full access.

Total visits to this blog: 226254