Runester
an aperiodic journal

Runester

another AJAX chatter …

February 20th, 2006

Well, I got all excited last week and worked on a simple chat application using AJAX with JSON. I wrote (what I considered) clever spooling code so that multiple simultaneous writes could be dealt with, without file/db collisions. Further, it was interesting to think of the project as a set of client with no server so that all phases (read from DB / write to DB ~or~ spool) are initiated by the chat client.

Anyway, when I succeeded, I lost almost all interest in the project. It was fun while I was problem solving and learning some new things about AJAX and trying out a new (to me) design pattern - but then the project ended and I felt a little let down. That’s it? Another AJAX chatter?

I still have some fantasies about using the same techniques but for something other then human-to-human chatting. I mean, this could easily be adapted for asynchronous system events or news aggragation or something. I do really like the idea of the browser maintaining state and only loading data via XMLHTTPRequest. It was pretty easy for the client (browser with JavaScript) to know which chat messages it already had and request only ‘new’ ones from the server, etc.

Anyway, on Friday I recieved my barcode scanner! So, I’ve been playing around with that. Most of the barcodes I generated using Perl were not actually readable by the scanner - a HUGE disappointment. It turned out that the various symbologies require very specific syntaxes, and a little Perl hacking later and everything was working by the time I left Friday night.

One particular problem, for example, was the GD::Barcode::Code39
module just output the string you give it as a bar pattern - but the actuall specification requires a “Start” and “Stop” character to brace the actual data (namely the asterisk “*”). In fact, when I examined the modules code, I see at least two different places where the author added code to prepend/postpend asterisks, only to comment out the code later. Weird.

Another problem I ran into was actually in the base class GD::Barcode,
there was no way to specify the width or “res” of the bars. They were all drawn as the GD primitive “line(x1,y1,x2,y2,color)”. I overloaded the ‘plot’ method of that object, added a ‘iLineWidth’ parameter and changed the primitive from ‘line’ to ‘filledRectangle’ - and suddenly I can control the display width of the displayed pattern. [This is used for high noise environments like the dusty back of a cargo container, etc.]

I still need to find an encoding that is more compact then Code39, and I need to modify the ‘plot’ method one more time - to differentiate between the displayed text and the actuall text. For example, most barcode labels print the value of the barcode in regular ascii beneath the bars so that the value is human-reabable. Well, I’ve learned (by experimentation) that the human-readable version is digit grouping (using spaces or hyphens) that are NOT encoded in the bars. This makes the barcode smaller (more compact) but the human-readable portion easier to read and remember. For example, “NAT 900-01234″ may actually be encoded as “NAT90001234″. The first is easier for humans to read, the second is smaller because there was no need to encode the extra space and hyphen characters. GD::Barcode doesn’t currently allow that, but it will when I’m done!

All of this is moot - I still need an inventory database schema and data entry application. As usual, this project is taking significantly longer then I had planned!

Leave a Reply

Name

Mail (never published)

Website