command

Call Command from Code Behind

坚强是说给别人听的谎言 提交于 2019-11-29 22:46:42
So I've been searching around and cannot find out exactly how to do this. I'm creating a user control using MVVM and would like to run a command on the 'Loaded' event. I realize this requires a little bit of code behind, but I can't quite figure out what's needed. The command is located in the ViewModel, which is set as the datacontext of the view, but I'm not sure exactly how to route this so I can call it from the code behind of the loaded event. Basically what I want is something like this... private void UserControl_Loaded(object sender, RoutedEventArgs e) { //Call command from viewmodel }

How to a add a command to a WPF TextBlock?

岁酱吖の 提交于 2019-11-29 22:01:17
I'd like to be able to click a textblock and have it run a Command. Is this possible? (if not do I just somehow make a tranparent button over it or something?) You can use a InputBinding . <TextBlock Text="Hello"> <TextBlock.InputBindings> <MouseBinding Command="" MouseAction="LeftClick" /> </TextBlock.InputBindings> </TextBlock> Edit: Hyperlink is probably worth a mention too. <TextBlock><Hyperlink Command="" TextDecorations="None" Foreground="Black">Hello</Hyperlink></TextBlock> You do not make a transparent button over it, you put the TextBlock into it: <Button> <Button.Template>

Pass path with spaces as parameter to bat file

孤者浪人 提交于 2019-11-29 20:25:17
I have a simple bat script that copies files from an known directory to a directory given by the user. How can I pass the path (it might contain spaces) to my script and use it with the xcopy command? In my code i have the following :READ_PWA_PATH if "%1" == "" ( rem Set default path set PWA_PATH="C:\Program Files\PWA" rem echo You have not specified your PWA url. echo Default will be assumed: C:\Program Files\PWA. choice /C:YN /M:"Do you wish to continue [Y] or cancel the script [N]?" IF ERRORLEVEL ==2 GOTO CANCEL IF ERRORLEVEL ==1 GOTO READ_WSS_SERVER_EXTENSIONS_PATH GOTO END ) else ( set

Show special characters in Unix while using 'less' Command

旧城冷巷雨未停 提交于 2019-11-29 20:22:58
I would like to know how to view special characters while using 'less' command. For instance I want to see the non-printable characters with a special notation. For instance in 'vi' editor I use "set list on" to see the line termination characters represented by dollar '$' character. Similarly I would want to do this using 'less' command. I referred Unix less manual, but to no avail. less will look in its environment to see if there is a variable named LESS You can set LESS in one of your ~/.profile (.bash_rc, etc, etc) and then anytime you run less from the comand line, it will find the LESS.

How to delete a folder with all contents using a bat file in windows?

寵の児 提交于 2019-11-29 20:21:20
I want to delete a folder with all files and subfolders using a bat file. I have tried the following, but it is not working: @DEL D:\PHP_Projects\testproject\Release\testfolder*.* Can anybody help? Jon @RD /S /Q "D:\PHP_Projects\testproject\Release\testfolder" Explanation : Removes (deletes) a directory. RMDIR [/S] [/Q] [drive:]path RD [/S] [/Q] [drive:]path /S Removes all directories and files in the specified directory in addition to the directory itself. Used to remove a directory tree. /Q Quiet mode, do not ask if ok to remove a directory tree with /S user3319853 del /s /q c:\where ever

Redirecting output to a command-line argument of another command in Windows

南笙酒味 提交于 2019-11-29 20:07:57
问题 How can I, in Windows, use the output of a script/command as an argument for another script? (A pipe | will not work here, since that other script doesn't read from the standard input) Too clarify: I have AnotherScript that needs an argument arg, e.g.: AnotherScript 12 now I want the argument (12 in the example) to come from the output of a script, call it ScriptB. So I would like something along the lines of AnotherScript (ScriptB) The AnotherScript is actually a python script that requires

Split text file into smaller multiple text file using command line

半世苍凉 提交于 2019-11-29 19:39:47
I have multiple text file with about 100,000 lines and I want to split them into smaller text files of 5000 lines each. I used: split -l 5000 filename.txt That creates files: xaa xab aac xad xbe aaf files with no extensions. I just want to call them something like: file01.txt file02.txt file03.txt file04.txt or if that is not possible, i just want them to have the ".txt" extension. I know the question has been asked a long time ago, but I am surprised that nobody has given the most straightforward unix answer: split -l 5000 -d --additional-suffix=.txt $FileName file -l 5000 : split file into

What is the difference between git clone and checkout?

我的未来我决定 提交于 2019-11-29 19:02:19
What is the difference between git clone and git checkout ? August Lilleaas The man page for checkout: http://git-scm.com/docs/git-checkout The man page for clone: http://git-scm.com/docs/git-clone To sum it up, clone is for fetching repositories you don't have, checkout is for switching between branches in a repository you already have. Note: for those who have a SVN/CVS background and new to Git, the equivalent of git clone in SVN/CVS is checkout . The same wording of different terms is often confusing. Kit Ho git clone is to fetch your repositories from the remote git server. git checkout

What does the 'export' command do?

喜夏-厌秋 提交于 2019-11-29 18:56:20
I am a little new to Linux, and I happen to run some commands blindly, in order to get things done. I thought that it will not be a waste of asking these type of questions, since more new people would have a regular knowledge about those. I started to work with Jenkins recently, and then I had to use this export command to run the Jenkins war archive . So I needed to know what export command does in general, and why we need to run this command, while running Jenkins (after the Jenkins home is set). Thanks! Yann Ramin export in sh and related shells (such as bash ), marks an environment

How to locate the vimrc file used by vim editor?

不羁岁月 提交于 2019-11-29 18:55:43
Is there a command in the vim editor to find the .vimrc file location? manojlds Just try doing the following: :version You will get an output which includes something like: system vimrc file: "$VIM/vimrc" user vimrc file: "$HOME/.vimrc" user exrc file: "$HOME/.exrc" system gvimrc file: "$VIM/gvimrc" user gvimrc file: "$HOME/.gvimrc" system menu file: "$VIMRUNTIME/menu.vim" As noted by Herbert in comments, this is where vim looks for vimrc s, it doesn't mean they exist. You can check the full path of your vimrc with :echo $MYVIMRC If the output is empty, then your vim doesn't use a user vimrc