command

How to disable a built-in command in vim

核能气质少年 提交于 2019-12-10 03:56:10
问题 In vim, when I hit :wq it is almost always an accident that occurred when attempting to input :w . I would like to disable :wq . The closest I found is cmap , but it has some odd behavior. If I do something like :cmap wq w I can no longer even input :wq ; it just remaps the keystroke sequence wq to w in command mode. Now I cannot, for example, input a search/replace command on a string containing wq . I would just like to alias the exact command :wq to :w or a no-op. Is there a way to do this

Format of the data returned by the FTP LIST command?

◇◆丶佛笑我妖孽 提交于 2019-12-10 03:52:06
问题 I'm in the middle of writing an FTP server but I'm a little confused about what format to send the file list in. Using 2 terminals and an FTP client, I was able to run through a simple FTP exchange. However, I wasn't really sure what format to send the file lists in. Is there some accepted format? What columns should I use? 回答1: This is what the RFC has to say: The data transfer is over the data connection in type ASCII or type EBCDIC. (The user must ensure that the TYPE is appropriately

linux: passing username and password in command line

做~自己de王妃 提交于 2019-12-10 02:58:56
问题 I am using IPVanish for using a proxy while surfing; like: sudo openvpn --config /home/ipv/conf/ipvanish-CA-Toronto-tor-a09.ovpn Now, I have to enter my username, after that my password. How Can I pass those two params right as one command, so that I just use one command and the username/password are being passed automatically? 回答1: The previous answer didn't work for me (still asked for username and password), what did work was putting your credentials in a file (pass.txt), like this

Difference between starting a command using init.d script and service start

一个人想着一个人 提交于 2019-12-10 01:56:58
问题 I need to understand the difference between starting a command using init.d script and service start . For example what is the difference between /etc/init.d/nginx start and service nginx start . 回答1: They do the same thing except service runs the script in a controlled environment. From the service(8) man page: DESCRIPTION service runs a System V init script in as predictable environment as possible, removing most environment variables and with current working directory set to / .

bash for inline command

蓝咒 提交于 2019-12-10 00:40:18
问题 I have to run commands, in a bash script, and within this bash script I have to run other commands. I am running CentOS. I found 2 ways to do this on blogs and manuals: 1) using the ticks or accent char command `sub command` or 2) using the dollar sign and parentheses command $(sub command) What is the difference between the 2 and which one is preferable to use? 回答1: There's no difference except in "nestability": The $() is nestable: $ echo $(echo "hi" $(echo "there")) while the `` is not.

Command Line (or batch file) rename all files in a folder (Windows)

可紊 提交于 2019-12-10 00:31:04
问题 I need to rename all of the files in a folder with the following filename format; itemID-straight-bottle.png TO itemID-bottle.png How can i accomplish this with a cmd script or in the command line? example; REDHI20806-straight-bottle.png TO REDHI20806-bottle.png I should have said, this is in Windows and i want to use either command line or a batch file to run this renaming on all files in a folder on a specific drive 回答1: short answer On Windows , you can use PowerShell, that is installed by

why should we use stdout=PIPE in subprocess.Popen?

不想你离开。 提交于 2019-12-09 22:11:02
问题 from subprocess import PIPE,Popen p = Popen("ls -l",shell=True,stderr=PIPE,stdout=PIPE) (out,err) = p.communicate() print(out, err) In above Popen call, if I remove stdout=PIPE , I am getting newline after every listing by ls -l in output. But if use stdout=PIPE , I get \n displayed, rather than newline, as below b'total 67092\n-rw-r--r-- 1 root root 171 May 27 09:08 new.py\n-rw-r--r-- 1 root root 74 May 12 18:14 abcd.conf\n-rwxr-xr-x 1 root root 5948 May 13 13:21 abxyz.sh\ndrwxr-xr-x 2 root

Command binding not working in a dynamic MVVM Context Menu

纵然是瞬间 提交于 2019-12-09 20:24:44
问题 I am new to WPF. Like many others, I am trying to bind a ContextMenu to an ObservableCollection to create a dynamic context menu. Everything works except binding the Command property to the TheCommand property of the MenuItemViewModel class, that represents the menu item. The command is not fired. What am I doing wrong? To start from the beginning, the ContextMenu is a child of the Image and is shown when the mouse is over the Image . <Image.ContextMenu > <ContextMenu ItemsSource="

添加第三方类库造成的linker command failed with exit code 1 (use -v to see invocation)的错误调试

不想你离开。 提交于 2019-12-09 19:13:12
linker command failed with exit code 1 (use -v to see invocation) 这个错误貌似遇见并不止一次,当我想用某个第三方类库的时候(如SBJson),我直接把类库文件copy到工程目录里面,然后一编译就出现这样错误(并不是一定会出这样错误),开始以为是网上下载的类库本身问题,所以重新找类库或者其他方式将它添加进去,只要不出错就行,也一直没有深入了解根本问题,今天在给工程添加一个FMDB(SQLIte第三方类库)文件编译时又出现这种错误,一开始以为工程问题,但是新建工程后还是出现这个问题,经过网上查找,得到了解决办法; [cpp] view plain copy Undefined symbols for architecture i386: "_OBJC_CLASS_$_FMDatabase" , referenced from: objc- class -ref in ViewController.o ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation) 在网上得到解决办法是: 在工作左边导航栏Target-->Build

WPF: Bind to command from ControlTemplate

无人久伴 提交于 2019-12-09 17:18:07
问题 I am trying to add a button to a custom ListView (MyListView) which triggers a command (MyCustomCommand) defined in MyListView. I have added the button (and a title text) by applying a ControlTemplate. The problem is that I have not found a way to trigger MyCustomCommand when clicking the button. What I eventually want to achieve is to open a Popup or ContextMenu where I can select which columns should be visible in the ListView. Here's my template source: <Style TargetType="local:MyListView"