Thursday, December 23, 2010


ruby rserve client

$ sudo gem install rserve-client
$ irb
>> require 'rserve'
>> a =

>> y = a.eval('2 + 2').to_ruby
=> 4.0

download the current osx binary, then install using a command similar to:

$ R CMD INSTALL /Users/eabolden/Downloads/Rserve_0.6-3.tar

Get the source code, not the OSX binary if you are using R64.

$ R CMD INSTALL /Users/eabolden/Downloads/Rserve_0.6-3.tar

Start Rserve with the command

$ R CMD Rserve

R version 2.12.1 (2010-12-16)
Copyright (C) 2010 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

Rserv started in daemon mode.

View Rserve settings

$ R CMD Rserve --RS-settings
WARNING: ignoring environment value of R_HOME
Rserve v0.6-3

config file: /etc/Rserv.conf
working root: /tmp/Rserv
port: 6311
local socket: [none, TCP/IP used]
authorization required: no
plain text password: not allowed
passwords file: [none]
allow I/O: yes
allow remote access: no
control commands: no
interactive: yes
max.input buffer size: 262144 kB


If no config file is supplied, Rserve accepts no remote connections, requires no authentication and file transfer is enabled. For more details about how to configure Rserve, see below.

Rserve is configured by the configuration file /etc/Rserv.conf (can be changed at compile time by specifying -DCONFIG_FILE=..). Additional configuration files can be added by the --RS-conf command line argument. The possible configuration entries are as follows (all entries are optional; default values are in angled brackets):

Thursday, December 16, 2010

vnc connection from linux to mac

Use the following to connect and see screen with ability to type. the clipboard part keeps the client from freezing:

vncviewer -SendClipboard=0
 -AcceptClipboard=0 -FullColour <hostname>

information from thread on

vncviewer -SendClipboard=0 -AcceptClipboard=0 -FullColour -PreferredEncoding=ZRLE <ip>

Wednesday, December 15, 2010

installing mysql2 gem on osx info from

You need the MySQL development headers for mysql2 to properly compile. This is needed, because much of the functionality is written in C and subsequently linked against MySQL.
A solution is to either point the gem installer to your mysql install folder explicitly like so
gem install mysql2 -- --with-mysql-dir=/usr/local/mysql# or where ever you installed your mysql server to
or by installing a mysql server to a known location (e.g. by using homebrew.) and then installing the gem
# install the mysql server locally
brew install mysql# install the gem
gem install mysql2
Both approaches require you to have XCode installed to have the required GCC compiler.

Mac OS 10.6.5 + apachectl: /usr/sbin/apachectl: line 82: ulimit: open files: cannot modify limit: Invalid argumen

hit this error today, google found several mentions of this fix.

The fix worked for me.


Mac OS 10.6.5 + apachectl: /usr/sbin/apachectl: line 82: ulimit: open files: cannot modify limit: Invalid argument

After upgrading to Mac OS 10.6.5 this morning while working on Quote Manager, I went to restart apache via the “sudo apachectl restart” command and was presented with an obscure error message:

/usr/sbin/apachectl: line 82: ulimit: open files: cannot modify limit: Invalid argument
Since apachectl was working fine 5 minutes before I updated to Mac OS 10.6.5, I figured the two were related. After a quick dig into what the update entailed, I found that Apple updated to Apache 2.2.15, which patched a number of vulnerabilities ( It turned out that one of those changes broke the apachectl script. Referring to line 82 of apachectl, the shell script was referring to the ULIMIT_MAX_FILES variable, which was set to:

ULIMIT_MAX_FILES="ulimit -S -n `ulimit -H -n`"
Changing the line as follows fixed the problem:


Sunday, December 12, 2010

rsruby installing on snow leopard 10.6.x

R manual:


#  rerun this command whenever is updated.
$ sudo gem install rsruby -- --with-R-dir=$R_HOME

== Installation

A working R installation is required. R must have been built with the '--enable-R-shlib' option enabled to provide the R shared library used by RSRuby.

Ensure the R_HOME environment variable is set appropriately. E.g.:

  R_HOME=/usr/lib/R (on Ubuntu Linux)
  R_HOME=/Library/Frameworks/R.framework/Resources (on OS X)

An RSRuby gem is available as well as a package using setup.rb. In each case the installation requires the location of your R library to compile the extension. This is usually the same as R_HOME. If you download the setup.rb package use these incantations:

  ruby setup.rb config -- --with-R-dir=$R_HOME
  ruby setup.rb setup
  ruby setup.rb install

Using gems it is almost the same:

  gem install rsruby -- --with-R-dir=$R_HOME

If RSRuby does not compile correctly you may need to configure the path to the R library, any one of the following should be sufficient:

o Put the following line in your .bashrc (or equivalent):


o or, make a link to RHOME/bin/ in /usr/local/lib or /usr/lib, then run 'ldconfig'.

o or, edit the file /etc/, add the following line and then run 'ldconfig':


$ sudo gem install arrayfields

~ $ irb
>> require 'rsruby'
=> true
>> r = RSRuby.instance
=> #<RSRuby:0x1011fbab0 @caching=true, @cache={"get"=>#<RObj:0x1011fb718>, "helpfun"=>#<RObj:0x1011f8400>, "help"=>#<RObj:0x1011f8400>, "NaN"=>NaN, "FALSE"=>false, "TRUE"=>true, "F"=>false, "NA"=>-2147483648, "eval"=>#<RObj:0x1011f9918>, "T"=>true, "parse"=>#<RObj:0x1011f9d00>}, @proc_table={}, @class_table={}, @default_mode=-1>
>> cc = []
=> []
>> cc << 1
=> [1]
>> cc << 45
=> [1, 45]
>> cc << 23
=> [1, 45, 23]
>> cc << 4
=> [1, 45, 23, 4]
>> cc
=> [1, 45, 23, 4]
>> r.sum(cc)
=> 73
>> r.max(cc)
=> 45
>> r.sort(cc)
=> [1, 4, 23, 45]
>> cc.sort
=> [1, 4, 23, 45]
>> r.length(cc)
=> 4


Sunday, December 5, 2010

What model Mac am I using?

Type a serial number into the form on this page to find out what model Macintosh you have.

alternate site, if apples does not work: