Free DNS provides easy shared DNS hosting & URL forwarding

Thursday, April 29, 2010

Sharing Powerpoint course content

In the last couple of months I looked into solutions for sharing my course presentations (PowerPoint files) with others. My main goal would be to provide an experience as close as possible to the actual in-class courses for people that missed courses. This means that I would like the course content to be available to others as a full-length presentation with an audio narration.
The easiest way to do it with PowerPoint is to record the audio using the Record Narration feature. The problem with sharing PowerPoint files with narration are multiple. I have some solutions to these problems, but they lead into other problems.
The first major problem comes from PowerPoint itself: it can record narrations only in PCM format. That means that an audio narration (recorded with mono, 16 bit, 22KHz quality) takes about 150MB/hour (about 352Kbps). As a solution, I can link the audio narration file (instead of embedding it into PowerPoint) and compressed later as an MP3. Compressing it with FFmpeg is a painless process (just run one command) and takes only a few minutes. Compressed as an MP3 at 8Kbps, I will get around 3,5MB/hour for the narration which is quite ok. The problem that shows up in this case is that the file are linked (so I have to handle all of them with the main ppt file), and even worse, the PowerPoint stores the absolute path to the file (so moving the ppt file to another is very difficult if you want to keep the narration working).
The second major problem is that students must have PowerPoint (full version or viewer-only) installed and they need to download the file in order to view it. To make things more complicated, if the narration is linked it will not work unless the files are save in the same folder (i.e. same disk, path, folder name) as it was when narration was recorded. A MAJOR blocker. Combined, these two problems, put the ppt file sharing solution out of the game. I'll prepare the course in PowerPoint, but I need another method to share it using Moodle.
Due to certain restrictions (I won't go into details), I can not use presentations or videos sharing services with public access (like slideshare.com or youtube.com).
The solution I'm looking into for my problem is share the presentations as Flash content, so I'm looking into different PowerPoint to Flash converting solutions. To sum up my requirements, I want the solution to have the following features:
  • small file output (I guess that means Flash with MP3 sound files)
  • easy to publish in Moodle (i.e. a single swf file to upload instead of a bunch of different files)
  • easy to create (i.e. click a few programs to transform from PowerPoint to Flash; as few as possible command line typing)
  • free/unexpensive as in open source, freeware or adware (but with a decent sized banner and without affecting usability)
  • fast conversion from ppt to swf (or batch conversion)
  • (optional) as many features as possible (some feature examples are slide notes, slide thumbnails, different controls, search in slides, narrator information)
Obviously, I will not get all there requirements fulfilled, but I'll try to get as close as possible.

Sunday, March 21, 2010

Click-to-translate feature for Moodle

Lately I tried to improve the quality of my university's Moodle platform. Among other things (i.e. upgrades, new backup setups, new theme, etc) I also wanted to improve the quality of the Romanian translations. The Romanian language pack of Moodle 1.9 its quite good from the student/user point of view, but it still has some problems:
  • the string for administrator/teacher views, reports, forms are not fully translated; I understand why: there little to gain in usability from translating them as many administrators use the English language (including me)
  • new strings are not translated yet (maybe they are in CVS, but I did not look there)
  • bugs
When I tried to fix or add some translations, I faced a problem that I believe is the source of many translation bugs: the lack of context information. For example, how do you translate "fullname". If it refers to a course, then it could be just that "Full name"; but if it refers to a user name, then it could also be "First and last name". Unfortunately, this is a bug in the Romanian language pack: when you create a course (in the Romanian interface) the full name will display "First and last name" (in Romanian, of course). Obviously, this is confusing for new users.
Even if you can guess the correct ad-litteram translation of a string, you could always benefit from knowing in what context it is used. This way, you can provide a better semantic translation.
In order to have this context information available, I patched Moodle to save the get_string results and send them to the browser (for user which have language editing capabilities). Then, using a simple JQuery/JavaScript script (sorry again for JQuery, I just found it much more pleasant than YUI) when the user performs a proper action (right-click while holding down Control), I display a list of the strings matching the element under the current mouse position. In this list, the user can click the string she/he wants to change/translate. A frame specific to that string is displayed where the user can edit the translation source and save it. The changes required patching lib/moodlelib.php (where get_string is) and lib/weblib.php (where the page footer is generated).
Initially, I wanted to do this a fully AJAX process (similar to Google's "suggest a better translation"), but I had to replicate a lot of the admin/lang.php content. This is not good, especially for future updates. Thus, I decided to open a frame with the translation editing form. The problem with this approach is that some translation files are just big and take very long to show up (frequently freezing Firefox for 5-10 seconds). Therefore, I patched admin/lang.php so that I can provide a particular string and it will display/edit only that string (loading/saving is very fast this way). Of course, the automatic translation feature using Google Language API is still in place and working fine.
Except for the new JavaScript for the editing console (which is about 80 lines of code, including many comments), the other changes are minor, allowing this feature to work with different Moodle versions.
Let's take now an example. Consider my local Moodle sandbox. As you can notice, the "Please register you site..." is not translated.
I'm an administrator, so I have language editing capabilities. When I right-click on that text (or an area that includes it, like a div, table cell, etc), I get a list of translatable string inside the HTML element I clicked. I go and click on the proper text:
Next, a frame loads displaying the editing form only for the pleaseregister string from the admin.php language file (which is currently untranslated in Romanian):
Taking advantage of the Google translation feature, I click on the English version of the text (on the left) in order to get it translated automatically into Romanian.
After making sure the translation is ok (and it was in this case), I can save it. Sometimes the Google translation needs a bit of work, but it's still a much better starting point than starting from zero.
If I would not patched admin/lang.php in order to display only the string I want to edit, then editing admin.php would mean to load a long form (which completely hangs Firefox for 10 seconds) and then scroll down to about 80% of the page or  search for the string I wanted.

Sunday, February 14, 2010

Automatic translation for Moodle UI strings with Google Translation API

Today I installed a fresh copy of Moodle 1.9. I'm reviewing it in order to upgrade our university's site (from Moodle 1.8) and another site (using Moodle 1.6). As always, I started going through all it's settings, looking for new features or things that changed. When I reached the Language section, I installed the Romanian language, just to make sure installation is working. However, I noticed that the Romanian language pack is missing 26.7% of strings (2672 to be more precise). Some translated string are also a bit weird.
I remembered that about two years ago, I patched Drupal in order to get automatic translation using Google Translate. At that time, Google translate did not provide any web services API, nor AJAX, and the translation of text containing HTML tags was very poor. The patch was doing simple HTTP requests, parsing of the HTTP response, some simple cleanup and in the end, it stored the translation into the Drupal locale messages.
Google Translate nowadays has much more languages than it used to backthen is AJAX based and offers web services, too. I was wondering how does it handle HTML tags and how hard would be to get it into the Moodle language editor. After 2 hours of coding and reading its API, I came up with this (sorry for JQuery, I know Moodle likes YUI):
$translang = preg_replace('/_.*/', '', $currentlang);
echo '
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
  google.load("language", "1")
  google.load("jquery", "1.4.1")
</script>
<script type="text/javascript">
  $(document).ready(function() {
    $("form .translator .stren").click(function() {
      var src = $(this);
      var dst = $("[name=\'stringXXX" + this.id + "\']")
      var tokens = [];
      var text = src.text().replace(/\$a(->\w*)?/g, function(match) {
        return "TK" + (tokens.push(match)-1);
      });
      google.language.translate(text, "en", "' . $translang .'", function(result) {
        if (!result.error) {
          dst.text(result.translation.replace(/TK\d+/g, function(match) {
            return tokens[match.substring(2)];
          })).css("background-color", "yellow")
        }
      })
    })
  });
</script>';
This will allow a translator to click on any string in the Language editing section and get a Google translation for that string. The translation is saved in the corresponding textarea (which is marked with yellow). You can then check, edit, undo, or save these changes.

Thursday, January 28, 2010

Thunderbird beats Evolution

I recently decided to get my email stored locally in case my internet connection fails and I need them. I used to have them save in Outlook Express (for backup purposes), but I dropped this habbit when I start forwarding everything to Gmail.
I decided to give Evolution a shot and see how it's doing these days. This is mainly because of it's "great integration with Gnome". The overall interface it's not very impressive, and looks like it's an old application. I could have gone along with it, no problem, but something else was a show stopper: I use POP3 and all email clients I used allowed me to "delete email on server when deleted from Inbox". Guess what? Evolution does not have this (again, for POP). It's either "delete emails when retrieving" or "delete after X days". It seems that this feature was requested back in Evolution 1.0 but it was never implemented. I search a lot on forums for an explanation and I found two Evolution developers (back in a 2003 thread):
  1. this feature is a POP hack and will not be implemented
  2. Evolution is targeted more to enterprise users which use IMAP
My reaction was:
  1. is it "hack" to use two POP commands to get a feature implemented? I guess no, since all other clients are doing it. Or maybe, they are all hackers, and Evolution developers are the real-deal.
  2. then why "force" it into my new Ubuntu desktop install (like that other half application that tries to replace Pidgin)?
One way or the other, Evolution is purged and Thunderbird is installed on my system (btw, same goes with empathy and pidgin). I care less for "Gnome integration" than I care about functionality.