POV-Ray : Newsgroups : povray.off-topic : The magic of CSV : The magic of CSV Server Time
4 Sep 2024 17:22:09 EDT (-0400)
  The magic of CSV  
From: Invisible
Date: 2 Dec 2009 11:09:51
Message: <4b16914f$1@news.povray.org>
OK, so today I confirmed that you can in fact export data from the 
Windows event log into a plain CSV file. Which is great.

(Unfortunately, sometimes event descriptions contain line breaks, which 
is not so great.)

Anyway, I wrote a small Haskell program that deletes any multi-line 
events, and then another which grabs only the events I care about and 
does some trixy parsing of the event description to pull out the data I 
actually want. The result is a big CSV file containing a list of printer 
events - date, time, user, printer and page count.

(There is *one* event in the log that says something like "document %4 
was printed on %6, byte count: %7, page count: %8". Which is really not 
especially helpful...)

So now I have a CSV file that contains the date, time, user, printer and 
page count. Just import that into Access and produce some stats, right?

Wrong! Access apparently can't parse any of the dates. Despite them all 
being perfectly valid dates (and it even *detects* that this column 
should be a date column), it fails to parse every single last one. >_<

So I used Haskell (which is really the wrong tool) to produce some 
statistics the hard way - by manually scanning the CSV file, reparsing 
the data and writing the results into yet *another* CSV file.

And now, finally, I have a chart showing me how many pages each printer 
printed on a given day. Which is all I wanted in the first place!

Mmm, apparently that printer in the corner hasn't printed a single 
damned page since July... Yep, it's definitely spare. :-)


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.