relative-path

Absolute vs. relative paths

给你一囗甜甜゛ 提交于 2019-11-27 03:40:46
If I use absolute paths, I can't move the whole directory to a new location. If I use relative paths, I can't move individual files to new locations. What's the solution here? Do you set up a config file that holds the root path and go from there? Or do you have a rule like: Never move files around? I've seen in some projects that people use dirname( FILE ). What is the point of that, I mean, why not simply leave it out since the dirname is relative anyway (depending on where the file sits)? you should use a config file that will be included in each file first line, for example your app look

MVC Bundling and CSS relative URLs

≡放荡痞女 提交于 2019-11-27 03:33:46
MVC's bundling is returning the wrong URL in CSS images when using CssRewriteUrlTransform: I have an intranet application whose URL is, for example: http://usid01-srv002/MyApplication . It's in IIS's "Default Web Site". Which has the following in BundleConfig.cs : bundles.Add(new StyleBundle("~/bundles/jcss") .Include("~/Scripts/JQueryUI/css/*.css", new CssRewriteUrlTransform()) ); The bundling system is generating the wrong URL for any images referenced in those CSS files, yielding 404's even JQueryUI's very well tested CSS files (from FireBug): e.g. it's generating http://usid01/path/foo.png

How do relative file paths work in Eclipse?

♀尐吖头ヾ 提交于 2019-11-27 03:29:54
So my 2009 new years resolution is to learn Java. I recently acquired "Java for Dummies" and have been following along with the demo code in the book by re-writing it using Eclipse. Anyway, every example in the book that uses a relative path does not seem to read the .txt file it's supposed to read from. Here is the sample code: import java.util.Scanner; import java.io.File; import java.io.IOException; import javax.swing.JFrame; import javax.swing.JLabel; import java.awt.GridLayout; class TeamFrame extends JFrame { public TeamFrame() throws IOException { PlayerPlus player; Scanner myScanner =

Relative Paths in Winforms

给你一囗甜甜゛ 提交于 2019-11-27 03:27:23
问题 Relative paths in C# are acting screwy for me. In one case Im handling a set of Texture2d objects to my app, its taking the filename and using this to locate the files and load the textures into Image objects. I then load an image from a relative path stored in the class file and use a relative path that needs to be relative to Content/gfx. But if i dont load these textures these relative paths will fail. How can I garuantee that my rel path wont fail? In web work all rel paths are relative

Getting relative path from absolute path in PHP

故事扮演 提交于 2019-11-27 03:20:35
I noticed some similar questions about this problem when I typed the title, but they seem not be in PHP. So what's the solution to it with a PHP function? To be specified. $a="/home/apache/a/a.php"; $b="/home/root/b/b.php"; $relpath = getRelativePath($a,$b); //needed function,should return '../../root/b/b.php' Any good ideas? Thanks. Try this one: function getRelativePath($from, $to) { // some compatibility fixes for Windows paths $from = is_dir($from) ? rtrim($from, '\/') . '/' : $from; $to = is_dir($to) ? rtrim($to, '\/') . '/' : $to; $from = str_replace('\\', '/', $from); $to = str_replace(

Relative Path Problems in Javascript Ajax call

半城伤御伤魂 提交于 2019-11-27 03:13:19
问题 Okay, I have a JavaScript file with the following functions: function AskReason() { var answer = prompt("Please enter a reason for this action:", ""); if (answer != null) DoReason(answer); } function createXMLHttpRequest() { try { return new XMLHttpRequest(); } catch (e) { alert('XMLHttpRequest not working'); } try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { alert('Msxml2.XMLHTT not working'); } try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { alert(

How to use relative/absolute paths in css URLs?

坚强是说给别人听的谎言 提交于 2019-11-27 03:09:04
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? Kobi The url is relative to the location of the CSS file , so this should work for you: url('../../images/image.jpg') The relative url goes two folders back, and then to

Should I use Url.Content() or ResolveUrl() in my MVC views?

青春壹個敷衍的年華 提交于 2019-11-27 02:40:51
问题 When building code like this: <script type="text/javascript" src="<%=ResolveUrl("~/js/js.js")%>"></script> or <input type="image" src="<%=ResolveUrl("~/img/submit.png")%>" /> Should I use Url.Content or ResolveUrl() ? What's the difference? 回答1: If you're using IIS URL Rewriting within your MVC application, e.g. internally treating http://yoursubdomain.example.com/MyController/MyAction as http://hosted.example.com/yoursubdomain/MyController/MyAction, Url.Content() will generate a correct

Angular2 relative paths for templateUrl and styleUrls?

拈花ヽ惹草 提交于 2019-11-27 02:27:51
问题 While searching I found something named as moduleId to set the relative paths of template and CSS files, but I don't know exactly how to use moduleId in our components of angular2? Actually, the problem is in my folder structure.I am loading my all .js files from dist folder whereas my view(.html files) are in the src folder. So when I use moduleId: module.id like this angular took the path from dist folder, instead of src folder. So anybody here helps me tell that How to set custom moduleId

IIS virtual directory and ASP.NET directory paths

試著忘記壹切 提交于 2019-11-27 02:14:09
问题 The problem I'm running into the typical virtual-directory dilemma in that you have some paths on your ASP.Net application and you deploy the app in a IIS virtual directory. Then all paths relatives to the "web root" (f.i., "/images") doesn't work because the app is in a virtual directory path. The solutions A. Make the "images" folder a virtual directory. This way "/images" will always exist. B. Use "<%=Request.ApplicationPath%>/Imagenes" as the source of my images. This works great in IIS