command

Executing viewmodels command on enter in TextBox

若如初见. 提交于 2019-12-03 04:04:16
问题 I want to execute a command in my viewmodel when the user presses enter in a TextBox. The command works when bound to a button. <Button Content="Add" Command="{Binding Path=AddCommand}" /> But I can't bring it to work from the TextBox. I tried an Inputbinding, but it didn't work. <TextBox.InputBindings> <KeyBinding Command="{Binding Path=AddCommand}" Key="Enter"/> </TextBox.InputBindings> I also tried to set the working button as default, but it doesn't get executed when enter is pressed.

Emacs repeat string n times

眉间皱痕 提交于 2019-12-03 03:47:07
问题 I'm learning the basics of navigating/editing in Emacs and I'm curious how one could accomplish the following task: Repeat the string 'bla ' n times in normal text editing mode. Let's say I want to repeat it five times to generate 'bla bla bla bla bla '. I tried... C-u 5 bla ...but the command executes after the 'b' is entered, and I only get 'bbbbb'. I'm sure there's some basic command that can help me here...would somebody be kind enough to enlighten me :)? 回答1: One way is via a keyboard

Execute commands with notepad++

喜夏-厌秋 提交于 2019-12-03 03:38:26
问题 How can I specify the actual file to process using the Run command in Notepad++. I want for example run pdflatex using the actualfile as input, or the cs compiler, etc. Using the entire path isn't practical, it must works with any actual file. 回答1: You can automatically add the current file using a variable in the execution string: C:\temp\test.exe "$(FULL_CURRENT_PATH)" The list of available variables is nowhere documented, but you can see it in the source code. FULL_CURRENT_PATH CURRENT

How can I handle WPF routed commands in my ViewModel without code-behind?

偶尔善良 提交于 2019-12-03 03:33:58
According to my understanding of MVVM, it is a good practice to handle routed commands directly in the ViewModel. When a routed command is defined in a ViewModel as a RelayCommand (or DelegateCommand), it is easy to bind directly to the command like this: Command={Binding MyViewModelDefinedCommand}. Actually, for routed command that are defined outside of my ViewModel, I handle those commands in the Code behind of the View and forward calls to the ViewModel. But I find it awkward that I have to do so. It goes against recommended MVVM good practices. I think that there should be a more elegant

Command Binding in hierarchical datatemplate

柔情痞子 提交于 2019-12-03 03:26:00
I have Menu in my app. I'm visualizing it using hierarchical data template: <MenuItem Header="Main menu" ItemsSource="{Binding ApplicationMenu}" > <MenuItem.ItemTemplate> <HierarchicalDataTemplate DataType="{x:Type tm:RMenuItem}" ItemsSource="{Binding Path=ChildrenItems}"> <MenuItem Header="{Binding Name}" Command="{Binding RunOperationCommand}" /> </HierarchicalDataTemplate> </MenuItem.ItemTemplate> </MenuItem> menu looks like as it should, but Command for each menu item is not fired! Even more - it is not bounded, which could be seen in debugger: get accessor of ICommand Property has been

What is /bin/true

笑着哭i 提交于 2019-12-03 03:25:38
问题 On a Linux system what is /bin/true ? 回答1: /bin/true is a command that returns 0 (a truth value in the shell). Its purpose is to use in places in a shell script where you would normally use a literal such as "true" in a programming language, but where the shell will only take a command to run. /bin/false is the opposite that returns non-zero (a false value in the shell). 回答2: From the man page: true - do nothing, successfully true returns a status 0. 回答3: Note, it's not just silly or visually

How to show ping output dynamically in a web page?

时光毁灭记忆、已成空白 提交于 2019-12-03 02:58:46
As part of a diagnostics page I would like to have the user be able to run a "ping", ie an ordinary shell command to send ICMP_ECHO_REQUSTs to a certain IP and display the resuls dynamically in a div in the browser. The backend is Ruby/Rails. I'm past running the command on the server side and reading the output from the ping command. And I've been building web pages that periodically calls back to the server to update som parts of the page dynamically. But in this case there are three challenges: be able to have the ajax call back to an uri/url to find the process that runs the ping command

Why are events and commands in MVVM so unsupported by WPF / Visual Studio?

拟墨画扇 提交于 2019-12-03 02:45:12
When creating an WPF application with the MVVM pattern, it seems I have to gather the necessary tools myself to even begin the most rudimentary event handling, e.g. AttachedBehaviors I get from here DelegateCommands I get from here Now I'm looking for some way to handle the ItemSelected event in a ComboBox and am getting suggestions of tricks and workarounds to do this (using a XAML trigger or have other elements bound to the selected item, etc.). Ok, I can go down this road, but it seems to be reinventing the wheel. It would be nice to just have an ItemSelected command that I can handle in my

How to deploy war file to tomcat using command prompt?

爱⌒轻易说出口 提交于 2019-12-03 02:42:43
问题 I have created a war file and put into tomcat/webapps . How to deploy a war file to tomcat using command prompt? 回答1: First add a user role in tomcat-users.xml for role manager-script. Then to undeploy current app you can use wget http://username:password@localhost:portnumber/manager/text/undeploy?path=/appname -O - -q To deploy wget http://username:password@localhost:portnumber/manager/text/deploy?path=/appname&war=file:/warpath -O - -q 回答2: The earlier answers on this page are correct that

Grails: How to combine domain objects' errors with command objects' errors?

假如想象 提交于 2019-12-03 02:16:49
Suppose I have User domain class and RegistrationCommand class. So when user is registering on website there are two steps for data validation: RegistrationCommand constraints validation. User domain object constrains validation. Controller action receive command object and pass it to view in a model after computing. So, I want to join domain objects' validation errors with command objects' errors and pass them as a part of command object. What is the best way to do that? I think the full answer is: if (!user.validate() || !user.save(true)) { if (user.errors.hasErrors()) { user.errors