pretty-print

Pretty-print types and class template along with all its template arguments

半城伤御伤魂 提交于 2019-11-29 01:47:45
Since typeid(T).name() doesn't return human understandable name of the type, it doesn't help us much if we want to print the name of the template arguments to some class template, especially when we're debugging. We often feel like writing this in debugging: print<Args...>(cout); //dump the names of all types to stdout! So I'm writing pretty-print utility which gives me the name of the class template. Well, it is easier to understand it through some sample usage: print<int>(cout); //prints int print<int, double, char>(cout); //prints int, double, char print<std::string>(cout); //prints std:

Lua indentation code in Lua [closed]

淺唱寂寞╮ 提交于 2019-11-29 01:36:28
Does there exist Lua code to indent Lua code? I have a lot of lua code where indenting it would help, and its in a pure lua environment. In defence of my question: For some of you here the situation here sounds impossible. It is very similar to requesting for Emacs Lisp code to format text. This is a real live working (company internal) Lua environment. This is a pure lua environment. I am looking for a Lua tool which can indent Lua code, not an opinion about the best editor. Paul Kulchenko has provided an amazing solution and so has Yusuf X. I have written a Lua beautifier and applied it to

Simple HTML Pretty Print

◇◆丶佛笑我妖孽 提交于 2019-11-29 00:25:48
http://jsfiddle.net/JamesKyle/L4b8b/ This may be a futile effort, but I personally think its possible. I'm not the best at Javascript or jQuery, however I think I have found a simple way of making a simple prettyprint for html. There are four types of code in this prettyprint: Plain Text Elements Attributes Values In order to stylize this I want to wrap elements , attibutes and values with spans with their own classes. The first way I have of doing this is to store every single kind of element and attribute (shown below) and then wrapping them with the corresponding spans $(document).ready

Best way to pretty print XML response in grails

▼魔方 西西 提交于 2019-11-28 23:38:45
Given this in a grails action: def xml = { rss(version: '2.0') { ... } } render(contentType: 'application/rss+xml', xml) I see this: <rss><channel><title></title><description></description><link></link><item></item></channel></rss> Is there an easy way to pretty print the XML? Something built into the render method, perhaps? According to the reference docs , you can use the following configuration option to enable pretty printing: grails.converters.default.pretty.print (Boolean) //Whether the default output of the Converters is pretty-printed ( default: false ) This is a simple way to pretty

How to pretty print in ipython notebook via sympy?

久未见 提交于 2019-11-28 20:05:41
I tried pprint , print , the former only prints Unicode version, and the latter doesn't do pretty prints. from sympy import symbols, Function import sympy.functions as sym from sympy import init_printing init_printing(use_latex=True) from sympy import pprint from sympy import Symbol x = Symbol('x') # If a cell contains only the following, it will render perfectly. (pi + x)**2 # However I would like to control what to print in a function, # so that multiple expressions can be printed from a single notebook cell. pprint((pi + x)**2) you need to use display: from IPython.display import display

A way to pretty print a C# object

对着背影说爱祢 提交于 2019-11-28 19:05:21
I have a text box and I want to display a C# object in it in a human-readable way, just for debugging reasons. I don't want to use external libraries if possible. How do I do this? Serialize it to JSON. It can be done in the ToString() method like others suggested, but I don't think that is appropriate if you are going to use that for debugging only. If you use Json then I would suggest using Newtonsofts Json library and then you can output the entire object in Json notation and it will format it with spacing and line breaks. we have used this to display complex objects easily for debug

Is there a PowerShell code formatter / pretty printer? [closed]

安稳与你 提交于 2019-11-28 17:47:28
I'm looking for a source code beautifyer for PowerShell programs. Ideally, it would be CLI based, but any solution is acceptable. I would like to avoid configuring a generic pretty printer tool; I'd like a solution that works for PowerShell out of the box. Is there such a thing? UPDATE: it's now on GitHub: https://github.com/DTW-DanWard/PowerShell-Beautifier I wrote a PowerShell pretty printer / code cleaner in PowerShell. It cleans white space, indents code groups, replaces aliases with commands, fixes casing on commands, parameters, types, etc. You can use it to reformat a file in place or

Scala - how to print case classes like (pretty printed) tree

瘦欲@ 提交于 2019-11-28 17:45:37
I'm making a parser with Scala Combinators. It is awesome. What I end up with is a long list of entagled case classes, like: ClassDecl(Complex,List(VarDecl(Real,float), VarDecl(Imag,float))) , just 100x longer. I was wondering if there is a good way to print case classes like these in a tree-like fashion so that it's easier to read..? (or some other form of Pretty Print ) ClassDecl name = Complex fields = - VarDecl name = Real type = float - VarDecl name = Imag type = float ^ I want to end up with something like this edit: Bonus question Is there also a way to show the name of the parameter..?

Pretty-Print JSON Data to a File using Python

梦想的初衷 提交于 2019-11-28 17:08:17
A project for class involves parsing Twitter JSON data. I'm getting the data and setting it to the file without much trouble, but it's all in one line. This is fine for the data manipulation I'm trying to do, but the file is ridiculously hard to read and I can't examine it very well, making the code writing for the data manipulation part very difficult. Does anyone know how to do that from within Python (i.e. not using the command line tool, which I can't get to work)? Here's my code so far: header, output = client.request(twitterRequest, method="GET", body=None, headers=None, force_auth

How to Pretty print VBA code?

核能气质少年 提交于 2019-11-28 16:41:12
问题 How do you copy VBA code into a Word document and retain the VBA editor color scheme? 回答1: You can use Notepad++ to accomplish this in three ways. Just so you know, Notepad++ is a more advanced version of Notepad, which supports syntax highlighting of different code files "out of the box" - Visual Basic included! Download & install it, fire it up, and load up your VBA code. You should automatically see it beautifully coloured (if not, because the file extension is something other than .vb ,