piping

Piping process output to new process

半腔热情 提交于 2019-12-01 12:58:57
I am having issues piping the output from the rtmpdump process to ffmpeg and I believe the issue is my process is stealing the output of rtmpdump. In my research I have heard of trying to use a cmd.exe process and run rtmpdump.exe as a /C command within that, but this issue is I lose reference to the rtmpdump.exe process that is spawned from that, and I need to be able to manage multiple rtmpdump processes within my program and selectively kill certain ones at times. I initially tried something simple like this: var p = new Process(); p.StartInfo.FileName = "rtmpdump.exe"; p.StartInfo

Call another click command from a click command

这一生的挚爱 提交于 2019-11-30 17:23:59
I want to use some useful functions as commands. For that I am testing the click library. I defined my three original functions then decorated as click.command : import click import os, sys @click.command() @click.argument('content', required=False) @click.option('--to_stdout', default=True) def add_name(content, to_stdout=False): if not content: content = ''.join(sys.stdin.readlines()) result = content + "\n\tadded name" if to_stdout is True: sys.stdout.writelines(result) return result @click.command() @click.argument('content', required=False) @click.option('--to_stdout', default=True) def

Piping Input using Java using command line

倖福魔咒の 提交于 2019-11-30 15:52:06
问题 public class ReadInput { public static void main(String[] args) throws IOException { BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); String x = null; while( (x = input.readLine()) != null ) { System.out.println(x); } } } I am able to run this code from the command line by typing 'java ReadInput < input.txt' but not by typing the input directly like 'java ReadInput hello'. When I type 'java ReadInput hello' I seem to get stuck in an infinite loop for some reason.

Piping Input using Java using command line

感情迁移 提交于 2019-11-30 15:36:09
public class ReadInput { public static void main(String[] args) throws IOException { BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); String x = null; while( (x = input.readLine()) != null ) { System.out.println(x); } } } I am able to run this code from the command line by typing 'java ReadInput < input.txt' but not by typing the input directly like 'java ReadInput hello'. When I type 'java ReadInput hello' I seem to get stuck in an infinite loop for some reason. Shouldn't it just work in the same way as typing 'java ReadInput < input.txt' but instead just reprint

What is the difference between %>% and %,% in magrittr?

扶醉桌前 提交于 2019-11-30 04:58:45
Github developmental version of magrittr includes some cool new function for piping but I do not exactly catch de difference between %>% and %,% . Is this only formal with %>% for value and %,% for functions, or there is some specific peculiarity? The normal piping operator is %>% . You can use %,% to create a reusable pipe, a pipe without data. Then later you can use the same pipe with various data sets. Here is an example. library(magrittr) library(dplyr) library(Lahman) Suppose you want to calculate the top 5 baseball players, according to total hits. Then you can do something like this

Call another click command from a click command

被刻印的时光 ゝ 提交于 2019-11-30 00:54:20
问题 I want to use some useful functions as commands. For that I am testing the click library. I defined my three original functions then decorated as click.command : import click import os, sys @click.command() @click.argument('content', required=False) @click.option('--to_stdout', default=True) def add_name(content, to_stdout=False): if not content: content = ''.join(sys.stdin.readlines()) result = content + "\n\tadded name" if to_stdout is True: sys.stdout.writelines(result) return result

Redirecting arguments into a program (BASH)

醉酒当歌 提交于 2019-11-29 17:47:36
I am fairly new to bash scripting and a part I am stuck on is after done< "$file_input" What I am trying to achieve is when I run the program ./test inside the testfile contains the numbers 15 14 90 22 and the program is going to take those numbers as the arguments and run it, but I am quite unsure how to do that. Am I going in the correct direction? Thanks for any help if [[ "$#" -ne 1 ]] then writeusage exit fi your_path=../file/test test_path=../../public/test file_input="$1" while read -r line do args+="$line" done < "$file_input" ----------------- unsure how to redirect the arguments in a

Chain arithmetic operators in dplyr with %>% pipe

廉价感情. 提交于 2019-11-29 05:30:37
I would like to understand why, in the the dplyr or magrittr package, and more specifically the chaining function %>% has some trouble with the basic operators + , - , * , and / Chaining takes the output of previous statement and feeds it as first argument of the next: 1:10 %>% sum # [55] Thus how come this doesn't work 1:10 %>% *2 %>% sum 1:10 %>% .*2 %>% sum I also found that the following syntax works for adding/substracting, but not multiply or divide. why so? 1:10 %>% +(2) # works OK 1:10 %>% *(2) # nope... So should I write an anonymous function even to do a *2 operation on my data.frame

What is the difference between %>% and %,% in magrittr?

夙愿已清 提交于 2019-11-29 02:33:09
问题 Github developmental version of magrittr includes some cool new function for piping but I do not exactly catch de difference between %>% and %,% . Is this only formal with %>% for value and %,% for functions, or there is some specific peculiarity? 回答1: The normal piping operator is %>% . You can use %,% to create a reusable pipe, a pipe without data. Then later you can use the same pipe with various data sets. Here is an example. library(magrittr) library(dplyr) library(Lahman) Suppose you

Set $_SERVER variable when calling PHP from command line?

守給你的承諾、 提交于 2019-11-28 22:21:29
问题 Is it possible to pass a $_SERVER variable to a PHP script via the command line? Specifically I am trying to set the $_SERVER['recipient'] manually so I can test email piping without setting up a mail server. 回答1: On *nix: $ recipient="email@domain.com" php script.php <?php print_r($_SERVER); Test: $ recipient="email@domain.com" php script.php | grep recipient [recipient] => something@domain.com Or, you can export it or setenv (depending on your OS), like $ export recipient="email@domain.com"