Storing code in Google Drive/DropBox - eclipse

First I understand I should probably be using GitHub or some other online repository, but I would like to explore some of the concepts necessary for my method to work.
I would like to run a batch script/program every time I close Visual Studio, Eclipse, Notepad. Specifically, I would like to run a copy program to copy all of my source code that I generated with that program to a folder inside a Google Drive/Dropbox folder. That way I know it is saved to the cloud. this way I do not have to set up a special backup extension inside each Development enviornment.
Firstly is there a built in simple solution for doing the above? or Do I need to write a custom service that checks to see when those programs are closed? and if that is the way to go where should I look for an example of how to get started?
Thanks.

No, there is no simple built-in method that will backup the files that you want when you want it.
Instead you could simply point your work directories to your Gdrive or DropBox folders, and create a folder inside them for each.
Or you could create a task that copies the files every 10 minutes or however long.
But if you want it to run only when you exit the programs you specify: Yeah, you'll pretty much need to write a batch file for each of the programs you want to back up. Then call the batch file instead of the program.
startVS.bat
set DropBox=C:\Wherever\
start /wait "" "C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe"
xcopy /s /e /d /y "%userprofile%\Documents\Visual Studio 2008\Projects\*.*" "%DropBox%"
If you want to have the same icon, and for the batch file run minimized:
1) Open Windows Explorer, navigate to startVS.bat, right-click on it, and click Create Shortcut.
2) Right-click on startVS - ShortCut -> Click Rename and rename it Visual Studios, then press [ENTER].
3) Right-Click on the new Visual Studios -> Properties -> Change Icon -> Browse
4) Paste %ProgramFiles% (x86)\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe into the File Name box.
5) Click Open -> OK
6) Click Normal Window -> Minimized -> OK
7) Put a copy of Visual Studios (really named Visual Studios.lnk) where ever you want it, like in the Start menu.
If you are not running a 64 bit system, at step 4 paste %ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe into the File Name box.

I think instead of going for this approach, you can run your script on a timely basis - say every 15 min.
This appraise will have below advantages advantages:
Easy to implement
Tool Independent
Timely Backup
Re-Use
So I think your problem will be solved by this approach.

For Google Drive, I've been messing around with GoogleCL: (I'm on Linux/Crunchbang)
$ sudo apt-get install python-gdata
$ sudo apt-get install googleCL
This'll give you the 'google' command:
$ which google
$ man google
You can upload files:
$ google docs upload foo.txt
(seems to store it as 'foo')
And download it: (in my opinion, syntax is inconsistent)
$ google docs get --title foo
(it won't find foo.txt for some reason)
So far, I'm not that happy with it. I want to encrypt files and park them there,
but it seems to choke on them. I've tried uuencoding them so I can just upload
a text file, but have had inconsistent results on files that aren't all that big
(1.6 Mbytes). Maybe Google doesn't want to deal with files it can't get any search
results out of ? Anyway, maybe Dropbox is better; haven't tried it yet.

Related

Renaming files doesn't take effect in VScode while using WSL2

I have a very annoying problem in my VScode setup.
I'm using WSL as a terminal to work on my projects and occasionally, mistype the name of one of the folder or file that I'm working with.
For example:
I accidentally created the Mainheader.js file in layout folder (without the capitalized L) therefore, I decided to rename the folder with a capital L.
Now on my React app, any changes made to MainHeader.js file will not be reflected. I did update the related import.
So I decided to delete the entire folder and recreate it with MainHeader.js but this is what I end up with.
The file is there in my folder but when I click on it, I get
"Unable to open Mainheader.js - File not found"
So I try to create it then I get this error:
Unable to create file 'wsl\path]to\MainHeader.js' that already exists when overwrite flag is not set
Has anyone run into this type of behavior in WSL before? It's quite annoying because the only workaround I've found so far is to create a completely different folder with a different name...
Any help would be appreciated. I can't really work like this.
I've been having the same problem for the past 2 days. I presume its a permissions issue, but unfortunately I don't know how to permanently fix it.
I did find this work-around though:
Open a new VS Code window. (I'd recommend closing any VS Code window that had
your project directory open.)
Create a duplicate or copy the contents of the problem file so you don't lose
your code.
Delete the problem file.
Now create the file again using VS Code. Go to File > New Text File. Next paste
in your code.
Now save your new file. Go to File > Save As and save your new file with at the same path + filename + extension that was giving you problems previously. VS Code should allow you to save the new file without any issue.
Now you can open this new VS Code window to your project directory and you should be able to continuing accessing the file that was a problem before.
Basically we just deleted the problem file and then created it again from scratch in a new VS Code window.
Hope this work-around works for you!
EDIT 09/20/2022
Following Baza86's answer here solved the issue for me. Seems like it was a permissions issue of sorts, but if you use the Remote-WSL extension VS code can directly access the linux filesystem.
How to run VScode in sudo mode in WSL2?
You may need add the case option to you options in the wsl config. The default is set to off, however you can set this to off, dir or force.
Open your wsl.conf using sudo with any text editor while running window subsystem Linux. The config file resides in /etc/wsl.conf. This file is used to configure settings per-distribution for Linux distros running on WSL 1 or WSL 2.
My default config looked like this yours may be different:
[automount]
options = "metadata"
add
[automount]
options = "metadata,case=dir"
Here is the official Microsoft docs for Advanced settings configuration in WSL - https://learn.microsoft.com/en-us/windows/wsl/wsl-config

My vs code python path has 2 different paths showing? one in white and one in blue

I am realizing the hardest part in learning to code is knowing how to even ask the right questions..
ill try and word it as best i can. I also will attach a screenshot.
I am running code in the terminal through VS code... and there is just so many files being shown every time i run the code. There is white and blue text that seems like the same thing? It makes it hard for me to see whats going on. Is there anyway to shorten or completely remove it? it seems 100% useless for just running some basic code.
The
C:/Program Files (x86)/Microsoft Visual Studio/shared/python37_64/python.exe
Is the Absolute path of the python executable.
And the
C:/PythonProjects/vscode/...../helloworld_start.py
Is the absolute path of the file that you are running.
Simple it is running
python helloworld_start.py
If you want to reduce this. You can simply open a terminal and change the directory to the current working directory and simply run the above command. This will use the relative path to run the helloworld_start.py file
First you need to add python to the Environment variables and then Open the terminal uin VSCode using Ctrl + ` and then cd to the current working directory and run python helloworld_test.py

Install VSCode in a specific folder

I just downloaded the Visual Studio Code App from https://code.visualstudio.com/ and when I tried to install it, it simply just installed it by itself, without the option to change the installation path.
I have an external harddrive, which is where I want the IDE to be placed instead of the Local Harddrive. How can I change this?
On the VSCode download page select "System Installer" instead of "User Installer". The System installer will prompt you for the install location.
Full credit to Hans Passant for giving the following working solution as a comment.
The installer does very little beyond copying the files, it just creates some Explorer context menu shortcuts ("Open with Code"). Otherwise following Chromium conventions and copying itself to c:\Users\yourname\AppData\Local\Code\app-0.1.0 so it can update itself without you noticing. Boo. So high odds that simply moving that folder to the other drive works just fine, put it anywhere and create a shortcut to Code.exe. If you still want the context menu entry to work then use Regedit and search for "code\app-0.1.0".

Run command line when a document is saved in Visual Studio 2013?

I'm currently evaluating using VS2013 for a HTML5 project.
In this project I would like to be able to run a command line tool every time a file is saved (and have the file path passed as argument to the command line tool), and then have the output displayed in the console in VS. It's also important that this setup can be part of the project file, so that when a developer opens the project it's already setup correctly and ready to go without any additional configuring in VS.
In both Sublime Text and Webstorm projects all this is easy to achieve, but I haven't been able to find anything similar in Visual Studio. Any tips would be much appreciated!
You can set a DocumentSaved handler with Visual Commander and run a tool. See the "2. Run Cppcheck on the saved file and show results in the Output window" extension sample.

Open multiple Eclipse workspaces on the Mac

How can I open multiple Eclipse workspaces at the same time on the Mac?
On other platforms, I can just launch extra Eclipse instances, but the Mac will not let me open the same application twice. Is there a better way than keeping two copies of Eclipse?
This seems to be the supported native method in OS X:
cd /Applications/eclipse/
open -n Eclipse.app
Be sure to specify the ".app" version (directory); in OS X Mountain Lion erroneously using the symbolic link such as open -n eclipse, might get one GateKeeper stopping access:
"eclipse" can't be opened because it is from an unidentified developer.
Your security preferences allow installation of only apps from the Mac App Store and identified developers.
Even removing the extended attribute com.apple.quarantine does not fix that. Instead, simply using the ".app" version will rely on your previous consent, or prompt you once:
"Eclipse" is an application downloaded from the Internet. Are you sure you want to open it?
By far the best solution is the OSX Eclipse Launcher presented in http://torkild.resheim.no/2012/08/opening-multiple-eclipse-instances-on.html It can be downloaded in the Marketplace http://marketplace.eclipse.org/content/osx-eclipse-launcher#.UGWfRRjCaHk
I use it everyday and like it very much! To demonstrate the simplicity of usage just take a look at the following image:
EDIT: Milhous's answer seems to be the officially supported way to do this as of 10.5. Earlier version of OS X and even 10.5 and up should still work using the following instructions though.
Open the command line (Terminal)
Navigate to your Eclipse installation folder, for instance:
cd /Applications/eclipse/
cd /Developer/Eclipse/Eclipse.app/Contents/MacOS/eclipse
cd /Applications/eclipse/Eclipse.app/Contents/MacOS/eclipse
cd /Users/<usernamehere>/eclipse/jee-neon/Eclipse.app/Contents/MacOS
Launch Eclipse: ./eclipse &
This last command will launch eclipse and immediately background the process.
Rinse and repeat to open as many unique instances of Eclipse as you want.
Warning
You might have to change the Tomcat server ports in order to run your project in different/multiple Tomcat instances, see Tomcat Server Error - Port 8080 already in use
To make this you need to navigate to the Eclipse.app directory and use the following command:
open -n Eclipse.app
Actually a much better (GUI) solution is to copy the Eclipse.app to e.g. Eclipse2.app and you'll have two Eclipse icons in Dock as well as Eclipse2 in Spotlight. Repeat as necessary.
If the question is how to easily use Eclipse with multiple different workspaces, then you have to use a kludge because shortcuts in OS X do not provide a mechanism for passing command line arguments, for example the "--data" argument that Eclipse takes to specify the workspace. While there may be different reasons to create a duplicate copy of your Eclipse install, doing it for this purpose is, IMNSHO, lame (now you have to maintain multiple eclipse configurations, plugins, etc?).
In any case, here is a workaround. Create the following script in the (single) Eclipse directory (the directory that contains Eclipse.app), and give it a ".command" suffix (e.g. eclipse-workspace2.command) so that you can create an alias from it:
#!/bin/sh
# open, as suggested by Milhous
open -n $(dirname $0)/Eclipse.app --args -data /path/to/your/other/workspace
Now create an alias to that file on your desktop or wherever you want it.
You will probably have to repeat this process for each different workspace, but at least it will use the same Eclipse installation.
2018 Update since many answers are no longer valid
OS X Heigh Sierra (10.13) with Eclipse Oxygen
Go to wherever your Eclipse is installed. Right-click -> Show Package Contents -> Contents -> MacOS -> Double-click the executable called eclipse
A terminal window will open and a new instance of eclipse will start.
Note that if you close the terminal window, the new Eclipse instance will be closed also.
To make your life easier, you can drag the executable to your dock for easy access
Instead of copying Eclipse.app around, create an automator that runs the shell script above.
Run automator, create Application.
choose Utilities->Run shell script, and add in the above script (need full path to eclipse)
Then you can drag this to your Dock as a normal app.
Repeat for other workspaces.
You can even simply change the icon - https://discussions.apple.com/message/699288?messageID=699288&#699288
One another way is just to duplicate only the "Eclipse.app" file instead of making multiple copies of entire eclipse directory. Right-Click on the "Eclipse.app" file and click the duplicate option to create a duplicate.
If you're like me, you probably have terminal running most of the time as well.
You could just create an alias in /Users//.bash_profile like this
alias eclipse='open -n path_to_eclipse.app'
then all you have to do is just open the terminal and type eclipse.
Based on a previous answer that helped me, but different directory:
cd /Applications/Eclipse.app/Contents/MacOS
./eclipse &
Thanks
You can create an AppleScript file to open Eclipse with a given workspace. You can even save the AppleScript file as an Application, which is equivalent to creating an alias with arguments in Windows OS.
Open Script Editor and type the following:
do shell script "open '/path/to/your/Eclipse/installation' -n --args -data /path/to/your/workspace"
For instance:
do shell script "open '/Applications/Eclipse.app' -n --args -data /MyWorkspaces/Personal"
Press the Run button to check it's working.
This script can be saved as such, but I prefer to save it as an Application. That way I can customize the icon by copying the *.icns icon from the original Eclipse.app bundle to the script application bundle.
To open an App folder, use the "see contents" contextual menu option. It should look like this:
Where "main.scpt" is the AppleScript file and "applet.icns" is the icon from the original Eclipse bundle.
Launch terminal and run open -n /Applications/Eclipse.app for a new instance.
I found this solution a while back, can't remember where but it still seems to work well for me.
Create a copy of Eclipse.app for each workspace you want to work in (for this example ProjectB.app), then open ProjectB.app/Contents/MacOS/eclipse.ini and add these two lines at the beginning of the file:
-data
/Users/eric/Workspaces/projectb
... substituting where your workspace is located. When you launch ProjectB.app it will automatically start with that workspace instead of prompting for a location, and you should be able to run it at the same time as other Eclipse instances with no problem.
In Terminal simply paste below line and hit enter ..
/Applications/Eclipse.app/Contents/MacOS/eclipse ; exit;
If you want to open multiple workspaces and you are not a terminal guy, just locate the Unix executable file in your eclipse folder and click it.
The path to the said file is
Eclipse(folder) -> eclipse(right click) -> Show package
Contents -> Contents -> MacOs -> eclipse(unix executable file)
Clicking on this executable will open a separate instance of eclipse.
A more convenient way:
Create an executable script as mentioned above:
#!/bin/sh
cd /Applications/Adobe\ Flash\ Builder\ 4.6
open -n Adobe\ Flash\ Builder\ 4.6.app
In you current instance of Flashbuilder or Eclipse, add a new external tool configuration. This is the button next to the debug/run/profile buttons on your toolbar. In that dialog, click on "Program" and add a new one. Give it the name you want and in the "Location" field, put the path to the script from step 1:
/Users/username/bin/flashbuilder
You can stop at step 2, but I prefer adding a custom icon to the toolbar. I use a the Quick Launch plugin to do that:
http://sourceforge.net/projects/quicklaunch/files/
After adding the plugin, go to "Run"->"Organize Quick Lauches" and add the external tool config from step 2. Then you can configure the icon for it.
After you save that, you'll see the icon in your toolbar. Now you can just click it every time you want a new Flashbuilder/Eclipse instance.
You can run multiple instances of Eclipse by creating a pseudonym for Eclipse application in it's folder and using it for running new Eclipse instance
Lets try downloading this in your eclipse on Mac you will be able to open multiple eclipse at a time Link
Name : macOS Eclipse Launcher
Steps :
Go to eclipse Market place.
Search for "macOS Eclipse Launcher" and install.
It will restart .
Now under file menu check for open option > there you will find other projects to open also at same time .
Window -> New Window
This opens a new window and you can then open another project in it. You can use this as a workaround hopefully.
It actually allows you to work in same workspace.