| « Passed Around | Emergency Faxes » |
"At the contract shop where I work," writes John S., "I have been assigned to a new web-enabled mapping program to help take a look at some of the issues they've been having."
"When an item is added to a map, it is given a label, such as Item #1, Item #2, etc., with the number on the label incrementing for each new item. We had been having a problem where map labels were not being assigned uniquely when there were more than 100 items per map. It was always starting at Item #100 when reloading the map from the database. This was causing issues since it was the map label name that was being used for the unique identifier (don't get me started on that). Curious, I took a look at the code to decipher how the label ids were being assigned."
"Each time the map was loaded, a function iterated each layer to find the items assigned to that layer, and then to parse out the number from the code and keep track of the maximum id. Apparently they had the foresight to account for more than 10 items, but not for more than 100."
Re: Almost Counting Past 100
2010-02-03 09:49
•
by
NoAstronomer
(unregistered)
|
Modern software development described in one sentence. |
|
Easy to fix:
nobody could need more than 1000 labels, could they? |
|
This reminds me of a word processor for an 8 bit micro I "worked" on. It had a page number register (contained in 8 bits) that would be printed out. They did some work and had a routine that usually did decimal conversions but was limited to 2 digits (8 bits will go to 256). Since they wanted to accomidate numbers over 100, they first compared the number to 100 and if it was over they incremented to 100's digit, and decreased the "left over" by 100, and tried again (it could be 200). This worked OK, but then they sent off the remainder to the two digit converter, which worked quite nice, and if you had a number less than 10, it returned a single digit (can't have leading zeros you know!). The end result was that page numbers would have the sequence:
... 97, 98, 99, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 110, 111. (I suspect that the 200's were similar, but I never had a document that big!). I suspect that they never worried about it, because they never got to documents over 100 pages, but we did!! Oh, well!! |
| « Passed Around | Emergency Faxes » |