Just another Perl shrine | |
PerlMonks |
Visualizing bugsby brian_d_foy (Abbot) |
on Dec 19, 2004 at 17:09 UTC ( [id://416010]=perlmeditation: print w/replies, xml ) | Need Help?? |
I needed to cycle through a collection of external files, but I wanted to do it in a random order, and I also wanted to go through all of the files before I went through any file twice. There are all sorts of ways to implement this, so that's not really a big deal. Somewhere I had an error that was giving me repeated files before I had finished a complete cycle, so I need to track that down, and I did, and it was fixed. But was it really fixed? I wondered how I could test this. I could simply count every time I saw the file and compare all the counts at various times. That works. I wanted to watch it though. I didn't want to speed read as a bunch of text lines scrolled past on the terminal. I wanted so compact output that would fit on the screen and updated as things happened, so I wrote a little Curses visualizer. The particulars of the program aren't important. It output a string with two numbers which identified the resource. The first number was between 1 and 9 and the second was between 1 and 80. On the screen, I framed a matrix for these. At the right spot, I'd put something on the screen to show something just happened for the file with those two numbers. I started with the count of the times I had seen that file. When I saw the file once, I'd put a "1" in the matrix, when I saw it twice, a "2", and so on. That kinda worked, but it was hard to read. Then I used other characters in place of number and alternated between characters with lots of empty space and those without a lot, such as ( . @ ^ # , $ | & + ). That was better, but still not good enough. I was running this things for a couple implementations and I wanted to see an anomaly instantly. I changed to simple, colored blocks instead of characters. I just made a bunch of Curses pairs that had the same foreground and background and assigned each color to a number of times I saw the file. I went in the order of the rainbow: blue for 1 time, green for 2 times, and so on. Too bad I can't show some images inline, so you'll have to be satisfied with some external images: first pass through the corpus (black is 0 times and blue is 1 time ), second pass (green is 2 times). I could have also done this with sound by playing a specific pitch for each count and I wouldn't even have to watch it. I could almost tune out because the odd pitch would get my attention.
-- brian d foy <bdfoy@cpan.org>
Back to
Meditations
|
|