Using R to Fetch and Plot Cosm Data

I have a number of sensor devices that use Cosm as a cloud based store data.  Cosm provides a fairly easy to use system for storing, viewing, and reacting to data from sensor networks (or just about any other source).  The Cosm pages provide basic graph building functions but lack the ability to do any computations, overlays, etc.  To make use of this data more effectively it can be loaded into the R Statistical Computing software package.  R is a full featured statistical package that is freely available for all major operating systems.

This post describes the process of using the RCurl package to retrieve data via the Cosm API from within R.

(more…)

SSL Connections in Ruby with ruby-postgres

Not much here, just a quick note about getting SSL connections to PostgreSQL in Ruby. According to the ruby-postgres documentation arbitrary libpg options can be passed to the PGconn.open() call. Calling PGconn.open like this:

conn = PGconn.open( 'host'    => 'host.domain.com',
                    'options' => 'sslmode=require' )

results in PGError: FATAL: invalid command-line arguments for server process. After digging at some forums and the ruby-postgres source code I found that one needs to prepend the options string with -o, so a working example is:

conn = PGconn.open( 'host'    => 'host.domain.com',
                    'options' => '-o sslmode=require' )