<?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>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>Wicket auto-complete text fields</title>
		<link>http://www.databasesandlife.com/wicket-auto-complete-auto-suggest-text-fields/</link>
		<comments>http://www.databasesandlife.com/wicket-auto-complete-auto-suggest-text-fields/#comments</comments>
		<pubDate>Tue, 30 Aug 2011 16:50:35 +0000</pubDate>
		<dc:creator>adrian</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.databasesandlife.com/?p=894</guid>
		<description><![CDATA[It&#8217;s modern practice in web applications to augment text fields with suggestions while one types. There are plenty of Javascript libraries out there to do that, and plenty of integrations with the Java web framework Wicket out there as well, but somehow none quite did exactly what I wanted, so I&#8217;ve rolled my own Wicket code (based [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s modern practice in web applications to augment text fields with suggestions while one types. There are plenty of Javascript libraries out there to do that, and plenty of integrations with the Java web framework <a href="http://wicket.apache.org/" target="_blank">Wicket</a> out there as well, but somehow none quite did exactly what I wanted, so I&#8217;ve rolled my own Wicket code (based on JQuery). And here they are.</p>
<p>What I wanted, but what other Wicket / Javascript libraries did not do, were:</p>
<ul>
<li>I wanted to allow the user to type <strong>multiple values</strong>. If you compose a message in Gmail, you want to be able to enter multiple recipients, not just one.</li>
<li>I wanted to have the option to either allow the user to type in <strong>options which were not presented</strong> (e.g. like when composing a message in Gmail, or typing in tags into Stack Overflow) or <strong>restrict</strong> them to the options presented (like recipients in Facebook)</li>
<li>I wanted to either allow the <strong>options to be included in the HTML</strong> page (e.g. for a set of 10 options, there is no point forcing the user to wait for a server round-trip to fetch matching options), or allow the options to be <strong>fetched from the server</strong> (e.g. if there are 1M options, they can&#8217;t be included in the HTML page).</li>
<li>I wanted the <strong>API to be incredibly simple</strong>. I want to include a single <code>&lt;input&gt;</code> into the Wicket HTML document, create the object in Java using a constructor, and attach the data source (client-side or server-side) in a single line.</li>
</ul>
<p>Surprisingly all of the above are not particularly easy to achieve simultaneously. But they are now done:</p>
<ul class="tight">
<li><a href="http://www.databasesandlife.com/blog-attachments/databasesandlife-util-javadoc/com/databasesandlife/util/wicket/MultipleValueAutoSuggestTextField.html"><code>MultipleValueAutoSuggestTextField</code></a> (auto-suggest = can also type in other values)</li>
<li><a href="http://www.databasesandlife.com/blog-attachments/databasesandlife-util-javadoc/com/databasesandlife/util/wicket/MultipleValueAutoCompleteTextField.html"><code>MultipleValueAutoCompleteTextField</code></a> (auto-complete = only those values allowed)</li>
</ul>
<p>And coupled with my newly created extensive multi-lingual location hierarchy database (hierarchy in the sense of 2nd district -&gt; Vienna -&gt; Austria -&gt; Europe -&gt; World, multi-lingual in the sense I have these displayable strings in various languages), allows me to create a MultipleValueLocationTextField subclass, which can be included in a host HTML page in one line of HTML and one line of Java, and which synchronizes its data with a <code>Location[]</code> in the client code (e.g. straight from/to a domain object), and it looks like this:</p>
<p><img src="http://www.databasesandlife.com/blog-attachments/20110830-wicket-auto-complete-drop-down.png" alt="" width="474" height="131" /></p>
<p>The source for the two Wicket fields linked to above is LGPL. <a href="http://www.databasesandlife.com/blog-attachments/databasesandlife-java-util.zip">Download Databases &amp; Life Util ZIP</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.databasesandlife.com/wicket-auto-complete-auto-suggest-text-fields/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Converting an SVG to a PDF programmatically</title>
		<link>http://www.databasesandlife.com/svg-to-pdf/</link>
		<comments>http://www.databasesandlife.com/svg-to-pdf/#comments</comments>
		<pubDate>Sat, 20 Aug 2011 13:08:47 +0000</pubDate>
		<dc:creator>adrian</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.databasesandlife.com/?p=869</guid>
		<description><![CDATA[Searching for this topic on the web led to various libraries, all of which were no doubt very powerful, all of which were extremely large and difficult to use if one didn&#8217;t know how. Plenty of advice existed on the internet, &#8220;use library X&#8221;, but when the library has hundreds of thousands of lines that [...]]]></description>
			<content:encoded><![CDATA[<p>Searching for this topic on the web led to various libraries, all of which were no doubt very powerful, all of which were extremely large and difficult to use if one didn&#8217;t know how. Plenty of advice existed on the internet, &#8220;use library X&#8221;, but when the library has hundreds of thousands of lines that isn&#8217;t really enough information. I didn&#8217;t even mind in which programming language the solution was to be written.</p>
<p>After hours of searching, reading Javadocs, reading source, and experimenting, I finally came up with the following lines of Java code.</p>
<p>Alas, this method can only convert from a SVG <em>file</em> to a PDF<em> file</em>, i.e. these have to be files existing on the disk, they cannot be URLs, in memory, cannot be streamed, and the SVG cannot be an in-memory DOM object. My SVG is dynamic: I&#8217;m altering/creating it at runtime (after all, if I wasn&#8217;t doing that, I could just save the PDF somewhere statically in the first place and wouldn&#8217;t need to do the conversion). And I want to deliver the PDF to the browser so streaming would be good for me. But no matter, I use <a href="http://download.oracle.com/javase/6/docs/api/java/io/File.html#createTempFile%28java.lang.String,%20java.lang.String%29">File.createTemporaryFile</a> together with <a href="http://download.oracle.com/javase/6/docs/api/java/io/File.html#deleteOnExit()">deleteOnExit</a> to create these files, and just ignore the fact that if the JVM exits abnormally, e.g. the computer suffers from a power failure, these files will never get deleted, and, over a long enough time-span, will fill up the disk until the computer fails.</p>
<p>Here are the lines:</p>
<pre>import org.apache.batik.apps.rasterizer.DestinationType;
import org.apache.batik.apps.rasterizer.SVGConverter;
import ...

<strong>// SVG is created programatically as a DOM Document </strong>
Document svgXmlDoc = ...

<strong>// Save this SVG into a file </strong>
File svgFile = File.createTempFile("graphic-", ".svg");
svgFile.deleteOnExit();
TransformerFactory tFac = TransformerFactory.newInstance();
Transformer transformer = tFac.newTransformer();
DOMSource source2 = new DOMSource(svgXmlDoc);
FileOutputStream fOut = new FileOutputStream(svgFile);
try { transformer.transform(source2, new StreamResult(fOut)); }
finally { fOut.close(); }

<strong>// Convert the SVG into PDF </strong>
File outputFile = File.createTempFile("result-", ".pdf");
outputFile.deleteOnExit();
SVGConverter converter = new SVGConverter();
converter.setDestinationType(DestinationType.PDF);
converter.setSources(new String[] { svgFile.toString() });
converter.setDst(outputFile);
converter.execute();</pre>
<p>And I have the following JARs (search using Google to find the projects and download them):</p>
<ul class="tight">
<li>avalon-framework-4.2.0.jar</li>
<li>batik-all-1.7.jar</li>
<li>commons-io-1.3.1.jar</li>
<li>commons-logging-1.0.4.jar</li>
<li>fop-0.95.jar</li>
<li>log4j-1.2.15.jar</li>
<li>xml-apis-ext.jar</li>
<li>xmlgraphics-commons-1.3.1.jar</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.databasesandlife.com/svg-to-pdf/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How many days until the end of the month?</title>
		<link>http://www.databasesandlife.com/how-many-days-until-the-end-of-the-month/</link>
		<comments>http://www.databasesandlife.com/how-many-days-until-the-end-of-the-month/#comments</comments>
		<pubDate>Wed, 27 Jul 2011 10:40:27 +0000</pubDate>
		<dc:creator>adrian</dc:creator>
				<category><![CDATA[Software Design]]></category>

		<guid isPermaLink="false">http://www.databasesandlife.com/?p=863</guid>
		<description><![CDATA[It&#8217;s a common enough problem, you want to find out if a date is in a particular month, or you want to know how many days there are left in the current month, and so on. I&#8217;ve seen the following awkward solution plenty of times at different companies: To find out if a day is [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s a common enough problem, you want to find out if a date is in a particular month, or you want to know how many days there are left in the current month, and so on.</p>
<p>I&#8217;ve seen the following awkward solution plenty of times at different companies: To find out if a day is within a month, you see if the date in question is greater than the start of the month and less than the end of the month; this seems logical enough. To determine the number of days left, you subtract the date in question from the last date in the month; this also seems reasonable enough.</p>
<p>The trouble is it&#8217;s not particularly easy to find out the last date in a given month. I&#8217;ve seen at least the following solutions:</p>
<ul class="tight">
<li>Using database functions to find the last day of the month</li>
<li>Having an array of 12 elements, maintaining the number of days in each month of the year</li>
<li>Simply using the date &#8220;YYYY-MM-31&#8243;.</li>
</ul>
<p>Using database functions is the best, for sure, as they&#8217;ll do the calculations right, but it&#8217;s still a certain amount of work to connect to the database just for this purpose. Obviously there are libraries such as Java&#8217;s Calendar which will do the same work but again, it&#8217;s a certain amount of effort. The array isn&#8217;t good as you have to introduce further logic to handle leap years. The last approach is obviously ridiculous as there are plenty of months for which such a date is invalid. (But MySQL 4 allows such dates and MySQL 5 doesn&#8217;t; which as part of a database migration project has brought this point to my attention.)</p>
<p>However, there is a much simpler solution, that is to compare the date with the <strong>first day of the next month</strong>. Finding the next month is easy (there are always 12 months in the year).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.databasesandlife.com/how-many-days-until-the-end-of-the-month/feed/</wfw:commentRss>
		<slash:comments>1</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>PC fire</title>
		<link>http://www.databasesandlife.com/pc-fire/</link>
		<comments>http://www.databasesandlife.com/pc-fire/#comments</comments>
		<pubDate>Mon, 06 Jun 2011 17:56:01 +0000</pubDate>
		<dc:creator>adrian</dc:creator>
				<category><![CDATA[Life]]></category>

		<guid isPermaLink="false">http://www.databasesandlife.com/?p=834</guid>
		<description><![CDATA[Last night, I was listening to music, about to go to bed, totally relaxed, and then suddenly smelt that something was burning. I ignored it as I thought it was probably coming from outside. About 30 seconds later the smell was so strong I realized it must be in the room. In panic I just [...]]]></description>
			<content:encoded><![CDATA[<p>Last night, I was listening to music, about to go to bed, totally relaxed, and then suddenly smelt that something was burning. I ignored it as I thought it was probably coming from outside. About 30 seconds later the smell was so strong I realized it must be in the room. In panic I just pulled out all electrical equipment such as the PC etc. (no time to &#8220;shut down&#8221;). The situation seemed to get worse still. I looked up at the light and there was a reasonable amount of smoke in the room.</p>
<p>This whole situation happened within about 60 seconds I think &#8211; from peacefully listening to music, to me having yanked all the power cables out and the room containing a bunch of smoke.</p>
<p>The smoke started to slowly dissipate after I&#8217;d turned everything off. That was good, I still had no idea where it was coming from. After about 30 minutes there was no smoke any more, and confident (or hopeful) that the problem had been solved (at least for the short term) I went to bed, putting off dealing with the actual problem until I was fit again the next day.</p>
<p>My two suspects were either the PC or the light fitment in the room. The light looked OK. I inspected the PC in the light of the day and it also looked fine. No burn marks or anything. I mean for such a lot of smoke, there would need to be physical burn marks, wouldn&#8217;t you think. So I turned the PC on, and about 10 seconds later there was visible smoke, not as much as the night before but still. And the smell of burnt plastic was back. So at least I knew what the source of the problem was.</p>
<p>A bit more inspection (and turning it on a few more times just briefly) led me to see that while the PC was on, thick gray smoke was just pouring out of the PC&#8217;s power supply.</p>
<p>I mean it&#8217;s not the end of the world, PCs can be replaced, nothing bad happened! But I just think of the number of times I&#8217;ve left that PC on and gone to work, or gone to the kitchen, .. it was just as well that happened while I was sitting in front of it!</p>
<p>Here&#8217;s a picture of what the room looked like after the PC being on for about 10 seconds this morning &#8211; the PC wasn&#8217;t even on long enough for the Windows logo to come up yet.</p>
<p><center><br />
<img src="/blog-attachments/20110606-pc-fire.jpg" width=482 height=298><br />
</center></p>
<p>Ah and there&#8217;s another point I should mention. I&#8217;m on some medication for sleeping and depression (not strong medication!) which I have to take an hour before going to bed. I&#8217;d taken that and the hour had passed so I was just about to switch the PC off and go to bed when the incident happened. A slight side-effect I&#8217;ve noticed is that I have increased levels of anxiety. It&#8217;s not bad, but it&#8217;s there.</p>
<p>And believe me, when an unknown source of smoke and burning suddenly appears in your room, having taken medication which increases anxiety is not in any way what you need.</p>
<p>And further, sleeping medication reduces your coordination and concentration etc. This is fine if you want to go to bed (as had been my plan) but is not so ideal if the situation suddenly changes from going to bed into potentially putting out a fire, &#8230; as I was moving from one place to another in the room to try and determine the source of the smoke, I kept on not being able to walk straight and nearly falling over&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.databasesandlife.com/pc-fire/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>Self-employed again</title>
		<link>http://www.databasesandlife.com/2011-self-employed/</link>
		<comments>http://www.databasesandlife.com/2011-self-employed/#comments</comments>
		<pubDate>Wed, 30 Mar 2011 15:11:40 +0000</pubDate>
		<dc:creator>adrian</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.databasesandlife.com/?p=802</guid>
		<description><![CDATA[For various reasons I have decided to leave s IT Solutions. The company was good, I stand by everything I said in my previous blog posts about working for large companies. (1) I felt my position there was too junior. I was constantly having to justify the things I wanted to do in large meetings [...]]]></description>
			<content:encoded><![CDATA[<p>For various reasons I have decided to leave <a href="http://www.s-itsolutions.at/">s IT Solutions</a>. The company was good, I stand by everything I said in my previous blog posts about <a href="/s-it-solutions/">working for large companies</a>.</p>
<p><strong>(1) I felt my position there was too junior.</strong> I was constantly having to justify the things I wanted to do in large meetings with various &#8220;senior&#8221; people who&#8217;d been working there for 10 or more years. But these people were younger than me, and had been working at that company all their life, and simply didn&#8217;t have the variety of experience that I had. They felt things had to be done a certain way, but I had seen various ways including the way they were proposing, but they weren&#8217;t interested in listening to my input on the consequences of that way. Basically the reason for that was people didn&#8217;t want to dilute their power; I don&#8217;t hate them for this, I just don&#8217;t need to work there either.</p>
<p><strong>(2) Various things were far too complex. </strong>It took me about a month to learn how to deploy something on one particular environment (this <em>wasn&#8217;t </em>the live environment!) which involved asking a project manager for a release number (which involved justifying to him why the deployment was necessary, often he didn&#8217;t agree..), writing an email to dept X, they would forward that to dept Y, then there was some Windows tool with multiple tabs and multiple fields per tab, where you had to enter various magic data, plus there was something on the Windows tray you had to right-click and configure, then there was the web-based deployment tool and you had to know where to click in that.. Plus I didn&#8217;t have permission for any of these systems, I didn&#8217;t know that I needed to have asked in the past for permissions to these systems as I only discovered &#8220;just in time&#8221; that they existed at all. No documentation, nobody told me they existed as that would reduce their power that the bosses needed to go to them to get something done.</p>
<p>Anyway, I was told at least once, &#8220;well, you might not like it, but you&#8217;ll have to get used to it. That&#8217;s the way your life is now!!&#8221;. Wrong ;-)</p>
<p>For the next months I have the following things lined up:</p>
<p><strong>(1) Implementation of a <a href="http://wicket.apache.org/">Java Wicket</a> based system of analyzing mobile phone usage data.</strong> Usage data is uploaded via CSV files, I parse them and put them into a database, then the main screen involves a set of reports, defined over a configuration file, with snippets of &#8220;where&#8221; clauses in them. The user may select further restrictions via drop-downs, these are added to the &#8220;where&#8221; clause. The &#8220;select&#8221; against the DB is performed and an XML is created of the results. XSLT created by <a href="http://www.altova.com/stylevision.html">Altova Stylevision</a>, which the customer has created and checked into my SVN, is then performed on the XML to produce PDF, RTF or HTML reports. I don&#8217;t need to change any code to change the layout of the report, it&#8217;s all in the XSLT file. To give the user a nice interface for managing the CSV files Windows Explorer and TortoiseSVN is used, I read the reports from SVN and insert the data programmatically via <a href="http://svnkit.com/">svnkit</a> which is nice and easy to use, and I keep the database and configuration in sync like <a href="/atomic-operations-over-filesystem-and-database/">this</a>. <a href="http://www.onestopconcept.com/">Onestop Concept</a> provided analysis of the requirements, and I did all the software architecture and programming. Deployed at <a href="http://www.nessus.at/">Nessus</a>. All in all, a nice project!</p>
<p><strong>(2) Further implementation on <a href="http://www.onestopconcept.com/offer-ready">Offer Ready</a></strong> for Onestop Concept (Martin Schmidt) which involves using some cool algorithms to determine which mobile phone tariff (incl. packs) is the best option given a set of usage data. Written in Java and C. (<a href="/java-method-64k-limit/">Not written only in Java!</a>)</p>
<p><strong>(3) Working for <a href="http://www.firstload.de/">firstload</a></strong> (hopefully!), a platform where you can download binary files acquired from Usenet. I will be working on their e-commerce software, for example the invoice-generation software, introducing tax rules, extending/re-writing the subscriptions logic, modernizing the software, and so on. PHP and MySQL. This is a domain I&#8217;ve worked in a few times before, I did the e-commerce software for Uboot&#8217;s SMS functionality, I wrote the Subscriptions system for <a href="http://www.easyname.eu/">easyname</a> for <a href="http://www.nessus.at/">Nessus</a>, was hired to write a pay-out and tax logic module for TheContentMarket then <a href="http://www.fatfoogoo.com/">FatFoogoo</a>, and so on.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.databasesandlife.com/2011-self-employed/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Visibility &amp; type inference in Java</title>
		<link>http://www.databasesandlife.com/visibility-type-inference-in-java/</link>
		<comments>http://www.databasesandlife.com/visibility-type-inference-in-java/#comments</comments>
		<pubDate>Tue, 08 Feb 2011 16:51:45 +0000</pubDate>
		<dc:creator>adrian</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.databasesandlife.com/?p=790</guid>
		<description><![CDATA[In Java, private classes can be used in signatures of public interfaces. This makes no sense! I had a situation the other day that I wanted to break one line down into multiple lines for readability. But it wasn&#8217;t possible. If I wrote the code as one line it worked; multiple lines it didn&#8217;t. This [...]]]></description>
			<content:encoded><![CDATA[<p><strong>In Java, private classes can be used in signatures of public interfaces. This makes no sense!</strong></p>
<p>I had a situation the other day that I wanted to break one line down into multiple lines for readability. But it wasn&#8217;t possible. If I wrote the code as one line it worked; multiple lines it didn&#8217;t. This is rather inconsistent! The following public class demonstrates the situation:</p>
<pre>
public class PublicObject {
    <strong>private </strong>class <strong>PrivateObject </strong>{ }

    private PrivateObject x;
    <strong>public </strong>void setX(<strong>PrivateObject </strong>x) { this.x=x; }
    <strong>public </strong><strong>PrivateObject </strong>getX() { return x; }
}
</pre>
<p>As you see, PublicObject instances are allowed to provide public methods which take and return PrivateObject instances, however that doesn&#8217;t make a lot of sense, as you can&#8217;t write client code which creates or manipulates PrivateObject instances.</p>
<p>But in fact that&#8217;s not true. Java does, in a very few places, use type inference (more info <a href="http://james-iry.blogspot.com/2009/04/java-has-type-inference-and-refinement.html">here</a>) to guess the type of objects, to save the programmer typing. And the public/private rule enforcement seems to be:</p>
<ul class=tight>
<li>You get an error if you write the name of a private class anywhere in your client source</li>
<li>If you just use type inference to use the object, and avoid ever explicitly writing the class name in your source code, it compiles and works fine.</li>
</ul>
<p>So the following code works:</p>
<pre>
myPublicObject.setX(myPublicObject.getX());
</pre>
<p>but the following code doesn&#8217;t:</p>
<pre>
PrivateObject x = myPublicObject.getX();
myPublicObject.setX(x);
</pre>
<p>And the reason the first line works is that, although the code is clearly using PrivateObject instances, it doesn&#8217;t ever use the word &#8220;PrivateObject&#8221; in the source code.</p>
<p>Surely, whether you explicitly reference the class in your code, or implicitly using the language&#8217;s type inference, are just syntactic differences only, and you should either be allowed to do both or neither.</p>
<p>(In .NET, the equivalent code does indeed not compile.)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.databasesandlife.com/visibility-type-inference-in-java/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

