Misplaced Pages

User talk:Johnuniq: Difference between revisions

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.
Browse history interactively← Previous editNext edit →Content deleted Content addedVisualWikitext
Revision as of 20:43, 27 October 2013 editEdwardsBot (talk | contribs)354,693 edits Books and Bytes: The Misplaced Pages Library Newsletter: new section← Previous edit Revision as of 22:42, 1 November 2013 edit undoWikid77 (talk | contribs)Autopatrolled, Extended confirmed users67,096 edits Convert/q needs Lua: new threadNext edit →
Line 233: Line 233:
</div> </div>
<!-- EdwardsBot 0651 --> <!-- EdwardsBot 0651 -->

==Convert/q needs Lua==
Hi, Wikid77 here. I have created a ], as a quick (ultra-fast) version of {Convert} and found that the Lua version is fast enough. So, I would like to use the Lua version, inside {convert/q} for limited main-space articles, to reduce 6-second conversions to below 1 second (where other templates are exceeding 30 seconds). I know you planned to release the Lua version as a system-wide upgrade, but a {convert/q} is needed soon, and the long-term testing for full-scale release of Lua is tedious, plus retro-fitting the dozen ]: {Convert/2}, {Convert/3}, {Convert/4}, {Convert/flip2}, {Convert/flip3}, {Convert/show2}, {Convert/show3}, (etc.). Anyway, if {convert/q} will be a burden, then I can implement it through other means. Things are moving so fast, and people are complaining that ] is crashing pages (reformat: 58+ seconds!), where {Convert} is used 150-250 times (taking up to 6 seconds compared to Lua 0.80 second). They are planning a Lua version of {Jct} in December/January, but it has over 1,780 road-type formats to rework in Lua script. Meanwhile, {convert/q} with Lua would reduce those large pages by 10% faster, and so that would be excellent. -] (]) 22:42, 1 November 2013 (UTC)

Revision as of 22:42, 1 November 2013

I'll reply to messages here, unless requested otherwise.
I'm in a WP:Lua coding frenzy and won't be much use for other stuff for a while.

Archiving icon
Archives

Index of stuff

Module:Convert

Archives (not related to convert)

Convert error category

I was just thinking that Category:Convert error could get full of rubbish quite quickly once the template goes live. One thing that could help in reducing that is to not categorise talk pages. The reason for the category is to track errors and get them fixed by editing the page with the issue, but for issues on talk pages, it's not work fixing them most of the time so it's probably not worth tracking them. Another thing that could be added is a |nocat=true parameter which would then be used to manually suppress the category on the page with the error. -- WOSlinker (talk) 12:05, 17 September 2013 (UTC)

Good idea. It looks as if it would be easy for the module to get the namespace number of the current page. One simple thing would be to output a category if and only if namespace == 0. If necessary, that could be tweaked later, but do you think it's likely a category would be needed in any of the others at WP:Namespace?
If we use the namespace == 0 test, would we also want a nocat parameter? Parameters are easy to add, but I think we should avoid them unless really needed because too many leads to confusion.
Please check the section just above this because I've added a new comment. Johnuniq (talk) 09:32, 18 September 2013 (UTC)
Yes, just namespace 0 would be fine, and no need for nocat. -- WOSlinker (talk) 09:45, 18 September 2013 (UTC)
Worth including template space too? That way errors inside infoboxes &tc. are listed by their source page, not hidden in articles. But this can include many controlled errors too (like empty infobox input in the template). -DePiep (talk) 14:26, 19 September 2013 (UTC)
@WOSlinker: I have implemented the above suggestion, thanks. It defaults to include categories only in main and template namespaces, and can easily be adjusted. While I have your attention, I recreated {{convert/sandboxlua2}} to include "warnings = true" so that template will show warnings. Johnuniq (talk) 10:17, 21 September 2013 (UTC)

Category:Convert invalid option

Your overview subpage says:

I suggest it is switched on right away always. That way we can find and clean up all these errors. Unless there is a pre-Lua convention that relies on this setting, but I do not see |warnings= in template code or documentation. -DePiep (talk) 14:40, 19 September 2013 (UTC)

I'm not sure, but am happy with whatever is wanted. It's reasonably common for convert templates to contain some junk (for example, "abr=on" instead of "abbr=on"), and I felt there should be a configuration setting (an option in the template) so warnings could be turned off if they generated too much noise. I thought it would be desirable to start with warnings off so more important error messages could be handled first (I'm expecting quite a few "unknown unit" problems), with fewer ugly messages visible in articles where there is probably no actual problem—that is, the displayed text is probably correct, even if not precisely what the editor intended. I have scraped examples from various articles, and just ran a test on a local computer with 8,000 converts. The were no warning messages, and I think I haven't cleaned problems from the converts, so perhaps warnings are sufficiently rare that having warnings on would not be a problem.
I don't think I've documented the following issue: Superfluous positional parameters are ignored, for example {{convert|12|m|ft|junk}} gives the same output, namely "12 metres (39 ft)", with and without warnings. Could think about some extra code to check for them later. Johnuniq (talk) 04:39, 20 September 2013 (UTC)
Ugh! Bit of turmoil going on here, and my test was broken. When done properly, the 7,540 converts (not 8,000) generate 31 warnings:
2 of "abr=on", 3 of "bbr=on", "abb=on", 1 of "abbrev=on" (should be "abbr=on")
1 of "abbrev=off" (should be "abbr=off")
1 of "sigfigs=1" (should be "sigfig=1")
1 of "dispp=flip" (should be "disp=flip")
1 of "link=on" (should be "lk=on")
1 of "sep=s" (possibly wanted "disp=s")
1 of "sp=eu", 3 of "sp=uk", 12 of "sp=UK" (should omit)
2 of "spell=us" (should be "sp=us")
1 of "lbabbr=on" (occurs in {{convert|20000|to|25000|kg|lbabbr=on}} which should be {{convert|20000|to|25000|kg|lb|abbr=on}})
Still 31 warnings in 7,540 converts is a pretty small number, so that sample suggests having warnings on by default would be ok. Johnuniq (talk) 05:59, 20 September 2013 (UTC)

Category names

The module uses four cetegories:

Suggestions:

  1. Make category names plural by general wp style.
  2. Be more descriptive: like "Pages with convert dimension mismatch"
  3. If I read code well, only the first message is shown. In that case, the generic (least precise) Category:Convert error should be added last, not first.
I will put all four in a parent template. -DePiep (talk) 15:04, 19 September 2013 (UTC)
Re #1: Yes, that's fine, although I'll hold off until there is more discussion on #2.
Re #2: It's just personal opinion, but the redundancy in a category like "Pages with X" is distasteful to me. A category is a list of pages so it's pointless putting "Pages with" in the name. For articles, we say Category:Living people or Category:1961 births. It's not Category:Articles about living people or Category:Articles about people born in 1961. However, I'm pretty flexible and am happy with the outcome of a discussion, although I hope we could attract a few opinions. The good news is it would be very easy to change the category names (see "all_categories" in Module:Convert/text).
Re #3: Yes, only one message is displayed no matter how many errors are in a convert, but each message has it own category so there is no realistic way of putting "Convert error" last (see "all_messages" in Module:Convert/text for the full story). Looking at the wikitext here shows the category for each message. Some expected errors have a dedicated category with a fairly obvious meaning: "Convert dimension mismatch", "Convert invalid option", "Convert unknown unit". Other miscellaneous messages are in the generic "Convert error" category. Johnuniq (talk) 09:55, 20 September 2013 (UTC)

Talk continued at Module_talk:Convert#Maintenance_category_names. -DePiep (talk) 12:17, 21 September 2013 (UTC)

A barnstar for you!

The Barnstar of Diligence
For your willingness to go way out of your way to help people from other wikis in technical matters. Siddhartha Ghai (talk) 17:44, 19 September 2013 (UTC)
Thanks very much! I was having a pretty mediocre day, and that was before looking at my watchlist (see below), so this message is most welcome. For future reference, this refers to a discussion above and at hi:User:Johnuniq/number. Johnuniq (talk) 02:26, 20 September 2013 (UTC)

sigfig error message

Just to let you know that I've changed the sigfig error from a critical one to a warning instead. -- WOSlinker (talk) 20:21, 21 September 2013 (UTC)

A "critical error" vs a "warning"? So far I only saw "errors" (orange, replacing the text, in one of three cats, all the same level of alarm) and "warnings" (pink, trailing the convert text, in a separate category). Does this edit mean there is a third, hybrid sort of message? At least we should give it its own category. But better we discuss its status & consequences. -DePiep (talk) 01:17, 22 September 2013 (UTC)
No, there's only two types. If there was |sigfig=-1 for example then previously it would have just displayed an error message and no conversion. I've changed that so that it now ignores the bad sigfig value and does the conversion with the default sigfig value instead and will display a warning instead (provided that warnings are on). -- WOSlinker (talk) 07:00, 22 September 2013 (UTC)
Thanks! In retrospect, it's clear that a sigfig problem is not fatal. For next time, you copied and edited the line:
add_warning(parms, 'cvt_empty_option', loc_name)
but loc_name is only suitable for cvt_empty_option (which reports that no value was given for loc_name), whereas cvt_bad_sigfig needs to be given loc_value because it reports that the given value is bad.
On looking at the code, I realized I had to do a little refactoring because the next section should not give a warning if the sigfig code already has done so. That's a benign problem currently because only the first warning is shown, but it's cleaner to get it right. Johnuniq (talk) 11:13, 22 September 2013 (UTC)
I've made Template:Convert/testcases/sigfig using {{convert/sandboxlua2}}. note that now we have warnings and errors in the same maintenance category. I would not mind adding categories for systematic message tracking. -DePiep (talk) 12:39, 22 September 2013 (UTC)
I'll look at the good work you're doing later (won't have time for at least 24 hours I'm afraid). However, I wouldn't worry about niceties such as whether errors and warnings belong in different categories. If we're going to output a message of any kind, it needs to be tracked so it can be fixed, and it doesn't matter what the category is called, or how optimized is the system of categories. Rather than have more categories, perhaps we should have fewer? Johnuniq (talk) 12:48, 22 September 2013 (UTC)
I've created a set of testcases at Template:Convert/testcases/rounding which involve combinations of the round_to, disp=5 and sigfig=number parameters. There are some differences between the current convert and the lua version which will need looking at. -- WOSlinker (talk) 13:09, 22 September 2013 (UTC)
Very nice, and I'm looking at it right now. I haven't finished, but so far haven't seen a single error from the module, although that may be prejudice. I'm not quite sure what the text at Template:Convert/testcases/rounding is saying. If a convert specifies round_to and sigfig, why wouldn't that be a case of "undefined behavior"? At any rate, what the module is doing looks reasonable to me. Johnuniq (talk) 13:20, 22 September 2013 (UTC)

Adding gross tonnage

I'd like to have an option to convert gross tonnage to cubic meters and back again. This involves a screwy formula which I have no idea how to invert, except numerically. I don't want to intrude into your good code and screw things up, but I would propose adding something like this to line 1778 of the current Module:Convert:

        elseif in_builtin == 'gross tonnage' then
            -- gross_tonnage = (0.20 + 0.02 * log10(cubic_meters)) * cubic_meters
            -- inquiry at the Mathemetics Refdesk failed to obtain a closed form solution for cubic_meters
            if (invalue <= 0) {
            	return false, { 'cvt_bug_convert' }
            	}
            local gross_tonnage = invalue
            local k_factor = 0.20
            local cubic_meters = gross_tonnage / k_factor
            do {
            	k_factor = 0.20 + 0.02 * log10(cubic_meters)
            	local new_cubic_meters = gross_tonnage / k_factor
            	if (math.abs(new_cubic_meters - cubic_meters) < 0.1) {
            		return true, {
            			outvalue = new_cubic_meters
        			}
        		cubic_meters = new_cubic_meters
        	} while (iterations<100)
            return false, { 'cvt_bug_convert' }

The inverse is mathematically simpler; I assume you'd hook into it in the same place using out_builtin == 'gross tonnage' and set outvalue = invalue * (0.20 + 0.02 * log10(invalue)).

The main spot to invoke this one would be in Template:GT.

This is the kind of funny logic that might deserve to be exiled to a special module to prevent recalculating all the instances of math.convert... in any case, I'll leave it at this point in your capable hands. Wnt (talk) 22:30, 21 September 2013 (UTC)

Now this is definitely going to make my head explode! Let me focus on the trivial first. Are you saying that the unit code (the thing that has to be entered in a convert template) should be "gross tonnage"? What about "GT" as per Gross tonnage? That's a bit dubious because it could be confused with "Gt" (gigatonne), but I think there are a couple of similar cases where people have to be careful to get the unit code exactly correct (and at least GT would be volume while Gt is mass). I don't mind what the unit code is, but they are usually brief.
Actually, I'd better confirm that: is GT a volume? Should it be possible to convert, say, 1234 cubic feet to GT?
I guess the symbol is "GT" and the name is "gross tonnage"? But how are each written with a value? I guess there is no plural name?
What is the default output unit (in a convert like {{convert|120|GT}})?
Where are the testcases!? Any chance of a few sample convert templates with what the output should be?
This looks interesting! Johnuniq (talk) 11:49, 22 September 2013 (UTC)
Well, the default output is obvious: m3 (cubic meters). Johnuniq (talk) 13:31, 22 September 2013 (UTC)
I'm not sure about all the synonyms and how you'd like to organize them. I supposed "gross tonnage" was fairly safe, but there might be room for revision. GT is used widely on Misplaced Pages via the template; it could also be G.T. to be less ? confusing for the template. My thought was that if it got inserted into the template, someone at one of the articles would set me straight about any errors. :) GT should indeed be a volume, and you should be able to convert to and from other units such as cubic feet. The problem of course is that most units come from science, but this one was invented by bureaucrats!
If you search "114,000 gross tonnage" online you'll find many sources using the phrase (occasionally with a hyphen after the 114,000...) So for now, as someone with dubious competence to command a rowboat, I'll say that my assumption is that
{{convert|120|m3|GT}} --> 29 gross tons
With the huge caveat that I have not looked into your module deeply enough to see how you generally decide the issue of the level of precision to report. Wnt (talk) 19:05, 23 September 2013 (UTC)

@Wnt: Your code works well, although despite the fact that I have made it work in Lua, I still haven't actually read it! I don't think I have time at the moment to put this in Module:Convert because of the details that would need to be figured out. Apart from the question of whether the output should say "gross tons" or "gross tonnage", there is the issue of the precision. The module has to do something when a user enters (say) precision 8 (8 decimal places), yet clearly the fixed iteration exit test produces considerably less than that. Either the module has to limit any given precision to, say, 2 places (and similar for the more tricky sigfig=8), or the iteration has to do something more sophisticated (which seems silly since talking about 0.1 GT seems totally pointless). I've got a bunch of things I want to do to get the module ready for deployment, and would like to defer consideration of this for a couple of weeks.

Please experiment with Module:Sandbox/Johnuniq/grosstonnage (edit it there, or copy it) and see what it does. Following is a quick test:

  • {{#invoke:sandbox/Johnuniq/grosstonnage | run_tests | 9000 | 11000}}
   Vol_input    Gross_ton    Vol_output  Iter
     9000.00      2511.76   9000.00280   4
    10000.00      2800.00   9999.99990   5
    11000.00      3089.11  10999.99989   5

Johnuniq (talk) 01:33, 25 September 2013 (UTC)

re: bed size table

...are you a wizard?! <3 — Preceding unsigned comment added by 193.63.174.211 (talk) 16:07, 5 October 2013 (UTC)

edit: *sees rest of talk thread only AFTER clicking the "send me a message" link on the main userpage and writing the above*
OHHHH I SEE NOW.
All the same, much thanks for fixing that. I'll try to follow that example next time something needs tweaking. 193.63.174.211 (talk) 16:23, 5 October 2013 (UTC)
This relates to a fix I made to how {{convert}} was used at Bed sizes. I've been working on Module:Convert for a long time and I'm glad there is benefit.
Is there a "send me a message" link on my user page? Some WMF wonder I assume. Johnuniq (talk) 09:30, 6 October 2013 (UTC)

Guns, Germs, and Steel

Johnuniq -

Your recent edits to this article were reverted by another editor, because they were unsourced. I think you made some very good points, and would like to see you put them back in, with sources. (What are the rules for citing a book when the article is about that book? I've never done it.) Just my 2 cents. Paulmlieberman (talk) 22:58, 7 October 2013 (UTC)

My recent edit was only to revert a very minor change that broke something in the text, and I did not write the section you mention. That section ("Response to criticism of Eurocentrism and determinism") can be seen in this permalink at 02:49, 27 September 2013. A quick look at the history suggests the removed text was present in the article four years ago, and is possibly older than that. I saw the edit which removed the section and decided to not challenge it because whereas the text was helpful to someone wanting to see Diamond's views, describing it as WP:OR is correct—an editor had essentially written a mini-essay extracting pieces from the book (aka cherry picking), and that's not suitable for Misplaced Pages. I'm afraid I don't have a recommendation about what to do because while it would be nice to present Diamond's views as he intended them, the only reasonable way to do that here is to find a reliable secondary source with an analysis of the book and its responses, then present a due synopsis of that information, with the source as a reference.
By the way, there is a problem with your signature as it is supposed to include a link to your user or talk page. There is something in your preferences where you possibly changed the default signature setting, and you might like to remove whatever you entered so the default occurs. Johnuniq (talk) 00:17, 8 October 2013 (UTC)
I try not to get into the politics around the GGS article, though I think it's a very important book, and I hate to see it trashed as Eurocentric. I think I fixed my signature. Here it is: Paulmlieberman (talk) 12:04, 8 October 2013 (UTC)
Yes, I agree. There has been a lot of nonsense written in response to the book. Signature is good. Johnuniq (talk) 23:15, 8 October 2013 (UTC)

Template editor role

Just to let you know that I've added the new template editor role to your account, which will come in useful when Module:Convert goes live & needs get protected, as it means that you'll still be able to edit it. -- WOSlinker (talk) 22:20, 17 October 2013 (UTC)

Thanks, nearly there!? Johnuniq (talk) 23:45, 17 October 2013 (UTC)

Titus Andronicus

Hey. Thought you might like to know I've opened a discussion about the non-free images in the Titus Andronicus article, here, if you wish to contribute. Cheers. Bertaut (talk) 20:42, 21 October 2013 (UTC)

Thanks, I noticed that and may comment later. I would suggest toning it down on the other editor regardless of the cluelessness of their behavior regarding collaboration. Johnuniq (talk) 21:57, 21 October 2013 (UTC)

Books and Bytes: The Misplaced Pages Library Newsletter

Books and Bytes

Volume 1, Issue 1, October 2013

by The Interior (talk · contribs), Ocaasi (talk · contribs)

Greetings Misplaced Pages Library members! Welcome to the inaugural edition of Books and Bytes, TWL’s monthly newsletter. We're sending you the first edition of this opt-in newsletter, because you signed up, or applied for a free research account: HighBeam, Credo, Questia, JSTOR, or Cochrane. To receive future updates of Books and Bytes, please add your name to the subscriber's list. There's lots of news this month for the Misplaced Pages Library, including new accounts, upcoming events, and new ways to get involved...

New positions: Sign up to be a Misplaced Pages Visiting Scholar, or a Volunteer Misplaced Pages Librarian

Misplaced Pages Loves Libraries: Off to a roaring start this fall in the United States: 29 events are planned or have been hosted.

New subscription donations: Cochrane round 2; HighBeam round 8; Questia round 4... Can we partner with NY Times and Lexis-Nexis??

New ideas: OCLC innovations in the works; VisualEditor Reference Dialog Workshop; a photo contest idea emerges

News from the library world: Wikipedian joins the National Archives full time; the Getty Museum releases 4,500 images; CERN goes CC-BY

Announcing WikiProject Open: WikiProject Open kicked off in October, with several brainstorming and co-working sessions

New ways to get involved: Visiting scholar requirements; subject guides; room for library expansion and exploration

Read the full newsletter

Thanks for reading! All future newsletters will be opt-in only. Have an item for the next issue? Leave a note for the editor on the Suggestions page. --The Interior 20:43, 27 October 2013 (UTC)

Convert/q needs Lua

Hi, Wikid77 here. I have created a Template:Convert/q, as a quick (ultra-fast) version of {Convert} and found that the Lua version is fast enough. So, I would like to use the Lua version, inside {convert/q} for limited main-space articles, to reduce 6-second conversions to below 1 second (where other templates are exceeding 30 seconds). I know you planned to release the Lua version as a system-wide upgrade, but a {convert/q} is needed soon, and the long-term testing for full-scale release of Lua is tedious, plus retro-fitting the dozen wp:wrapper templates: {Convert/2}, {Convert/3}, {Convert/4}, {Convert/flip2}, {Convert/flip3}, {Convert/show2}, {Convert/show3}, (etc.). Anyway, if {convert/q} will be a burden, then I can implement it through other means. Things are moving so fast, and people are complaining that Template:Jct is crashing pages (reformat: 58+ seconds!), where {Convert} is used 150-250 times (taking up to 6 seconds compared to Lua 0.80 second). They are planning a Lua version of {Jct} in December/January, but it has over 1,780 road-type formats to rework in Lua script. Meanwhile, {convert/q} with Lua would reduce those large pages by 10% faster, and so that would be excellent. -Wikid77 (talk) 22:42, 1 November 2013 (UTC)