<?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 &#187; Broken</title>
	<atom:link href="http://www.databasesandlife.com/category/bugs/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.databasesandlife.com</link>
	<description>Adrian Smith's blog</description>
	<lastBuildDate>Wed, 14 Dec 2011 10:13:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>&#8220;childs&#8221; is not a word</title>
		<link>http://www.databasesandlife.com/childs/</link>
		<comments>http://www.databasesandlife.com/childs/#comments</comments>
		<pubDate>Wed, 14 Dec 2011 10:12:38 +0000</pubDate>
		<dc:creator>adrian</dc:creator>
				<category><![CDATA[Broken]]></category>

		<guid isPermaLink="false">http://www.databasesandlife.com/?p=921</guid>
		<description><![CDATA[I&#8217;ve seen this quite a few times, and I feel it&#8217;s worth mentioning, as it perhaps isn&#8217;t obvious. The plural of the word child is children and not childs. org.apache.wicket.MarkupContainer (add method)]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve seen this quite a few times, and I feel it&#8217;s worth mentioning, as it perhaps isn&#8217;t obvious. The plural of the word <strong>child</strong> is <strong>children</strong> and <em>not</em> <strong>childs</strong>.</p>
<p><a href="http://wicket.apache.org/apidocs/1.4/org/apache/wicket/MarkupContainer.html#add%28org.apache.wicket.Component...%29">org.apache.wicket.MarkupContainer (add method)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.databasesandlife.com/childs/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>curtime</title>
		<link>http://www.databasesandlife.com/curtime/</link>
		<comments>http://www.databasesandlife.com/curtime/#comments</comments>
		<pubDate>Thu, 07 Jul 2011 15:22:04 +0000</pubDate>
		<dc:creator>adrian</dc:creator>
				<category><![CDATA[Broken]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://www.databasesandlife.com/?p=845</guid>
		<description><![CDATA[The MySQL function curtime has (at least) the following issues: The function returns the current time as a number i.e. the time quarter past 8 would be returned from the function as the number 201500. (So if you subtract one from such a number you get 201499 which has no meaning.) The function only returns this [...]]]></description>
			<content:encoded><![CDATA[<p>The MySQL function <a href="http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_curtime">curtime</a> has (at least) the following issues:</p>
<ol>
<li><strong>The function returns the current time as a number</strong> i.e. the time quarter past 8 would be returned from the function as the number 201500. (So if you subtract one from such a number you get 201499 which has no meaning.)</li>
<li><strong>The function only returns this</strong> if you use it in an &#8220;integer context&#8221;, i.e. (x+0) causes x to be evaluated to an integer. (Otherwise it produces a string in a different format.)</li>
<li><strong>At some point the function was changed</strong> not to return an integer but to return a decimal with 6 decimal places. As far as I can tell these 6 decimal places are always zero. The example in the documentation also supports this experience.</li>
<li><strong>There is no way to specify a timezone</strong>. When going from a point in time (e.g. unix time or simply the concept of &#8220;now&#8221;) to/from an external format (hours, minutes, year, &#8230;) you must <em>always specify a timezone</em>. The concept of the &#8220;default timezone&#8221; should just be eradicated and deleted from the world. If I had a time-machine, the first thing I would do is go back and prevent this concept&#8217;s creation. (The user must see the data in their timezone, which on a web application needn&#8217;t be the same as the server&#8217;s. And if you are writing a desktop application, you need to decide explicitly to use the user&#8217;s timezone, as not all data might be for the user, e.g. data from a server or database.)</li>
<li><strong>I don&#8217;t really think the name of the function is very good</strong> (saving characters by abbreviating the name, but why?)</li>
</ol>
<p>Why would you ever use a function? Why would you ever add it to your database product. <em>*Shakes Head*</em></p>
<p>I welcome feedback of the form &#8220;this is an amazing function, I&#8217;ve used it my application and it fitted my need exactly&#8221;. I do really welcome this. Please don&#8217;t hold back.</p>
<p>Related: <a href="http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_curdate">curdate</a>, <a href="http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_now">now</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.databasesandlife.com/curtime/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The method invocation operator, and expressions, in PHP</title>
		<link>http://www.databasesandlife.com/the-method-invocation-operator-and-expressions-in-php/</link>
		<comments>http://www.databasesandlife.com/the-method-invocation-operator-and-expressions-in-php/#comments</comments>
		<pubDate>Wed, 01 Jun 2011 14:01:48 +0000</pubDate>
		<dc:creator>adrian</dc:creator>
				<category><![CDATA[Broken]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.databasesandlife.com/?p=826</guid>
		<description><![CDATA[PHP is a weird language. $x = new Foo(); print $x-&#62;bar(); works fine as you&#8217;d expect. but print new Foo()-&#62;bar(); print (new Foo())-&#62;bar(); all do not work. I do not understand how you can build an expression parser, where the code above works, and the code below does not. It&#8217;s almost as if &#8220;$x = [...]]]></description>
			<content:encoded><![CDATA[<p>PHP is a weird language.</p>
<pre>
$x = new Foo();
print $x-&gt;bar();
</pre>
<p>works fine as you&#8217;d expect. but</p>
<pre>
print new Foo()-&gt;bar();
print (new Foo())-&gt;bar();
</pre>
<p>all do not work.</p>
<p>I do not understand how you can build an expression parser, where the code above works, and the code below does not. It&#8217;s almost as if &#8220;$x = new XXX(xxx)&#8221; a separate case searched for by the parser?</p>
<p>I mean if you have an expression parser capable of handling brackets, i.e. (1+2)*4, and you have the expression (new Foo()) and you have the concept of $object->method() then how can it possibly not work?</p>
<pre>
$ <strong>cat -n x.php</strong>
     1  &lt;?php
     2
     3  class Foo {
     4     function bar() { return 4; }
     5  }
     6
     7  $foo = new Foo();
     8  print $foo-&gt;bar();
     9
    10  print (new Foo())-&gt;bar();

$ <strong>php -e x.php</strong>
Parse error: syntax error, unexpected T_OBJECT_OPERATOR
in /home/adrian/x.php on line 10
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.databasesandlife.com/the-method-invocation-operator-and-expressions-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quotes in CSV Files</title>
		<link>http://www.databasesandlife.com/quotes-in-csv-files/</link>
		<comments>http://www.databasesandlife.com/quotes-in-csv-files/#comments</comments>
		<pubDate>Mon, 11 Apr 2011 16:48:24 +0000</pubDate>
		<dc:creator>adrian</dc:creator>
				<category><![CDATA[Broken]]></category>

		<guid isPermaLink="false">http://www.databasesandlife.com/?p=814</guid>
		<description><![CDATA[Quotes in CSV files are a classic case of a solution to a problem, which in fact does nothing to solve the problem, but which does increase complexity. The problem: If you have a row of data like foo,bar and you wish to include commas in one data element, you can&#8217;t, as the recipient system [...]]]></description>
			<content:encoded><![CDATA[<p>Quotes in CSV files are a classic case of a solution to a problem, which in fact does nothing to solve the problem, but which does increase complexity.</p>
<p>The problem: If you have a row of data like <strong>foo,bar</strong> and you wish to include commas in one data element, you can&#8217;t, as the recipient system will treat the comma as a field separator as opposed to part of the data. The solution used by programs like Excel: surround such data in double-quotes, i.e. <strong>&#8220;fo,o&#8221;,bar</strong>.</p>
<p>In my opinion, there are two solutions to embedding data in other data (e.g. a string in a CSV file, or a piece of arbitrary text in an XML file):</p>
<ol class="tight">
<li>Either<strong> any character</strong> may be contained within the embedded data</li>
<li>Or <strong>only certain characters</strong> may be contained within the embedded data</li>
</ol>
<p>If you are in situation #2, it doesn&#8217;t really matter <em>how many</em> characters you can/can&#8217;t contain, the fact is, you&#8217;ll have to deal with the situation.</p>
<p>The CSV solution if introducing double-quotes has simply been changed the problem from &#8220;you can&#8217;t use commas&#8221; to &#8220;you can&#8217;t use double-quotes&#8221; which are pretty equivalent problems IMHO. Yet, as with most solutions, the complexity has been increased by its introduction.</p>
<p>There needs to be a solution to the new problem of &#8220;you can&#8217;t use double-quotes&#8221;, and that solution should be to define an escape character e.g. &#8220;\&#8221; to prefix the double-quotes in case you wish to represent them literally. And that solution would work just as well to solve the original &#8220;you can&#8217;t use commas&#8221; problem!</p>
<p>(In fact the solution chosen by Excel is to use two double-quotes to represent a literal double-quote, and not an escape prefix like the backslash: this makes parsing harder and can&#8217;t be used for field separators as they couldn&#8217;t be differentiated from two field separators around an empty field.)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.databasesandlife.com/quotes-in-csv-files/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>VPN fail</title>
		<link>http://www.databasesandlife.com/vpn-fail/</link>
		<comments>http://www.databasesandlife.com/vpn-fail/#comments</comments>
		<pubDate>Wed, 18 Aug 2010 09:19:09 +0000</pubDate>
		<dc:creator>adrian</dc:creator>
				<category><![CDATA[Broken]]></category>

		<guid isPermaLink="false">http://www.databasesandlife.com/?p=616</guid>
		<description><![CDATA[I tried to use my company laptop outside of the office for the first time. I clicked on the &#8220;VPN&#8221; option in the start menu which the company had installed on the laptop. Up came a browser, trying to access the VPN page (accessible from the Internet). However, it didn&#8217;t work, as the browser was [...]]]></description>
			<content:encoded><![CDATA[<p>I tried to use my company laptop outside of the office for the first time. I clicked on the &#8220;VPN&#8221; option in the start menu which the company had installed on the laptop. Up came a browser, trying to access the VPN page (accessible from the Internet). However, it didn&#8217;t work, as the browser was trying to connect to the company&#8217;s web proxy. The company web proxy is obviously only available once one is in the company network, i.e. once the VPN is connected.</p>
<p>(The solution was to include the VPN website server in the list of sites not to use the company proxy for; however as I only just managed that, I wonder how many of the non-technical users within the company will manage it.)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.databasesandlife.com/vpn-fail/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java is lacking a String &#8220;join&#8221; function</title>
		<link>http://www.databasesandlife.com/java-is-lacking-a-string-join-function/</link>
		<comments>http://www.databasesandlife.com/java-is-lacking-a-string-join-function/#comments</comments>
		<pubDate>Fri, 16 Apr 2010 10:49:49 +0000</pubDate>
		<dc:creator>adrian</dc:creator>
				<category><![CDATA[Broken]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.databasesandlife.com/?p=465</guid>
		<description><![CDATA[Between Java 1.0 and Java 1.3 (1996-2002 according to Wikipedia) there was no way to split strings into an array or a list. In Java 1.4 the authors of Java saw it fit to introduce a method to split strings, String csvData = "field1,field2,field3"; String[] fields = csvData.split(","); However they did not introduce a method [...]]]></description>
			<content:encoded><![CDATA[<p>Between Java 1.0 and Java 1.3 (1996-2002 according to Wikipedia) there was no way to split strings into an array or a list.</p>
<p>In Java 1.4 the authors of Java saw it fit to introduce a method to split strings,</p>
<pre>String csvData = "field1,field2,field3";
String[] fields = csvData.split(",");
</pre>
<p>However they did not introduce a method to &#8220;join&#8221; strings! Even in Java 7 there is no way to do this, e.g. via a static String.join method (2002-now).</p>
<p>OK I realize this is not &#8220;rocket science&#8221;, and I appreciate it exists in various versions in various third-party libraries, but still, it&#8217;s something every program needs to do at some point, it&#8217;s annoying to have to re-define it or think about it for each application.</p>
<p>For example, in one project I was working on in the last 6 months, such a function was created, and then had a bug! (OK but to be fair, that was not the only bug in the application!)</p>
<p>Come on, I mean this is a totally trivial function, totally necessary, available in all scripting lanuags why is it still not in Java?!</p>
<p>(P.S. Want to see an &#8220;enterprise java&#8221; solution to this problem? Check out the <a href="http://google-collections.googlecode.com/svn/trunk/javadoc/com/google/common/base/Joiner.html#method_summary">number of methods on this class</a>)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.databasesandlife.com/java-is-lacking-a-string-join-function/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Java varargs: inconsistent behaviour if you pass an array</title>
		<link>http://www.databasesandlife.com/java-varargs-inconsistent-behaviour-if-you-pass-an-array/</link>
		<comments>http://www.databasesandlife.com/java-varargs-inconsistent-behaviour-if-you-pass-an-array/#comments</comments>
		<pubDate>Thu, 15 Apr 2010 10:39:07 +0000</pubDate>
		<dc:creator>adrian</dc:creator>
				<category><![CDATA[Broken]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.databasesandlife.com/?p=461</guid>
		<description><![CDATA[In Java 1.4 there was the function Arrays.asList. You could pass it an array and it would make a list out of it. String[] myArray = new String[] { "foo", "bar" }; List myList = Arrays.asList(myArray); In Java 1.5 this was retrofitted for varargs; you could simply pass elements to the function List&#60;String&#62; myList = [...]]]></description>
			<content:encoded><![CDATA[<p>In Java 1.4 there was the function Arrays.asList. You could pass it an array and it would make a list out of it.</p>
<pre>String[] myArray = new String[] { "foo", "bar" };
List myList = Arrays.asList(myArray);
</pre>
<p>In Java 1.5 this was retrofitted for varargs; you could simply pass elements to the function</p>
<pre>List&lt;String&gt; myList = Arrays.asList("foo", "bar");
</pre>
<p>I never really understood how that worked in a backwards-compatible way; I mean either the function takes an array of stuff, or it takes individual elements, surely?</p>
<p>It turns out, that with the varargs syntax, the caller is not forced to pass individual elements, the caller can instead pass an array of elements.</p>
<pre>List&lt;String&gt; myList = Arrays.asList("foo", "bar");
List&lt;String&gt; myList = Arrays.asList(new String[] { "foo", "bar" });
</pre>
<p>The above two calls are identical, both return a List&lt;String&gt;.</p>
<p>But surely this is really dangerous? I mean Arrays.asList does not make any assumptions about what types of arguments it accepts; the list can be composed of any object.</p>
<p>How can it be certain that you want to have an List of Strings, and not a List containing a single element which is a String array? (An array is an object.)</p>
<p>To demonstrate this inconsistency:</p>
<pre>String[] arr = new String[] { "foo", "bar" };
Arrays.asList(arr);            // returns List&lt;String&gt;
Arrays.asList(arr, arr);       // returns List&lt;String[]&gt;
Arrays.asList(arr, arr, arr);  // returns List&lt;String[]&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.databasesandlife.com/java-varargs-inconsistent-behaviour-if-you-pass-an-array/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>foreach syntax</title>
		<link>http://www.databasesandlife.com/foreach-syntax/</link>
		<comments>http://www.databasesandlife.com/foreach-syntax/#comments</comments>
		<pubDate>Wed, 24 Mar 2010 13:04:26 +0000</pubDate>
		<dc:creator>adrian</dc:creator>
				<category><![CDATA[Broken]]></category>
		<category><![CDATA[Coding]]></category>

		<guid isPermaLink="false">http://www.databasesandlife.com/?p=442</guid>
		<description><![CDATA[Most modern languages use very similar syntax inspired by C; but the features added since C are really non-standard! The &#8220;for-each&#8221; syntax annoys me particularly. I mean none of these is significantly better/worse than the others, but I program in all these languages (apart from C#) on a regular basis and I always have to [...]]]></description>
			<content:encoded><![CDATA[<p>Most modern languages use very similar syntax inspired by C; but the features added since C are really non-standard! The &#8220;for-each&#8221; syntax annoys me particularly. I mean none of these is significantly better/worse than the others, but I program in all these languages (apart from C#) on a regular basis and I always have to think when typing in the line in order not to get the wrong syntax.</p>
<table style="width: 100%;">
<tbody>
<tr>
<td style="width: 100px;"><strong>PHP</strong></td>
<td style="font-family: monospace;">foreach (<em>list </em>as <em>element</em>)</td>
</tr>
<tr>
<td><strong>Perl</strong></td>
<td style="font-family: monospace;">foreach my <em>element </em>(<em>list</em>)</td>
</tr>
<tr>
<td><strong>Java</strong></td>
<td style="font-family: monospace;">for (<em>element </em>: <em>list</em>)</td>
</tr>
<tr>
<td><strong>Javascript</strong></td>
<td style="font-family: monospace;">for (var <em>element </em>in <em>list</em>)</td>
</tr>
<tr>
<td><strong>C#</strong></td>
<td style="font-family: monospace;">foreach (<em>element </em>in <em>list</em>)</td>
</tr>
</tbody>
</table>
<p>For what it&#8217;s worth, I think &#8220;foreach&#8221; is nicer than &#8220;for&#8221; as it reads more like a sentence (the word &#8220;for&#8221; really makes no sense at all in that context); and about &#8220;in&#8221; vs. colon I&#8217;ve got no preference really.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.databasesandlife.com/foreach-syntax/feed/</wfw:commentRss>
		<slash:comments>2</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) [...]]]></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>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 [...]]]></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>
	</channel>
</rss>

