path

Java: Path vs File

让人想犯罪 __ 提交于 2019-12-17 05:37:50
问题 For new applications written in Java 7, is there any reason to use a java.io.File object any more or can we consider it deprecated? I believe a java.nio.file.Path can do everything a java.io.File can do and more. 回答1: Long story short: java.io.File will most likely never be deprecated / unsupported. That said, java.nio.file.Path is part of the more modern java.nio.file lib, and does everything java.io.File can, but generally in a better way, and more. For new projects, use Path . And if you

Learning Ant path style

给你一囗甜甜゛ 提交于 2019-12-17 05:36:27
问题 Where can I find resources to learn Ant path style conventions? I've gone to the Ant site itself, but couldn't find any information on path styles. 回答1: Ant-style path patterns matching in spring-framework: The mapping matches URLs using the following rules: ? matches one character * matches zero or more characters ** matches zero or more 'directories' in a path {spring:[a-z]+} matches the regexp [a-z]+ as a path variable named "spring" Some examples: com/t?st.jsp - matches com/test.jsp but

How do I set $PATH such that `ssh user@host command` works?

拜拜、爱过 提交于 2019-12-17 05:34:06
问题 I can't seem to set a new $PATH such that it is used when executing commands via ssh user@host command . I have tried adding export PATH=$PATH:$HOME/new_path to ~/.bashrc and ~/.profile on the remote machine, but executing ssh user@host "echo \$PATH" shows that the change has not been picked up (it shows /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games). The remote machine is running Ubuntu 8.04. I'm sure I could hack it into /etc/profile, but that's not a clean

Where does Chrome store extensions?

戏子无情 提交于 2019-12-17 05:32:31
问题 I looked in: C:\Documents and Settings\username\Local Settings\Application Data\Google\Chrome\User Data\Default\Extensions for unpacked extensions, but that folder is empty for me. For newer versions, where does Chrome store the files? 回答1: Storage Location for Unpacked Extensions Extension engine does not explicitly change their location or add a reference to its local paths, they are left in the place where there are selected from in all Operating Systems . Ex: If i load a unpacked

Adding the current directory to Windows path permanently

大憨熊 提交于 2019-12-17 05:15:11
问题 I am trying to add the current directory (from a command-line) to Windows path permanently, but I am having serious problems implementing this. My initial attempt was: set PATH=%PATH%;%cd% However, this only works in the current session; as soon as I close the command-line window, the PATH environment variable retains its previous value. Next, I tried: setx PATH=%PATH%;%cd% This might work in Windows 7 and 8 according to some of the answers that I found here, but in Windows 10, the setx

PHP recursive directory path

廉价感情. 提交于 2019-12-17 05:11:23
问题 i have this function to return the full directory tree : function getDirectory( $path = '.', $level = 0 ){ $ignore = array( 'cgi-bin', '.', '..' ); // Directories to ignore when listing output. Many hosts // will deny PHP access to the cgi-bin. $dh = @opendir( $path ); // Open the directory to the handle $dh while( false !== ( $file = readdir( $dh ) ) ){ // Loop through the directory if( !in_array( $file, $ignore ) ){ // Check that this file is not to be ignored $spaces = str_repeat( ' ', (

Regex Last occurrence?

妖精的绣舞 提交于 2019-12-17 04:53:38
问题 I'm trying to catch the last part after the last backslash I need the \Web_ERP_Assistant (with the \ ) My idea was : C:\Projects\Ensure_Solution\Assistance\App_WebReferences\Web_ERP_WebService\Web_ERP_Assistant \\.+?(?!\\) // I know there is something with negative look -ahead `(?!\\)` But I can't find it. [Regexer Demo] 回答1: Your negative lookahead solution would e.g. be this: \\(?:.(?!\\))+$ See it here on Regexr 回答2: One that worked for me was: .+(\\.+)$ Try it online! Explanation: .+ -

PHP exec $PATH variable missing elements

纵然是瞬间 提交于 2019-12-17 04:34:36
问题 When I echo $PATH on my command line, it returns /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Applications/MAMP/Library/bin:/usr/local/git/bin:/usr/X11/bin When I execute this php code exec('echo $PATH; whoami; less /etc/paths; 2>&1') I get string 'echo $PATH; whoami; less /etc/paths; 2>&1' (length=56) array 0 => string '/usr/bin:/bin:/usr/sbin:/sbin' (length=29) 1 => string 'eric' (length=4) 2 => string '/usr/bin' (length=8) 3 => string '/bin' (length=4) 4 => string '/usr

Android path to asset txt file

落花浮王杯 提交于 2019-12-17 04:32:25
问题 I'm doing: FileReader fin = new FileReader("file:///android_asset/myFile.txt"); in an Android project and many variations. At runtime I get a file not found exception. The file is present and correct in the assets folder, so my path must be wrong. What is the absolute path I need here? 回答1: AssetFileDescriptor descriptor = getAssets().openFd("myfile.txt"); FileReader reader = new FileReader(descriptor.getFileDescriptor()); Try using the above with FileDescriptors. Seems to be the most

Check whether a path is valid

China☆狼群 提交于 2019-12-17 04:27:15
问题 I am just wondering: I am looking for a way to validate if a given path is valid. (Note: I do not want to check if a file is existing! I only want to proof the validity of the path - So if a file could possibly exists at the location) . Problem is, I can't find anything in the .Net API. Due to the many formats and locations that Windows supports, I'd rather use something MS-native. Since the function should be able to check against: Relative Paths (./) Absolute Paths (c:\tmp) UNC-Pathes (