Great Pacific Garbage Patch

I am constantly surprised at how people have not heard of the “Great Pacific Garbage Patch”, basically a very large patch of man-made pollution floating in the Pacific. The currents in the Pacific work together to create this patch of garbage which varies in size over time, somewhere between the size of Texas and the size of the US.

This TedTalk by Capt. Charles Moore illustrates this very well:

Capt. Charles Moore of the Algalita Marine Research Foundation first discovered the Great Pacific Garbage Patch — an endless floating waste of plastic trash. Now he’s drawing attention to the growing, choking problem of plastic debris in our seas.

I have done some amount of scuba diving (about 200+ dives) and I have almost always seen pollution of some sort or another on most dives which is very disheartening (as well as the now usual coral bleaching and falling fish populations.)


C3P0, MySQL and ‘Error Reading Communication Packets’

I have been using C3P0 as my connection pool for iBatis to connect to a MySQL database (via the MySQL connector for Java) and have been dogged by an annoying issue where the client (presumably iBatis) drops the connection without closing it first causing MySQL to complain with the error message “Got an error reading communication packets”. Not a major issue because it was not causing the application to fail, but it was generating about 2GB of unnecessary log every month.

Basically what is going on is that the connection times out at the MySQL server end because it is idle (more than 60 seconds in this case). I set the idle timeout in C3P0 to 50 seconds to ensure that the connection was closed there before the timeout triggered in MySQL, obviously that was not working. As I mentioned above what I think is going on is that iBatis is dropping the connection without closing it properly first:

I get pages of error logs with this message –
“Got an error reading communication packets”. And the aborted clients
are easily in hundreds.

You get that message in the log every time the server closes a client
connection because it was inactive too long. Too long is “longer than

In fact C3P0’s author, Steve Waldman, mentions this:

Sometimes client applications are sloppy about close()ing all Connections they check out. Eventually, the pool grows to maxPoolSize, and then runs out of Connections, because of these bad clients.

I was not about to go grubbing around in the iBatis code (and whatever else) to figure out where the issue was, and found that ‘propertyCycle’ would probably help me:


Default: 0
Maximum time in seconds before user configuration constraints are enforced. Determines how frequently maxConnectionAge, maxIdleTime, maxIdleTimeExcessConnections, unreturnedConnectionTimeout are enforced. c3p0 periodically checks the age of Connections to see whether they’ve timed out. This parameter determines the period. Zero means automatic: A suitable period will be determined by c3p0. [You can call getEffectivePropertyCycle…() methods on a c3p0 PooledDataSource to find the period automatically chosen.]

The ‘suitable period’ chosen by C3P0 here was 12.5 seconds, which means that it is very likely for the cycle to fall outside my window of 50 and 60 seconds (see above.) Changing this to 5 seconds fixed the issue (10 still generated errors once in a while.) Interestingly the ‘suitable period’ is stored internally as a float (as retrieved by getEffectivePropertyCycleDefaultUser()) but is set as an int (as set by setPropertyCycle()), go figure.

Safari 4 Beta

Apple just released a beta of Safari 4.0, so I downloaded it and took a quick look.

Looks nice enough, ArsTechnica has a good first look, I like the top sites and the history, but I hate the new tabs. Those will take some getting used to if that is what makes it into the final release.

There is of course the ‘other‘ browser.

Updated – Apparently you can revert the tabs to the old position:

defaults write DebugSafari4TabBarIsOnTop -bool NO

Second update – this page lists all the options you can set and unset from the command line.

State of the Oceans

In early March there is going to be a conference in Washington DC called “The Blue Vision Summit” to talk about the critical state of the oceans.

One of the speakers is Sylvia Earle who gave a presentation at TED this month on that very subject. Well worth watching.

Using Solid State Disks on Linux

Great post on using solid state disks on Linux by Dan Weinreb.

Solid-state disks (SSDs) are getting less expensive, faster, and larger. I just bought a lightweight laptop with 128GB of SSD instead of a disk. Just to see what I’d find out, I poked around on the web looking for information how to use SSD’s under Linux. Keep in mind that I am not an expert on SSD’s, nor on Linux! Bearing that in mind, here’s what I found:

I am about to update my main linux development machine and was considering using a SSD for the boot drive though it sounds like that might not be the best thing to do.

New Mac Mini

Interesting leaks of the new Mac Mini, a picture and a video.

Couple of things are interesting beyond the specs you would expect, there are two display ports and a FireWire 800 port (rather than the 400 port on the current model.)

With FireWire 800 (to which you could attach a Drobo) the Mac Mini becomes a much more interesting NAS device.

iPhone App Usage Patterns

Some interesting stats on iPhone application usage patterns:

Regarding the ability of applications to sustain users’ interest, Pinch Media discovered that only about 1% of downloads end up being used long-term, with only about 20% of users of free applications using the application beyond the first day. While paid apps generally perform a bit better in this regard than free apps, the drop-off in usage is still steep in the vast majority of cases. Similarly, the amount of time users spend engaged with an application decreases significantly, stabilizing at approximately five minutes per day, although games do perform approximately twice as well as other applications in this regard.

This pretty much mirrors my usage patterns. I usually test out apps for a day (or less) and delete if it doesn’t serve my needs, or I keep it around. There are a few apps I use on a daily basis but most I use sporadically.