<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Virtualzone</title>
	<atom:link href="http://www.virtualzone.de/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.virtualzone.de</link>
	<description>Heiner Peuser&#039;s Blog: Tutorials, How-Tos, Software.</description>
	<lastBuildDate>Sun, 08 Jan 2012 13:24:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Increasing Google Chrome&#8217;s Scroll Speed</title>
		<link>http://www.virtualzone.de/2012-01-08/increasing-google-chromes-scroll-speed/</link>
		<comments>http://www.virtualzone.de/2012-01-08/increasing-google-chromes-scroll-speed/#comments</comments>
		<pubDate>Sun, 08 Jan 2012 13:24:20 +0000</pubDate>
		<dc:creator>heiner</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.virtualzone.de/?p=194</guid>
		<description><![CDATA[On my Ubuntu 11.10 system, scrolling through pages using Google Chrome was terribly slow using the mouse wheel. Here is an easy way to fix this: Launch Chrome with the parameter --scroll-pixels=n, where n is the number of pixels to scroll. For example: google-chrome --scroll-pixels=400 To integrate this parameter into the desktop shortcut link, open [...]]]></description>
			<content:encoded><![CDATA[<p>On my Ubuntu 11.10 system, scrolling through pages using Google Chrome was terribly slow using the mouse wheel.</p>
<p>Here is an easy way to fix this: Launch Chrome with the parameter --scroll-pixels=n, where n is the number of pixels to scroll. For example:<br />
google-chrome --scroll-pixels=400</p>
<p>To integrate this parameter into the desktop shortcut link, open the following file as root: /usr/share/applications/google-chrome.desktop</p>
<p>Search for the line "Exec=/opt/google/chrome/google-chrome %U" and replace it with "Exec=/opt/google/chrome/google-chrome --scroll-pixels=400 %U". Now, you can easily start Chrome using your desktop shortcut and the mouse scroll speed should be improved.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.virtualzone.de/2012-01-08/increasing-google-chromes-scroll-speed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java&#8217;s SecureRandom.generateSeed() on Linux</title>
		<link>http://www.virtualzone.de/2011-10-24/javas-securerandom-generateseed-on-linux/</link>
		<comments>http://www.virtualzone.de/2011-10-24/javas-securerandom-generateseed-on-linux/#comments</comments>
		<pubDate>Mon, 24 Oct 2011 18:39:15 +0000</pubDate>
		<dc:creator>heiner</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.virtualzone.de/?p=182</guid>
		<description><![CDATA[On my Ubuntu server, running the following Java code caused the application to hang: for &#40;int i=1; i&#38;lt;=1000; i++&#41; &#123; SecureRandom random = new SecureRandom&#40;&#41;; // Deprecated: byte[] iv = random.getSeed(16); byte&#91;&#93; iv = random.generateSeed&#40;16&#41;; System.out.println&#40;i&#41;; &#125; The code runs smoothly on Windows,  but hangs on Linux. I found out that with Java 5 or [...]]]></description>
			<content:encoded><![CDATA[<p>On my Ubuntu server, running the following Java code caused the application to hang:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> i<span style="color: #339933;">=</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> i<span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;=</span><span style="color: #cc66cc;">1000</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #003399;">SecureRandom</span> random <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">SecureRandom</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #666666; font-style: italic;">// Deprecated: byte[] iv = random.getSeed(16);</span>
	<span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> iv <span style="color: #339933;">=</span> random.<span style="color: #006633;">generateSeed</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">16</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>The code runs smoothly on Windows,  but hangs on Linux. I found out that with Java 5 or later, you need to run your application with the following parameter:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">-Djava.security.egd=<span style="color: #c20cb9; font-weight: bold;">file</span>:<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>.<span style="color: #000000; font-weight: bold;">/</span>urandom</pre></div></div>

<p>Alternatively, you can modify the file jre/lib/security/java.security so that the following property is set permanently:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">securerandom.source=<span style="color: #c20cb9; font-weight: bold;">file</span>:<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>.<span style="color: #000000; font-weight: bold;">/</span>urandom</pre></div></div>

<p>This applies to JRE 5, JRE 6 and JRE 7.</p>
<p>By the way: In Java 1.4, the default setting is <span class="Apple-style-span" style="font-family: Consolas, Monaco, monospace; font-size: 12px; line-height: 18px; white-space: pre;">/dev/random</span>, which tends to block if there is no I/O action. Changing the setting to <span class="Apple-style-span" style="font-family: Consolas, Monaco, monospace; font-size: 12px; line-height: 18px; white-space: pre;">/dev/urandom </span>(as above) fixes the issue here.</p>
<p>For further information, have a look at <a href="http://bugs.sun.com/view_bug.do?bug_id=6202721" target="_blank">this bug report</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.virtualzone.de/2011-10-24/javas-securerandom-generateseed-on-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to set up a chrooted Debian Environment on Fritz!Box Fon WLAN 7390</title>
		<link>http://www.virtualzone.de/2011-07-17/debian-debootstrap-chroot-fritzbox-7390/</link>
		<comments>http://www.virtualzone.de/2011-07-17/debian-debootstrap-chroot-fritzbox-7390/#comments</comments>
		<pubDate>Sun, 17 Jul 2011 14:41:14 +0000</pubDate>
		<dc:creator>heiner</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.virtualzone.de/?p=157</guid>
		<description><![CDATA[Setting up a chrooted Debian Environment on the Fritz!Box 7390 allows you to run almost any software on your Fritz!Box (at least, if it's compatible with the box' MIPS CPU). These instructions shouldn't harm your Fritz!Box if you follow them carefully - however, there's no warranty, you do it on your own risk. To get [...]]]></description>
			<content:encoded><![CDATA[<p>Setting up a chrooted Debian Environment on the Fritz!Box 7390 allows you to run almost any software on your Fritz!Box (at least, if it's compatible with the box' MIPS CPU). These instructions shouldn't harm your Fritz!Box if you follow them carefully - however, there's no warranty, you do it on your own risk.</p>
<p>To get started, you need the following:</p>
<ul>
<li>A Debian based system with debootstrap installed (aptitude install debootstrap)</li>
<li>Telnet must be activated on the Fritz!Box (with latest firmware, just call #96*7*)</li>
<li>An USB flash drive with at least 512 MB free space, formatted as ext2/3</li>
</ul>
<p>Note: We will set up Debian Lenny, as Debian Squeeze seems not to be compatible with the kernel employed by the Fritz!Box. You will get errors like "Cannot utime: Unknown error" using dpkg or tar with Squeeze. Read <a href="http://www.ip-phone-forum.de/showthread.php?t=232258" target="_blank">here</a> (German) and <a href="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=613738" target="_blank">here</a> for more information.</p>
<p>The entire setup takes about one hour.</p>
<p>Let's start:</p>
<ol>
<li>On the Debian based system, mount the USB flash drive and create a new directory 'lenny' on it.</li>
<li>Execute the following command (after correcting the path to your lenny folder):<br />
debootstrap --foreign --arch=mips lenny /mnt/usb/lenny ftp://ftp.de.debian.org/debian/</li>
<li>After debootstrap completed, connect the USB flash drive to the Fritz!Box.</li>
<li>Log in to the Fritz!Box via Telnet. When prompted for a password, use the one you set for the web interface.</li>
<li>Change directory to /var/media/ftp/. Your USB flash drive should be mounted automatically as USB2-0-FlashDisk-00.</li>
<li>Get a Busybox version that features chroot, such as the busybox_1.16.1_7390_static.bz2 from <a href="http://www.ip-phone-forum.de/showthread.php?t=210107&amp;page=2" target="_blank">here</a> and extract it into the current folder.</li>
<li>Mount proc: mount -t proc proc /var/media/ftp/USB2-0-FlashDisk-00/lenny/proc</li>
<li>Let debootstrap complete the installation: ./busybox_1.16.1_7390_static chroot /var/media/ftp/USB2-0-FlashDisk-00/lenny /debootstrap/debootstrap --second-stage</li>
<li>The installation is completed now. You can use the following script to chroot into your freshly installed Debian environment:

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>media<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">ftp</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">DISTDIR</span>=USB2-<span style="color: #000000;">0</span>-FlashDisk-00<span style="color: #000000; font-weight: bold;">/</span>lenny
<span style="color: #c20cb9; font-weight: bold;">umount</span> <span style="color: #007800;">$DISTDIR</span><span style="color: #000000; font-weight: bold;">/</span>proc
<span style="color: #c20cb9; font-weight: bold;">mount</span> <span style="color: #660033;">-t</span> proc proc <span style="color: #007800;">$DISTDIR</span><span style="color: #000000; font-weight: bold;">/</span>proc
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-f</span> <span style="color: #007800;">$DISTDIR</span><span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>fstab
<span style="color: #c20cb9; font-weight: bold;">touch</span> <span style="color: #007800;">$DISTDIR</span><span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>fstab
<span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #660033;">-f</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>resolv.conf <span style="color: #007800;">$DISTDIR</span><span style="color: #000000; font-weight: bold;">/</span>etc
<span style="color: #c20cb9; font-weight: bold;">hostname</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #007800;">$DISTDIR</span><span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">hostname</span>
<span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #660033;">-f</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>hosts <span style="color: #007800;">$DISTDIR</span><span style="color: #000000; font-weight: bold;">/</span>etc
.<span style="color: #000000; font-weight: bold;">/</span>busybox_1.16.1_7390_static <span style="color: #c20cb9; font-weight: bold;">chroot</span> <span style="color: #007800;">$DISTDIR</span> <span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">bash</span></pre></div></div>

</li>
</ol>
<p>Thanks to the users at <a href="http://www.ip-phone-forum.de/" target="_blank">IP-Phone-Forum.de</a> and <a href="http://freetz.org/wiki/packages/debootstrap" target="_blank">Freetz.org</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.virtualzone.de/2011-07-17/debian-debootstrap-chroot-fritzbox-7390/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to use Apache HttpClient (DefaultHttpClient) with HTTPS/SSL on Android</title>
		<link>http://www.virtualzone.de/2011-02-27/how-to-use-apache-httpclient-with-httpsssl-on-android/</link>
		<comments>http://www.virtualzone.de/2011-02-27/how-to-use-apache-httpclient-with-httpsssl-on-android/#comments</comments>
		<pubDate>Sun, 27 Feb 2011 11:42:35 +0000</pubDate>
		<dc:creator>heiner</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[HttpClient]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.virtualzone.de/?p=134</guid>
		<description><![CDATA[Connecting to an HTTPS address using the Apache HttpClient shipped with Android is not so straight forward. Whether the server's certificate as correct or not, you will probably see one of these exceptions: javax.net.ssl.SSLPeerUnverifiedException: No peer certificate. Here is a "quick and dirty" solution which makes the HttpClient trust any certificate without verifying it (not [...]]]></description>
			<content:encoded><![CDATA[<p>Connecting to an HTTPS address using the Apache HttpClient shipped with Android is not so straight forward. Whether the server's certificate as correct or not, you will probably see one of these exceptions:</p>
<pre>javax.net.ssl.SSLPeerUnverifiedException: No peer certificate.</pre>
<p>Here is a "quick and dirty" solution which makes the HttpClient trust any certificate without verifying it (not recommended to be used in productive environments, of course). <a title="How to use Apache HttpClient (DefaultHttpClient) with HTTPS/SSL on Android" href="http://www.virtualzone.de/2011-02-27/how-to-use-apache-httpclient-with-httpsssl-on-android/">Read more...</a></p>
<p><span id="more-134"></span></p>
<h3>1. Getting the necessary classes</h3>
<p>Get the classes EasySSLSocketFactory and EasyX509TrustManager from <a href="http://code.google.com/p/exchangeit/source/browse/trunk/src/com/byarger/exchangeit/" target="_blank">here</a>.</p>
<p>Open the EasySSLSocketFactory class and modify the following method in this way:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">Socket</span> createSocket<span style="color: #009900;">&#40;</span><span style="color: #003399;">Socket</span> socket, <span style="color: #003399;">String</span> host, <span style="color: #000066; font-weight: bold;">int</span> port, <span style="color: #000066; font-weight: bold;">boolean</span> autoClose<span style="color: #009900;">&#41;</span>
<span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">IOException</span>, <span style="color: #003399;">UnknownHostException</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #666666; font-style: italic;">//return getSSLContext().getSocketFactory().createSocket();</span>
	<span style="color: #000000; font-weight: bold;">return</span> getSSLContext<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getSocketFactory</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">createSocket</span><span style="color: #009900;">&#40;</span>socket, host, port, autoClose<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>The modification is necessary to avoid the following error:</p>
<pre>javax.net.ssl.SSLException: SSL handshake aborted: ssl=0x2cb0e8: I/O error during system call. Broken Pipe</pre>
<h3>2. Making it work</h3>
<p>Use the following code to create an instance of DefaultHttpClient which will accept connections to HTTPS hosts without verifying the SSL certificate:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">SchemeRegistry schemeRegistry <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> SchemeRegistry<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
schemeRegistry.<span style="color: #006633;">register</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> Scheme<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;http&quot;</span>, PlainSocketFactory.<span style="color: #006633;">getSocketFactory</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, <span style="color: #cc66cc;">80</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
schemeRegistry.<span style="color: #006633;">register</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> Scheme<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;https&quot;</span>, <span style="color: #000000; font-weight: bold;">new</span> EasySSLSocketFactory<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, <span style="color: #cc66cc;">443</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
HttpParams params <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> BasicHttpParams<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
params.<span style="color: #006633;">setParameter</span><span style="color: #009900;">&#40;</span>ConnManagerPNames.<span style="color: #006633;">MAX_TOTAL_CONNECTIONS</span>, <span style="color: #cc66cc;">30</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
params.<span style="color: #006633;">setParameter</span><span style="color: #009900;">&#40;</span>ConnManagerPNames.<span style="color: #006633;">MAX_CONNECTIONS_PER_ROUTE</span>, <span style="color: #000000; font-weight: bold;">new</span> ConnPerRouteBean<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">30</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
params.<span style="color: #006633;">setParameter</span><span style="color: #009900;">&#40;</span>HttpProtocolParams.<span style="color: #006633;">USE_EXPECT_CONTINUE</span>, <span style="color: #000066; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
HttpProtocolParams.<span style="color: #006633;">setVersion</span><span style="color: #009900;">&#40;</span>params, HttpVersion.<span style="color: #006633;">HTTP_1_1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
ClientConnectionManager cm <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> SingleClientConnManager<span style="color: #009900;">&#40;</span>params, schemeRegistry<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">httpClient</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> DefaultHttpClient<span style="color: #009900;">&#40;</span>cm, params<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Source: <a href="http://stackoverflow.com/questions/1217141/self-signed-ssl-acceptance-android" target="_blank">http://stackoverflow.com/questions/1217141/self-signed-ssl-acceptance-android</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.virtualzone.de/2011-02-27/how-to-use-apache-httpclient-with-httpsssl-on-android/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Creating &amp; Parsing WBXML with Java using kXML 2</title>
		<link>http://www.virtualzone.de/2011-02-25/creating-parsing-wbxml-with-java-using-kxml-2/</link>
		<comments>http://www.virtualzone.de/2011-02-25/creating-parsing-wbxml-with-java-using-kxml-2/#comments</comments>
		<pubDate>Fri, 25 Feb 2011 00:31:30 +0000</pubDate>
		<dc:creator>heiner</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[WBXML]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.virtualzone.de/?p=124</guid>
		<description><![CDATA[WBXML (WAP Binary XML) is a binary representation of XML. It is used e.g. by the Microsoft Exchange ActiveSync protocol. Only very few WBXML parsers for Java seem to be available. One of the libraries you will probably come across when searching for a WBXML Java Library is kXML. kXML is a small XML pull parser, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://en.wikipedia.org/wiki/WBXML" target="_blank">WBXML (WAP Binary XML)</a> is a binary representation of XML. It is used e.g. by the Microsoft Exchange ActiveSync protocol.</p>
<p>Only very few WBXML parsers for Java seem to be available. One of the libraries you will probably come across when searching for a WBXML Java Library is <a href="http://kxml.sourceforge.net/kxml2/" target="_blank">kXML</a>. kXML is a small XML pull parser, specially designed for constrained environments such as Applets, Personal Java or MIDP devices (see <a href="http://kxml.sourceforge.net/about.shtml" target="_blank">kXML's about page</a>).</p>
<p>Getting started with kXML is a bit tricky, since you find only a handful of tutorials that are suitable for kXML 2. These snippets should make it easier for you. <a title="Creating &amp; Parsing WBXML with Java using kXML 2" href="http://www.virtualzone.de/2011-02-25/creating-parsing-wbxml-with-java-using-kxml-2/">Read more...</a><span id="more-124"></span></p>
<p><strong>Converting WBXML to XML:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #003399;">InputStream</span> in <span style="color: #339933;">=</span> ...... <span style="color: #666666; font-style: italic;">// TODO</span>
WbxmlParser parser <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> WbxmlParser<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// You may want to set some code pages here using parser.setTagTable()</span>
parser.<span style="color: #006633;">setInput</span><span style="color: #009900;">&#40;</span>in, <span style="color: #0000ff;">&quot;UTF-8&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003399;">Document</span> dom <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Document</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
dom.<span style="color: #006633;">parse</span><span style="color: #009900;">&#40;</span>parser<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #003399;">ByteArrayOutputStream</span> out <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">ByteArrayOutputStream</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
KXmlSerializer ser <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> KXmlSerializer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
ser.<span style="color: #006633;">setOutput</span><span style="color: #009900;">&#40;</span>out, <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
dom.<span style="color: #006633;">write</span><span style="color: #009900;">&#40;</span>ser<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
ser.<span style="color: #006633;">flush</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> b <span style="color: #339933;">=</span> out.<span style="color: #006633;">toByteArray</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">String</span><span style="color: #009900;">&#40;</span>b<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p><strong>Converting XML to WBXML:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #003399;">InputStream</span> in <span style="color: #339933;">=</span> ...... <span style="color: #666666; font-style: italic;">// TODO</span>
KXmlParser parser <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> KXmlParser<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
parser.<span style="color: #006633;">setInput</span><span style="color: #009900;">&#40;</span>in, <span style="color: #0000ff;">&quot;UTF-8&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003399;">Document</span> dom <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Document</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
dom.<span style="color: #006633;">parse</span><span style="color: #009900;">&#40;</span>parser<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #003399;">ByteArrayOutputStream</span> out <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">ByteArrayOutputStream</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
WbxmlSerializer ser <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> WbxmlSerializer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// You may want to set some code pages here using ser.setTagTable()</span>
ser.<span style="color: #006633;">setOutput</span><span style="color: #009900;">&#40;</span>out, <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
dom.<span style="color: #006633;">write</span><span style="color: #009900;">&#40;</span>ser<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
ser.<span style="color: #006633;">flush</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> b <span style="color: #339933;">=</span> out.<span style="color: #006633;">toByteArray</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">String</span><span style="color: #009900;">&#40;</span>b<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p><strong>Working with Code Pages / Tag Tables</strong></p>
<p>Code pages/tag tables specify which tag string is encoded by which integer. The protocol you're about to implement defines its own tag table - so you will have to tage a look at its specifications. Please refer to the the <a href="http://www.w3.org/TR/wbxml/" target="_blank">W3C WBXML documentation</a> for further information.</p>
<p>Here is a small example:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">String</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> TAG_TABLE_0 <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #0000ff;">&quot;Tag1&quot;</span>, <span style="color: #666666; font-style: italic;">// 0x05</span>
	<span style="color: #0000ff;">&quot;Tag2&quot;</span>, <span style="color: #666666; font-style: italic;">// 0x06</span>
	<span style="color: #0000ff;">&quot;Tag3&quot;</span>, <span style="color: #666666; font-style: italic;">// 0x07</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">String</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> TAG_TABLE_1 <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #666666; font-style: italic;">// ...</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
parser.<span style="color: #006633;">setTagTable</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span>, TAG_TABLE_0<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
parser.<span style="color: #006633;">setTagTable</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span>, TAG_TABLE_1<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
parser.<span style="color: #006633;">setTagTable</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">2</span>, ...<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.virtualzone.de/2011-02-25/creating-parsing-wbxml-with-java-using-kxml-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Android SDK with 64bit Java SE Development Kit (JDK)</title>
		<link>http://www.virtualzone.de/2011-02-23/android-sdk-with-64bit-java-se-development-kit-jdk/</link>
		<comments>http://www.virtualzone.de/2011-02-23/android-sdk-with-64bit-java-se-development-kit-jdk/#comments</comments>
		<pubDate>Wed, 23 Feb 2011 15:22:25 +0000</pubDate>
		<dc:creator>heiner</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.virtualzone.de/?p=118</guid>
		<description><![CDATA[The Android SDK installer (r10 in my case) doesn't support the 64bit version of the Java SE Development Kit (JDK) out of the box. You will see an error message such as "Java SE Development Kit (JDK) not found". Instead of installing the 32bit version of JDK, try the following workaround that I've found in [...]]]></description>
			<content:encoded><![CDATA[<p>The Android SDK installer (r10 in my case) doesn't support the 64bit version of the Java SE Development Kit (JDK) out of the box. You will see an error message such as "Java SE Development Kit (JDK) not found".</p>
<p>Instead of <a href="http://blog.janjonas.net/2011-01-14/windows-android-sdk-installer-does-not-find-java-development-kit-jdk" target="_blank">installing the 32bit version of JDK</a>, try the following workaround that I've found in the <a href="http://codearetoy.wordpress.com/2010/12/23/jdk-not-found-on-installing-android-sdk/" target="_blank">codearetoy blog</a>.</p>
<p><em>Warning:</em> Use these instructions at your own risk! Damaging the registry may lead to unexpected results and/or data loss!</p>
<ol>
<li>Open regedit.</li>
<li>Navigate to HKEY_LOCAL_MACHINE\Software\JavaSoft\</li>
<li>Export the entire content.</li>
<li>Open the .reg-File you've saved the export to with an editor and replace "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\" with "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\JavaSoft\".</li>
<li>Double-click the .reg-File to run the import.</li>
<li>Run the Android SDK installer again - it should work now.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.virtualzone.de/2011-02-23/android-sdk-with-64bit-java-se-development-kit-jdk/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Outlook Web Access 2010: HTTP 500 Error after authentication</title>
		<link>http://www.virtualzone.de/2011-02-07/outlook-web-access-2010-http-500-error-after-authentication/</link>
		<comments>http://www.virtualzone.de/2011-02-07/outlook-web-access-2010-http-500-error-after-authentication/#comments</comments>
		<pubDate>Mon, 07 Feb 2011 15:25:13 +0000</pubDate>
		<dc:creator>heiner</dc:creator>
				<category><![CDATA[Exchange Server]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.virtualzone.de/?p=112</guid>
		<description><![CDATA[If you experience HTTP 500 Errors after logging in to Microsoft Outlook Web Access (OWA) powered by Microsoft's Exchange Server 2010 SP1, you should check if the service "Microsoft Exchange Forms-Based Authentication" (in German versions: "Formularbasierter Microsoft Exchange-Authentifizierungsdienst", MSExchangeFBA) is running. If it's not, start it and change the run option to "Automatic (delayed run)".]]></description>
			<content:encoded><![CDATA[<p>If you experience HTTP 500 Errors after logging in to Microsoft Outlook Web Access (OWA) powered by Microsoft's Exchange Server 2010 SP1, you should check if the service "Microsoft Exchange Forms-Based Authentication" (in German versions: "Formularbasierter Microsoft Exchange-Authentifizierungsdienst", MSExchangeFBA) is running. If it's not, start it and change the run option to "Automatic (delayed run)".</p>
]]></content:encoded>
			<wfw:commentRss>http://www.virtualzone.de/2011-02-07/outlook-web-access-2010-http-500-error-after-authentication/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Server Name Indication (SNI) with IIS 7.5</title>
		<link>http://www.virtualzone.de/2011-02-07/server-name-indication-sni-with-iis-7-5/</link>
		<comments>http://www.virtualzone.de/2011-02-07/server-name-indication-sni-with-iis-7-5/#comments</comments>
		<pubDate>Mon, 07 Feb 2011 15:14:28 +0000</pubDate>
		<dc:creator>heiner</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.virtualzone.de/?p=110</guid>
		<description><![CDATA[Using virtual hosts with HTTPS (so called "Server Name Indication"/SNI) is officially not supported by Microsoft's Internet Information Services IIS. However, there is a workaround which has been documented on YouTube: http://www.youtube.com/watch?v=zVCmzBfx3BE Here are the steps: Edit the site's binding and add an HTTPS Binding. Ignore the host header now, this will be added later. [...]]]></description>
			<content:encoded><![CDATA[<p>Using virtual hosts with HTTPS (so called "Server Name Indication"/SNI) is officially not supported by Microsoft's Internet Information Services IIS. However, there is a workaround which has been documented on YouTube: <a href="http://www.youtube.com/watch?v=zVCmzBfx3BE">http://www.youtube.com/watch?v=zVCmzBfx3BE</a></p>
<p>Here are the steps:</p>
<ol>
<li>Edit the site's binding and add an HTTPS Binding. Ignore the host header now, this will be added later.</li>
<li>Open a command prompt (cmd).</li>
<li>Change directory to C:\Windows\system32\inetsvr</li>
<li>Enter the following command (replace "Your Site Name" and "www.yoursite.com" with the appropriate values): appcmd set site /site.name:"Your Site Name" /bindings.[protocol='https',bindingInformation='*:443:'].bindingInformation:*:443:www.yoursite.com</li>
</ol>
<p><strong>Update:</strong> Unfortunately, this doesn't seem to be a solution for  SNI. IIS can only bind certificates to IP addresses, not hosts. So if you change the certificate for one site on one IP address, all sites hosted on this IP address will be updated as well. So far, the only solution to use different certificates with a single IP address is to use different TCP Ports. However, the guide above allows you to set up multiple SSL hosts sharing one certificate on one IP address/port.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.virtualzone.de/2011-02-07/server-name-indication-sni-with-iis-7-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Error 0&#215;80070021 when using lighttpd&#8217;s WebDAV with Windows 7</title>
		<link>http://www.virtualzone.de/2010-12-06/error-0x8007002-when-using-lighttpds-webdav-with-windows-7/</link>
		<comments>http://www.virtualzone.de/2010-12-06/error-0x8007002-when-using-lighttpds-webdav-with-windows-7/#comments</comments>
		<pubDate>Mon, 06 Dec 2010 15:33:27 +0000</pubDate>
		<dc:creator>heiner</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.virtualzone.de/?p=105</guid>
		<description><![CDATA[When trying to use WebDAV provided by a lighttpd installation with Windows 7, you will probably encounter the following error message when copying files to the WebDAV folder: Error 0x80070021: The process cannot acess the file because another process has locked a portion of the file. The reason for this error is that mod_webdav is [...]]]></description>
			<content:encoded><![CDATA[<p>When trying to use WebDAV provided by a lighttpd installation with Windows 7, you will probably encounter the following error message when copying files to the WebDAV folder:</p>
<p>Error 0x80070021: The process cannot acess the file because another process has locked a portion of the file.</p>
<p>The reason for this error is that mod_webdav is "far away from 100%" (see <a href="http://redmine.lighttpd.net/wiki/1/Docs:ModWebDAV">http://redmine.lighttpd.net/wiki/1/Docs:ModWebDAV</a>). I guess it's caused by the circumstance that shared locks are handles as exclusive locks (not sure about that). There is a bug open in lighttpd's issue tracker for 3 years: <a href="http://redmine.lighttpd.net/issues/1492">http://redmine.lighttpd.net/issues/1492</a></p>
<p>For now, the only opportunity I see is to switch to Apache. That's really sad, lighty is so nice except for this bug.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.virtualzone.de/2010-12-06/error-0x8007002-when-using-lighttpds-webdav-with-windows-7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tomcat &amp; Apache: High CPU Usage</title>
		<link>http://www.virtualzone.de/2010-11-30/tomcat-apache-high-cpu-usage/</link>
		<comments>http://www.virtualzone.de/2010-11-30/tomcat-apache-high-cpu-usage/#comments</comments>
		<pubDate>Tue, 30 Nov 2010 10:17:56 +0000</pubDate>
		<dc:creator>heiner</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.virtualzone.de/?p=86</guid>
		<description><![CDATA[Summary: Tomcat running behing an Apache Frontend Server can cause high CPU Usage on the Java Process. Here are several approaches how to fix it. Setup: Debian GNU/Linux, Java Runtime Environment (JRE) 1.6, Apache 2.2, Tomcat 6.0.29, mod_jk/mod_proxy Effect: Accessing web applications directly through Tomcat doesn't cause any problems. When accessing web applications through the [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Summary: </strong>Tomcat running behing an Apache Frontend Server can cause high CPU Usage on the Java Process. Here are several approaches how to fix it.</p>
<p><strong>Setup:</strong> Debian GNU/Linux, Java Runtime Environment (JRE) 1.6, Apache 2.2, Tomcat 6.0.29, mod_jk/mod_proxy</p>
<p><strong>Effect: </strong>Accessing web applications directly through Tomcat doesn't cause any problems. When accessing web applications through the Apache Frontend Server (forwarding requests by using mod_proxy), it took a few seconds and the cpu usage of the Java process went up to 99.9 %. Obviously, the combination of Apache and Tomcat is causing this problem.</p>
<p><strong>Fix: </strong>There are several approaches that could help to fix the issue:</p>
<ol>
<li>Make sure you're using a newer version of the APR Tomcat Native Library than 1.1.4. See: <a href="https://issues.apache.org/bugzilla/show_bug.cgi?id=40909">https://issues.apache.org/bugzilla/show_bug.cgi?id=40909<br />
</a></li>
<li>If you're using mod_proxy to forward requests from Apache to Tomcat, switch to mod_jk. It is more mature than mod_proxy, although mod_proxy is sometimes consideres to be the successor of mod_jk. For a comparison of both, see: <a href="http://community.jboss.org/blogs/mladen.turk/2007/07/16/comparing-modproxy-and-modjk">http://community.jboss.org/blogs/mladen.turk/2007/07/16/comparing-modproxy-and-modjk<br />
</a></li>
<li>What finally solved the issue for me: Set a Connection Timeout for the AJP Connector in Tomcat's server.xml (see <a href="http://tomcat.apache.org/tomcat-6.0-doc/config/ajp.html">http://tomcat.apache.org/tomcat-6.0-doc/config/ajp.html</a>). Here is an example:
<div class="wp_syntax">
<div class="code">
<pre class="bash">&lt;!-- Define an AJP 1.3 Connector on port 8009 --&gt;
&lt;Connector port="8009" protocol="AJP/1.3" redirectPort="8443" enableLookups="false" keepAliveTimeout="20000" executor="default" connectionTimeout="5000"/&gt;</pre>
</div>
</div>
</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.virtualzone.de/2010-11-30/tomcat-apache-high-cpu-usage/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

