The Museum of HP Calculators

HP Forum Archive 21

[ Return to Index | Top of Index ]

HP41 barcodes: this one called my attention
Message #1 Posted by Luiz C. Vieira (Brazil) on 5 Apr 2012, 6:56 p.m.

I decided to open a new topic about this because, maybe, it is of common interest.

After opening this page pointed out by Raymond Wiker (original message) I decided to inspect the source code (HTML) of the resulting bar coded page and surprisingly found a sequence of HTML codes like this one:

<rect fill="black" height="30" width="1.575" y="44" x="20"></rect>

I mean, the bars are actually drawn as rectangles with height="30" and width="1.575" for 'zero' or width="3.3249999999999997" for 'one'. y="44" is the relative location of ROW 1, being y="86" for ROW 2, y="128" for ROW 3 and so. The x="20" is the vertical alignment (column) of the bar, and it goes higher (rightmost) for each new bar, depending on the previous one being a '0' or a '1'.

It has probably taken some time to get to this format, but once the bars are generated this way, I guess the printout will be clean and free of bleeding (shaded areas between spaces and bars).

I liked it very much!

Comments?

Thanks.

Luiz (Brazil)

Edited: 6 Apr 2012, 12:06 a.m.

      
Re: HP41 barcodes: this one called my attention
Message #2 Posted by Raymond Wiker on 6 Apr 2012, 3:31 a.m.,
in response to message #1 by Luiz C. Vieira (Brazil)

Glad you liked it :-)

The output is generated using scalable vector graphics (SVN), with the relative widths of zero/one/space given by the recommendations in the HP41 book named "Creating Your Own HP-41 Barcode Manual" (or something very much like it).

The number 3.3249999999999997 should be 3.325, but due to a combination of the inherent inexactitude of floating-point arithmetic and my own inherent lazyness, it ends up looking somewhat odd.

One advantage of using SVN is that the output is scalable, so it is possible to magnify or reduce the output without losing (much) of the accuracy.

Edited: 6 Apr 2012, 3:32 a.m.

            
Re: HP41 barcodes: this one called my attention
Message #3 Posted by Luiz C. Vieira (Brazil) on 6 Apr 2012, 3:51 a.m.,
in response to message #2 by Raymond Wiker

Hi, Raymond.

Congratulations for your excellent bar code creator. It is indeed a lot practical and handy! And because you use vectorized output, printing quality is somehow printer independent.

Quote:
The number 3.3249999999999997 should be 3.325
I was wondering about the reason being related to some floating-point operation, but also considered it was a way to prevent rounding errors to propagate and make bar codes with many bytes harder to read.
Quote:
One advantage of using SVN is that the output is scalable
Indeed, this is undoubtedly a great advantage. I also thought about to print the resulting HTML page as a PDF through some of these low budget, even free PDF converters and test the printed output, but I must confess I did not move ahead with that.

Thanks for sharing your bar code creator.

Cheers.

Luiz (Brazil)

            
Re: HP41 barcodes: this one called my attention
Message #4 Posted by Neil Hamilton (Ottawa) on 6 Apr 2012, 7:27 a.m.,
in response to message #2 by Raymond Wiker

I suspect you mean SVG for Scalable Vector Graphics.

I created a hardware waveform design tool using SVG a couple of years ago and discovered that not all browsers at that time supported it. Notably, IE did not support it "out of the box". My recollection is that you could download a module to make it be recognized by IE but that module kept issuing a warning something to the effect that "you are about to run active code and this may be dangerous". Give me a break!

I use Linux now and am not sure if MS has finally gotten with the program. All other browsers I tested handled SVG natively -- though none handled the SVG test suite flawlessly. Things may be different now.

The absolutely lovely feature about SVG is, as its name implies, that it is scalable and will display nice, crisp edges and figures no matter what scale you render it at.

Great use of the language Raymond!

                  
Re: HP41 barcodes: this one called my attention
Message #5 Posted by Raymond Wiker on 7 Apr 2012, 4:40 p.m.,
in response to message #4 by Neil Hamilton (Ottawa)

Oops... yes, you're right. SVN is the short name for Subversion, which is a version control system.

The web-based generator works for IE9, and possibly also for IE8 - I have not tested IE8. It probably does not work with IE7 or earlier, unless a separate SVG module has been installed.

BTW, for anybody who wants to run the web-based generator on their own site, the code (3 files: index.html, hp41barcode.js, functions.js) can be downloaded from GitHub

                        
Re: HP41 barcodes: this one called my attention
Message #6 Posted by Luiz C. Vieira (Brazil) on 7 Apr 2012, 6:00 p.m.,
in response to message #5 by Raymond Wiker

Hi, Raymond.

In this event, how would you like to be credited? Without credits, I would not dare sharing it...

Cheers.

Luiz (Brazil)

                              
Re: HP41 barcodes: this one called my attention
Message #7 Posted by Raymond Wiker on 8 Apr 2012, 4:04 a.m.,
in response to message #6 by Luiz C. Vieira (Brazil)

A link to the original code repository (http://github.com/rwiker/hp41barcode) should be sufficient. In addition, if you make changes to the code (bug fixes or enhancements), I would appreciate it if you could pass them on to me.


[ Return to Index | Top of Index ]

Go back to the main exhibit hall