<?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>Databases and Life</title>
	<atom:link href="http://www.databasesandlife.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.databasesandlife.com</link>
	<description>Adrian Smith's blog</description>
	<lastBuildDate>Tue, 09 Mar 2010 16:12:21 +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>NoSQL becuase SQL is too slow?</title>
		<link>http://www.databasesandlife.com/436/</link>
		<comments>http://www.databasesandlife.com/436/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 16:36:13 +0000</pubDate>
		<dc:creator>adrian</dc:creator>
				<category><![CDATA[uboot]]></category>

		<guid isPermaLink="false">http://www.databasesandlife.com/?p=436</guid>
		<description><![CDATA[I just read this excellent article relating to the reasoning for using NoSQL databases being performance problems.
http://thoughts.j-davis.com/2010/03/07/scalability-and-the-relational-model/
However, I wonder if it&#8217;s even reasonable to search for solutions to performance problems with the relational model; NoSQL, etc.
I think as computers get faster and faster (CPUs, SSDs, more memory, &#8230;) the set of problems which are &#8220;too [...]]]></description>
			<content:encoded><![CDATA[<p>I just read this excellent article relating to the reasoning for using NoSQL databases being performance problems.</p>
<p><a href="http://thoughts.j-davis.com/2010/03/07/scalability-and-the-relational-model/">http://thoughts.j-davis.com/2010/03/07/scalability-and-the-relational-model/</a></p>
<p>However, I wonder if it&#8217;s even reasonable to search for solutions to performance problems with the relational model; NoSQL, etc.</p>
<p>I think as computers get faster and faster (CPUs, SSDs, more memory, &#8230;) the set of problems which are &#8220;too slow&#8221; for a particular technology (or mindset, ..) get fewer and fewer.</p>
<p>I used to have the pleasure of having to optimize systems (based on SQL, some of our solutions involved leaving the relational model); e.g. community with 4M users (uboot), but nowadays I have no customer where even an open-source database installed on reasonably inexpensive hardware is insufficient.</p>
<p>Of course, that&#8217;s just my experience, and there certainly are many problems, companies, etc. today which require solving performance problems in the database, but I assert a lot of the people proposing NoSQL as a solution to performance problems with SQL databases don&#8217;t have the performance problems in the first place; I mean not everyone is implementing Facebook, Google, &#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.databasesandlife.com/436/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upgrade to Lenny, everything down :(</title>
		<link>http://www.databasesandlife.com/upgrade-to-lenny-everything-down/</link>
		<comments>http://www.databasesandlife.com/upgrade-to-lenny-everything-down/#comments</comments>
		<pubDate>Sun, 21 Feb 2010 19:54:52 +0000</pubDate>
		<dc:creator>adrian</dc:creator>
				<category><![CDATA[Broken]]></category>

		<guid isPermaLink="false">http://www.databasesandlife.com/?p=430</guid>
		<description><![CDATA[How annoying, I upgraded from Debian Etch (Apache 2.2.3-4) to Debian Lenny (Apache 2.2.9), and then my Subversion Server (over HTTPS) gave the following error when surfed to from Firefox, which worked fine before:
An error occurred during a connection to svn.example.com.
SSL received a record that exceeded the maximum permissible length.
(Error code: ssl_error_rx_record_too_long)
What does that mean!? [...]]]></description>
			<content:encoded><![CDATA[<p>How annoying, I upgraded from Debian Etch (Apache 2.2.3-4) to Debian Lenny (Apache 2.2.9), and then my Subversion Server (over HTTPS) gave the following error when surfed to from Firefox, which worked fine before:</p>
<blockquote><p>An error occurred during a connection to svn.example.com.<br />
SSL received a record that exceeded the maximum permissible length.<br />
(Error code: ssl_error_rx_record_too_long)</p></blockquote>
<p>What does that mean!? There&#8217;s not a great deal of info on the web.</p>
<p>Fundamentally, in my case, the first thing to work out, is that that error message means (or meant, in my case at least) HTTP was being transmitted over the HTTPS port, i.e. it wasn&#8217;t valid HTTPS at all, thus the protocol error. This could be confirmed by surfing to http://&#8230;:443/ (i.e. not https://) and seeing that the content (the Subversion server in my case) was correct.</p>
<p>The question was why? I had a bunch of sites in the &#8220;sites-enabled&#8221; directory, and another one of them (not my Subversion site!) had a</p>
<pre>&lt;VirtualHost *&gt;
</pre>
<p>whereas it should have been</p>
<pre>&lt;VirtualHost *:80&gt;
</pre>
<p>i.e. the port was missing. I&#8217;m not quite sure why it had that effect, as the request to the Subversion HTTPS URL did deliver the Subversion content, just not over HTTPS any more. But perhaps without the :80, it decided all ports should be subject to NameVirtualHost, and as that&#8217;s not possible with HTTPS, switched HTTPS off for all ports and all sites?</p>
<p>Nightmare &#8230;.</p>
<p>See also: <a href="http://stackoverflow.com/questions/119336/ssl-error-rx-record-too-long-and-apache-ssl">http://stackoverflow.com/questions/119336/ssl-error-rx-record-too-long-and-apache-ssl</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.databasesandlife.com/upgrade-to-lenny-everything-down/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>We took uboot.com online 10 years ago</title>
		<link>http://www.databasesandlife.com/we-took-uboot-com-online-10-years-ago/</link>
		<comments>http://www.databasesandlife.com/we-took-uboot-com-online-10-years-ago/#comments</comments>
		<pubDate>Sun, 21 Feb 2010 04:30:50 +0000</pubDate>
		<dc:creator>adrian</dc:creator>
				<category><![CDATA[uboot]]></category>

		<guid isPermaLink="false">http://www.databasesandlife.com/?p=425</guid>
		<description><![CDATA[At approx 6:30am on Monday 21st Feb 2000 my boss, my colleague and I took the first version of Uboot online.
It certainly didn&#8217;t have all the features it needed back then, it took us one extra week to add an address book to the messaging functionality, for example. And it didn&#8217;t have any photo sharing, [...]]]></description>
			<content:encoded><![CDATA[<p>At approx 6:30am on Monday 21st Feb 2000 my boss, my colleague and I took the first version of Uboot online.</p>
<p>It certainly didn&#8217;t have all the features it needed back then, it took us one extra week to add an address book to the messaging functionality, for example. And it didn&#8217;t have any photo sharing, video sharing, blogging, or the e-commerce functions that it has now.</p>
<p>It&#8217;s actually amazing how fast we did develop the first version: a team of three software developers, I started at the company on 3rd Jan 2000 and completed two other projects before starting Uboot; the first commit was on 19th Jan 2000.</p>
<p>With a few exceptions, I have been involved with Uboot software development, sometimes more, sometimes less, since then.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.databasesandlife.com/we-took-uboot-com-online-10-years-ago/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>&#8220;me&#8221; vs &#8220;you&#8221; in user-interface dialogs</title>
		<link>http://www.databasesandlife.com/me-vs-you-in-user-interface-dialogs/</link>
		<comments>http://www.databasesandlife.com/me-vs-you-in-user-interface-dialogs/#comments</comments>
		<pubDate>Mon, 15 Feb 2010 12:20:13 +0000</pubDate>
		<dc:creator>adrian</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.databasesandlife.com/?p=421</guid>
		<description><![CDATA[Computers, if they are addressing the user, should address the user as &#8220;you&#8221;, not as &#8220;me&#8221;.
Computers need, from time to time, to address the user, for example &#8220;You have updated your setting successfully&#8221;.
Some programs use the word &#8220;you&#8221; to address the user, some use the word &#8220;me&#8221; on the grounds that the user is reading [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Computers, if they are addressing the user, should address the user as &#8220;you&#8221;, not as &#8220;me&#8221;.</strong></p>
<p>Computers need, from time to time, to address the user, for example &#8220;You have updated your setting successfully&#8221;.</p>
<p>Some programs use the word &#8220;you&#8221; to address the user, some use the word &#8220;me&#8221; on the grounds that the user is reading it, and to them, they are &#8220;me&#8221;.</p>
<p>However, using &#8220;me&#8221; to address someone is ridiculous! That&#8217;s as logical as a human using the word &#8220;I&#8221; or &#8220;me&#8221; to refer to the recipient of a piece of communication, &#8220;hey, do I fancy going to the pub?&#8221; on the grounds that, to the recipient, they are &#8220;I&#8221;.</p>
<p>&#8220;me&#8221; is the source of communication, &#8220;you&#8221; is the destination of communication; if a computer is communicating, the user is the recipient of the communication so should be called &#8220;you&#8221;.</p>
<p>Specifically Gmail is the main culprit for this in my life, it lists conversations between &#8220;me, Joe&#8221;; having &#8220;you, Joe&#8221; or &#8220;Adrian, Joe&#8221; would be much better! Gmail even, on the same screen that it lists conversations between &#8220;me&#8221; and other people, says &#8220;You are using 25% of your 7000MB&#8221;, so it&#8217;s not even consistent!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.databasesandlife.com/me-vs-you-in-user-interface-dialogs/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Code generation? Don&#8217;t generate to Java</title>
		<link>http://www.databasesandlife.com/java-method-64k-limit/</link>
		<comments>http://www.databasesandlife.com/java-method-64k-limit/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 16:40:13 +0000</pubDate>
		<dc:creator>adrian</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.databasesandlife.com/?p=407</guid>
		<description><![CDATA[I tried to write a program using Java; it all seemed to be going well but then I hit a ridiculous limit. Java cannot be used for this type of problem. I have now completely re-written it in a different programming language, and that works fine.
Be aware of this limit. I was unaware of it [...]]]></description>
			<content:encoded><![CDATA[<p><strong>I tried to write a program using Java; it all seemed to be going well but then I hit a ridiculous limit. Java cannot be used for this type of problem. I have now completely re-written it in a different programming language, and that works fine.</strong></p>
<p>Be aware of this limit. I was unaware of it when I started this project. But it makes Java completely unsuitable for a whole class of problem.</p>
<p>My customer supplies me with a config file from time to time, this specifies a certain algorithm. When the user enters data, this algorithm must be applied. The algorithm is complex, so performance is an issue.</p>
<p>The solution I chose was to <strong>generate code</strong> to execute the algorithm, based on the information in the config file. This is a valid computer-science approach, and is used for similar problems. For example, language parsers are often expressed as a grammar, and code to parse documents in the grammar are generated. JSPs are turned into Java classes which are then compiled and executed. WebTek <a href="http://github.com/prozessor13/webtek/blob/master/lib/WebTek/Compiler.pm">pre-compiles</a> HTML templates containing macros into code which produces the resulting HTML when executed.</p>
<p>However, <strong>don&#8217;t try this in Java</strong>, unless you are only working with small problems. A single method in Java can only be 64KB in size, once compiled.<br />
<a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4262078"> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4262078</a></p>
<p>This means, JSPs can only be of a certain length, parsers can only parse languages of a certain complexity, if WebTek were written in Java then templates could only be of a certain length and complexity, and so on. Do you want to place such restrictions on the software you produce?</p>
<p>My specific problem involves simulating one million variations to a particular solution. How can I fit that into 64K?</p>
<ul>
<li>That is 0.06 bytes per solution variation; yet the simulation of a single variation involves many lines of code (i.e. in total compiling to more than 0.06 bytes!).</li>
<li>I could put each variation into its own method, and have a big method which calls them all&#8212;but a method call takes more than 0.06 bytes!</li>
<li>I could have a hierarchy of methods: one main method which calls, say, 100 sub-methods, each of those call 100 sub-sub-methods, and finally those methods call the methods for the individual variations.</li>
</ul>
<p>It&#8217;s not even possible to know how many bytes a method will generate to! So, as the complexity of the simulation of a variation is expressed in the config file, I would have to essentially have to do a &#8220;trial and error&#8221; approach: generate a method, compile it, if I get the error concerning the 64KB limit, split the problem up into slightly smaller methods, try the compilation again, repeat, etc. (And the Java compiler is not even very fast.)</p>
<p><strong>This is all so wrong! </strong>This is complexity, which isn&#8217;t solving the customer&#8217;s problem. This complexity costs me time (and thus my customer money), complexity leads to bugs and difficulty of maintenance, etc.</p>
<p>So I have changed the language. <strong>Rather than generate Java, I generate C</strong> and compile it using the GNU gcc compiler. <a href="http://www.gnu.org/prep/standards/standards.html#Semantics">From the GNU coding standards</a>:</p>
<blockquote><p>
Avoid arbitrary limits on the length or number of any data structure, including file names, lines, files, and symbols, by allocating all data structures dynamically.
</p></blockquote>
<p>This is a good standard! I like it. All programs should be written with this in mind. Your program may well be online in 10 or 20 years, and the hardware may well have changed: a 64KB limit may seem reasonable one year but is a real limitation 10 or 20 years later in software which would otherwise still be useful.</p>
<p>So, if you are solving this type of problem, don&#8217;t use Java.</p>
<p>P.S. On a separate project I used a similar approach using Perl, and that worked out fine too.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.databasesandlife.com/java-method-64k-limit/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Learnt two new smileys today</title>
		<link>http://www.databasesandlife.com/learnt-two-new-smileys-today/</link>
		<comments>http://www.databasesandlife.com/learnt-two-new-smileys-today/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 11:46:12 +0000</pubDate>
		<dc:creator>adrian</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.databasesandlife.com/?p=398</guid>
		<description><![CDATA[Thanks to Nessus!
\o/ &#8211; arms raised in the air &#8211; success gesture
&#60;3&#160; &#8211; heart
]]></description>
			<content:encoded><![CDATA[<p>Thanks to <a href="http://www.nessus.at/">Nessus</a>!</p>
<p><strong><code>\o/</code></strong> &#8211; arms raised in the air &#8211; success gesture<br />
<strong><code>&lt;3&nbsp;</code></strong> &#8211; heart</p>
]]></content:encoded>
			<wfw:commentRss>http://www.databasesandlife.com/learnt-two-new-smileys-today/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PHP infinite recursion</title>
		<link>http://www.databasesandlife.com/php-infinite-recursion/</link>
		<comments>http://www.databasesandlife.com/php-infinite-recursion/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 12:50:11 +0000</pubDate>
		<dc:creator>adrian</dc:creator>
				<category><![CDATA[Broken]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.databasesandlife.com/?p=388</guid>
		<description><![CDATA[What can I say? How about &#8220;toy language&#8221;?

$ php -r 'function foo() { foo(); } foo();'
Segmentation fault

I&#8217;m not saying that infinite recursion is a good idea, but during development it can happen by accident, and I don&#8217;t expect such a simple error to crash the PHP interpreter! (Also it took me about 20 minutes to [...]]]></description>
			<content:encoded><![CDATA[<p>What can I say? How about &#8220;toy language&#8221;?</p>
<pre>
$ php -r 'function foo() { foo(); } foo();'
Segmentation fault
</pre>
<p>I&#8217;m not saying that infinite recursion is a good idea, but during development it can happen by accident, and I don&#8217;t expect such a simple error to crash the PHP interpreter! (Also it took me about 20 minutes to debug this problem, as I had no idea where it happened, nor indeed what the problem was..)</p>
<p><i>PHP 5.2.6 on Linux 2.6.26 Debian</i></p>
]]></content:encoded>
			<wfw:commentRss>http://www.databasesandlife.com/php-infinite-recursion/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>&#8220;Go&#8221; programming language</title>
		<link>http://www.databasesandlife.com/go-programming-language/</link>
		<comments>http://www.databasesandlife.com/go-programming-language/#comments</comments>
		<pubDate>Wed, 11 Nov 2009 16:46:06 +0000</pubDate>
		<dc:creator>adrian</dc:creator>
				<category><![CDATA[Coding]]></category>

		<guid isPermaLink="false">http://www.databasesandlife.com/?p=372</guid>
		<description><![CDATA[Before everyone gets too excited about the &#8220;Go&#8221; language, let&#8217;s not forget it lacks:

Exceptions
Assertions
Inheritance
Generic types

Generics are necessary to express concepts like List&#60;List&#60;MyType&#62;&#62;. If you are in to static typing, then you need to be able to express those concepts. (And if you are not, then a statically typed language like Go is not for you [...]]]></description>
			<content:encoded><![CDATA[<p>Before everyone gets too excited about the &#8220;Go&#8221; language, let&#8217;s not forget it lacks:</p>
<ul class=tight>
<li><a href="/exceptions-use-them/">Exceptions</a></li>
<li>Assertions</li>
<li>Inheritance</li>
<li>Generic types</li>
</ul>
<p>Generics are necessary to express concepts like List&lt;List&lt;MyType&gt;&gt;. If you are in to static typing, then you need to be able to express those concepts. (And if you are not, then a statically typed language like Go is not for you anyway.)</p>
<p>Obviously it has good features as well, such as its concurrency constructs and type inference, but without those features above, I can&#8217;t see how you can do any useful modeling in the language; or rather how can you can express a useful model in the language without losing a lot of information.</p>
<p><a href="http://golang.org/doc/go_lang_faq.html">http://golang.org/doc/go_lang_faq.html</a></p>
<p>Perhaps those features will be added in future versions.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.databasesandlife.com/go-programming-language/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>3 changes price from £10 to £1250 then charge me to cancel</title>
		<link>http://www.databasesandlife.com/3-changes-price-from-10-to-1250-then-charge-me-to-cancel/</link>
		<comments>http://www.databasesandlife.com/3-changes-price-from-10-to-1250-then-charge-me-to-cancel/#comments</comments>
		<pubDate>Fri, 18 Sep 2009 14:27:10 +0000</pubDate>
		<dc:creator>adrian</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.databasesandlife.com/?p=363</guid>
		<description><![CDATA[Where do I begin to describe how much I hate three (mobile operator UK) today.
(I had a mobile internet subscription / device from them.)
Firstly &#8211; and this is not new &#8211; the program they supply with the computer to show you how many MB you&#8217;ve used (and thus how much you&#8217;ve got left before they charge [...]]]></description>
			<content:encoded><![CDATA[<p>Where do I begin to describe how much I hate <a href="http://three.co.uk/">three</a> (mobile operator UK) today.</p>
<p>(I had a mobile internet subscription / device from them.)</p>
<p>Firstly &#8211; and this is not new &#8211; the program they supply with the computer to show you how many MB you&#8217;ve used (and thus how much you&#8217;ve got left before they charge you) is &#8220;inaccurate&#8221; (= underestimates the amount you&#8217;ve used), some support person from three told me that. But this program has a massive window that comes up, with the 3 logo plastered all over it &#8211; I mean it&#8217;s not exactly obvious that this program is inaccurate. Why don&#8217;t they just put a huge warning up saying &#8220;this data is inaccurate&#8221;?</p>
<p>The product is something like 1000 MB surfing for £10 a month. The main point, for me, being that you can use it in certain foreign countries, including Austria, and the price is the same as if you used it in the UK. This is why I bought it &#8211; so I could use it from both the UK and Austria. This was called <strong>&#8220;roam like home&#8221;</strong>.</p>
<p>Well &#8211; that&#8217;s no longer the case. I noticed a bill (thankfully only £15), called them, tried to cancel, they told me I&#8217;d have to pay a cancellation fee as I&#8217;m still in the contract period. I mean this is so totally outrageous.</p>
<p>So I spent 45 minutes on the phone, failed to get them to drop the early cancellation fee (which admittedly is only 20 pounds). They say then sent me an SMS informing me of the changes, giving me 30 days in which to cancel. As I hadn&#8217;t cancelled within that time, I had to pay the fee.</p>
<p>However a UMTS modem for a computer &#8211; which I only use very rarely, simply isn&#8217;t switched on when it&#8217;s not in use. Normal SMS expire if they aren&#8217;t delivered after a certain period of time (10 days?) but they assured me this was a &#8220;special&#8221; SMS which didn&#8217;t expire. And I have often had problems with SMS when roaming, but they assured me this couldn&#8217;t have been the case.) Even if that had been the case, if the device is off for those 30 days, I wouldn&#8217;t receive the SMS in time. And anyway, I didn&#8217;t receive the SMS at all (but they claim I &#8220;must have done&#8221;)</p>
<p>And they also said they posted it on their website &#8211; nice one, as if I surf to three.co.uk every day to hang out &#8211; it&#8217;s the new Facebook, so much fun to be had there&#8230;.</p>
<p>They also say they are not obliged to provide this service, it&#8217;s not in the terms and conditions. I knew they&#8217;d say this. But there were <em>massive</em> advertisements for this feature when I went into the shop and bought it &#8211; I mean many huge person-size signs advertising the service. The guy in the shop told me this was the product, he didn&#8217;t say &#8220;this is the product until further notice&#8221;. I even have an email from 3 confirming this is the case, again with no mention of this being something which could expire or change:</p>
<blockquote><p>Austria is a 3 like home network. If you use data in this country then it’ll be first deducted from your allowance provided you are latched unto 3 network.</p>
<p>Normally out of allowance charges in Austria is £3.00 per MB however, as Austria is a 3 like home country if you exceed your allowance and are roaming to 3 network, you’ll be charged 10 pence per MB.</p></blockquote>
<p>I mean I understand services can change over their lifetime, and prices can change, etc. But I mean this is no minor service change:</p>
<ul class=tight>
<li>Before, when I bought it, I can use 1000 MB in Austria for <strong>£10</strong></li>
<li>Now, 1 MB in Austria costs £1.25, so 1000 MB would be <strong>£1,250</strong></li>
</ul>
<p>So I spoke to them, to all their &#8220;managers&#8221; etc, on the phone, and they told me there&#8217;s nothing they can do. I didn&#8217;t cancel it in time; they understand my frustration but their hands are tied.</p>
<p>They&#8217;ve fundamentally changed the service &#8211; making it useless to me &#8211; and now charge me for cancelling it</p>
<p>Thankfully it didn&#8217;t cost me much - £15 in extra MB used, and £20 cancellation fee. But that&#8217;s mainly due to the wisdom I acquired by being charged <strong>€2500</strong> by another mobile operator. <a href="http://britishexpats.com/forum/showthread.php?t=629044">This guy</a> got charged <strong>£500</strong> due to this change by 3, for example.</p>
<p>I hate mobile operators. Three is now added to my list of companies I&#8217;ll buy anything from again, the other being <a href="http://www.databasesandlife.com/deceptive-practices-in-mobile-data-tariffs/">T-Mobile</a>.</p>
<p>I mean this is capitalism &#8211; the operators are happy when they can charge people a few thousand Euros because they didn&#8217;t understand they were roaming, or didn&#8217;t understand the T&#038;C had changed. As a consumer one is powerless. Capitalism shouldn&#8217;t have come to this.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.databasesandlife.com/3-changes-price-from-10-to-1250-then-charge-me-to-cancel/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Java: Always explicitly specify which XML parser to use</title>
		<link>http://www.databasesandlife.com/java-always-explicitly-specify-which-xml-parser-to-use/</link>
		<comments>http://www.databasesandlife.com/java-always-explicitly-specify-which-xml-parser-to-use/#comments</comments>
		<pubDate>Tue, 15 Sep 2009 12:42:26 +0000</pubDate>
		<dc:creator>adrian</dc:creator>
				<category><![CDATA[Broken]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.databasesandlife.com/?p=351</guid>
		<description><![CDATA[There is the following design error in Java (at least in Servlets):

A server may serve multiple applications; each application may use different libraries or even different versions of the same library, &#8220;side by side&#8221;.
XML parsers, transformers (XSLT), etc., have a standard interface, and there may be different implementations of this interface from different vendors, open-source [...]]]></description>
			<content:encoded><![CDATA[<p>There is the following design error in Java (at least in Servlets):</p>
<ol>
<li>A server may serve multiple applications; each application may use different libraries or even different versions of the same library, &#8220;side by side&#8221;.</li>
<li>XML parsers, transformers (XSLT), etc., have a standard interface, and there may be different implementations of this interface from different vendors, open-source projects, etc.</li>
<li>Which XML parser, transformed etc. is actually used depends on a <strong>global system variable</strong>.</li>
</ol>
<p>And it&#8217;s point 3 that&#8217;s the problem really. Points 1 and 2 are debatable: they certainly bring advantages, but they certainly bring complexity too.</p>
<p>I just had the problem that one of my web applications stopped working, but only intermittently. Restarting the server led to everything being OK, but later things would not be OK. I do hate environments where everything appears to work, yet in fact doesn&#8217;t. I mean how do you know when you&#8217;re &#8220;done&#8221; in such an environment? (Or how do you even know you are in such an environment?)</p>
<p>The bug was caused by:</p>
<ol>
<li>Application one used the default XML parser, and didn&#8217;t have any extra JARs (libraries) for reading XML</li>
<li>Application two required a special XML parser, set the global variable so it would be used, and included the JARs necessary for the special XML parser</li>
</ol>
<p>So when a request came to application 1, <em>after </em>a request had come to application 2, then the system would try to instantiate the special XML parser within application 1 (specified in the global variable set by application 2), but wouldn&#8217;t find it, as it wasn&#8217;t deployed in application 1 (and applications can&#8217;t use one another&#8217;s libraries, due to feature #1).</p>
<p>This seems obvious when one describes it, but looking at the logs, on a live server, with the system down and the clock ticking? &#8211; Far from obvious.</p>
<p>So now, I assert, every time you want to create an XML parser, do the following:</p>
<h3>If you require a special XML library, use:</h3>
<pre>
System.<strong>setProperty</strong>("javax.xml.parsers.DocumentBuilderFactory",
    "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl");
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
...
</pre>
<h3>If you require the standard XML library, use:</h3>
<pre>
Properties systemProperties = System.getProperties();
systemProperties.<strong>remove</strong>("javax.xml.parsers.DocumentBuilderFactory");
System.setProperties(systemProperties);
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
...
</pre>
<p>There is also the possibility to pass a parameter to DocumentBuilderFactory to specify which XML parser technology to use. That&#8217;s a good option too, as it wouldn&#8217;t &#8220;corrupt&#8221; this global variable (&#8220;system property&#8221;). However I think one should be defensive, and always delete the global variable if one wishes to use the standard XML parser, and therefore it doesn&#8217;t matter if this global variable gets corrupted or not.</p>
<h3>Never do the following:</h3>
<pre>
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
</pre>
<p>This simply relies on whichever XML parser is currently set in the global variable. You have no way to guarantee that some other application running on the same server won&#8217;t set the global variable to use an XML parser you don&#8217;t have installed in your application. Even if you have control of the server and all applications, you don&#8217;t know what software you&#8217;ll be writing in the future. (In this case I installed a new application to a server which&#8217;d been running fine for 1 year, but due to setting the global variable, the old application broke..)</p>
<p>The same applies for all those other &#8220;factory&#8221; situations such as TransformerFactory.newInstance() etc.</p>
<p>This feels all quite inelegant to me, and has just cost me a lot of time, and it&#8217;s not as if I&#8217;m so new to programming Java. I am wondering if there is a better way to approach it? Or is Java just broken in this particular respect?</p>
<p>P.S. This is not the only thing that went wrong with the old application today. I upgraded from Java 5 to Java 6 and suddenly some XML was not compliant against a schema according to Java &#8211; I had hit <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6529766">this error</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.databasesandlife.com/java-always-explicitly-specify-which-xml-parser-to-use/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
