Saturday 26 May 2007

GRUB Error 17

Ever since I've added a new partition between my windows and linux partitions I get GRUB Error 17 after installing/updating some essential linux core elements. It is happening because GRUB config file gets overridden with a default one. I don't know how to solve this problem but I do know how to recover in an easy way. I've copied the /boot/grub/menu.lst file (grub configuration) to my home directory. Every time I get Error 17 after choosing Linux in my GRUB menu I:
  1. Reboot the system
  2. When GRUB menu appears I select linux option and press 'e' for editing
  3. I set correct parameters
  4. Press 'b' for booting
  5. When system loads I override /boot/grub/menu.lst with the stored one from my home folder
And that's it. I realize it is not a solution, but it works for me :)

Thursday 24 May 2007

Master's Thesis presentation

Here is one of the presentations describing my current work. It is basically a simple digest of the theoretical part of my Master's Thesis. If you are interested in my other presentations you can take a look at my slideshare profile.


(Presentation may not be visible in some browsers under Linux)

Wednesday 16 May 2007

100% CPU usage caused by atieventsd process

When I was checking yesterday the performance of my system I noticed that the system monitor shows permanent 100% CPU usage. It was quite weird because there where no other applications running. I clicked on the 'processes' tab and I found out that a process called 'atieventsd' was using all the possible CPU load. The process is related to ATI drivers. I searched through ubuntu fora I I found the solution for this problem in couple places (it seems that it affects many Ubuntu Dapper Drake users). For me worked this one

Wednesday 2 May 2007

Javascript Timer object for active pages/tabs

Sometimes you want to fire an event on a webpage with a certain delay. There are couple ways to do that. Today I'm gonna present a JS Timer object, which waits a given amount of seconds after it's creation till it raises an alert. In addition out timer will work only when the page is active. If it looses a focus the timer stops. It resumes when it gains it back. Here is my code with some comments:
var TimerJob = Class.create();
TimerJob.prototype = {

/*PeriodicalExecuter*/ pe : null,

//numbers of seconds to wait
/*int*/ sec : 600,

//flag set after countdown finishes
/*bool*/ finished : false,

// Initializes the timer
initialize : function(){
this.pe = new PeriodicalExecuter(this.execute.bind(this),1);
window.onblur = this.abort.bindAsEventListener(this);
},

// Stops the timer countdown if page/tab looses focus
// Handles window.onblur event
abort : function(evt){
$('informer').innerHTML = "abort";
window.onblur = '';
window.onfocus = this.resume.bindAsEventListener(this);
this.pe.stop();
},

// Resumes the timer countdown when page/tab gains focus
// Handles window.onfocus event
resume : function(evt){
if(this.finished){
window.onfocus = '';
window.onblur = '';
}else{
this.pe = new PeriodicalExecuter(this.execute.bind(this),1);
window.onfocus = '';
window.onblur = this.abort.bindAsEventListener(this);
}

},

// Restarts the timer countdown
restart : function(){
this.pe.stop();
this.pe = new PeriodicalExecuter(this.execute.bind(this),1);
window.onblur = this.abort.bindAsEventListener(this);
},

// Action executed by timer each second
execute : function(_pe){

$('informer').innerHTML = this.sec;
this.sec--;
if(this.sec <= 0){
this.pe.stop();

alert("It is time!!!");

this.finished = true;
window.onblur = '';
window.onhelp = '';
}
},
}
The code above uses protoype.js library, which I already mentioned several times. Let me explain a little bit how it works. Initialize() method is a constructor, which starts the countdown. PeriodicalExecuter is an object from prototype.js library, which name explains everything :) Each second execute() method is invoked, which sets the number of seconds left in the page element identified by id 'informer'. Every time the page looses it focus (window.onblur) the abort() method is invoked which stops the countdown. When it gains focus back (window.focus) the resume() method is invoked. When the counter reaches 0 alert is raised and we don't care about focus or other stuff any more :)

Any questions?

PS. The code has been tested on Opera 9.2 and FF 1.5 (Ubuntu Dapper Drake)

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 :>).

Monday 26 March 2007

Task scheduling in J2SE / J2EE with Quartz

Recently I had to implement a module that would execute a given task once a day. At first I wanted to use Timer class but than I found Quartz.
Quartz is a library for task scheduling for JAVA/J2EE. It is very easy to configure and use. Here are some features that I like:
  • works in both J2SE and J2EE
  • different jobs storing modes (memory or DB)
  • jobs can be declared in XML (no need to compile the code after changes)
  • different triggering modes (e.g. Cron like one)
  • predefined set of triggers e.g. minutely, daily etc.
  • it's for free (Apache License 2.0)

Check it out at: www.opensymphony.com/quartz/

Wednesday 21 March 2007

Managing Wi-Fi with kNetworkManager

I use Wi-Fi connection at work. I've also got one at home recently. I was looking for a tool for managing wireless networks. I wanted it to be easy in use and configuration, just like at Windows. I've found kNetworkManager. It seems to meet all of my expectations.

I faced some problems at the beginning - it simply didn't want to manage my networks :) I've solved the problem by removing all the lines describing network devices in
/etc/network/interfaces

You can find description (in polish) of installation procedure
here. It also contains tips how to configure password manager so you are not ask for the network password every time you log in.

Tuesday 13 March 2007

Default browser in KDE

I'm an Opera user, so I would like it to be my default web browser. This short note is about setting a default browser in Kubuntu in general. I experienced some problems trying to make it work.
  • Attempt #1
    First I tried recommended method:
    sudo update-alternatives --config x-www-browser
    At first I thought it worked fine, but first use of Thunderbird proved me wrong. This command works mainly for KDE applications, which thunderbird is not (it opens Firefox by default).

  • Attempt #2
    Ok. Let's try to find it somewhere in system settings. I found something like this:
    System Settings > KDE Components > Default Applications > Web Browser
    This must be it! Oh, it's so easy! No, wait a second - it still doesn't work with Thunderbird :\

  • Attempt #3
    Following instructions from 'Opera help' for KDE environment I tried to associate .html and .htm files with Opera:
    In Koqueror menu bar choose:
    Settings > Configure Konqueror > File Associations > text > html
    You can set there the order in which the application for a given type should be chosen.
    Didn't help.

  • Attempt #4 (successful!!!)
    OK, last try. I'm serious - it's now or never! I switched to Gnome for a moment and set the default browser from there:
    System -> Preferences -> Preferred Apllications
    Quick switch back to KDE and...
    Ladies & Gentleman - we have a WINNER! I mean it works ;)

Useful links:
1. This guy had the same problem.
2. I've found solution here.

Monday 12 March 2007

Amarok

I love it! Only for the Amarok itself it was worth to switch to Ubuntu. It is nothing revolutionary, but its features are exactly what I need to enjoy my media collection.
It can also deal with last.fm streams, which makes it even more useful.

The coolest feature for me is possibility to control the player using the mouse scroll over the Amarok's tray icon.
  • scroll up/down - volume up/down
  • ctrl + scroll up/down - previous/next song
  • scroll click - pause/play
Oh, I forgot to mention about keyboard shortcuts used for controlling the player that are working also when player's window is not active.

First negative impressions

Linux sucks! ;) Ok, maybe not really, but...

I spent some time on customising my Ubuntu but there are still many things I had in Windows working which I miss in Linux a lot:
  • Open Pandora - there is no Open Pandora player for Linux. I did not find any alternatives as well.
  • Mic in webcam - my Ubuntu can't handle the mic build in USB webcam (Logitech Quickcam Pro 3000). It is probably easy to set up but I'm pretty lazy :P
  • Azureus - actually Azureus is a Java torrent client, so it should be portable. But I just can't get it working correctly on Ubuntu. I use poor kTorrent instead.
  • Flash in Opera - I'm facing the same problem I experienced using Opera 8.x on Windows: Flash player doesn't work right in Opera. Banners and adds don't close when I click "X", application menus don't work etc.. It can be really annoying! I hope next versions will have this bug fixed.
I hope this list won't get much longer.

Saturday 10 March 2007

KDE

Dafault display manager for Ubuntu is GNOME. My colleagues suggested me to try KDE instead. So I did.

Changing GNOME to KDE:
  • Download & install KDE packages with all their dependencies (around 350MB) using Synaptic Package Manager.
    System > Administration > Synaptic Package Manager
  • Reboot the system.
  • When the login screen appears choose:
    Menu > Session Type > KDE.
That's it.

After couple hours spent with KDE and some changes in default look and components configuration I can say KDE suits me, although the default style seems to be little bit to "candy" for me.

My Desktop looks now like this:

Let's get started

I've chosen Ubuntu 6.06 Dapper Drake as my Linux distribution. It is supposed to be a ready-to-use system, so it should be pretty simple to start with.

The installation went very smooth indeed. After launching the system from bootable CD a graphical enviroment appears. Click the 'install' shortcut to start the installation process. The process itself is very simple, it requires to set only basic parameters and click 'Next' several times. All the hard work the systems does for you.

Now we are ready to go!

Friday 9 March 2007

Switching to Linux

I've finally decided to join the exclusive comunity of Linux users. As much as I like Windows and the easy of use it offers I also realize that every selfrespecting software developer has to know the Linux basics.

The purpouse of this blog is to gather my knowledge about technical
issues related to Linux installation and usage. The secondary goal of this blog is to improve my english by practice.