command

Why do du and Perl's -s give different values for the file size?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-05 14:33:02
Updated According to comments: I have outlog.txt file which contains multiple filenames, e.g: 2345_535_Dell&HP_3PAR_DEAL.txt , similarly there are many filename but not the actual folder where the files are located and so in code am appending filenames to folderpath to get actual file location. Now,I want to get disk usage of all the files present in outlog.txt and also total disk usage of all files present in outlog.txt . I have tried two approaches perl -s and my ($size) = split(' ', du `"$folderpath/$_"`) but both approaches are giving me different values and also when I am using du than am

Commands in MVVM

落爺英雄遲暮 提交于 2019-12-05 11:40:33
I've been seeing tutorials where people are creating the methods like CanExecute in their code. I'm assuming they are doing this to help the reader understand how it all works. When I look up Command and ICommand it takes me to the ICommand class on MSDN that is used for Windows Store apps. Is there not a Command class for WPF? The built-in implementation of ICommand in WPF is RoutedCommand (and its sibling RoutedUICommand ). RoutedCommand works like this: The Execute and CanExecute methods on a RoutedCommand do not contain the application logic for the command as is the case with a typical

Command to call method from viewmodel

狂风中的少年 提交于 2019-12-05 11:18:48
OK, I tend to avoid using commands because they always manage to confuse the hell out of me, but I'm on a new project and am trying to architect it correctly with no code behind on my view. Basically All I am trying to do right now is wire up a button that fires a command that does some things on my view model, and somehow something so simple is still giving me trouble. I think I'm close but can't quite get there. Here is what I have right now. <Window.Resources> <RoutedUICommand x:Key="GetMusic" /> </Window.Resources> <Window.DataContext> <core:ViewMain /> </Window.DataContext> <Window

Find files and print only their parent directories

半城伤御伤魂 提交于 2019-12-05 11:11:19
问题 I have the following commands. Wherever the .user.log file is present, we need to print the parent directories (i.e hht and wee1 .) How can this be done? $ cd /nfs//office/ && find . -name '.user.log' ./hht/info/.user.log ./wee1/info/.user.log 回答1: Am I missing something here. Surely all this regex and/or looping is not necessary, a one-liner will do the job. Also "for foo in $()" solutions will fail when there are spaces in the path names. Just use dirname twice with xargs, to get parent's

how to call shell commands from groovy correctly

你离开我真会死。 提交于 2019-12-05 11:03:24
i want to execute shell commands from my groovy script. I tested the following: "mkdir testdir".execute() and this just works fine. Now i wanted to make a file, write something to the file and then open a text editor to view the file. def execute(cmd) { def proc = cmd.execute() proc.waitFor() } execute("touch file") execute("echo hello > file") execute("gedit file") Now gedit opens correctly but ther is no "hello" string in the file. How is this working?!? You cannot do redirection in the line: execute("echo hello > file") So nothing gets written to the file. The easiest way to handle this is

WPF Using commands to slow to update UI controls

旧城冷巷雨未停 提交于 2019-12-05 10:45:47
问题 I bind a command to a button through command property and doing a command binding in the page it is placed. In execute method I create an instance of a class that contains the background worker and I start it (this is a long task). The background worker (bw) class contains a variable isRunning that it is set to true before DoWork method is executed and to false when RunWorkerCompleted is executed. So from the code behind of the page where button is placed, in CanExecute method I set e

How to use mv command to rename multiple files in unix?

假装没事ソ 提交于 2019-12-05 09:53:16
I am trying to rename multiple files with extension xyz[n] to extension xyz example : mv *.xyz[1] to *.xyz but the error is coming as - " *.xyz No such file or directory" Don't know if mv can directly work using * but this would work find ./ -name "*.xyz\[*\]" | while read line do mv "$line" ${line%.*}.xyz done Mikaël Mayer Let's say we have some files as shown below.Now i want remove the part -(ab...) from those files. > ls -1 foo* foo-bar-(ab-4529111094).txt foo-bar-foo-bar-(ab-189534).txt foo-bar-foo-bar-bar-(ab-24937932201).txt So the expected file names would be : > ls -1 foo* foo-bar-foo

Is binding IsEnabled optional when binding Command?

不问归期 提交于 2019-12-05 09:45:12
I noticed that the following code: <Button Content="_Timbres..." Command="{Binding Path=ShowTimbresCommand}" IsEnabled="{Binding Path=CanExecuteShowTimbresCommand}"/> behaves equally as: <Button Content="_Timbres..." Command="{Binding Path=ShowTimbresCommand}"> Meaning that the CanExecuteShowTimbresCommand is automatically bound to the IsEnabled property. Is that true and why? Usually controls which accept a Command will set IsEnabled to false if the command's CanExecute is false , that's all there is to it. MSDN : Another purpose of commands is to indicate whether an action is available. [...

Executable Deleting Itself on linux [closed]

徘徊边缘 提交于 2019-12-05 09:31:53
Closed. This question is off-topic . It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . Being a super user , I executed the following command on linux rm rm which removes itself. Because when process is in execution , its reference count is not zero.Hence it cannot be deleted. So I am bemused, how and why does it happen? I tried the same with chown 0000 chown as well. cp -r Dir1/ Dir2/ In above command also , what happens when i delete the source directory only when copying is in progress??? It is

NSSpeechRecognizer example

 ̄綄美尐妖づ 提交于 2019-12-05 09:19:55
Ok so I need to do this: Wait for command, "Goodnight". Then run an action. Can someone explain how do accomplish this? Try this website: http://www.cocoadev.com/index.pl?NSSpeechRecognizer And modify as such: NSSpeechRecognizer *listen; NSArray *cmds = [NSArray arrayWithObjects:@"goodnight",nil]; listen = [[NSSpeechRecognizer alloc] init]; [listen setCommands:cmds]; [listen setDelegate:self]; [listen setListensInForegroundOnly:NO]; [listen startListening]; [listen setBlocksOtherRecognizers:YES]; - (void)speechRecognizer:(NSSpeechRecognizer *)sender didRecognizeCommand:(id)aCmd { if ([