<?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>WombatNation</title>
	<atom:link href="http://www.wombatnation.com/feed" rel="self" type="application/rss+xml" />
	<link>http://www.wombatnation.com</link>
	<description>MySQL, Linux, Java, Python, Soccer, Beer and Incinerating Toilets</description>
	<lastBuildDate>Mon, 13 May 2013 05:21:32 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Geo Searches for Health Care Pricing Data</title>
		<link>http://www.wombatnation.com/2013/05/geo-searches-for-health-care-pricing-data</link>
		<comments>http://www.wombatnation.com/2013/05/geo-searches-for-health-care-pricing-data#comments</comments>
		<pubDate>Mon, 13 May 2013 05:21:32 +0000</pubDate>
		<dc:creator>Robert</dc:creator>
				<category><![CDATA[Conference]]></category>
		<category><![CDATA[MongoDB]]></category>

		<guid isPermaLink="false">http://www.wombatnation.com/?p=986</guid>
		<description><![CDATA[My presentation at MongoDB Days SF on Friday went very well, though I got to the last slide of my 40-minute talk in just 30 minutes. Hopefully, I didn&#8217;t speak too fast for a lot of people. Fortunately, I remembered at the end that I had also wanted to talk about how I saved space [...]]]></description>
				<content:encoded><![CDATA[<p>My presentation at MongoDB Days SF on Friday went very well, though I got to the last slide of my 40-minute talk in just 30 minutes. Hopefully, I didn&#8217;t speak too fast for a lot of people. Fortunately, I remembered at the end that I had also wanted to talk about how I saved space by omitting keys with a very common default value. While that required adding a very small amount of app logic to fill in default values for missing keys, it enabled me to save quite a few bytes per document. Every byte counts when you are storing 600+ million documents.</p>

<p>The extra time at the end of my talk was also nicely filled in by a lot of good questions. I ended up having to rush off the stage for the next talk.</p>

<p>It was also cool that I was speaking to about 100 or so people in the Gold Room at the beautiful Palace Hotel. The Castlight Xmas party was in the same room two years ago.</p>

<p>As always, 10gen put on another excellent show. Meghan and her team are awesome. I&#8217;ve attended several of these events and they get better each time.</p>

<p>Here are the slides I presented:</p>

<iframe src="http://www.slideshare.net/WombatNation/slideshelf" width="615px" height="470px" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" style="border:none;" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe>
]]></content:encoded>
			<wfw:commentRss>http://www.wombatnation.com/2013/05/geo-searches-for-health-care-pricing-data/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Speaking at MongoDB SF 2013</title>
		<link>http://www.wombatnation.com/2013/03/speaking-at-mongodb-sf-2013</link>
		<comments>http://www.wombatnation.com/2013/03/speaking-at-mongodb-sf-2013#comments</comments>
		<pubDate>Sat, 30 Mar 2013 05:32:02 +0000</pubDate>
		<dc:creator>Robert</dc:creator>
				<category><![CDATA[Conference]]></category>
		<category><![CDATA[MongoDB]]></category>

		<guid isPermaLink="false">http://www.wombatnation.com/?p=975</guid>
		<description><![CDATA[I&#8217;m very excited that my talk proposal &#8220;Geo Searches for Healthcare Pricing Data&#8221; was accepted for MongoDB SF 2013. I&#8217;ll be speaking at 11:55 am on May 10th in the Palace Hotel Gold Ballroom about why I chose to deploy MongoDB at Castlight Health to serve large amounts of healthcare pricing data with very low [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://wombatnation.com/w/wp-content/uploads/2013/03/MongoDB_Days_2013_Speaker_Badge_200x200-2.png"><img class="alignleft size-full wp-image-980" alt="MongoDB_Days_2013_Speaker_Badge_200x200 2" src="http://wombatnation.com/w/wp-content/uploads/2013/03/MongoDB_Days_2013_Speaker_Badge_200x200-2.png" width="200" height="200" align="left" hspace="5" /></a>
I&#8217;m very excited that my talk proposal &#8220;Geo Searches for Healthcare Pricing Data&#8221; was accepted for <a href="https://www.10gen.com/events/mongodb-san-francisco-2013">MongoDB SF 2013</a>. I&#8217;ll be speaking at 11:55 am on May 10th in the Palace Hotel Gold Ballroom about why I chose to deploy MongoDB at Castlight Health to serve large amounts of healthcare pricing data with very low latency. I&#8217;ll go into as much detail as I can in forty minutes as to how we use it, how we deployed it and the excellent results we&#8217;ve gotten.</p>

<p>I previously <a href="http://www.wombatnation.com/2010/12/mongo-sv-2010">spoke about logging to MongoDB at Mongo SV</a> a few years ago in Mountain View and have attended several other MongoDB conferences and events. The 10Gen team has built a fantastic product and has an amazing events team. Their conferences are very well run, economical, educational and I highly recommend attending them.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wombatnation.com/2013/03/speaking-at-mongodb-sf-2013/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Book Review &#8211; Lean In</title>
		<link>http://www.wombatnation.com/2013/03/book-review-lean-in</link>
		<comments>http://www.wombatnation.com/2013/03/book-review-lean-in#comments</comments>
		<pubDate>Fri, 22 Mar 2013 06:32:03 +0000</pubDate>
		<dc:creator>Robert</dc:creator>
				<category><![CDATA[Reviews]]></category>

		<guid isPermaLink="false">http://www.wombatnation.com/?p=970</guid>
		<description><![CDATA[After finishing Facebook COO Sheryl Sandberg&#8217;s new book Lean In, I was surprised by the disconnect with some of the early criticism I had read. I actually thought Sandberg wrote a lot about her personal life and greatly appreciated her experience and co-workers at Google. She also clearly admitted she is in a place of [...]]]></description>
				<content:encoded><![CDATA[<p>After finishing Facebook COO Sheryl Sandberg&#8217;s new book <a title="Lean In by Sheryl Sandberg" href="http://www.amazon.com/Lean-In-Women-Work-Will/dp/0385349947/wombatnation-20">Lean In</a>, I was surprised by the disconnect with some of the early criticism I had read. I actually thought Sandberg wrote a lot about her personal life and greatly appreciated her experience and co-workers at Google. She also clearly admitted she is in a place of privilege. I don&#8217;t understand why people think that invalidates her from advising women about what is possible in their career. Obviously, not every woman will achieve what she has achieved. But neither will every man. I have to wonder if those reviewers just read other reviews by reviewers who only lightly skimmed the book.</p>

<p>Lean In also has a lot to offer to male readers. In addition to advice to men in senior positions on how to ensure women and men have equal opportunities, there&#8217;s just a lot of great career advice that applies to most everyone.</p>

<p>I had initially wondered about the amazing detail of the footnotes and how she had time to do that much research. Then I discovered, as I should have expected, that she had a lead researcher. However, Sandberg did provide very detailed acknowledgements giving credit where credit was due. And I think her presentations and Q&amp;A sessions show that she&#8217;s not just putting her name on someone else&#8217;s work.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wombatnation.com/2013/03/book-review-lean-in/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CompressedOops and 32 GB Heaps</title>
		<link>http://www.wombatnation.com/2012/04/compressedoops-and-32-gb-heaps</link>
		<comments>http://www.wombatnation.com/2012/04/compressedoops-and-32-gb-heaps#comments</comments>
		<pubDate>Sun, 08 Apr 2012 05:53:36 +0000</pubDate>
		<dc:creator>Robert</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.wombatnation.com/?p=952</guid>
		<description><![CDATA[At work we have a Java-based service that caches a very large amount of data. I spend a lot of time optimizing performance and memory usage for this service. The amount of memory it uses at runtime to cache a sufficient amount of data for performance reasons is now reaching the the 32 GB boundary. [...]]]></description>
				<content:encoded><![CDATA[<p>At work we have a Java-based service that caches a very large amount of data. I spend a lot of time optimizing performance and memory usage for this service. The amount of memory it uses at runtime to cache a sufficient amount of data for performance reasons is now reaching the the 32 GB boundary.</p>

<p>One downside of using a 64-bit JVM is that the object pointers used by the JVM to reference objects would normally need to increase from 4 bytes (32 bits) to 8 bytes (64 bits). But, if the heap is under 32 GB, the JVM can take a shortcut because it knows that the offset will always fit in 4 bytes.</p>

<p>The JVM argument -XX:+UseCompressedOops was added to force the JVM to use <a href="https://wikis.oracle.com/display/HotSpotInternals/CompressedOops">compressed ordinary object pointers</a> whenever possible. In Java 6 Update 23, the JVM was updated to enable Compressed Oops by default. Compressed Oops works very well for heaps up to about 26 GBs, but can still be advantageous for larger heaps.</p>

<p>However, I found that with Java 6 Update 24, Compressed Oops are not used at times when they could be, even if you specify -XX:+UseCompressedOops.</p>

<p>Specifically, I was using a 31.7 GB heap and my service was unexpectedly running out of memory. On one of our other systems, the heap for the same service reached only 26 GB after its large internal cache was fully loaded. After a lot of investigation that weekend, I discovered that the working system was on Java 6 Update 26. I downgraded it to Update 24 and easily reproduced the problem.</p>

<p>I had previously done a lot of testing to see what our penalty was for crossing the 32 GB heap boundary and found that it was about 8 GB. That&#8217;s actually not too bad, as general estimates I had heard from others ranged from 30-50%. This is probably due to the fact the objects we are caching mostly have only primitive data types as fields.</p>

<p>I highly recommend the <a href="http://www.slideshare.net/aszegedi/everything-i-ever-learned-about-jvm-performance-tuning-twitter">Everything I Ever Learned About JVM Performance Tuning @Twitter</a> slides and <a href="http://www.infoq.com/presentations/JVM-Performance-Tuning-twitter">presentation</a> for more info on JVM tuning. Or read <a href="http://www.umbrant.com/blog/2012/twitter_jvm_tuning.html">Andrew&#8217;s summary of Attila&#8217;s talk</a>.</p>

<p>By reducing the cache size on the production server enough to not blow out the heap, I confirmed that the heap size when using 1.6.0.24 was about 8 GB higher than when using 1.6.0.26. JVM, meet smoking gun.</p>

<p>The release notes for 1.6.0.26 references a <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6985015">compressedoops related bug</a> fix that may have resulted in this feature now working as described. I read through all of the many bugs fixed in that release and it seems to be the most likely candidate.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wombatnation.com/2012/04/compressedoops-and-32-gb-heaps/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Changes to long_query_time Not Changing</title>
		<link>http://www.wombatnation.com/2012/03/changes-to-long_query_time</link>
		<comments>http://www.wombatnation.com/2012/03/changes-to-long_query_time#comments</comments>
		<pubDate>Wed, 07 Mar 2012 07:20:28 +0000</pubDate>
		<dc:creator>Robert</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://www.wombatnation.com/?p=949</guid>
		<description><![CDATA[At work today I ran into a new reason for not keeping open MySQL connections for a long time. It involves dynamic session variables like long_query_time. I wanted to capture a couple of hours worth of all queries in the slow query log so I could analyze them with pt-query-digest from the excellent Percona Toolkit. [...]]]></description>
				<content:encoded><![CDATA[<p>At work today I ran into a new reason for not keeping open MySQL connections for a long time. It involves dynamic session variables like long_query_time.</p>

<p>I wanted to capture a couple of hours worth of all queries in the slow query log so I could analyze them with <a title="Percona Toolkit Query Digest" href="http://www.percona.com/doc/percona-toolkit/2.0/pt-query-digest.html">pt-query-digest</a> from the excellent Percona Toolkit. So, I used</p>

<p><code lang="SQL">set global long_query_time=0;</code></p>

<p>After a couple of hours I had a lot of data. I discovered later that I was actually missing some of the early queries.</p>

<p>Then I set long_query_time back to 1 so only queries longer than 1 second would be logged. To my initial amazement, lots of very short queries continued to be logged to the slow query log.</p>

<p>A <a href="http://bugs.mysql.com/bug.php?id=38704">little research</a> turned up the fact that the long_query_time session variable for a connection is initialized from the global variable only when a connection is opened. So, any connections that were open when I set long_query_time to 0 continued on as if it were still set to 1. Therefore I missed capturing those queries.</p>

<p>Worse, though, is that some of our code uses connection pools that can keep alive connections for a few hours. Short queries on those connections continued to be written to the slow query log after I set long_query_time = 1. Fortunately, I was tailing the slow query log, so I noticed this before it got too big. At this point, you can temporarily disable slow query logging, let it go and hope those connections don&#8217;t last too much longer, or go all club and hammer on the connections and kill them and hope your code handles it gracefully. The last one generally isn&#8217;t so great of an idea for a production app.</p>

<p>As I mentioned above, my slow query log capture didn&#8217;t include sub-second queries from connections that were open when I set long_query_time to 0. That would obviously affect the results of my analysis by leaving out the queries from long-lived connections.</p>

<p>So, if you&#8217;re doing something like this, you should capture data for a long enough time to offset this factor or at least throw out the data from the earlier parts of the log. You should also check out the open connections with show processlist; before changing long_query_time.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wombatnation.com/2012/03/changes-to-long_query_time/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Astromixology</title>
		<link>http://www.wombatnation.com/2012/01/astromixology</link>
		<comments>http://www.wombatnation.com/2012/01/astromixology#comments</comments>
		<pubDate>Mon, 30 Jan 2012 08:07:42 +0000</pubDate>
		<dc:creator>Robert</dc:creator>
				<category><![CDATA[Food and Drink]]></category>
		<category><![CDATA[The Unusual and the Weird]]></category>

		<guid isPermaLink="false">http://www.wombatnation.com/?p=936</guid>
		<description><![CDATA[Whenever I&#8217;m looking for a drink recipe, I first seek out my trusty Mixology pamphlet, courtesy of the Southern Comfort Corporation, ca. 1974. What better source could there be for cocktail recipes than a pamphlet that mixes astrology with photos of swinging dudes in gaudy polyester leisure suits accompanied by the smiling Stepford wives. Sure, [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://wombatnation.com/w/wp-content/uploads/2012/01/mix_cover.jpg"><img class="alignleft size-full wp-image-937" title="Mixology cover" src="http://wombatnation.com/w/wp-content/uploads/2012/01/mix_cover.jpg" alt="Mixology cover" width="250" height="366" align="left" hspace="5" /></a>
Whenever I&#8217;m looking for a drink recipe, I first seek out my trusty Mixology pamphlet, courtesy of the Southern Comfort Corporation, ca. 1974. What better source could there be for cocktail recipes than a pamphlet that mixes astrology with photos of swinging dudes in gaudy polyester leisure suits accompanied by the smiling Stepford wives. Sure, this guy is in a pretty reasonable looking sweater, but steel yourself now for what is to come.</p>

<p>Back in the 70&#8242;s, subliminal messaging was a controversial topic. I remember running across a book from that same year called <a href="http://www.amazon.com/Subliminal-Seduction-Wilson-Bryan-Key/dp/0451061489?tag=wombatnation-20">Subliminal Persuasion</a> that had a lot of images from advertising and movies with supposedly embedded suggestive words and images, primarily of a sexual nature. Check out the <a title="Subliminal Manipulation blog" href="http://subliminalmanipulation.blogspot.com/">Subliminal Manipulation blog</a> if you don&#8217;t sex believe me.</p>

<p>Take a closer look at the hair of the guy on the Mixology cover. Now, think about other parts of a man&#8217;s body. Good luck getting this image out of your head (no pun intended) anytime soon. I&#8217;m really, really sorry.</p>

<p>Next up we&#8217;ve got a dude confidently sporting a pink suit. The previous sentence is the only known sentence on the internet including the words dude and pink suit, but not the word pimp. Ignore the faint yellow polka-dots. I double-checked the pamphlet and they must be a scanning artifact. I was so hoping they weren&#8217;t, though. I think my scanner understandably puked on the image.</p>

<p><a href="http://wombatnation.com/w/wp-content/uploads/2012/01/mix_pg_2_3.jpg"><img class="size-full wp-image-940" title="Pink suited swinger" src="http://wombatnation.com/w/wp-content/uploads/2012/01/mix_pg_2_3.jpg" alt="" width="600" height="435" /></a></p>

<blockquote>Almost everyone knows his Zodiac sign today. But few have any real knowledge of astrology.</blockquote>

<blockquote>Intent of astrology data herein is simply to inform, not to advise. Therefore any personal application is the individual&#8217;s responsibility.</blockquote>

<p>Check out Mr. quilted pants on the left. What grandmother wouldn&#8217;t want to see her granddaughter coming home with a nice boy wearing a handmade quilt? OK, besides any grandmother with something against hobos. Those pants are so appalling that I almost didn&#8217;t notice the crazy blue plaid suit in the back. He&#8217;s channeling Rodney Dangerfield from Caddyshack, but coming up well short. Powder blue cardigan boy looks positively normal in this photo.</p>

<p><a href="http://wombatnation.com/w/wp-content/uploads/2012/01/mix_pg_8_9.jpg"><img class="size-full wp-image-941" title="Quilted pants and blue plaid suit" src="http://wombatnation.com/w/wp-content/uploads/2012/01/mix_pg_8_9.jpg" alt="" width="600" height="435" /></a></p>

<p>If your party kilt is at the drycleaner, a full tartan suit is always a great substitute. It&#8217;s a little hard to see, but, yes, those are matching pants. Fortunately, I don&#8217;t think it&#8217;s the royal Stewart tartan. Too bad his promiscuous plaid partner up front isn&#8217;t in a matching tartan. I can&#8217;t identify the tartans for certain due to the cumulative retinal scarring, but I&#8217;m suspecting they&#8217;re variants of the Montgomery Ward tartan.</p>

<p><a href="http://wombatnation.com/w/wp-content/uploads/2012/01/mix_pg_10_11.jpg"><img class="size-full wp-image-942" title="Worst use of tartan evah" src="http://wombatnation.com/w/wp-content/uploads/2012/01/mix_pg_10_11.jpg" alt="" width="600" height="435" /></a></p>

<p>If you&#8217;re daring and desperate for the full pamphlet in a high enough resolution to actually read it, <a title="Images from Mixology Pamphlet" href="/images/mixology.zip">download the 2 MB zipfile</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wombatnation.com/2012/01/astromixology/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Kohler Numi Review in NY Times</title>
		<link>http://www.wombatnation.com/2011/10/kohler_numi</link>
		<comments>http://www.wombatnation.com/2011/10/kohler_numi#comments</comments>
		<pubDate>Sat, 22 Oct 2011 20:23:16 +0000</pubDate>
		<dc:creator>Robert</dc:creator>
				<category><![CDATA[The Unusual and the Weird]]></category>

		<guid isPermaLink="false">http://www.wombatnation.com/?p=925</guid>
		<description><![CDATA[The competition for toilet supremacy is heating up. The NY Times has a great review of Kohler&#8217;s Numi, which opens up like a Transformer to accept your tributes. Someone should hack the opening chime to play a recording of Optimus Prime saying &#8221;No sacrifice is too great in the service of freedom.&#8221; And I would love to see [...]]]></description>
				<content:encoded><![CDATA[<p>The competition for toilet supremacy is heating up. The NY Times has a great review of <a href="http://www.nytimes.com/2011/10/13/technology/personaltech/kohlers-numi-is-everything-one-wants-in-a-toilet-and-more.html">Kohler&#8217;s Numi</a>, which opens up like a Transformer to accept your tributes. Someone should hack the opening chime to play a recording of Optimus Prime saying &#8221;No sacrifice is too great in the service of freedom.&#8221; And I would love to see it do battle with <a href="http://www.wombatnation.com/2004/08/toto-neorest-600">Toto&#8217;s Megatron, I mean Neorest</a>.</p>

<p><img class="alignnone" title="Kohler Numi transforming" src="http://graphics8.nytimes.com/images/2011/10/13/business/13-BASICS1/13-BASICS1-articleLarge.jpg" alt="Kohler Numi transforming" width="500" /></p>

<p>When I first glanced at the image of the remote control, I thought the bottom left button said &#8220;Lasers&#8221;. Now, that would be freaking awesome. Whether as a laser light show to accompany the event or as a modern alternative to the <a href="http://www.wombatnation.com/essays/incinolet.html">incineration of your contributions</a>, I&#8217;m all for it. And surely a couple frickin&#8217; lasers would come in handy when kicking some Neorest butt.</p>

<p><img class="alignnone" title="Kohler Numi remote control" src="http://graphics8.nytimes.com/images/2011/10/13/business/13-BASICS4/13-BASICS4-articleInline.jpg" alt="Kohler Numi remote control" width="190" height="280" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.wombatnation.com/2011/10/kohler_numi/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Streaming ResultSets with the MySQL JDBC Driver</title>
		<link>http://www.wombatnation.com/2011/06/streaming-resultsets-with-the-mysql-jdbc-driver</link>
		<comments>http://www.wombatnation.com/2011/06/streaming-resultsets-with-the-mysql-jdbc-driver#comments</comments>
		<pubDate>Sat, 04 Jun 2011 01:00:04 +0000</pubDate>
		<dc:creator>Robert</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://www.wombatnation.com/?p=909</guid>
		<description><![CDATA[When you use the MySQL JDBC driver to select rows from a table, the connection will block until the entire ResultSet has been pulled over to the client. In most cases this makes sense, especially if the server is on a different host. Retrieving the entire ResultSet will minimize the number of TCP packets that [...]]]></description>
				<content:encoded><![CDATA[<p>When you use the MySQL JDBC driver to select rows from a table, the connection will block until the entire ResultSet has been pulled over to the client. In most cases this makes sense, especially if the server is on a different host. Retrieving the entire ResultSet will minimize the number of TCP packets that must be sent from the server.</p>

<p>However, if you are returning a very large ResultSet, the client will have to allocate a lot of memory on the heap. If you end up accessing each row to create an object from the data, then you will need enough heap space for the entire ResultSet plus all of the objects you instantiate.</p>

<p>The driver documentation explains how to <a href="http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-implementation-notes.html">force the driver to stream the ResultSet row-by-row</a>.</p>

<p>The first catch is that you must be using a regular Statement object, not a PreparedStatement.</p>

<p>The documentation says you need to add the following non-intuitive code before executing the query:</p>


<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;">stmt <span style="color: #339933;">=</span> conn.<span style="color: #006633;">createStatement</span><span style="color: #009900;">&#40;</span>java.<span style="color: #006633;">sql</span>.<span style="color: #003399;">ResultSet</span>.<span style="color: #006633;">TYPE_FORWARD_ONLY</span>,
              java.<span style="color: #006633;">sql</span>.<span style="color: #003399;">ResultSet</span>.<span style="color: #006633;">CONCUR_READ_ONLY</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
stmt.<span style="color: #006633;">setFetchSize</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">Integer</span>.<span style="color: #006633;">MIN_VALUE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>


<p>though you can actually just use <code>conn.createStatement()</code> since <code>TYPE_FORWARD_ONLY</code> and <code>CONCUR_READ_ONLY</code> are the defaults.</p>

<p>There are a couple caveats in the documentation, though they are fairly obvious. You should process the ResultSet as quickly as possible, since locks will be held as long as the statement (and any transaction it is in) is open.</p>

<p>In addition to being non-intuitive, setting the fetch size to <code>Integer.MIN_VALUE</code> might cause unexpected results if you run your code against a database server other than MySQL.</p>

<p>If you&#8217;re willing to go all out in committing to MySQL, you can cast the return value of <code>createStatement()</code> to <code>com.mysql.jdbc.Statement.StatementImpl</code> and then call <code>enableStreamingResults()</code>. That will, at least, make the behavior of your code more obvious.</p>

<p>At work I needed to cache a lot of data from a couple of tables. Using the default behavior caused the heap to grow to over 12.5 GB. That made for trouble when running on my 8 GB laptop. By switching to streaming the ResultSet, the heap maxed out at only 5 GB.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wombatnation.com/2011/06/streaming-resultsets-with-the-mysql-jdbc-driver/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tweeting by Phone with PhoneBlogger</title>
		<link>http://www.wombatnation.com/2011/03/tweeting-by-phone-with-phoneblogger</link>
		<comments>http://www.wombatnation.com/2011/03/tweeting-by-phone-with-phoneblogger#comments</comments>
		<pubDate>Sun, 20 Mar 2011 23:06:52 +0000</pubDate>
		<dc:creator>Robert</dc:creator>
				<category><![CDATA[Google App Engine]]></category>
		<category><![CDATA[PhoneBlogger]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[VoiceXML]]></category>

		<guid isPermaLink="false">http://www.wombatnation.com/?p=905</guid>
		<description><![CDATA[In late 2002, I thought it would be cool to build an application that allowed you to blog by phone. Tools, libraries and hosted services were a bit more limited back then, but after a few months of learning, coding and debugging, I managed to release the first version of PhoneBlogger in January 2003. Along [...]]]></description>
				<content:encoded><![CDATA[<p>In late 2002, I thought it would be cool to build an application that allowed you to blog by phone. Tools, libraries and hosted services were a bit more limited back then, but after a few months of learning, coding and debugging, I managed to release the first version of <a href="/phoneblogger/">PhoneBlogger</a> in January 2003. Along the way, I learned a lot about <a href="http://python.org">Python</a>, <a href="http://voicexml.org">VoiceXML</a>, JavaScript, XML-RPC, audio encoding, shared web hosting and command line tools for Linux.</p>

<p>Fast forward nearly ten years and not only have the tools and libraries come a long way, but there are many more free or inexpensive hosted services that simplify building a tool/service like PhoneBlogger. Instead of hosting the application code on a shared hosting site, I can now build and deploy on <a href="http://code.google.com/appengine/">Google App Engine</a>. Though scalability is not an issue for my personal use of PhoneBlogger, if it were turned into a public service, App Engine would make scaling much simpler and more economical. App Engine also makes deployment a snap, though with a small amount of work, so would <a href="http://fabfile.org/">Fabric</a>. For my PhoneBlogger rewrite, I decided to use App Engine.</p>

<p>In the original version of PhoneBlogger, I coded a bunch of static VoiceXML and JavaScript for managing the telephone interaction with a caller. At the time, three of the most prominent services for VoiceXML developers were <a href="http://studio.tellme.com">Tellme</a> (now owned by Microsoft), <a href="http://cafe.bevocal.com">BeVocal</a> (now owned by Nuance) and <a href="http://evolution.voxeo.com">Voxeo</a> (still independent). I had to write slightly different code for Tellme and BeVocal, but the differences weren&#8217;t that significant. I think it would have been pretty simple to port to Voxeo, as well. Improved support of VoiceXML 2 would now likely allow me to use the same code on each platform.</p>

<p>While VoiceXML is still a great option for building speech apps, a couple of new services bring you simple APIs for building speech or DTMF (touchtone) applications, at the cost of portability. This time around I&#8217;ve started with <a href="http://twilio.com">Twilio</a>. I very quickly turned a Python/GAE example from the Twilio website into a DTMF app for tweeting by phone. Although speech recognition allows you to build much more complex and natural applications, many simple applications can be built quickly and easily with just support for pressing keys to provide input. PhoneBlogger falls into that category, for now.</p>

<p>One very convenient thing about Twilio is that I can use their platform to capture and host recordings in a format that is simple to play back in a web browser. If I were really concerned about longevity of the recordings I could easily retrieve them and store them elsewhere, but I&#8217;m okay with keeping them on Twilio servers for now. That&#8217;s an easy enhancement to add later. The biggest downside for tweeting the Twilio links is that the Twilio recording URLs are ginormous. Fortunately, the goo.gl URL shortener made quick work of that problem.</p>

<p>I&#8217;m also going to take a look at porting my code to <a href="http://tropo.com">Tropo</a>, which is a service offered by Voxeo. Tropo is built on Voxeo&#8217;s Prophecy platform and offers speech recognition as an option.</p>

<p>I decided to begin the rewrite by first supporting tweeting by phone. Twitter offers a great API, which is made even simpler by libraries like Tweepy. I highly recommend first checking out the OAuth support in any library for Twitter you might consider using. OAuth can be a complex beast, but libraries like <a href="http://joshthecoder.github.com/tweepy/">Tweepy</a> make it almost trivial.</p>

<p>The original PhoneBlogger source code and a couple iterations of it are <a href="http://sourceforge.net/projects/phoneblogger/">available on SourceForge</a>. I wasn&#8217;t particularly interested in learning about CVS at the time, so I just uploaded tarballs of all the code. While SourceForge has improved a lot, I&#8217;ve become more of a fan of GitHub. Google Code, LaunchPad and BitBucket are also great options. I started using LaunchPad when working on a <a href="https://launchpad.net/gearmanij">Java library for Gearman</a>, but then set up a <a href="https://github.com/RobertStewart">couple of repos on GitHub</a> when I started working on <a href="https://github.com/log4mongo/log4mongo-java">Log4mongo-Java</a>. I&#8217;m much happier with Git, Bazaar and Mercurial than Subversion and CVS (Caveman Versioning System). I&#8217;ve already started posting code for the new <a href="https://github.com/RobertStewart/phoneblogger">phoneblogger project on GitHub</a>.</p>

<p>As of now, the new version of PhoneBlogger supports tweeting by phone. All the code is on GitHub, along with a README file with the basic steps to set it up for yourself. In an upcoming blog post I&#8217;ll walk through those steps in a little more detail.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wombatnation.com/2011/03/tweeting-by-phone-with-phoneblogger/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>O&#8217;Reilly Media Wishlist</title>
		<link>http://www.wombatnation.com/2011/02/oreilly-media-wishlist</link>
		<comments>http://www.wombatnation.com/2011/02/oreilly-media-wishlist#comments</comments>
		<pubDate>Thu, 10 Feb 2011 18:33:00 +0000</pubDate>
		<dc:creator>Robert</dc:creator>
				<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.wombatnation.com/?p=902</guid>
		<description><![CDATA[Programming Scala The Ruby Programming Language Hadoop: The Definitive Guide, Second Edition Data Mashups in R Great R: Level 1 Hands-on Cassandra JavaScript: The Good Parts Complete Web Monitoring Scaling MongoDB]]></description>
				<content:encoded><![CDATA[<ul>
    <li><a href="http://oreilly.com/catalog/9780596155957/">Programming Scala</a></li>
    <li><a href="http://oreilly.com/catalog/9780596516178/">The Ruby Programming Language</a></li>
    <li><a href="http://oreilly.com/catalog/9781449389734/">Hadoop: The Definitive Guide, Second Edition</a></li>
    <li><a href="http://oreilly.com/catalog/9780596559649/">Data Mashups in R</a></li>
    <li><a href="http://oreilly.com/catalog/0636920001041/">Great R: Level 1</a></li>
    <li><a href="http://oreilly.com/catalog/0636920014195/">Hands-on Cassandra</a></li>
    <li><a href="http://oreilly.com/catalog/9780596517748/">JavaScript: The Good Parts</a></li>
    <li><a href="http://oreilly.com/catalog/9780596155131/">Complete Web Monitoring</a></li>
         <li><a href="http://oreilly.com/catalog/9781449303211/">Scaling MongoDB</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.wombatnation.com/2011/02/oreilly-media-wishlist/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic page generated in 1.152 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2013-06-18 23:10:48 -->

<!-- Compression = gzip -->