output

Writing to CSV from list, write.row seems to stop in a strange place

寵の児 提交于 2019-11-26 23:33:13
问题 I am attempting to merge a number of CSV files. My Initial function is aimed to: Look Inside a directory and count the number of files within (assume all are .csv) Open the first CSV and append each row into a list Clip the top three rows (there's some useless column title info I don't want) Store these results in an a list I've called 'archive Open the next CSV file and repeat(clip and append em to 'archive') When we're out of CSV files I wanted to write the complete 'archive' to a file in

Java: is there a way to run a system command and print the output during execution?

痴心易碎 提交于 2019-11-26 23:30:55
问题 I have a python script and it takes a long time to finish. I would like to run it from Java, but also output the script's output while it is executing, so that I can tell if it is properly running. I've searched and only found examples where we output the output after the system command has finished, rather than during its execution. Any way to do it while the script is running? Here's what I have public void doSomething() throws IOException { String[] callAndArgs = {"python", "/hi.py"};

Xcode - how to see build command and log?

廉价感情. 提交于 2019-11-26 22:50:55
问题 I have build errors in my Xcode project (Objective-C), and I no longer "stumble upon" the build command string nor the build output logs. This is Xcode 6.3.1. All I can inspect is a left-side panel listing errors/warnings. I want the build command and build console output to compare between two projects; there's a platform-specific issue present in one but not the other; my intuition says that the build settings are different between the two and that seeing the output would be the easiest way

Android : Force audio routing

[亡魂溺海] 提交于 2019-11-26 22:00:29
问题 I would like to change the sound device output in my Android app. I want to use the speaker of the phone when the headset plugged. I've tried to use setSpeakerphoneOn from AudioManager class audioManager.setSpeakerphoneOn(true); with audioManager.setMode(AudioManager.MODE_IN_CALL); but I don't want to set the MODE_IN_CALL ! I want to stay in MODE_NORMAL. I've search around the AudioSystem class and I've found an application, "SoundAbout", which do that. You can choose the speaker for media

How to save the output of this awk command to file?

前提是你 提交于 2019-11-26 22:00:16
问题 I wanna save this command to another text: awk '{print $2}' it extract's from text. now i wanna save output too another text. thanks 回答1: awk '{ print $2 }' text.txt > outputfile.txt > => This will redirect STDOUT to a file. If file not exists, it will create it. If file exists it will clear out (in effect) the content and will write new data to it >> => This means same as above but if file exists, this will append new data to it. Eg: $ cat /etc/passwd | awk -F: '{ print $1 }' | tail -10 >

Parsing the output of Bash's time builtin

回眸只為那壹抹淺笑 提交于 2019-11-26 21:40:31
问题 I'm running a C program from a Bash script, and running it through a command called time, which outputs some time statistics for the running of the algorithm. If I were to perform the command time $ALGORITHM $VALUE $FILENAME It produces the output: real 0m0.435s user 0m0.430s sys 0m0.003s The values depending on the running of the algorithm However, what I would like to be able to do is to take the 0.435 and assign it to a variable. I've read into awk a bit, enough to know that if I pipe the

What does flushing the buffer mean?

末鹿安然 提交于 2019-11-26 21:31:17
I am learning C++ and I found something that I can't understand: Output buffers can be explicitly flushed to force the buffer to be written. By default, reading cin flushes cout ; cout is also flushed when the program ends normally. So flushing the buffer (for example an output buffer): does this clear the buffer by deleting everything in it or does it clear the buffer by outputting everything in it? Or does flushing the buffer mean something completely different? David Heffernan Consider writing to a file. This is an expensive operation. If in your code you write one byte at a time, then each

What does an integer that has zero in front of it mean and how can I print it?

*爱你&永不变心* 提交于 2019-11-26 21:06:37
class test{ public static void main(String args[]){ int a = 011; System.out.println(a); } } Why I am getting 9 as output instead of 011 ? How can I get 011 as output? The JLS 3.10.1 describes 4 ways to define integers. An integer literal may be expressed in decimal (base 10), hexadecimal (base 16), octal (base 8), or binary (base 2). An octal numeral consists of a digit 0 followed by one or more of the digits 0 through 7 ... A decimal numeral is either the single digit 0, representing the integer zero, or consists of an digit from 1 to 9 optionally followed by one or more digits from 0 to 9 ..

How can I suppress column header output for a single SQL statement?

独自空忆成欢 提交于 2019-11-26 18:39:50
I'm executing some SQL statements in batch (using the mysql command-line binary). I want one of my several SELECT statements to not print the column headers, just the selected records. Is this possible? Invoke mysql with the -N (the alias for -N is --skip-column-names ) option: mysql -N ... use testdb; select * from names; +------+-------+ | 1 | pete | | 2 | john | | 3 | mike | +------+-------+ 3 rows in set (0.00 sec) Credit to ErichBSchulz for pointing out the -N alias. To remove the grid (the vertical and horizontal lines) around the results use -s ( --silent ). Columns are separated with a

How to use python numpy.savetxt to write strings and float number to an ASCII file?

人盡茶涼 提交于 2019-11-26 18:38:30
I have a set of lists that contain both strings and float numbers, such as: import numpy as num NAMES = num.array(['NAME_1', 'NAME_2', 'NAME_3']) FLOATS = num.array([ 0.5 , 0.2 , 0.3 ]) DAT = num.column_stack((NAMES, FLOATS)) I want to stack these two lists together and write them to a text file in the form of columns; therefore, I want to use numpy.savetxt (if possible) to do this. num.savetxt('test.txt', DAT, delimiter=" ") When I do this, I get the following error: >>> num.savetxt('test.txt', DAT, delimiter=" ") Traceback (most recent call last): File "<stdin>", line 1, in <module> File "