path

Getting the path of a running JAR file returns “rsrc:./”

做~自己de王妃 提交于 2019-12-12 17:57:30
问题 My code runs inside a JAR file and I need to get the full path of that file. For example, my JAR is called example.jar and is located at D:\example\ So I need to get "D:\example\example.jar" by some code inside that jar. I have tried many methods to get that path, but none of them worked correctly. One of them is getClass().getProtectionDomain().getCodeSource().getLocation().toURI().getPath() Many people say that this works for them, but it returns "rsrc:./" for me. I have searched after that

Implicit conversion between std::filesystem::path and std::string, should it happen?

倖福魔咒の 提交于 2019-12-12 17:21:50
问题 The cppreference page for std::filesystem::path states: Paths are implicitly convertible to and from std::basic_strings , which makes it possible to use them with over files APIs, e.g. as an argument to std::ifstream::open Now the conversion to a std::filesystem::path is easy to see as it has a non-explicit constructor that takes std::string types. What I can't seem to find, though, is a way to go to a std::string implicitly. There is a string function, but it is std::string string() const; ,

When using Node's fs.readFile(), should I prepend the path with __dirname?

馋奶兔 提交于 2019-12-12 17:18:51
问题 Example: fs.readFile(path.join(__dirname, 'path/to/file'), callback); versus fs.readFile('path/to/file', callback); Both seem to work, so I'm wondering if I can just skip the __dirname prefix, i.e. if there is any reason to prepend it. 回答1: From the node docs, __dirname is the name of the directory that the currently executing script resides in. This will allow for flexibility across multiple deployments (eg: development / production). If you are not deploying to any remote servers, you

Django signal get request full path

拥有回忆 提交于 2019-12-12 17:16:59
问题 I wrote a signal in my django project, inside I want to send an email with the full path of my website. But to do so, I need to get the request object inside the signal, how could I do that? Thanks. @receiver(pre_save, sender=AccessRequest) def email_if_access_true(sender, instance, **kwargs): #How can I get the full path of my website here? pass 回答1: Put following code in your pre_save signal receiver: from django.contrib.sites.models import get_current_site current_site = get_current_site

Resolve path of Excel

♀尐吖头ヾ 提交于 2019-12-12 17:15:53
问题 Actually I intended to ask the following question: For an executable that lies in a directory defined in %PATH% , how can I find out in which of these directory it is found? because I need to run Excel from C# using Process.Run(...), and just indicating "Excel" works fine: Windows seems to know where to find it. However I need to provide the appropriate working directory, too. But in the meantime I found out that Microsoft Office is not even in the %PATH%, Windows apparently resolves it in

C, runtime test if executable exists in PATH

*爱你&永不变心* 提交于 2019-12-12 17:15:16
问题 I am currently writing an application in C, targetting BSD and Linux systems with a hope to being generall portable. This program a runtime dependency, in this case mplayer. As it stands I am using execlp() to start mplayer. I am checking the error code of the execlp call and I am testing for EACCESS , so I know when I attempt to run mplayer if it exists or not. Because of the way my program works, mplayer is a required dependency but may not be used for some time after my program starts. As

how can get the list of Sql Server instance(or SqlExpress) that are installed and exist in local network

跟風遠走 提交于 2019-12-12 17:10:05
问题 I want to get list of Sql server instance that are existing in local network with the name of computer that it belongs to. question2:if a user select every instance of SqlExpress ,i want to get the path that it becomed installed, i mean for example "C:\Program Files\Microsoft SQL Server.....". thanks alot. 回答1: Check this MSDN page EDIT: for future reference, here is the relevant code.: using System.Data.Sql; class Program { static void Main() { // Retrieve the enumerator instance and then

D3.js How to rotate Text on a path

爱⌒轻易说出口 提交于 2019-12-12 16:27:42
问题 This is my first D3 project (I'm not a programmer, so learning everything at once). I'm trying to make a circular calendar that I've been drawing by hand for several years, which is a huge pain. Most of the bits are now working, but I can't figure out how to get the text turned 90 degrees on this arc. Once I get the text turned, then I'll need to figure out how to get it spaced equally around the circle. My goal is to get it to look like this hand drawn example: Here's what it looks like

Choosing a different executable in bash

雨燕双飞 提交于 2019-12-12 16:18:46
问题 When I want to run make to generate some executables it always uses the Sun make located at /usr/local/bin/make rather than GNU make which can be found at /usr/sfw/bin/gmake . How can I tell the OS to use GNU make rather than Sun's? Do I need to overwrite the path somehow? 回答1: For two executables named identically, reorder paths in the PATH variable, since the first match will be used. Otherwise, define an alias in your ~/.profile or ~/.bashrc file: alias make="/usr/sfw/bin/gmake" Or a

PowerShell - Add grandparent folder name to file name

半世苍凉 提交于 2019-12-12 16:14:33
问题 I'm still pretty new at PS Scripting, so most of what I do is hacked together from examples. What I'm trying to do right now is search all the folders in a directory for PDFs and then rename them, adding the grandparent folder name to the file name. For example: c:\export\123\notes\abc.pdf would be renamed to c:\export\123\notes\123_abc.pdf The rest of the script, which works fine, uses GhostScript to convert them to TIFs and moves them to another server. The problem is that that all the PDFs