Ensuring RStudio always restarts in administrator mode - r

Sometimes I receive notifications that I am trying to updating already-loaded packages from RStudio and am prompted to choose if I want to restart R(Studio) or not. I've noticed that sometimes I will have write permission issues after this, despite having RStudio set to run as an administrator. My hunch is that this is because I have set the permissions for a specific shortcut (see below) and not for RStudio itself (if this even happens) -- accordingly when it restarts, it isn't restarting the same way as I ran the program in the first place and thus is not in administrator mode.
Am I correct that this can happen and, if so, is there some sore of way to consistently ensure it is run in administrator mode? I'm asking this on SO since I'm guessing there is probably a way within R or on the command line to ensure this, if it can indeed happen. I'm on a single-user Windows 10 machine.

Related

Rscript slave call doesn't exit properly

I have a Desktop Entry that calls a shiny app.
Here's my desktop entry
[Desktop Entry]
Type=Application
Comment=App
Name=App
Exec=/usr/bin/Rscript -e "shiny::runApp('~/raspberry_IP/app.R', launch.browser=TRUE)"
Icon=/home/path/to/logo/rpi_logo.png
Terminal=false
Categories=Utility
StartupNotify=true
This runs well and the Shiny application works as expected. However, when I close my browser tab, I see the process is still running.
I am running this application from Ubuntu 20.04 LTS.
If I change my terminal=false to terminal=true. I see that the output of my terminal freezes (the app no longer updates, hence no diagnostic printing). But the terminal is still active (which makes sense given the process is still running). I can CTRL+C out of it to kill it from my terminal, but that's not the desired user behavior.
I see some strategies to stop the app using stopApp() like here. This strategy uses a separate action button to kill the app, so the user has to "manually" stop it. This might work, but I believe it's natural for the user to try to close the tab or Browser (and there's no way for them to know the process is still running, unless they check).
Using this on the server side, does kill the process, but it's recommended against (see here).
session$onSessionEnded(stopApp)
In this case, because my app is running on a local machine, I think I could potentially get away with this (there is only one user at a time), but I was wondering whether there's better practice to implement.

Global variables not saved after executing R code

Recently I swapped my personal PC with admin rights to my employee's PC, where we use AD to log in and where I do not hold admin rights.
Since that event, I have trouble running my R code. I currently develop Shiny app. Each time I click "Run app", two things appear to behave differently versus my old setup.
First of all, I can run app only once - after that, the Rstudio is busy forever, suppressing me from running app again, accessing data frames created by my app and so on. So after each test of some changes, I literally have to reset entire RStudio.
Secondly, despite the fact that I have set my working directory to "C:/Users/mylogin/Documents", after restarting R, there are no global variables visible, event after saving workspace image. I used to use global variables to debug my app after closing it. Of course I can rewrite entire code to, for example, dump all the tables to different files.
My question is: is it possible, that this behavior is related to not having admin rights on my current PC? Or is it related to another issue and if so - may someone provide me some help in that matter? I have little to no knowledge about debugging Rstudio.
Setup: Win 10 64bit, R version 4.0.2 (2020-06-22) Rstudio desktop, 1.3.1093, Apricot Nasturtium.
For future generations: the problem perished, without any particular reason, quite frustrating that we will never know the answer.

RStudio Server on Microsoft Azure instance

I am currently running R on a Microsoft Azure instance (Ubuntu virtual machine) using RStudio as my IDE, to which I connect simply through my browser. I am trying to run some commands that take quite some time to complete from within RStudio and figured that I could simply close my tab with RStudio open and the process would keep running. However, when I try to reconnect to see how the process is doing, the page keeps loading but I am unable to see RStudio.
I have a few questions regarding running RStudio on a server:
First, am I correct in thinking that I can close my tab and keep the process running?
Second, is it normal behaviour that I am unable to connect to the server while the process is running?
Third, am I going about this the correct way or are there better ways?
Yes, you can close your tab and keep it running.
RStudio Server waits on updates from the R process to update the UI. This means that if you have a long-running computation, your tab may not fully reload until it's finished. You may also have seen this in the middle of a session: when R is busy, you can have problems saving scripts that are open in the editor pane.
Logging out in the middle of a computation should be safe, but be aware that RStudio will save your workspace and shut R down after a period of inactivity. It then reloads everything when you log back in. But this only extends to objects in memory; if you have any files saved in your temp directory, they'll have disappeared when you come back. They're probably still on the disk, but since your new R session has a new temp directory, you'll have to do a manual search for them.

InstallScript Reboot after multiple prequisites

My product uses an InstallScript 2014 project that has multiple prerequisites (PRQ). Sometimes one or more of these PRQs requires that the machine be rebooted. I have set the PRQ Editor Behavior tab to "Note it, fail to resume if the machine is rebooted, and reboot after the installation", and have set the return codes as 1641 and 3010, both of which indicate that a restart is required.
I interpret the Behavior setting to indicate that once ALL of the prerequisites have been installed and after MY application is installed that computer will be rebooted. However, this is not the case - the reboot never occurs.
Could it be that if PRQ #1 requests a reboot but PRQ does not, the "note" for a reboot is lost thus none occurs? This would certainly explain what I'm seeing. (The PRQ process is a black-box: There's no way to see what happens as it's running.)
If this is true, what other options do I have? Should I allow each PRQ to reboot as necessary, potentially aggravating my customers, or is there another way that I'm not seeing?
When the user runs the installer, I check if they are installed in the registry and ask the user if they would like to install them one by one if they are missing anything. If I decide that one needs a reboot, then I display the prompt to reboot the machine. It gives me complete control over how I handle the prereqs rather than using the PRQ system.

windeployqt.exe not working ? Application does not start

I have a simple application using
QT += core gui network webkitwidgets
I've used windeployqt.exe to generate the 32 bits release on my win-10 64 bit computer. When I put the folder on a win-7 64 Bit desktop and double-click the app.exe, it never starts.
I can see it in the task manager, but I can't kill it, and if I try I cannot close the explorer folder in which I double clicked anymore.
I've checked the usual platform, ICU, qwindows.dll, and so on.
http://doc.qt.io/qt-5/windows-deployment.html
EDIT Precisions:
I've compiled with default 32 Bit kit: "build-Test-Desktop_Qt_5_5_1_MinGW_32bit-Release" with "mingw492_32"
I have a package "release" generated by windeployqt.exe using the --webkit switch. I start a command prompt:
> set path=
> set mingw=
Then I make sure that no Qt/Mingw things exists anymore in my environment variables.
I also rename "c:\Qt" into "c:\ __Qt".
I move my release folder on my desktop.
I start release\test.exe ( from the clean path shell )
Everything runs fine! So The release/test.exe has everything it needs without the path/mingw variable.
But as soon as I put the folder on another windows machine ( 7 instead of 10 ) it never starts.
I tried dependency walker. It shows a lot of "API-MS-WIN*.dll" missing...
It even shows much more missing dlls on the "good" machine than on the bad one !!!
Every single "missing dll" on the "bad" target machine is actually in system32 on this machine.
Thanks for advice, every advice is welcome, I'm a bit desperate... :)
Edit
It seems to be related to the machine itself. I have successfully deployed this (very small) app to 2 non developer machine on win7 and win8 respectively. But the above "bad machine" still resits running it...
Edit
The problem seems not to be general but related to this one particular machine. Hence, feel free to close or move to the appropriate forum as it is not related to Qt/windeplyqt. If I figure out a solution, and question is closed, I'll simply add a last edit. Safe Boot and malwarebyte are my next actions.
After a long investigation.
Do not believe dependency walker, it used to be a top notch tool but it is now outdated.
If there is a missing dll, the system will prompt you with "cannot load dll xxx.dll" anyway.
Your best shot in case a soft runs on machine X but not on Machine Y is:
start in safe mode ( run: msconfig --> diagnostic startup )
turn off any antivirus or non microsoft/driver software,
"run as administrator".
If you can run with step 3. Then proceed by elimination:
run without admin rights,
Start anti spyware, etc...
Add appropriate exception to your antivirus if it is the root cause.
If the antivirus is not the root cause, run process monitor on both machines. Then compare, what Failed on one machine and not the other ? Read the windows event log and compare any error messages on both machines.
run sfc /scannow to check disk
run a complete anti spyware scan/ pc-repair tool ( malwarebytes, combofix, ... )
Make sure you really have the very same package on both machines, make sure you are not trying to run an exe on mac OS, make sure your computer is on.
Call the oracle, you are in the matrix...
In my case the problem was Avast and it was solved by adding appropriate exception.

Resources