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(){ = 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);;

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


// Restarts the timer countdown
restart : function(){; = 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;
if(this.sec <= 0){;

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)