Thursday, December 23, 2010

Rserve

ruby rserve client


$ sudo gem install rserve-client
$ irb
>> require 'rserve'
>> a = Rserve::Connection.new

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


http://www.rforge.net/Rserve/doc.html

http://www.rforge.net/Rserve/files/

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



Note:

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.

Configuration
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 http://forums.macrumors.com/showthread.php?t=1044728

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

Wednesday, December 15, 2010

installing mysql2 gem on osx info from stackoverflow.com


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.

From: http://blog.deversus.com/2010/11/mac-os-1065-apachectl-usrsbinapachectl-line-82-ulimit-open-files-cannot-modify-limit-invalid-argument/

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 (http://support.apple.com/kb/HT4435). 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:

ULIMIT_MAX_FILES=""

Sunday, December 12, 2010

rsruby installing on snow leopard 10.6.x

R manual:
http://www.u.arizona.edu/~ryckman/Documents/RTutorial.pdf

http://rubyforge.org/projects/rsruby/

http://github.com/alexgutteridge/rsruby/tree/master


https://github.com/alexgutteridge/rsruby


http://web.kuicr.kyoto-u.ac.jp/~alexg/rsruby/manual.pdf

<code>

#  rerun this command whenever R.app 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):

  export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:RHOME/bin

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

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

  RHOME/bin


$ 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


</code>




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.

http://support.apple.com/specs/

alternate site, if apples does not work:

http://www.appleserialnumberinfo.com/

Friday, November 19, 2010

Cloth Diapers?

Well written, with very nice pictures -- a view of one families transition to cloth diapers.

http://babymakingmachine.blogspot.com/search/label/cloth%20diaper%20experiment

locked out of drupal?

I was given a site which had maintenance mode turned on, needed to turn it off, so I needed these urls.


http://localhost/drupal6/?q=user
http://localhost/drupal6/?q=admin/settings/site-maintenance

Thursday, November 18, 2010

Rails and Ruby Learn interactively

Two great sites to give you a great quick start learning ruby and then rails.

Learn Ruby
http://tryruby.org/

Learn Rails
http://railsforzombies.org/

macports removing old bits

I noticed lots of duplication when I looked at my installed ports using the command,

$ port list installed


I needed to clean out the old builds. First I needed to see the old builds using the command:

$ port installed


Then remove the old bits using the following commands:

$ sudo port clean --all installed
$ sudo port -f uninstall inactive


use $ du -sh /opt to get the size of the /opt directory before and after removal of ports.

Based on information in the blogpost at cleaning-up-macports

Before I install new packages, or update, I like to update macports itself, and then update outdated packages.

$ sudo port selfupdate
$ sudo port upgrade outdated

Tuesday, November 16, 2010

Wool Dryer Balls - Faster Laundry Drying Time

Wool Dryer Balls gift set.


Wool dryer balls are popular gift for this year. They work for everyone, and are a very useful 'green' gift. You can add scents to the wool using essential oils, or go the unscented route.

Dryer balls help with the tumbling action of the laundry, and are great for use with items such as cloth diapers.

They are available in colors too.

Wool Dryer Balls - Where I found them.

Microsoft Office for Mac 2011 - Mactech Benchmarks

http://www.mactech.com/2010/11/16/mactech-releases-office-mac-2011-benchmark-results

MacTech benchmarked the performance of Microsoft Office versions 2011, 2008, 2004.

See MacTech chart of comparisons of the components of office.

















There has been one update so far to the office suite November 9, 2010.

Visual Basic and Outlook are changes in this update.

Wednesday, November 10, 2010

OSX R.app Ruby

I want to use ruby, and later a rails application to work with the R statistical application. CRAN R.app home.


  1. sudo gem install simpler
  2. OSX Snow Leopard 10.6 already has ruby installed.
  3. OSX includes Preview.app for viewing pdf documents.
  4. Run an example.

$ irb
>> require 'simpler'
>> r = Simpler.new
>> x = [1,2,7]
>> y = [3,4,8]
>> r.pdf_viewer = "open /Applications/Preview.app"
>> r.show!(x,y) {|xr,yr| "plot(#{xr},#{yr})"}

resulting image shown in preview...


This code is from the info on github.
https://github.com/jtprince/simpler