- Reboot the system
- When GRUB menu appears I select linux option and press 'e' for editing
- I set correct parameters
- Press 'b' for booting
- When system loads I override /boot/grub/menu.lst with the stored one from my home folder
Saturday, 26 May 2007
GRUB Error 17
Thursday, 24 May 2007
Master's Thesis presentation
(Presentation may not be visible in some browsers under Linux)
Wednesday, 16 May 2007
100% CPU usage caused by atieventsd process
Wednesday, 2 May 2007
Javascript Timer object for active pages/tabs
var TimerJob = Class.create();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 :)
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 = '';
}
},
}
Any questions?
PS. The code has been tested on Opera 9.2 and FF 1.5 (Ubuntu Dapper Drake)
Subscribe to:
Posts (Atom)