I've been using my unittest Moodle question type pretty much since the beginning of this school year. But a couple of things have been bothering me as I watch students work on code problems.
The first is that their only feedback for a failed JUnit test was the stacktrace that JUnit kicks out. For students new to programming, that is both intimidating and almost totally worthless. So, I went in and parsed out the failure messages and now they're displayed in a table with just the message about what was expected and what was returned.
Next, the plugin that I used as a starting point had a field on the question editing page where you entered the name of the JUnit test class. But you didn't have to do that for the student class file because the student's file would be parsed to pull out the class name. Went in and did the same thing for the JUnit test classname and removed the field.
And last was something really trivial, but one that bothered me more than it should. When the ace editor loaded it was scaled to the height and width of the textarea it was replacing. Worked great, until the student resized their browser. So a bit of CSS and the editor window is always 100% of its container.
Pushed an update to GitHub a few minutes ago and uploaded it to my Moodle server. Haven't had a chance to test it live with students yet since it's Saturday, but we'll give it a kicking on Monday and see how it goes.
Over the summer I took a Moodle unit testing plugin and updated it so that it'll use JUnit 4 and improved on the interface a bit. Since the school year started I've been using it with my students, and up until a couple of days ago it worked without a hitch.
What caught us is that we were giving a test to about 55 students at the same time, and they were all submitting Java code to my little $10 a month DigitalOcean VPS droplet. About 30 minutes in everything slowed down to a crawl. Server load was about 60x over max and there were around 250 instances of javac running.
Fortunately, it was a pretty easy fix. I had my students sit back, take a deep breath, and not submit anything for a couple of minutes. That took care of 27 of the 55 testers, and it was enough to get the server load down below 10. Still high, but you couldn't tell by the speed of the server. It was reacting just like it should.
Most impressive is that the server never actually crashed. The droplet only has 1gb RAM along with a 2gb swap, but while I was watching it never had to touch the swap.
Guess the lesson is that we probably shouldn't test 55 students at the same time if they're all going to be writing and submitting code.
Learned an important lesson today.
I spent a good chunk of yesterday working on a new project. It's a Moodle plugin that, when finished, will let you put code online for your students to work on along with tests so they know when they're done and you can automatically get back a grade.
But while deactivating the plugin in Moodle so that I could reactivate and trigger database table creation I accidentally clicked the button to delete the folder from the computer and everything I did yesterday disappeared.
First step when I started over this morning was to commit it to GitHub and then committed fairly regularly today so that I didn't lose to much if I do something stupid again.
Logged in this morning to a small VPS that I have hosted at DigitalOcean and saw a notice that Ubuntu 14.04 was available, and that I should upgrade from 12.04 that was currently on the box. Did a bit of research, and figured I'd go ahead and do the upgrade. Nothing really critical was on the server, so it didn't seem all that important, but I didn't like the idea of having an outdated version of Ubuntu on my VPS.
So, I did exactly what was suggested...
Appeared to be working okay, until about half way through and errors started popping up that files couldn't be found - 404 status codes.
The VPS restarted and that's when the real fun began. Got an error that the file system was read only and to go to a recovery console, which I did. An fsck determined that the file system was okay.
What I decided to do, after much Googling, was to try the upgrade again from the recovery console.But I had to overcome a few snags.
First step was to remount / in read / write mode. In recovery it was read only.
mount -o remount,rw /dev/vda /
/dev/vda might also be /dev/vda1 depending on how you setup the droplet originally. This gave me access to where I could write to files.
Next I needed networking. Originally I went and manually setup eth0 to the settings for my droplet which are, very conveniently, shown under the VNC window in the DigitalOcean control panel. Turns out, there was an easier way.
service networking restart
This loaded eth0, which I had already done, but also lo and eth1. Didn't need those two, but it was also a shorter command.
This didn't bring up DNS though. I could ping remote IP addresses, but not look up domain names. The DNS servers were correctly set, just not working.
So what I wound up doing was to set the two domain names I needed, mirrors.digitalocean.com and nyc2.mirrors.digitalocean.com, in the /etc/hosts file so they didn't need DNS with the following two lines.
18.104.22.168 mirrors.digitalocean.com 22.214.171.124 nyc2.mirrors.digitalocean.com
You'll probably want to check that those two IPs are still correct, and also change from nyc2 to whatever data center you're in.
Then, ran the upgrade command again and after about 30 minutes of watching the console scroll by version 14.04 was up and ready.
Only snag I've found so far is that Apache is giving me a forbidden error which is probably just some permissions deal coming from a newer version of Apache in 14.04 compared to 12.04. But, SSH is working again so I can now go through PuTTY instead of the VNC console and get everything back where it needs to be.
I've been playing around with Moodle plugins for the past few days and have kicked out a couple that are working, at least well enough for me to use.
One of them solved a pretty trivial task for me, but one that should save some time down the road. And that's formatting.
Teaching Computer Science I type a lot of code into question banks. Sure, the WYSIWYG editor in Moodle makes it pretty easy to change fonts. But I wanted something more like BBCode that's popular on web forums or shortcodes in WordPress. Something that lets me keep my hands on the keyboard and not having to mouse around to change fonts.
What I came up with is a filter plugin that I'm calling Easy Filter. From the admin settings pages you can define a tag to wrap around question text and then what the filter puts in place before and after that text as the page is displayed. For example, I have a 'java' tag setup that I'm using to wrap around any Java code in questions or pages. When I wrap Java code like this - [pre]System.out.println("Hello");[/pre] it wraps it in a <pre> tag to format in a monospaced font.
And, here's a screenshot...
The screenshot has 3 different tags defined, along with their before and after HTML. The bottom form is for adding more tags. To remove a tag you just blank it out on the list and hit the Update button.
The plugin is hosted at GitHub. Once you download the zip, you'll need to upload everything to the /filter/easyfilter/ folder under your Moodle root.
Bob was absent yesterday and has to make up the test. Jane didn't do so well and you want to let her have a second attempt. You're only giving students 10 minutes for the quiz today, but Chris just needs a few extra minutes.
What you need is a user override. Not sure when this was added to Moodle, but I found it while setting up my Moodle 2.7 server for next year; and it looks like something that will get a lot of use.
The basics are that you can give a user, or a group, slightly different restrictions on a Moodle quiz. Read more »
Not sure this is the best way to do this, but it works.
Working on a project and I'm writing a lot of code to do RegEx searches. Each match is 3 or 4 lines to do the match, check if there was a match, and then do something with the match. Since I was tired of typing the same code over and over, kicked out a little function to do it for me.
It also was an excuse to try out Gists and embedding them back on my site instead of putting the code directly in a post.
Edit on 8/7/2014
Well, this script is pretty much worthless now. Not sure when it happened, but Moodle now lets you upload the entire Blackboard zip file, images included, and everything gets imported. No more messing around with the res00000 files.
Going to leave the original post though. Might be handy for someone stuck using an older version of Moodle.
I'm a big fan of Moodle, but really don't like the way you have to add questions to banks. There's just too much on that page.
So I normally build question banks in Examview and then import to Moodle. Only catch is that importing that way doesn't allow for images.
So what I've done is create a simple Python script that takes the exported file and replaces the image links with a data scheme URI. Wasn't expecting it to work, but it works without a hitch. Read more »
Moment of stupidity today...
For probably the past year or so the visual editor hasn't been working for me in WordPress. Just always plain text. No visual tab at all. And I checked. The disable WYSIWYG editor checkbox was clear for my account.
Today I tried checking the checkbox, saving settings, and then clearing the checkbox and saving again. Went back and the WYSIWYG editor is back.
Guess I should have tried turning it off and back on again a long time ago.