<?xml version="1.0" encoding="utf-8" ?>

<rss version="0.91" >
<channel>
<title>Raimund Meyer's personal blog</title>
<link>http://x-webservice.net/</link>
<description>var life = this.live();</description>
<language>de</language>
<image>
        <url>http://x-webservice.net/templates/default/img/s9y_banner_small.png</url>
        <title>RSS: Raimund Meyer's personal blog - var life = this.live();</title>
        <link>http://x-webservice.net/</link>
        <width>100</width>
        <height>21</height>
    </image>

<item>
    <title>JavaScript clone object</title>
    <link>http://x-webservice.net/archives/6-JavaScript-clone-object</link>

    <description>
        &lt;p&gt;Since I did not easily find a good all browser, all kinds of object cloning funtion on the net, here&#039;s my one&lt;/p&gt; 
  &lt;pre&gt;function cloneObject (obj)
{
  if ( !obj )
  {
    return null;
  }

  // check for function, RegExp, and Date objects, and non-object types
  if ( typeof obj != &#039;object&#039; || obj instanceof Function || obj instanceof RegExp || obj instanceof Date)
  {
    newObj = obj; // just copy reference to it
  }
  else
  {
    var newObj = (obj instanceof Array) ? [] : {};
    for ( var n in obj )
    {
      var node = obj[n];
      if ( typeof node == &#039;object&#039; )
      {
        newObj[n] = cloneObject(node);
      }
      else
      {
        newObj[n] = node;
      }
    }
  }

  return newObj;
};

var x = {a: 1, b : &quot;OK&quot;, c : /test$/, d: [1,2], e : {a:&#039;OK&#039;}, f: function(arg){alert(arg)}};
var y = cloneObject(x);

alert(typeof y.a +&#039;: &#039;+y.a);
alert(typeof y.b +&#039;: &#039;+y.b);
alert(&#039;RegExp: &#039; +&#039;true: &#039;+y.c.test(&quot;test&quot;) + &#039; false: &#039;+y.c.test(&quot;testx&quot;));
alert(&#039;Array: &#039; + y.d.join(&#039; joinedWith &#039;));
alert(&#039;Object: &#039; + y.e.a);

y.f(&#039;Function: OK&#039;);

function myClass(a, b)
{
  this.prop = &#039;Custom Class method call: OK&#039;;
}

myClass.prototype.func = function()
{
  alert(this.prop)
}

var t = new myClass();
tClone = cloneObject(t);

tClone.func();
alert(&#039;instanceof myClass: &#039; + (tClone instanceof myClass)); //unfortunately this does not work 
&lt;/pre&gt; 
  &lt;p&gt;&lt;br /&gt;&lt;/p&gt; 
    </description>
</item>
<item>
    <title>Javascript class inheritance</title>
    <link>http://x-webservice.net/archives/5-Javascript-class-inheritance</link>

    <description>
        &lt;p&gt;I always believed there was no such thing as class inheritance in Javascript. As I&#039;m just working on a rather large Javascript application I thought I might well use a derived class an discovered that there is really a way to do it.&lt;/p&gt; 
  &lt;pre&gt;function a()
{
	
}

a.prototype.propA = &#039;Hello&#039;;

a.prototype.methodA = function()
{
	this.thisPropA = &#039;World&#039;;
}

function b()
{
	a.apply(this, arguments);
  this.methodA();
	this.thisPropB = &#039;works!&#039;
}

b.prototype = new a();
b.prototype.propB = &#039;It&#039;;
b.prototype.method2 = function()
{
	alert(this.thisPropA + &#039; &#039; + this.propA + &#039; &#039; + this.propB + &#039; &#039; + this.thisPropB)
}


o = new b();
o.method2();
&amp;#160;&lt;/pre&gt; 
  &lt;p&gt;To inherit from one class, you have to assign an instance of it to the protopype of the derived class. It seems not very explicit, but it works as expected. To call the parent constructor you have to use its apply() method to execute it in the this-context of the derived class. &lt;br /&gt;&lt;/p&gt; 
    </description>
</item>
<item>
    <title>JavaScript Array sort function for umlauts and numbers</title>
    <link>http://x-webservice.net/archives/4-JavaScript-Array-sort-function-for-umlauts-and-numbers</link>

    <description>
        &lt;pre&gt;Array.prototype.jsCoreSort = Array.prototype.sort;
Array.prototype.sort = function(comparisonFunction)
{
	if(typeof comparisonFunction != &#039;function&#039;)
	{
		comparisonFunction = function(a, b){
			if (typeof parseInt(a,10) == &#039;number&#039; &amp;amp;&amp;amp; typeof parseInt(b,10) == &#039;number&#039;)
			{
				return parseInt(a,10)-parseInt(b,10);
			}
			else 
			{
				if (typeof a != &#039;string&#039;) a = a.toString();
				var r = function (str){
					str = str.toLowerCase();
					str = str.replstrce(/ä/g,&quot;a&quot;);
					str = str.replstrce(/ö/g,&quot;o&quot;);
					str = str.replstrce(/ü/g,&quot;u&quot;);
					str = str.replstrce(/ß/g,&quot;s&quot;);
					
					return str;
				}
				a = r(a);
			
				if (typeof b != &#039;string&#039;) b = b.toString();
				b = r(b);
			
				return(a==b)?0:(a&amp;gt;b)?1:-1;
			}
		}
	}
	this.jsCoreSort(comparisonFunction);
}
&lt;/pre&gt; 
  &lt;p&gt;Thanks to &lt;a href=&quot;http://www.brain4.de/programmierecke/js/arraySort.php&quot;&gt;http://www.brain4.de/programmierecke/js/arraySort.php&lt;/a&gt; for the comparison function &lt;/p&gt; 
    </description>
</item>
<item>
    <title>Compiz Fusion and two monitors</title>
    <link>http://x-webservice.net/archives/3-Compiz-Fusion-and-two-monitors</link>

    <description>
        If you have two monitors on a nvidia card and want to enable desktop effects, use TwinView and not Xinerama! 
    </description>
</item>
<item>
    <title>Open images in Photoshop in Linux with wine</title>
    <link>http://x-webservice.net/archives/2-Open-images-in-Photoshop-in-Linux-with-wine</link>

    <description>
        &lt;p&gt;I&#039;m&amp;#160; glad that it&#039;s possible using Photoshop in Linux, but the lack of desktop integration is so irritating. Placing this script in /usr/bin as photoshop makes it possible to open images with double click or context menu&lt;br /&gt;&lt;/p&gt; 
  &lt;pre&gt;#!/bin/sh
wine &quot;C:\Programme\Adobe\Photoshop CS\Photoshop.exe&quot;  &quot;`winepath -w $*`&quot;
 &lt;/pre&gt;
  &lt;p&gt;
And don&#039;t forget to make it executable:&lt;/p&gt;
  &lt;pre&gt;chmod +x /usr/bin/photoshop
&lt;/pre&gt; 
    </description>
</item>
<item>
    <title>Use Xinha instead of HTMLArea in Serendipity</title>
    <link>http://x-webservice.net/archives/1-Use-Xinha-instead-of-HTMLArea-in-Serendipity</link>

    <description>
        Just installed Serendipity and saw, omg, they use HTMLArea. Of course I
instantly uploaded Xinha in the very htmlarea folder and voilà, works
like a charm. Very content with backward compatibility 
    </description>
</item>

</channel>
</rss>
