Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Jump to content

Template talk:ISO 3166 code/Archive 1: Difference between revisions

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
Content deleted Content added
Confused: new section
Line 69: Line 69:
''29-March-10:'' When trying to edit the "top 300" city articles to avoid using CountryAbbr2, I noticed many articles used invalid parameters as the nation name, instead putting unusual values, such as "subdivision_name = XXX<br>YYY". People might wonder, ''"If CountryAbbr2 only transcluded all 560 templates in reaching the end of the list, such as for Zimbabwe, then why did so many articles transclude the full 560 templates?"'' ...because any invalid, non-nation/flag parameter would require comparisons with all 560 before leaving the #switch branches with no match at the end. If the flag was "image+France" (near the top of the list), then only a few flag-templates were transcluded to reach the matching French flag. However, one article had used "subdivision_name=City" where "City" was not a nation, and hence it used 560 templates to find no match. I added "City" (or "city") as an early choice in CountryAbbr2. Also, I moved "flag+USA" to the top of the list because template {USA} was the most-used flag-template on Wikipedia, and likewise, I moved the top 40 nation flags to the top of the #switch list in {CountryAbbr2}. The numerous articles checking those flags will match within 40 template comparisons, and not check all 500 cases. As a result, the problem becomes to avoid using {CountryAbbr2} with invalid parameters being sent from {{tl|Infobox_settlement}}, so that is an efficiency issue for long-term re-design of that template. There is no call to {CountryAbbr2} for sub-sub-sub-divisions: "subdivision_name2=zzz" does not invoke {CountryAbbr2}. -[[User:Wikid77|Wikid77]] ([[User talk:Wikid77|talk]]) 14:03, 29 March 2010 (UTC)
''29-March-10:'' When trying to edit the "top 300" city articles to avoid using CountryAbbr2, I noticed many articles used invalid parameters as the nation name, instead putting unusual values, such as "subdivision_name = XXX<br>YYY". People might wonder, ''"If CountryAbbr2 only transcluded all 560 templates in reaching the end of the list, such as for Zimbabwe, then why did so many articles transclude the full 560 templates?"'' ...because any invalid, non-nation/flag parameter would require comparisons with all 560 before leaving the #switch branches with no match at the end. If the flag was "image+France" (near the top of the list), then only a few flag-templates were transcluded to reach the matching French flag. However, one article had used "subdivision_name=City" where "City" was not a nation, and hence it used 560 templates to find no match. I added "City" (or "city") as an early choice in CountryAbbr2. Also, I moved "flag+USA" to the top of the list because template {USA} was the most-used flag-template on Wikipedia, and likewise, I moved the top 40 nation flags to the top of the #switch list in {CountryAbbr2}. The numerous articles checking those flags will match within 40 template comparisons, and not check all 500 cases. As a result, the problem becomes to avoid using {CountryAbbr2} with invalid parameters being sent from {{tl|Infobox_settlement}}, so that is an efficiency issue for long-term re-design of that template. There is no call to {CountryAbbr2} for sub-sub-sub-divisions: "subdivision_name2=zzz" does not invoke {CountryAbbr2}. -[[User:Wikid77|Wikid77]] ([[User talk:Wikid77|talk]]) 14:03, 29 March 2010 (UTC)
:I've been working to normalize subdivision names so that {{tl|CountryAbbr}}, {{tl|CanAbbr2}}, and {{tl|StateAbbr}} don't fail so often. Since my usual tool (geosearch.py) is (temporarily I hope) out of commission, perhaps a maintenance category could be established to accelerate this process. --[[User:Stepheng3|Stepheng3]] ([[User talk:Stepheng3|talk]]) 17:02, 29 March 2010 (UTC)
:I've been working to normalize subdivision names so that {{tl|CountryAbbr}}, {{tl|CanAbbr2}}, and {{tl|StateAbbr}} don't fail so often. Since my usual tool (geosearch.py) is (temporarily I hope) out of commission, perhaps a maintenance category could be established to accelerate this process. --[[User:Stepheng3|Stepheng3]] ([[User talk:Stepheng3|talk]]) 17:02, 29 March 2010 (UTC)
::The geosearch.py tool is back in business, and one of the first things I noticed was that the number of {{tl|Coord}}s with incomplete region codes is way up. A major source of these failures appears to be related to {{tl|CountryAbbr}}. Specifically, {{tl|CountryAbbr}} is failing on about 22,000 Poland articles that use {{tl|flag icon}} in the <code>subdivision_name=</code> parameter of {{tl|Infobox settlement}}. I added a testcase that demonstrates the bug, and I'd appreciate some help in fixing it. --[[User:Stepheng3|Stepheng3]] ([[User talk:Stepheng3|talk]]) 19:05, 17 April 2010 (UTC)


== Confused ==
== Confused ==

Revision as of 19:05, 17 April 2010

Nièvre bug

{{editprotected}} The department of Nièvre in France should have a hyphen (-) before the code (58). --Stepheng3 (talk) 20:02, 23 July 2009 (UTC)[reply]

Done, plus some other stuff. --- RockMFR 22:54, 23 July 2009 (UTC)[reply]
Thank you! --Stepheng3 (talk) 20:25, 24 July 2009 (UTC)[reply]

Excessive transclusion

This template is called from {{Infobox settlement}}, and the way it's done, it always transcludes over a hundred templates, which slows down edit and preview page loading substantially, and makes the list of transcluded templates under the editbox almost useless. It also means that we have a dozen million useless template links in the database, which slows down editing of all pages. The template should be redone so that the smallest possible number of templates is transcluded on every use. Zocky | picture popups 11:45, 14 October 2009 (UTC)[reply]

I believe this template (and {{CountryAbbr2}} et. al.) should be deleted, after a bot has added coordinates_type = type:city_region:XX-YY to all the transclusions of Infobox settlement. Further comments and discussion at Template talk:Infobox settlement. — Andrwsc (talk · contribs) 17:15, 14 October 2009 (UTC)[reply]
I'm with you in spirit, Andrwsc, but note that this template is also used by other infoboxes including {{Geobox}}. --Stepheng3 (talk) 20:48, 28 February 2010 (UTC)[reply]

Plan to streamline CountryAbbr2 transclusions

24-March-10: Looks like the massive problem is inside {CountryAbbr2}, with the misuse of templates to decode a nation's title from the 3-letter code, where, perhaps, some people thought the effect would be to just match the current nation code against the caller's country name; but instead, {CountryAbbr} seems to copy all the template links (perhaps 300-500 nation templates) into each and every article using this {CountryAbbr} template. Since the nation names don't change very often, the 340 could be hard-coded into {CountryAbbr2}, rather than decoded within every city/nation article page. If a nation changed it's name, then the associated users would notice the old name and see the need to update the {CountryAbbr2} template. I will begin the "{{CountryAbbr2/sandbox}}" version to improve this {CountryAbbr}. We've been waiting too many months on this problem. -Wikid77 (talk) 17:14, 24 March 2010 (UTC)[reply]

If it makes any difference, User:Xenobot/6.2 seeks to avoid use of CountryAbbr in Infobox settlement by providing region codes directly. –xenotalk 19:18, 24 March 2010 (UTC)[reply]

Issues of CountryAbbr on subpage: overlinking

28-March-10: In the processing needed to lookup the flag image&wikilink for a nation, {CountryAbbr} invokes {CountryAbbr2} which, in turn, keeps invoking flag templates until one matches. If there is no matching flag, then {CountryAbbr2} will have checked all entries in the #switch, and transcluded every possible flag template (and Country_data_Xxxx template) for all nations. See talk-page subpage "/overlinking" for an example listing 653 templates transcluded into the city article "Fremont, California" and discuss there. -Wikid77 (talk) 10:59, 28 March 2010 (UTC)[reply]

24-March-10: The country-flag lookup routine, {{CountryAbbr2}} needs to be replaced from the sandbox version {{CountryAbbr2/sandbox}}, which has been massively streamlined for the name-match logic to bypass 300-560 flag/data templates per use. The new version also matches "Swaziland" not supported earlier.

IMPACT: over 167,000 article pages might get reformatted, and over 68,000 articles directly using {CountryAbbr2} will then omit 300-560 wikilinks to nation/flag subtemplates, resulting in myriads fewer, perhaps 25-73 million fewer total wikilinks. A major infobox affected is: {{Infobox_Settlement}}. See list of heavily-transcluded templates: "WP:Database reports/Templates with the most transclusions" with counts for {CountryAbbr2}.

TEST DATA: The following test cases will show that the sandbox version generates the identical results, for use in article pages, even though {CountryAbbr2/sandbox} generates those results 100x faster using far fewer templates. After update, an edit-preview of this talk-page will show the live results (as "Currently") with the installed template. The test cases are coded in the format: {{CountryAbbr2|United States|Florida}} or {{CountryAbbr2|{{USA}}|Florida}}.

This is the basis for requesting an admin-edit, but the sandbox version is not ready yet. -Wikid77 (talk) 18:33, 25 March 2010 (UTC)[reply]

The claim of being 100x-500x faster sounds dubious to me. If that's an essential element of your argument for the change, then I would like to see some measurement evidence. --Stepheng3 (talk) 20:32, 25 March 2010 (UTC)[reply]
Well he did say perhaps =) –xenotalk 20:35, 25 March 2010 (UTC)[reply]
  • The speed depends on the number of individual templates being transcluded to "compute" the nation/region codes. Of course, if the table can't be completed, then the speed is infinitely faster with a shorter template that could complete the table. -Wikid77 (talk) 13:58, 26 March 2010 (UTC)[reply]
What matters to users is the total response time, not just the part due to transclusions. If transclusions account for (say) 95% of the delay seen by users, then eliminating them is unlikely to improve responsiveness by more than 20x. My point is that until you measure the speedup, you don't really know what it will be. While I approve of the work you're doing, I hate to see exaggerated claims based on an overly simplistic performance model. Best regards, --Stepheng3 (talk) 19:09, 26 March 2010 (UTC)[reply]
  • Yes, I agree some users might read "100x-500x" and think their articles will display over 100x times faster, expecting an article to appear within 1 second after clicking a link. I have removed that wording so that no one expects articles to display over 100x faster. I know it's difficult even for some computer programmers to understand a template generating "32 million wikilinks" and I've had some WP developers delete my warnings that overlinking would clog WP databases and foul articles. They claimed "WP:Don't worry about performance". The reality seems to be that when a template gets as huge as CountryAbbr2 had become (with 560 internal transclusions), then using it too many times will kill the article-display totally: no partial page, just an internet error page for "HTTP 500 Internal server error". Anyway, the sandbox version is ready to be installed. -Wikid77 (talk) 05:17, 27 March 2010 (UTC)[reply]

{{editprotected}} After the update, after replacing the contents of {CountryAbbr2} from {CountryAbbr2/sandbox}, then all examples in the table should be able to display, and the whole table should appear complete. -Wikid77 (talk) 05:59, 27 March 2010 (UTC)[reply]

I would like someone who is familiar with these templates to double-check your code before committing the change, if possible. — Martin (MSGJ · talk) 09:30, 27 March 2010 (UTC)[reply]
I've looked at the code, looked at the test cases, and while everything appears sound at first blush, I'm somewhat out of my comfort zone on this one. I see nothing wrong, but like Martin, I'd appreciate another opinion before committing. Huntster (t @ c) 09:02, 28 March 2010 (UTC)[reply]
  • Thanks. I guess you're the 2nd person that Martin was seeking, so with my tests of the template, that's 3 of us. To record how {CountryAbbr2} had been working, before this update, I have created a large subpage "/overlinking" to discuss those problems of using 560 templates to check a nation's flag, plus a full example of how poorly the template had worked, during the past year. This template has been a challenge for everyone:
  • so big that no one had time to fix it during 2009;
  • so big that a full example (653 templates) needs a talk-subpage for all details;
  • so big it cannot be fully tested due to Wikipedia template limits;
  • so big no one has time to write all 600 test cases;
  • so big that writers have lived the horror of "560" transclusions for a year.
This template is living proof, that for massive templates, they are almost impossible to improve, in a volunteer effort, even after a whole year. Massive templates are a major problem for Wikipedia, generating severely poor performance for many months. -Wikid77 10:59, 28 March 2010 (UTC)
I'll take a 3rd look and will deploy when everything looks ok. —TheDJ (talkcontribs) 11:30, 28 March 2010 (UTC)[reply]
Changes looked valid, so done. And good work, this was a huge transclusion problem it seems !!! —TheDJ (talkcontribs) 11:48, 28 March 2010 (UTC)[reply]
  • Great, I see that millions of wikilinks have already been dropped. Formerly, where a flag template {FSM}, or {BEL}, had 16,000 transclusions, it now has only about 100 or 400, allowing editors to easily confirm each flag-template's usage in the remaining articles. Thanks to everyone for checking & installing this massive fix. You have done your good deed for the decade, and you have all earned 9 years wiki-vacation! -Wikid77 (talk) 19:31, 28 March 2010 (UTC)[reply]
    Nice job. This might cut out a lot of work for me. –xenotalk 00:40, 29 March 2010 (UTC)[reply]
Yes, see below: #Invalid parameters passed to CountryAbbr. -Wikid77 14:03, 29 March 2010 (UTC)

With due respect, this is the wrong way to solve the problem. "Unfolding" the flag template usage inside CountryAbbr still results in maintenance difficulties. The wikicode of CountryAbbr et. al. must anticipate all the possible markup variations for the infobox parameter. It is a fundamentally bad design to try to parse one infobox parameter in order to define a second infobox parameter, versus simply specifying the second infobox parameter directly. The right way to fix the problem is what Xeno was going to do with his bot, by adding the coordinates_region field to all those infoboxes so we can delete CountryAbbr entirely, not just patch it. — Andrwsc (talk · contribs) 23:11, 30 March 2010 (UTC)[reply]

I'm still willing to run the task but you'll need to defend the BRFA. I am not familiar enough with the subject area and the changes that were made. –xenotalk 23:21, 30 March 2010 (UTC)[reply]
I wouldn't be quite so negative about it.
In the mean time, we have a more efficient kludge. And if/when the bot run happens, it will be more efficient because it will be subst-ing a more efficient version of {{CountryAbbr}}. And all the other templates that use CountryAbbr will enjoy some speedup (until someone fixes them to not use it).
Personally, I don't have a problem with parsing one parameter to obtain another. In this particular case, the problem is that the format of the input parameter (subdivision_name) was never adequately defined, which explains why CountryAbbr has had such a hard time parsing it. --Stepheng3 (talk) 23:22, 30 March 2010 (UTC)[reply]
The "more efficient kludge" completely depends on the internals of the flag template system, and that is not an unchanging thing. Changes made there should not cause breakage here, which is entirely possible now. — Andrwsc (talk · contribs) 23:32, 30 March 2010 (UTC)[reply]
Your point about the fragility of the system is well taken, Andrwsc.--Stepheng3 (talk) 02:20, 31 March 2010 (UTC)[reply]

Invalid parameters passed to CountryAbbr

29-March-10: When trying to edit the "top 300" city articles to avoid using CountryAbbr2, I noticed many articles used invalid parameters as the nation name, instead putting unusual values, such as "subdivision_name = XXX<br>YYY". People might wonder, "If CountryAbbr2 only transcluded all 560 templates in reaching the end of the list, such as for Zimbabwe, then why did so many articles transclude the full 560 templates?" ...because any invalid, non-nation/flag parameter would require comparisons with all 560 before leaving the #switch branches with no match at the end. If the flag was "image+France" (near the top of the list), then only a few flag-templates were transcluded to reach the matching French flag. However, one article had used "subdivision_name=City" where "City" was not a nation, and hence it used 560 templates to find no match. I added "City" (or "city") as an early choice in CountryAbbr2. Also, I moved "flag+USA" to the top of the list because template {USA} was the most-used flag-template on Wikipedia, and likewise, I moved the top 40 nation flags to the top of the #switch list in {CountryAbbr2}. The numerous articles checking those flags will match within 40 template comparisons, and not check all 500 cases. As a result, the problem becomes to avoid using {CountryAbbr2} with invalid parameters being sent from {{Infobox_settlement}}, so that is an efficiency issue for long-term re-design of that template. There is no call to {CountryAbbr2} for sub-sub-sub-divisions: "subdivision_name2=zzz" does not invoke {CountryAbbr2}. -Wikid77 (talk) 14:03, 29 March 2010 (UTC)[reply]

I've been working to normalize subdivision names so that {{CountryAbbr}}, {{CanAbbr2}}, and {{StateAbbr}} don't fail so often. Since my usual tool (geosearch.py) is (temporarily I hope) out of commission, perhaps a maintenance category could be established to accelerate this process. --Stepheng3 (talk) 17:02, 29 March 2010 (UTC)[reply]
The geosearch.py tool is back in business, and one of the first things I noticed was that the number of {{Coord}}s with incomplete region codes is way up. A major source of these failures appears to be related to {{CountryAbbr}}. Specifically, {{CountryAbbr}} is failing on about 22,000 Poland articles that use {{flag icon}} in the subdivision_name= parameter of {{Infobox settlement}}. I added a testcase that demonstrates the bug, and I'd appreciate some help in fixing it. --Stepheng3 (talk) 19:05, 17 April 2010 (UTC)[reply]

Confused

Why does {{CountryAbbr2|{{flag|Afghanistan}}|[[Kunduz Province]]}} yield "" yet {{subst:CountryAbbr2|{{flag|Afghanistan}}|[[Kunduz Province]]|subst=subst:}} yields "" (nothing)? –xenotalk 03:55, 16 April 2010 (UTC)[reply]