Notice: register_sidebar was called incorrectly. No id was set in the arguments array for the "Sidebar 1" sidebar. Defaulting to "sidebar-1". Manually set the id to "sidebar-1" to silence this notice and keep existing sidebar content. Please see Debugging in WordPress for more information. (This message was added in version 4.2.0.) in /usr/share/wordpress/wp-includes/functions.php on line 4139 Tech Notes » 2009 » November

Read a Barcode

Uncategorized No Comments »

Jonathan Washington determined how to Read a Barcode without a reader, and using his description it’s fairly easy.

The numbers have a bit of a delicious pattern; let me expand a bit from the Wired How-to Article, which presented this example:

The Digits themselves break down as follows:

digit code
* 0-0110
0 00-110
1 10-001
2 01-001
3 11-000
4 00-101
5 10-100
6 01-100
7 00-011
8 10-010
9 01-010

Simple, right? The barcode will also start and end in a 0-0110 sequence, which breaks the xx-xxx pattern. I cannot see Mr Washington’s article, the hosting has trashed it, so maybe this stuff is already discussed. The Wired Article is really hard to take apart from there — examples would have been nice — so I’ve expanded a bit on it.

Although we could look at the barcode digits as simple replacement cyphers — similar to the glyphs on the TV show “Fringe” — there is a key to the barcoding numbers themselves that would let a reader build a barcode cheat-sheet or lookup just before decoding a barcode to reduce the chances of error. Let’s remap the table above, add sample barcodes, move the zero after the 9, and add an asterisk markup so that we have an example of that as well:

digit code barcode
1 10-001 10-001
2 01-001 01-001
3 11-000 11-000
4 00-101 00-101
5 10-100 10-100
6 01-100 01-100
7 00-011 00-011
8 10-010 10-010
9 01-010 01-010
0 00-110 00-110
* 0-0110 0-0110

You can see how the progression of the 4 leftmost digits of each 5-bit sequence is actually a binary increment. The rule for that sequence seems to be “no more than two ones per digit”, and the 5th digit toggles one/zero to ensure that each sequence has two. Zero is pushed up to the “ten” spot, so it doesn’t have to suffer the indignity of no ones at all — for which the check bit would have to be 2. And what about 7? skipped. above, 7 is actually 8, 8 is actually 9, etc.

Asterisk is basically “zero” but with the spacer moved, perhaps to help key the scanner to the size and use the data itself as start/stop bits, the same way the 6-of-8 is done on an old floppy disk (leading bits are zero, after a spin there’s enough 0-0-1 and 0-0-0-etc to key the reader).

So now we have the magical logic to generate the bit patterns for the barcode digits, let’s markup the barcode and overlay some digits:


Now that looks a lot easier to digest.


Not Seeing is Disbelieving

Uncategorized No Comments »

Speaking with a software architect — a young guy, obviously — he pointed out that he’s never seen the issues I’ve noted with a design he has, and so they must not exist. He went on to reiterate that he designed a product once that had an international market.

He didn’t ask what I had done, I didn’t volunteer it. I don’t need to swing a pedigree around, usually the recommendation I make are fairly obvious, sometimes only in hindsight.

It seems he and others seem to believe that if they haven’t heard of a particular issue, it cannot occur. This ignores:

  • Problems that occur that are not voiced because “it’s no use, they’ll never fix it”
  • Problems raised that are not escalated to the entity that can make a difference
  • Problems that are raised high enough, but are deemed “not a real problem because I haven’t seen it”
  • Problems difficult to replicate in a different country (similar to the comma problem I had in shell-based math, fails only in France)

People who discuss design and are aware of staffing/labour management don’t often bring things up for no reason. Of course, there is always room for a “painting the bike shed” discussion, but no one intends to waste staff hours. Typically, resolving things at design-time avoid staff-hours down the road.

Young architects don’t fully understand this, until they’ve done a few projects, and realize that they cannot personally see every problem.

It’s the equivalent of when software developers realize they cannot personally fix every known problem.

“Seeing is Believing”, eventually we get past the “Not Seeing is disbelieving” stage.

I remember this same argument, but by proxy: “I know a really smart guy, and he didn’t fix that problem, so that problem can never occur obviously”. I’m sure the logic errors there are obvious.

In this case, I elected to make my changes, and discuss them in hindsight. Some people recognize that I have the chinese habit of smiling and stopping when I see that I’m in an impossible task such as describing a round world to early Europeans. I don’t want to avoid making these changes, because that results in a waste of staff-hours that I don’t want to cause just to prove my point.

SNMP: What is it over there?

howto No Comments »

In a discussion about discovering SNMP devices, I started to wonder why we (my company) is still screen-scraping a telnet prompt to discover what sort of hardware is “over there”.

It’s actually much easier if you’re already configuring an SNMP client:

snmpget -Ov -On -v 1 -c public

The responses I’ve seen so far:
.* Brocade Communications (hint: privatenumber 1588 is Brocade)
(ie . )
.* OpenSource stack (hint: privatenumber 8072 is net-snmp)
(ie . is reported by Apple TimeCapsule)
(ie . is reported by Synology ds209)

The reason for this path is to see whether we can use to determine product IDs (port blades) on all manufacturers, or just Cisco. Brocade doesn’t populate . because “9” is cisco’s privatenumber 🙁

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in