pretty-print

Eclipse/CDT Pretty Print Errors

亡梦爱人 提交于 2021-01-28 12:41:11
问题 Let me start by saying that I've scoured other questions on here that are incredibly closely related, but haven't lent themselves to resolving my issue. Setup: Win7 laptop, SSH/X11 to CentOS 6.4 Final running Eclipse Kepler SR2 w/ CDT 8.3 GDB 7.2 Managed corporate server that does not have Internet access (so no svn co... ) I am new to using Eclipse/CDT, but familiar with GDB. When I try to debug an application that uses STL, upon the first occurrence of an STL object, I get the below error(s

Numpy array being rounded? subtraction of small floats

夙愿已清 提交于 2021-01-27 16:05:04
问题 I am assigning the elements of a numpy array to be equal to the subtraction of "small" valued, python float-type numbers. When I do this, and try to verify the results by printing to the command line, the array is reported as all zeros. Here is my code: import numpy as np np.set_printoptions(precision=20) pc1x = float(-0.438765) pc2x = float(-0.394747) v1 = np.array([0,0,0]) v1[0] = pc1x-pc2x print pc1x print pc2x print v1 The output looks like this: -0.438765 -0.394747 [0 0 0] I expected

pretty print not working for c++ stl list

跟風遠走 提交于 2021-01-27 12:24:56
问题 While using gdb for the following code, it appears that pretty print works as expected for stl vector and strings but the output for list seems cryptic. list<int> l; string a = "Hello"; vector<int> v(2,3); l.push_back(5); l.push_back(10); Output of gdb pretty print: (gdb) set print pretty on (gdb) disp v 1: v = std::vector of length 2, capacity 2 = {3, 3} (gdb) disp a 2: a = "Hello" (gdb) disp l 3: l = { <std::__cxx11::_List_base<int, std::allocator<int> >> = { _M_impl = { <std::allocator<std

Pretty-print arrays on failure

℡╲_俬逩灬. 提交于 2021-01-27 08:21:29
问题 describe Rspec do it 'should print arrays in a readable manner' do arr = [ [0, :a, -1], [1, :b, -2], [2, :c, -3], [3, :d, -4], [4, :e, -5], [6, :g, -7], [7, :h, -8], [8, :i, -9] ] arr.should eql [] end end On failure: Failures: 1) Rspec should print arrays in a readable manner Failure/Error: arr.should eql [] expected: [] got: [[0, :a, -1], [1, :b, -2], [2, :c, -3], [3, :d, -4], [4, :e, -5], [6, :g, -7], [7, :h, -8], [8, :i, -9]] Is there a way to tell Rspec to pretty print its failures? My

Pretty-print arrays on failure

孤街醉人 提交于 2021-01-27 08:21:22
问题 describe Rspec do it 'should print arrays in a readable manner' do arr = [ [0, :a, -1], [1, :b, -2], [2, :c, -3], [3, :d, -4], [4, :e, -5], [6, :g, -7], [7, :h, -8], [8, :i, -9] ] arr.should eql [] end end On failure: Failures: 1) Rspec should print arrays in a readable manner Failure/Error: arr.should eql [] expected: [] got: [[0, :a, -1], [1, :b, -2], [2, :c, -3], [3, :d, -4], [4, :e, -5], [6, :g, -7], [7, :h, -8], [8, :i, -9]] Is there a way to tell Rspec to pretty print its failures? My

How do I get python's pprint to return a string instead of printing?

元气小坏坏 提交于 2021-01-16 04:46:26
问题 In other words, what's the sprintf equivalent to pprint? 回答1: The pprint module has a command named pformat, for just that purpose. From the documentation: Return the formatted representation of object as a string. indent, width and depth will be passed to the PrettyPrinter constructor as formatting parameters. Example: >>> import pprint >>> people = [ ... {"first": "Brian", "last": "Kernighan"}, ... {"first": "Dennis", "last": "Richie"}, ... ] >>> pprint.pformat(people, indent=4) "[ { 'first

How do I get python's pprint to return a string instead of printing?

为君一笑 提交于 2021-01-16 04:44:50
问题 In other words, what's the sprintf equivalent to pprint? 回答1: The pprint module has a command named pformat, for just that purpose. From the documentation: Return the formatted representation of object as a string. indent, width and depth will be passed to the PrettyPrinter constructor as formatting parameters. Example: >>> import pprint >>> people = [ ... {"first": "Brian", "last": "Kernighan"}, ... {"first": "Dennis", "last": "Richie"}, ... ] >>> pprint.pformat(people, indent=4) "[ { 'first

Pretty print a table in C++

落爺英雄遲暮 提交于 2020-11-30 05:27:40
问题 I am looking for a library similar to prettytable but in C++ http://code.google.com/p/prettytable/ I know how to generate one myself using either printf or iostream. However, I would like to know if there is a library for this. I am interested only in writing this ASCII table to the console. Preferably something like: std::vector<std::string> headers; headers.push_back("My Awesome Header 1"); headers.push_back("My Awesome Header 2"); headers.push_back("My Awesome Header 3");