You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A system should be put in place where all entries from TM data files that end up in DB fields are checked for length to avoid problems like TravelMapping/Web#195 .
A set of constants should be introduced to the site update program to make sure these values are consistent among all checks and when DB tables are created.
This is now more important, and should be combined with a truncation of entries that are too long, since MySQL 5.7 will not allow overlength fields to be added to a column. Increasing (possibly temporarily, possibly to be replaced with a TEXT field) the width of the description in the updates table.
MySQL 8 won't even insert the overlength values unto the tables, and the site update process halts. ERROR 1406 (22001) at line 1074: Data too long for column 'banner' at row 49532
fraidfd is commented out on lab2 until the HighwayData side is resolved.
The above means these should be handled at the ErrorList level of the siteupdate program, rather than create a DatacheckEntry that would need a successful site update in order to be shown on siteupdate.php.
ABORTING due to 3 errors:
1: Abbrev >3 characters in usafl.csv line: [usafl;FL;FL44;;Leesburg;;fl.fl044;], Leesburg
2: Could not find Route matching root fl.fl044 in system usafl.
3: No roots in usafl_con.csv line [usafl;FL44;;Leesburg;fl.fl044]
Fri Sep 6 11:51:20 EDT 2019
The 2nd and 3rd errors happen because the Route constructor aborts, and then the HighwaySystem ctor does if (!route_list.back().is_valid()) route_list.pop_back();
Just queried the DB on lab2; turns out that Bourgogne-Franche-Comté Routes Départementales (Haute-Saône), at 60 characters, can in fact fit in the DB.
I'm guessing this changed some time between MySQL 5.7 & 8.0, along with the transition from 5.7 accepting & truncating overlength values, to 8.0 stopping with an error message...
TravelMapping-2020-03-24@21:13:20.sql worked fine on noreaster
lab2 barfed on it: ERROR 1406 (22001) at line 726: Data too long for column 'fullName' at row 362
(the offending datum being Finland Seututiet (outlined - temp preview to fix active routes))
I'm bummed that I didn't take a screenshot of travelmapping.net when things were messed up, but ISTR the ñ being displayed as a �, as in TravelMapping/Web#195. Here's how it appears on lab2:
Seems the thing to do is plan for the most restrictive circumstances, that we're limited by byte counts rather than character counts. Pro: We don't have to get the C++ version to do character counts. Con: We do have to get the Python version to do byte counts.
The old C++ version would stop processing a Route object if it encountered an overlength Banner or Abbrev. Fixed. Once I remove bel.n712pel, there are no diffs between the old and new logs/stats/graphs/nmp_merged.
siteupdate.py is running right now, 2nd pass just started. ToDo next.
And then, diff the new C++ & new Python output.
After that, on to changing all the new len('ñ') to len('ñ'.encode('utf-8')) checks.
OK, finally about ready to go on this.
Considering all the small things to watch out for & fix that kept popping up, it'd be wise to break one of everything in HighwayData and make sure everything behaves as expected.
Since the C++ version is all about speed, it writes the .sql file in the background during the graph generation process. Thus we have almost a complete file by the time we reach the ABORTING condition. All that's left are datacheckErrors, graphTypes & graphs. This is sometimes reported as taking 0.1s to write, so I just decided to finish it off before terminating. Not much harm in a junk .sql file hanging around, and it's there completely if you wanna do a post-mortem grep. And who knows, depending on the errors involved, it may even be possible to manually ingest it into a lab2 with no, or even a noreaster with minimal, ill effects.
What matters is that the program terminates with an exit code of 1, so localupdate.sh knows to not continue.
A final thought:
How about checking for unrecognized colors in systems.csv? We could have a set of the "official TM" colors, and check each systems.csv datum for membership in this set, catching potential misspellings etc. Just that DBFieldLength is no longer the best class name for all our constants. Ideas on a better name? Thoughts?
A thought on colors, probably overkill. We could go a bit further, having a colors.csv that defines names and RGB values for the "official" TM colors, introducing a new DB table to store them, the systems table would refer to those entries, and the front-end code would load up its set of colors from that new DB table.
I don't see a big need to specify RGB values, as we can already override them, albeit on a per-tier rather than per-color basis. I can happily agree to "probably overkill", and leave this feature out. It'll be good to get this enhancement out the door.
Before the big stress test gets underway, while I'm in the CSV parsing routes I'm giving the C++ ones a much-needed cleanup, and tightening a couple other minor screws.
After, there will be at least one merge conflict to resolve on my end.
There's a remote chance that the MALFORMED_LAT & MALFORMED_LON datachecks can produce overlength info values. I included checks for this, but the Python version is not 100% foolproof.
Rather than spend time on a fix and then gunk up the commit history with obsolete code that will just be overwritten again in a few days, I think I'll scrap these changes (in both languages) & go no-build pending a cleanup per #299.
# look up country and continent, add index into those arrays# in case they're needed for lookups later (not needed for DB)foriinrange(len(countries)):
country=countries[i][0]
ifcountry==fields[2]:
fields.append(i)
breakiflen(fields) !=6:
el.add_error("Could not find country matching regions.csv line: "+line)
continueforiinrange(len(continents)):
continent=continents[i][0]
ifcontinent==fields[3]:
fields.append(i)
breakiflen(fields) !=7:
el.add_error("Could not find continent matching regions.csv line: "+line)
continue
I've retained the lookups for matching countries & continents. Any objections if I nix storing the indices as part of the fields array?
# in case they're needed for lookups later (not needed for DB)
Sounds like a case of planning for the future, not fully knowing yet what's going to be done with the data.
I did simillar when starting out the C++ version, looking up & storing a pointer the the continent & country std::pairs. Nothing much is done with them, but the only less RAM-intensive option would have been to include a C char array in the Region object. :)
Activity
jteresco commentedon Jan 29, 2018
More evidence that this should happen: http://tm.teresco.org/forum/index.php?topic=2358.0
jteresco commentedon May 15, 2018
This is now more important, and should be combined with a truncation of entries that are too long, since MySQL 5.7 will not allow overlength fields to be added to a column. Increasing (possibly temporarily, possibly to be replaced with a TEXT field) the width of the description in the updates table.
yakra commentedon Nov 30, 2018
This could be done during the Route constructor.
el.add_error, and, yes, halt the siteupdate process. :)yakra commentedon Jul 15, 2019
Forgot about this one.
I implemented at least part of it in C++:
DataProcessing/siteupdate/cplusplus/classes/Route/Route.cpp
Lines 56 to 59 in 0817bdd
yakra commentedon Jul 17, 2019
MySQL 8 won't even insert the overlength values unto the tables, and the site update process halts.
ERROR 1406 (22001) at line 1074: Data too long for column 'banner' at row 49532fraidfd is commented out on lab2 until the HighwayData side is resolved.
yakra commentedon Aug 27, 2019
The above means these should be handled at the
ErrorListlevel of the siteupdate program, rather than create aDatacheckEntrythat would need a successful site update in order to be shown on siteupdate.php.yakra commentedon Sep 6, 2019
C++
The 2nd and 3rd errors happen because the Route constructor aborts, and then the HighwaySystem ctor does
if (!route_list.back().is_valid()) route_list.pop_back();yakra commentedon Mar 24, 2020
http://forum.travelmapping.net/index.php?topic=3147.msg18099#msg18099
12 remaining items
yakra commentedon Apr 4, 2020
Just queried the DB on lab2; turns out that
Bourgogne-Franche-Comté Routes Départementales (Haute-Saône), at 60 characters, can in fact fit in the DB.Regardless of how the Python version behaves, this complicates the C++ version quite a bit, as the "error" it's reporting is a false positive.
Fun fun. I think I'll take a break & spend my next couple days of quarantine getting reacquainted with my classic video game systems.
yakra commentedon Apr 4, 2020
I'm guessing this changed some time between MySQL 5.7 & 8.0, along with the transition from 5.7 accepting & truncating overlength values, to 8.0 stopping with an error message...
ERROR 1406 (22001) at line 726: Data too long for column 'fullName' at row 362(the offending datum being
Finland Seututiet (outlined - temp preview to fix active routes))I'm bummed that I didn't take a screenshot of travelmapping.net when things were messed up, but ISTR the

ñbeing displayed as a �, as in TravelMapping/Web#195. Here's how it appears on lab2:Seems the thing to do is plan for the most restrictive circumstances, that we're limited by byte counts rather than character counts.
Pro: We don't have to get the C++ version to do character counts.
Con: We do have to get the Python version to do byte counts.
Edit: OK, it's pretty straightforward:
yakra commentedon Apr 4, 2020
diffs
len('ñ')tolen('ñ'.encode('utf-8'))checks.yakra commentedon Apr 6, 2020
OK, finally about ready to go on this.
Considering all the small things to watch out for & fix that kept popping up, it'd be wise to break one of everything in HighwayData and make sure everything behaves as expected.
Since the C++ version is all about speed, it writes the .sql file in the background during the graph generation process. Thus we have almost a complete file by the time we reach the ABORTING condition. All that's left are datacheckErrors, graphTypes & graphs. This is sometimes reported as taking 0.1s to write, so I just decided to finish it off before terminating. Not much harm in a junk .sql file hanging around, and it's there completely if you wanna do a post-mortem grep. And who knows, depending on the errors involved, it may even be possible to manually ingest it into a lab2 with no, or even a noreaster with minimal, ill effects.
What matters is that the program terminates with an exit code of 1, so localupdate.sh knows to not continue.
A final thought:
How about checking for unrecognized colors in systems.csv? We could have a set of the "official TM" colors, and check each systems.csv datum for membership in this set, catching potential misspellings etc. Just that
DBFieldLengthis no longer the best class name for all our constants. Ideas on a better name? Thoughts?yakra commentedon Apr 8, 2020
jteresco commentedon Apr 8, 2020
A thought on colors, probably overkill. We could go a bit further, having a colors.csv that defines names and RGB values for the "official" TM colors, introducing a new DB table to store them, the systems table would refer to those entries, and the front-end code would load up its set of colors from that new DB table.
yakra commentedon Apr 8, 2020
I don't see a big need to specify RGB values, as we can already override them, albeit on a per-tier rather than per-color basis. I can happily agree to "probably overkill", and leave this feature out. It'll be good to get this enhancement out the door.
Before the big stress test gets underway, while I'm in the CSV parsing routes I'm giving the C++ ones a much-needed cleanup, and tightening a couple other minor screws.
After, there will be at least one merge conflict to resolve on my end.
yakra commentedon Apr 9, 2020
There's a remote chance that the MALFORMED_LAT & MALFORMED_LON datachecks can produce overlength info values. I included checks for this, but the Python version is not 100% foolproof.
Rather than spend time on a fix and then gunk up the commit history with obsolete code that will just be overwritten again in a few days, I think I'll scrap these changes (in both languages) & go no-build pending a cleanup per #299.
yakra commentedon Apr 10, 2020
yakra commentedon Apr 10, 2020
I've retained the lookups for matching countries & continents. Any objections if I nix storing the indices as part of the
fieldsarray?yakra commentedon Apr 11, 2020
if len(line) == 0 or line.startswith('#'):if (line.empty() || line[0] == '#')HighwayDatabreakages are as expected. I know I whiffed at least 4 of'em.rg_strpart of theRouteobject; use it to load & process WPTsHighwaySystemctor accordinglyjteresco commentedon Apr 11, 2020
I am not sure why they were there in the first place, so I suppose no harm in getting rid of them.
error checks for field lengths
yakra commentedon Apr 13, 2020
Sounds like a case of planning for the future, not fully knowing yet what's going to be done with the data.
I did simillar when starting out the C++ version, looking up & storing a pointer the the continent & country
std::pairs. Nothing much is done with them, but the only less RAM-intensive option would have been to include a C char array in the Region object. :)