path

VS Code python extension recently started complaining about a Path error on Win10

痴心易碎 提交于 2019-12-20 12:47:09
问题 When I start Visual Studio Code with a python file I started getting the following error The environment variable 'Path' seems to have some paths containing characters (';', '"' or ';;'). The existence of such characters are known to have caused the Python extension to not load. If the extension fails to load please modify your paths to remove these characters. I checked my path and I did indeed have a ;; appearing. I removed it but, I'm still getting the error. Here is my current path. PATH

Shortest path with a fixed number of edges

半世苍凉 提交于 2019-12-20 10:59:09
问题 Find the shortest path through a graph in efficient time, with the additional constraint that the path must contain exactly n nodes. We have a directed, weighted graph. It may, or may not contain a loop. We can easily find the shortest path using Dijkstra's algorithm, but Dijkstra's makes no guarantee about the number of edges. The best we could come up with was to keep a list of the best n paths to a node, but this uses a huge amount of memory over vanilla Dijkstra's. 回答1: It is a simple

sudo open -e ~/.bash_profile Permission denied mac

孤者浪人 提交于 2019-12-20 10:54:10
问题 I am trying to edit bash_profile file to add path to my sdk through the following command on my mac machine. sudo touch ~/.bash_profile; open -e ~/.bash_profile It opens the file in TextEdit but does not allow me to edit it. Though i have given super-user permission and password while running the above command. It is giving me following message when i try to edit it. "You don’t own the file “.bash_profile” and don’t have permission to write to it. You can duplicate this document and edit the

java.nio.file.Path for URLs?

倖福魔咒の 提交于 2019-12-20 10:18:53
问题 Java7 ships with a default Path implementation for local files. Is there a Path implementation for URLs? For example, I should be able to copy a remote resource using the following code: Path remote = Paths.get(new URI("http://www.example.com/foo/bar.html")); Path local = Paths.get(new URI("/bar.html")); Files.copy(remote, local); Currently, this throws java.nio.file.FileSystemNotFoundException: Provider "http" not installed . I could probably implement this myself but I'd rather not reinvent

How to get the base path in jQuery?

送分小仙女□ 提交于 2019-12-20 10:17:58
问题 window.location works fine, but returns me the whole, absolute path, like http://domain.xyz/punch/lines . But I only need http://domain.xyz/ . How can I extract only that first part? And how can I make that dynamic, I mean to be always the same even when the subdirectory path gets longer? 回答1: You can get the protocol and the host separately, and then join them to get what you need window.location.protocol + "//" + window.location.host + "/" As a sidenote, window.location.pathname would

How to smooth a freehand drawn SVG path?

只谈情不闲聊 提交于 2019-12-20 09:38:08
问题 I am looking for a solution to convert a freehand, user drawn SVG path, consisting of lots auf LineTo segments, into a smoother one. Preferred language would be JavaScript, but any advice is welcome. 回答1: first of all, I would recommend using a good graphics library, such as raphael. It will simplify the process of actually using javascript to perform the drawing. A very simple method of smoothing is to convert all lineto commands with equivalent curveto commands and calculate some control

python import path: packages with the same name in different folders

时光毁灭记忆、已成空白 提交于 2019-12-20 09:33:37
问题 I am developing several Python projects for several customers at the same time. A simplified version of my project folder structure looks something like this: /path/ to/ projects/ cust1/ proj1/ pack1/ __init__.py mod1.py proj2/ pack2/ __init__.py mod2.py cust2/ proj3/ pack3/ __init__.py mod3.py When I for example want to use functionality from proj1 , I extend sys.path by /path/to/projects/cust1/proj1 (e.g. by setting PYTHONPATH or adding a .pth file to the site_packages folder or even

python import path: packages with the same name in different folders

感情迁移 提交于 2019-12-20 09:31:26
问题 I am developing several Python projects for several customers at the same time. A simplified version of my project folder structure looks something like this: /path/ to/ projects/ cust1/ proj1/ pack1/ __init__.py mod1.py proj2/ pack2/ __init__.py mod2.py cust2/ proj3/ pack3/ __init__.py mod3.py When I for example want to use functionality from proj1 , I extend sys.path by /path/to/projects/cust1/proj1 (e.g. by setting PYTHONPATH or adding a .pth file to the site_packages folder or even

Choosing between multiple executables with same name in Linux

被刻印的时光 ゝ 提交于 2019-12-20 09:28:42
问题 The system I am using has gnuplot installed in /usr/bin . I don't have root, but I needed a newer version of gnuplot , so I installed it to $HOME/usr/bin . I added $HOME/usr/bin to my path, but it still executes the one in /usr/bin if I just use the gnuplot command. I'd rather not have to specify $HOME/usr/bin/gnuplot every time I have to use it. How do I tell Linux to use the one in my home directory, and not the one in /usr/bin ? 回答1: Executables are found in PATH order. You need to prepend

Dynamic Paths in Helper

你。 提交于 2019-12-20 08:58:01
问题 I'm trying to create a helper method for my admin links. In quite a few views I have the code <% if current_user %> <%= link_to "Edit", edit_model_path(model) %> <%= link_to "New", new_model_path %> <%= link_to "Delete", model, :confirm => "You're a Noob", :method => :delete %> <% end %> that only display these when logged in. I would like to do something like this in their place <%= admin_links(model) %> and pass the current item into the application helper method def admin_links(m) if