How do I configure Eclipse's Subversion config file to use my private-key? - eclipse

I'm using Eclipse and the Subversive for SVN control, in Windows. I've also installed TortoiseSVN. The SVN repository I'm using is utilizing a svn+ssh scheme, and there is no way to change that.
Now, there's a file in %APPDATA%\Subversion\config that I need to edit to perform SVN interaction in Eclipse without typing in the password every time. The line in this config file reads now (default):
ssh = $SVN_SSH ssh -o ControlMaster=no
I've read a bit on the web that the $SVN_SSH is an environmental variable in Windows, and in this case it points to TortoiseSVN\bin\TortoisePlink.exe, which is correct.
What is the additional parameteres to append this config to make it take my private key? I've updated the "authorized_keys" file on the server (in my .ssh folder) with my public keyphrase, and I've tested and confirmed that logging in to the SVN server outside Eclipse works like it should with my private/public key pair.
The problem here is to make it all work inside Eclipse, and it's quite frankly a small nightmare :/ If anyone has experienced the same, or knows any remedy, I'd appreciate any help.

If you set the 'SVN_SSH' environment variable the rest of the line is ignored, so you should either replace '$SVN_SSH ssh' with the path to the program, or move the required arguments to the end of the SVN_SSH environment variable.

Related

Remote containers on Windows - how?

I have been playing around with the Remote containers feature of VS Code. If I have a .devcontainer directory inside my repo, VS code suggests to open the repo using a bind mount.
However, bind mounting to Windows seems to have two major drawbacks:
File permissions are all wrong. I am not sure what happens if I git commit such a file, maybe I will inadvertedly make non-executable files executable? I think this is a limitation in Docker for windows, but a problem nonetheless.
CRLF conversion is by default introducing whitespace diffs in all files (This is solved by .gitattributes though).
I saw that there is an option to clone the repo directly from Github to a named volume, but that does not respect the mount point set in the devcontainer.json file.
So I think my questions is really about: is remote containers at all usable on Windows for practical purposes and if so, how do I best set it up?
While it does work good for me in Windows 10 (2004 update), I recommend using devcontainer using WSL2 as it works "smoother".
The file permissions issue might be fixable using the remoteUser property in the devcontainer.json file. Just remove the comment and use the remoteUser value that is supplied by the template.

How to eliminate RubyMine false "No such file to load" errors

I've recently installed RubyMine on a second machine and cloned a GitHub repository there.
My application runs exactly the same as on the first machine, but the RM code inspection result is radically different: I get dozens of "No such file to load" errors.
This even though the application runs fine both from the command line and from RM.
In dialog Run/Debug Configurations, I have specified load paths (-I. -I..) in the Ruby arguments.
Does the code inspection not honor the configuration? Or perhaps it's using a different configuration?
A bit late, but you may need to mark the directories that are load path roots in your app within the Rubymine tree - right click and do "Mark Directory As/Load Path Root".
For me the other solutions did not work. However, the problem was that RubyMine detected the wrong ruby version - while rvm for the project was ruby 2.4.1, in RubyMine it defaulted to the last version it had (2.4.2). So going to RubyMine > Preferences > Ruby SDK & Gems and changing the version for the project to the correct one solved it.
If you use the "Mark Directory As/Load Path Root" action, this will apply for IDE autocompletion only. It will not be propagated onto the interpreter (as it would be in PyCharm with Python).
You have to either keep using the -I switch, or configure $LOAD_PATH in your code, or (preferably) set up a Gem project with bundler support. You can then configure the path in a gemspec file. See https://www.jetbrains.com/help/ruby/creating-gem-project.html.
Sources:
https://intellij-support.jetbrains.com/hc/en-us/community/posts/206741945-Load-Path-not-working-at-all-
https://intellij-support.jetbrains.com/hc/en-us/community/posts/206727915-Building-RubyGems-lib-in-load-path-
You can try changing Project Path Mappings and set relative Local Path and Remote Path to get it to work.

PyCharm - automatically set environment variables

I'm using virtualenv, virtualenvwrapper and PyCharm.
I have a postactivate script that runs an "export" command to apply the environment variables needed for each project, so when I run "workon X", the variables are ready for me.
However, when working with PyCharm I can't seem to get it to use those variables by running the postactivate file (in the "before launch" setting). I have to manually enter each environment variable in the Run/Debug configuration window.
Is there any way to automatically set environment variables within PyCharm? Or do I have to do this manually for every new project and variable change?
I was looking for a way to do this today and stumbled across another variation of the same question (linked below) and left my solution there although it seems to be useful for this question as well. They're handling loading the environment variables in the code itself.
Given that this is mainly a problem while in development, I prefer this approach:
Open a terminal
Assuming virtualenvwrapper is being used, activate the virtualenv of the project which will cause the hooks to run and set the environment variables (assuming you're setting them in, say, the postactivate hook)
Launch PyCharm from this command line.
Pycharm will then have access to the environment variables. Likely because of something having to do with the PyCharm process being a child of the shell.
https://stackoverflow.com/a/30374246/4924748
I have same problem.
Trying to maintain environment variables through UI is a tedious job.
It seems pycharm only load env variables through bash_profile once when it startup.
After that, any export or trying to run a before job to change bash_profile is useless
wondering when will pycharm team improve this
In my case, my workaround for remote interpreter works better than local,
since I can modify /etc/environment and reboot the vm
for local interpreter, the best solution I can do are these:
1. Create a template Run/Debug config template and clone it
If your env variables are stable, this is a simple solution for creating diff config with same env variables without re-typing them.
create the template config, enter the env variables you need.
clone them
see picture
2. Change your script
Maybe add some code by using os.environ[] = value at your main script
but I don't want to do this, it change my product code and might be accidentally committed
Hope someone could give better answer, I've been spent too much time on this issue...
Another hack solution, but a straightforward one that, for my purposes, suffices. Note that while this is particular to Ubuntu (and presumably Mint) linux, there might be something of use for Mac as well.
What I do is add a line to the launch script (pycharm.sh) that sources the needed environment variables (in my case I was running into problems w/ cx_Oracle in Pycharm that weren't otherwise affecting scripts run at command line). If you keep environment variables in a file called, for example, .env_local that's in your home directory, you can add the following line to pycharm.sh:
. $HOME/.env_local
Two important things to note here with respect to why I specifically use '.' (rather than 'source') and why I use '$HOME' rather than '~', which in bash are effectively interchangeable. 1) I noticed that pycharm.sh uses the #!/bin/sh, and I realized that in Ubuntu, sh now points to dash (rather than bash). 2) dash, as it turns out, doesn't have the source "builtin", nor will ~ resolve to your home dir.
I also realize that every time I upgrade PyCharm, I'll have to modify the pycharm.sh file, so this isn't ideal. Still beats having to manage the run configurations! Hope it helps.
OK, I found better workaround!
1.install fabric in your virtualenv
go to terminal and
1. workon your virtualenv name
2. pip install fabric
2. add fabric.py
add a python file and named it "fabric.py" under your project root, past the code below,and change the path variables to your own
from fabric.api import *
import os
path_to_your_export_script = '/Users/freddyTan/workspace/test.sh'
# here is where you put your virtualenvwrapper environment export script
# could be .bash_profile or .bashrc depend on how you setup your vertualenvwrapper
path_to_your_bash_file = '/Users/freddyTan/.bash_profile'
def run_python(py_path, virtualenv_path):
# get virtualenv folder, parent of bin
virtualenv_path = os.path.dirname(virtualenv_path)
# get virtualenv name
virtualenv_name = os.path.basename(virtualenv_path)
with hide('running'), settings(warn_only=True):
with prefix('source %s' % path_to_your_export_script):
with prefix('source %s' % path_to_your_bash_file):
with prefix('workon %s' % virtualenv_name):
local('python %s' % py_path)
3. add a external tool
go to
preference-> External tools -> click add button
and fill in following info
Name: whatever
Group: whatever
Program: "path to your virtualenv, should be under '$HOME/.virtualenvs' by default"/bin/fab
Parameter: run_python:py_path=$FilePath$,virtualenv_path=$PyInterpreterDirectory$
Working directory: $ProjectFileDir$
screenshot
wolla, run it
go to your main.py, right click, find the external name (ex. "whatever"), and click it
you could also add shortcut for this external tool
screenshot
drawbacks
this only work on python 2.x, because fabric don't support python 3

Mercurial eclipse plugin push different server

I have installed mercurial and configured in .hgrc file like this:
default (server-1)
default push (server-2)
This works fine in command line as it is using .hgrc file.
I tried using the eclipse plugin for mercurial which is not reading from .hgrc file ( I have to give repo address and credentials to it), I have given the default server-1 address, So How can I configure server-2 for push operation ?
Or
how to make my eclipse to read from .hgrc file directly ?
Thanks in advance.
I believe the plugin is utilizing the .hgrc file (for instance I've never edited it by hand and have a defult definition in it).
Try opening the drop-down list of the URL text field in when pushing/pulling, it will contain server-1 (and probably server-2 too), and if you select it, the plugin will also fill the user credentials (if you saved them too).

How to change credentials for Hg repository in Eclipse?

This is exactly the same case as this one, but with Hg instead of SVN. I have MercurialEclipse installed, and I have changed the password of my remote repo. Now when I synch it fails.
I have not found any conf file in "C:\Documents and Settings\%USER%\Application Data..." about Hg.
I have deleted the .keyring eclipse file and restarted but still fails.
Eclipse 3.6.1 with MercurialEclipse1.6, on windows Vista
In reply to pyfunc (thanks):
I found an entry like this in .hg\hgrc:
[paths]
default = https://user:oldpassword#bitbucket.org/myprojectpath
so I changed to the new password and restarted eclipse, but still I get 'authorization failed'...
I finally found out a way to achieve this. If I select "Synchronize With" I get a dialog and I am able to insert the good values, so now I could synch!
This does not explain why changing values in .hgrc didn't work, but at least is solved now, although it would be nice to find out about the details...
Typically that is stored in .hgrc file. That is the user configuration file stores in the HOME directory. You should be able to change the password there.
As per the man page of Mercurial, there are some suggestions about the location of config file on windows.
1. <install-dir>\Mercurial.ini
2. HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial
3. C:\Mercurial\Mercurial.ini
4. %HOME%\Mercurial.ini or
5. %HOME%\.hgrc or
6. %USERPROFILE%\Mercurial.ini or
7. %USERPROFILE%\.hgrc
it could also lie in /.hg/hgrc
Finally found the config file after some digging... it's in ${workspace_location}/.metadata/.plugins/org.eclipse.core.runtime/.settings/com.vectrace.MercurialEclipse
If you close Eclipse, open this file, and delete just the lines at the bottom starting with repo_, the settings you have saved for that repository (including credentials) should be cleared the next time you open Eclipse. You'll probably want to make a backup of the file just in case.
Since these credentials override whatever you have in your hgrc, deleting these should allow the repositories to authenticate with your global settings. You won't necessarily see the credentials in the username/password fields in Eclipse, but if you click Next/Finish anyway, it should work fine.