Wednesday 25 April 2007

Object Oriented Javascript

I'm using a lot of Javascript in the project I'm currently working on. I don't really like it but it can be very useful sometimes. In order to make it easier I try to use the object oriented approach. Protoype.js library supports creating of an object oriented code by extending regular javascript objects with some additional functionality. You can find good examples at prototype's homepage but I also recommend this tutorial.

Having some background in a "real" OOP languages I did not have many difficulties with creating OO JS code. I did have, however, some problems with understanding how it works - I'm still not 100% sure about it ;). The issue I'm talking about is related to the scope of methods. I found myself trying to access some object's properties from the body of the methods, that could work in different context. If you have the same problem I would recommend reading the description of bind() method, that is introduced by prototype library.

It is also possible to write OO JS code without using prototype.js. There are good tutorials available here and here.

Saturday 21 April 2007

Accessing CDATA section in XML DOM from Javascript

I had a hard time figuring out how to access CDATA Section in XML DOM using JavaScript. I read many different comments on that but I have not find a satisfying answer. Let's take a look at an xml example:
<page>
<uri>http://www.somepage.com/page1.html</uri>
<content>
<!--[CDATA[
<p>Paragraph 1</p>
<p>Paragraph 2 <a href="lnk.html">lnk</a></p>
]]-->
</content>
</page>
I was trying to access the CDATA section the way I access all the text nodes:
xmlDocument.getElementsByTagName('content')[0].firstChild.nodeValue;
Unfortunately it doesn't work. I was wondering what am I doing wrong. I run some tests and discovered that the <content> node has actually 3 children (I thought it has only 1). The first and third childNodes are empty text nodes; the middle one is the CDATASection node I was trying to access. So the final code looks like this:
xmlDocument.getElementsByTagName('content')[0].childNodes[1].nodeValue;

I'm using this for parsing a server response returned by AJAX Request (invoked using prototype.js library). I am not an expert here but I guess it may differ between XML DOM implamantations.

Tuesday 17 April 2007

5th Annual Conference on Teaching & Learning: Learning Technologies

Here is our abstract, which recently has been approved for this conference:

Adapting informal sources of knowledge to e-Learning.

Authors: Czaja Filip, Dobrzański Jarosław, Jankowski Jacek

The amount of information sources and the available data is growing dramatically fast nowadays. It is very difficult time for teachers to keep up with changes (especially in information domain) and to find new and appropriate sources of information. This problem also affects e-Learning. Contemporary e-Learning systems deliver predefined, rigid courses which usually do not take into account user specific conditions, like wishing to broaden his or her knowledge in wide range of domains at the same time. Without constant maintenance, electronic courses are also getting outdated. Moreover, all of the current solutions seem to underestimate the potential of informal learning [1].

According to researches, over eighty per cent of possessed knowledge is acquired from informal sources of information like wikis, blogs and digital libraries [1]. These Web 2.0 platforms allow community collaboration, sharing knowledge and ideas. In addition, they are continuously developed to better serve users. Semantic description of available sources not only interconnects them but also allows machines to reason about their content. Consequently, artifacts can be easily accessed, browsed and harvested for further use.

Following the presented idea, we introduce Didaskon [2], a framework for automated composition of a learning path for a student. The selection and workflow scheduling of learning objects is based on their description, semantically annotated specification of user profiles, anticipated knowledge after course completion and technical details of the client’s platform. User profile is described with FOAFRealm Ontology [3], a part of FOAFRealm project. It is based on FOAF metadata that provides functionality to manage identities and share resources with friends.

Having in mind statistics about acquiring knowledge, we decided that Didaskon shall derive both from formal and informal sources of information. It should collect relevant data from wikis or blogs and process it so that it can be used in a form of learning objects, which enriches and improves the process of learning.

References:
1. DTI 2006 - Beyond eLearning: practical insights from the USA
2. http://didaskon.corrib.org
3. www.foafrealm.org

Playing .wmv files in Ubuntu

In order to play .wmv files in Ubuntu you have to install w32codecs package:
  1. Open
    /etc/apt/sources.list
  2. Add lines:
    • Dapper Drake:
      deb http://mirror.ubuntulinux.nl dapper-seveas all
      deb-src http://mirror.ubuntulinux.nl dapper-seveas all
    • Edgy:
      deb http://mirror.ubuntulinux.nl edgy-seveas all
      deb-src http://mirror.ubuntulinux.nl edgy-seveas all
  3. Update list of repositories:
    sudo apt-get update
  4. Install the package:
    sudo apt-get install w32codecs
  5. Open your files and watch :)

Solution found here and here.

Monday 16 April 2007

Didn't get the iPod

Well I'm fresh after Faculty of Engineering Research Day 2007. Surprisely I didn't get the iPod for the best poster. I didn't even get a digital picture frame. I actually got nothing but wine and cheese :) It cames out that not only the quality of the posters counted but also the research idea itself. Here is my one page abstract explaining a little bit of my current work.

Don't you think I deserve a price for this poster? :)

Related links:
Faculty of Engineering Research Day 2007
My Abstract
All submitted abstracts

Monday 9 April 2007

Tables on multiple pages with latex

It is Easter break so I have finally some time to write my Master's Thesis ("Delivering accessible information from soical semantic information sources through adaptive hypermedia" - yeah, I don't understand it either :D ). Anyway, I'm using latex with TeXclipse. Yesterday I tried to create my first ever table using latex.

There is a latex directive "tabular", which I was trying to use. Problem with my table was that it was quite long and had to be spread on multiple pages. Tabular does not support this kind of long tables and it simply cuts the table at the end of the page.

I've found example using "longtable" directive for creating tables on multiple pages but I did not have appropriate package installed. I followed this instruction and installed necessary packages. Now it is enough to declaire use of this package \usepackage{longtable} and create a longtable.

Package installation precedure:
  1. Download set of additional packages tools.zip from www.ctan.org.
  2. Extract package's content
  3. Enter folder with extracted files and run command
    latex tools.ins
    to create *.sty files
  4. Copy *.sty to folder with latex plugins. In my case it's
    /usr/share/texmf-tetex/tex/latex.
  5. Refresh latex files db by running command texhash
You use the "longtable" directive very similar to tabular. Here is simple example:

\begin{longtable}{c|l|p{5cm}}
\hline
content of cell 1 (centered) &
content of cell 2 (aligned left) &
content of cell 3 (multiplerows, 5cm width) \\
\hline
\end{longtable}

PS. Longtable directive helped me with my problem but it still doesn't work as I expected. If a single cell contains a lot of text in multiple rows, so it takes more than one page to render it, it is also cut at the end of the page. I don't know how to fix it (yet :>).