w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to pass a relative path (relative to main bundle) to iOS app as "argument passed on launch" in Schemes?
You don't need to pass in the path as an argument. You just need to use the NSBundle methods to return the path. Have a look at [[NSBundle mainBundle] pathForResouce: ofType:]; And also the documentation for NSBundle, https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSBundle_Class/Reference/Reference.html

Categories : IOS

Will protocol-relative URLs for HREFs perform as well as a relative path?
Relative, absolute, or protocol relative URLs are browser features. The browser combines the new URL with the page URL to build a complete URL to send a request to. It has no effect on the network.

Categories : Misc

Hadoop get relative path from absolute path and base path
How about building a String while recursing with getParent() until the current path is equal to the base path? Here is a helper function that might do what you want. (I haven't tested it yet, but the idea might help) private static String absolutePathToRelativeString(final Path path, final Path base) { final StringBuilder builder = new StringBuilder(path.toString().length()); Path curPath = new Path(path); while (curPath != null && curPath.depth() != 0 && !curPath.equals(base)) { if (!curPath.equals(path)) { builder.append('/'); } builder.insert(0, curPath.getName()); curPath = curPath.getParent(); } return builder.toString(); }

Categories : Java

phantomJS : Absolute path working, but Relative path giving problems
Maybe there is an issue in page.render but I don't think so. The most common case of hangs is unhandled exception. I will suggest you 4 things to investigate the issue : add an handler to phantom.onError and/or to page.OnError encapsulate your code in try/catch blocks (such as for page.render) Once the page is loaded, there is no test on callback status. It's better to check the status ('success' or 'fail') seems to freeze when calling page.render. Have you tried a simpler filename in the current directory? Maybe the freeze is because of the security or invalid filename (invalid characters?) Hope this will help you

Categories : PHP

included dbconfig.php file failes when using a direct path instead of relative path
You are trying to include file over HTTP. That is not right, you should include files with passing your local filesystem path to include or require. Your root should probably look like so: $root = '/var/www/mywebsite/testing-folder/';

Categories : PHP

Is it possible to ui:include files from an absolute file path rather than relative webapp path?
On a mac (for example) the path look like this: <ui:include src="file:///Users/Julian/Documents/.../WEB-INF/templates/footer.xhtml" /> On Windows the path looks like this: <ui:include src="file:///C:/Users/.../footer.xhtml" />

Categories : JSF

How to resolve a relative directory path to canonical path in MATLAB/Octave
The simplest way I know to convert a path to its canonical form is using cd command: oPath = cd(cd(iPath)); Note that this would fail if the path does not exist on your file system.

Categories : Matlab

do relative path in wordpress plugin point to wp-admin path?
I use the following in the main plugin file to define its URL and Path: $this->plugin_url = plugins_url( '/', __FILE__ ); $this->plugin_path = plugin_dir_path( __FILE__ ); Then, print the image like: echo '<img src = "' . $this->plugin_url . 'images-uploads/image.jpg">';

Categories : PHP

Expand a relative path but not follow any symlink in the path in Python
Not sure that's what you're looking for, but... you can write a function that generate the "logical" full path from the relative path and current working directory then check that the generated path really exists on the system. That function could look like: import os def absolute_path(path): wd = os.getcwd() full = os.path.join(wd, path) parts = full.split(os.sep) kept = [] skip = 0 for part in reversed(parts): if part == '..': skip += 1 elif skip == 0: kept.insert(0, part) else: skip -= 1 return os.sep + os.path.join(*kept)

Categories : Python

Incorrect new Uri (base, relative)
Any link that starts with a / is treated as being in the root of the domain. So first, I'll reformat your code for clarity: href = x.ProductHref.IsUrlAbsolute() ? x.ProductHref : (x.ProductHref.StartsWith("/") || (x.ProductHref.StartsWith(".")) ? x.ProductHref : "/" + x.ProductHref; Reducing this to how it evaluates: href = false ? // Nothing : (false || false) ? // Nothing : "/" + "Product-landscape-chaise_longue_118_it.html"; That produces the URL /Product-landscape-chaise_longue_118_it.html, which starts with a / and so is in the root of your domain. How you fix this is entirely determined by the rest of your code, which you didn't provide, so I can't offer any suggestions.

Categories : C#

API call works in browser, but reports (incorrect?) redirect when called via PHP curl
I feel stupid now, for two reasons: The error that Eugene pointed out, namely that I used the wrong host in my header. I then spent half the day figuring out why authorization failed, read documentation about curl functions and everything. Now I found the error: my password contained a § symbol, and the wrong password was sent only because of encoding. I put a utf8_decode around my password and now it works like a charm. Another mystery solved.

Categories : PHP

compare path and get relative path between two files with javascript
Unfortunately, JavaScript has no native method for doing this. But the path module in node.js has! This code has been taken from the node.js path module source code function relative(from, to) { function trim(arr) { var start = 0; for (; start < arr.length; start++) { if (arr[start] !== '') break; } var end = arr.length - 1; for (; end >= 0; end--) { if (arr[end] !== '') break; } if (start > end) return []; return arr.slice(start, end - start + 1); } var fromParts = trim(from.split('/')); var toParts = trim(to.split('/')); var length = Math.min(fromParts.length, toParts.length); var samePartsLength = length; for (var i = 0; i < length; i++) { if (fromParts[i] !== toParts[i]) {

Categories : Javascript

asp.net MVC saving relative path in database as not the full path
If your question is "How to save as full path", please try this string path = Path.Combine(Server.MapPath("~/Content/img/Company/LogoFiles"), filename); If your question is "How to save as relative path", please try this [HttpPost] public ActionResult Save(HttpPostedFileBase myFile) { string filename = myFile.FileName; string relativeFileName = "~/Content/Uploads/" + filename;// relative path return View(); }

Categories : Sql Server

Combine an absolute path with a relative path
Try this: string abs = "X:/A/B/Q"; string rel = "../../B/W"; var path = Path.GetFullPath(Path.Combine(abs,rel)); It will give you full absolute path http://msdn.microsoft.com/en-us/library/system.io.path.getfullpath.aspx

Categories : C#

How to convert Relative Path into absolute path in c#
try like HostingEnvironment string logDirectory = HostingEnvironment.MapPath("~") + "\" + "App_Data\MakeMyBill.sdf"; or string logDirectory =Server.MapPath("~/App_Data/MakeMyBill.sdf") or on any folder string filePath = @"D:file"; string directoryName = Path.GetDirectoryName(filePath); filePath = directoryName + @"file.xml";

Categories : Asp Net Mvc

Incorrect base URL for Backbone DELETE requests - uses relative instead of absolute URLs
I found a solution, though I'm not entirely happy with it: deleteclient: function () { if (confirm('Are you sure you wish to delete this client?')) { // Destroy the model this.model.destroy({ url: baseUrl + 'client/' + this.model.get('id') + '/' }); // Remove the view this.remove(); } } Basically, if I explicitly pass through the URL to destroy(), that does the trick. It's a little annoying that I can't find a more DRY way to do this, so I'm open to any other method of doing the same thing.

Categories : Django

In php how to replace relative path to absolute path for images and download that php file as a doc file?
You can use html <base> (inside head section) tag and set "root" for your images. For example: <head> .. <base href="http://yourdomain.com/optional_base_folder_to_all_images/" /> .. </head>

Categories : PHP

How do I create an absolute file path from a QDir and a relative file path?
You can use QFileInfo for that, use the constructor that takes a QDir and a QString, then call absoluteFilePath or canonicalFilePath depending on what you want exactly. QDir dir; // ... QString file; // ... QFileInfo fi(dir, file); QString canonical = fi.canonicalFilePath();

Categories : C++

Which relative path is necessary
If running the program from the package root (src) and using FileReader as mentioned, you would use simply "META-INF/example.xml". Modify this path as appropriate if the working directory is different.

Categories : Java

Relative path in c#
List<string> paths = new List<string>() { @"C:usersMyPcUsersDataUsers", @"C:usersMyPcUsersDataUsersData", @"C:usersMyPcUsersDataUsersDataAnagraphics", @"C:usersMyPcUsersDataWork" }; var MatchingChars = from len in Enumerable.Range(0, paths.Min(s => s.Length)).Reverse() let possibleMatch = paths.First().Substring(0, len) where paths.All(f => f.StartsWith(possibleMatch)) select possibleMatch; var LongestDir = Path.GetDirectoryName(MatchingChars.First()); var ftpPaths = paths.Select(p=>Path.Combine("myftp:8008",p.Substring(LongestDir.Length +1)).Replace(@"", "/")); ftpPaths : myftp:8008/Users myftp:8008/Users/Data myftp:8008/Users/Data/Anagraphics myftp:8008/Work To Find the common file path from list of paths I used one of answer of thi

Categories : C#

PHP include relative path
While I appreciate you believe absolute paths is not an option, it is a better option than relative paths and updating the PHP include path. Use absolute paths with an constant you can set based on environment. if (is_production()) { define('ROOT_PATH', '/some/production/path'); } else { define('ROOT_PATH', '/root'); } include ROOT_PATH . '/connect.php'; As commented, ROOT_PATH could also be derived from the current path, $_SERVER['DOCUMENT_ROOT'], etc.

Categories : PHP

Relative path for images
If your image folder is path is like this : www.mydomain.com/news/images/ and your articles are in : www.mydomain.com/news/article then you have to write your path like this in the article: <p>this is my image<img src="../images/myimg.png"></p> I suggest you to place your image folder like this: www.mydomain.com/images/ Then you will be able to use the same path across all your pages like this: <p>this is my image<img src="/images/myimg.png"></p>

Categories : PHP

Relative path in InputStream
You are on the way. The method ClassLoader.getResource returns a URL object. Your System.out.println statement prints out this URL. You can see the URL protocol "file:". Problem: The File constructor does not expect a URL, but just the path to the file. This is the reason, why the FileInputStream cannot find the file. Solution: You do not need to create an InputStream yourself. Just use URL.openStream for that. Or even better: Ask the class loader for it with ClassLoader.getResourceAsStream. Example: String path = "res/" + sfilename + ".xlsx"; URL resURL = getClass().getClassLoader().getResource(path); try (InputStream inputStream = resURL.openStream()) { ... } Or: String path = "res/" + sfilename + ".xlsx"; try (InputStream inputStream = getClass().getClassLoader().getResource

Categories : Java

relative path of excel for c#
To get a filepath relative to the currently executing exe, you can use the following: string exeDir = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); Excel.Workbook wkbook = exapp.Workbooks.Open(System.IO.Path.Combine(exeDir, "test.xlsx"));

Categories : C#

Possible to make path relative in WEB-INF/web.xml?
If you make it a relative path, and use new File(path) to access the directory, it will be relative to the directory from which your container is started. You can do it, but except for making it more difficult to know where the files are actually stored, and for risking to look at the wrong place because the container is started from elsewhere, I don't really see the point. If waht you plan to do is storing the uploaded files in the directory of the deployed webapp, then you should definitely not do that, as a redeploy of the webapp will remove all the uploaded files. Treat the webapp directory as read-only.

Categories : Java

ASP MVC Relative URL Path(not file)
Do this: var urlHelper = new UrlHelper(Request.RequestContext); string url = Request.Url.GetLeftPart(UriPartial.Authority) + urlHelper.Action("ViewReport", new { userId = UserName, reportId = PI.ElementAt(i).TempUserID }); Or, if you prefer not to use the UrlHelper.Action, you do it like this: string url = Request.Url.GetLeftPart(UriPartial.Authority) + "/ViewReport...";

Categories : Asp Net Mvc

How to set relative path to a "a href"?
Try location.hostname+location.pathname+your_relative_path This will give you a combination of the path to your current page (minus the actual file name if there was one in the url) with your relative address in your_relative_path. So, something like http://www.mypage.com/contents/level1/en-us/page2/../../test.html would be the result in the end.

Categories : Javascript

default URL vs Javascript relative path
Pagination with get parameters By default, all parameters in CakePHP are named parameters (url fragments like /foo:bar/). This also applies, by default, to pagination arguments. To use get arguments for pagination params - you can do that by setting appropriate config: public $paginate = array( 'paramType' => 'querystring' ); This will generate urls of the form: /the/url?page=1&limit=10 Instead of: /the/url/page:1/limit:10 Specifying urls as string is extremely fragile Previously you mentioned using urls like get_backend_requests in javascript. You will still find problems if you do that even using get arguments of pagination. That's because even for the "same" url, the result can be different: /the/url => /the/get_backend_requests /the/url/ => /the/url/get_

Categories : PHP

Jquery relative and absolute path
The way JavaScript works it that it loads from the file it was called from and now the file it was written in. In order to do what you need you need to supply the relative path from the current page you're viewing. Example: If current page is http://www.domain.com then you'll need to do: $("#test").load("wp-content/includes/mytheme/index_loader.php"); If current page is http://www.domain.com/wp-content/index.php then you'll need to do: $("#test").load("includes/mytheme/index_loader.php"); As a side note CSS is not the same way and CSS the relative path is based on the file it's written in.

Categories : Javascript

Convert relative path to full URL
You can use the Uri Class to combine an absolute URI and a relative path: Uri absolute = new Uri("http://redrocksoftware.com.au/"); Uri result = new Uri(absolute, "/PDF/MyFile.pdf"); // result == {http://redrocksoftware.com.au/PDF/MyFile.pdf}

Categories : C#

How would I resolve a relative path in Objective-C?
Your example paths fall into two groups: tilde paths and "dot" paths. For tilde paths you must expand them in your code, the tilde is not recognised by the file system but is a shorthand introduced by command line interpreters (aka "shells", CLI). To do the expansion you can use methods such as stringByExpandingTildeInPath. The "dot" paths are different, the "." and ".." directory entries exist as part of the file system and paths containing them work. However, a path starting with "." or ".." is taken as relative to the current working directory (CWD). While the CWD is obvious for a CLI it is less obvious what it might be set to for a GUI application - which means those such paths work they probably don't reference what you expect they do after a GUI app is launched. However you can se

Categories : Objective C

Root relative path in MVC4 without @URL
I created a very simple MVC Controller to expose Routes that you need to access from javascript. You can find it at my GitHub -> https://github.com/tucaz/JSRouteController

Categories : C#

Get relative path to file within project in JNI
The jni folder is not added to your APK. If you want files to be bundled with your application, I'd suggest putting them in the assets folder. If the assets folder doesn't already exist, place it at the same level as the jni folder (so they are siblings). If you take this approach you will have to use the Asset Manager. This has a native interface, found in android/asset_manager.h. To open your file use: AAsset *a = AAssetManager_open(pAssetManager, "file.txt", AASSET_MODE_BUFFER); if (a) { const void *res = AAsset_getBuffer(a); //do something with the file! AAsset_close(a); } There are different flags you can pass in instead of AASSET_MODE_BUFFER.

Categories : Java

Liferay portlet and relative path
First of all, "The Portlet Constructor" is not "=init phase", init() is "init phase". Further, be aware that nobody guarantees that getRealPath actually returns a meaningful value - see its javadoc. The message that you give in the exception suggests that your init() code should first call super.init() and then assume that the framework did set up the portletContext.

Categories : Java

Shortcuts changing the relative path?
I am not in a position to propose a direct solution for your specific problem. On the other hand, I have had some paths/relative-reference problems in the past when working with different Windows installer packages which I solved by running a program passing all the required information to the installer. Example of what I mean: A small program is executed right before starting the installation. It retrieves all the required information (e.g., desktop's path) and writes it to a temporary location (e.g., Windows Registry). The main installation package is started, reads/deletes the information from the temporary location and brings it into account while performing the installation (e.g., path for the shortcuts). Depending upon the available setup options, you might perform the aforement

Categories : C#

How to set relative path to script from ascx
Try including the full path to the resource files, as per the instructions on the Masonry getting started documentation: Include the Masonry script in your site. <script src="/path/to/masonry.pkgd.min.js"></script> For example: <script src="/desktopmodules/com.demo.masonry/Scripts/jquery.infinitescroll.min.js"></script> <script src="/desktopmodules/com.demo.masonry/Scripts/masonry.pkgd.js"></script> <script src="/desktopmodules/com.demo.masonry/Scripts/imagesloaded.js"></script>

Categories : C#

Relative or Absolute path not opening
Try this to avoid ambiguity dirname(__FILE__) OR if you're using PHP 5.3 or higher use this -> __DIR__ . Usage - require dirname(__FILE__) . '/../../filename.php'; OR - require __DIR__ . '/../../../filename.php'; more from manuals - http://php.net/manual/en/language.constants.predefined.php

Categories : PHP

How to get a relative path in a web.config file
You are using in your path string but thats the symbol for literal. So any char following the will be inturpreted as a literal like . is not a valid char. You actualy want the literal the sequence for which is \ Also @ infront of a string tells that you dont want literals. So mappath(" needs to be mappath(@" or every needs to become \

Categories : C#

Relative path for sdcard images
Don't use hard code paths. Use Environment.getExternalStorageDirectory() private File[] listFile; ArrayList<String> f = new ArrayList<String>(); public void getFromSdcard() { File file= new File(android.os.Environment.getExternalStorageDirectory(),"Images"); if (file.isDirectory()) { listFile = file.listFiles(); for (int i = 0; i < listFile.length; i++) { f.add(listFile[i].getAbsolutePath()); } } } Add permission in manifest file <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> Suppose your folder contains other files. String Patternjpg = ".jpg"; for(int i = 0; i < lis

Categories : Android

Flex with AMFPHP, in PHP relative path
Best practice is to use absolute paths, not relative. How about replacing $ConfigPathToWsdl by something like dirname(FILE) . '/../wsdl' ? Note it's FILE surrounded by double underscores, as shown here in the comments here http://php.net/manual/en/function.dirname.php

Categories : PHP



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.