[Rpad-commits] r3 - in pkg/Rpad: . R inst inst/basehtml inst/basehtml/server man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Jan 2 16:39:43 CET 2014
Author: jedick
Date: 2014-01-02 16:39:42 +0100 (Thu, 02 Jan 2014)
New Revision: 3
Added:
pkg/Rpad/inst/basehtml/index.html
pkg/Rpad/inst/basehtml/server/
pkg/Rpad/inst/basehtml/server/R_process.pl
pkg/Rpad/inst/basehtml/server/Rpad_process.pl
pkg/Rpad/man/Rpad-package.Rd
Removed:
pkg/Rpad/inst/basehtml/LocalDefault.Rpad
Modified:
pkg/Rpad/DESCRIPTION
pkg/Rpad/R/LocalVersion.R
pkg/Rpad/inst/NEWS
pkg/Rpad/inst/README
pkg/Rpad/inst/basehtml/DojoTest.html
pkg/Rpad/inst/basehtml/Example1.Rpad
pkg/Rpad/inst/basehtml/Rpad.css
pkg/Rpad/inst/basehtml/Rpad_body.js
pkg/Rpad/inst/basehtml/ServerNotes.html
pkg/Rpad/man/RpadLocalServer.Rd
Log:
restore some functionality to the server version
Modified: pkg/Rpad/DESCRIPTION
===================================================================
--- pkg/Rpad/DESCRIPTION 2013-12-31 05:19:15 UTC (rev 2)
+++ pkg/Rpad/DESCRIPTION 2014-01-02 15:39:42 UTC (rev 3)
@@ -1,6 +1,6 @@
Package: Rpad
Title: Workbook-style, web-based interface to R
-Version: 1.3.99.0
+Version: 1.3.99.1
Author: Tom Short (EPRI), Philippe Grosjean (UMH EcoNum), Jeffrey Dick
Description: A workbook-style user interface to R through a web
browser. Provides convenient interaction with an R process
Modified: pkg/Rpad/R/LocalVersion.R
===================================================================
--- pkg/Rpad/R/LocalVersion.R 2013-12-31 05:19:15 UTC (rev 2)
+++ pkg/Rpad/R/LocalVersion.R 2014-01-02 15:39:42 UTC (rev 3)
@@ -36,13 +36,13 @@
"Rpad" <-
-function(file = "", defaultfile = "LocalDefault.Rpad", port = 8079) {
+function(file = "", defaultfile = "index.html", port = 8079) {
startRpadServer(defaultfile, port)
browseURL(paste("http://127.0.0.1:", port, "/", file, sep = ""))
}
"startRpadServer" <-
-function(defaultfile = "LocalDefault.Rpad", port = 8079) {
+function(defaultfile = "index.html", port = 8079) {
require("tcltk")
# This is the main function that starts the server
# This function implements a basic http server on 'port'
Modified: pkg/Rpad/inst/NEWS
===================================================================
--- pkg/Rpad/inst/NEWS 2013-12-31 05:19:15 UTC (rev 2)
+++ pkg/Rpad/inst/NEWS 2014-01-02 15:39:42 UTC (rev 3)
@@ -1,3 +1,20 @@
+CHANGES IN Rpad 1.3.99.1 (2014-01-02)
+-------------------------------------
+
+- Restore Perl files related to server version of Rpad
+ (Rpad_process.pl, R_process.pl).
+
+- Rename LocalDefault.Rpad to index.html (used in both the local and
+ server versions).
+
+- Remove outdated Debian and Windows sections in ServerNotes.html, but
+ move some of the notes to "Additional Notes".
+
+- Major revision of R_process.pl. Now uses a recent Statistics::R
+ (tested with version 0.32), forks a background Perl process,
+ uses Linux:Inotify to become aware of R commands and Time:Out
+ to self-destruct.
+
CHANGES IN Rpad 1.3.99.0 (2013-12-31)
-------------------------------------
Modified: pkg/Rpad/inst/README
===================================================================
--- pkg/Rpad/inst/README 2013-12-31 05:19:15 UTC (rev 2)
+++ pkg/Rpad/inst/README 2014-01-02 15:39:42 UTC (rev 3)
@@ -1,13 +1,14 @@
This is the Rpad "inst" directory
-README this file
-ChangeLog old ChangeLog, from Rpad 1.3.0 (April 2007)
-NEWS current NEWS
-tcl/ HTTP server written in TCL
-server/ Perl files for the server version of Rpad
-basehtml/ The Javascript, CSS and example HTML files for Rpad
-app.profile.js Application build profile for Dojo customization
-LICENSE.dojo License for the Dojo toolkit (http://dojotoolkit.org/)
+README This file
+ChangeLog Old ChangeLog, from Rpad 1.3.0 (April 2007)
+NEWS Current NEWS
+tcl/ Local HTTP server in TCL
+basehtml/ The Javascript, CSS and example HTML files for Rpad
+basehtml/server/ Perl files for the server version of Rpad
+perl_interface/ Statistics::Rpad Perl module, based on Statistics::R
+app.profile.js Application build profile for Dojo customization
+LICENSE.dojo License for the Dojo toolkit (http://dojotoolkit.org/)
--------
Parts of app.profile.js were adapted from the Dojo boilerplate:
Modified: pkg/Rpad/inst/basehtml/DojoTest.html
===================================================================
--- pkg/Rpad/inst/basehtml/DojoTest.html 2013-12-31 05:19:15 UTC (rev 2)
+++ pkg/Rpad/inst/basehtml/DojoTest.html 2014-01-02 15:39:42 UTC (rev 3)
@@ -29,7 +29,7 @@
</script>
<h4 id="greeting">Hello</h4>
-<p>The heading immediately above should say "Hello Dojo!" then change to "Hello" a few seconds later. This confirms that Dojo is loaded and can locate modules programmatically (in JavaScript).</p>
+<p>The heading immediately above should say "Hello Dojo!" then change to "Hello" a few seconds later. This confirms that Dojo is loaded and can locate modules programmatically (in JavaScript). It may not work on the server version of Rpad (if myModule.js is not in the webserver root directory).</p>
<h4>A simple Dojo widget</h4>
<p>There should be a button below with a counter that increments when clicked. This confirms that Dojo widgets can be instantiated declaratively (in markup).</p>
Modified: pkg/Rpad/inst/basehtml/Example1.Rpad
===================================================================
--- pkg/Rpad/inst/basehtml/Example1.Rpad 2013-12-31 05:19:15 UTC (rev 2)
+++ pkg/Rpad/inst/basehtml/Example1.Rpad 2014-01-02 15:39:42 UTC (rev 3)
@@ -22,8 +22,6 @@
-->
-<!-- modified by Jeffrey Dick to use new Dojo framework, December 2013 -->
-
<head>
<title>Rpad Example</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
@@ -64,12 +62,22 @@
The Calculate button also refreshes this plot.
</p>
+<!--
+TODO: it appears that input elements in widgets don't work with
+the CGI implementation, because of requests that look like
+-->
+
<p>
-<div data-dojo-type="Rpad" rpadOutput="none">
+<div data-dojo-type="Rpad">
<input name="sdlog" value="2">
</div>
Standard deviation<br>
</p>
+<div data-dojo-type="Rpad">
+<pre>
+print(sdlog)
+</pre>
+</div>
<div data-dojo-type="Rpad">
<pre>
Deleted: pkg/Rpad/inst/basehtml/LocalDefault.Rpad
===================================================================
--- pkg/Rpad/inst/basehtml/LocalDefault.Rpad 2013-12-31 05:19:15 UTC (rev 2)
+++ pkg/Rpad/inst/basehtml/LocalDefault.Rpad 2014-01-02 15:39:42 UTC (rev 3)
@@ -1,167 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<html>
-<!--
-by Tom Short, EPRI, tshort at epri.com
-(c) Copyright 2005 by EPRI
-license: GNU GPL v2 or greater
--->
-
-<!--
-modified by Jeffrey Dick December 2013:
-update code for current Dojo implementation,
-clean up help links and add link to DojoTest.Rpad
--->
-
-
-<head>
- <title>Rpad Base Page</title>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <script type="text/javascript">
- rpadConfig = {
- rpadRun: "all",
- rpadHideSource: true
- };
- </script>
- <!-- the Rpad head section -->
- <script src="Rpad_head.js"></script>
-</head>
-
-<style>
-.RpadTableHolder TH {padding: 5px; background: transparent;
- text-align:right; font-weight:bold;
- border: thin none #CCC; }
-.RpadTableHolder TD {padding: 5px; background: transparent;
- text-align:right; padding:2px 2px 2px 2px;
- border: thin none #CCC; }
-
-</style>
-
- <body>
-<!-- the Rpad body section -->
-<script src="Rpad_body.js"></script>
-
-
-<table width="100%"><tr valign="top"><td width="70%">
-<p>Rpad/HTML pages in working directory (click on the link to load the file): </p>
-
-<!--
-<p><span contenteditable="false">
-<a href="blank.Rpad">New Rpad page</a></span><br></p>
--->
-
-<div data-dojo-type="Rpad">
-<pre>
-.threecolumns = function(lst) {
- n = length(lst)
- if (n <= 3) return(as.matrix(lst))
- ncol = 3
- nrow = ceiling(n / ncol)
- lst = as.matrix(append(lst, rep("", ncol * nrow - n)))
- dim(lst) = c(nrow, ncol)
- lst
-}
-.rpadfiles = grep('\\.html$|\\.rpad$', dir(), ignore.case = TRUE, value = TRUE)
-.rpadfiles = H("a", href = .rpadfiles, collapseContents = FALSE,
- .rpadfiles)
-.rpadfiles = .threecolumns(.rpadfiles)
-HTMLon()
-Html(.rpadfiles)
-</pre>
-</div>
-
-<!--
-<p>*.Rdata R binary files (click to load into R): </p>
-<div data-dojo-type="Rpad">
-<pre>
-.files = grep('\\.RData$', dir(), ignore.case = TRUE, value = TRUE)
-.files = H("a", href = paste('javascript:rpad.send("R", "load(\\\\"',
- .files,
- '\\\\")")', sep = ""),
- collapseContents = FALSE,
- .files)
-.files = .threecolumns(.files)
-HTMLon()
-Html(.files)
-</pre>
-</div>
--->
-
-<!--
-<p>*.R files (click to source into R): </p>
-<div data-dojo-type="Rpad">
-<pre>
-.files = grep('\\.R$', dir(), ignore.case = TRUE, value = TRUE)
-.files = H("a", href = paste('javascript:rpad.send("R", "source(\\\\"',
- .files,
- '\\\\")")', sep = ""),
- collapseContents = FALSE,
- .files)
-.files = .threecolumns(.files)
-HTMLon()
-Html(.files)
-</pre>
-</div>
--->
-
-<p>Objects in user's workspace:</p>
-<div data-dojo-type="Rpad">
-<pre>
-# print(ls.str(), wid = 40, nchar.max = 20, vec.len=2)
-ls()
-</pre>
-</div>
-
-<p>Enter R code here and press
-<input onclick='javascript:rpad.calculatePage()' value='Calculate' type='button'></input>
-or F9 to run it:
-</p>
-<div data-dojo-type="Rpad" rpadRun="normal" rpadHideSource=false>
- <textarea rows="4" cols="60">
-g1 <- "Hello World!"
-print(g1)
-g2 <- paste(sample(strsplit(g1, "")[[1]]), collapse="")
-print(g2)
- </textarea>
-</div>
-
-
-</td><td> </td> <td width="25%">
-<p>Help</p>
-
-<span contenteditable="false">
-<a href="BasicDocumentation.html">Rpad documentation</a><br>
-<a href="ServerNotes.html">Server notes</a><br>
-</span>
-
-<p>Rpad Demos</p>
-
-<span contenteditable="false">
-<a href="Example1.Rpad">General Example</a><br>
-<a href="InputExamples.Rpad">Input Examples</a><br>
-<a href="DojoTest.html">Dojo Test Page</a><br>
-<a href="RpadTest.Rpad">Rpad Test Page</a><br>
-</span>
-
-<p>Links</p>
-
-<span contenteditable="false">
-<a href="http://cran.r-project.org/doc/contrib/Short-refcard.pdf">Tom Short's R refcard</a><br>
-<a href="http://cran.r-project.org/doc/contrib/Baggott-refcard-v2.pdf">Matt Baggot's R refcard v2</a><br>
-<a href="http://cran.r-project.org/doc/contrib/Liu-R-refcard.pdf">Liu's R refcard</a><br>
-<a href="http://rpad.r-forge.r-project.org">Rpad homepage</a><br>
-<a href="http://www.r-project.org">R homepage</a><br>
-</span>
-
-
-
-</td></tr></table>
-
-<br><br><br>
-<sub>The original author of Rpad is:</sub>
-<br>
-<sub>Tom Short, tshort at epri.com, Copyright 2005. EPRI, license: GNU GPL v2 or greater</sub>
-<br>
-<sub>To contact the current maintainer, see the DESCRIPTION file</sub>
- </body>
-</html>
-
Modified: pkg/Rpad/inst/basehtml/Rpad.css
===================================================================
--- pkg/Rpad/inst/basehtml/Rpad.css 2013-12-31 05:19:15 UTC (rev 2)
+++ pkg/Rpad/inst/basehtml/Rpad.css 2014-01-02 15:39:42 UTC (rev 3)
@@ -79,11 +79,3 @@
text-align:right; padding:2px 2px 2px 2px;
border: thin solid #CCC; }
-.RpadTableHolder .tableheaderrow {
-/*
- cursor: pointer ;
- behavior:url(js/tablesort.htc);
- -moz-binding: url(../js/moz-behaviors.xml#tablesort.htc);
-*/
-}
-
Modified: pkg/Rpad/inst/basehtml/Rpad_body.js
===================================================================
--- pkg/Rpad/inst/basehtml/Rpad_body.js 2013-12-31 05:19:15 UTC (rev 2)
+++ pkg/Rpad/inst/basehtml/Rpad_body.js 2014-01-02 15:39:42 UTC (rev 3)
@@ -204,6 +204,7 @@
// Send "commands" for processing.
// Put results received in the DOM node "rpadResults".
// Send along the originating DOM node "rpadInput" in case it's needed.
+//alert("in rpad.send, commands = "+commands);
require(["dojo/request"], function(request){
// The target URL on your webserver:
request.get("server/R_process.pl", {
@@ -220,7 +221,7 @@
rpad.receive(rpadResults, response, rpadInput);
}, function(err){
// Event handler on errors:
- alert("error in rpad.send");
+ alert("Error in rpad.send. Did R stop running?\n"+err);
});
});
}
@@ -325,18 +326,24 @@
command = name + " = '" + node.value + "'";
} else if (node.nodeName.toLowerCase() == "select" && node.selectedIndex >= 0)
command = name + " = '" + node[node.selectedIndex].text.replace(/'/g,"\\\'") + "'"
- else if (node.type == "text" || node.type == "hidden")
+ else if (node.type == "text" || node.type == "hidden") {
if (node.getAttribute("rpadType") == "Rvariable" && node.value != "") {
command = name + " = " + node.value;
}
else if (node.getAttribute("rpadType") == "Rstring" && node.value != "") {
command = name + " = '" + node.value.replace(/'/g,"\\\'") + "'";
}
+ }
commands = commands + command + "\n";
+ }
//alert("processRForm node.type="+node.type+" commands="+commands);
- }
- if (commands != "") {
+ if (commands != "" && commands != "\n") {
rpad.send(commands, null, nodes[0]);
+ } else if (commands == "\n") {
+ // the \n by itself, caused by an input field in an Rpad widget (not Rvariable or Rstring)
+ // results in a spurious R command that breaks R communication in the CGI implementation,
+ // but we do need to keep going to calculate the next nodes
+ rpad.calculateNextNode(nodes[0]);
}
}
@@ -447,9 +454,10 @@
rpad.processRForm(node.elements);
return true;
}
- // process standalone input fields individually
+ // process standalone input fields (but not buttons) individually
if ((node.nodeName == "INPUT" || node.nodeName == "SELECT") &&
node.getAttribute("name") != "" &&
+ node.type != "button" &&
rpad._hasNoFormParent(node)) {
rpad.processRForm(node);
return true;
@@ -507,27 +515,30 @@
require(["dojo/request"], function(request){
// The target URL on your webserver:
+ // initialize Rpad
request.get("server/Rpad_process.pl?command=login", {
// The used data format.
handleAs: "text"
}).then(function(response){
-
// Event handler on successful call:
- // The target URL on your webserver:
+ // Save the location of the rpad temporary directory and start an R process
+ rpad.dir = response;
request.get("server/R_process.pl?ID="+response+"&command=login", {
handleAs: "text"
}).then(function(response){
// this is where we want to be! let's calculate the page
if(rpad._runState == "init") rpad.calculatePage();
}, function(err){
- alert("error in rpad.login step 2/2");
+ // (The missingness of Statistics::R might cause this error on the server version of Rpad, not the local version)
+ alert("Error in rpad.login step 2/2. Is the Statistics::R Perl module installed? Error:\n"+err);
});
}, function(err){
// Event handler on errors:
- alert("error in rpad.login step 1/2");
+ // (The missingness of Rpad_process.pl will cause this error on the server version of Rpad, not the local version)
+ alert("Error in rpad.login step 1/2. Is the Rpad/server/Rpad_process.pl file present on the HTTP server?");
});
});
Modified: pkg/Rpad/inst/basehtml/ServerNotes.html
===================================================================
--- pkg/Rpad/inst/basehtml/ServerNotes.html 2013-12-31 05:19:15 UTC (rev 2)
+++ pkg/Rpad/inst/basehtml/ServerNotes.html 2014-01-02 15:39:42 UTC (rev 3)
@@ -30,15 +30,8 @@
<body>
<h2>Installation of the Server Version</h2>
- <p>Rpad has been setup with Linux using the Apache server, with
- either Apache 1.3 or Apache 2.0. It may
- well work on others, but this was the easiest option. Under
- windows, it has also been tested with Apache
- (although it doesn't seem as responsive as apache under linux). I have
- also had good experiences using Rpad with coLinux (www.colinux.org) under
- win2k with R, Apache, and mod_perl. Rpad can be installed using
- CGI for the perl portion or with mod_perl. These directions
- describe installation with mod_perl:</p>
+ <p>This document outlines the setup of the server version of Rpad on Linux using Apache 2.4.
+ The Perl portion of the Rpad interface can be installed using CGI or mod_perl.</p>
<p>The main steps to installing Rpad on a server are:</p>
@@ -47,49 +40,54 @@
<li>Install the R2HTML package from CRAN.</li>
- <li>Install the Rpad package from CRAN.</li>
+ <li>Install the Rpad package from CRAN.
+ Note: for server version, Rpad and all other referenced R packages must be
+ installed at the system level.</li>
<li>Install Apache.</li>
- <li>Install mod_perl. This is optional. Rpad can also be run
- with CGI. </li>
+ <li>Install mod_perl (optional, but faster than CGI). </li>
<li>Copy the directory basehtml in Rpad's package directory to
- /www/var (or wherever your server root is). Rename as
+ /var/www (or wherever your server root is). Rename as
appropriate. For example: </li>
<pre>
cp -r /usr/lib/R/library/Rpad/basehtml /var/www/Rpad
</pre>
- <li>Enable write access to the Rpad directory as well as the
- Rpad/server directory.</li>
+ <li>Ensure the webserver user (e.g. apache) has write access to the /tmp directory.</li>
<li>Enable execution of all of the Rpad/server/*.pl files
(chmod a+x).</li>
- <li>Install the Statistics-R_perl_interface that comes with Rpad
- in the serverversion directory. This version has slight
- modifications to Graciliano's R-Statistics
- version 0.02).</li>
+
+ <li>Install the required Perl modules (all available on CPAN):</li>
+
+ <ul>
+ <li>Statistics::R (tested with version 0.32; don't use the old 0.02!) (and dependencies IPC::Run, Regexp::Common, Text::Balanced).
+ Used to control an R process through Perl.</li>
- <li>Change the server configuration as appropriate to enable
- CGI and/or mod_perl. Tell the browser not
- to cache some files which might change during a
- session, using the mod_expires module. Here is the portion of the httpd.conf for Apache 1.3
- to do this for Rpad files in /var/www/Rpad:</li>
+ <li>Linux::Inotify2 (and its dependency, common:sense). Used to monitor file changes
+ so that incoming R commands can be executed by a backgrounded Perl/R bridge.</li>
+ <li>Time::Out. Used to time out waiting for R results (10 seconds), and to destroy the background
+ Perl/R bridge (10 minutes, after which the temporary directory is cleared and the R and Perl processes exit).</li>
+ </ul>
+
+
+ </li>
+
+ <li>Update the HTTP server configuration file to enable execution of the Perl scripts.
+ Also, add a mime type to tell the server to serve .Rpad files as text/html, and
+ use mod_expires to tell the browser not to cache some files which might change
+ during a session. Here is the portion of the httpd.conf for Apache 2.4
+ to do this using CGI:</li>
+
</ul>
<pre>
+LoadModule cgi_module modules/mod_cgi.so
<Directory /var/www/Rpad/server*>
- <IfModule mod_perl.c>
- <Files *.pl> # requires mod_perl
- SetHandler perl-script
- PerlHandler Apache::Registry
- Options +ExecCGI
- PerlSendHeader ON
- </Files>
- </IfModule>
Options +ExecCGI
AddHandler cgi-script .pl
<IfModule mod_expires.c>
@@ -97,66 +95,35 @@
ExpiresDefault "now plus 0 seconds"
</IfModule>
</Directory>
-AddType text/x-component .htc
AddType text/html .Rpad
</pre>
<ul>
- <li>Here's a portion of the httpd.conf to configure Rpad for
- Apache2 for files in /var/www/Rpad:</li>
+ <li>This is what it might look like when using mod_perl:</li>
</ul>
<pre>
+LoadModule perl_module modules/mod_perl.so
<Directory /var/www/Rpad/server*>
<IfModule mod_perl.c>
<Files *.pl> # requires mod_perl
SetHandler perl-script
- PerlResponseHandler ModPerl::PerlRun
+ PerlResponseHandler ModPerl::Registry
PerlOptions +ParseHeaders
- Options -Indexes +ExecCGI
+ Options +ExecCGI
</Files>
</IfModule>
- Options +ExecCGI
- AddHandler cgi-script .pl
<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault "now plus 0 seconds"
</IfModule>
</Directory>
-AddType text/x-component .htc
AddType text/html .Rpad
</pre>
- <ul>
- <li>Add a mime type to tell the server to serve .Rpad files as
- text/html (done in the httpd.conf files above).</li>
- <li>To get the help menu item to work, create a symlink R to /usr/lib/R
- in the /www/var/Rpad directory (ln -s /usr/lib/R /var/www/Rpad/R).</li>
- <li>To update the javascript database for the R keyword search
- page (SearchRKeywords.html), source makeHelpTemplate.R from
- within R in the main Rpad directory.</li>
- </ul>
- <h2>Notes on Debian</h2>
+ <h2>Additional Notes</h2>
-<p>This is the main platform that Debian's been tested on, and
-<a href="http://www.Rpad.org">www.Rpad.org</a> is a Debian
-server. Debian packages for Rpad are available at <a
-href="http://www.Rpad.org">www.Rpad.org</a>. Installing the Rpad
-package does all of the installation steps described above. Under
-Debian, Rpad will work with apache or apache2, and it will work with
-or without mod_perl on either version of apache.</p>
-
-<p>There's also a script that will install the Rpad html files. It is located in the
-serverversion directory within the Rpad package directory. It's called
-installRpadWWW.sh. This creates another Rpad directory. In
-addition to copying the base html files, it sets permissions and configures
-apache properly for that directory. Here's an example:
-</p>
-<pre>
-/usr/local/lib/R/site-library/Rpad/installRpadWWW.sh /var/www/RpadTesting
-</pre>
-
<p>I normally add a cron job to restart the Apache server once a
day. This clears out any R processes that didn't get killed for
whatever reason. I create the following as the file /etc/cron.daily/Rpad-cleanup:</p>
@@ -166,49 +133,10 @@
rm -rf /var/www/Rpad/server/dd*
</pre>
+<p>Some considerations for Windows:</p>
- <h2>Notes on Apache 1.3 under Windows</h2>
-
-
<pre>
-# Installing apache_1.3.33-win32-x86-no_src.msi downloaded from
-# www.apache.org using CGI
-# Windows 2000
-# Perl 5.8.4 installed at C:/apps/perl
-# Installed Apache at C:/Program Files/Apache Group/Apache
-# WWW root is at C:/Program Files/Apache Group/Apache/htdocs
-
-# Copied the directory basehtml directory to htdocs\Rpad
-xcopy/I/S "C:\Program Files\R\rw2001\library\Rpad\basehtml" "C:\Program Files\Apache Group\Apache\htdocs\Rpad"
-
-# Added a mime type for .Rpad files in conf\mime.types as follows:
-text/html Rpad
-
-#Installed Statistics-R_perl_interface:
-cd C:\Program Files\R\rw2001\library\Rpad\serverversion\Statistics-R_perl_interface
-perl Makefile.pl
-nmake
-nmake install
-# you can also just copy the directory
-# C:\Program Files\R\rw2001\library\Rpad\serverversion\Statistics-R_perl_interface\lib\Statistics
-# to C:\apps\perl\site\lib (or wherever your perl lib's are)
-
-# Add the following to the conf\httpd.conf file to read .pl files as CGI:
-AddHandler cgi-script .pl
-
-# Changed the following in the conf\httpd.conf file to enable CGI:
- Options Indexes FollowSymLinks MultiViews
-# to
- Options Indexes FollowSymLinks MultiViews ExecCGI
-
-# Added the following line as the first line to the 3 perl files in
-# htdocs\Rpad\server to point to perl
-#!c:/apps/perl/bin/perl.exe
-
-# I also futzed with the permissions on these files, but I don't know
-# that it was necessary.
-
-# Used R's png driver rather than ghostscript: in .RpadStartup.R,
+# Used R's png driver rather than ghostscript: in RpadStartup.R,
# uncommented the following line:
#
graphoptions(type="Rpng")
@@ -230,78 +158,10 @@
You need to change the user for the apache service and
set permissions for that user to prevent access to unwanted
parts of your hard drive. Google for "apache localsystem ntfs permissions".
-
</pre>
- <h2>Notes on Apache 2.0 under Windows</h2>
-<p>Installing Rpad on an apache2 installation (cgi mode) on Windows 2000
-worked exactly the same as the Apache 1.3 installation. </p>
-
-<p>I briefly tried Rpad with apache2/modperl under windows. In very limited
-testing, it worked okay. Modperl under windows can make Apache very slow, at least to start
-and stop. A server restart can take over 10 seconds on my win2k
-laptop. </p>
-
- <h2>Notes on the Windows IIS server</h2>
-
-<p>WARNING: Users (including me) have reported problems installing
-Rpad on IIS. I've got a Windows 2000 machine with IIS running fine. In
-another installation on XP (also using IIS v5.1), it refuses to start
-R (the perl part works, it just won't spawn another process). </p>
-
-<p>Installing Rpad on the IIS server that came with Windows 2000
-worked mainly the same as the Apache 1.3 installation. Here are some
-further notes:</p>
-
-<pre>
-# Copied the directory basehtml directory to wwwroot\Rpad
-xcopy/I/S "C:\Program Files\R\rw2001\library\Rpad\basehtml" "C:\Inetpub\wwwroot\Rpad"
-
-#Installed the Statistics-R_perl_interface as outlined above.
-
-## NOTE: This step shouldn't be needed anymore! It should figure it out right,
-## but I left it in so you can try it if things don't work right.
-# In C:\Inetpub\wwwroot\Rpad\server\R_process.pl, change the following
-# lines from:
-my $R = Statistics::Rpad->new(
-# log_dir => '/var/www/Rpad/server/' . $Rpad_ID
- log_dir => $dir . $Rpad_ID
- ) ;
-# to:
-my $R = Statistics::Rpad->new(
- log_dir => 'c:/Inetpub/wwwroot/Rpad/server/' . $Rpad_ID
-# log_dir => $dir . $Rpad_ID
- ) ;
-
-# In the IIS "properties" tab, change the following:
-# Under Http Headers|File Types...|New Type..., entered a Content type
-# of text/html for an Associated Extension of Rpad
-# Under Home Directory|Configuration...|App Mappings,
-# added a Extension for pl with an Executable of
-# C:\apps\Perl\bin\perl5.8.4.exe %s %s
-
-# Used R's png driver rather than ghostscript:
-# in c:/Inetpub/wwwroot/Rpad/.RpadStartup.R,
-# uncommented the following line:
-#
-graphoptions(type="Rpng")
-
-# In c:/Inetpub/wwwroot/Rpad/.RpadStartup.R, uncommented
-# the following lines to properly specify the location for graphs.
-#
-## NOTE: This step shouldn't be needed anymore! It should figure it out right,
-## but I left it in so you can try it if things don't work right.
-assign("RpadDir", envir = Rpad:::.RpadEnv,
- gsub("c:/Inetpub/wwwroot","", getwd(), ignore.case = TRUE) )
-
-I didn't know how to disable caching on the pages served from Rpad/server*.
-
-As with apache, you need to lock down the file permissions. Google
-for IIS and IUSR. Also look for "IIS Lockdown Tool".
-</pre>
-
<h2>Troubleshouting server installations</h2>
<p>Look for directories named /var/www/Rpad/server/dd??????????/
@@ -355,13 +215,17 @@
<p>If graphics appear locally but not on remote machines, it indicates
a problem with finding the URL for the graphics files. You may have to
-modify the Rpad/.RpadStartup.R to explicitly tell R where to find
+modify the Rpad/RpadStartup.R to explicitly tell R where to find
the graphics files, like:</p>
assign("RpadDir", envir = Rpad:::.RpadEnv,
gsub("c:/Inetpub/wwwroot","", getwd(), ignore.case = TRUE) )
-<br><br><br><sub>by Tom Short, tshort at epri.com, Copyright 2005. EPRI, license: GNU GPL v2 or greater</sub>
+<br><br><br>
+<sub>Original author:</sub>
+<sub>by Tom Short, tshort at epri.com, Copyright 2005. EPRI, license: GNU GPL v2 or greater</sub>
+<sub>Last updated 2014-01-01 by Jeffrey Dick.</sub>
+
</body>
</html>
Added: pkg/Rpad/inst/basehtml/index.html
===================================================================
--- pkg/Rpad/inst/basehtml/index.html (rev 0)
+++ pkg/Rpad/inst/basehtml/index.html 2014-01-02 15:39:42 UTC (rev 3)
@@ -0,0 +1,174 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<html>
+<!--
+by Tom Short, EPRI, tshort at epri.com
+(c) Copyright 2005 by EPRI
+license: GNU GPL v2 or greater
+-->
+
+<!--
+modified by Jeffrey Dick December 2013:
+update code for current Dojo implementation,
+clean up help links and add link to DojoTest.Rpad
+-->
+
+
+<head>
+ <title>Rpad Base Page</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <script type="text/javascript">
+ rpadConfig = {
+ rpadRun: "all",
+ rpadHideSource: true
+ };
+ </script>
+ <!-- the Rpad head section -->
+ <script src="Rpad_head.js"></script>
+</head>
+
+<style>
+.RpadTableHolder TH {padding: 5px; background: transparent;
+ text-align:right; font-weight:bold;
+ border: thin none #CCC; }
+.RpadTableHolder TD {padding: 5px; background: transparent;
+ text-align:right; padding:2px 2px 2px 2px;
+ border: thin none #CCC; }
+
+</style>
+
+ <body>
+<!-- the Rpad body section -->
+<script src="Rpad_body.js"></script>
+
+
+<table width="100%"><tr valign="top"><td width="70%">
+<p>Rpad/HTML pages in working directory (click on the link to load the file): </p>
+
+<!--
+<p><span contenteditable="false">
+<a href="blank.Rpad">New Rpad page</a></span><br></p>
+-->
+
+<div data-dojo-type="Rpad">
+<pre>
+.threecolumns = function(lst) {
+ n = length(lst)
+ if (n <= 3) return(as.matrix(lst))
+ ncol = 3
+ nrow = ceiling(n / ncol)
+ lst = as.matrix(append(lst, rep("", ncol * nrow - n)))
+ dim(lst) = c(nrow, ncol)
+ lst
+}
+.rpadfiles = grep('\\.html$|\\.rpad$', dir(), ignore.case = TRUE, value = TRUE)
+.rpadfiles = H("a", href = .rpadfiles, collapseContents = FALSE,
+ .rpadfiles)
+.rpadfiles = .threecolumns(.rpadfiles)
+HTMLon()
+Html(.rpadfiles)
+</pre>
+</div>
+
+<!--
+<p>*.Rdata R binary files (click to load into R): </p>
+<div data-dojo-type="Rpad">
+<pre>
+.files = grep('\\.RData$', dir(), ignore.case = TRUE, value = TRUE)
+.files = H("a", href = paste('javascript:rpad.send("R", "load(\\\\"',
+ .files,
+ '\\\\")")', sep = ""),
+ collapseContents = FALSE,
+ .files)
+.files = .threecolumns(.files)
+HTMLon()
+Html(.files)
+</pre>
+</div>
+-->
+
+<!--
+<p>*.R files (click to source into R): </p>
+<div data-dojo-type="Rpad">
+<pre>
+.files = grep('\\.R$', dir(), ignore.case = TRUE, value = TRUE)
+.files = H("a", href = paste('javascript:rpad.send("R", "source(\\\\"',
+ .files,
+ '\\\\")")', sep = ""),
+ collapseContents = FALSE,
+ .files)
+.files = .threecolumns(.files)
+HTMLon()
+Html(.files)
+</pre>
+</div>
+-->
+
+<p>Objects in user's workspace:</p>
+<div data-dojo-type="Rpad">
+<pre>
+# print(ls.str(), wid = 40, nchar.max = 20, vec.len=2)
+ls()
+</pre>
+</div>
+
+<p>Enter R code here and press
+<input onclick='javascript:rpad.calculatePage()' value='Calculate' type='button'></input>
+or F9 to run it:
+</p>
+<div data-dojo-type="Rpad" rpadRun="normal" rpadHideSource=false>
+ <textarea rows="4" cols="60">
+g1 <- "Hello World!"
+print(g1)
+g2 <- paste(sample(strsplit(g1, "")[[1]]), collapse="")
+print(g2)
+ </textarea>
+</div>
+
+<p>The date and time:</p>
+<div data-dojo-type="Rpad" rpadRun="all">
+<pre>
+date()
+</pre>
+</div>
+
+
+</td><td> </td> <td width="25%">
+<p>Help</p>
+
+<span contenteditable="false">
+<a href="BasicDocumentation.html">Rpad documentation</a><br>
+<a href="ServerNotes.html">Server notes</a><br>
+</span>
+
+<p>Rpad Demos</p>
+
+<span contenteditable="false">
+<a href="Example1.Rpad">General Example</a><br>
+<a href="InputExamples.Rpad">Input Examples</a><br>
+<a href="DojoTest.html">Dojo Test Page</a><br>
+<a href="RpadTest.Rpad">Rpad Test Page</a><br>
+</span>
+
+<p>Links</p>
+
+<span contenteditable="false">
+<a href="http://cran.r-project.org/doc/contrib/Short-refcard.pdf">Tom Short's R refcard</a><br>
+<a href="http://cran.r-project.org/doc/contrib/Baggott-refcard-v2.pdf">Matt Baggot's R refcard v2</a><br>
+<a href="http://cran.r-project.org/doc/contrib/Liu-R-refcard.pdf">Liu's R refcard</a><br>
+<a href="http://rpad.r-forge.r-project.org">Rpad homepage</a><br>
+<a href="http://www.r-project.org">R homepage</a><br>
+</span>
+
+
+
+</td></tr></table>
+
+<br><br><br>
+<sub>The original author of Rpad is:</sub>
+<br>
+<sub>Tom Short, tshort at epri.com, Copyright 2005. EPRI, license: GNU GPL v2 or greater</sub>
+<br>
+<sub>To contact the current maintainer, see the DESCRIPTION file</sub>
+ </body>
+</html>
+
Added: pkg/Rpad/inst/basehtml/server/R_process.pl
===================================================================
--- pkg/Rpad/inst/basehtml/server/R_process.pl (rev 0)
+++ pkg/Rpad/inst/basehtml/server/R_process.pl 2014-01-02 15:39:42 UTC (rev 3)
@@ -0,0 +1,176 @@
+#!/usr/bin/perl -w
+#!c:/apps/perl/bin/perl.exe
+
+# The following line is a test script to see if it works.
+# http://localhost/Rpad/server/R_process.pl?&ID=/tmp/ddNTlmHSvWZF&command=R_commands&R_commands=print('hello')
+
+use strict;
+use warnings;
+
+use Statistics::R;
+use Linux::Inotify2;
+use File::Path qw(remove_tree);
[TRUNCATED]
To get the complete diff run:
svnlook diff /svnroot/rpad -r 3
More information about the Rpad-commits
mailing list