Free DNS provides easy shared DNS hosting & URL forwarding

Thursday, August 5, 2010

Elegant SEF columns layout

I found this somewhere (I can't remember where). I'm not using it now, but it's good to know.
The CSS is
/* @begin columns/sidebars (fixed L,R; liquid C) */
.columns-both, .columns-left {
  padding-left: 200px; /* LC width */
.columns-both, .columns-right {
  padding-right: 150px; /* RC fullwidth + CC padding */
.columns-container .column-main, .columns-container .column-left, .columns-container .column-right {
  position: relative;
  float: left;
.columns-container .column-main {
  width: 100%;
.columns-container .column-left {
  width: 190px;          /* LC width */
  left: -200px;          /* LC fullwidth + CC padding */
  margin-left: -100%;
.columns-container .column-right {
  width: 140px;          /* RC width */
  margin-right: -150px;  /* RC fullwidth + CC padding */
/*** IE6 Fix ***/
* html .columns-container .column-left {
  left: 150px;           /* RC fullwidth */
/* @end columns/sidebars (fixed L,R; liquid C) */
and the HTML (in a Drupal theme) is:









Tuesday, July 6, 2010

Working out OpenVPN with Network Manager in Lucid Lynx

For two years now, I've used OpenVPN to connect to a server where I upload some of the stuff I work on. Until now I always started OpenVPN from the terminal, because I didn't manage to get it working from the Network Manager in the last 4 Ubuntu versions.
Last weekend, I had some spare time and I installed Lucid Lynx on my laptop. I tried (again) to get OpenVPN working with Network Manager. As usually it failed, although I was pretty sure everything I did was correct.
So I decided to import my existing openvpn configuration file and export it back to see if there's something different. After doing this, I've noticed a few difference, but most of them were just due to syntax. However, two lines looked more interesting:

user openvpn
group openvpn
I've checked and saw that with these lines in the configuration file, the openvpn connection failed to start even from the terminal. Therefore, I did the following:
  1. create the openvpn group as a system group using

    groupadd -r openvpn
  2. assign the openvpn group to the directory (and files) that holds my openvpn key and certificates (mine and server's):

    chgrp -R openvpn openvpn_folder
  3. assign group read permissions to the openvpn settings directory and remove permissions for others:

    chmod g+r,o-rwx openvpn_folder
After these steps, the OpenVPN connection started from the Network Manager without problems (note that it's recommended route only traffic for that network through that connection).

Monday, May 24, 2010

Matlab 7 startup problem

Recently I had to install Matlab 7 on a Dell Inspiron 1501 laptop running Windows XP SP3. Everything went OK during installation. However, Matlab failed to start: it started, showed the splash screen, show the full application window, and as soon as the prompt was about to appear, all windows closes.
After some googleing I found out that this is caused by Matlab 7 using the wrong version of the Blas library ( Dell Inspiron 1501 has an AMD Athlon processor.
The solution was quite easy (considering how much time I lost to find it): add the environmental variable BLAS_VERSION with the value atlas_Athlon.dll.

Tuesday, May 4, 2010

Manually setup the Broadcom wireless card firmware on Dell Inspiron 1501

These steps summarize the information presented here:
  1. Download and extract the b43-fwcutter.
  2. Download and extract the Broadcom drivers.
  3. Compile the b43-fwcutter
  4. Run the b43-fwcutter to extract the firmware
Run the following commands as root and then restart the network service:
cd /tmp 
tar xjf b43-fwcutter-013.tar.bz2
tar xjf broadcom-wl-
cd b43-fwcutter-013
cd ..
b43-fwcutter-013/b43-fwcutter -w /lib/firmware broadcom-wl-

Monday, May 3, 2010

Customizing Moodle login instructions on a per language basis

Today I installed another language in one of my Moodle sites. On this occasion I noticed that the login instructions that I setup in the Moodle admin settings are being displayed in Romanian whatever language the user selects.
More precisely, in order to tell users to check their spam/bulk folder for the registration email that the site sends, I frequently customize the auth_instructions setting on the /admin/settings.php?section=manageauths page. In it, I copy the original message, which I get from the HTML source of the login page, and then I customize it to suit my needs.
When I setup a custom message, the original message is no longer displayed; which is very well. The problem is that when a user switches to another language (e.g. English), the customized message still appears (in Romanian). In order to fix this "problem", I removed the customized message from the site setting (ie. leaving it blank) and I moved it in the moodle.php language file for Romanian. This is quite easy to do: just go to /admin/lang.php?mode=compare&currentfile=moodle.php&currentstr=loginsteps#loginsteps and paste the HTML for your message (the one you had customized before in the site setting).
Note: If you did not apply the patch I describe in Click-to-translate feature for Moodle then loading the string editing page will take some time. Be patient!

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 or
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=""></script>
<script type="text/javascript">
  google.load("language", "1")
  google.load("jquery", "1.4.1")
<script type="text/javascript">
  $(document).ready(function() {
    $("form .translator .stren").click(function() {
      var src = $(this);
      var dst = $("[name=\'stringXXX" + + "\']")
      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")
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.

Friday, January 22, 2010

Hiding Tight VNC tray icon

As stated in the TightVNC FAQ, in order to hide the tray icon of the server, you need to add/set in the registry the DWORD DisableTrayIcon entry to 1 inside the HKLM\SOFTWARE\ORL\WinVNC3 container.
A .reg file that does this automatically is this:

Windows Registry Editor Version 5.00


Thursday, January 21, 2010

Setting up Synctex for Sumatra PDF and TexnicCenter

Everytime I need this information I have to search for it on forums, then filter out the broken solutions in order to find out the corect one. So, I'm posting it here to have it for future reference:
  1. Install & setup SumatraPDF and Texniccenter (including the output profiles of TexnicCenter).
  2. Open the Output profiles window (Alt+F7).
  3. Select the Latex => PDF output profile.
  4. In the Latex section, add -synctex=-1 at the end of Command line arguments to pass to the compiler textbox (leave a space between this and the previous arguments).
  5. In the Viewer section, set the Path of executable textbox to C:\Program Files\SumatraPDF\SumatraPDF.exe -inverse-search "\"c:\Program Files\TeXnicCenter\TEXCNTR.EXE\" /ddecmd \"[goto('%f','%l')]\"". This will start SumatraPDF as the PDF viewer and will provide it with the program to run whenever a back search is performed.
  6. Still in the Viewer section, set for View project's output and Forward search the following options: Enable DDE Command and set Command to [ForwardSearch("%bm.pdf","%Wc",%l,0)], Server to SUMATRA, and Topic to Control. This will allow forward search to work.
Update: Step 5 refers to an older version of TeXnicCenter installed on Windows XP. Read the comments to find out the updated folder (for Windows 7) and file name (latest TexnicCenter).