<?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>Horatio Caine&#039;s Blog &#187; java</title>
	<atom:link href="http://hxcaine.com/blog/tag/java/feed/" rel="self" type="application/rss+xml" />
	<link>http://hxcaine.com/blog</link>
	<description>A blog of life, ideas and code</description>
	<lastBuildDate>Thu, 19 Jun 2014 00:46:16 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.0.38</generator>
	<item>
		<title>First line disappears from Eclipse console output</title>
		<link>http://hxcaine.com/blog/2011/01/12/first-line-disappears-from-eclipse-console-output/</link>
		<comments>http://hxcaine.com/blog/2011/01/12/first-line-disappears-from-eclipse-console-output/#comments</comments>
		<pubDate>Wed, 12 Jan 2011 15:28:46 +0000</pubDate>
		<dc:creator><![CDATA[Horatio Caine]]></dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[console]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[first line]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[output]]></category>
		<category><![CDATA[println]]></category>

		<guid isPermaLink="false">http://hxcaine.wordpress.com/?p=142</guid>
		<description><![CDATA[I was just running a standard Java file straight from Eclipse when I noticed something strange. The first line of output was not showing at all. My code ran an analysis, got back a result and printed a couple of attributes from the result. I was getting all but the first line of output (even [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>I was just running a standard Java file straight from Eclipse when I noticed something strange. The first line of output was not showing at all.</p>
<p>My code ran an analysis, got back a result and printed a couple of attributes from the result. I was getting all but the first line of output (even though I knew there was nothing wrong with the System.out.println code).</p>
<p>When I ran it in the terminal, I found a few hundred (or thousand) lines of debug output from the analyser which I had forgotten to disable. For some reason, Eclipse was ignoring this and only printing the remaining output. This consumed the first line too, for some reason.</p>
<p>As soon as I disabled the debug output from the analysis code, the output was behaving normally again.</p>
]]></content:encoded>
			<wfw:commentRss>http://hxcaine.com/blog/2011/01/12/first-line-disappears-from-eclipse-console-output/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQLite timestamp comparison causes SQLiteException or error</title>
		<link>http://hxcaine.com/blog/2010/09/15/sqlite-timestamp-comparison-causes-sqliteexception-or-error/</link>
		<comments>http://hxcaine.com/blog/2010/09/15/sqlite-timestamp-comparison-causes-sqliteexception-or-error/#comments</comments>
		<pubDate>Wed, 15 Sep 2010 23:13:10 +0000</pubDate>
		<dc:creator><![CDATA[Horatio Caine]]></dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[comparison]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[quotation marks]]></category>
		<category><![CDATA[select]]></category>
		<category><![CDATA[sqlite]]></category>
		<category><![CDATA[sqliteexception]]></category>
		<category><![CDATA[statement]]></category>
		<category><![CDATA[timestamp]]></category>

		<guid isPermaLink="false">http://hxcaine.wordpress.com/?p=87</guid>
		<description><![CDATA[When getting the &#8220;next&#8221; or &#8220;previous&#8221; entry in an SQLite table, I&#8217;ve been using the rowId so far and it&#8217;s been okay. Recently, though, it&#8217;s not been that easy. For example, when a user imports a set of entries, some of which have an earlier timestamp than the current entries, they end up in the [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>When getting the &#8220;next&#8221; or &#8220;previous&#8221; entry in an SQLite table, I&#8217;ve been using the rowId so far and it&#8217;s been okay.</p>
<p>Recently, though, it&#8217;s not been that easy. For example, when a user imports a set of entries, some of which have an earlier timestamp than the current entries, they end up in the middle of the entries but their rowIds are newer and so are considered to be at the end of the list.</p>
<p>This causes weird navigation issues, so it&#8217;s best to stick with a single way to order entries.</p>
<p>Here is a sample of a SELECT statement that will get a rowId of the next entry in order of timestamp:</p><pre class="crayon-plain-tag">SELECT DISTINCT rowid
FROM entry_table
WHERE timestamp &gt; 2010-09-15 13:15:20.250
ORDER BY timestamp ASC LIMIT 1</pre><p>However, this causes an SQLite exception in Android/Java and other errors in other SQLite implementations. The problem is the space in the timestamp given. Whenever there is a space there should be quotation marks surrounding the piece of text.</p>
<p>So the timestamp should be &#8220;2010-09-15 13:15:20.250&#8243;, giving a SELECT statement that looks like this:</p>
<p></p><pre class="crayon-plain-tag">SELECT DISTINCT rowid&nbsp;
FROM entry_table 
WHERE timestamp &gt; &quot;2010-09-15 13:15:20.250&quot; 
ORDER BY timestamp ASC LIMIT 1</pre><p></p>
<p>This selects one row where the timestamp is the next greatest than the given one, i.e. the one right after the given one. It should also be error-free, now that we&#8217;ve included the quotation marks.</p>
]]></content:encoded>
			<wfw:commentRss>http://hxcaine.com/blog/2010/09/15/sqlite-timestamp-comparison-causes-sqliteexception-or-error/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
