<?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>Boky on the roll</title>
	<atom:link href="http://www.boky.cc/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.boky.cc</link>
	<description>Rants about IT, java and development productivity</description>
	<lastBuildDate>Mon, 29 Mar 2010 09:13:59 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Optimal JVM parameters</title>
		<link>http://www.boky.cc/2010/03/29/optimal-jvm-parameters/#utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=optimal-jvm-parameters</link>
		<comments>http://www.boky.cc/2010/03/29/optimal-jvm-parameters/#comments</comments>
		<pubDate>Mon, 29 Mar 2010 09:13:59 +0000</pubDate>
		<dc:creator>boky</dc:creator>
				<category><![CDATA[it]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[system administration]]></category>

		<guid isPermaLink="false">http://www.boky.cc/?p=67</guid>
		<description><![CDATA[<br/>Since most of our software runs on JVM, we&#8217;ve had our share of experience with crashing JVMs (Out Of Any Kind Of Memory), tuning JVM and optimizing its performance. Some are on 32-bit JVMs, others on 64-bits. Some run many small applications, others run bigger applications. Some run resin, others JBoss yet there are some [...]]]></description>
			<content:encoded><![CDATA[<br/><p>Since most of our software runs on JVM, we&#8217;ve had our share of experience with crashing JVMs (Out Of Any Kind Of Memory), tuning JVM and optimizing its performance. Some are on 32-bit JVMs, others on 64-bits. Some run many small applications, others run bigger applications. Some run resin, others JBoss yet there are some running Tomcat. Most are on Linux, some&nbsp;Windows.</p>
<p>But they all have some things in common:
<ul>
<li>they must run&nbsp;24/7</li>
<li>they all run server&nbsp;VMs</li>
<li>they are all web&nbsp;applications</li>
</ul>
<p>While there is no real way to tell which options will make your JVM work best, we&#8217;ve found the following to be helpful. I thought it would be nice to&nbsp;share:</p>
<p><strong>-Xms1024m -Xmx1024m</strong><br />
Setting both Xmx and Xms to the same value will help eliminate memory fragmentation. Your application should run a bit faster, as the VM will not start at minimum and allocate additional memory as the application server / your application starts&nbsp;up.</p>
<p><strong>-XX:MaxPermSize=512M</strong><br />
You will most certainly want to increase your permanent generation size, as the default is often too small. Here we&#8217;ve set it to half of assigned memory and works quite&nbsp;fine.</p>
<p><strong>-Xmn128m</strong><br />
Change the new generation size. If your application is creating and releasing a lot of objects in short time (usually correlated with number of connections, usage of your website), you may find yourself with a JVM crashing when the &#8220;eden / new generation&#8221; has been exhausted. This will show up as &#8220;100% eden&#8221; in the crash log. Increasing the new generation size might&nbsp;help.</p>
<p><strong>-Xss2m</strong><br />
Each thread in the JVM will get its own stack. The default stack is quite small and setting it a bit higher is usually a good idea. 2048k should be enough usually appropriate for most usage scenarios, but your mileage may vary. Increased when you have really long stacks (quite common if using a servlet container + several frameworks). Your first sign of having a too short stack will be a&nbsp;<tt>StackOverflowError</tt>.</p>
<p><strong>-Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000</strong><br />
These two parameters increate garbage collection interval for RMI connections. Mostly a JBoss issue, but other app servers run just fine with this settings. Should also speed things up a&nbsp;bit.</p>
<p><strong>-Dsun.net.inetaddr.ttl=30</strong><br />
<strike>Sun&#8217;s</strike> Oracle&#8217;s JVM has a &#8220;feature&#8221; which cashes all DNS lookups. Forever. This might be an issue if the some of the external services changes IP and you don&#8217;t restart your server very often (reCaptha is one such example). Set this parameter and have JVM forget lookups after a certain&nbsp;time.</p>
<p><strong>-XX:+UseConcMarkSweepGC</strong><br />
Change the garbage collector. We&#8217;ve had better experiences using UseConcMarkSweepGC, especially on multi-processor machines. Although, it seems &#8220;G1&#8221; will be the best after it&#8217;s&nbsp;finished.</p>
<p><strong>-XX:+CMSPermGenSweepingEnabled -XX:+CMSClassUnloadingEnabled</strong><br />
Support class unloading. Usefull even in production, as it allows you to completely undeploy the previous application if you&#8217;re doing hot-deployment. One option name is old (CMSClassUnloadingEnabled) the other new (CMSPermGenSweepingEnabled) but both still work&nbsp;though.</p>
<p><strong>-Dfile.encoding=utf-8</strong><br />
Since we don&#8217;t speak US-ASCII only, we moved everything to UTF-8 several years ago. Even all our JSP pages are defined as <tt>@page encoding=&#8221;UTF-8&#8221; contentType=&#8221;..; charset=UTF-8&#8221;</tt> You would be amazed how are i18n problems just vanished. UTF-8&nbsp;rules. </p>
<p><strong>-Denvironment.type=prod</strong><br />
We &#8220;mark&#8221; our servers as &#8220;prod&#8221;, &#8220;test&#8221;  and &#8220;dev&#8221;. In ideal world this would not be necessary, but sometimes the code needs to know in which environment it runs. This helps avoid confusion and have that same setting in several different places and each person inventing his own way of determening the&nbsp;enviornment.</p>
<p><strong>-Dorg.apache.catalina.STRICT_SERVLET_COMPLIANCE=false</strong><br />
Tomcat goodie. Being too much servlet-compliant is not always a good thing<sup><small>(TM)</small></sup>. This relaxes some strange constrains that makes applications&thinsp;&#8212;&thinsp;especially ones ported from other servlet containers&thinsp;&#8212;&thinsp;run better. Sometimes, applications will not run without this parameter at all. If you&#8217;re concerned about cross-container compatibility, leave this parameter out and develop exclusively on Tomcat. If you&#8217;re running applications developed by different teams and/or vendors, by all means, put it&nbsp;in. </p>
<p><strong>-XX:+UseCompressedOops</strong><br />
Using compressed oopts will decrease your memory usage when running 64-bit JVMs. In a nutshell, it tells JVM to use 32-bit pointers around the code (where&nbsp;possible).</p>
<p><strong>-ea</strong><br />
<span style="color:red">For development/staging only.</span> Enable assertions. If you&#8217;re a prudent developer, you&#8217;re code will have a lot of sanity checks. This will enable them. This way it&#8217;s easier to spot errors before going&nbsp;live.</p>
<p><strong>-Dcom.sun.xml.ws.transport.http.client.HttpTransportPipe.dump=true -Dcom.sun.xml.ws.transport.http.HttpAdapter.dump=true -Dcom.sun.xml.ws.util.pipe.StandaloneTubeAssembler.dump=true</strong><br />
<span style="color:red">For development/staging only.</span> Enable debugging of JAX-WS /WSIT. All communication (XMLs, HTTP trafic) of webservices will be dumped to your STDOUT. If you&#8217;re having problems with webservices and don&#8217;t know what&#8217;s wrong, sometimes this is the only way to&nbsp;go.</p>
<p>If you have any other useful options, I&#8217;d be more than happy to add them to the&nbsp;list.</p>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='title' title='Use these links to share this page with others'>Bookmark and Share</div><div class='linkbuttons'><a href='http://del.icio.us/post?url=http://www.boky.cc/2010/03/29/optimal-jvm-parameters/&amp;title=Optimal JVM parameters' title='Save to del.icio.us' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/delicious.png' style='width:16px; height:16px;' alt='[del.icio.us] ' /></a> <a href='http://digg.com/submit?phase=2&amp;url=http://www.boky.cc/2010/03/29/optimal-jvm-parameters/&amp;title=Optimal JVM parameters' title='Digg It!' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/digg.png' style='width:16px; height:16px;' alt='[Digg] ' /></a> <a href='http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://www.boky.cc/2010/03/29/optimal-jvm-parameters/&amp;title=Optimal JVM parameters' title='Save to Google Bookmarks' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/google.png' style='width:16px; height:16px;' alt='[Google] ' /></a> <a href='http://www.linkedin.com/shareArticle?mini=true&url=http://www.boky.cc/2010/03/29/optimal-jvm-parameters/&title=Optimal JVM parameters' title='Share on LinkedIn' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/linkedin.png' style='width:16px; height:16px;' alt='[LinkedIn] ' /></a> <a href='http://www.stumbleupon.com/submit?url=http://www.boky.cc/2010/03/29/optimal-jvm-parameters/&amp;title=Optimal JVM parameters' title='Stumble It!' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/stumbleupon.png' style='width:16px; height:16px;' alt='[StumbleUpon] ' /></a> <a href='https://favorites.live.com/quickadd.aspx?mkt=en-us&amp;url=http://www.boky.cc/2010/03/29/optimal-jvm-parameters/&amp;title=Optimal JVM parameters' title='Save to Windows Live' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/windowslive.png' style='width:16px; height:16px;' alt='[Windows Live] ' /></a> <a href='http://bookmarks.yahoo.com/toolbar/savebm?opener=tb&amp;u=http://www.boky.cc/2010/03/29/optimal-jvm-parameters/&amp;t=Optimal JVM parameters' title='Save to Yahoo! Bookmarks' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/yahoo.png' style='width:16px; height:16px;' alt='[Yahoo!] ' /></a> <a href='http://www.feedburner.com/fb/a/emailFlare?itemTitle=Optimal JVM parameters&amp;uri=http://www.boky.cc/2010/03/29/optimal-jvm-parameters/&amp;loc=en_US' title='Email this to a friend' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/email.png' style='width:16px; height:16px;' alt='[Email] ' /></a>  <a title='See more bookmark and sharing options...' href='http://www.boky.cc/2010/03/29/optimal-jvm-parameters/#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div><div class='brand'><small><a href='http://www.bookmarkify.com/'>Powered by Bookmarkify&trade;</a></small></div></div>]]></content:encoded>
			<wfw:commentRss>http://www.boky.cc/2010/03/29/optimal-jvm-parameters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HeuristicMixedException and jBoss</title>
		<link>http://www.boky.cc/2010/03/18/heuristicmixedexception-and-jboss/#utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=heuristicmixedexception-and-jboss</link>
		<comments>http://www.boky.cc/2010/03/18/heuristicmixedexception-and-jboss/#comments</comments>
		<pubDate>Thu, 18 Mar 2010 11:25:27 +0000</pubDate>
		<dc:creator>boky</dc:creator>
				<category><![CDATA[it]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[system administration]]></category>

		<guid isPermaLink="false">http://www.boky.cc/?p=62</guid>
		<description><![CDATA[<br/>Seen a lot of these in your jboss&#160;logs?

[com.arjuna.ats.jta.logging.loggerI18N] [com.arjuna.ats.internal.jta.resources.arjunacore.preparefailed] [com.arjuna.ats.internal.jta.resources.arjunacore.preparefailed] XAResourceRecord.prepare - prepare failed with exception XAException.XAER_RMERR
&#8230;
javax.transaction.HeuristicMixedException
        at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1390)
        at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:135)
        at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:87)
        at&#160;org.jboss.tm.usertx.client.ServerVMClientUserTransaction.commit(ServerVMClientUserTransaction.java:140)

I&#8217;ve had this issue [...]]]></description>
			<content:encoded><![CDATA[<br/><p>Seen a lot of these in your jboss&nbsp;logs?</p>
<blockquote><p>
[com.arjuna.ats.jta.logging.loggerI18N] [com.arjuna.ats.internal.jta.resources.arjunacore.preparefailed] [com.arjuna.ats.internal.jta.resources.arjunacore.preparefailed] XAResourceRecord.prepare - prepare failed with exception XAException.XAER_RMERR<br />
&#8230;<br />
javax.transaction.HeuristicMixedException<br />
        at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1390)<br />
        at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:135)<br />
        at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:87)<br />
        at&nbsp;org.jboss.tm.usertx.client.ServerVMClientUserTransaction.commit(ServerVMClientUserTransaction.java:140)
</p></blockquote>
<p>I&#8217;ve had this issue with jBoss and Postgres XA datasource after upgrading from Postgres 8.1 to Postgres&nbsp;8.4.</p>
<p>Was quite puzzled by it, I even tried hacking the jbossjta-properties.xml and datasource config. Nothing worked, <a href="http://www.google.com/">Google</a> was of no&nbsp;help.</p>
<p>Later I found out that&thinsp;&#8212;&thinsp;surprisingly&thinsp;&#8212;&thinsp;reading the manuals&nbsp;helps.</p>
<p>To be exact, there&#8217;s <a href="http://www.postgresql.org/docs/8.4/interactive/runtime-config-resource.html#GUC-MAX-PREPARED-TRANSACTIONS">a passage</a> in the documentation that&nbsp;states:</p>
<blockquote><p>
If you are using prepared transactions, you will probably want max_prepared_transactions to be at least as large as max_connections, so that every session can have a prepared transaction&nbsp;pending.
</p></blockquote>
<p>By default (since 8.3) I think this parameter is set to &#8220;0&#8221; and was &#8220;5&#8221; before that. We copied an older config over and we had it at&nbsp;&#8220;5&#8221;.</p>
<p>So, since we had max_connections set to 512, I&#8217;ve changed the max_prepared_transactions to 1024, restarted the server (reload won&#8217;t suffice) and - voila - things started&nbsp;working.</p>
<p>Another one of those: &#8220;you need to remember this for the next&nbsp;time&#8221;.</p>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='title' title='Use these links to share this page with others'>Bookmark and Share</div><div class='linkbuttons'><a href='http://del.icio.us/post?url=http://www.boky.cc/2010/03/18/heuristicmixedexception-and-jboss/&amp;title=HeuristicMixedException and jBoss' title='Save to del.icio.us' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/delicious.png' style='width:16px; height:16px;' alt='[del.icio.us] ' /></a> <a href='http://digg.com/submit?phase=2&amp;url=http://www.boky.cc/2010/03/18/heuristicmixedexception-and-jboss/&amp;title=HeuristicMixedException and jBoss' title='Digg It!' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/digg.png' style='width:16px; height:16px;' alt='[Digg] ' /></a> <a href='http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://www.boky.cc/2010/03/18/heuristicmixedexception-and-jboss/&amp;title=HeuristicMixedException and jBoss' title='Save to Google Bookmarks' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/google.png' style='width:16px; height:16px;' alt='[Google] ' /></a> <a href='http://www.linkedin.com/shareArticle?mini=true&url=http://www.boky.cc/2010/03/18/heuristicmixedexception-and-jboss/&title=HeuristicMixedException and jBoss' title='Share on LinkedIn' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/linkedin.png' style='width:16px; height:16px;' alt='[LinkedIn] ' /></a> <a href='http://www.stumbleupon.com/submit?url=http://www.boky.cc/2010/03/18/heuristicmixedexception-and-jboss/&amp;title=HeuristicMixedException and jBoss' title='Stumble It!' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/stumbleupon.png' style='width:16px; height:16px;' alt='[StumbleUpon] ' /></a> <a href='https://favorites.live.com/quickadd.aspx?mkt=en-us&amp;url=http://www.boky.cc/2010/03/18/heuristicmixedexception-and-jboss/&amp;title=HeuristicMixedException and jBoss' title='Save to Windows Live' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/windowslive.png' style='width:16px; height:16px;' alt='[Windows Live] ' /></a> <a href='http://bookmarks.yahoo.com/toolbar/savebm?opener=tb&amp;u=http://www.boky.cc/2010/03/18/heuristicmixedexception-and-jboss/&amp;t=HeuristicMixedException and jBoss' title='Save to Yahoo! Bookmarks' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/yahoo.png' style='width:16px; height:16px;' alt='[Yahoo!] ' /></a> <a href='http://www.feedburner.com/fb/a/emailFlare?itemTitle=HeuristicMixedException and jBoss&amp;uri=http://www.boky.cc/2010/03/18/heuristicmixedexception-and-jboss/&amp;loc=en_US' title='Email this to a friend' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/email.png' style='width:16px; height:16px;' alt='[Email] ' /></a>  <a title='See more bookmark and sharing options...' href='http://www.boky.cc/2010/03/18/heuristicmixedexception-and-jboss/#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div><div class='brand'><small><a href='http://www.bookmarkify.com/'>Powered by Bookmarkify&trade;</a></small></div></div>]]></content:encoded>
			<wfw:commentRss>http://www.boky.cc/2010/03/18/heuristicmixedexception-and-jboss/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JDBCAppender for log4j</title>
		<link>http://www.boky.cc/2010/02/03/jdbcappender-for-log4j/#utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=jdbcappender-for-log4j</link>
		<comments>http://www.boky.cc/2010/02/03/jdbcappender-for-log4j/#comments</comments>
		<pubDate>Wed, 03 Feb 2010 13:55:45 +0000</pubDate>
		<dc:creator>boky</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.boky.cc/?p=54</guid>
		<description><![CDATA[<br/>After being quite dissatisfied with the current state of database appenders for log4j (see examples here, here and here) I&#8217;ve decided to write my&#160;own.
Features:

uses PreparedStatements exclusively. No more messing with queries, quotes and similar&#160;stuff
uses batch mode to speed up&#160;inserts
inserts are done in another thread to prevent delays with&#160;logging
uses DataSources to better manage database&#160;connectivity
query is database-independent [...]]]></description>
			<content:encoded><![CDATA[<br/><p>After being quite dissatisfied with the current state of database appenders for log4j (see examples <a href="http://logging.apache.org/log4j/1.2/apidocs/index.html">here</a>, <a href="http://logging.apache.org/log4j/companions/receivers/apidocs/org/apache/log4j/db/DBAppender.html">here</a> and <a href="http://www.dankomannhaupt.de/projects/index.html">here</a>) I&#8217;ve decided to write my&nbsp;own.</p>
<p>Features:</p>
<ul>
<li>uses <tt>PreparedStatements</tt> exclusively. No more messing with queries, quotes and similar&nbsp;stuff</li>
<li>uses batch mode to speed up&nbsp;inserts</li>
<li>inserts are done in another thread to prevent delays with&nbsp;logging</li>
<li>uses <tt>DataSources</tt> to better manage database&nbsp;connectivity</li>
<li>query is database-independent (any SQL-92 compliant server should&nbsp;work)</li>
<li>config-compatible with <a href="http://www.dankomannhaupt.de/projects/index.html">Danko&#8217;s&nbsp;implementation</a></li>
<li>table name and column names can be&nbsp;configured</li>
<li>does not care if your table has an ID column or&nbsp;not</li>
<li>drops statements on SQL&nbsp;error</li>
</ul>
<p>What else could be&nbsp;done?</p>
<ul>
<li>Better handling of exceptions. We could keep logged statements (up to a point) or spill them over to another&nbsp;<a href="http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Appender.html">Appender</a>.</li>
<li>Add the possibility to call a stored procedure instead of doing bulk&nbsp;insert</li>
</ul>
<p>Without further ado, <a href="http://www.boky.cc/wp-content/uploads/2010/02/JDBCAppender.zip">here&#8217;s the code</a>. I&#8217;m releasing it under BSD license, so feel free to hack it in any way you like. But if you do make it better, please let me know so I can publish it&nbsp;here.</p>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='title' title='Use these links to share this page with others'>Bookmark and Share</div><div class='linkbuttons'><a href='http://del.icio.us/post?url=http://www.boky.cc/2010/02/03/jdbcappender-for-log4j/&amp;title=JDBCAppender for log4j' title='Save to del.icio.us' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/delicious.png' style='width:16px; height:16px;' alt='[del.icio.us] ' /></a> <a href='http://digg.com/submit?phase=2&amp;url=http://www.boky.cc/2010/02/03/jdbcappender-for-log4j/&amp;title=JDBCAppender for log4j' title='Digg It!' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/digg.png' style='width:16px; height:16px;' alt='[Digg] ' /></a> <a href='http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://www.boky.cc/2010/02/03/jdbcappender-for-log4j/&amp;title=JDBCAppender for log4j' title='Save to Google Bookmarks' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/google.png' style='width:16px; height:16px;' alt='[Google] ' /></a> <a href='http://www.linkedin.com/shareArticle?mini=true&url=http://www.boky.cc/2010/02/03/jdbcappender-for-log4j/&title=JDBCAppender for log4j' title='Share on LinkedIn' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/linkedin.png' style='width:16px; height:16px;' alt='[LinkedIn] ' /></a> <a href='http://www.stumbleupon.com/submit?url=http://www.boky.cc/2010/02/03/jdbcappender-for-log4j/&amp;title=JDBCAppender for log4j' title='Stumble It!' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/stumbleupon.png' style='width:16px; height:16px;' alt='[StumbleUpon] ' /></a> <a href='https://favorites.live.com/quickadd.aspx?mkt=en-us&amp;url=http://www.boky.cc/2010/02/03/jdbcappender-for-log4j/&amp;title=JDBCAppender for log4j' title='Save to Windows Live' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/windowslive.png' style='width:16px; height:16px;' alt='[Windows Live] ' /></a> <a href='http://bookmarks.yahoo.com/toolbar/savebm?opener=tb&amp;u=http://www.boky.cc/2010/02/03/jdbcappender-for-log4j/&amp;t=JDBCAppender for log4j' title='Save to Yahoo! Bookmarks' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/yahoo.png' style='width:16px; height:16px;' alt='[Yahoo!] ' /></a> <a href='http://www.feedburner.com/fb/a/emailFlare?itemTitle=JDBCAppender for log4j&amp;uri=http://www.boky.cc/2010/02/03/jdbcappender-for-log4j/&amp;loc=en_US' title='Email this to a friend' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/email.png' style='width:16px; height:16px;' alt='[Email] ' /></a>  <a title='See more bookmark and sharing options...' href='http://www.boky.cc/2010/02/03/jdbcappender-for-log4j/#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div><div class='brand'><small><a href='http://www.bookmarkify.com/'>Powered by Bookmarkify&trade;</a></small></div></div>]]></content:encoded>
			<wfw:commentRss>http://www.boky.cc/2010/02/03/jdbcappender-for-log4j/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Compress your javascript and CSS</title>
		<link>http://www.boky.cc/2009/09/06/compress-your-javascript-and-css/#utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=compress-your-javascript-and-css</link>
		<comments>http://www.boky.cc/2009/09/06/compress-your-javascript-and-css/#comments</comments>
		<pubDate>Sun, 06 Sep 2009 15:12:33 +0000</pubDate>
		<dc:creator>boky</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[productivity]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.boky.cc/?p=10</guid>
		<description><![CDATA[<br/>Maybe some of you know of that you can speed up your speed up your application a lot, if you compress your CSSs and javascripts. Maybe some of you do it manually or have used online tools. You might have even heard of YUI compressor, which doesn&#8217;t use search&#38;repleace but Rhino to analyze your code, [...]]]></description>
			<content:encoded><![CDATA[<br/><p>Maybe some of you know of that you can speed up your speed up your application a lot, if you compress your <abbr title="cascading style sheets">CSSs</abbr> and javascripts. Maybe some of you do it manually or have used <a href="http://javascriptcompressor.com/">online tools</a>. You might have even heard of <a href="http://developer.yahoo.com/yui/compressor/">YUI compressor</a>, which doesn&#8217;t use search&amp;repleace but <a href="http://www.mozilla.org/rhino/">Rhino</a> to analyze your code, making the compression process even more&nbsp;robust.</p>
<p>But, until now you always had to do it manually. Now I have a solution for you: automatic compression of your javascripts and&nbsp;CSSs.</p>
<p>I have created a simple filter that compresses the code on the fly. This makes it transparent to use and seeds up transfer times. Just make sure you cache the result through a <em>cache filter</em> and/or reverse proxy and/or by setting <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html">cache headers</a> or you&#8217;ll see increased processor usage which won&#8217;t make your sysadmin&nbsp;happy.</p>
<h3>Usage.</h3>
<ul>
<li>download the&nbsp;code</li>
<li>compile with <a href="http://maven.apache.org/">Maven</a>, if you changed&nbsp;anything</li>
<li>Put this in your&nbsp;<tt>web.xml</tt>:</li>
</ul>
<pre>&lt;filter&gt;
 &lt;filter-name&gt;CssAndJSCompressorFilter&lt;/filter-name&gt;
 &lt;filter-class&gt;com.parsek.web.CssAndJSCompressorFilter&lt;/filter-class&gt;
&lt;/filter&gt;

&lt;filter-mapping&gt;
 &lt;filter-name&gt;CssAndJSCompressorFilter&lt;/filter-name&gt;
 &lt;url-pattern&gt;*.css&lt;/url-pattern&gt;
 &lt;dispatcher&gt;REQUEST&lt;/dispatcher&gt;
&lt;/filter-mapping&gt;

&lt;filter-mapping&gt;
 &lt;filter-name&gt;CssAndJSCompressorFilter&lt;/filter-name&gt;
 &lt;url-pattern&gt;*.js&lt;/url-pattern&gt;
 &lt;dispatcher&gt;REQUEST&lt;/dispatcher&gt;
&lt;/filter-mapping&gt;</pre>
<p>I&#8217;m releasing the code under LGPLv3, so you are free to use it anywhere you want. If you find it useful, do mention my name and put a link to this site and leave a comment how you are using&nbsp;it.</p>
<p><a href="http://www.boky.cc/wp-content/uploads/2009/09/cjsc.zip">Download the&nbsp;code.</a></p>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='title' title='Use these links to share this page with others'>Bookmark and Share</div><div class='linkbuttons'><a href='http://del.icio.us/post?url=http://www.boky.cc/2009/09/06/compress-your-javascript-and-css/&amp;title=Compress your javascript and CSS' title='Save to del.icio.us' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/delicious.png' style='width:16px; height:16px;' alt='[del.icio.us] ' /></a> <a href='http://digg.com/submit?phase=2&amp;url=http://www.boky.cc/2009/09/06/compress-your-javascript-and-css/&amp;title=Compress your javascript and CSS' title='Digg It!' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/digg.png' style='width:16px; height:16px;' alt='[Digg] ' /></a> <a href='http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://www.boky.cc/2009/09/06/compress-your-javascript-and-css/&amp;title=Compress your javascript and CSS' title='Save to Google Bookmarks' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/google.png' style='width:16px; height:16px;' alt='[Google] ' /></a> <a href='http://www.linkedin.com/shareArticle?mini=true&url=http://www.boky.cc/2009/09/06/compress-your-javascript-and-css/&title=Compress your javascript and CSS' title='Share on LinkedIn' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/linkedin.png' style='width:16px; height:16px;' alt='[LinkedIn] ' /></a> <a href='http://www.stumbleupon.com/submit?url=http://www.boky.cc/2009/09/06/compress-your-javascript-and-css/&amp;title=Compress your javascript and CSS' title='Stumble It!' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/stumbleupon.png' style='width:16px; height:16px;' alt='[StumbleUpon] ' /></a> <a href='https://favorites.live.com/quickadd.aspx?mkt=en-us&amp;url=http://www.boky.cc/2009/09/06/compress-your-javascript-and-css/&amp;title=Compress your javascript and CSS' title='Save to Windows Live' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/windowslive.png' style='width:16px; height:16px;' alt='[Windows Live] ' /></a> <a href='http://bookmarks.yahoo.com/toolbar/savebm?opener=tb&amp;u=http://www.boky.cc/2009/09/06/compress-your-javascript-and-css/&amp;t=Compress your javascript and CSS' title='Save to Yahoo! Bookmarks' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/yahoo.png' style='width:16px; height:16px;' alt='[Yahoo!] ' /></a> <a href='http://www.feedburner.com/fb/a/emailFlare?itemTitle=Compress your javascript and CSS&amp;uri=http://www.boky.cc/2009/09/06/compress-your-javascript-and-css/&amp;loc=en_US' title='Email this to a friend' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/email.png' style='width:16px; height:16px;' alt='[Email] ' /></a>  <a title='See more bookmark and sharing options...' href='http://www.boky.cc/2009/09/06/compress-your-javascript-and-css/#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div><div class='brand'><small><a href='http://www.bookmarkify.com/'>Powered by Bookmarkify&trade;</a></small></div></div>]]></content:encoded>
			<wfw:commentRss>http://www.boky.cc/2009/09/06/compress-your-javascript-and-css/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Exporting part of your SVN tree</title>
		<link>http://www.boky.cc/2009/08/27/exporting-part-of-your-svn-tree/#utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=exporting-part-of-your-svn-tree</link>
		<comments>http://www.boky.cc/2009/08/27/exporting-part-of-your-svn-tree/#comments</comments>
		<pubDate>Thu, 27 Aug 2009 08:47:11 +0000</pubDate>
		<dc:creator>boky</dc:creator>
				<category><![CDATA[productivity]]></category>
		<category><![CDATA[system administration]]></category>

		<guid isPermaLink="false">http://www.boky.cc/?p=45</guid>
		<description><![CDATA[<br/>Recently I&#8217;ve came up with a problem that required that I made part of our SVN tree accessible to an outside partner. Of course we did not want to give him access to everything. My first thought was to just use apache reverse proxy and proxy one suburl to root of the public server. Boy [...]]]></description>
			<content:encoded><![CDATA[<br/><p>Recently I&#8217;ve came up with a problem that required that I made <em>part of our SVN tree </em>accessible to an outside partner. Of course we did not want to give him access to <em>everything</em>. My first thought was to just use apache reverse proxy and proxy one suburl to root of the public server. Boy was I&nbsp;wrong.</p>
<p>Googling around discovered that this is at least tricky but better yet impossible to do. Therefore, my another solution involved exporting the tree under the same URL but also adding some rewriting rules to make it more user friendly. Wrong,&nbsp;again.</p>
<p>As it turns out your also need to export the virtual <tt>!svn</tt> directory to make things work. Here it goes, the final solution that seems to be working at the&nbsp;moment:</p>
<pre>
&lt;VirtualHost *:443&gt;
        ServerAdmin     admin@example.org
        ServerName      project-svn.example.net
        DocumentRoot    /store/web/proxy

        SSLEngine               on
        SSLProtocol             all -SSLv2
        SSLCipherSuite          ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
        SSLCertificateFile      /etc/httpd/conf.d/project-svn.example.net.ssl/_.example.net.crt
        SSLCertificateKeyFile   /etc/httpd/conf.d/project-svn.example.net.ssl/_.example.net.key
        SSLCertificateChainFile /etc/httpd/conf.d/project-svn.example.net.ssl/exampleca.crt

        SetEnv          force-proxy-request-1.0 1
        SetEnv          proxy-nokeepalive       1
        SetEnvIf        User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0

        ErrorLog        "|/usr/sbin/rotatelogs /var/log/httpd/project-svn.example.net/error.443.log.%Y-%m-%d 86400"
        CustomLog       "|/usr/sbin/rotatelogs /var/log/httpd/project-svn.example.net/access.443.log.%Y-%m-%d 86400" full

        &lt;IfModule mod_deflate.c&gt;
            &lt;IfModule mod_headers.c&gt;
                Header set Accept-Encoding "gzip, deflate"
            &lt;/IfModule&gt;
            SetInputFilter DEFLATE
            SetOutputFilter DEFLATE
            DeflateFilterNote Input instream
            DeflateFilterNote Output outstream
            DeflateFilterNote Ratio ratio
            BrowserMatch ^Mozilla/4 gzip-only-text/html
            BrowserMatch ^Mozilla/4\.0[678] no-gzip
            BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
            SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png|jar|zip|rar|mpe?g)$ no-gzip dont-vary
            Header append Vary User-Agent env=!dont-vary
        &lt;/IfModule&gt;

        ProxyPass               /svnindex.xsl                   http://svn.internal.pri/svnindex.xsl
        ProxyPassReverse        /svnindex.xsl                   http://svn.internal.pri/svnindex.xsl
        ProxyPass               /css/                           http://svn.internal.pri/css/
        ProxyPassReverse        /css/                           http://svn.internal.pri/css/
        ProxyPass               /images/                        http://svn.internal.pri/images/
        ProxyPassReverse        /images/                        http://svn.internal.pri/images/
        ProxyPass               /svnroot/projects/PCKB/         http://svn.internal.pri/svnroot/projects/PCKB/
        ProxyPassReverse        /svnroot/projects/PCKB/         http://svn.internal.pri/svnroot/projects/PCKB/
        ProxyPass               /svnroot/!svn/                  http://svn.internal.pri/svnroot/!svn/
        ProxyPassReverse        /svnroot/!svn/                  http://svn.internal.pri/svnroot/!svn/

        RewriteEngine   on

        RewriteCond             %{SERVER_NAME}  ^project-svn\.example\.net$ [NC]
        RewriteCond             %{REQUEST_URI}  ^(/svnroot(/projects)?)?/?$ [NC]
        RewriteRule             ^(.*)$          /svnroot/projects/PCKB/ [R=301,L]

        RewriteCond             %{SERVER_NAME}  ^project-svn\.example\.net$ [NC]
        RewriteCond             %{REQUEST_URI}  ^/svnroot/projects/PCKB$ [NC]
        RewriteRule             ^(.*)$          /svnroot/projects/PCKB/ [R=301,L]

        RewriteCond             %{SERVER_NAME}  ^project-svn\.example\.net$ [NC]
        RewriteCond             %{REQUEST_URI}  !^/(svnindex.xsl$|css/.+|images/.+|svnroot/(!svn/|projects/PCKB)).*$ [NC]
        RewriteRule             ^(.*)$          /svnroot/projects/PCKB$0 [R=301]
&lt;/VirtualHost&gt;
</pre>
<p>Few notes about the the&nbsp;configuration:</p>
<ul>
<li>the project  we are exporting is&nbsp;<tt>PCKB</tt></li>
<li>our SVN lives on&nbsp;http://svn.internal.pri/svnroot</li>
<li>browser output is beautified through a stylesheet, therefore we&#8217;ll need to proxy it also along with all required&nbsp;resources</li>
<li><strong>no security is enforced on the proxy:</strong>: back end apache handles all security and is configured for complete authentication (read + write) when requesting the repository through the&nbsp;proxy</li>
</ul>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='title' title='Use these links to share this page with others'>Bookmark and Share</div><div class='linkbuttons'><a href='http://del.icio.us/post?url=http://www.boky.cc/2009/08/27/exporting-part-of-your-svn-tree/&amp;title=Exporting part of your SVN tree' title='Save to del.icio.us' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/delicious.png' style='width:16px; height:16px;' alt='[del.icio.us] ' /></a> <a href='http://digg.com/submit?phase=2&amp;url=http://www.boky.cc/2009/08/27/exporting-part-of-your-svn-tree/&amp;title=Exporting part of your SVN tree' title='Digg It!' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/digg.png' style='width:16px; height:16px;' alt='[Digg] ' /></a> <a href='http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://www.boky.cc/2009/08/27/exporting-part-of-your-svn-tree/&amp;title=Exporting part of your SVN tree' title='Save to Google Bookmarks' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/google.png' style='width:16px; height:16px;' alt='[Google] ' /></a> <a href='http://www.linkedin.com/shareArticle?mini=true&url=http://www.boky.cc/2009/08/27/exporting-part-of-your-svn-tree/&title=Exporting part of your SVN tree' title='Share on LinkedIn' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/linkedin.png' style='width:16px; height:16px;' alt='[LinkedIn] ' /></a> <a href='http://www.stumbleupon.com/submit?url=http://www.boky.cc/2009/08/27/exporting-part-of-your-svn-tree/&amp;title=Exporting part of your SVN tree' title='Stumble It!' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/stumbleupon.png' style='width:16px; height:16px;' alt='[StumbleUpon] ' /></a> <a href='https://favorites.live.com/quickadd.aspx?mkt=en-us&amp;url=http://www.boky.cc/2009/08/27/exporting-part-of-your-svn-tree/&amp;title=Exporting part of your SVN tree' title='Save to Windows Live' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/windowslive.png' style='width:16px; height:16px;' alt='[Windows Live] ' /></a> <a href='http://bookmarks.yahoo.com/toolbar/savebm?opener=tb&amp;u=http://www.boky.cc/2009/08/27/exporting-part-of-your-svn-tree/&amp;t=Exporting part of your SVN tree' title='Save to Yahoo! Bookmarks' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/yahoo.png' style='width:16px; height:16px;' alt='[Yahoo!] ' /></a> <a href='http://www.feedburner.com/fb/a/emailFlare?itemTitle=Exporting part of your SVN tree&amp;uri=http://www.boky.cc/2009/08/27/exporting-part-of-your-svn-tree/&amp;loc=en_US' title='Email this to a friend' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/email.png' style='width:16px; height:16px;' alt='[Email] ' /></a>  <a title='See more bookmark and sharing options...' href='http://www.boky.cc/2009/08/27/exporting-part-of-your-svn-tree/#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div><div class='brand'><small><a href='http://www.bookmarkify.com/'>Powered by Bookmarkify&trade;</a></small></div></div>]]></content:encoded>
			<wfw:commentRss>http://www.boky.cc/2009/08/27/exporting-part-of-your-svn-tree/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Operation does not have a SOAP fault extension</title>
		<link>http://www.boky.cc/2009/02/02/operation-does-not-have-a-soap-fault-extension/#utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=operation-does-not-have-a-soap-fault-extension</link>
		<comments>http://www.boky.cc/2009/02/02/operation-does-not-have-a-soap-fault-extension/#comments</comments>
		<pubDate>Mon, 02 Feb 2009 15:13:50 +0000</pubDate>
		<dc:creator>boky</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[web services]]></category>

		<guid isPermaLink="false">http://www.boky.cc/?p=42</guid>
		<description><![CDATA[<br/>If you have ever banged your head when using JAX-WS / WSIT at this&#160;error:

[ERROR] fault "getBusinessCaseFault" in operation "getBusinessCase" does not have a SOAP fault extension
  line 3213 of file:/service.wsdl

Boy than I have a solution for you. As it turns out, your WSDL was probably generated by Axis. And, as it turns out, it [...]]]></description>
			<content:encoded><![CDATA[<br/><p>If you have ever banged your head when using JAX-WS / WSIT at this&nbsp;error:</p>
<p><code><br />
[ERROR] fault "getBusinessCaseFault" in operation "getBusinessCase" does not have a SOAP fault extension<br />
  line 3213 of file:/service.wsdl<br />
</code></p>
<p>Boy than I have a solution for you. As it turns out, your WSDL was probably generated by Axis. And, as it turns out, it was probably faulty. Our WSDL included 40-something methods and the first 32 were OK, but the last few were invalid and caused the parser to&nbsp;choke.</p>
<p>Look for <tt>&lt;wsdl:operation&#8230;&gt;</tt> tag and in it you&#8217;ll see something like this:<br />
<code><br />
&lt;wsdl:fault name="getBusinessCaseHistoryFault"&gt;<br />
</code></p>
<p>When in fact, it should be like this:<br />
<code><br />
   &lt;wsdl:fault name="getBusinessCaseHistoryFault"&gt;<br />
    &lt;soap:fault name="getBusinessCaseHistoryFault" use="literal" /&gt;<br />
   &lt;/wsdl:fault&gt;<br />
</code></p>
<p>After we fixed these elements everything went on just fine. I am still not quite sure whether it&#8217;s JAX-WS&#8217; or Axis&#8217; bug, the specification seems to be a bit fuzzy on this issue. But nevertheless, things started&nbsp;working.</p>
<p>Just thought it would be nice to&nbsp;share.</p>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='title' title='Use these links to share this page with others'>Bookmark and Share</div><div class='linkbuttons'><a href='http://del.icio.us/post?url=http://www.boky.cc/2009/02/02/operation-does-not-have-a-soap-fault-extension/&amp;title=Operation does not have a SOAP fault extension' title='Save to del.icio.us' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/delicious.png' style='width:16px; height:16px;' alt='[del.icio.us] ' /></a> <a href='http://digg.com/submit?phase=2&amp;url=http://www.boky.cc/2009/02/02/operation-does-not-have-a-soap-fault-extension/&amp;title=Operation does not have a SOAP fault extension' title='Digg It!' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/digg.png' style='width:16px; height:16px;' alt='[Digg] ' /></a> <a href='http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://www.boky.cc/2009/02/02/operation-does-not-have-a-soap-fault-extension/&amp;title=Operation does not have a SOAP fault extension' title='Save to Google Bookmarks' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/google.png' style='width:16px; height:16px;' alt='[Google] ' /></a> <a href='http://www.linkedin.com/shareArticle?mini=true&url=http://www.boky.cc/2009/02/02/operation-does-not-have-a-soap-fault-extension/&title=Operation does not have a SOAP fault extension' title='Share on LinkedIn' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/linkedin.png' style='width:16px; height:16px;' alt='[LinkedIn] ' /></a> <a href='http://www.stumbleupon.com/submit?url=http://www.boky.cc/2009/02/02/operation-does-not-have-a-soap-fault-extension/&amp;title=Operation does not have a SOAP fault extension' title='Stumble It!' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/stumbleupon.png' style='width:16px; height:16px;' alt='[StumbleUpon] ' /></a> <a href='https://favorites.live.com/quickadd.aspx?mkt=en-us&amp;url=http://www.boky.cc/2009/02/02/operation-does-not-have-a-soap-fault-extension/&amp;title=Operation does not have a SOAP fault extension' title='Save to Windows Live' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/windowslive.png' style='width:16px; height:16px;' alt='[Windows Live] ' /></a> <a href='http://bookmarks.yahoo.com/toolbar/savebm?opener=tb&amp;u=http://www.boky.cc/2009/02/02/operation-does-not-have-a-soap-fault-extension/&amp;t=Operation does not have a SOAP fault extension' title='Save to Yahoo! Bookmarks' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/yahoo.png' style='width:16px; height:16px;' alt='[Yahoo!] ' /></a> <a href='http://www.feedburner.com/fb/a/emailFlare?itemTitle=Operation does not have a SOAP fault extension&amp;uri=http://www.boky.cc/2009/02/02/operation-does-not-have-a-soap-fault-extension/&amp;loc=en_US' title='Email this to a friend' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/email.png' style='width:16px; height:16px;' alt='[Email] ' /></a>  <a title='See more bookmark and sharing options...' href='http://www.boky.cc/2009/02/02/operation-does-not-have-a-soap-fault-extension/#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div><div class='brand'><small><a href='http://www.bookmarkify.com/'>Powered by Bookmarkify&trade;</a></small></div></div>]]></content:encoded>
			<wfw:commentRss>http://www.boky.cc/2009/02/02/operation-does-not-have-a-soap-fault-extension/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Comparing Python and Java</title>
		<link>http://www.boky.cc/2008/09/07/comparing-python-and-java/#utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=comparing-python-and-java</link>
		<comments>http://www.boky.cc/2008/09/07/comparing-python-and-java/#comments</comments>
		<pubDate>Sun, 07 Sep 2008 21:05:57 +0000</pubDate>
		<dc:creator>boky</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[opinion]]></category>
		<category><![CDATA[productivity]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.boky.cc/?p=17</guid>
		<description><![CDATA[<br/>Recently I&#8217;ve taken up the task of learning Python after being quite a few years in Java. There are some posts&#8201;&#8212;&#8201;biased towards Python IMHO&#8201;&#8212;&#8201;that I&#8217;ve tried to take into account, but I just thought I&#8217;d throw in my&#160;€0.02.
Please note that while I&#8217;ve been working with Java for quite a few years, I&#8217;ve just started learning [...]]]></description>
			<content:encoded><![CDATA[<br/><p>Recently I&#8217;ve taken up the task of learning Python after being quite a few years in Java. There are <a href="http://www.ferg.org/projects/python_java_side-by-side.html">some posts</a>&thinsp;&#8212;&thinsp;biased towards Python IMHO&thinsp;&#8212;&thinsp;that I&#8217;ve tried to take into account, but I just thought I&#8217;d throw in my&nbsp;€0.02.</p>
<p>Please note that while I&#8217;ve been working with Java for quite a few years, I&#8217;ve just started learning Python, but it&#8217;s not the first dynamic language I&#8217;ve used. If anything, I&#8217;ve mastered javascript and even used it as a core feature for an insurance enterprise system and are quite aware of pros and cons of dynamic vs. static&nbsp;languages.</p>
<p>If you see anything wrong or disagree, please let me know. Now, let&#8217;s go sink our teeth into side by side&nbsp;comparison.</p>
<h4>Java vs. Python Productivity - an&nbsp;Overview</h4>
<table border="0" cellspacing="10">
<thead>
<tr style="background: #FFFFDD">
<th style="padding: 10px 0 10px 5px; text-align: left; font-style: normal">Feature</th>
<th style="padding: 10px 0 10px 5px; text-align: left">Java</th>
<th style="padding: 10px 0 10px 5px; text-align: left">Python</th>
</tr>
</thead>
<tbody>
<tr>
<td style="vertical-align: top" rowspan="2"><em style="font-weight: bold; color: #000066">typing</em></td>
<td style="vertical-align: top"><strong>statically&nbsp;typed</strong></p>
<p>Everything (every variable) you use in Java must be explicitly defined. While this presents a bit more clutter and work it eliminates a lot of errors when you type &#8220;workunits&#8221; or &#8220;wokrUnits&#8221; instead of &#8220;workUnits&#8221;. Everything is cought at compile-time (or even before, in your editor!) and there are virtually no mistakes of this kind in production code. Also, with auto boxing and generics, difference between objects and primitive types is blurred to a point where both can be used almost interchangibly.</td>
<td style="vertical-align: top"><strong>dinamically&nbsp;typed</strong></p>
<p>In python nothing needs to be defined before you use it. This is quite handy and spares quite a few (unneccessary) lines in your code but if you mistype (or even worse, unknowingly override a global variable), strange things will happen at <em>run-time</em>.</td>
</tr>
<tr>
<td style="padding-bottom: 3em; color: #006600" colspan="2"><em>Vedict:</em>Given the fact that there are a lot of languages on both sides of the river and it doesn&#8217;t seem that any will be going away soon, there is no clear winner here. Depends on experience of the programmer and the size of the project.</td>
</tr>
<tr>
<td style="vertical-align: top" rowspan="2"><em style="font-weight: bold; color: #000066">verbosity</em></td>
<td style="vertical-align: top"><strong>verbose / not&nbsp;compact</strong></p>
<p>Java does not spare the characters. Everything must be defined and explained long and verbose. This sometimes goes into extreemes (think how much code you need to create a property on an object). On the other hand, IDEs help out with quite a lot of this typing.</td>
<td style="vertical-align: top"><strong>terse /&nbsp;compact</strong></p>
<p>Python&#8217;s syntax is almost scaringly concise. When you see it first, it might scare you even more than perl.</td>
</tr>
<tr>
<td style="padding-bottom: 3em; color: #006600" colspan="2"><em>Vedict:</em> I like to see as much usable code on screen at one time. Unnecessary characters just create clutter. Python gets a point.</td>
</tr>
<tr>
<td style="vertical-align: top" rowspan="2"><em style="font-weight: bold; color: #000066">classes</em></td>
<td style="vertical-align: top">In Java, everything is focused around a Class, which is why it is generally in it&#8217;s own file. But, on the other hand, can contain an unlimited number of inner classes and anonymous classes. A project of 15 classes can therefore be coded in one or 15 files.</td>
<td style="vertical-align: top">Phyton focuses its development around modules. Class is defined in much the same way as a function/method. A project of 15 classes can therefore exist in one, 4, 6 or 15 files.</td>
</tr>
<tr>
<td style="padding-bottom: 3em; color: #006600" colspan="2"><em>Vedict:</em> IMHO both quite well in this aspect. I never noticed having &#8220;too much&#8221; files in a Java project. It&#8217;s a tie.</td>
</tr>
<tr>
<td style="vertical-align: top" rowspan="2"><em style="font-weight: bold; color: #000066">exception handling</em></td>
<td style="vertical-align: top"><strong>checked and unchecked&nbsp;exceptions</strong></p>
<p>Your method may throw a checked (i.e. explicitly declared) or an unchecked (subclass of <tt>RuntimeException</tt>) exception. There&#8217;s a lot of buzz in the Java world if checked exceptions <a href="http://www.google.com/search?q=java+checked+exceptions">were a good idea in the first place</a>, but it&#8217;s not what our discussion is about.</td>
<td style="vertical-align: top"><strong>unchecked&nbsp;only</strong></p>
<p>All Pyhton&#8217;s exceptions are unchecked. Period. Any part of the code you do not know <em>might</em> throw some kind of exception you have no idea of.</td>
</tr>
<tr>
<td style="padding-bottom: 3em; color: #006600" colspan="2"><em>Vedict:</em> Whether or not checked exceptions are a good or not, I think having a choice is cool. Java wins.</td>
</tr>
<tr>
<td style="vertical-align: top" rowspan="2"><em style="font-weight: bold; color: #000066">method declaration</em></td>
<td style="vertical-align: top"><strong>overloading,&nbsp;varargs</strong></p>
<p>In Java, if you want your method to accept different (&#8230;number of&#8230;) parameters your only choice was to overload it and include just one line that called the other method. This has been loosened up a bit with varargs (some restrictions apply) which allows you to give unlimited number of parameters to the method.<br />
Example of bogus <tt>printf</tt> in&nbsp;Java:</p>

<div class="wp_codebox"><table><tr id="p173"><td class="code" id="p17code3"><pre class="java" style="font-family:monospace;"><span style="color: #003399;">String</span> printf<span style="color: #009900;">&#40;</span><span style="color: #003399;">Object</span>... <span style="color: #006633;">args</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	printf<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Default message&quot;</span>, args<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003399;">String</span> printf<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> message, <span style="color: #003399;">Object</span>... <span style="color: #006633;">args</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #666666; font-style: italic;">// code here</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
...
&nbsp;
<span style="color: #666666; font-style: italic;">// Usage</span>
printf<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">2</span>, <span style="color: #cc66cc;">3</span>, <span style="color: #cc66cc;">4</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
printf<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Hello world&quot;</span>, <span style="color: #0000ff;">&quot;foo&quot;</span>,<span style="color: #0000ff;">&quot;bar&quot;</span>, 5.5d<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003399;">List</span> a <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">ArrayList</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
a.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
a.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;foo&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
a.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;bar&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
printf<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Hello world&quot;</span>, a<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
printf<span style="color: #009900;">&#40;</span>a<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

</td>
<td style="vertical-align: top"><strong>default params, *name, **name, named&nbsp;parameters</strong></p>
<p>Named parameters are an excellent feature, especially for methods with a lot of parameters. A function/method in python can also accept an optional unbounded list, map or both of parameters in a special variable(s).<br />
Example of bogus <tt>printf</tt> in&nbsp;Java:</p>

<div class="wp_codebox"><table><tr id="p174"><td class="code" id="p17code4"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">def</span> printf<span style="color: black;">&#40;</span>message=<span style="color: #483d8b;">&quot;Hello world&quot;</span>, <span style="color: #66cc66;">*</span>args<span style="color: black;">&#41;</span>:
	<span style="color: #808080; font-style: italic;"># the code</span>
&nbsp;
...
&nbsp;
<span style="color: #808080; font-style: italic;"># Usage</span>
printf<span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">2</span>, <span style="color: #ff4500;">3</span>, <span style="color: #ff4500;">4</span><span style="color: black;">&#41;</span>
printf<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Hello world&quot;</span>, <span style="color: #483d8b;">&quot;foo&quot;</span>, <span style="color: #483d8b;">&quot;bar&quot;</span>, <span style="color: #ff4500;">5.5</span><span style="color: black;">&#41;</span>
<span style="color: #808080; font-style: italic;"># Note:</span>
<span style="color: #808080; font-style: italic;"># printf(message = 'Hello world', &quot;foo&quot;, &quot;bar&quot;)</span>
<span style="color: #808080; font-style: italic;"># will not work</span>
printf<span style="color: black;">&#40;</span>message = <span style="color: #483d8b;">'Hello world'</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>

</td>
</tr>
<tr>
<td style="padding-bottom: 3em; color: #006600" colspan="2"><em>Vedict:</em> Named parameters are cool. They increase verbosity (not quite Python&#8217;s concept) but for a good reason. Variable argumenst are a bit aquard in Python and easier in java. Python wins, but by a slight margin.</td>
</tr>
<tr>
<td style="vertical-align: top" rowspan="2"><em style="font-weight: bold; color: #000066">IO handling</em></td>
<td style="vertical-align: top">Java has abstracted everything. Everything is an <tt>InputStream</tt>/<tt>OutputStream</tt>, you wrap it around and around to get something useful out of it.</td>
<td style="vertical-align: top">Python&#8217;s approach is KISS. <tt>file.open</tt>, <tt>urllib2.urlopen</tt>.</td>
</tr>
<tr>
<td style="padding-bottom: 3em; color: #006600" colspan="2"><em>Vedict:</em> Python is cool. Java is extensible. I must say I miss this kind of simlicitly in Java, but enterprise-wise it makes sense. A tie for now.</td>
</tr>
<tr>
<td style="vertical-align: top" rowspan="2"><em style="font-weight: bold; color: #000066">inheritance</em></td>
<td style="vertical-align: top"><strong>single-class inheritance,&nbsp;interfaces</strong></p>
<p>Java is pretty classic when it comes to object. Each object can inherit from one parent only but can implent multiple interfaces.</td>
<td style="vertical-align: top"><strong>multi-class&nbsp;inheritance</strong></p>
<p>One class can inherit from multiple classes. No interfaces.</td>
</tr>
<tr>
<td style="padding-bottom: 3em; color: #006600" colspan="2"><em>Vedict:</em> Personally, I find Java&#8217;s idea much easier to comprehend and follow. In Python superclass&#8217; constructor may be invoked multiple times. Java wins, sorry Python.</td>
</tr>
<tr>
<td style="vertical-align: top" rowspan="2"><em style="font-weight: bold; color: #000066">XML parsing</em></td>
<td style="vertical-align: top"><strong><a href="http://www.w3.org/DOM/">DOM</a> built-in, <a href="http://www.saxproject.org/">SAX built-in</a>, <a href="http://stax.codehaus.org/">StAX</a>, <a href="http://www.jdom.org/">jDOM</a>, <a href="http://www.dom4j.org/">DOM4J</a>, <a href="http://www.xom.nu/">XOM</a>, <a href="https://jaxb.dev.java.net/">JAXB</a>&#8230;</strong></p>
<p>Comes with unfriendly, but standards-compliant DOM and SAX parsers. Latest java supports DOM 3. Many implementations exist that bring XML parsing closer to Java-mindset.</td>
<td style="vertical-align: top"><strong><a href="http://www.w3.org/DOM/">DOM</a> built-in, <a href="http://www.saxproject.org/">SAX built-in</a>, <a href="http://effbot.org/zone/element-index.htm">ElementTree</a>, os-enabled (i.e. <a href="http://docs.python.org/lib/module-xml.parsers.expat.html">Expat</a>)&#8230;</strong></p>
<p>Comes with unfriendly, but standards-compliant DOM and SAX parsers. Latest Python 2.5 doesn&#8217;t seem to support DOM 3<sup>2</sup>. Many other implementations exist, I&#8217;ve looked into Python-centric <a href="http://effbot.org/zone/element-index.htm">ElementTree</a>.</td>
</tr>
<tr>
<td style="padding-bottom: 3em; color: #006600" colspan="2"><em>Vedict:</em> Both support familiar standards and implementations which bring XML loser to the language. Both need a separate downloads to make XML parsing a joy. It&#8217;s a tie, folks.</td>
</tr>
<tr>
<td style="vertical-align: top" rowspan="2"><em style="font-weight: bold; color: #000066">date / time handling</em></td>
<td style="vertical-align: top">The <a href="http://java.sun.com/javase/6/docs/api/java/util/Date.html">java.util.Date</a>, <a href="http://java.sun.com/javase/6/docs/api/java/util/Calendar.html">java.util.Calendar</a> and <a href="http://java.sun.com/javase/6/docs/api/java/text/DateFormat.html">java.text.DateFormat</a> may not be the gems of best programming ever, but they do get (most) of the job done. Truth to be told, there are some libraries (<a href="http://joda-time.sourceforge.net/">Joda</a>, being one of them) that try to rectify this situation. There&#8217;s even now a new <a href="http://jcp.org/en/jsr/detail?id=310">JSR-310</a> to finally fix everything.</td>
<td style="vertical-align: top">Lots of functions in <tt>datetime</tt>, <tt>time</tt> and <tt>calendar</tt> modules with confusing names<sup>3</sup> like <tt>strftime</tt>, <tt>strptime</tt>, <tt>mktime</tt>, <tt>pryear</tt>. Still problem storing and parsing timezones though<sup>4</sup>.</td>
</tr>
<tr>
<td style="padding-bottom: 3em; color: #006600" colspan="2"><em>Vedict:</em> I find Java&#8217;s API <em>much</em> easier to understand, although Python&#8217;s has more functionality. Given that Java&#8217;s API works internationally out-of-the-box and the names are designed for humans to read, I give a point to Java.</td>
</tr>
<tr>
<td style="vertical-align: top" rowspan="2"><em style="font-weight: bold; color: #000066">unicode</em></td>
<td style="vertical-align: top">Java has been unicode from day 1. Every character, every String is unicode. Period. <a href="http://java.sun.com/docs/books/jls/third_edition/html/lexical.html">Java 5.0 Supports Unicode 4.0</a>.</td>
<td style="vertical-align: top">Unicode has been &#8220;slapped onto&#8221; the language. You have &#8220;regular strings&#8221; (<tt>&#8220;Hello world&#8221;</tt>), &#8220;raw strings&#8221; (<tt>r&#8221;Hello world&#8221;</tt>), &#8220;unicode strings&#8221; (<tt>u&#8221;Hello world&#8221;</tt>) and even &#8220;unicode raw strings&#8221; (<tt>ur&#8221;Hello world&#8221;</tt>). It may be true that most of the time unicode strings are not needed and you can save some memory but with current capacities this should not be an issue at all. Just drop the lagacy and make everything unicode. Given Python&#8217;s interpreted nature this should not be to difficult&nbsp;IMHO.</p>
<p><strong>Update: </strong>Pyhton3 finally fixes this long standing issue.</td>
</tr>
<tr>
<td style="padding-bottom: 3em; color: #006600" colspan="2"><em>Vedict:</em> <span style="text-decoration: line-through;">Java wins by far. No question here.</span> With Python3, there&#8217;s the gap is closing.</td>
</tr>
</tbody>
</table>
<p>If you are new to Python, there is a <a href="http://www.poromenos.org/tutorials/python">nice post explaining</a> its core features in 10 minutes. My verdict <em>so far</em>? Python<sup>1</sup> can be more productive in small-scale scenarios. Great language to write scripts, jobs, crons, small, fast and hacked-up webs but not really something I would base my enterprise solution on. But, on the other hand, enterprise applications have the need for scripting, crons, jobs, small tasks which can be edited by the end user (Administrator) without the need for restaring the server or redeploying the application. The best way to accomplish this task would be by using a language such as&nbsp;Python.</p>
<p>Note:</p>
<p><sup>1</sup> I am comparing core language features only, not frameworks built on top of it, i.e. <a href="http://www.djangoproject.com/">Django</a>, <a href="http://groovy.codehaus.org/">Groovy</a>, <a href="http://www.jboss.com/products/seam">Seam</a> or&nbsp;<a href="http://www.rubyonrails.org/">Rails</a>.</p>
<p><sup>2</sup> Tried with <tt>node.textContent</tt>&nbsp;only.</p>
<p><sup>3</sup> Actually, I haven&#8217;t had that much experience with python yet, but as I understand, this are direct wrappers/copies of OS functions with same&nbsp;names.</p>
<p><sup>4</sup> The function <tt>strptime</tt>, for example, will not parse the timezone in format &#8220;+/-hh:mm&#8221;. Even named timezones (i.e. PST, DST) are only checked and not processed. You can do it with an external library&nbsp;though.</p>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='title' title='Use these links to share this page with others'>Bookmark and Share</div><div class='linkbuttons'><a href='http://del.icio.us/post?url=http://www.boky.cc/2008/09/07/comparing-python-and-java/&amp;title=Comparing Python and Java' title='Save to del.icio.us' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/delicious.png' style='width:16px; height:16px;' alt='[del.icio.us] ' /></a> <a href='http://digg.com/submit?phase=2&amp;url=http://www.boky.cc/2008/09/07/comparing-python-and-java/&amp;title=Comparing Python and Java' title='Digg It!' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/digg.png' style='width:16px; height:16px;' alt='[Digg] ' /></a> <a href='http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://www.boky.cc/2008/09/07/comparing-python-and-java/&amp;title=Comparing Python and Java' title='Save to Google Bookmarks' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/google.png' style='width:16px; height:16px;' alt='[Google] ' /></a> <a href='http://www.linkedin.com/shareArticle?mini=true&url=http://www.boky.cc/2008/09/07/comparing-python-and-java/&title=Comparing Python and Java' title='Share on LinkedIn' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/linkedin.png' style='width:16px; height:16px;' alt='[LinkedIn] ' /></a> <a href='http://www.stumbleupon.com/submit?url=http://www.boky.cc/2008/09/07/comparing-python-and-java/&amp;title=Comparing Python and Java' title='Stumble It!' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/stumbleupon.png' style='width:16px; height:16px;' alt='[StumbleUpon] ' /></a> <a href='https://favorites.live.com/quickadd.aspx?mkt=en-us&amp;url=http://www.boky.cc/2008/09/07/comparing-python-and-java/&amp;title=Comparing Python and Java' title='Save to Windows Live' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/windowslive.png' style='width:16px; height:16px;' alt='[Windows Live] ' /></a> <a href='http://bookmarks.yahoo.com/toolbar/savebm?opener=tb&amp;u=http://www.boky.cc/2008/09/07/comparing-python-and-java/&amp;t=Comparing Python and Java' title='Save to Yahoo! Bookmarks' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/yahoo.png' style='width:16px; height:16px;' alt='[Yahoo!] ' /></a> <a href='http://www.feedburner.com/fb/a/emailFlare?itemTitle=Comparing Python and Java&amp;uri=http://www.boky.cc/2008/09/07/comparing-python-and-java/&amp;loc=en_US' title='Email this to a friend' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/email.png' style='width:16px; height:16px;' alt='[Email] ' /></a>  <a title='See more bookmark and sharing options...' href='http://www.boky.cc/2008/09/07/comparing-python-and-java/#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div><div class='brand'><small><a href='http://www.bookmarkify.com/'>Powered by Bookmarkify&trade;</a></small></div></div>]]></content:encoded>
			<wfw:commentRss>http://www.boky.cc/2008/09/07/comparing-python-and-java/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Hug a developer</title>
		<link>http://www.boky.cc/2008/09/03/hug-a-developer/#utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=hug-a-developer</link>
		<comments>http://www.boky.cc/2008/09/03/hug-a-developer/#comments</comments>
		<pubDate>Wed, 03 Sep 2008 06:59:07 +0000</pubDate>
		<dc:creator>boky</dc:creator>
				<category><![CDATA[funny]]></category>
		<category><![CDATA[it]]></category>
		<category><![CDATA[productivity]]></category>
		<category><![CDATA[usability]]></category>

		<guid isPermaLink="false">http://www.boky.cc/?p=16</guid>
		<description><![CDATA[<br/>I was sent this nice link from a friend and a cooworker&#160;today.
Worth checking it&#160;out.
Bookmark and Share         More&#160;&#187;Powered by Bookmarkify&#8482;]]></description>
			<content:encoded><![CDATA[<br/><p>I was sent <a href="http://www.develop-one.net/blog/2008/08/27/HugADeveloper.aspx">this nice link</a> from a friend and a cooworker&nbsp;<abbr class="datetime" title="2008-09-03">today</abbr>.</p>
<p>Worth checking it&nbsp;out.</p>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='title' title='Use these links to share this page with others'>Bookmark and Share</div><div class='linkbuttons'><a href='http://del.icio.us/post?url=http://www.boky.cc/2008/09/03/hug-a-developer/&amp;title=Hug a developer' title='Save to del.icio.us' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/delicious.png' style='width:16px; height:16px;' alt='[del.icio.us] ' /></a> <a href='http://digg.com/submit?phase=2&amp;url=http://www.boky.cc/2008/09/03/hug-a-developer/&amp;title=Hug a developer' title='Digg It!' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/digg.png' style='width:16px; height:16px;' alt='[Digg] ' /></a> <a href='http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://www.boky.cc/2008/09/03/hug-a-developer/&amp;title=Hug a developer' title='Save to Google Bookmarks' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/google.png' style='width:16px; height:16px;' alt='[Google] ' /></a> <a href='http://www.linkedin.com/shareArticle?mini=true&url=http://www.boky.cc/2008/09/03/hug-a-developer/&title=Hug a developer' title='Share on LinkedIn' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/linkedin.png' style='width:16px; height:16px;' alt='[LinkedIn] ' /></a> <a href='http://www.stumbleupon.com/submit?url=http://www.boky.cc/2008/09/03/hug-a-developer/&amp;title=Hug a developer' title='Stumble It!' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/stumbleupon.png' style='width:16px; height:16px;' alt='[StumbleUpon] ' /></a> <a href='https://favorites.live.com/quickadd.aspx?mkt=en-us&amp;url=http://www.boky.cc/2008/09/03/hug-a-developer/&amp;title=Hug a developer' title='Save to Windows Live' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/windowslive.png' style='width:16px; height:16px;' alt='[Windows Live] ' /></a> <a href='http://bookmarks.yahoo.com/toolbar/savebm?opener=tb&amp;u=http://www.boky.cc/2008/09/03/hug-a-developer/&amp;t=Hug a developer' title='Save to Yahoo! Bookmarks' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/yahoo.png' style='width:16px; height:16px;' alt='[Yahoo!] ' /></a> <a href='http://www.feedburner.com/fb/a/emailFlare?itemTitle=Hug a developer&amp;uri=http://www.boky.cc/2008/09/03/hug-a-developer/&amp;loc=en_US' title='Email this to a friend' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/email.png' style='width:16px; height:16px;' alt='[Email] ' /></a>  <a title='See more bookmark and sharing options...' href='http://www.boky.cc/2008/09/03/hug-a-developer/#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div><div class='brand'><small><a href='http://www.bookmarkify.com/'>Powered by Bookmarkify&trade;</a></small></div></div>]]></content:encoded>
			<wfw:commentRss>http://www.boky.cc/2008/09/03/hug-a-developer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Software and media licencing</title>
		<link>http://www.boky.cc/2008/07/02/software-and-media-licencing/#utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=software-and-media-licencing</link>
		<comments>http://www.boky.cc/2008/07/02/software-and-media-licencing/#comments</comments>
		<pubDate>Wed, 02 Jul 2008 17:00:50 +0000</pubDate>
		<dc:creator>boky</dc:creator>
				<category><![CDATA[opinion]]></category>
		<category><![CDATA[usability]]></category>

		<guid isPermaLink="false">http://www.boky.cc/?p=15</guid>
		<description><![CDATA[<br/>I was just thinking the other day, how funny the licencing business has become. You &#8220;buy&#8221; things but you do not really buy them, they&#8217;re just &#8220;lended&#8221; to you for an indefinite period of time. Furthermore you&#8217;re allowed to use them only in a certain way within a certain timeframe and should not dissasemble or [...]]]></description>
			<content:encoded><![CDATA[<br/><p>I was just thinking the other day, how funny the licencing business has become. You &#8220;buy&#8221; things but you do not really buy them, they&#8217;re just &#8220;lended&#8221; to you for an indefinite period of time. Furthermore you&#8217;re allowed to use them only in a certain way within a certain timeframe and should not dissasemble or find out how they&nbsp;work.</p>
<p>Imagine yourself buying a shovel at your local hardware store but the label on it clearly states: &#8220;This shovel is licenced for grave-digging only. Any other use, including but not limited to gardening, canal digging or backyard rearaning is strictly forbidden. You are not allowed to dissasemble this shovel, change any of it&#8217;s parts&thinsp;&#8212;&thinsp;regardless of their condition&thinsp;&#8212;&thinsp;or lend it to a friend, coworker, family member or any other person, either living or dead. You are allowed to keep only one (1) copy of shovel at any given time in your shed. If you break any rule stated above, licence for this shovel is revoked and the shovel reclaimed&nbsp;automatically.&#8221;</p>
<p>Scary, come to think of&nbsp;it.</p>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='title' title='Use these links to share this page with others'>Bookmark and Share</div><div class='linkbuttons'><a href='http://del.icio.us/post?url=http://www.boky.cc/2008/07/02/software-and-media-licencing/&amp;title=Software and media licencing' title='Save to del.icio.us' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/delicious.png' style='width:16px; height:16px;' alt='[del.icio.us] ' /></a> <a href='http://digg.com/submit?phase=2&amp;url=http://www.boky.cc/2008/07/02/software-and-media-licencing/&amp;title=Software and media licencing' title='Digg It!' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/digg.png' style='width:16px; height:16px;' alt='[Digg] ' /></a> <a href='http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://www.boky.cc/2008/07/02/software-and-media-licencing/&amp;title=Software and media licencing' title='Save to Google Bookmarks' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/google.png' style='width:16px; height:16px;' alt='[Google] ' /></a> <a href='http://www.linkedin.com/shareArticle?mini=true&url=http://www.boky.cc/2008/07/02/software-and-media-licencing/&title=Software and media licencing' title='Share on LinkedIn' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/linkedin.png' style='width:16px; height:16px;' alt='[LinkedIn] ' /></a> <a href='http://www.stumbleupon.com/submit?url=http://www.boky.cc/2008/07/02/software-and-media-licencing/&amp;title=Software and media licencing' title='Stumble It!' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/stumbleupon.png' style='width:16px; height:16px;' alt='[StumbleUpon] ' /></a> <a href='https://favorites.live.com/quickadd.aspx?mkt=en-us&amp;url=http://www.boky.cc/2008/07/02/software-and-media-licencing/&amp;title=Software and media licencing' title='Save to Windows Live' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/windowslive.png' style='width:16px; height:16px;' alt='[Windows Live] ' /></a> <a href='http://bookmarks.yahoo.com/toolbar/savebm?opener=tb&amp;u=http://www.boky.cc/2008/07/02/software-and-media-licencing/&amp;t=Software and media licencing' title='Save to Yahoo! Bookmarks' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/yahoo.png' style='width:16px; height:16px;' alt='[Yahoo!] ' /></a> <a href='http://www.feedburner.com/fb/a/emailFlare?itemTitle=Software and media licencing&amp;uri=http://www.boky.cc/2008/07/02/software-and-media-licencing/&amp;loc=en_US' title='Email this to a friend' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/email.png' style='width:16px; height:16px;' alt='[Email] ' /></a>  <a title='See more bookmark and sharing options...' href='http://www.boky.cc/2008/07/02/software-and-media-licencing/#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div><div class='brand'><small><a href='http://www.bookmarkify.com/'>Powered by Bookmarkify&trade;</a></small></div></div>]]></content:encoded>
			<wfw:commentRss>http://www.boky.cc/2008/07/02/software-and-media-licencing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Collecting in Java, again</title>
		<link>http://www.boky.cc/2008/06/20/collecting-in-java-again/#utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=collecting-in-java-again</link>
		<comments>http://www.boky.cc/2008/06/20/collecting-in-java-again/#comments</comments>
		<pubDate>Fri, 20 Jun 2008 11:15:16 +0000</pubDate>
		<dc:creator>boky</dc:creator>
				<category><![CDATA[it]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[productivity]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[usability]]></category>

		<guid isPermaLink="false">http://www.boky.cc/?p=14</guid>
		<description><![CDATA[<br/>
Image via&#160;Wikipedia

Seems that a lot of people think that Java Collections framework needs an update. There are some resents to how Apache&#8217;s Commons Collections Framework is handling things, most of them focusing on not supporting generics and breaking some contracts of the standard collections API.I&#8217;ve talked about Apache&#8217;s framework before. But behold: another player has [...]]]></description>
			<content:encoded><![CDATA[<br/><div class="zemanta-img" style="margin: 1em; float: right; display: block;"><a href="http://en.wikipedia.org/wiki/Image:Googleplex_Welcome_Sign.jpg"><img style="border: medium none; display: block;" src="http://upload.wikimedia.org/wikipedia/en/thumb/e/ee/Googleplex_Welcome_Sign.jpg/202px-Googleplex_Welcome_Sign.jpg" alt="Sign at the Googleplex" /></a><a href="http://en.wikipedia.org/wiki/Image:ASF-logo.svg"><img style="border: medium none; display: block;" src="http://upload.wikimedia.org/wikipedia/commons/thumb/c/cd/ASF-logo.svg/169px-ASF-logo.svg.png" alt="Apache's HTTP server logo" /></a></p>
<p class="zemanta-img-attribution" style="text-align: center">Image via&nbsp;<a href="http://en.wikipedia.org/wiki/Image:Googleplex_Welcome_Sign.jpg" target="_blank">Wikipedia</a></p>
</div>
<p>Seems that a lot of people think that <a href="http://java.sun.com/docs/books/tutorial/collections/">Java Collections framework</a> needs an update. There are some resents to how <a href="http://commons.apache.org/collections/">Apache&#8217;s Commons Collections Framework</a> is handling things, most of them focusing on not supporting generics and breaking some contracts of the standard collections API.I&#8217;ve talked about <a href="http://www.boky.cc/2008/04/05/collecting-objects-in-java/">Apache&#8217;s framework before</a>. But behold: another player has entered the playing fields. This time it&#8217;s <a href="http://code.google.com/p/google-collections">Google</a>. Funny enough they haven&#8217;t tried to fix Apache&#8217;s API but rather develop their own API which they hope will get included into JDK&nbsp;7.</p>
<p>I will do some performance measurements between both and let you know which classes are faster and more optimized. Otherwise, Google presents us with the following (new) collection&nbsp;objects:</p>
<ul>
<li><a href="http://google-collections.googlecode.com/svn/trunk/javadoc/com/google/common/collect/BiMap.html">BiMap</a>, unique two-way map, equivalent to Apache&#8217;s&nbsp;<a href="http://commons.apache.org/collections/api-3.2/org/apache/commons/collections/BidiMap.html">BidiMap</a>.</li>
<li><a href="http://http//google-collections.googlecode.com/svn/trunk/javadoc/com/google/common/collect/Multimap.html">Multimap</a>, equivalent to Apache&#8217;s <a href="http://commons.apache.org/collections/api-3.2/org/apache/commons/collections/MultiMap.html">MultiMap</a>. Both allow multiple values per single&nbsp;key.</li>
<li><a href="http://google-collections.googlecode.com/svn/trunk/javadoc/com/google/common/collect/Multiset.html">Multiset</a> is something that Apache calls a <a href="http://commons.apache.org/collections/api-3.2/org/apache/commons/collections/Bag.html">Bag</a>. Both allow multiple instances of the same value to appear in a&nbsp;set.</li>
<li><a href="http://google-collections.googlecode.com/svn/trunk/javadoc/com/google/common/collect/ReferenceMap.html">ReferenceMap</a>. Surprise, Apache has a class with <a href="http://commons.apache.org/collections/api-3.2/org/apache/commons/collections/map/ReferenceMap.html">the same name</a>.Both do the same. Allow you to use strong/weak/soft references for keys and values. Both are replacements for weirdly designed&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/util/WeakHashMap.html">WeakHashMap</a>.</li>
<li><a href="http://google-collections.googlecode.com/svn/trunk/javadoc/com/google/common/collect/ForwardingMap.html">ForwardingMap</a>/List/Set&#8230; to aid you in creating your own wrapper classes around other collection&nbsp;objects</li>
</ul>
<p>The package also adds some utility classes, which can also be found in various other libraries, but it&#8217;s nice to know we also have them&nbsp;here:</p>
<ul>
<li><a href="http://google-collections.googlecode.com/svn/trunk/javadoc/com/google/common/collect/PeekingIterator.html">PeekingIterator</a> is something that should be in Java&#8217;s collection framework in the first place. It allows you to &#8220;peek&#8221; at the next element without actually grabbing it, as next() does. While not widely useful, it makes some tasks <em>a lot</em>&nbsp;simpler.</li>
<li><a href="http://google-collections.googlecode.com/svn/trunk/javadoc/com/google/common/base/Nullable.html">Nullable</a> annotation, which allows you to clearly define that <strong>null</strong> is an acceptable input parameter for a given metthod. Frankly, I think that <a href="http://www.jetbrains.com/idea/documentation/howto.html">JetBrains approach</a> is better of, since it provides both <strong>Nullable</strong> and <strong>NotNull</strong>, the JAR is only 6KB and annotations are understood by the GUI. Furthermore, results from method cals can also be&nbsp;annotated.</li>
<li>numerous other improvements, and utilities to make your life easier, such as creating an <strong>ArrayList </strong>from Iterator, creating a Map from a list of parameters&nbsp;etc.</li>
</ul>
<p>Also worth of reading is an interview with <a href="http://www.javalobby.org/articles/google-collections/">Kevin and Jared</a>, authors of the package and especially a comparison that&#8217;s available on <a href="http://www.devx.com/Java/Article/36183">another&nbsp;blog</a>.</p>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Zemified by Zemanta" href="http://reblog.zemanta.com/zemified/c599c56f-67fa-4b89-808d-dd4d18152cd5/"><img class="zemanta-pixie-img" style="border: medium none; float: right;" src="http://img.zemanta.com/reblog_a.png?x-id=c599c56f-67fa-4b89-808d-dd4d18152cd5" alt="Zemanta Pixie" /></a></div>
<div class='bookmarkify'><a name='bookmarkify'></a><div class='title' title='Use these links to share this page with others'>Bookmark and Share</div><div class='linkbuttons'><a href='http://del.icio.us/post?url=http://www.boky.cc/2008/06/20/collecting-in-java-again/&amp;title=Collecting in Java, again' title='Save to del.icio.us' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/delicious.png' style='width:16px; height:16px;' alt='[del.icio.us] ' /></a> <a href='http://digg.com/submit?phase=2&amp;url=http://www.boky.cc/2008/06/20/collecting-in-java-again/&amp;title=Collecting in Java, again' title='Digg It!' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/digg.png' style='width:16px; height:16px;' alt='[Digg] ' /></a> <a href='http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://www.boky.cc/2008/06/20/collecting-in-java-again/&amp;title=Collecting in Java, again' title='Save to Google Bookmarks' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/google.png' style='width:16px; height:16px;' alt='[Google] ' /></a> <a href='http://www.linkedin.com/shareArticle?mini=true&url=http://www.boky.cc/2008/06/20/collecting-in-java-again/&title=Collecting in Java, again' title='Share on LinkedIn' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/linkedin.png' style='width:16px; height:16px;' alt='[LinkedIn] ' /></a> <a href='http://www.stumbleupon.com/submit?url=http://www.boky.cc/2008/06/20/collecting-in-java-again/&amp;title=Collecting in Java, again' title='Stumble It!' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/stumbleupon.png' style='width:16px; height:16px;' alt='[StumbleUpon] ' /></a> <a href='https://favorites.live.com/quickadd.aspx?mkt=en-us&amp;url=http://www.boky.cc/2008/06/20/collecting-in-java-again/&amp;title=Collecting in Java, again' title='Save to Windows Live' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/windowslive.png' style='width:16px; height:16px;' alt='[Windows Live] ' /></a> <a href='http://bookmarks.yahoo.com/toolbar/savebm?opener=tb&amp;u=http://www.boky.cc/2008/06/20/collecting-in-java-again/&amp;t=Collecting in Java, again' title='Save to Yahoo! Bookmarks' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/yahoo.png' style='width:16px; height:16px;' alt='[Yahoo!] ' /></a> <a href='http://www.feedburner.com/fb/a/emailFlare?itemTitle=Collecting in Java, again&amp;uri=http://www.boky.cc/2008/06/20/collecting-in-java-again/&amp;loc=en_US' title='Email this to a friend' onclick='target="_blank";' rel='nofollow'><img src='http://www.boky.cc/wp-content/plugins/bookmarkify/email.png' style='width:16px; height:16px;' alt='[Email] ' /></a>  <a title='See more bookmark and sharing options...' href='http://www.boky.cc/2008/06/20/collecting-in-java-again/#bookmarkify' rel='nofollow'><small>More&nbsp;&raquo;</small></a></div><div class='brand'><small><a href='http://www.bookmarkify.com/'>Powered by Bookmarkify&trade;</a></small></div></div>]]></content:encoded>
			<wfw:commentRss>http://www.boky.cc/2008/06/20/collecting-in-java-again/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
