Running R code via Rstudio on a remote server not by browser - r

Is there a way to use a local Rstudio installation on my machine which is actually running the code on a remote server where I can run distributed jobs via SLURM?
Can it be compatible with version control and dockers?

The remoter package does what you are wanting to do very well. You start R on the remote server and run remoter :: server(showmsg=TRUE). Then in you local RStudio you run
remoter :: client (). Works fairly flawlessly.
My main issue is that when you run help it comes from the remote session in the console rather than the help window.
https://cran.r-project.org/web/packages/remoter/vignettes/remoter.pdf

Related

problem with kernel creation in vscode while connected to remote jupyter server?

I am trying to connect to remote jupyter server which is running in remote server inside a docker. from vs code (local machine) with the help of jupyter extension, and running a newly created notebook.
The problem seems to be the kernel creation via this method for this newly created notebook.
My Jupyter Server is running in remote server, inside a docker environment, with port forwarding enable.
I can access it via my browser by http://{remote_machine_ip}:{port}/, and I am able to create new jupyter notebook.
However when I use the vs code to open local notebook file, and connect to the remote jupyter server.
When I try to run the cells, it shows the following error:
Failed to start the Kernel.
'_xsrf' argument missing from POST.
View Jupyter log for further details.
Possible solution
However, if I try to open a new kernel in browser, and connect it to same kernel in vs code, the problem goes away.
This issue seems to be arising when vs code sends the request to create jupyter kernel to the jupyter server.
As, when I tested with already running jupyter kernel in vs code, it works fine.
The issue here is, security implementation of jupyter server, which don't allow cross site request to create a kernel, as it security vulnerability.
For more details about _xsrf token, you can read here, although it doesn't talk about specific to jupyter server, its very easy to deduce the logic.
In one post of jetbrains, I found the solution, to make jupyter ignore _xsrf token, by adding new flag while starting the jupyter server,
--NotebookApp.disable_check_xsrf=True
Or add it to your notebook config.
Also, to make sure your request are not been blocked, as suggested by vscode blog. Add the following flag too,
--NotebookApp.allow_origin='*'

Problem using readClipboard() in Shiny app deployed to shinyapps.io

I have created a Shiny App that relies on reading data directly from the user's clipboard. This Shiny app works perfectly when running on my local machine; however when I deploy the app to shinyapps.io I get the following error:
Warning: Error in readClipboard: could not find function "readClipboard"
This question was raised before but didn't receive an answer: Paste from client's clipboard on Shiny Server
My hunch is that I'll probably need to incorporate some javascript function which allows the web browser to read the user's clipboard...but I have zero idea where to start on that :-(
Has anyone achieved this functionality before in a Shiny App deployed to shinyapps.io?
This is likely because shinyapps.io runs in a Linux server, and readClipboard()only works on Windows OS. So I am assuming that you are running locally on a Windows machine.
You could try the package clipr.
I never tried myself, but I read that it works on Linux.
From the site where I read about the package
Note that on Linux, you will need to install the system requirement, either xclip or xsel. This can be done using for example apt-get install xclip.
I have an app running on a Linux server, and I use the following statement to be able to test it in Windows (in my case is access to a database that is different between systems)
if (tolower(Sys.info()['sysname']) == "linux") {
# Linux code here
} else {
# Windows code here
}

Point RStudio to remote R instance

I would like to have RStudio running on my local machine (os x) and the R executable on a remote computer.
I'm aware that I could run RStudio Server on the remote machine and connect to it using a web interface, however I abhor using web interfaces for things like this due to the delays and limited ability to move windows and use shortcuts.
Since RStudio isn't stand alone but points to an R executable elsewhere on the local machine (in a location that can be varied), it seems like in theory this pointer could be to a remote location. (Is there some reason this is incorrect?)
How might I accomplish this?

Running java based webdriver scripts in unix server

I have written webdriver+TestNG scripts in windows using java. Now there is an upcoming requirement to run the same scripts in UNIX server without much of code modification. I have heard about running tests in headless browser, but I dont know about this much. I searched a lot but there is no clear and simple response to start looking into this.
Is it possible to just change the driver instance to htmlunitdriver and run the same in unix environment? How could I create the tests as a package and move to unix environment for running the scripts?
You can run your existing script by making few changes in driver instance creation. Suppose you are using Firefox driver for your test, then you can run your script in headless mode using virtual display Xvfb (Xvfb is an X server that can run on machines with no display hardware and no physical input devices).
Below are the steps to run your tests in headless mode:
Install Xvfb
Start the Xvfb by executing this command Xvfb :99 -screen 0 1024x768x24 & Xvfb Manual
Then create a Firefox driver instance that uses virtual display started in step 2 as below:
FirefoxBinary fb = new FirefoxBinary();
fb.setEnvironmentProperty("DISPLAY", ":99");
WebDriver driver = new FirefoxDriver(fb,null);
Now your script will run in headless mode. You may need to change few other things like path of your test data or any other references that uses windows file system (like C:\)

RStudio locally + R cloudly

Is there any way to run RStudio locally on my machine but using a remote machine running R as engine instead of my local R install?
To be clear I know that there's the possibility to use RStudio server with a web GUI but I am asking something different. I want to use both my local RStudio app connected to a remote machine running R (possibly through ssh).
Is it possible?
The High Performance Computing Task View may be of some assistance. Unfortunately, I haven't found an easy way to do this and instead simply forward a local RStudio instance on our Linux cluster over X using SSH. You'll need XQuartz if you're on OS X.
I suppose that RStudio Server is probably a better way of doing this. You can easily tie in the RStudio authentication to PAM on your Linux server to authenticate.
ssh -X user#server.com rstudio

Resources