absolute-path

Performance: Absolute vs. Relative URLs

纵然是瞬间 提交于 2019-12-19 06:05:08
问题 What's faster? Hot linking (inline linking) to an absolute URI or hosting the resource yourself and using a relative URI? In his tutorial on how to style HTML5 elements in Internet Explorer, Remy Sharp states that hot linking causes an "extra HTTP [GET] request." I agree if you're comparing hot linking to copying & pasting (embedding) the script into the HTML. But, if you're comparing hot linking to hosting the script locally and linking via a relative path, then I'd argue that hot linking is

Convert absolute path to relative path in batch file

久未见 提交于 2019-12-18 16:46:08
问题 Is it possible to convert an absolute path to a relative path in a batch file? (the opposite of this). Obviously you would need two inputs: the absolute path to convert, and an absolute reference path that you want it to be relativised to. eg: Path to convert: c:\documents\mynicefiles\afile.txt Reference path: c:\documents Result: mynicefiles\afile.txt 回答1: @echo off setlocal EnableDelayedExpansion set Path_to_convert=c:\documents\mynicefiles\afile.txt set Reference_path=c:\documents set

Tomcat server absolute file access in war webapp

对着背影说爱祢 提交于 2019-12-18 13:38:07
问题 I have a Spring webapp whose .war file has been uploaded to a Tomcat server. Most of the basic functions are working as intended - page views and form submission. My problem now is that my webapp needs to read and write files and I am clueless as to how I can achieve this (the file I/O returns java.lang.NullPointerException ). I used the following code to get the absolute path of a given file suggested by Titi Wangsa Bin Damhore to know the path relative to the server: HttpSession session =

How to find relative path given two absolute paths?

放肆的年华 提交于 2019-12-18 06:12:14
问题 Given two absolute paths, e.g. /a/path/to/a /a/path/to/somewhere/else How can I get a relative path from one to the other, ../a ? In a sense, the opposite of what realpath does. 回答1: I answered a similar question here: Resolving a relative path without referencing the current directory on Windows. There is no standard function for this. There is a function in vi-like-emacs for this purpose. A quick check of apropos relative shows me few other programs which likely implement this: revpath for

how to find the target file's full(absolute path) of the symbolic link or soft link in python

余生长醉 提交于 2019-12-17 22:55:03
问题 when i give ls -l /etc/fonts/conf.d/70-yes-bitmaps.conf lrwxrwxrwx <snip> /etc/fonts/conf.d/70-yes-bitmaps.conf -> ../conf.avail/70-yes-bitmaps.conf so for a symbolic link or soft link, how to find the target file's full(absolute path) in python, If i use os.readlink('/etc/fonts/conf.d/70-yes-bitmaps.conf') it outputs ../conf.avail/70-yes-bitmaps.conf but i need the absolute path not the relative path, so my desired output must be, /etc/fonts/conf.avail/70-yes-bitmaps.conf how to replace the

Get absolute paths of all files in a directory

痞子三分冷 提交于 2019-12-17 21:46:43
问题 How do I get the absolute paths of all the files in a directory that could have many sub-folders in Python? I know os.walk() recursively gives me a list of directories and files, but that doesn't seem to get me what I want. 回答1: os.path.abspath makes sure a path is absolute. Use the following helper function: import os def absoluteFilePaths(directory): for dirpath,_,filenames in os.walk(directory): for f in filenames: yield os.path.abspath(os.path.join(dirpath, f)) 回答2: If the argument given

PHP absolute path to root

笑着哭i 提交于 2019-12-17 08:33:47
问题 I can't believe PHP doesn't have an easy solution of this simple matter. ASP.NET has a ~ sign that cares of this issue and starts everything from root level. Here's my problem: localhost/MySite -->Admin -- Edit.php -->Class -- class.EditInfo.php -->Texts -- MyInfo.txt --ShowInfo.php Inside class.EditInfo.php I am accessing MyInfo.txt so I defined a relative path "../Texts/MyInfo.txt". Then I created an object of EditInfo in Admin/Edit.php and accessed Texts/MyInfo.txt it worked fine. But now

PHP absolute path to root

拥有回忆 提交于 2019-12-17 08:33:35
问题 I can't believe PHP doesn't have an easy solution of this simple matter. ASP.NET has a ~ sign that cares of this issue and starts everything from root level. Here's my problem: localhost/MySite -->Admin -- Edit.php -->Class -- class.EditInfo.php -->Texts -- MyInfo.txt --ShowInfo.php Inside class.EditInfo.php I am accessing MyInfo.txt so I defined a relative path "../Texts/MyInfo.txt". Then I created an object of EditInfo in Admin/Edit.php and accessed Texts/MyInfo.txt it worked fine. But now

How to use relative/absolute paths in css URLs?

纵然是瞬间 提交于 2019-12-17 07:12:10
问题 I have a production and development server. The problem is the directory structure. Development: http://dev.com/subdir/images/image.jpg http://dev.com/subdir/resources/css/style.css Production: http://live.com/images/image.jpg http://live.com/resources/css/style.css How can I have a style.css in css folder that uses on both servers the same path for the background: url property? Is there a trick I can use with relative paths? 回答1: The URL is relative to the location of the CSS file, so this

Get path of Android resource

旧时模样 提交于 2019-12-17 03:17:25
问题 My question is: is it possible to get the absolute path of a resource (in a subdirectory of the res/ folder) in Android? Most of the answers I see to this question on google suggest getting a file descriptor, implying that this is not possible. Is it? EDIT: The reason I want to do this is because I'm writing classes that accept a path to media and play it. Testing would be much easier if I could pass the absolute path of a resource. 回答1: Use URI Paths instead of "absolute" path, see this post