command

Updating a reference to a command of a nested ViewModel?

安稳与你 提交于 2019-12-04 21:58:08
I know I'm probably missing something simple and obvious, but at the moment it eludes me. I'm attempting to use the MVVM pattern. How do you update a reference to a command in a viewmodel that is linked to a child viewmodel? I've got a view (MainView) bound to a viewmodel (MainViewModel). On MainView, I've got an instance of another view (SummaryView) bound to a viewmodel (SummaryViewModel). SummaryViewModel contains a collection of a third viewmodel (SummaryFilterViewModel). On SummaryView, there is a TabControl and each tab on it is bound to one of the SummaryFilterViewModel instances in the

Bind command to X-button of window title bar

北战南征 提交于 2019-12-04 21:54:25
My WPF maintenance window have a toolbar with a button "Exit"; a CommandExit is bind with this button. The CommandExit perform some checks before exit. Now, if I click to close button of the window (x-button of title bar), this checks are ignored. How can I do to bind CommandExit to window x-button? You have to implement event handler of your main window's event "Closing" where you can do checks and cancel the closing action. This is easiest way to do it, however otherwise you have to redesign whole window and its theme. I assume you may want to cancel closing based on these conditions? You

execute file .lnk in Java

自作多情 提交于 2019-12-04 19:50:22
i need to execute a .lnk file in java (lnk file that points at an exe file). how can i do? in vb .net i do Process.Start(path) and it works thx you for help. Use a ProcessBuilder : ProcessBuilder pb = new ProcessBuilder("cmd", "/c", "C:\\temp\\file.lnk"); Process process = pb.start(); Call process.getInputStream() and process.getErrorStream() to read the output and error output of the process. On Windows, you could use rundll : Runtime.getRuntime().exec("rundll32 SHELL32.DLL,ShellExec_RunDLL " + "\Path\to\File.lnk"); Java has no support for OS specific features, but java.awt.Desktop.open

In GDB, how do I execute a command automatically when program stops? (like display)

人盡茶涼 提交于 2019-12-04 18:51:21
问题 I want some commands to be automatically executed each time the program stops, just like what display does with x. How do I do that? 回答1: Here's the easy way I found out: define hook-stop ...commands to be executed when execution stops end Refer to this page for details: http://sourceware.org/gdb/current/onlinedocs/gdb/Hooks.html#Hooks 回答2: Another "new" way to do it is with the Python Event interface: def stop_handler (event): print "event type: stop" gdb.events.stop.connect (stop_handler)

Cordova and setting Android using command line

隐身守侯 提交于 2019-12-04 18:38:10
问题 I am trying to migrate my existing project from cordova 2.1 to the latest, 3.1 wich can be installev vía command line, I already have the Android SDK installed, So: sudo npm install -g cordova // All good cordova create hello com.example.hello HelloWorld // All good cordova platform add android // Then it fires: Checking Android requirements... [Error: The command `android` failed. Make sure you have the latest Android SDK installed, and the `android` command (inside the tools/ folder) added

authentication error for mifare card “6982:Security status not satisfied”

守給你的承諾、 提交于 2019-12-04 18:15:00
I know. This question asked before under same tag and same name here . But the answers are useless for me. and i opened again for real answers. I have pc/sc reader and Contactless card(mifare card), I can connect to the card and also I execute getdate command successfully, but when I want to authenticate I see this error "6982:Security status not satisfied" I've tried these 4 different commands for authentication but I get the same error for all of them. FF 88 00 00 06 FF FF FF FF FF FF FF 88 00 00 60 12 FF 88 00 00 05 01 00 12 60 00 FF 88 00 00 60 00 how can I authenticate to this card ? The

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

折月煮酒 提交于 2019-12-04 17:48:27
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 root 4096 May 13 12:39 log\ndrwxrwxrwx 3 root root 4096 May 14 16:02 newpy\n-rw-r--r-- 1 root root 134

Command binding not working in a dynamic MVVM Context Menu

狂风中的少年 提交于 2019-12-04 16:55:57
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="{DynamicResource ContextMenu}" where the empty ContextMenu is defined as follows: <Window.Resources> <local

Problem with starting OpenOffice service (soffice) from Java (command working in commandline, but not from Java)

南笙酒味 提交于 2019-12-04 15:46:40
I want to exceute a simple command which works from the shell but doesn't work from Java. This is the command I want to execute, which works fine: soffice -headless "-accept=socket,host=localhost,port=8100;urp;" This is the code I am excecuting from Java trying to run this command: String[] commands = new String[] {"soffice","-headless","\"-accept=socket,host=localhost,port=8100;urp;\""}; Process process = Runtime.getRuntime().exec(commands) int code = process.waitFor(); if(code == 0) System.out.println("Commands executed successfully"); When I run this program I get "Commands executed

Preventing management commands from running more than one at a time

六月ゝ 毕业季﹏ 提交于 2019-12-04 15:45:51
I'm designing a long running process, triggered by a Django management command, that needs to run on a fairly frequent basis. This process is supposed to run every 5 min via a cron job, but I want to prevent it from running a second instance of the process in the rare case that the first takes longer than 5 min. I've thought about creating a touch file that gets created when the management process starts and is removed when the process ends. A second management command process would then check to make sure the touch file didn't exist before running. But that seems like a problem if a process