output

Powershell output

I'm having a little issue with controlling output in ps. Here's the line of code in question; $result|sort-object cn | format-table -wrap -autosize If I append | out-file $logfile the last column of my output is truncated. Now I know that if I changed the width of my console session and run the script again, my output is fine, b...

mysql select into outfile /tmp no output

Hello, I cannot get the following code to generate any output. The MySQL user has "all" grant level, /tmp is writable, the query returns a results set. mysql> SELECT field FROM test_table WHERE condition='test' -> INTO OUTFILE '/tmp/test.csv' -> FIELDS TERMINATED BY ',' -> ENCLOSED BY '"' -> LINES TERMINATED BY '\n'; ...

PHP <<<EOB

I've been developing with PHP for some years now, and recently came across this code: <?php echo <<<EOB <html> <head> <title>My title</title> </head> ... EOB; ?> I've never seen this approach to print HTML, which seems to be pretty useful and less prone to some weird variable or double quote syntax error. I've...

how to write into a text file by C program

my problem is fprintf is only printing part of the expected output into the file.When i use printf the output is correctly printed on the output window, showing that the loop is correct but when i use it with fprintf the complete output is not printed.Only the initial part is printed. PLease advise as to what might possibly be the pro...

How do i output a dynamically generated web page to a .html page instead of .py cgi page?

Hi So ive just started learning python on WAMP, ive got the results of a html form using cgi, and successfully performed a database search with mysqldb. I can return the results to a page that ends with .py by using print statements in the python cgi code, but i want to create a webpage that's .html and have that returned to the user, a...

C# Print Any Complete XML Document to Console?

C# Print Any Complete XML Document to Console? Anyone have a snippet? (Hides behind the cubicle...shit.) ...

Mysql outfile to current working directory?

Is there a way I can make the OUTFILE statement in a .sql file point to the path of the current working directory of the .sql file itself, without manually specifying an absolute path name? As it is now, the default location is the data directory of the schema that I'm working with (ie. C:\progra~1\mysql\etc\etc). Thanks! ...

How do I detect whether sys.stdout is attached to terminal or not?

Is there a way to detect whether sys.stdout is attached to a console terminal or not? For example, I want to be able to detect if foo.py is run via: $ python foo.py # user types this on console OR $ python foo.py > output.txt # redirection $ python foo.py | grep .... # pipe The reason I ask this question is that I want to make su...

How to print '\n' instead of a newline?

I am writing a program that uses prints a hex dump of its input. However, I'm running into problems when newlines, tabs, etc are passed in and destroying my output formatting. How can I use printf (or cout I guess) to print '\n' instead of printing an actual newline? Do I just need to do some manual parsing for this? EDIT: I'm receivin...

Do I need to make sure output data is valid UTF-8?

Hi, I have a website that tells the output is UTF-8, but I never make sure that it is. Should I use a regular expression or Iconv library to convert UTF-8 to UTF-8 (leaving invalid sequences)? Is this a security issue if I do not do it? ...

How to write a word to beginning of each line in a notepad txt file? C++

I want to write a word to each line before all the words. DATA.txt { ie. Hello my name is steven ie. 1.hello 1.my 1.name 1.is 1.steven } IN FILE I/O to put the number 1 and a dot before all the words in the beginning of the line Ok i want it to find the string then ut the certain text "...

Nicely formatting output to console, specifying number of tabs

I am generating a script that is outputting information to the console. The information is some kind of statistic with a value. So much like a hash. So one value's name may be 8 characters long and another is 3. when I am looping through outputting the information with two \t some of the columns aren't aligned correctly. So for example...

MySQL - Disabling the query output and showing only the total execution time taken

I have a stored procedure which I want to test for speed in a production environment. So I created a new stored procedure which calls this for a 100 times, each time with different parameters. My question is: how can I disable the output that the MySQL command line prints as I am sure that this adds to the total time. So, to recap, from ...

Passing PHP output stream to Java

I am building an app using SOAP/web services to interact with a Java API. All was going swimmingly until now. I need to pass an output stream as a param to a Java method from PHP. I am pretty sure I need to use PHP output buffering and fwrite, I am just not sure how to go about it. I know you can use Java in php by using $myJavaFromPHP...

More Control Over C Standard Output

I can't seem to find the right way to ask the almighty google... In such programs as a command-line progress bar, the output buffer seems to be directly manipulated. It can't print a character to a terminal in any place it wants. How is such control over a program's output controlled in standard C? Is there a special library that I c...

JUnit test for System.out.println()

Hi. I need to write JUnit tests for an old application that's poorly designed and is writing a lot of error messages to standard output. When the getResponse(String request) method behaves correctly it returns a XML response: @BeforeClass public static void setUpClass() throws Exception { Properties queries = loadPropertiesFile("req...

Trying to return input from a function in C.

#include <stdio.h> #include <stdlib.h> #include <time.h> void initDeck (int deck[]); void showDeck (int deck[]); void shuffleDeck (int deck[]); int getBet (); main() { int deck[52]; int playerBet; char z; initDeck(deck); shuffleDeck(deck); showDeck(deck); playerBet = getBet(); //scanf ("%d\n", &playe...

Oracle - return newly inserted key value.

We have a table with a Primary Key that gets populated on insert by a trigger on the table - the trigger gets the next sequence number from a sequence we created for the table and uses that for the value of the key on insert. Now we would like to be able to return that value in our insert procedure (PL\SQL), similar to select @@scope_ide...

Formatting a double output using BufferedWriter in Java

I'm working on an assignment, and have completed the code, however I am having an issue with correct formatting of the output. I am taking a text file, separating the products based by price, and appending the data to two separate files. How do I make the format of the double correct with the BufferedWriter so that it appears as money ...

Where does System.Diagnostics.Debug.Write output appear?

Hi, the following C# program (built with csc hello.cs) prints just Hello via Console! on the console and Hello via OutputDebugString in the DebugView window. However, I cannot see either of the System.Diagnostics.* calls - does anybody know why that is? using System; using System.Runtime.InteropServices; class Hello { [DllImport("k...