output

Capture Console Output of a Specific Thread in Java

I realize there are similar questions on SO, but they don't quite solve my problem. I would like a method that, given a Class object, will invoke the "main" method, that is to say, public static void main, on that Class (if it exists) and capture the console output of that main method. The class doing the invocation is a non-daemon thr...

Printing thousand seperated floats with GAWK

I must process some huge file with gawk. My main problem is that I have to print some floats using thousand separators. E.g.: 10000 should appear as 10.000 and 10000,01 as 10.000,01 in the output. I (and Google) come up with this function, but this fails for floats: function commas(n) { gsub(/,/,"",n) point = index(n,".") - 1 if ...

Cannot retrieve output parameters from MSSQL stored procedure using PHP

I am executing a MSSQL stored procedure that is supposed to return an output parameter (ErrCode), as well as a resultset. I am calling the procedure from PHP using the following code, but so far have been unable to retrieve the output parameter: $stmt = mssql_init("addFaculty", $this->db); mssql_bind($stmt, "@FacultyID", $FacultyID, S...

How can I read the error output of external commands in Perl?

As part of a larger Perl program, I am checking the outputs of "diff" commands of input files in a folder against reference files, where a blank output (a match) is a passing result, and any output from diff is a fail result. The issue is, if the target folder is short on the number of expected files, the exception diff throws doesn't c...

Hadoop: map/reduce from HDFS

I may be wrong, but all(?) examples I've seen with Apache Hadoop takes as input a file stored on the local file system (e.g. org.apache.hadoop.examples.Grep) Is there a way to load and save the data on the Hadoop file system (HDFS)? For example I put a tab delimited file named 'stored.xls' on HDFS using hadoop-0.19.1/bin/hadoop dfs -put...

Why does my Falcon script print the date a month ahead instead of today's date?

Today is April 25, 2009 which in US format is abbreviated month-day-year, so today is 04-25-09. This line > CurrentTime().toString("%m-%d-%y") should print "04-25-09". Instead it prints "05-25-09". Why is that? According to the docs CurrentTime() returns a TimeStamp instance. TimeStamp has a toString() method which accepts a date/time...

Will this redirection ">>& <filename>" work in Korn shell?

I am trying to redirect both STDOUT/STDERR of a UNIX command and append to a log file in a korn shell. rm -rf file1 >>& logfile Will this command work in ksh or is this a typical bash command? What harm would I be causing with above command? ...

Can I stop std::cout flushing on "\n"?

Hi, According to to this post std::cout will automatically flush on \n when it is attached to an interactive device (e.g. a terminal window). Otherwise (e.g. when being piped to a file) it will act fully buffered and will only flush on .flush() or std::endl. Is there a way to override this behaviour in Microsoft Visual C++ so that I ca...

mod_wsgi yield output buffer instead of return

Right now I've got a mod_wsgi script that's structured like this.. def application(environ, start_response): status = '200 OK' output = 'Hello World!' response_headers = [('Content-type', 'text/plain'), ('Content-Length', str(len(output)))] start_response(status, response_headers) return [output...

What is the PHP syntax for File/terminal output formatting?

I want to create a command line program using PHP. How do I design the program's I/O? I can send output as text. I am wondering about the specific output syntax. For example: In HTML i use <br/> to pass to a new line. How can I do this using terminal/file output? Is there a reference for terminal/file oriented programming in PHP? ...

Haskell: Printing out the contents of a list of tuples

Basically what I need to do is write a function that takes in a list of type [(String,String)] and print out the contents so that, line-by-line, the output looks like this: FirstString : SecondString FirstString : SecondString ..etc, for every item in the list. I've got the following code and it prints it out, but for some reason it p...

Stored proc Output parameter + Select not passing back output parameter

Hi I have a stored procedure that returns two recordsets which i call using GetReader. I iterate the first, call IDataReader.NextResult(), then iterate the second. I assign values to output parameters in the sp, but when i check the values after finishing with my reader, my output parameters are null. Looks like a bug. I don't want to ...

C#: Printing all properties of an object

Is there a method built in to .NET that can write all the properties and such of an object to the console? Could make one using reflection of course, but I'm curious to if this already exists... especially since you can do it in Visual Studio in the Immediate Window. There you can an object name (while in debug mode), press enter, and it...

How to determine where a number is printing from in MATLAB?

In MATLAB, how do you tell where in the code a variable is getting output? I have about 10K lines of MATLAB code with about 4 people working on it. Somewhere, someone has dumped a variable in a MATLAB script in the typical way: foo Unfortunately, I do not know what variable is getting output. And the output is cluttering out other mo...

How does <iostream> work? (C++)

Just out of curiosity, how does iostream access the input-output system. (I have a bad habit of constantly reinventing the wheel, and I'm wondering if I can build a custom input-output system to the likes of iostream). ...

nant script doesn't display unit test details

Can someone please tell me why my build script (nant) doesn't display the unit test details in the command prompt window? I have verbose set to true, but it doesn't want to display any details about my unit tests. Here's the target: <target name="run-unit-tests" depends="compile, move.assemblies.for.tests, rebuildDatabase"> <mkdir ...

C# How To Read Console Output With Parameters

Is it possible to run a console application and get its outputted contents back as a string in C#? I want to be able to use parameters when running the console app: c:\files\app.exe -a 1 -b 2 -c 3 ...

Why does this program display seemingly random characters? (C++)

Well, not random, because its the same every time, but #include<iostream> using namespace std; int main() { char box[10][10]; for(int i=-1;i<11;i++) { cout<<"---------------------"<<endl<<"|"; for(int j=0;j<10;j++) { cout<<box[j][i]<<"|"; } cout<<endl; } intx;cin>>x...

PHP - Output Firefox JSON data

Is it possible to output specific JSON data (exported from Firefox bookmarks) using PHP. This is the code which I have so far, it will re-encode the data as Firefox doesn't export it in the correct UTF-8 way. I also remove the trailing , from the end of the file. <?php // Read the file blah blah $hFile = "../uploads/james.json"; $hFile...

outputstream response.redirect binary

Hello guys, I need from a c# code to make a redirect and pass data to it. Can sy point me the right direction? how to write binary data on an httpcontext, redirect it to http://myserver/hello.aspx and take back this binary on the page load of http://myserver/hello.aspx thx in advance ...