Free DNS provides easy shared DNS hosting & URL forwarding

Thursday, December 24, 2009

The power behind GMail

Have you ever wondered how does GMail manage to give us all these nice features? How about what makes it so fast? If you did, you'll find the answer in the following movie. It's a bit technical, but you should understand it even with basic computer skills.

Let me know if you did find the answer!

Thursday, December 17, 2009

Wikipedia Forever

Wikipedia Affiliate Button
Today I was reading a few lines about Python and I stumbled upon this text:
the language is named after the BBC show "Monty Python's Flying Circus" and has nothing to do with nasty reptiles
I red that before a couple of times, but I never understood the relation between the programming language and the show. I googled up the shows name and (obviously) the first two results were Wikipedia pages. I clicked one of them and I got into Wikipedia. There I saw it: a message from Jimmy Wales. I realized that I wanted to make a donation for Wikipedia a few days ago, but I forgot. Afraid this might happen again, I put everything on hold and made the donation. If you use Wikipedia, consider making donation, too. The ammount is not important. There are lots of cool things to find in there (e.g. did you know that spam is also related to Monty Python's Flying Circus?).

Monday, December 7, 2009

National Geographic Wallpapers

National Geographic is offering wallpaper-sized variants of many of their beautiful photo collections. One of the collections that I follow in iGoogle is the Photo of the day. I like it mostly because it doesn't have a particular theme and includes photos from many places around the world.
From time to time, I like some picture so much that I "go through all the trouble" (a 5-clicks process) and save it as my wallpaper.
I wanted something automated to do this (i.e. save the POD as my wallpaper). I know there is Opal (both for Windows & Linux), but I don't want to use it for two reasons:
  1. when I last tested it, it failed to work (i.e. it did not set any wallpaper)
  2. I fail to see the purpose of running a program full time (even if it's using almost none CPU & memory) just to update a file one time a day
Thus, I decided to practice my bash scripting & linux command skills to write a script that will save the National Geographic POG and set it as wallpaper in Gnome. This is what I came up with (it is not and will not be optimized nor use error control):
#!/bin/bash

# the URL of the photo feed
RSS_FEED=http://www.nationalgeographic.com/rss/photography/photo-of-the-day

# the prefix of the photos URL (used to find the newest photo)
IMAGE_URL_PREFIX=http://photography.nationalgeographic.com/staticfiles/

# format of the photo
# in = 270x179, sw = 800x600, lw = 1024x768, xl=1280x1024
IMAGE_FORMAT=sw

# directory where to save the images
IMAGE_DIRECTORY=~/Pictures

# retrieve the RSS feed, grep for the latest image and
# replace it's name to match the required format
IMAGE_URL=`wget -qO /dev/stdout $RSS_FEED | egrep -m 1 -o "$IMAGE_URL_PREFIX[^\"]*" | sed -e s/-in\.jpg\$/-$IMAGE_FORMAT\.jpg/`

# retrive the image
wget -q -nc -P $IMAGE_DIRECTORY $IMAGE_URL

# get the image file name
IMAGE_FILE=`basename $IMAGE_URL`

# set the image as background
gconftool -s -t string /desktop/gnome/background/picture_filename $IMAGE_DIRECTORY/$IMAGE_FILE
gconftool -s -t string /desktop/gnome/background/picture_options scaled

Friday, November 20, 2009

Catfight


These are some old photos of my cats. The gray tabby is no longer with us. It simply disappeared one day. Hopefully, he's doing alright.

Friday, November 13, 2009

My (real) great deal on shoplet.com

I buy my Office Supplies at Shoplet.com This is a follow up on my shopping experience with shoplet.com. After my previous attempt to make the deal of a life-time and buy a ultra-modern laptop for only $0.95, I exchanged emails with Keith B. from Shoplet. After our "rocky" start (as he kindly tagged my "I demand an explanation" emails), he was very eager to help me solve my problem. He even went the extra mile and got me an extra $50 coupon (I already got a 10% discount coupon for my initial order).
Thus, I decided to give it another try. I went on the site and browsed around for some time until I found some things I like. I mainly looked at computer products and office supplies. I selected a few, including a Wii wheel remote, some USB hubs, microSD cards and others, but for now I only bought these:
  • a 2GB DDR2 SDRAM Memory Module - I need this because my last eBay bid did not worked out;
  • Newton Peripherals MoGo Mouse BT - Optical - this seems very interesting; I'm realy currious to see how it looks and works and just in case it's really really cool, I bought a few.
  • a camera pocket tripod - I wanted to get one for some time.
Overall, I was very happy with the content of my cart so I went to checkout. Since I'm familiar to PayPal, I decided to pay using that. Including UPS ground shipping and NY taxes, I had to pay only $13 (thanks to the coupon I got from Keith) and I got some very cool items. Anyway, that's not what I was after; Elena argued that I spent too much time browsing the site, but for me it was very fun. More fun than going to a real computer shop.

Wednesday, November 11, 2009

Karmic Koala doesn't like my display

Yesterday I installed Karmic Koala on my office PC. I had a Jaunty installation before that I did not used/customize much so I figured there's not much for me to gain in an upgrade. Thus, I did a fresh install from a 4GB USB stick. The installation went very well, taking less than 15 minutes boot-to-reboot. Another thing I liked is that there was no need to unplug & replug the USB stick during the installation (this was required by Jaunty and earlier versions).
The first things I noticed is that overall the system is much nicer than Jaunty:
  • the icon theme has greater details and nicer design,
  • it has up-to-date packages not available in Jaunty (like Octave 3.2),
  • start up time has lowered (not at much as others say, but then again, my PC is not cutting edge),
  • the new IM client is empathy (I'm using it right now, but I'm not sure I like it better than Pidgin).
This means that upgrading my home PC will be a step forward (that I can't do right now because of other work).
One thing that I then noticed as annoying was the slow resolution (800x600) and the incapacity to make it larger. I then realized this happens in Xubuntu 9.10, too. Therefore it's not related to Xubuntu (as I thought before).
I spend some time on forums, trying to find a direct solution for this problem only to find out that something changed in X and something else changed in the kernel, and one is using the other, and there's another link point to another 5 pages discussion and then another link, and so on.
One thing that I got by browsing though all these forum posts was this: X in Ubuntu Karmic Koala comes with no xorg.conf because it's suppose to autodetect the video card and display settings. It does not happen in my case. I blamed the video card.
Next thing I found useful is that I can make X write a configuration for me using the command:
X -configure
This is new stuff for me, because I used x86cfg (or something similar) to do this way back (like 2-3 years ago). Anyway, this creates a file called xorg.cfg.new in my home directory which I then moved into /etc/X11, renamed it to xorg.cfg, and restarted the Gnome Display Manager (gdm) service.

This did not solve the problem either. So I went and looked into /var/log/Xorg.0.log to see if I get some pointers on whats happening. I saw a lot of messages like this:
(II) intel(0): EDID for output VGA1
(II) intel(0): Not using default mode "640x350" (vrefresh out of range)
(II) intel(0): Not using default mode "640x400" (vrefresh out of range)
(II) intel(0): Not using default mode "720x400" (vrefresh out of range)
... and so on

Then I realized that it's not the video card, but the display that is not being detected correctly. So I added the following lines to my /etc/X11/xorg.conf (I found something similar on forums) inside the "Monitor" section:
HorizSync 28-64
VertRefresh 43-75

This did the trick and after restarting gdm, I got a wonderful big resolution (which I trimmed down to 1024x768).

Tuesday, November 10, 2009

My (almost) great deal on shoplet.com


On Friday I was googling for a present for my niece: I was looking for a laptop with small display (less than 13", because she's still small). Not necessarily something fancy, but something that would not create problems when used by a child (enough RAM and decent processing power).
While looking around I found a deal that seemed too good to be true (and so it was) on shoplet.com: a laptop Asus U20A-A1 for only $0.95. Including taxes and all, that would have been about $9. I refreshed the page a few times just to make sure I'm seeing right, then I went ahead and paid for it. The process went through without any problems, as the site created my account with my details using data from Paypal. I was hoping this is a special offer and not a mistake.
On Monday evening I got an email informing me that the item is "discontinued", my order was canceled, and I got a refund. I went on the site again and checked. It still said the item is "in stock". According to it, I could have ordered another few laptops, too :) However, the marketing person said the IT department did not update the site.
I was quite surprised to find out that such a big website does not have an automated inventory system in place. To be honest, I didn't believe it at first, but someone else from the site confirmed it to me.
Anyway, apart from my own unhappy experience, shoplet.com seems to be a nice place for IT shopping or at least browsing for information on products (since they have very detailed information on them). You can also receive a 10% coupon if you put one of their badges of your blog or site.
The thing that I liked most about their site is their green program where they offer recycled products and they keep track of the outcome of this program.

Surprice "gift" inside the Octave package

Today I noticed that my Octave packages got upgraded to Octave 3.2 (from 3.1). I don't know when that happened, but I immediately typed news to see what's new. I was expecting a few bug fixes, one or two new features and some code rewrites. I was wonderfully surprised by the large number of major changes that come with 3.2.
The full list is available on http://www.gnu.org/software/octave/NEWS-3.2.html, but just to mention a few:
  • Many optimizations: sorting and searching, matrix transposition, array indexing, logical operators, etc.
  • Block comments: this will allow me to easily comment large chunks of code
  • Object Oriented Programming: I'm not sure how soon I'll get to use that, but it's nice to know it is there.

Sunday, November 8, 2009

I'm hooked to Linux

These days I "celebrate" 1 year since I switched to Linux as my main operating system. Before I continue, I have to say that I still use Windows XP at my office (older PC) and occasionaly at home (mostly for existing Texnic Center projects and Microsoft Excel).

I started using Ubuntu on a daily basis about 1 year ago (by upgrading from the until-then unfrequently used 8.04 to 8.10). I used Linux before but just to see what's new in it:

  • starting in 2002 with Mandrake 8 (I started by formatting by mistake the entire disk instead of the future home partition);
  • moving then to Mandriva Free 2004 (former Mandrake);
  • tried Ubuntu 6 (that I got from Tudor);
  • returned to Mandriva Free (2006, I believe);
  • played with Fedora (which I didn't like because I wasn't fond of Gnome);
  • tested Kubuntu 7.10 (because of KDE);
  • moved to Kubuntu 8.04 (which I didn't like because of KDE 4);
  • installed Ubuntu 8.04 (but didn't used it much);
  • upgraded to Ubuntu 8.10 (and switched to Linux).

I liked Ubuntu because I found it very easy to install applications on it. Since I do a lot of development, I also use the terminal quite frequently and the command line completion features also helped me a lot in my first days (and they still do). Overall, I'm very happy with it, although it requires more RAM than Windows XP to run smoothly (especially when you start Office applications). Currently, my 1GB RAM (don't laugh!) is doing it's job, but I ordered more RAM on eBay (that's also a premier for me). I had my ups-and-downs with Ubuntu (like getting Skype to work), but it's been fun to learn. Some things (like getting the webcam to work), I didn't figure out until now and I'm still wasting time trying to fix it.

Since I switched to Ubuntu, I kept on looking to other distributions, too, but I always returned to Ubuntu:

  • Xubuntu - I like it (especially because it's simple UI), but i find it limited (e.g. mousepad vs. gedit) and buggy (on my Dell Inspiron laptop it doesn't allow dual-displays, on my Maguay office PC is allows 800x600 pixels, etc).
  • ArchLinux - didn't finish installing it: I'm a techie user and I used more or less many OSs (including CP/M, MSDOS 5, Windows 3.1, Windows 95, QNX, etc), but I never liked doing more task that are required (these days, this means typing long cryptic commands that are hard to figure out or reproduce unless you use them daily or you have a wiki page in front of you)
  • LinuxMint - I liked it a lot especially because the launch menu (Ubuntu System Panel), but except for that, it felt too close to Ubuntu to make the switch. Instead I installed its launch menu in Ubuntu.
  • openSuse - nice but less friendly than Ubuntu. It also has a nice launch menu which looked cool the first time I tested it, but last week I checked it again and it felt just annoying (just like Vista and KDE4's menu). Too many clicks to open an application.
  • OpenSolaris - No, no, no. I don't have that much RAM to throw at the OS. I need RAM for my applications. Unfortunatelly, it's like comparing Visual Studio with Eclipse. One is fast and memory efficient, the other is not (but I use Eclipse).

Saturday, August 22, 2009

Gardening





I had some spare time two days ago, so I went in the garden to do some cleaning. We ignored it a lot this summer due to our GSoC projects, PhD and papers research, and other activities. Of course, during this outdoors activity, I had the invaluable support of Elena (taking pictures and making fun of me), our cat - Yahoo (ignoring me completely) and the four kittens that showed up in our garden since spring (meowing at me and begging for food).

Sunday, August 16, 2009

GSoC 2009 sum-up

After I finished my previous post, I recalled a few moments when things didn't work the way I wanted (or didn't work at all). One thing led to another and I start thinking what were the main challenges I faced during this project. If I was to make such a list, it would be probably look like this:

  • missing documentation for the recording widgets:
    • for riffly, I had some help from their support team regarding their API and metadata services (thanks Steven) and some I had to find out by myself through try-and-error (and Firebug and Wireshark and XDegug and so on);
    • for nanogong, I had to go through their applet java code to find out how it works. Maybe I'm missing the big picture (since nanogong is only a piece of a larger project), but it seems to me that this code was unnecesary complicated in some places, and missing a lot in others (some said: "so what, it's code that works").
  • working on still in development code (both repository and Moodle 2.0):
    • there have been quite a few occasions in which I updated my CVS only to find out it contains broken code which was commited in by mistake;
    • the repository code is still going through some changes and the coding style felt in some parts a bit rough; this feeling was in part due to the particular tasks and contraints that I was facing with my plugins; however, the documentation pages and the existing plugins proved a valueable source of information in many case (thanks dongsheng).
    • less important, but still a tiny problem was that the repository code is missing comments in some places (especially in Javascript, filepicker and webservice code), has out of date comments in other places, and has in a few places comments like this:
      Don't modify this file unless you know how it works

Anyway, even with all these issues, finishing this project was never at risk, because Jerome was very helpfull and quick in response, providing me with usefull tips, coding help and great feedback, and occasionally collecting feedback and advices on my befalf from other Moodle developers. He's also very pacient and he gave me a lot of freedom to work on the project on my own pace.

Dongsheng (who designed and developed the repository API) was also very supportive, helping me when I got stuck with the repository API and quickly fixing repository bugs so that I can move on.

Last, but not least, Helen was very helpful with the administrative part, keeping me (and the others) informed and focused on my schedule, stepping in on a few occations to make sure I have a great (and complete) GSoC experience.

Saturday, August 15, 2009

Completed audio repository plugins

During Google Summer of Code 2009 project I worked on implementing repository plugins that would allow users to record audio files directly into Moodle. Initially, the plan was to provide a single recording only, but things went a bit further, and I also implemented a collection management feature.

Both plugins have integrated help pages for all their features, but additional help (mostly for developers) is in the Record audio repository plugin wiki page. Some discutions focused on audio and/or video recording in Moodle are in the Record audio repository plugin (was Wanted: New feature ideas for GSOC projects) and GSOC: Record Audio/Video directly into resources/activities forums. The later is more general, not only about the repository plugin. Last, but not least, there also a place for feature requests and bug reports in the MDL-18341 ticket.

The plugins are not included in the Moodle releases (not even the 2.0 dev daily build). In order to test them, you'll need to use a 2.0 dev daily build.

The Riffly plugin allows audio-only or audio-video recording inside the Moodle repositories. The flv files are stored on riffly.com servers and, optionally, they can be downloaded into Moodle (to go under Moodle File API control). Recorded files and the recording flash object is available in all places where the repository is used to select files.

After you download a Moodle 2.0 dev build, you'll have to download the plugin manually from CVS and copy the entire riffly folder inside the repository folder of your Moodle instalation. Then go to the Plugins/Repositories entry of the Administration menu, enable the plugin and make it visible. When you're done, you'll have the option to create riffly site-wide, course-wide or per-user collections. For each collection, you can choose what type of content it accepts: audio, audio-video or none of them (to get a locked collection).

The Nanogong plugin allows audio-only recording inside the Moodle repositories. The wav files are stored into Moodle using the File API. The sound files can be recorded using the ImaACPCM or Speex codecs. As for the riffly plugin, recorded files and the recording applet are available in all places where the repository is used to select files.

After you download a Moodle 2.0 dev build, you'll have to download the plugin manually from CVS and copy the entire nanogong folder inside the repository folder of your Moodle instalation. Then go to the Plugins/Repositories entry of the Administration menu, enable the plugin and make it visible. When you're done, you can select the codec used and the quality of the sound for the site-wide recording instance. This instance will be shared by all users of your site (because it only handles recording, and File API handles the rest).

Sunday, August 2, 2009

Octave files misdetected as Objective-C

As you may noticed from the previous post's screenshot, GEdit misdetects my Octave .m files as Objective-C code files (because both share the same file extension). Because I don't use Objective-C, I tried to fix this problems like this:

  1. I edited the file /usr/share/mime/packages/freedesktop.org.xml, commenting out the mime-type tag with type text/x-objcsrc (just search for text/x-objcsrc and you'll find it).
  2. After saving this file, I ran the following command:
    sudo update-mime-database /usr/share/mime/
  3. Last, I restarted GEdit.

It didn't seem to work, so I did the following thing:
sudo rm /usr/share/gtksourceview-2.0/language-specs/objc.lang.
This worked fine.

Octave taking over Matlab

I'm trying to replace my Matlab R12/Windows habit with Octave 3/Linux. I installed the QtOctave IDE, but it seems to bulky (especially because I use Gnome). I didn't liked it, so I uninstalled it.

Next I tried another approach: I installed the gedit-plugins package which contains the embeded terminal plugin and enabled the filesystem and embeded terminal plugins. My GEdit window setup looks like similar to Matlab's default view, except for the workspace and history sidepanes (which I didn't use much anyway).

I also added the file .octaverc in my home directory and added this line to it:
edit EDITOR 'gedit %s'
This command makes Octave's edit command to open files in the gedit (instead of default emacs).

Wednesday, July 29, 2009

Nanogong applet how-to

This is a compilation of the notes I tookon nanogong appet. I think I got everything here and I didn't missed anything.

The nanogong applet accepts the following (optional) parameters:

  • SoundFileURL = URL = address of a sound file that should be loaded on applet init (default "")
  • Start = true|false = if true, the applet will start playing the file from SoundFileURL after loading (default false)
  • ShowAudioLevel = true|false = if true, it displays the audiometer (i.e. VU meter) (default true)
  • ShowRecordButton = true|false = if true, it displays the record button (default true)
  • ShowSpeedButton = true|false = if true, it displays the faster/slower playback buttons (default true)
  • ShowSaveButton = true|false = if true, it displays the saved file locally button (default true)
  • Color = HTML color (including # prefix) = the color of the applet's background (default #FFFFFF)
  • AudioFormat = ImaADPCM|Speex = the codec used for sound encoding (default Speex)
  • SamplingRate = integer = the sampling rate of the sound recording (default 44100); allowed values depend on the AudioFormat:
    • 8000|11025|22050|44100 = for IMA_ADPCM audioformat
    • 8000|16000|32000|44100 = for Speex audioformat
  • SpeexQuality = 1...10 = quality of sound compression for the speex codec (1 = lowest, 10 = highest quality) (default: 10)

Appart from SoundFileURL and Start parameters, which allow sound to be played as soon as the applet is loaded, the nanogong applet can be controlled using the sendGongRequest method. In order to do this, the applet should have an id, which makes it easy to get a reference to it in JavaScript. Here's an example:

HTML:
<applet id="nanogong" archive="nanogong.jar" code="gong.NanoGong" width="180" height="40"></applet>

JavaScript:
var recorder = document.getElementById('nanogong');
if (recorder == null) {
 alert("recorder not found");
 return;
}
var result = recorder.sendGongRequest(...request name..., ...parameters...);

The following requests names (and parameters) are accepted (including returned values, but without quotes):

  • playMedia StartTime EndTime - plays the media between the StartTime (optional; default: current position) and EndTime (optional; default: end of sound) seconds; return value is "StartTime;EndTime" (values parsed by the applet)
  • recordMedia Duration - record Duration (optional; default: maximum accepted) seconds of sound; return value is "Duration" (values parsed by the applet)
  • pauseMedia - pause the media playback or recording; return value is "Time" (current playback time)
  • stopMedia - stops the media playback or recording; return value is "" (if playback) or "Duration" (total recording time, if recording)
  • setMediaTime Time - sets the current playback time; return value is "Time" (value parsed by the script)
  • getMediaTime - gets the current playback time; return value is "Time" (current playback time)
  • getMediaDuration - gets the total playback time; return value is "Time" (total playback time)
  • setMediaRate Rate - sets the playback rate (between 0.5 and 1.5); return value is "Rate" (value parsed by the script)
  • getMediaRate - gets the playback rate (between 0.5 and 1.5); return value is "Rate" (current playback rate)
  • getMediaStatus - gets the current status: playing, recording,paused, paused recording, stopping, stopped, closing, or closed; return value is "Status"
  • getAudioLevel - gets the current audio level (in 0.00 format); return value is "Audio level"
  • saveMessage Type Filename Path - saves the audio file (many features)
  • postToForm URL Parameter Cookies Filename - send the sound file via HTTP post to the URL address (including the Cookies), with the file send as the Parameter form item and with local name Filename; return value is the response of the server.
  • loadFromURL URL Start - load the sound file from the URL and playsit if Start=true; return value is "URL" (value parsed by the applet)
  • getVersion - gets the applet version number; return value is "Version"

Here's an exemple that also uploads the registered message (2 files in the same directory):

File: record.php
------------------------
<?php
if(isset($_GET['save'])) {
  move_uploaded_file($_FILES['sndfile']['tmp_name'], '/tmp/' .
$_FILES['sndfile']['name']);
  echo 'Your file have been saved.';
  exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>The NanoGong Applet</title>
  <script src="nanogong.js" type="text/javascript" language="javascript"/>
</head>
<body>
  <h1>The NanoGong Applet</h1>
  <applet id="nanogong" archive="nanogong.jar" code="gong.NanoGong"
width="180" height="40">
  <param name="AudioFormat" value="ImaADPCM" />
  </applet>
  <input type="button" onclick="sendFile('nanogong')" value="Send" />
</body>
</html>

nanogong.js
------------------------
function sendFile(applet_id) {
var recorder = document.getElementById(applet_id);
if (recorder == null) {
  alert("recorder not found");
  return;
}

var duration =parseInt(recorder.sendGongRequest("GetMediaDuration", "audio")) || 0;
if (duration <= 0) {
  alert("no recording found");
  return;
}

// upload the voice file to the server
var msg = recorder.sendGongRequest("PostToForm","record.php?save=1", "sndfile", "cookie=SomeText", "myfile");
alert(msg);
}

The problem with the current applet is that it is not signed and it contains code for saving files locally. This makes browsers to ask the user if they trust the applet publisher. This is annoying and it may raise concerns for unfamiliar users. There are three solutions to this problem:

  • leave it as it is (maybe show a message to the user, explaining what the browser is complaining about)
  • sign a copy of the nanogong.jar file with some valid certificate (maybe a moodle certificate)
  • delete the local file saving code (not very important), recompile the applet and hope that the browser will not complain anymore.

Tuesday, July 21, 2009

Almost there

The riffly plugin repository is almost completed. Jerome is helping me with QA and squashing bugs. The plugin now supports multiple instances (per site, per course and/or per user) and each of this instances can be setup to support only audio media, only video media or audio and video. Also, each instance can be setup to download the riff files locally (for management using Moodle's File API) or to link to the files on riffly.com (very useful, if you have limited storage space or bandwidth).

Meanwhile, I started work on the second plugin, which is using the Java applet nanogong.

Wednesday, July 15, 2009

Code is in CVS

The code up to now it's in CVS. I did some changes to the recording scripts, factoring out the common part in record.php. After Jerome noticed that recording is limited to 10s, I fixed that and set a limit to 1 hour. I also fixed some other bugs that Jerome reported and made some changes to the UI (the recording links placed at the top now; no longer mixed with the recorded content). I'm currently working on integrating this plugin with File API.

Thursday, July 9, 2009

CVS write access

My application for CVS write access was accepted and now I have write access to contrib/plugins/repository/riffly. I'll commit the plugin as soon as possible (probably after I'll do the changes Jerome proposed).

Monday, July 6, 2009

Midterm plugin

This week I "finished" the repository plugin for integration of riffly.com web services. I got carried away so I added more features than I initially planned for (like video recording). Before going into more details, you can go and download the plugin from the ticket #MDL-18341.

Instalation: Inside the tgz'ed file you'll find only one folder (called riffly) that you'll have to extract in the repository folder of your Moodle instalation. After that, go to Moodle's Site Administration menu and drill into Plugins/Repositories/Manage repositories. Click on the "Add Riffly" link and then enable the Riffly repository plugin.

Usage: As I said, the plugin has many features (although some of them are not as visible as they could be), so I will not present them all and let you discover them by yourself. Just a few tips:

  • how to insert a riff in your document: you'll have to use TinyMCE's "Insert/edit embeded media" button. Click on it and then click on the Browse button (to the right of the File/URL textbox). In the File Picker, select the riffly source. There you'll see the riff manager option, the record audio option, the record video option and any riffs you recorded previously (or added manually through the manager). Select the riff you want or record a new one, enter its name (or a description) and click the "Select this file" button. The rest is business as usual.
  • how to manage your riffs: follow the previous steps, but select the "Manage collection" instead of an riff. You'll see a list with all the riffs in your repository (including their name/description, ID and preview areas). You can remove items from the repository or you can add new items if you know their IDs (Yes, you can share riffs with your friends by sharing these IDs)

Things that might go wrong: The code was developed against the HEAD of Moodle's CVS and it works ok. However, I spent an entire day tracking down a bug that prevented the file picker to show its content (repository categories and items). It seems a bug found its way into commit 1.19 of lib/form/editor.php (Petr was so kind to help me find it). Either check it was fixed in a following version or use the 1.18 version from HEAD.

Things that didn't go as planned: I broke my Moodle working enviroment twice this week with CVS updates. It's normal for a product in development phase, but that doesn't make it less annoying. 

I planned to create a TinyMCE to ease the proces of recording (and open the file picker directly). I never developed for TinyMCE before. I got maybe 60% of it done, but yesterday I got stuck in some JavaScript issues. Today, I found some ways to make it work, but I'll have to postpone work on it for a while.

Because of the TinyMCE plugin, I didn't have time to write the text filter, which would be probably much more easier and straightforward (I went with the challenging/fun part).

Monday, June 29, 2009

Back to work

My short trip to IaÅŸi is over. I attendend the ECODAM 2009 Doctoral Summer Workshop. There I assisted to some very interesting lectures (both from invited speakers and from other PhD students) and I also gave a talk about bonds representations in Ising spin glasses.

Unfortunatelly, last moment problems before leaving stopped me from submitting the last week's work summary and once got there my online time was very limited (between lectures, organizing activities, and spending time with my favorite niece). Therefore I'll do a two week summary in one post.

I finished the code for retrieving riffs metadata from Riffly. This is used when the user manually adds a riff to the repository.

I refactored the JavaScript code for integration of Riffly callback API with Moodle. It's much cleaner now, using AJAX POST to send the data back to Moodle repository and callback functions to update the File Picker location only if the riff ID was correctly stored in Moodle. If the store process fails, the the File Picker location will not change, so the user will be able to retry.

One problem that gave me major headaches (especially because I didn't have an Internet connection to search for more data) was the inconsistence between YUI's asyncRequest docs and implementation. Documentation says that the callback can be a function or an object. This is either wrong, or Moodle's YUI version it's older, because a function doesn't work. Finally I found the solution: use an object with success and failure methods.

When I updated code from CVS, I got the surprise that the HTML meta got deprecated from print_header. I was using it to inject some small JavaScript code (a hack, I know). Anyway, I had to learn about the new way to do it: using the require dynamic property of the global $PAGE variable. So now, the JS is on its own file, connection to Moodle through the riffly JavaScript variable.

Finally, I applied for write access in contrib/plugins/repository/riffly so I can start to commit.

To do: these are some ideas that might be good to implement:

  • automatically select a newly recorded file (to save the user a few clicks);
  • implement a text filter (Jerome sugested to look at the youtube filter for an example) instead of using flash objects;
  • create a TinyMCE plugin to make recording easier than it is now (about 3 mouse clicks instead of the current 6 clicks).

Wednesday, June 17, 2009

First glimpse

The plugin I'm working on is starting to get a face, too. I almost finished the rough user interface. It doesn't have all the bells and whistles of Mihai's work, but it's enough now for testing the backend. I'll probably have to work on it some more after I get the feedback from Jerome. This is how it looks right now.

The user accesses the repository instance (in this case, called something). She/he will always see two pseudo-entries: manage collection and record. In addition to these, all the audio items in this instance's collection will be available for selection.

NB: The repository framework only supports thumbnail images for previews. This is not very usefull in the case of audio content. One of these solutions could be used:

  1. implement a way to add textual description to entries and display those instead of generic "Audio file" text
  2. implement a way that plugins can render their own HTML code for thumbnail (I think this is more usefull: @todo: check this with Jerome and Dongsheng)

The Manage collection entry displays a page where the collection entries can be deleted, previewed or added. This is usefull if you want to move items from one collection to another or to add an item that you now recorded.

NB: The i18n is not fully implemented and many language strings are missing.

Finally, the Record entry displays the recording Flash object. It allows users to record audio content and save it. I'm still fighting some JavaScript issue in order to automatically store riff ID and select it in the file picker after recording. This also brought me to my first contact with YUI. It's ok, but I like JQuery better. JQuery is simply more fancy, lightweight, and ... more fun.

Monday, June 8, 2009

Riffly API update

These are some additional information I managed to obtain about the riffly.com services. First of all, the API does not offer an username/password authentication method for premium users. If a user has a premium account, they add their domain in their control panel on riffly.com, so it will auto-detect any riffs that are played from their domain.

Second, the metadata for riffs is only available though JavaScript. More exactly, imagine you have the ID of a riff: B47686169D7111DC9B0D44CF0D09CCE3. In order to get its metadata you have to read http://riffly.com/api/info/B47686169D7111DC9B0D44CF0D09CCE3, which will give you something like this:

{
  "created" : "1196227339",
  "riffly_id" : "B47686169D7111DC9B0D44CF0D09CCE3",
  "playbacks" : "80",
  "type" : "video"
}
The most useful things here are the created timestamp and the playbacks count. Unfortunatelly, in order to display these in the File Picker, I would have to get these files for each riff and parse them in PHP. I'm not sure it's worth it.

A possible solution is to find the a way to embed some <script> tags in the File Picker that load JavaScript from this address http://riffly.com/api/info/B47686169D7111DC9B0D44CF0D09CCE3?callback=myCallback. The code produced by this address will call the myCallback function. Unfortunatelly, I'm not sure this will work with HTTPS Moodle instalations.

Monday, June 1, 2009

Meeting with Petr

Today I talked to Petr about the plugin progress. The discussion was very useful because he pointed out that teachers are allowed to embed objects and applets, but students aren't (for XSS reasons). It seems that the current method for students to embed objects is providing a link and let the filters take care of the rest (I'll have to check that).

No riffly.com reply yet

I haven't got a reply from riffly.com, yet. It's not urgent, because I can work on other stuff, but I was curious to get more details. I have another batch of questions ready for them, but one thing at a time.

Sunday, May 31, 2009

Repository "Hello world" (aka Riffly.com)

This week I've worked the repository plugin for the riffly.com audio services. Starting the plugin was easy. The documentation presents clearly the required first steps. Thei are not hard to follow.

Moving on and getting into more details proved harder, due to the gaps in the documentation. For answers to many questions I had to dig into the repository lib code and trace the control flow. I guess the code is still in working because there are many code comments left, some obsolete comments, and many non-documented functions (too many?).  Yeah, and the Ajax part did make the process harder in some places.

Anyway, I got a skeleton of the plugin in place :). I still have some unanswered questions (like is the link and ref_id return types treated diferently, and how?).

Another issue is missing information about the riffly premium features. I wrote them requesting details, but I haven't received an answer yet.

Netbeans vs Eclipse (for PHP)

All weekend I've tested Netbeans and Eclipse with my PHP projects, mainly Moodle (since it has the larger codebase).

I've been using Eclipse Europa with PDT 1.0.3 for almost an year now since Petr recomended it to me. I'm very happy with it, although on a few occations the workspace got corrupted and some of the features stopped working (code completion, code dereferencing, etc).

So this weekend I tested Eclipse Ganymade with PDT 2.0 and Netbeans 6.5. Ganymede was quickly out of race (for now) due to too much memory hogging. Netbeans was OK, but it felt like its PHP features are somehow behind PDT's: file parsing/opening was slower, code dereferecing worked incorrectly on a few occations, and after a few hours of working the memory consumption was also large. I liked it code completion speed and coding helps.

I was expecting more from Netbeans, but I guess it's still too much focused on Java. Eclipse seems more general. So for now, I'll keep my Eclipse.

Saturday, May 23, 2009

Coding starts.... NOW!

Well, GSoC coding starts today. I finished the functional specification, but I still need to prepare some mockups to make it cleaner. Jerome suggested balsamiq. I'll give it a try.
Jerome gave me some very good advices about dealing with common stuff vs. specific issues in it:
the question to ask yourself is: What are the difference between java applet and web services for the final users (Moodle admin and the guy wanted to record a sound)? If the difference needs a few sentences to be explained, you can have one paragraph. If you need half a chapter to explain the difference, it probably needs distinct chapters/use cases.
On a separate issue, I think Elena has an easier project code-wise, but more challenging "inspirational-wise".

Tuesday, May 19, 2009

Repository APIs

Finally, after long and frequent interruptions I was able to complete reading Moodle's Repository API & friends. The specification is still under construction, but it showcases an interesting and powerful concept with a very clean API.

Monday, May 18, 2009

Eclipse says "Workspace in use or cannot be created"

Out of the blue, Eclipse is saying that the "Workspace in use or cannot be created". I say ok, probably a lock file was left behind and so I do:
rm ~/workspace/.metadata/.lock

No error (so the file was left behind), yet the problem is not solved. I tried clearing out the workspace path. Same problem.
Googleing, I found this post, so I ran:
sudo gedit /usr/share/eclipse/configuration/.settings/org.eclipse.ui.ide.prefs
removed the RECENT_WORKSPACES line. It works now.

Thursday, May 7, 2009

First entry

This is my first blog entry. As I write right now, I'm not a big fan of blogs. However, I started this in order to help me keep track of my progress while working on Moodle with Google Summer of Code and other projects I'm doing.
It might also prove useful helping me "bookmark" stuff I found useful once and I can't find it anymore (like USP).
I've added a task to my Google Calendar to see in one year from now if my impressions about blogs changed.