How to use HTML to print header and footer on every printed page of a document?

Is it possible to print HTML pages with custom headers and footers on each printed page? I’d like to add the word “UNCLASSIFIED” in Red, Arial, size 16pt to the top and bottom of every printed page, regardless of the content. To clarify, if the document was printed onto 5 pages, each page should have … Read more

How do I expand the output display to see more columns of a Pandas DataFrame?

Is there a way to widen the display of output in either interactive or script-execution mode? Specifically, I am using the describe() function on a Pandas DataFrame. When the DataFrame is five columns (labels) wide, I get the descriptive statistics that I want. However, if the DataFrame has any more columns, the statistics are suppressed … Read more

How can I flush the output of the print function (unbuffer python output)?

How do I force Python’s print function to output to the screen? 1 13 In Python 3, print can take an optional flush argument: print(“Hello, World!”, flush=True) In Python 2 you’ll have to do import sys sys.stdout.flush() after calling print. By default, print prints to sys.stdout (see the documentation for more about file objects).

What’s the simplest way to print a Java array?

In Java, arrays don’t override toString(), so if you try to print one directly, you get the className + ‘@’ + the hex of the hashCode of the array, as defined by Object.toString(): int[] intArray = new int[] {1, 2, 3, 4, 5}; System.out.println(intArray); // prints something like ‘[I@3343c8b3′ But usually, we’d actually want something … Read more

What’s the simplest way to print a Java array?

Since Java 5 you can use Arrays.toString(arr) or Arrays.deepToString(arr) for arrays within arrays. Note that the Object[] version calls .toString() on each object in the array. The output is even decorated in the exact way you’re asking. Examples: Simple Array: String[] array = new String[] {“John”, “Mary”, “Bob”}; System.out.println(Arrays.toString(array)); Output: [John, Mary, Bob] Nested Array: … Read more

How to print to stderr in Python?

There are several ways to write to stderr: # Note: this first one does not work in Python 3 print >> sys.stderr, “spam” sys.stderr.write(“spam\n”) os.write(2, b”spam\n”) from __future__ import print_function print(“spam”, file=sys.stderr) That seems to contradict zen of Python #13 †, so what’s the difference here and are there any advantages or disadvantages to one … Read more

Print ArrayList

I have an ArrayList that contains Address objects. How do I print the values of this ArrayList, meaning I am printing out the contents of the Array, in this case numbers. I can only get it to print out the actual memory address of the array with this code: for(int i = 0; i < … Read more