w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
The Command-T how to use current file own NERDTree bookmark as search directory?
Completely disregarding NERDTree, you can configure your CommandT mapping to include your project root by default. To make it flexible, you can load the project root for each vim session dynamically from an environment variable: "If the $H environment variable is available, assume it contains CommandT's root dir if !empty($H) nnoremap <silent> <Leader>t :CommandT $H<CR> else nnoremap <silent> <Leader>t :CommandT<CR> endif Or more simply, you could use $PWD, which should reflect the directory you started your vim session in. Regarding the solution you propose, you can indeed cd in NERDTree by position the cursor on the node you want to cd to and then pressing cd (see :h NERDTree-cd). That changes the output of :pwd/:!pwd for the NERDTree buffer an

Categories : Vim

How to change the current working directory to a specific directory and execute a program under the specific directory?
One of your principal problems is that you don't capture the return value (output) of the command in backticks. You are merely throwing away the output you want. Do something like: my $output = `perl ./script.pl` system("perl ./script.pl")

Categories : Perl

How to backup and restore python current working environment?
You should take a look on pickle documentation. You also have an example that can help you to do what you're thinking on.

Categories : Python

Python joining current directory and parent directory with os.path.join
You can use normpath, realpath or abspath: import os goal_dir = os.path.join(os.getcwd(), "../../my_dir") print goal_dir # prints C:/here/I/am/../../my_dir print os.path.normpath(goal_dir) # prints C:/here/my_dir print os.path.realpath(goal_dir) # prints C:/here/my_dir print os.path.abspath(goal_dir) # prints C:/here/my_dir

Categories : Python

After I deleted a directory, it always prompts "shell-init error retrieving current directory getcwd solve" when log on bash
When opening a new shell or xterm, it's started in the working directory of the process that started it. If you e.g. cd /proc && xterm, the new terminal will place you in /proc. Whatever's starting your terminal had positioned itself in /home/desktop/zeno, and now all the terminals are trying to start there. If you make that process change directory (by rebooting, for example), the terminals will start in a directory that exists and you will no longer get this error.

Categories : Linux

Store current SAS title, change it temporarily, and restore it at end of macro
It seems like instead of first setting the title and then trying to create a macro variable from it, you'd be better off first setting a macro variable (or multiple if there are several different titles you'll want to use repeatedly), then using that in the title statement, like this: %let title_text = "This is my pre-macro title"; /* Set title first time. */ title "&title_text"; /* Call macro. */ %xl; /* Restore title. */ title "&title_text";

Categories : Sas

Windows Azure Active Directory Backup/Restore
You could consider using some of the Windows Azure Active Directory PowerShell Cmdlets to save your configuration. The various Get- Cmdlets (see http://technet.microsoft.com/en-us/library/jj151815.aspx) should allow you to save all your configuration settings, users, roles, etc.

Categories : Azure

How to print the name of my current directory's parent directory
You can use ${PWD%/*}: $ echo $PWD /home/me/test/t $ echo ${PWD%/*} /home/me/test As the expression ${string%substring} Strips shortest match of $substring from back of $string (reference).

Categories : Shell

Get the current directory name via php script in another directory
I am not 100% sure of your questions, but it sounds like you are looking for the URL/Directory of the page you are currently on, not the directory of the header? What about: $_SERVER['PHP_SELF']; $_SERVER['REQUEST_URI']; $_SERVER['SCRIPT_NAME']; $_SERVER['SCRIPT_FILENAME']; $_SERVER['DOCUMENT_ROOT']; Those all give info about the current file open by the server based on the HTTP request it received.

Categories : PHP

Press back button current fragment persist not restore previous fragment
You can see my solution here. I have a ViewPager with three pages which contains Fragments. In first page, I have a ListFragment and onListItemClick I replace that Fragment with another one. When Back Button is pressed, I go back to ListFragment.

Categories : Java

How do I obtain and use the current directory of the exe?
Use: File.Copy(SelFolder & "Resource.zip", progDirectory) Instead of: My.Computer.FileSystem.WriteAllBytes(SelFolder & "Resource.zip", progDirectory, False)

Categories : Dotnet

iOS - dirent.h - current directory name
See `NSFileManager as it provides the standard iOS interface to the filesystem. https://developer.apple.com/library/ios/DOCUMENTATION/Cocoa/Reference/Foundation/Classes/NSFileManager_Class/Reference/Reference.html As well, you should understand this thoroughly. https://developer.apple.com/library/ios/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/FileSystemProgrammingGuide.pdf (See the iOS section)

Categories : IOS

Get current batchfile directory
System read-only variable %CD% keeps the path of the caller of the batch, not the batch file location. You can get the name of the batch script itself as typed by the user with %0 (e.g. scriptsmybatch.bat). Parameter extensions can be applied to this so %~dp0 will return the Drive and Path to the batch script (e.g. W:scripts) and %~f0 will return the full pathname (e.g. W:scriptsmybatch.cmd). You can refer to other files in the same folder as the batch script by using this syntax: CALL %0..SecondBatch.cmd This can even be used in a subroutine, Echo %0 will give the call label but, echo "%~nx0" will give you the filename of the batch script. When the %0 variable is expanded, the result is enclosed in quotation marks. More on batch parameters.

Categories : Batch File

jQuery/JS: Get current URL parent directory
Fiddle var a = "http://www.site.com/example/index.html"; var b = a.substring(0, a.lastIndexOf('/'))+"/";

Categories : Javascript

NPM Installs Package Outside Current Directory
If the node_modules directory doesn't exist in your current directory, NPM will look for it in the higher directories until it finds it. So, if the parent directory has a node_modules directory, NPM will assume that's where it is to install modules. A quick way around this is to create an empty node_modules directory where you want the modules to be placed.

Categories : Node Js

How to Keep Ace from Looking for Themes and Modes in Current Directory?
I find with Ace and MVC Bundling and Minification, I need to set the basePath in the ace configuration using an absolute reference. ace.config.set("basePath", "/Scripts/FullPathToMy/AceEditorDirectory"); It's probably not the best solution, but it should get you on your way.

Categories : C#

log4j.xml in current directory not found
For Eclipse testing in Maven the easiest thing I've found to do is to put the log4j.xml in src/test/resources. It will be added to the classpath when running unit tests, etc. When we actually install our application at a customer site we place the file in /etc/... and specify it with -Dlog4j.configuration. My best guess as to why the current directory part isn't working for you is that Eclipse is probably setting the current directory to something other than what you think it is. Try following the instructions here to print the current working directory and check it matches what you think. UPDATE: Almost forgot. When you specify -jar the classpath options (-cp -classpath) are ignored. -jar Execute a program encapsulated in a JAR file. The first argument is the name of a J

Categories : Java

What is the difference between these ways of getting current directory?
They all give the same result They certainly don’t. currentDir and dir both give you the current working directory – i.e. by default the directory your executable was run from (but it can be changed during the execution). By contrast, appBaseDir and path get the directory which contains the executing assembly’s file. To illustrate how they differ, consider that you have an executable which sits in C:araz.exe. Now I can execute the application by entering the following chain of commands in a terminal: $ md C:foo $ cd C:foo $ ..araz.exe Now the current working directory is C:foo but the application’s base directory is C:ar. There exist analogous means of setting the working directory for other methods of launching an application (e.g. via a shortcut icon or programmat

Categories : C#

obtaining Current directory in VC++ forms
You are passing the address of the pointer to Convert::ToString(). pwd is an array and using the variable name without an array subscript automatically decays to a pointer. You want to use either Convert::ToString(pwd) or Convert::ToString(&pwd[0])

Categories : Visual C++

Zip together all HTML files under current directory
What about this? find /your/path/ -type f -name "*.html" | xargs zip all_html_files.zip looks for all .html files under the directory /your/path (change it for yours). Then, pipes the result to xargs, which creates the zip file. Edit To junk the paths, add -j option: find /your/path/ -type f -name "*.html" | xargs zip -j all_html_files.zip

Categories : Linux

How to get the current working directory using python 3?
It seems that IDLE changes its current working dir to location of the script that is executed, while when running the script using cmd doesn't do that and it leaves CWD as it is. To change current working dir to the one containing your script you can use: import os os.chdir(os.path.dirname(__file__)) print(os.getcwd()) The file variable is available only if you execute script from file, and it contains path to the file. More on it here: Python __file__ attribute absolute or relative?

Categories : Python

mod_rewrite rewritebase current directory
this does exactly that, through it looks too scary to use http://www.zeilenwechsel.de/it/articles/8/Using-mod_rewrite-in-.htaccess-files-without-knowing-the-RewriteBase.html googled by mod_rewrite htaccess directory current directory

Categories : Htaccess

default classpath current directory anomaly
java takes a class name as argument. It doesn't take a file path. The class name (Sparrow) is then resolved by the java class loader to a .class file based on the classpath, i.e. it looks for a Sparrow.class file in every directory and jar listed in the classpath. Let's take an example that respects good practices, and thus doesn't use the default package: package foo.bar; public class Baz { ... } The class name of the above class is foo.bar.Baz. To execute it, you must use java foo.bar.Baz and java will look for a foo/bar/Baz.class in all the directories listed in the classpath. So if the classpath is set to /hello/world, it will look for the file /hello/world/foo/bar/Baz.class.

Categories : Java

How do I make FindFirst look for files in the current directory?
The path '*.*' is relative to the root directory of the drive of the current working directory. You probably mean to pass GetCurrentDir + '*' to FindFirst. Or even better, TPath.Combine(GetCurrentDir, '*'). For example, this program demonstrates that you code works correctly provided that you pass an appropriate path to FindFirst. program FindFirstDemo; {$APPTYPE CONSOLE} uses SysUtils, IOUtils; var SR: TSearchRec; begin Writeln(GetCurrentDir); if FindFirst(TPath.Combine(GetCurrentDir, '*'),faAnyFile,SR)=0 then begin repeat Writeln(SR.Name); until FindNext(SR)<>0; FindClose(SR); end; Readln; end.

Categories : Delphi

Which plugins make assumptions about current directory
I've been using :set autochdir since I've started with Vim in 2002, I use a lot of plugins, but I haven't experienced many problems. (And those problems were rather easy to fix; I think I've sent some such patches to plugin authors.) In the end, it greatly depends on the individual plugins. Don't be afraid and just try it; it's trivial to switch back, anyway. Look out for problems with plugins that create new buffers or access / navigate to other buffers, especially when those are distributed over different directories. Problems ususally manifest themselves into the wrong buffer (or an empty one in the wrong directory) being opened.

Categories : Vim

how can I add current directory to ruby loadpath permanently
$:.unshift File.dirname(__FILE__) Should add the directory of the file you place the snippet on. If you want the directory where you are currently working on (where you call the file from) you can do the following: $:.unshift Dir.getwd

Categories : Ruby

Getting just the current directory without the full path in python
Like this: os.path.split(os.getcwd())[1] Although os.path.split returns a tuple, you don't need to unpack it. You can simply select the item that you need and ignore the one that you don't need.

Categories : Python

Textmate 2 Ruby Run settings for current directory
First of all, this has nothing to do with Textmate but with how Ruby handles that file path. So no need to fiddle with TM settings. You are opening a file relative to the current working directory. If you run Test1.rb from the RubyDevs directory Test2.rb is not present in the current working directory, if you open the file from the RubyLearn directory it is. To make it work from any directory you need to determine the directory of the Test1.rb file and add the Test2.rb path like this: file = File.open(File.dirname(__FILE__) + '/Test2.rb') file.close() Hope this helps!

Categories : Ruby

Why pipe resets current working directory?
The pipe does not reset the current working directory. The pipe creates subshells, in bash one for each side of the pipe. The subshell also does not reset the current working directory. The subshell contains the changes to the environment in itself and does not propagate them to the parent shell. In your first script: $ { mkdir dir; cd dir; pwd; } | cat; pwd; The cd is executed inside the left subshell of the pipe. The working directory is changed only in that subshell. The working directory of the parent shell is not changed. The first pwd is executed in the same subshell as the cd so it reads the changed working directory. The pwd at the end is executed in the parent shell so it reads the working directory of the parent shell which was not changed. In your second script: $ { mkdir

Categories : Bash

Returning all the Users from the current Active Directory
You must have link for this action like follow: /CurrentController/Details?id=1 So, for example you can write ActionLink as follow: <a href="@Url.Action("Details", "ControllerName", new { id = 1})" role="button" data- toggle="modal">

Categories : Asp Net

How to change the current working directory in Groovy
As Groovy runs on JVM, the same restrictions apply. Unfortunately it is not possible. Changing the current working directory in Java? JDK bug

Categories : Groovy

How to get current working directory path of a Qt application?
your application cannot know where the project is, because this is a qt-creator option. if you want to run your binary in the project path you have to setup your working directory inside qt-creator to the right path. then the QDir::currentPath() will return the path you want to have. goto: projects->[environment]->run-> working directory

Categories : C++

How to run a process from memory/RAM as the "current working directory"
It sounds difficult, and it will definitely require a lot of stuff that cannot be done in pure Java. On Linux, I think you would need to do the following: Create and mount a "tmpfs" - http://unix.stackexchange.com/questions/66329/creating-a-ram-disk-on-linux Unzip the ZIP file into the tmpfs Run the .exe using ProcessBuilder ... which allows you to set the child processes current directory. etcetera Unmount the "tmpfs" when you've done. The commands for creating the "ram disk" file system will be OS specific, and may require root / administrator privilege. It is unclear whether doing this will be more efficient than using a temporary directory in the file system. I wouldn't attempt this unless there was a clearly demonstrated need for a solution that it more efficient; i.e. unle

Categories : Java

Display the names of all .txt documents within the current (or specified) directory
This should work: File folder = new File("path/to/txt/folder"); File[] files = folder.listFiles(); File[] txtFiles = new File[files.length]; int count = 0; for(File file : files) { if(file.getAbsolutePath().endsWith(".txt")) { txtFiles[count] = file; count++; } } It should be pretty self explanatory, you just need to know folder.listFiles(). To trim down the txtFiles[] array use Array.copyOf. File[] finalFiles = Array.copyOf(txtFiles, count); From the docs: Copies the specified array, truncating or padding with false (if necessary) so the copy has the specified length.

Categories : Java

Get current Word document's save directory
ActiveDocument.FullName The above gives the full path to the document, including the file name. ActiveDocument.Path The above gives the directory where your document is saved. ActiveDocument.Name The above gives the name of the document, without path information.

Categories : Vba

Xtend how to get full path of current working directory
Yes, Java has a File class. You can create one by calling this constructor which takes a String. Then you can call getAbsolutePath() on it. You can call it like this: package com.sandbox; import java.io.File; public class Sandbox { public static void main(String[] args) { File file = new File("relative path"); String absolutePathString = file.getAbsolutePath(); } }

Categories : Java

PHP loop through current directory files for image resize
There's two ways to solve this. You can use one of PHP's "Magic Constants," __PATH__ to show the path to that current file. However, ot all PHP installs have this built in. The function getcwd() returns the current directory you're looking at, which may not be where your file lives. You can try this: <?php chdir( dirname( __FILE__ ) ); echo getcwd(); ?> Once you pull the directory, you can feed it into your script as it is. Hope this helps.

Categories : PHP

How to execute files added to .bashrc out of current directory?
Here is the solution: Composer showed an error that I was running the CGI version of php (stupid I know, I know). That was because I had an symlink in my bin dir to the cgi version. I changed the link it shows now to the CLI version of php. Now it works :)

Categories : Linux

How can I read the current directory from a 7-zip SFX, to copy one file there after installing to another one?
If, as an example, your application SFX would be called myapp.exe, then you could do the following in batch (assuming I have understood your problem correctly): @ECHO OFF :: configure: directory where to install application SET DSTDIR=D:program filesmy app :: configure: which installed file to move back to installer directory SET MOVEFILE=langast.txt :: %~dp0 is expanded to where we (the batch) currently are SET SRCDIR=%~dp0 :: call 7-zip self-extractor with destination directory (1) myapp.exe -o"%DSTDIR%" :: move the special file back (2) MOVE "%DSTDIR%\%MOVEFILE%" "%SRCDIR%"

Categories : Batch File

How to find a file path in current java directory
Try: String path = System.getProperty("user.dir"); path = path.replaceAll("\","/") + "/etc/xsd/template.xsd" Source: String.replaceAll with Backslashes error

Categories : Misc

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