pretty-print

Putting each attribute on a new line during xml serialization

Lets say I have a DOM object (or a string containing xml). Is it in any way possible to serialize the xml in such a way that each attribute appears on a new line? This is the output I want: <parent> <anElement attrOne="1" attrTwo="2" attrThree="3" /> </parent> Preferred if the solution a part of the ...

How to format code in html / css / js/ php

I'm looking for a way to automatically format and color code I write in an HTML document. I know wikipedia does it, for example on the page: http://en.wikipedia.org/wiki/Nested_function I'm sure there are libraries out there to do this, but I can't for the life of me, find one. Does anyone have any suggestions? ...

How to format numbers according to locale in Haskell?

In Python I can use locale.format to pretty-print numbers according to locale setting: >>> import locale >>> locale.setlocale(locale.LC_ALL, "en_US.UTF-8") 'en_US.UTF-8' >>> locale.format("%.2f",1234567.89,grouping=True) '1,234,567.89' How can I do the same in Haskell? I see that there are localeconv and setlocale bindings, but is the...

A beautifier for lisp?

Are there any beautifiers for (e)lisp? Online preferred ...

Pretty Print Excel Formulas?

Does anyone know of a (free) tool to pretty print Excel formulas? A Google search didn't turn anything up. I've got a few worksheets of semi-complex formulas to slog through, so this would make my life a bit easier. I'm just looking to turn something like this AC6+AD6+(IF(H6="Yes",1,IF(J6="Yes",1,0)))+IF(X6="Yes",1,0) into somethin...

encode xml while printing SOAPMessage

Hi, I have written a function to pretty print a javax.xml.soap.SOAPMessage to a string: public static String soapMessageToString (SOAPMessage msg) { try { Writer out = new StringWriter(); TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = t...

How do I print out a tree structure?

I'm trying to improve performance in our app. I've got performance information in the form of a tree of calls, with the following node class: public class Node { public string Name; // method name public decimal Time; // time spent in method public List<Node> Children; } I want to print out the tree such that I can see li...

Ruby Configure IRB to Pretty_Inspect by Default

Hi Guys, I'm fairly new to ruby, and am configuring IRB. I like pretty print (require 'pp'), but it seems a hassle to always type pp for it to pretty print it. What I'd like to do is make it pretty print by default, so if i have a var , say, 'myvar', and type myvar, it automatically calls pretty_inspect instead of the regular inspect...

Pretty print a tree

Let's say I have a binary tree data structure defined as follows type 'a tree = | Node of 'a tree * 'a * 'a tree | Nil I have an instance of a tree as follows: let x = Node (Node (Node (Nil,35,Node (Nil,40,Nil)),48,Node (Nil,52,Node (Nil,53,Nil))), 80,Node (Node (Nil,82,Node (Nil,83,Nil)),92,Node (Nil,98,Nil))) I...

Hibernate: OutOfMemoryError persisting Blob when printing log message

I have a Hibernate Entity: @Entity class Foo { //... @Lob public byte[] getBytes() { return bytes; } //.... } My VM is configured with a maximum heap size of 512 MB. When I try to persist an object which has a 75 MB large object, I get an OutOfMemoryError. The names of the methods in the stack trace (StringBuilder,...

How to turn off the Eclipse code formatter for certain sections of Java code?

I've got some Java code with SQL statements written as Java strings (please no OR/M flamewars, the embedded SQL is what it is - not my decision). I've broken the SQL statements semantically into several concatenated strings over several lines of code for ease of maintenance. So instead of something like: String query = "SELECT FOO, BAR...

How to handle widespread code format changes in a git repository

We have a project with around 500,000 lines of code, managed with git, much of it several years old. We're about to make a series of modifications to bring the older code into conformance with the developer community's current standards and best practices, with regards to naming conventions, exception handling, indentation, and so forth...

PHP SimpleXML new line

Hi, I have created a XML file using PHP's simple XML, saved the file. When opening the file in php using fopen and printing the contents. my XML looks like this: (see below) <?xml version="1.0" encoding="UTF-8"?> <home><orderList><delivery_cost>0.00</delivery_cost><delivery_surname>TEST</delivery_surname><delivery_postcode>1234</delive...

Nokogiri pretty printing

Sorry for this question, apparently all my googling and api searching skills must be failing me. I've written a web crawler in ruby and I'm using Nokogiri::HTML to parse the page. I need to print the page out and while messing around in IRB I noticed a pretty_print method. However it takes a parameter and I can't figure out what it wants...

Combine lxml XSLT pretty_print with strip-space

I'm cleaning up some gross XML, and so I've had pretty_print = True set in the call to etree.tostring() on my lxml output of the XSL transform. However, that left me with a few junk whitespace nodes from the original input, so I added <xsl:strip-space elements="*"/> ...but that completely collapses all whitespace, ignoring pretty prin...

Is there free text editor for JSON pretty print

Is there free text editor with JSON formatting capabilities like XML Tools for Notepad++? I tested some of Adobe AIR editors and all editors are completely lack of other must have text editing features. Ideally it should be a notepad++ plugin :). ...

Haskell -- problem with pretty-printing a list

I'm new to haskell, and i read through and digested Learn You A Haskell For Great Good, trying out a couple of things along the way. For my first project i wanted to try the classic: FizzBuzz. So i came up with the following code: import System.IO fizzBuzz :: (Integral a) => a -> String fizzBuzz num | fizz && buzz = "FizzBuzz" ...

Use PHP to format an input SQL query as HTML?

What I am looking for is a php function that takes an unformatted query like this: $sql = "select name, size from things where color = 'green' order by price asc"; so that it would appear in an HTML page something like this: SELECT name, size FROM things WHERE color = 'green' ORDER BY price ASC'; There's some co...

Formatting Ruby's prettyprint

Is it possible to change the width that prettyprint (require 'pp') uses when formatting output? For example: "mooth"=>["booth", "month", "mooch", "morth", "mouth", "mowth", "sooth", "tooth"] "morth"=>["forth", "mirth", "month", "mooth", "morph", "mouth", "mowth", "north", "worth"] The first array is printed inline because it f...

A command-line HTML pretty-printer: Making messy HTML readable

I'm looking for recommendations for HTML pretty printers which fulfill the following requirements: Takes HTML as input, and then output a nicely formatted/correctly indented but "graphically equivalent" version of the given input HTML. Must support command-line operation. Must be open-source and run under Linux. ...