<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
	<channel>
		<title>xrado blog</title>
		<link>http://xrado.hopto.org</link>
		<description>cooking, programming and everyday life</description>
		<language>en</language>
		<generator>myPortal 2.0</generator>
		
					<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/xrado" type="application/rss+xml" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
				<title>FireSpider and pyGtranslator on GitHub</title>
				<link>http://xrado.hopto.org/post/firespider-and-pygtranslator-on-github</link>
				<description><![CDATA[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 ... ]]></description>
				<content:encoded><![CDATA[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...&nbsp; <br /><br /><b><a href="http://github.com/xrado/firespider">FireSpider on GitHub</a></b> and
<b><a href="http://github.com/xrado/pygtranslator">pyGtranslator  on GitHub</a></b><br /><br />]]></content:encoded>
				<guid>http://xrado.hopto.org/post/firespider-and-pygtranslator-on-github</guid>
				<pubDate>Fri, 20 Mar 2009 18:04:50 +0100</pubDate>
			</item>
					<item>
				<title>Dynamic select boxes</title>
				<link>http://xrado.hopto.org/post/dynamic-select-boxes</link>
				<description><![CDATA[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 remembe ... ]]></description>
				<content:encoded><![CDATA[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. <br /><br />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.<br />
<pre name="code" class="javascript">
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;
	}
});
</pre>

Methods hopefully already explaining their self.<br /><br /><b>USAGE</b><br />
<pre name="code" class="javascript">
// 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);
</pre>

happy selecting ;)<br />]]></content:encoded>
				<guid>http://xrado.hopto.org/post/dynamic-select-boxes</guid>
				<pubDate>Thu, 19 Feb 2009 18:00:16 +0100</pubDate>
			</item>
					<item>
				<title>Simple combining of multiple javascript and css files</title>
				<link>http://xrado.hopto.org/post/simple-combining-of-multiple-javascript-and-css-files</link>
				<description><![CDATA[I've already wrote about "<i><a href="http://xrado.hopto.org/post/firefox-only-includes-styles-form-css-files">firefox only includes styles form .css files</a></i>" and I found out that isn't quite true. Actually firefox doesn't care about the css file extension, but only relay on header <b>Content- ... ]]></description>
				<content:encoded><![CDATA[I've already wrote about "<i><a href="http://xrado.hopto.org/post/firefox-only-includes-styles-form-css-files">firefox only includes styles form .css files</a></i>" and I found out that isn't quite true. Actually firefox doesn't care about the css file extension, but only relay on header <b>Content-Type: text/css</b>. If you as usual have .css file, apache will take care of right content-type, otherwise you will have to take care about it. <br /><pre name="code" class="php">header('Content-Type: text/css');</pre>I came across this when i was writing this script:<br /><pre name="code" class="php">## combine.php

// Define path prefix
$prefix = realpath('.');

if($_GET['js']) {
	header('Content-Type: application/x-javascript');
	$data = Array('path'=&gt;$prefix.'/template/js/','files'=&gt;$_GET['js'],'ext'=&gt;'.js');
} elseif($_GET['css']) {
	header('Content-Type: text/css');
	$data = Array('path'=&gt;$prefix.'/template/styles/','files'=&gt;$_GET['css'],'ext'=&gt;'.css');
} else exit();

foreach(explode(',',$data['files']) as $file) {
	if($file &amp;&amp; file_exists($data['path'].$file.$data['ext'])) readfile($data['path'].$file.$data['ext']);
}</pre>Simple few lines of code, but already do the trick. That will minimise
number of server requests and benefit in faster page loading.<br /><br />Defining the path and file extension is important, otherwise you may expose some other scripts source or even worse, some system files. <br /><br /><b>Usage in page head</b><br /><pre name="code" class="xhtml">&lt;link rel="stylesheet" type="text/css" href="combine.php?css=style,forms" /&gt;
&lt;script type="text/javascript" src="combine.php?js=mootools,validate,fx"&gt;&lt;/script&gt;</pre>Hope you like it, otherwise If you want more advanced solution try <a href="http://code.google.com/p/minify/">minify</a>. <br /><br />cheers<br />]]></content:encoded>
				<guid>http://xrado.hopto.org/post/simple-combining-of-multiple-javascript-and-css-files</guid>
				<pubDate>Wed, 21 Jan 2009 21:10:41 +0100</pubDate>
			</item>
					<item>
				<title>pyGtranslator 0.2 (new version)</title>
				<link>http://xrado.hopto.org/post/pygtranslator-02-new-version</link>
				<description><![CDATA[Here is a new version of <a href="http://xrado.hopto.org/post/pygtranslator-gui-tool-for-google-translate">pyGtranslator</a> (GUI tool for Google translate) with many fixes and some new features. I think now works as it should.<b>what's new:</b>utf-8 characters works properly nowshowing new lines fi ... ]]></description>
				<content:encoded><![CDATA[Here is a new version of <a href="http://xrado.hopto.org/post/pygtranslator-gui-tool-for-google-translate">pyGtranslator</a> (GUI tool for Google translate) with many fixes and some new features. I think now works as it should.<br /><br /><b>what's new:</b><br /><ul><li>utf-8 characters works properly now</li><li>showing new lines fixed</li><li>added languages swap button</li><li>settings are now saved on exit<br /></li><li>better connection error handling</li></ul><br /><i>happy translating and a happy new year :)</i><br />
<h3><br /><b>Downloads</b></h3>
<b>Source</b><span style="text-decoration: underline;"><br />
</span><a href="http://xrado.hopto.org/file/open/19_9e323102dd8b8/pygtranslator-0.2.tar.gz" >pygtranslator-0.2.tar.gz</a>
<br />
<br /><b>Linux</b> <small>(require python, gtk, pygtk)</small>
<br />- ubuntu / debian: <a href="http://xrado.hopto.org/file/open/24_eb1b54ab8dbf7/pygtranslator_0.2-1_i386.deb" >pygtranslator_0.2-1_i386.deb</a><br />- zenwalk: <a href="http://xrado.hopto.org/file/open/22_1b8abe37cd757/pygtranslator-0.2-noarch-54.1.tgz" >pygtranslator-0.2-noarch-54.1.tgz</a> 
<a href="http://xrado.hopto.org/file/open/20_efbd6c48841c7/pygtranslator-0.2-noarch-54.1.dep">dep</a> 
<a href="http://xrado.hopto.org/file/open/21_a956e57eca247/pygtranslator-0.2-noarch-54.1.md5">md5</a><br /><br />
<b>Windows</b> <small>(require <a href="http://gtk-win.sourceforge.net/home/index.php/en/Downloads">GTK2 runtime</a>)</small><br />
<a href="http://xrado.hopto.org/file/open/23_64e84afdb3d4c/pygtranslator-0.2-win32.zip" >pygtranslator-0.2-win32.zip</a><br /><br />]]></content:encoded>
				<guid>http://xrado.hopto.org/post/pygtranslator-02-new-version</guid>
				<pubDate>Thu, 01 Jan 2009 17:05:35 +0100</pubDate>
			</item>
					<item>
				<title>pyGtranslator - GUI tool for Google translate</title>
				<link>http://xrado.hopto.org/post/pygtranslator-gui-tool-for-google-translate</link>
				<description><![CDATA[<b>Update: </b>new version <b><a href="http://xrado.hopto.org/post/pygtranslator-02-new-version">pyGtranslator 0.2</a></b> avalible I've been playing with python these days. I made a small GUI tool that brings Google translate to your desktop.&nbsp;Application was easy to code, although I use python ... ]]></description>
				<content:encoded><![CDATA[<blockquote><b>Update: </b>new version <b><a href="http://xrado.hopto.org/post/pygtranslator-02-new-version">pyGtranslator 0.2</a></b> avalible <br /></blockquote>I've been playing with python these days. I made a small GUI tool that brings Google translate to your desktop.&nbsp;Application was easy to code, although I use python occasionally&nbsp; (wish I could more and learn it better), but want it to make it run on both linux and windows. That took me quite more time. I almost gave up with py2exe and building windows executable, but after hours of googling and trying I figure out that I have to set environmental path to GTK runtime libs. I also made packages for two my favourite linux distros Zenwalk and Ubuntu. pyGtranslator can be improved and also "<span style="font-style: italic;">suggest a better translation</span>" is missing, but that's maybe for late updates, if the need shows. I hope it works for you, otherwise let me know.<br /><br /><img style="border: 1px solid gray;" alt="pygtranslator" src="http://xrado.hopto.org/image/medium/44/pygtranslator.png" align=""><br /><br /><b><a href="http://github.com/xrado/pygtranslator">pyGtranslator  on GitHub</a></b><br /><h3><b>Downloads</b></h3><b>Source</b><br />
<a href="http://xrado.hopto.org/file/open/16_e76de1db3f5d0/pygtranslator-0.1.tar.gz" >pygtranslator-0.1.tar.gz</a>
<br /><br /><b>Linux</b> <small>(require python, gtk, pygtk)</small><br />- ubuntu / debian: 
<a href="http://xrado.hopto.org/file/open/11_e58efbe272895/pygtranslator_0.1-1_i386.deb" >pygtranslator_0.1-1_i386.deb</a><br />- zenwalk: 
<a href="http://xrado.hopto.org/file/open/15_98413d02cc3a3/pygtranslator-0.1-noarch-54.1.tgz" >pygtranslator-0.1-noarch-54.1.tgz</a> 
<a href="http://xrado.hopto.org/file/open/14_09d400d2065bd/pygtranslator-0.1-noarch-54.1.md5">md5</a> 
<a href="http://xrado.hopto.org/file/open/13_7b06ac326297e/pygtranslator-0.1-noarch-54.1.dep">dep</a><br /><br />
<b>Windows</b> <small>(require <a href="http://gtk-win.sourceforge.net/home/index.php/en/Downloads">GTK2 runtime</a>)</small><br />
<a href="http://xrado.hopto.org/file/open/17_afb50d462de32/pygtranslator-0.1-win32.zip" >pygtranslator-0.1-win32.zip</a><br /><br />]]></content:encoded>
				<guid>http://xrado.hopto.org/post/pygtranslator-gui-tool-for-google-translate</guid>
				<pubDate>Thu, 11 Dec 2008 19:10:13 +0100</pubDate>
			</item>
		
	</channel>
</rss>
