so I've just begun using Visual Studio 2012 as a new programmer, and I'd like to find a way to have VS2012 automatically save (or at least automatically convert) files to UNIX line endings.
I found this page as a means of creating an executable that could be integrated with VS2010 as a macro. Since VS2012 no longer uses macros, how can I set this up so that this is executed on my files at save? I don't want to have to go to Advanced Save everytime I save a file (I tend to save every 30 seconds or so out of paranoia).
I began trying to construct an add in to handle this for me, but as a beginner I'm afraid that's a bit beyond me.
Thank you in advance for the help.
you can do like this,
click File, choose Save .... as, then in the save file dialog, choose save with Encoding, another dialog shows up, you can choose Unix format.
Related
I had a R script open in RStudio. The file was saved many times over the course of several weeks and worked perfectly fine when RStudio was opened and closed. However, today, I restarted my computer and when I opened RStudio and more specifically the script that I mentioned, all of the R code vanished, leaving a single long row of "....." with red highlighting.
When I tried to open the R file in other text processors such as Sublime Text and Notepad++, only a line of zeroes was visible. None of my other R files were affected. I'm currently running Windows 8.1 and have the latest version of R and RStudio. What can I do to recover the code in the file and prevent something like this from happening again?
It might be an old thread and it might have been covered in 'user4458796' answer in suggestion #1 ("Use the history..."), but:
My friend had the same problem and we managed to recover the code from a 'history_database' files located on Windows at:
'C:\Users\%user%\AppData\Local\RStudio-Desktop\'
I assume there is an equivalent location in Linux in general.
Hopefully I won't get downvoted, just sharing my 2cents.
Ben.
It's not clear what happened to corrupt your file (and thus how to fix it if possible) and it is kind of ominous that you're just seeing 0's in other text editors, but I'll give you my best suggestion and some tips.
Suggestions for Attempting Recovery
Since your other R files were unaffected, you should have a messy record of your code in the history. Use the history to reconstruct your code.
Access a copy of your file from any version control, cloud, or offline backup you may have used -- git, SVN, iCloud, SugarSync, Dropbox, etc (I realize you probably wouldn't have posted this question if that were an option, but I had to throw it out there).
Use a Hex or sector editor to try to recover the data.
Use a data recover program to find an old version of your file.
Inspect your trash or recycling bin to see if it has an old version. Depending on your OS and the settings of how you (insecurely or securely) delete files, then you may be able to undelete a deleted version, even if it's not immediately available.
Try different methods of recovering text data from corrupted text files like OpenOffice's and Microsoft's suggestions.
Tips for the Future
I know that hindsight is 20/20, but a few quick tips for good measure:
Use version control. Git is supported in RStudio's GUI interface.
Have more than one version of your file. Many professors and professionals recommend writing/storing code in a text editor and using your IDE only for the working copy.
Make backups. Distinct from #2, you should backup your files to a hard drive, flash drive, or cloud service like Dropbox or Spideroak.
I am developing a webpage and every time I hit save all it brings up this save dialog. It has does this every time and I have rebuilt this page three times trying to get it to stop. What is causing it and how can I correct this unexpected event.
This typically occurs when opening the visual studio project as a web application or web site that never had the solution file created. By default the visual studio wants to have a solution file with it. Until you click "save" it will keep bothering you. Once you tell it "save" it will not bother you anymore and there is no harm in have the project associated to a solution file.
I Apologize if this question has already been asked. i can't seem to find it anywhere if it has.
I have a custom build script use to syntax check some php files and upload them to a server, and this is executed as a part of the build process. since this script is used to parse inline php statements (embedded in objective c blocks using macros) it's fairly critical this script happens on each build. the actual execution is working fine, i'd just also like to be able to open a particular file when there is an error, and locate the cursor in the approximate location.
i have found that since xcode is configured on my system to open .php files by default (not sure if that's the norm or if i did it manually at some point), using
open filename.php
in a shell script opens the file.
i'd like to be able to specify the line number too.
eg something along the lines of
open filename.php --args --jump-to-line 1234
(--args is a switch for "open" meaning pass the arguments on to Xcode)
any ideas?
You can use the xed command. Only works for Xcode 3 though, not other editors. For Xcode 4, try this
See man xed
This is a bit of a strange question, but I thought people here might be interested.
Is it possible to have R cause a file to be opened in another program? For example, could you write a command line that would cause a music file to start playing? The potential application would be that after a model is finished running, music would start to play, alerting you to the model's completion.
In addition to system, on Windows at least you can use shell.exec which will open the file using the application specified in the Windows file associations. For example, shell.exec("file.txt") will open a text file in your favourite text editor, shell.exec("file.mp3") will launch a media player, etc.
There is audio package which allow to play wave files:
require(audio)
wave_file <- dir("C:/Windows/Media", pattern="\\.wav$", full.names=TRUE)[1] # some random windows wave file
f <- load.wave(wave_file)
play(f)
You can do this by calling the system() function.
we're developing an app that should be able to open specified file with default editor application. (so if it is .doc - it suppose to be opened by MSWord or openOffice)
But I also need to wait until user will close the editor, check if it was changed (by size and date), and upload it to the server.
So the following steps:
1) find def editor
2) open file
3) wait it be closed
4) do smth after that with the file.
now results of my research:
-> opening by def editor is simple: file.openWithDefaultApplication();
but there is no way to know that editor is closed (maybe by checking that file is not locked in timer???)
-> i can start the native process and pass file as parameter BUT looks like the code
NativeApplication.nativeApplication.getDefaultApplication(file.extension);
does not work for any extension :( - it doesnt work for "rtf", "doc" but works for "pdf"... and [file.openWithDefaultApplication()] works fine with any file!
any suggestions?
thx in advance!
but there is no way to know that
editor is closed
Correct. I do not believe what you want to do is possible with AIR. How would AIR be able to tell whether the file is open or not? You might want to look into using NativeProcess; but that would be reliant on the underlying OS/default program exposing APIs to let you know when the program was open and/or closed.
My only suggestion is that you don't have the Air application watch the file, but instead show a popup that say 'click okay when done editing file' and then upload it based on that.
The only other way I can think of this working is if you create both a .bat and a .sh file
(for both windows and macs/linux; select one or the other depending on the os) which open the file you want through NativeProcess (and of course, put 'wait') and then listen for the close event.