w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
System.IO.IOException: "The file exists" when using System.IO.Path.GetTempFileName() - resolutions?
As Sayse suggested, you might try setting the %TEMP% environment variable when your app launches. Environment.SetEnvironmentVariable("TEMP", "<dir>");

Categories : C#

Why can I run this file packaged by Maven by specifying the path as argument but not by setting the path permanently in my path variable?
You'll need to add the storm dependencies to your classpath - it's currently not included because it is marked as 'provided' in the m2-pom.xml, change it to 'compile': <dependency> <groupId>storm</groupId> <artifactId>storm</artifactId> <version>0.8.2</version> <scope>compile</scope> </dependency>

Categories : Java

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

The Widest Path Challenge - the most efficient way for finding path in Maximal Spanning Tree
Use the set to construct a Subgraph object. Subclass DepthFirstIterator so that encounterVertex puts an entry with key v and value (whatever the other endpoint of e is) into a map p. Search depth-first from the sink. Recover the path by initializing v to be the source and looking up v, p[v], p[p[v]], etc., until there is no entry. This is a pain, but the library authors baked FibonacciHeap into ClosestFirstIterator, which otherwise would be the class you want. (Heck, if you don't care about another n log n time operation, you could just run Dijkstra on the subgraph.) Kruskal's algorithm functions fine with disconnected graphs. It returns a minimum-weight spanning forest, i.e., for each connected component, a minimum-weight spanning tree. I can't vouch for this particular implementation.

Categories : Algorithm

var di = new DirectoryInfo(path) throws exception until I use Windows Explorer to open the path for a first time
Since you said it's happening on network folders, my first inclination is that the windows process that this app is running under doesn't have security access to read the directory info. When the user browses to this folder, the security is authenticated, and so your app can now read it. Does the app work if Root is a local folder?

Categories : C#

PHP: fopen path for `include`d script using Apache Document Root when full path is specified?
If the Path starts with / It will point to the root Filesystem which is fine with CLI but CGI would understand it this way: /home/jweinberger/com.example/logs/script1.log//home/jweinberger/logs/script1.log You should use the index 'DOCUMENT_ROOT' from the $_SERVER array. fopen($_SERVER['DOCUMENT_ROOT'].'/home/jweinberger/logs/script1.log')

Categories : PHP

path smooth algorithm for astar path planning based on quad tree
haha,I find the method for the difference size path smooth. Just use the funnel algorithm too, but there is a difference: when add left and right point for two quads, find one intersection side, and sort the four points(a0, a1, b0, b1) like ([x, y0], [x, y1], [x, y2], [x, y3], and y0 <= y1 <= y2 <= y3) , and use the two points [x, y1], [x, y2].

Categories : Misc

Need help creating reg-ex expression to rewrite path and filename using information in original path and file name
Enable mod_rewrite and .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory: Options +FollowSymLinks -MultiViews # Turn mod_rewrite on RewriteEngine On RewriteBase / RewriteRule ^(ImageFolio4_files)/1/([^/]+)/((?!AM|tn_)[^.]+.jpg)$ /$1/cache/images/~$2~$3 [L,R=302,NC] Once you verify it is working fine, replace R=302 to R=301. Avoid using R=301 (Permanent Redirect) while testing your mod_rewrite rules.

Categories : Regex

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

os.path.join() and os.path.normpath() both add double backwards slash on windows
'static\css\reset.css' is the representation of the string r'staticcss eset.css'. The double backsalsh indicates escaping of the backslash - in string literals it has a meaning of "do something special with the next character", which you don't want here. >>> print('static\css\reset.css') staticcss eset.css

Categories : Python

Replace part of a path which has multiple occurrences into full path name by a string
1st solution: change batch code and call file #: @echo off &setlocal enabledelayedexpansion set mypath="D:android-sdkandroid-sdk-windows#workspace" SET "mypath=!mypath:%~1=*!" echo %mypath% "D:android-sdkandroid-sdk-windows*workspace" 2nd solution: use sed @echo off &setlocal set "mypath=D:android-sdkandroid-sdk-windowsKworkspace" for /f %%i in ('echo(%mypath%^|sed s/%~1/*/') do set "mypath=%%i" echo %mypath% "D:android-sdkandroid-sdk-windows*workspace"

Categories : Batch File

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

Java - replace all instances of path separators with system path separator
It is documented in the Javadoc: Note that backslashes () and dollar signs ($) in the replacement string may cause the results to be different than if it were being treated as a literal replacement string; see Matcher.replaceAll. Use Matcher.quoteReplacement(java.lang.String) to suppress the special meaning of these characters, if desired. So you can try this: String replaced = path.replaceAll("[/\\]+", Matcher.quoteReplacement(System. getProperty("file.separator")));

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

StreamReader Server.MapPath - Physical path given, virtual path expected
MapPath translates paths starting from ~ to full local path. Does not look like you need it in your code. If the file is supposed to be at fixed place all the time, open in directly by full path. If it is relative to site root, then use something like Server.MapPath("~/status.txt")

Categories : C#

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

How to make $_SERVER['DOCUMENT_ROOT'] reference to alias directory path and NOT wamp default path?
I think you would be better creating a Virtual host for each of your projects. HowTo setup Virtual Hosts

Categories : Apache

How do I convert a double slashed path to a path that open() accepts?
The double slashes are not the problem here. It is the carriage return character at the end that is causing you problems. String it from the path: fp = open(path.strip(), 'rb') Python is merely showing a string literal representation of your path string, for ease of debugging. Any character with special meaning, outside of the printable ASCII range, is escaped, including backslashes. The value itself does not have doubled backslashes: >>> path = 'F:\Music\v flac\1-06 No Quarter.flac ' >>> path 'F:\Music\v flac\1-06 No Quarter.flac ' >>> print path F:Musicv flac1-06 No Quarter.flac >>> path[:3] 'F:\' >>> len(path[:3]) 3 Note how printing path shows the path value having only single backslashes and how the first 3 characters of the path a

Categories : Python

Match last path element using JaxRS @Path annotation in Jersey
The best solution I've found is to manually detect when the second method is matching the last path element and manually delegate to the first. @Path("{name}") public Object getNamedResource(@Context UriInfo uriInfo) { boolean lastElement = uriInfo.getMatchedURIs() .iterator().next().equals(uriInfo.getPath()); if (lastElement && "data".equals(name)) { return getDataResource(uriInfo); } ... } Not a bad solution to my particular problem, but I'm still frustrated that Jersey is escaping my pattern without asking me first.

Categories : Java

Java Mac create new File(path) - path with german umlauts
I don't know how Mac OS will treat umlauts in the file system. But if the directory could be handled correctly out of the JVM it has to work in it, too. So try to list the name of the directory trough a listFiles() one level above: File d = new File("/Volume/dir1/dir2/"); for( File f : d.listFiles()) System.out.println(f.getName()); So you will see how the String has to look like for opening the file (also it really exists and is accessible from the VM); SOLUTION: File.listFiles() mangles unicode names with JDK 6 (Unicode Normalization issues)

Categories : Java

Regular expressions for Windows based file path and UNC path
Why no simply use Test-Path with -IsValid parameter? Adding to davor's suggestion...here is a link to some examples: http://technet.microsoft.com/en-us/library/ff730955.aspx

Categories : C#

vim autocompletes wrong path when executing external script in a different path
Try executing: export PATH="~/Dropbox/Work/Scripts:$PATH" which will add it as the first place to look for the script. Then you'll see if the "k/Scripts/PythonTidy.py" is in the PATH prior, and thus found first by vim.

Categories : Vim

How do i open a file from different path(not the server default path) using file_put_content in php
When placing files on your computer you can either use relative or absolute path like this: // absolute path $file = "C:/temp/test.txt"; // relative path from C:/Program Files/wamp/htdocs/index.php $file = "../../temp/test.txt"; Both of those files point to the same place

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

PHP: Does file_exists($path) check sub directory of $path ? how computationally intensive it is?
I'm not sure if you mean does file_exists($path) check subdirectories of path or if it checks subdirectories of the current working directory for path. In either case the answer is no. $path is taken simply as a path and the method confirms whether or not that file/directory exists.

Categories : PHP

POSIX path in applescript from list not opening. Raw path works
Not sure what is going on there, i agree it's confusing. An alternate is to use the shell 'open' command instead. repeat with filePath in FilesList do shell script "open " & quoted form of filePath end repeat The shell seems more happy with POSIX paths, the trick is to send in the 'quoted form' of your POSIX paths. -- EDIT: Putting into a var first works too. repeat with theFiles in FilesList set f to POSIX file theFiles tell application "Finder" to open f end repeat It seems the Finder is causing the coercion to POSIX file problem.

Categories : String

binding with path doesn't work when first item on path is null
There are small differences between the binding paths/calculation for MvvmCross versus Xaml. In particular, we know FallbackValue is interpreted and used differently. This different behaviour: occurs on line MvxFullBinding.cs#L109 is logged in https://github.com/slodge/MvvmCross/issues/297. If you have additional test cases to add to that list, then please upload them as GitHub repos and link them to that case. (But don't expect 'very quick' changes/fixes to that binding code - as changing it could break a lot of apps that now rely on it and as MvxValueConverters are often built to be much more type specific than traditional Microsoft IValueConverter ones) In the meantime, for this particular case: a FallbackValue may work for you as a workaround (but may be an enum fallback va

Categories : Android

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

404 redirect works but changes rewritten URL path in browser to full URL path
You need to add conditions before each of your rewrites to ensure you're not blindly rewriting into a file that doesn't exist. Mainly, the 4 rules at the end need to have some conditions: RewriteCond %{REQUEST_URI} ^/([A-Za-z0-9_-]+)/?$ RewriteCond %{DOCUMENT_ROOT}/pages/%1/%1.php -f RewriteRule ^ pages/%1/%1.php [NC,L] The first condition creates a grouping which is backreferenced using %1. The second condition creates a path that you are trying to rewrite to and checks if that file exists using -f. Same thing for the others: RewriteCond %{REQUEST_URI} ^/([A-Za-z0-9_-]+)/([A-Za-z0-9_-]+)/?$ RewriteCond %{DOCUMENT_ROOT}/pages/%1/%2/%2.php -f RewriteRule ^ pages/%1/%2/%2.php [NC,L] RewriteCond %{REQUEST_URI} ^/([A-Za-z0-9_-]+)/([A-Za-z0-9_-]+)/([A-Za-z0-9_-]+)/?$ RewriteCond %{DOCUMENT

Categories : Htaccess

Getting error: PKIX path building failed: unable to find valid certification path to requested target
There are two possible sources for this error: either the opposite side is using genuinely untrusted certificate (self-signed or signed by untrusted CA), or the opposite side is not sending certificate validation chain (e.g. there is intermediate signing certificate along the way to your trusted CA, but this ceriticate is not present in the SSL handshake). Solution for the first case is to add the untrusted CA (or the ceriticate itself) to your JRE truststore (${java.home}/lib/security/cacerts) or better - create your own truststore (which will not get removed when upgrading Java) and provide that to your application via javax.net.ssl.trustStore JVM property. Solution for the second case is either to go with the first case solution or better - convince the opposite side to send correc

Categories : Java

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

Regex to transform SVG path to raphael.js path format
Description I would do this in two steps. First gather each of the paths in the string. Second remove the text from each of the strings you don't want retained. First Regex This captures all the attributes from the path without regard for their order in the tag. It also skips over some problematic issues where attribute values may contain strings which look like actual tags. <paths (?=(?:[^>=]|='[^']*'|="[^"]*"|=[^'"][^s>]*)*?sd=('[^']*'|"[^"]*"|[^'"][^s>]*)) (?=(?:[^>=]|='[^']*'|="[^"]*"|=[^'"][^s>]*)*?sid=('[^']*'|"[^"]*"|[^'"][^s>]*)) (?=(?:[^>=]|='[^']*'|="[^"]*"|=[^'"][^s>]*)*?sinkscape:label=('[^']*'|"[^"]*"|[^'"][^s>]*)) Second Regex This will only be applied to the d attribute, and it basically replaces all the spaces decimal portion of each di

Categories : Regex

Add Path / Auto Load Path For Grape API Not Working
If you split api into many files you need mount that parts. See documentation for modules These don't have to be different versions, but may be components of the same API. class APP::API < Grape::API mount APP::Groups mount APP::Users end

Categories : Ruby On Rails

os.path.join in python returns 'wrong' path?
From the os.path.join() documentation: Join one or more path components intelligently. If any component is an absolute path, all previous components (on Windows, including the previous drive letter, if there was one) are thrown away, and joining continues. A / at the start makes /tmp an absolute path. If you wanted to join multiple path elements that perhaps contain a leading path separator, then strip those first: os.path.join(*(elem.lstrip(os.sep) for elem in elements)) Special-casing absolute paths makes it possible for you to specify either a relative path (from a default parent directory) or an absolute path and not have to detect if you have an absolute or relative path when constructing your final value.

Categories : Python

Load image from an UNC path in network and hide the path
I think that your best (and simplest) approach might to be to map a virtual directory using the UNC-type paths you have shown. Then you can address the files in your html in a more 'normal' way (effectively hiding the UNC server name as you've requested). You could, for instance, map UNC \192.168.84.52DistriAffiche to virtual folder images and then reference the image file names from folder images in your html. The following doc describes setting up virtual folders, please note the special instructions for UNC mappings. http://msdn.microsoft.com/en-us/library/bb763173(v=vs.100).aspx

Categories : C#

Get path two directories above the path to current class file
If you create a File from the URL you can call getParentFile() on it: URL fileUrl = Test.class.getProtectionDomain().getCodeSource().getLocation(); File file = new File(fileUrl.toURI); String grandParent = file.getParentFile().getParent(); This should also work: String grandParent = Test.class.getResource("../../").toString();

Categories : Java

Path is drawn again after submit, how to clear previous path?
Make your directionsRenderer global (your original code creates a new one for every directions request): var directionsRenderer = null; function renderDirections(result, address, number) { var myRoute = result.routes[0].legs[0]; for (var i = 0; i < myRoute.steps.length; i++) { } var marker = new google.maps.Marker({ position: myRoute.steps[i - 1].end_point, map: map, icon: "https://maps.gstatic.com/mapfiles/ms2/micons/green-dot.png" }); directionsRenderer = new google.maps.DirectionsRenderer({ map: map, suppressMarkers: true, draggable: true }); markersArray.push(marker); directionsRenderer.setMap(map); //polylineOpts.setMap(map); directionsRenderer.setDirections(result); }

Categories : Javascript

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

Python - Extract folder path from file path
The built-in submodule os.path has a function for that very task. import os os.path.dirname('T:DataDBDesignDBDesign_93_v141b.mdb')

Categories : Python

Shouldn't the library path default to the workspace path?
Just experienced the same problem myself. Here's how to fix the immediate problem:- Right click on your project in Package Explorer on the left (not the class, the main project 'HelloWorldSWT'), and select Properties. Select the Java Build Path on the left, and the Projects tab on the right. Expand org.eclipse.swt.etc Click on Native Library Location, then the Edit button In the popup that appears click on the Workspace button Click on org.eclipse.swt.etc (don't expand just click on it), and click OK. Credit to the Eclipse forum for the answer - would probably have taken me another 3 days to figure this on my own... :-) There may well be a better way to 'fix' this more globally.

Categories : Java



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