Pathway to directory lost in R studio - rstudio

I am relatively new to R studio, I am attempting to import a .RNK file to run on GSEA. However, the pathway to my working directory is lost and I keep receiving a file, "rt" warning message.
When comparing my working directory with my usual windows explorer file, the files themselves are absent from the working directory.
I have attempted to change the Default text encoding to UTF-8 but this has had no effect. I would be grateful for any suggestions to help with this problem?

That is a very common problem!
You have four options to select the correct file and path! Hope at least one can work well.
Manually without code, you can go to the top and choose Session->Set Working Directory -> Choose Directory... and then select the file.
You can just use the function file. choose() and look for the file on your computer and select it.
You can look for the file path on your computer and write it in R. Look in the local search engine for your computer and search for the file. For example: setwd("~/Desktop/University/Homework")
You can use getwd() in the console to know where the script is working and saving the files and then look for the files there!
PD: the best way to work in R and R-Studio/Posit for me is by creating a project. Doing so, you will have everything related to the script in one folder (new and old files!). It is similar to setwd()but better!

Related

macOS: QFileIconProvider icon(QFileInfo) get icons for non-existent files

I'm trying to implement a file explorer that will display a list of remote files(stored on another network server). And I use QFileIconProvider.icon(QFileInfo) to get the file icon.
The QFileInfo is constructed from a single filename(no path information):
for example: QFileInfo fi("test.jpg");
and that works on both Windows and Linux(I tested it on a Ubuntu machine), but it doesn't work on the macOS. On macOS, I always get the warning
Path given to -[NSWorkspace iconForFile:] is not a full path.
I have checked the solution here: Qt 4.8 - QFileIconProvider, Getting icon for non-existent file (based on extension), but it's for the Windows platform.
I was able to make it work if I created a temporary file on my working directory with the same remote filename. But the temporary needs to be kept. If I deleted the temporary file after calling QFileIconProvider::Icon, I will get the warning above when the QTableView tries to display the QIcon in the UI.
Is there any working solution for my case?
Thanks all.
Since there is no "correctly" solution, I just make a workaround:
Create a temporary file for each file extension, and keep them here, only delete these temporary files when you ensure you don't need them anymore. (I choose to delete them before my app quit.
At least, it works for me.
Thanks!

The visual studio F# interactive window keeps not opening in current directory

So I want to work a little bit in the interactive window in visual studio, to take a look at some F#.
Now View>other windows>F# interactive
In order to load my file I then type
>#load "Distance.fs";;
It is important to mention that Distance.fs is the current file that I am standing on.
however now, I get this error:
It looks like it keeps looking in the wrong directory, and it keeps doing this across different files and projects. Why does this happen? Is there any way I can configure VS to always open the interactive windows on the currently open directory
FSI defaults its current directory to whatever %TEMP% is and just needs a little help. Create a scratch script (as #TheQuickBrownFox suggested), and put your #load statement in there. Above that, add
open System
Environment.CurrentDirectory <- __SOURCE_DIRECTORY__
Highlight those two lines and press Alt-Enter to tell FSI to change to the script's current directory, then your #load statement should work (if needed, adjust your path, for example if you create a separate scripts folder, then maybe you now need #load "../Distance.fs", etc.

How to manage files with a batchscript via "Send To"?

I want to improve my file managent and need some help to get started.
For this specific script, my idea is the following:
while in Explorer
rightclick a file -> Send To -> "Apps[.bat]"
Then the script starts and does the following:
moves the whole directory (and subfolders) of the selected file to a specified location (in my case C:\Users\Name\Desktop\Apps\Files)
so sending Name\Downloads\Coolportableapplication\Coolapp.exe to the batch results in Name\Desktop\Apps\Files\Coolportableapplication\Coolapp.exe
creates a shortcut of C:\Users\Name\Desktop\Apps\Files\Coolportableapplication\Coolapp.exe in C:\Users\Name\Desktop\Apps
Is this generally possible with a batchscript?
This isn't my first batch but I've never dealt with unspecified files and English isn't my native language so I couldn't really find anything useful for my cause, though I am sure my little script won't be too much of a problem for you. Based on that batch, I want to create similar scripts but I just have no idea how to begin with that one.
Thanks a lot!
No need for a batch file but anyway.
1: Type shell:sendto into your explorer window and copy the shortcut to your directory "C:\Users\Name\Desktop\Apps\Files". This directory will now show as default in your Send To options.

Opening a CHM file produces: "navigation to the webpage was canceled"

I am trying to open a .chm file.
I downloaded the source, extracted it, and double clicked on Waffle.chm and clicked "Open" but no matter what element in the chm file I click, I get the message:
Navigation to the webpage was canceled.
What you can try:
Retype the address.
What's going on here?
Summary
Microsoft Security Updates 896358 & 840315 block display of CHM file contents when opened from a network drive (or a UNC path). This is Windows' attempt to stop attack vectors for viruses/malware from infecting your computer and has blocked out the .chm file that draw data over the "InfoTech" protocol, which this chm file uses.
Microsoft's summary of the problem: http://support.microsoft.com/kb/896054
Solutions
If you are using Windows Server 2008, Windows 7, windows has created a quick fix. Right click the chm file, and you will get the "yourfile.chm Properties" dialog box, at the bottom, a button called "Unblock" appears. Click Unblock and press OK, and try to open the chm file again, it works correctly. This option is not available for earlier versions of Windows before WindowsXP (SP3).
Solve the problem by moving your chm file OFF the network drive. You may be unaware you are using a network drive, double check now: Right click your .chm file, click properties and look at the "location" field. If it starts with two backslashes like this: \\epicserver\blah\, then you are using a networked drive. So to fix it, Copy the chm file, and paste it into a local drive, like C:\ or E:. Then try to reopen the chm file, windows does not freak out.
Last resort, if you can't copy/move the file off the networked drive. If you must open it where it sits, and you are using a lesser version of windows like XP, Vista, ME or other, you will have to manually tell Windows not to freak out over this .chm file. HHReg (HTML Help Registration Utility) Utility Automates this Task. Basically you download the HHReg utility, load your .chm file, press OK, and it will create the necessary registry keys to tell Windows not to block it. For more info: http://www.winhelponline.com/blog/fix-cannot-view-chm-files-network-xp-2003-vista/
Windows 8 or 10? --> Upgrade to Windows XP.
"unblocking" the file fixes the problem. Screenshot:
Win 8 x64:
just move it to another folder or rename your folder (in my case: my folder was "c#").
avoid to use symbol on folder name. name it with letter.
done.
In addition to Eric Leschinski's answer, and because this is stackoverflow, a programmatical solution:
Windows uses hidden file forks to mark content as "downloaded". Truncating these unblocks the file. The name of the stream used for CHM's is "Zone.Identifier". One can access streams by appending :streamname when opening the file. (keep backups the first time, in case your RTL messes that up!)
In Delphi it would look like this:
var f : file;
begin
writeln('unblocking ',s);
assignfile(f,'some.chm:Zone.Identifier');
rewrite(f,1);
truncate(f);
closefile(f);
end;
I'm told that on non forked filesystems (like FAT32) there are hidden files, but I haven't gotten to the bottom of that yet.
P.s. Delphi's DeleteFile() should also recognize forks.
The definitive solution is to allow the InfoTech protocol to work in the intranet zone.
Add the following value to the registry and the problem should be solved:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\HTMLHelp\1.x\ItssRestrictions]
"MaxAllowedZone"=dword:00000001
More info here: http://support.microsoft.com/kb/896054
Go to Start
Type regsvr32 hhctrl.ocx
You should get a success message like:
" DllRegisterServer in hhctrl.ocx succeeded "
Now try to open your CHM file again.
other way is to use different third party software. This link shows more third party software to view chm files...
I tried with SumatraPDF and it work fine.
I fixed this programmatically in my software, using C++ Builder.
Before I assign the CHM help file, Application->HelpFile = HelpFileName, I check to see if it contains the "Zone.Identifier" stream, and when it does, I simply remove it.
String ZIStream(HelpFileName + ":Zone.Identifier") ;
if (FileExists(ZIStream))
{ DeleteFile(ZIStream) ; }
There are apparently different levels of authentication. Most articles I read tell you to set the MaxAllowedZone to '1' which means that local machine zone and intranet zone are allowed but '4' allows access for 'all' zones.
For more info, read this article:
https://support.microsoft.com/en-us/kb/892675
This is how my registry looks (I wasn't sure it would work with the wild cards but it seems to work for me):
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\HTMLHelp]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\HTMLHelp\1.x]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\HTMLHelp\1.x\ItssRestrictions]
"MaxAllowedZone"=dword:00000004
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\HTMLHelp\1.x\ItssRestrictions]
"UrlAllowList"="\\\\<network_path_root>;\\\\<network_path_root>\*;\\ies-inc.local;http://www.*;http://*;https://www.*;https://*;"
As an additional note, weirdly the "UrlAllowList" key was required to make this work on another PC but not my test one. It's probably not required at all but when I added it, it fixed the problem. The user may have not closed the original file or something like that. So just a consideration. I suggest try the least and test it, then add if needed. Once you confirm, you can deploy if needed. Good Luck!
Edit: P.S. Another method that worked was mapping the path to the network locally by using mklink /d (symbolic linking in Windows 7 or newer) but mapping a network drive letter (Z: for testing) did not work. Just food for thought and I did not have to 'Unblock' any files. Also the accepted 'Solution' did not resolve the issue for me.
Moving to local folder is the quickest solution, nothing else worked for me esp because I was not admin on my system (can't edit registery etc), which is a typical case in a work environment.
Create a folder in C:\help drive, lets call it help and copy the files there and open.
Do not copy to mydocuments or anywhere else, those locations are usually on network drive in office setup and will not work.

Can Notepad++ automatically upload local files to the server when I save?

I use Notepad++ with its NppFTP plugin. I am required to keep local copies up to date, so I edit the local files then upload them to the server. I'm wondering if there is a way for Notepad++ to automatically upload the file to the server as soon as I save it, without me having to press another button.
I'm open to using other FTP programs but I would rather stick with Notepad++ as the text editor
I know this question is slightly dated, but I would just like to put out there to alleviate future confusion for anyone who tries to find an answer to this question that as far as I know, NppFTP currently does this by default. There is a window beneath the main file view area that informs you of current FTP operations. Dreamweaver has started crapping out on me regularly so I had to find an equally powerful solution; it seems like Notepad++ just might be that!
Instead of trying to do this solely with Notepad++, I've gotten a similar workflow using Filezilla as well.
I set Notepad++ as my default text editor (Edit -> Settings -> File Editing -> Use Custom Editor) in Filezilla.
I can right-click on a local file (in Filezilla) and press "edit". Whenever I save the file in Notepad++, Filezilla detects the difference and prompts me to upload the file.
Will reply back to this post once I can get this process to be completely automatic.
Researching about same problem , i found from the Notepad++ Plugin Manager NppNetNote plugin. It allow you to edit both files at time (Local and remote) wich is like edit local and publish.
Edit: I'm sorry. Mistake. Now that plugin is called NppDocShare, and acts as server/client for a live document. You can edit a file from two locations (Notepad++ executions) at twice, but cannot edit two files nor emulates the autoupload.
I'd try the #Gabriel Ryan Nahmias and he's just RIGHT. The NppFTP plugin does that you wanna, but is a little tricky (obvious when you do) to configure.
By default, the program uses a variable path (Global cache: %CONFIGDIR%\Cache\%USERNAME%#%HOSTNAME%) to store the local copy that is uploaded at save. You need to create a pair folder when create a ftp CONNECTION PROFILE to say to NppFTP plugin how you wanna threat the file/connection. Otherwise, the ftp file goes to global.
Once the profile is created, i.e; C:\myfolder\ vs / (/ is relative to ftp) any file Edited or Created will be created/autouploaded to FTP at save. Also, you can open the FTP file, and it will be threated as the local one. Untill you save that, the real local file is not overwritten. If you dont like the file from FTP, simply close file and open from the local folder. So, you can chose which document wanna edit at start :)
Works Like Magic. Now im in love with Notepad++ :)
Extra: The subfolder creation is not magic. This only works from FTP to Local. You can edit a file from FTP subfolder and the folder plus file will be reproduced into local. No way to create from Local to FTP. You must create the ftp subfolder by hand :X (Unexpected)
You can manage files by two ways. Creating a profile per folder/proyect or create multiple local cache directories to a single profile. BUT, only the first one will be available (You will reorder it on each use). No magic here :( and it's more easy to create profiles and choose from the droplist at connect.
Anyway, i think the NppFTP is doing the things very well.
I had the same problem. Solved updating the NppFTP plugin to the latest stable version.
Cheers!

Resources