HP41 barcodes: this one called my attention



#4

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.


#5

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.


#6

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)

#7

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!


#8

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


#9

Hi, Raymond.

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

Cheers.

Luiz (Brazil)


#10

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.


Possibly Related Threads…
Thread Author Replies Views Last Post
  setting up subroutines that are called many times... Geoff Quickfall 4 1,921 10-18-2013, 03:41 AM
Last Post: Geoff Quickfall
  Little curiosity: why the fourth stack register is called "T"? Antlab 34 8,849 07-03-2013, 04:49 PM
Last Post: Walter B
  PPC Rom Barcodes John Abbott (S. Africa) 7 2,351 05-11-2013, 09:05 AM
Last Post: John Abbott (S. Africa)
  If this seller just wants attention, this is a very strange way to get it! Garth Wilson 13 3,523 08-21-2012, 08:13 AM
Last Post: Etienne Victoria
  HP-41 barcodes... via the web browser Raymond Wiker 6 2,254 10-07-2011, 09:54 AM
Last Post: Egan Ford
  Attention collectors! robertoataulfo 3 1,502 10-04-2011, 05:01 PM
Last Post: David Hayden
  WP 34S : Reopening last catalog called - Revisited Miguel Toro 3 1,288 09-11-2011, 05:00 PM
Last Post: Walter B
  WP 34S : Reopening last catalog called Miguel Toro 1 921 09-07-2011, 10:25 AM
Last Post: Marcus von Cube, Germany
  ATTENTION 41CL Early Adopters Monte Dalrymple 6 2,029 05-28-2011, 03:59 AM
Last Post: Hans Brueggemann
  MCODE: Where these last posts are heading: A function called "NSG" Geir Isene 12 3,463 01-13-2010, 05:34 AM
Last Post: Geir Isene

Forum Jump: