path

How to make Emacs use my .bashrc file?

允我心安 提交于 2019-12-18 11:53:28
问题 I need to use my $PATH in Emacs to run some commands. How can I make Emacs use it? I installed Emacs from Ubuntu repositories. 回答1: Here's a trick I use to ensure my GUI Emacs always sees the same $PATH that I get inside a shell: (defun set-exec-path-from-shell-PATH () (let ((path-from-shell (replace-regexp-in-string "[ \t\n]*$" "" (shell-command-to-string "$SHELL --login -i -c 'echo $PATH'")))) (setenv "PATH" path-from-shell) (setq eshell-path-env path-from-shell) ; for eshell users (setq

Can I get the absolute path to the current script in KornShell?

流过昼夜 提交于 2019-12-18 11:49:42
问题 Is it possible to find out the full path to the script that is currently executing in KornShell (ksh)? i.e. if my script is in /opt/scripts/myscript.ksh , can I programmatically inside that script discover /opt/scripts/myscript.ksh ? Thanks, 回答1: You could use: ## __SCRIPTNAME - name of the script without the path ## typeset -r __SCRIPTNAME="${0##*/}" ## __SCRIPTDIR - path of the script (as entered by the user!) ## __SCRIPTDIR="${0%/*}" ## __REAL_SCRIPTDIR - path of the script (real path,

Android move object along a path

 ̄綄美尐妖づ 提交于 2019-12-18 11:46:40
问题 I ave created a path a circle and displayed both of them on screen as follows: public void onDraw(Canvas canvas){ Path sPath = new Path(); sPath.moveTo(100, 100); sPath.lineTo(300, 100); sPath.lineTo(300, 300); sPath.lineTo(100,300); sPath.lineTo(100,100); sPath.close(); Paint ballPaint = new Paint(); ballPaint.setColor(Color.GREEN); Paint pathPaint = new Paint(); pathPaint.setColor(Color.BLUE); canvas.drawPath(sPath, ballPaint); canvas.drawCircle(100,100,20,pathPaint); } i would like to have

Invariant stroke thickness of Path regardless of the scale

橙三吉。 提交于 2019-12-18 11:45:46
问题 We are using wpf to develop a cad like application where drawings placed on the canvas using the Path object. I just ran into a slight issue that whenver i scale/zoom my canvas, all the elements in the canvas get scaled and this is the behaviour i wanted but this also increases the stroke thickness of the Path. Is there a way by which i increase/scale/zoom the objects but still i maintain the same stroke thickness of the path. Any help in this regard will be very useful for me. 回答1: A better

How to remove a path prefix in python?

半腔热情 提交于 2019-12-18 11:37:58
问题 I wanted to know what is the pythonic function for this : I want to remove everything before the wa path. p = path.split('/') counter = 0 while True: if p[counter] == 'wa': break counter += 1 path = '/'+'/'.join(p[counter:]) For instance, I want '/book/html/wa/foo/bar/' to become '/wa/foo/bar/' . 回答1: A better answer would be to use os.path.relpath: http://docs.python.org/2/library/os.path.html#os.path.relpath >>> import os >>> full_path = '/book/html/wa/foo/bar/' >>> print os.path.relpath

Globbing/pathname expansion with colon as separator

我的未来我决定 提交于 2019-12-18 11:23:10
问题 How can I convert a string containing glob characters such as /var/lib/gems/*/bin into a colon-separated string of filenames (i.e. PATH compatible) matching the pattern? i.e. echo /var/lib/gems/*/bin will return /var/lib/gems/1.8/bin /var/lib/gems/1.9.1/bin I want /var/lib/gems/1.8/bin:/var/lib/gems/1.9.1/bin instead. The obvious approach is simply to replace the space character with ':' via tr , but that doesn't work if the filename itself contains the space character. 回答1: Actually, I

How to ensure there is trailing directory separator in paths?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-18 11:15:28
问题 I'm having an issue with AppDomain.CurrentDomain.BaseDirectory . Sometimes the path ends with '\' and other times it doesn't. I can't find a reason for this. It would be fine if I was using Path.Combine but I want to do Directory.GetParent and it yields different results. Have you found this problem? Can I do things differently to get the parent directory of the application? My current hack is: var baseDir = AppDomain.CurrentDomain.BaseDirectory; if (!baseDir.EndsWith("\\")) baseDir += "\\";

PHP get path to every file in folder/subfolder into array? [duplicate]

雨燕双飞 提交于 2019-12-18 10:46:32
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: PHP SPL RecursiveDirectoryIterator RecursiveIteratorIterator retrieving the full tree I am not sure where to start. But I have to get the paths to all files in a folder and all the content of the subfolder in paths too. For example if I had 1 folder that had five folders and each folder had 10 mp3s in it etc... That means my array would have to find 50 paths to these files. Later lets say I added one more folder

Resolving a relative url path to its absolute path

偶尔善良 提交于 2019-12-18 10:31:35
问题 Is there a library in python that works like this? >>> resolvePath("http://www.asite.com/folder/currentpage.html", "anotherpage.html") 'http://www.asite.com/folder/anotherpage.html' >>> resolvePath("http://www.asite.com/folder/currentpage.html", "folder2/anotherpage.html") 'http://www.asite.com/folder/folder2/anotherpage.html' >>> resolvePath("http://www.asite.com/folder/currentpage.html", "/folder3/anotherpage.html") 'http://www.asite.com/folder3/anotherpage.html' >>> resolvePath("http://www

xcrun: error: active developer path (“/Applications/Xcode.app/Contents/Developer”) does not exist

空扰寡人 提交于 2019-12-18 10:03:48
问题 I'm having xcode issues when I try to use brew and git: xcrun: error: active developer path ("/Applications/Xcode.app/Contents/Developer") does not exist, use xcode-select --switch path/to/Xcode.app to specify the Xcode that you wish to use for command line developer tools (or see man xcode-select ) I can type xcode-select and it shows that the command exists. When I type xcode-select -p it shows: /Applications/Xcode.app/Contents/Developer but when I do which xcode-select , it gives me: /usr