output

How to write files to current directory instead of bazel-out

自闭症网瘾萝莉.ら 提交于 2019-11-29 04:49:28
I have the following directory structure: my_dir | --> src | | | --> foo.cc | --> BUILD | --> WORKSPACE | --> bazel-out/ (symlink) | | ... src/BUILD contains the following code: cc_binary( name = "foo", srcs = ["foo.cc"] ) The file foo.cc creates a file named bar.txt using the regular way with <fstream> utilities. However, when I invoke Bazel with bazel run //src:foo the file bar.txt is created and placed in bazel-out/darwin-fastbuild/bin/src/foo.runfiles/foo/bar.txt instead of my_dir/src/bar.txt , where the original source is. I tried adding an outs field to the foo rule, but Bazel complained

Clearing only part of the console output

纵饮孤独 提交于 2019-11-29 04:03:28
问题 What I want to do: The cursor is initially blinking on the top left corner of the screen: 160 characters remaining _ When I press 'i': 159 characters remaining i When I press 'a': 158 characters remaining ia When I press 'm': 157 characters remaining iam and so on. What needs to be done(According to me): Need to clear the only the first three characters of the screen. Update the newly pressed key on the screen What I have tried: I tried to clear the whole screen and write everything that was

Print Integer with 2 decimal places in Java

混江龙づ霸主 提交于 2019-11-29 03:44:00
in my code i use integers multiplied by 100 as decimals (0.1 is 10 etc). Can you help me to format output to show it as decimal? int x = 100; DecimalFormat df = new DecimalFormat("#.00"); // Set your desired format here. System.out.println(df.format(x/100.0)); I would say to use 0.00 as format: int myNumber = 10; DecimalFormat format = new DecimalFormat("0.00"); System.out.println(format.format(myNumber)); It will print like: 10.00 The advantage here is: If you do like: double myNumber = .1; DecimalFormat format = new DecimalFormat("0.00"); System.out.println(format.format(myNumber)); It will

What's the difference between write, print, pprint, princ, and prin1?

岁酱吖の 提交于 2019-11-29 02:48:46
问题 I'm getting into some Lisp, and I've come across various different functions that to me appear to be doing the same thing... Namely printing to console... So what exactly is the difference between all those different functions? 回答1: This is answered here: http://www.lispworks.com/documentation/HyperSpec/Body/f_wr_pr.htm write is the general entry point to the Lisp printer. prin1 produces output suitable for input to read . princ is just like prin1 except that the output has no escape

How to increase the ipython qtconsole scrollback buffer limit

佐手、 提交于 2019-11-29 01:31:43
问题 When I load ipython with any one of: ipython qtconsole ipython qtconsole --pylab ipython qtconsole --pylab inline The output buffer only holds the last 500 lines. To see this run: for x in range(0, 501): ...: print x Is there a configuration option for this? I've tried adjusting --cache-size but this does not seem to make a difference. 回答1: Quickly: ipython qtconsole --IPythonWidget.buffer_size=1000 Or you can set it permanently by adding: c.IPythonWidget.buffer_size=1000 in your ipython

Don't display pushd/popd stack across several bash scripts (quiet pushd/popd)

坚强是说给别人听的谎言 提交于 2019-11-29 01:19:48
问题 Each time I use pushd or popd, it print the stack to standard output. How not to do so? I don't want to do pushd > /dev/null each time because I have a lot of scripts calling each other. Maybe a nice override will do it, but I'll need to override these builtins only in my scripts, and then restore the correct behavior. 回答1: You could add pushd () { command pushd "$@" > /dev/null } popd () { command popd "$@" > /dev/null } to the top of each script. This is probably the minimum amount of work

Difference between JspWriter and PrintWriter in Java EE?

独自空忆成欢 提交于 2019-11-29 01:07:23
问题 For all you "duplicate" fanatics, there is a similar question on SO right here. The difference is that I paint a vivid example that I can not understand the output of. The documentation for JspWriter and PrintWriter says there are two differences: 1. JspWriter can throw exceptions, PrintWriter should not do so. 2. JspWriter uses a PrintWriter behind the scene, but since by default JSP pages are buffered, the PrintWriter won't be created until the buffer is flushed - whatever that mean in the

Suppress console output in PowerShell

风流意气都作罢 提交于 2019-11-28 22:21:34
I have a call to GPG in the following way in a PowerShell script: $key = & 'gpg' --decrypt "secret.gpg" --quiet --no-verbose > $null I don't want any output from GPG to be seen on the main console when I'm running the script. Due to my noobness in PowerShell, I don't know how to do this. I searched Stack Overflow and googled for a way to do it, found a lot of ways to do it, but non of it worked. The "> $null" for example has no effect. I found the --quiet --no-verbose options for GPG to put less output in the console, still it's not completely quiet, and I'm sure there is a way in PowerShell

Is this undefined behaviour in C ? If not predict the output logically

假装没事ソ 提交于 2019-11-28 22:17:26
问题 Code 1 #include <stdio.h> int f(int *a, int b) { b = b - 1; if(b == 0) return 1; else { *a = *a+1; return *a + f(a, b); } } int main() { int X = 5; printf("%d\n",f(&X, X)); } Consider this C code. The question here is to predict the output. Logically, I get 31 as ouput. (Output on machine) When I change the return statement to return f(a, b) + *a; I logically get 37. (Output on machine) One of my friends said that while computing the return statement in return *a + f(a, b); we compute the

Angular 2 - How to trigger a method on a child from the parent

一个人想着一个人 提交于 2019-11-28 20:49:00
问题 It's possible to send data from the parent to a child through @Input, or to call a method on the parent from the child with @Output, but I'd like to do exactly the other way around, which is calling a method on the child from the parent. Basically something like that: @Component({ selector: 'parent', directives: [Child], template: ` <child [fn]="parentFn" ></child> ` }) class Parent { constructor() { this.parentFn() } parentFn() { console.log('Parent triggering') } } and the child: @Component