How to set proxy in R ( ubuntu) - r

Gaurav Pandey
I used the command
Sys.setenv(http_proxy="http://myusername:pswd#host:port")
and it worked at first.
But on restarting It in the Terminal it showed the following error.-
cannot open: HTTP status was '407 Proxy Authentication Required
How to resolve this issue.Help,,,

You set the environment for the process running R. When the instance of R exits, the process goes away, and the environment is gone.
You cannot set the environment for a parent process.
Put these commands in /etc/profile or ~/.bash_profile instead:
export http_proxy
http_proxy=http://myusername:pswd#host:port
Or all on one line (for bash):
export http_proxy=http://myusername:pswd#host:port
Or run the commands in the shell before starting R.

Related

Error that says Rscript is not recognized as an internal or external command, operable program or batch file [duplicate]

shell_exec("Rscript C:\R\R-3.2.2\bin\code.R ");
This is the call to script.On calling the above script, the error occurs.
I am trying to call my R script from the above path but no output is being shown. While checking the error logs of PHP, it says 'Rscript' is not recognized as an internal or external command, operable program or batch file.' The script is working fine on the Rstudio but not running on the command line.
Add the Rscript path to your environment variables in Windows:
Go to Control Panel\System and Security\System and click Advanced System Settings, then environment variables, click on path in the lower box, edit, add "C:\R\R-3.2.2\bin"
Restart everything. Should be good to go. Then you should be able to do
exec('Rscript PATH/TO/my_code.R')
instead of typing the full path to Rscript. Won't need the path to your my_code.R script if your php file is in the same directory.
You need to set the proper path where your RScript.exe program is located.
exec ("\"C:\\R\\R-3.2.2\\bin\\Rscript.exe\"
C:\\My_work\\R_scripts\\my_code.R my_args";
#my_args only needed if you script take `args`as input to run
other way is you declare header in your r script (my_code.r)
#!/usr/bin/Rscript
and call it from command line
./my_code.r
If you are running it in Git Bash terminal, you could follow a revised version of the idea suggested by #user5249203: in the first line of your file my_code.R, type the following
#!/c/R/R-3.2.2/bin/Rscript.exe
I assumed that your path to Rscript.exe is the one listed above C:\R\R-3.2.2\bin. For anyone having a different path to Rscript.exe in Windows, just modify the path-to-Rscript accordingly. After this modification of your R code, you could run it in the Git Bash terminal using path-to-the-code/mycode.R. I have tested it on my pc.
I faced the same problem while using r the first time in VS Code, just after installing the language package (CRAN).
I restart the application and everything worked perfectly. I think restarting would work for you as well.

Correct usage of jupyter CLI parameter?

Disclaimer: I use jupyter kernel, but the question is also relevant for jupyter notebook.
According to jupyter kernel --help-all, I should be able to change the jupyter kernel JSON connection file by setting a parameter called --KernelManager.connection_file.
If I understand this correctly, that means that the following command:
jupyter kernel --KernelManager.connection_file=connection.json
should start a kernel and give me a connection file called connection.json.
However, this is what I get:
→ jupyter kernel --KernelManager.connection_file='test-this-thing.json'
[KernelApp] Starting kernel 'python3'
[KernelApp] Connection file: /Users/me/Library/Jupyter/runtime/kernel-1e65d0fe-bf8e-1234-8208-463bd4a1234a.json
Now, jupyter doesn't complain that I've passed a wrong argument nor anything, it just doesn't change the connection file.
Am I doing something wrong? How can I correctly change the connection filename?
Essentially, nothing you are doing in the above code is wrong. Previously the kernel overrode whatever you set as the connection file with a hard coded file location.
This has now been fixed as per the following pull requests:
https://github.com/jupyter/jupyter_client/pull/399
Removed the static connection file name declaration on kernelapp initialize method.
https://github.com/jupyter/jupyter_client/pull/432
Set the default connection_file such that it preserves an existing configuration.
I useful workaround to set the connection file is to not call jupyter kernel directly, but rather use the kernel manager module, which is more flexible:
python -m ipykernel_launcher -f ~/kernels/file.json
The above works for current and previous versions of jupyter, so I'd consider it to be more reliable.

Nuclide remotee development setup with anaconda on the server side

I am using nuclide and nuclide-server for remote development for Python. However, the anaconda / virtualenv envirionment is on the server side. How do I make sure that I am inside the anaconda / virtualenv environment?
For example, do I need to do this:
source activiate ...blah...
start the nuclide-server inside the virtualenv
so that I can make sure that the nuclide-server is inside my desired virtualenv?
I suggest creating a shell script on your remote server that should consist of:
initialization of your environment
any other preparation
and finally running the nuclide-start-server command
After your script is done, it should be somewhere in your $PATH so you could fill the script's name in the Remote Server Command field as shown in the .

Jar file run on a server background with close putty session

I have tried the run spring boot jar file using putty. but the problem is after closed the putty session service was stopped.
then i tried up the jar file with following command. its working fine .
**nohup java -jar /web/server.jar **
You should avoid using nohup as it will just disassociate your terminal and the process. Instead, use the following command to run your process as a service.
sudo ln -s /path/to/your-spring-boot-app.jar /etc/init.d/your-spring-boot-app
This command creates a symbolic link to your JAR file. Which then, you can run as a service using the command sudo service your-spring-boot-app start. This will write console log to /var/log/your-spring-boot-app.log
Moreover, you can configure spring-boot/application.properties to write console logs at your specified location using logging.path=path-to-your-log-directoryor logging.file=path-to-your-log-file.txt. Also, it may be worth noting that logging.file takes priority over logging.path

Unable to run sqlplus commands from jenkins

I have a shell script at Unix Server which contain sqlplus commands to do some validation.and I can run script using putty and see required result.In Unix server I have set up Oracle path and Library path in .bash_profile file. So when I start putty , it get loaded and can understand sqlplus command.
Now Challenge is
when I call that shell script from Jenkins(Windows node) then I get error "sqlplus command not found". Here I call .bash_profile file first then my shell script which have sqlplus commands.
Please help.
Set up the PATH as an environment variable in your Jenkins job definition. More details here:
How to set up environment variables in Jenkins

Resources