w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to convert path to Mac OS X path, the almost-NFD normal form?
Well, decided to write out the Python solution, since the related other question I pointed to was more Objective-C. First you need to install https://pypi.python.org/pypi/pyobjc-core and https://pypi.python.org/pypi/pyobjc-framework-Cocoa. Then following should work: import sys from Foundation import NSString, NSAutoreleasePool def fs_normalize(path): _pool = NSAutoreleasePool.alloc().init() normalized_path = NSString.fileSystemRepresentation(path) upath = unicode(normalized_path, sys.getfilesystemencoding() or 'utf8') return upath if __name__ == '__main__': e = u'xe9' j = u'ufa1b' e_expected = u'eu0301' assert fs_normalize(e) == e_expected assert fs_normalize(j) == j Note that NSString.fileSystemRepresentation() seems to also accept str input. I

Categories : Python

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

While Sending Html Mails from my web application Recieved Mails contains Symbols like &ldquo,&rdquo, ‘
Check with another constructor for htmlView: ContentType mimeType = new System.Net.Mime.ContentType("text/html"); var htmlView = AlternateView.CreateAlternateViewFromString(bodyMessage, mimeType);

Categories : Asp Net Mvc

Converting normal path into uri path so that it can be used for mediametadataretriever?Can a normal path be used as uri?
This code should work: File [] files = ... // your initialized variable MediaMetadataRetriever mmr = new MediaMetadataRetriever(); for (int i = 0; i < files.length; i++) { Uri uri = Uri.fromFile(files[i]); mmr.setDataSource(this, uri); String artist = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ARTIST); // More code, do something with the metadata, etc... } mmr.release();

Categories : Android

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

Convert windows path to web path in asp.net mvc
windowsPath.Replace(Request.ServerVariables["APPL_PHYSICAL_PATH"], String.Empty); Found this at: Absolute path back to web-relative path

Categories : Asp Net

PhoneGap file write to absolute path in windows store / windows 8 apps
By default, the only areas an app can access programmatically are (a) your local, temp, and roaming appdata folders, and (b) any libraries for which you've declared a capability in the manifest. For anything else, you must first acquire the StorageFolder or StorageFile object through a file picker. The use of the file picker is what obtains user consent to access that file or folder. If you acquire access to a file or folder this way, then you should preserve access through the Windows.Storage.AccessCache API for future sessions (for recently used lists and such). Trying to get to anything else (e.g. absolute file paths) will give an access denied exception. The code you show above will do this--if you use the file picker you'd be using either the StorageFile API or a relative path on a

Categories : Cordova

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

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 get absolute path of file depends on windows 32-bit or 64-bit machine
I am not aware of your concern. Just give a try to: request.getServletContext().getRealPath("/") It will give you the context path of your application Root folder regardless of underlying platform and you can add required folder or file's relative path (Relative path from application root folder ) with it to get absolute path.

Categories : Java

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#

Use absolute full path to the img instead of the local path
Try: my_path = "/images/myimage.jpg"; See Why would a developer place a forward slash at the start of each relative path? to understand the function of the forward slash in this context.

Categories : Javascript

How to get path of a file which is in IsolatedStorage?
tile.BackgroundImage = new Uri("isostore:/MyFolder/MyFile.png", UriKind.Absolute); Here's more information about data in WP8: http://msdn.microsoft.com/en-us/library/windowsphone/develop/ff402541(v=vs.105).aspx

Categories : C#

How to get file path from IsolatedStorage for ShareMediaTask
You cannot share from your isolated storage, since access to it is limited to your app only. In your case, you should first save your pictures to the media library (unless they're saved there automatically), and then you should use media library's path, rather than your own. A case very similar to yours is described here in MSDN.

Categories : C#

URL path not working, absolute path does
try to change url 'http://mydomain.com/' by a function function selfURL(){ $server1 = $_SERVER['HTTPS']; $server2 = $_SERVER['SERVER_PROTOCOL']; $server3 = $_SERVER['SERVER_PORT']; $server4 = $_SERVER['SERVER_NAME']; $s = empty($server1) ? '' : ($server1 == "on") ? "s" : ""; $protocol = strleft(strtolower($server2), "/").$s; $port = ($server3 == "80") ? "" : (":".$server3); return $protocol."://".$server4.$port; } function strleft($s1, $s2){ return substr($s1, 0, strpos($s1, $s2)); } print(selfURL()); you can replace '$port' if it not used

Categories : PHP

Delete file in IsolatedStorage on Windows Phone 8
This is a bug in the Windows Phone 8 emulator, some times the aplication lost the permissions of her files in the isolated storage. You must delete the application from emulator, and from the visual studio re-implement the app, and try again.

Categories : C#

Windows phone - C# - Truncating file(s) in IsolatedStorage
If you want to remove the last character you could do the following: writer.BaseStream.SetLength(writer.BaseStream.Length - 1); Additionaly, when opening the file, use FileMode.Open, otherwise whole file will be truncated.

Categories : C#

Windows Phone: how to change the automated navigation path?
Add a event for ValueChanged. Write the event handler like this: private void TimePicker_ValueChanged(object sender, DateTimeValueChangedEventArgs e) { NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative)); }

Categories : C#

Changing the path/filename of SplashScreenImage.jpg in Windows Phone 8
Nope, still the same "problem", splash screens must be placed at root level. However, you can have several splash screens depending on the client's resolution. Check here for more tips on how to create splash screens for your WP apps. http://msdn.microsoft.com/en-us/library/windowsphone/develop/ff769511%28v=vs.105%29.aspx

Categories : C#

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

User files in IsolatedStorage being lost in Windows Phone 8 app
When you do a rebuild in Visual Studio then start debugging, your app will be uninstalled (which will remove all files in iso store) then reinstalled. You don't need to worry when you publish your app to the store. If you deploy an update through the store, your app will be updated (instead of uninstalled then reinstalled) and all files should stay intact.

Categories : C#

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

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++

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#

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

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#

i have set path of ndk-build in windows 8 but still getting error in path?
You need to add Cygwin directory into your PATH too. To add to path right click Computer->Properties->Advanced System Settings-> "Advanced" tab -> Environment Variables

Categories : Java

boost::filesystem::path to QByteArray
There's a path::string() method. So the code would look like this: const QByteArray pathAsArray = QByteArray(path.string().c_str());

Categories : C++

How can I hide file path in server filesystem?
It sounds like you are attempting to implement security through obscurity. It's a bit like hiding your key under the welcome mat rather than investing in an electronic keypad or key safe. This is never the right way to approach web security, or any other security for that matter. Rather than trying to hide file paths you should be focusing on eliminating any vulnerabilities that might present themselves once an attacker has the file path.

Categories : HTML

Filesystem watcher path not working with app.config
In your app.config both settings define "Deirectory1" as key. Replace the second one with "Directory2" and it will work: <?xml version="1.0" encoding="utf-8" ?> <configuration> <appSettings> <add key="Directory1" value="C:Usersd.brockDesktopdir 1"/> <add key="Directory2" value="C:Usersd.brockDesktopdir 2"/> </appSettings> </configuration>

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

Perl recursion through filesystem (without File:Find) follows "top" one path only
When doing recursion, it is important that each level has its own set of variables, and does not change those of upper levels. Take for example this implementation of the factorial, which is: fac(n) = 1 · 2 · 3 · … · n In naïve Perl code, we could write sub fac { $n = shift; return 1 if $n < 2; return $n * fac($n-1); } Output for fac(10) is 1. This is cleary wrong, we expected 1*2*3*4*5*6*7*8*9*10 = 3628800. The problem is that each recursion level assigned to the same $n variable. We have the following call stack: fac(10) $n = 10 fac(9) * $n $n = 9 fac(8) * $n * $n $n = 8 ... fac(1) * $n * $n * $n * $n * $n * $n * $n * $n * $n * $n $n = 1 return 1 So all of that evaluates to 1. Duh. We can give each level a different $n variable by declaring it wit

Categories : Perl

boost::filesystem::path causing memory difference
Due to your second code sample, I would say that boost::filesystem::path is initializing some static internal state (which remains allocated until the end of your program). How can I avoid such problems with unit tests? Create a test initialization method that you execute before getting the first memory checkpoint. Ideally you should be able to customize allocation and deallocation to track (override new/delete, add your custom allocator and so on) but that is more difficult and may not be allowed to do it, depending on the libraries you use. Is initializing such a variable before starting the test a solution? It's a workaround. Not very elegant, but in the end, it is telling you what you want to know. Will I have to do many more such things when using other code? Depend

Categories : C++

filesystem directory_iterator not returning full file path
For full path you need to use start->path().directory_string() directory_iterator end; for (directory_iterator start(p); start != end; ++start) { if (is_directory(start->status())) { //A directory } if (is_regular_file(start->status())) { std::cout << start->path().directory_string()<< " "; } } Play around with following based on your need, refer boost docs for more details, however names their suggest all. start->path().branch_path(); start->path().directory_string(); start->path().file_string(); start->path().root_path(); start->path().parent_path(); start->path().string(); start->path().basename(); start->path().filename(); start->path().root_name(); start->path().relative_path(

Categories : C++

Git SVN Ignoring error from SVN, path probably does not exist: (160013): Filesystem has no item
You really can't do it that way. git svn requires that you have a linear history (ok, git doesn't; svn itself does). So all of your git work must end up on the end of the commit-tree for svn. The right thing to do is use git svn clone first to mirror the remote repository and then make commits to that checked out version and run git dcommit. Yes, there are other ways to do this, but the way you are doing it above makes a commit before pulling in the remote content, which won't work. If you're just trying to add all your existing changes to the version from the remote, you can probably do it this way: # git init # git checkout -b "mychanges" # git checkout master # git svn init .... # git svn fetch # git checkout mychanges # git rebase master # git checkout master # git merge --ff-onl

Categories : Misc

Extending on boost::filesystem::path and overloading assignment operator
The compiler is telling you what you need: 'operator=' (operand types are 'std::back_insert_iterator<std::list<MyPath> >' and 'boost::filesystem::directory_entry') So you need to implement one more method (at least).

Categories : C++

Absolute path for URL
This kind of url can be written using {{ path() }}. For example: <a href="{{ path('profile-change-password') }}"> Change password </a> http://symfony.com/doc/current/book/routing.html#generating-urls-from-a-template

Categories : Symfony2

Getting absolute path jsf
ExternalContext#getRealPath() returns the path relative to where the webapp is been deployed, not where the webapp is been developed orso, as you incorrectly seemed to expect. But, the variable name pathToSave indicates a much bigger problem: you seem to intend to save files in there. This is a bad idea for the reasons mentioned in the following answer: Uploaded image only available after refreshing the page. In a nutshell, save them to a fixed local disk file system path instead. Note that some servers offer ways to make this step easier configurable, e.g. JBoss. Just stop using getRealPath(). You never need it in real world. In the 10 years I developed Java web applications (it's under the covers coming from ServletContext#getRealPath()), that method was never been useful for anything.

Categories : Java

Different sys.path between pypy and normal python
I think you're expecting any module installed for CPython to work with PyPy out of the box. That's not the case. It's the same when you upgrade from CPython 2.6 to CPython 2.7: the modules you have already installed for 2.6 are not automatically available for 2.7, and must be re-installed. Similarly, you must re-install the modules for PyPy. This said, the standard pygame doesn't work too well with PyPy, but stay tuned; it seems someone is working on a version of pygame based on cffi, which should work very well with PyPy.

Categories : Python

Absolute path and testing with IIS
Using MVC, use @Url.Content(...). <img src="@Url.Content("~/Content/Images/example.png")" /> The Url.Content() method will figure out where your application lies under the IIS root and adjust the links accordingly: /Content/Images/example.png or /SomeVirtualPath/Content/Images/example.png You can use this for any URl you need (css files, javascript files, images, etc.)

Categories : Dotnet



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