Giter VIP home page Giter VIP logo

tx's Introduction

Erlang Term Explorer (TX)

This app was created to fill the void in the data visualisation area. And to help you follow "know your data" paradigm. Basically it shows you your data in web browser via webserver listening to localhost.

What does it look like?

Features

  • tx:show(Term) and tx:show(Term, Title)
    • Given an arbitrary term, saves it temporarily and creates an unique URL to it (similar to Pastebin but with faster/manual expiration). Click the URL or copy and open in your web browser (Javascript required).
  • tx:redbug(Spec) and tx:redbug(Spec, Options)
    • If you have Redbug available, then tx will run redbug:start and capture events output, then store it in a regular way as a browsable term.
  • Process and ports are "inspectable", just click one to see.
  • Proplists with printable keys are detected and formatted tidier.
  • Uses only standard Erlang libraries (inets), no external dependencies.

How to begin

Add https://github.com/kvakvs/tx as your application dependency or download it and compile manually. Run your application as usual. When you need to see things, call tx:show(Term). in Erlang console or insert call to tx:show where you need it. URL is returned from tx:show, and Erlang shell will display it. NOTE: return value won't be displayed if you call tx:show in your code.

Application tx will be started automatically and web server will be opened on your first call of tx:show/1. Alternatively run tx manually via: tx:start().. Default port is 20000, and default host is localhost. You can set port to 0 in tx.app.src, to start on random available port.

Example

Simple demo: tx:show(application:which_applications()).

All sorts of terms in one: tx:show([<<123,32,1>>, <<1:1, 3:5, 45:7>>, <<"test\ttest">>, 123, 123.321, make_ref(), self(), erlang:ports(), fun()->ok end, {fun erlang:ports/0, 'test', "test"}, [{test, value1}, {fgsfds, 1000}], [1,2,3|{4, [5|test]}]]).

R17 maps example: tx:show(#{k1 => "test", k2 => 'test', k3 => 123, k4 => <<"test">>}).

TODO

Possible things to add of improve

  • Support compact display of value-only tuples and lists (multiple values per line)
  • ? Backend could recognize record definitions and supply field information to frontend
  • Paste term from clipboard
  • Implement automatic expiration (cleanup loop on timer)
  • Toolbox for External Term Format: encode, decode, compress, view in hex etc.
  • Unfold the whole thing into introspection tool like tv (table viewer) or observer.

tx's People

Contributors

kvakvs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tx's Issues

Incorrect display for some lists

[1, [3|a]]

This is returned by tx as

{ "parsed": {"t":"l","v":[{"t":"i","v":"1"},{"t":"i","v":"3"}],"tail_element":{"t":"a","v":"a"}},
  "raw":"[1,3|a].",
  "title":"No name",
  "expires":1419148925
}

which is not entirely true, I think :)

Crash on very long nested term

Very long Redbug dump with webmachine contexts in it (which are very nested) causes crash.
Due to improper lists, very likely.

Can't show the term

Term:

{error,{asn1,{wrong_tag,{{expected,16},
                         {got,131073,
                              {131073,
                               [{2,<<0>>},
                                {2,<<0>>},
                                {16,
                                 [{131072,<<1>>},
                                  {131074,<<4,16,151,32,130,4,6,240>>},
                                  {131075,<<132,17,151,37,132,146,8,7>>},
                                  {131077,<<"\n">>},
                                  {131080,<<0>>},
                                  {131082,<<132,147,24,38,3>>},
                                  {131084,<<3,20,89,66,40,137,80>>},
                                  {131095,<<145,129>>},
                                  {131099,[{131072,<<128,144,163>>}]},
                                  {131100,<<2>>},
                                  {131101,<<3,20,89,66,40,137,80>>},
                                  {131102,<<3,97>>},
                                  {131122,<<82,32,80,5,96,41,152,249>>},
                                  {131125,[{131075,<<17>>}]},
                                  {131126,<<65,51,1,54,3,55,150>>},
                                  {131127,<<145,151,32,130,147,149,241>>},
                                  {131129,<<2,65,144,48,97,16,101,97>>},
                                  {131131,
                                   [{131073,
                                     <<145,151,32,130,147,149,241>>}]}]}]}}}}}}

tx error:

{exit,{ucs,{bad_utf8_character_code}},
      [{xmerl_ucs,from_utf8,1,[{file,"xmerl_ucs.erl"},{line,185}]},
       {tx_mochijson2,json_encode_string,2,
                      [{file,"src/tx_mochijson2.erl"},{line,200}]},
       {tx_mochijson2,'-json_encode_proplist/2-fun-0-',3,
                      [{file,"src/tx_mochijson2.erl"},{line,181}]},
       {lists,foldl,3,[{file,"lists.erl"},{line,1248}]},
       {tx_mochijson2,json_encode_proplist,2,
                      [{file,"src/tx_mochijson2.erl"},{line,184}]},
       {tx_mochijson2,'-json_encode_array/2-fun-0-',3,
                      [{file,"src/tx_mochijson2.erl"},{line,171}]},
       {lists,foldl,3,[{file,"lists.erl"},{line,1248}]},
       {tx_mochijson2,json_encode_array,2,
                      [{file,"src/tx_mochijson2.erl"},{line,173}]}]}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.