cooking, programming and everyday life xrado

Sunday, January 17, 2010

Going freelance

If you don't already know I'm going freelance with the next month. I was thinking about this for a long time and now finally decided to start my own business and try it on my own. I made a checklist of things I'll have to do before the startup and one of top priorities was setup a portfolio.

Here it is, it's not much, just some screen shots and short description but i think enough to give you the feeling what i already dealt with and what are my experiences. It's temporary, just until i make my own business web site.

Saturday, November 28, 2009

Baked lasagna and potatoes & kebab style seitan

I haven't posted for a while about my cooking creations. Here are two i just found on my camera.

Baked lasagna and potatoes with summer vegetables and some cheese
IMG 1745
before
IMG 1747
after

Kebab style chopped and fried seitan with fresh vegetables and bread
IMG 1756
IMG 1626

Delicious!

Friday, March 20, 2009

FireSpider and pyGtranslator on GitHub

Since I'm getting so many bug reports and improvement wishes for those two tiny apps I decide to push the source to GitHub repository, available to any one to contribute. I haven't touch them for a while also the code isn't shiny, but any way we are all learning. I wish i could play more with it but I'm currently busy with other things also switching the job and so... 

FireSpider on GitHub and pyGtranslator on GitHub

Thursday, February 19, 2009

Dynamic select boxes

These days i was working on a project, where i needed dynamically loading select boxes. I first tried mootools native methods like removing and injecting new option elements in to select element. That worked just fine in FF, but as you expect in IE did not. IE's select box stood unchanged. I remember while ago i have to re-inject the whole select box to see the changes in IE.

According to DOM, there is a better way. HTMLSelectElement support add and remove method that work in all major browsers. So i have implemented three basic methods for mootools Element class.
Element.implement({
	removeAllOptions: function() {
		if(this.get('tag')!='select') return this;
		for(var i=this.options.length-1;i>=0;i--) this.remove(i);
		return this;
	},

	addOption: function(text,value) {
		if(this.get('tag')!='select') return this;
		var optn = new Element('option');
		if(text) optn.text = text;
		if(value) optn.value = value;
		this.options.add(optn);
		return this;
	},

	removeOption: function(prop,value){
		if(this.get('tag')!='select') return this;
		for(var i=this.options.length-1;i>=0;i--) {
			if (prop=='selected' && this.options[i].selected) this.remove(i);
			if (prop=='value' && this.options[i].value==value) this.remove(i);
			if (prop=='text' && this.options[i].text==value) this.remove(i);
			if (prop=='index' && i==value) this.remove(i);
		}
		return this;
	}
});
Methods hopefully already explaining their self.

USAGE
// remove all options or empty select box
$('selectbox').removaAllOptions();

// add options, one after another
$('selectbox').addOption('One',1).addOption('Two',2).addOption('Two',3);

// removing options 
$('selectbox').removeOption('text','One');
$('selectbox').removeOption('value',2);
$('selectbox').removeOption('selected');
$('selectbox').removeOption('index',0);
happy selecting ;)
pages:  1   2   3   4   5   6   7   8   9   10