path

How to get server path of physical path ?

…衆ロ難τιáo~ 提交于 2019-12-22 04:00:53
问题 I want to convert this physical path "C:\bla\bla\Content\Upload\image.jpg" to server path like "/Content/Upload/image.jpg" . How can i do that ? 回答1: you can use something like that : public static class Extensions { public static string RelativePath(this HttpServerUtility utility, string path, HttpRequest context) { return path.Replace(context.ServerVariables["APPL_PHYSICAL_PATH"], "/").Replace(@"\", "/"); } } and you call Server.RelativePath(path, Request); 回答2: You can do the following to

Python: is the current directory automatically included in path?

 ̄綄美尐妖づ 提交于 2019-12-22 03:52:58
问题 Python 3.4: From reading some other SO questions it seems that if a moduleName.py file is outside of your current directory, if you want to import it you must add it to the path with sys.path.insert(0, '/path/to/application/app/folder') , otherwise an import moduelName statement results in this error: ImportError: No module named moduleName Does this imply that python automatically adds all other .py files in the same directory to the path? What's going on underneath the surface that allows

How can I find the location of the tcsh shell script I'm executing?

血红的双手。 提交于 2019-12-22 03:45:48
问题 Say I put an executable tcsh file in /path/to/my_script.csh and my current directory is anywhere, for example I'm in /path So I type to/my_script.csh I want to have a line in my_script.csh that will return "/path/to/my_script.csh" - like ruby's __FILE__ 回答1: If you want to ensure the same result (full path and script name) try something like this: ... rootdir=`/bin/dirname $0` # may be relative path rootdir=`cd $rootdir && pwd` # ensure absolute path zero=$rootdir/`/bin/basename $0` echo

How to change the terminal prompt to just current directory? [closed]

拟墨画扇 提交于 2019-12-22 03:23:05
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . I am using a Macbook Pro, and I wanted to change it to the current directory and a dollar sign prompt in Terminal. I've already looked at these resources to try and solve this issue. I tried modifying the ~/.bashrc file and saving it but it did not seem to work. PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for

Can a Ruby script tell what directory it’s in?

倖福魔咒の 提交于 2019-12-22 01:55:14
问题 Inspired by "Getting the source directory of a Bash script from within", what's the Ruby way to do this? 回答1: For older versions of Ruby (< 2.0), the script being run can be found using: File.dirname(__FILE__) - relative path; or File.expand_path(File.dirname(__FILE__)) - the absolute path. For newer versions of Ruby, try: __dir__ Using __dir__ will return the script path even after a call to Dir.chdir ; whereas, using the older syntax may not return the path to the script. 回答2: Use __dir__

How to get realative path for database?

心不动则不痛 提交于 2019-12-22 01:41:53
问题 I am developing a jframe to store some data in database by using textfields and all. i have following code for database connection. I am using sqlite database. **Connectdatabase.java** /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package shreesai; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import javax.swing.JOptionPane; /** * * @author DeepRocks */ public class Connectdatabase { Connection con =

Style Paths In Java EE Applications

岁酱吖の 提交于 2019-12-22 01:37:32
问题 I have a Java EE application and in the application I have the following structure. WEB-INF layout header.jsp styles main.css I want to include the main.css in the header.jsp . Which I am attempting to do with the following (where ... is the path): <link rel="stylesheet" href="..."> However, I can't seem to get the right path. I have tried each of the following with no luck: ../styles/main.css /styles/main.css styles/main.css /WEB-INF/styles/main.css WEB-INF/styles/main.css What is the

.Net - Remove dots from the path

☆樱花仙子☆ 提交于 2019-12-22 01:26:11
问题 How can I convert "c:\foo\..\bar" into "c:\bar"? 回答1: string path = Path.GetFullPath("C:\\foo\\..\\bar"); // path = "C:\\bar" More Info 回答2: Have you tried string path = Path.GetFullPath(@"C:\foo\..\bar"); in C# using the System.IO.Path class? 回答3: Use Path.GetFullPath 回答4: I believe what you're looking for is Syetem.IO.Path as it provides methods to deal with several issues regarding generic paths, even Internet paths. 回答5: Try System.IO.Path.GetFullPath(@"c:\foo..\bar") 回答6: I wanted to

InputStream from relative path

一个人想着一个人 提交于 2019-12-22 01:24:31
问题 I have a relative file path (for example "/res/example.xls") and I would like to get an InputStream Object of that file from that path. I checked the JavaDoc and did not find a constructor or method to get such an InputStream from a path/ Anyone has any idea? Please let me know! Thank you 回答1: Use FileInputStream: InputStream is = new FileInputStream("/res/example.xls"); But never read from raw file input stream as this is terribly slow. Wrap it with buffering decorator first: new

Uploaded images not showing, wrong path

六月ゝ 毕业季﹏ 提交于 2019-12-21 22:13:01
问题 I've got a problem with displaying images that were uploaded from admin panel. Django renders wrong path, probably due to my configuration mistake somewhere... This is my model definition: class Article(models.Model): """News article, displayed on homepage to attract users""" class Meta: db_table = 'article' title = models.CharField(max_length=64) headline = models.CharField(max_length=255) content = HTMLField() image = models.ImageField(upload_to = 'articles/', null=True, blank=True) active