Questions tagged [output]

The externally observable consequences of calling a program on some input

The output of a program is the set of externally observable consequences of running a program on the given input.

A program's output can be manifested in several forms:

  1. What is printed to and/or
  2. What is written to an external file
  3. What changes are made to the inputs, which are then used in other functions or programs
9797 questions
16
votes
4 answers

Behavior of 2D arrays

I have created a 2D array, and tried to print certain values as shown below: int a[2][2] = { {1, 2}, {3, 4}}; printf("%d %d\n", *(a+1)[0], ((int *)a+1)[0]); The output is: 3 2 I understand why 3 is the first output (a+1 points to…
Kevin Richards
  • 570
  • 1
  • 6
  • 23
16
votes
8 answers

How to execute a python script and write output to txt file?

I'm executing a .py file, which spits out a give string. This command works fine execfile ('file.py') But I want the output (in addition to it being shown in the shell) written into a text file. I tried this, but it's not working :( execfile…
user2957951
  • 303
  • 2
  • 4
  • 11
16
votes
4 answers

Completely disable IPython output caching

I'm dealing with some GB-sized numpy arrays in IPython. When I delete them, I definitely want them gone, in order to recover the memory. IPythons output cache is quite annoying there, as it keeps the objects alive even after deleting the last…
Michael
  • 7,316
  • 1
  • 37
  • 63
15
votes
5 answers

Order of request.getParameterNames()

How do I get all the parameterNames in an HTML form in the same sequence? Example: If the form contains FirstName, LastNameand Age The output should appear exatcly in the same sequence I have tried using the following but this shifts the order…
jcdmb
  • 3,016
  • 5
  • 38
  • 53
15
votes
2 answers

gradle get resources default output directory

Gradle: how to get default resources output dir? println sourceSets.main.resources.outputDir Error: Needs to set a non-null value before it can be retrieved
eastwater
  • 4,624
  • 9
  • 49
  • 118
15
votes
3 answers

Python: How to read stdout of subprocess in a nonblocking way

I am trying to make a simple python script that starts a subprocess and monitors its standard output. Here is a snippet from the code: process = subprocess.Popen([path_to_exe, os.path.join(temp_dir,temp_file)], stdout=subprocess.PIPE) while True: …
pineappleman
  • 849
  • 4
  • 8
  • 20
15
votes
2 answers

How to output smooth cspline curve as a data file

Does anybody know how to extract some data of smooth cspline curve for a given data? For instance, there is a data file which has 2 columns corresponding to x and y values. I can draw the data with smooth cpline curve by the following commands p…
user4914499
  • 344
  • 1
  • 3
  • 12
15
votes
5 answers

Why doesn't this code using printf and cout have the expected output?

I have the following code: int main () { ios_base::sync_with_stdio(false); cin.tie(NULL); for (int i = 0; i < 3; i++) { cout << i << " "; printf("%d ", i); } cout << endl; return 0; } The expected…
Reynaldo Aguilar
  • 1,906
  • 1
  • 15
  • 29
15
votes
7 answers

Visual Studio Express 2013: Program output in unit tests (console, debug etc.)

I'm really banging my head against the wall here. Is it so hard to get program output in Visual Studio (Express 2013)? When writing code, I find it absolutely essential to be able to print out the values of variables, operations etc. while working…
15
votes
1 answer

c# execute shell command and get result

I am executing a command prompt command as follows: string cmd = "/c dir" ; System.Diagnostics.Process proc = new System.Diagnostics.Process(); proc.StartInfo.FileName = "cmd.exe"; proc.StartInfo.Arguments = cmd; proc.StartInfo.UseShellExecute =…
Mika
  • 1,195
  • 6
  • 22
  • 34
15
votes
7 answers

Print Integer with 2 decimal places in Java

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?
user1749458
  • 153
  • 1
  • 1
  • 6
14
votes
3 answers

Error when checking target: expected dense_1 to have 3 dimensions, but got array with shape (118, 1)

I'm training a model to predict the stock price and input data is close price. I use 45 days data to predict the 46th day's close price and a economic Indicator to be second feature, here is the model: model = Sequential() model.add( LSTM( 512,…
Chris Wong
  • 143
  • 1
  • 1
  • 6
14
votes
3 answers

Xcode 8 (Swift) No print output in Console

The question in the topic: Why no print output in Console using Simulator? Is it disabled or this is a bug?
Alex Pilugin
  • 683
  • 2
  • 10
  • 38
14
votes
4 answers

Xamarin.Forms - Debug.WriteLine() - where does the output go?

I have a simple Xamarin.Forms project that I'm running in Visual Studio, using an iphone emulator. I have the following code in App.cs: protected override void OnStart() { Debug.WriteLine("---------- OnStart called!"); } Where exactly is that…
jbyrd
  • 5,287
  • 7
  • 52
  • 86
14
votes
7 answers

Scanning multiple lines using single scanner object

I a newbie to java so please don't rate down if this sounds absolute dumb to you ok how do I enter this using a single scanner object 5 hello how do you do welcome to my world 6 7 for those of you who suggest…
Creative_Cimmons
  • 255
  • 1
  • 2
  • 11