HermannSW 2700006U54 Tags:  pbmtobraille graphviz braille dot xslt image non-xml unicode terminal datapower netpbm 2 Comments 831 Visits
HermannSW 2700006U54 Tags:  dot netpbm terminal non-xml pbmtobraille unicode xslt datapower image graphviz braille 7 Comments 1,524 Visits
"ws & comments":"http://www.fileformat.info/format/pbm/egff.htm"
This week I retweeted a last April tweet I stumbled across:
This looked really interesting to me, graphviz dot tool drawing output "inside" the terminal:
I wanted to be able to do same or similar [of course store as file and view via gimp or browser is possible].
Back in 2011 I gave 2 WSTE webcasts on "Non-XML Data Processing in WebSphere DataPower SOA Appliances Stylesheets". The 2nd webcast shows on slide 28 how I did convert a bitmap image into textual output making use of the Braille Patterns.
This is the conversion for snowman.pbm, .pbm is portable bitmap format from netpbm tools:
Typically only the top 2x3 dots of 2x4 get used, as you can see above I used all 2x4.
Here are the numbering of the dots as well as the hex codes are specifed:
There are tons of converters between different formats in netpbm tools, as well as modifiers (like eg. pnmcrop).
In this blog posting I will now talk about new pbmtobraille tool I created.
You find the C source, a syntax highlighted version and sample outputs generated in pbmtobraille.zip for download.
pbmtobraille.c[.pre.html] is a small C program (97 lines without comments containing sample outputs) doing just what it says:
pbmtobraille.c.html is just the syntax highlighted version.
samples.txt[.pre.html] contains various sample output produced (shown below), which are part of pbmtobraille.c's comments too.
9x9.pbm is a really crazy parsing sample according the .pbm spec, following this statement:
This is the header section demonstrating basic use with pbmtext output, including negation of generated output, as well as the help line telling the tool's features:
This is top of tail comment section, showing graphviz output done by pbmtobraille:
And finally this is bottom section showing a bigger layout in vertical direction (layout=TB is default, Top to Bottom):
HermannSW 2700006U54 Tags:  graphviz browser share draw fiddle layout tool 2 Comments 2,358 Visits
Last month posting GraphvizFiddle did provide a nice (cool) tool to automatically layout (directed) graphs and even to load and save the input DOT language files. This was nice and useful, but missed an important feature the other "fiddle" tools I mentioned in the posting provide -- Share!
Since today new "Share" button is available in GraphvizFiddle tool -- let me give an example "shared" link:
If you move your mouse cursor on that link or open it, you will see that I just made the URLencoded DOT file the Fragment part of the URL. This has some nice consequences ;-)
Have fun with the new GraphvizFiddle link feature -- I will twitter some nice ones from time to time myself.
<status>Done with adding all I wanted to add -- have fun with GraphvizFiddle tool.</status>
The tool is online, the initial "viz.js" download of 1.3MB takes a little time:
(when I will figure out how to serve viz.js.gz only 305KB need to be transfered)
This tool is motivated by similar fiddle tools I use:
In "DOT input & control" area you can select Graphviz output format (default svg),
In "[SVG] output" area the graph will be layed out and drawn.
The rest of this posting is structured as follows:
The "standard" way of using Graphviz drawing tools is by installing the Graphviz distribution locally.
A DOT language file can be processed by a public webdot server, and graphviz.org even provides such a server. A sample DOT input file is
Some argument applies to "GViz Helper Tool" and "Graphviz workspace".
Now if really many users at same time or some evildoers access a webdot server it may become unusable quickly. Therefore server-side Graphviz solutions are not scalable.
Basic functionality is to draw graphs specified in input area. After drawing "Draw" button gets greyed out until input changed. No automatic drawing, you have to click on "Draw".
The left selection box allows to specify the output format, "svg" being the default and only fromat visible in browsers.
In order for GraphvizFiddle to be a complete solution at least Load functionality had to be added (by the "Choose File" or "Browse" buttons). Things get difficult with "Save" button. The only portable solution across browsers is to make use of "data:text/plain;charset=utf-8;,..." protocol trick and window.open(). Then browser "Save as" functionality allows to just save the data ("Save" button is available on input as well as output area). Internet Explorer disables windows.open() with "data:..." for security reasons -- but hey, you should use a different browser anyway ;-)
As stated in my previous Graphviz / viz.js posting I still am not able to build viz.js myself. Therefore I just use "http://mdaines.github.io/viz.js/viz.js" (really a local copy of that on my website to make sure that GraphvizFiddle tool is not affected on any bad changes on github version). The Graphviz News page lists lots of versions and so the valid questions is what Graphviz version viz.js does provide. The answer to that question was found surprisingly easy by doing a SVG drawing and clicking on output area "Save" button. The SVG shown just states graphviz version in 2nd line ouf output:
<!--?xml version="1.0" encoding="UTF-8" standalone="no"?--> <!-- Generated by graphviz version 2.28.0 (20110507.0327) --> <!-- Title: minimal_nonplanar_graphs Pages: 1 --> ... The features are limited of cours
The features are limited of course, only dot layout tool is available, and only 7 textual output formats are available (the "svg" one resulting in graphical display in browsers, see http://caniuse.com/svg for detailed browser version support).
Six of the provided 10 samples are from Graphviz Gallery. I did add a comment line to 5 of them. If you just delete the comment start characters ("//") and click on "Draw" you will see some effect without needing to have any knowledge of DOT language.
I did think quite some time what should be the "initial" demo for GraphvizFiddle. Since the tool is on (nice) graph layout definitely planarity is a topic, and so I chose to display the two minimal non-planar graphs and demonstrated the cluster feature of Graphviz. In additon "tooltip" and "URL" are used to demonstrate what you can do to make Graphviz layouts interactive.
The second sample "scalable" is just a graphical representation of what I said in section Scalability of online Graphviz tools.
I did create "number" sample while fixing APAR IC92083 " DATAPOWER FAILS TO PROCESS SOME VALID JSON NUMBERS IN SCIENTIFICNOTATION". I wrote a generator that created 98282 json numbers of 1<=length<=10 from that graph which is now part of DataPower 24x7 testing.
The fourth sample generates a really big output -- no problem with a scalable output format like SVG (// complete f(x)=x² mod 221 graph for Pollard's rho method).
The samples should allow you to have fun with the tool even without knowing the details of DOT language, and to be a starting point for your own experiments.
As always I did test my solution with all big5 browsers, with these versions:
I do the Windows testing in Virtual_Client_for_Linux_Windows_7-KVM.
Theses are the issues I did identify for GraphvizFiddle tool:
I did use Graphviz tool (http://www.graphviz.org/) for more than ten years now -- really cool.
In my 2nd WSTE DataPower webcast back in 2010 you can see on slides 16-18 on how I did use Graphviz for DataPower:
On slide 10 of 1st 2010 WSTE webcast you can see that we use Graphviz in DataPower Compier development as well (top right):
Reason was that I deemed setting up a Web server based Graphviz solution as difficult.
Problem was that emscrypten was not installed, and while there are easy solutions for Windows and Mac OS and some flavors of Linux, for my Redhat flavor of Linux things were not that easy.
BUT the Viz.js example.html page is online, you can just try it out !
AND even better, you can just save the sample page from your web browser as "Web Page, complete", and it will store the HTML page as well as viz.jz allowing you to work with it locally (even without network connectivity).