command

UNIX ssh script, running commands on remote server

Deadly 提交于 2019-11-30 14:16:01
问题 I would like to create a script that automatically logs into a remote server and grabs a file on the server. The script already logs into the server however the commands are not run on that machine. Once I disconnect from the remote server, the commands are run on the client machine. !/bin/sh ssh -o PreferredAuthentications=publickey brjones@server.com cd ~/folder "i would like to grab file and copy it to client machines folder" EDIT: I am not sure if you noticed but I am used a passwordless

WPF Command with Click Event Handler

柔情痞子 提交于 2019-11-30 13:38:57
When I use the Command in a Button control the event handler which joined with Click event will never raised, How can I use the Command and handle the Click event handler? You could attach the ICommand to another property and execute it from the Click handler. <Button x:Name="MyButton" Tag="{x:Static ApplicationCommands.Stop}" Click="MyButton_Click" /> and in the handler: private void MyButton_Click(object sender, RoutedEventArgs e) { var button = sender as Button; if (button != null) { var command = button.Tag as ICommand; if (command != null) command.Execute(button.CommandParameter); } } You

Architecture: simple CQS

空扰寡人 提交于 2019-11-30 12:45:49
问题 I'm thinking about applying CQS for my ASP.NET MVC web site, but in a very simple matter. I don't mean CQRS, because I want to use the same data source for query and command parts, and so I don't need event sourcing and other more complex patterns. So, what I have in mind is: use the same database for query and command part for the query part, expose database views with entity framework and WCF data services, so that specific views are returned to the client, querying data becomes very easy

WPF Listbox and Select All

坚强是说给别人听的谎言 提交于 2019-11-30 12:37:49
I want to create a simple ListBox and have SelectAll as a context menu item. However it seems that ListBox has some sort of inbuilt handling for SelectAll that I can't get working, but is interfering with my attempt to implement SelectAll. My entire XAML is this: <Window x:Class="WpfApplication1.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300"> <Window.CommandBindings> <CommandBinding Command="ApplicationCommands.SelectAll" Executed="SelectAllExecuted" /> </Window

Bind DoubleClick Command from DataGrid Row to VM

不想你离开。 提交于 2019-11-30 11:58:19
问题 I have a Datagrid and don't like my workaround to fire a double click command on my viewmodel for the clicked (aka selected) row. View: <DataGrid EnableRowVirtualization="True" ItemsSource="{Binding SearchItems}" SelectedItem="{Binding SelectedItem}" SelectionMode="Single" SelectionUnit="FullRow"> <i:Interaction.Triggers> <i:EventTrigger EventName="MouseDoubleClick"> <cmd:EventToCommand Command="{Binding MouseDoubleClickCommand}" PassEventArgsToCommand="True" /> </i:EventTrigger> </i

Run a command shell in jenkins

末鹿安然 提交于 2019-11-30 11:02:57
I'm trying to execute a command shell in Jenkins, I'm working on Windows 7. In the console output I have this: Building in workspace C:\Program Files (x86)\Jenkins\workspace\test [test] $ sh -xe C:\Windows\TEMP\hudson6299483223982766034.sh The system cannot find the file specified FATAL: L'exécution de la commande a échoué. java.io.IOException: Cannot run program "sh" (in directory "C:\Program Files (x86)\Jenkins\workspace\test"): CreateProcess error=2, Le fichier spécifié est introuvable at java.lang.ProcessBuilder.start(Unknown Source) at hudson.Proc$LocalProc.<init>(Proc.java:244) at hudson

Binding WPF ContextMenu MenuItem to UserControl Property vs ViewModel Property

泄露秘密 提交于 2019-11-30 10:25:45
I'm struggling to understand what is going on with the ContextMenu. I know it is rendered as a separate window, with a separate visual tree, so we can't use relative binding to bind a command exposed as a property of the user control. e.g. the following does not work: <MenuItem Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl}, Path=TestCommand}" Header="Test" /> But, if you set the data context of the user control to a view model that exposes a command as a property, the following will work: <MenuItem Command="{Binding TestCommand}" Header="Test" /> What I don't

UNIX ssh script, running commands on remote server

时光怂恿深爱的人放手 提交于 2019-11-30 09:58:31
I would like to create a script that automatically logs into a remote server and grabs a file on the server. The script already logs into the server however the commands are not run on that machine. Once I disconnect from the remote server, the commands are run on the client machine. !/bin/sh ssh -o PreferredAuthentications=publickey brjones@server.com cd ~/folder "i would like to grab file and copy it to client machines folder" EDIT: I am not sure if you noticed but I am used a passwordless connection to the remote server using ssh and keygeneration. I appreciate the ideas but I am looking to

WPF: TreeViewItem bound to an ICommand

情到浓时终转凉″ 提交于 2019-11-30 09:12:34
I am busy creating my first MVVM application in WPF. Basically the problem I am having is that I have a TreeView (System.Windows.Controls.TreeView) which I have placed on my WPF Window, I have decide that I will bind to a ReadOnlyCollection of CommandViewModel items, and these items consist of a DisplayString, Tag and a RelayCommand. Now in the XAML, I have my TreeView and I have successfully bound my ReadOnlyCollection to this. I can view this and everything looks fine in the UI. The issue now is that I need to bind the RelayCommand to the Command of the TreeViewItem, however from what I can

Executing a Command from Java and Waiting for the Command to Finish

我与影子孤独终老i 提交于 2019-11-30 08:54:35
In my Java program, I create a process that executes a command to run a batch file like this: try { File tempFile = new File("C:/Users/Public/temp.cmd"); tempFile.createNewFile(); tempFile.deleteOnExit(); setContents(tempFile, recipe.getText()); //Writes some user input to file String cmd = "cmd /c start " + tempFile.getPath(); Process p = Runtime.getRuntime().exec(cmd); int exitVal = p.waitFor(); refreshActionPerformed(evt); } catch (InterruptedException ex) { Logger.getLogger(mainFrame.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(mainFrame.class