Template talk:Ft3 to m3

From Wikipedia, the free encyclopedia

Contents

[edit] Test

Template:Cft to cm

Hrmm, okay I'm probably jumping the gun, but it isn't working yet, lol. Let me go find a template expert, Mike, lol ArielGold 21:26, 25 September 2007 (UTC)

[edit] Test 2

Try this:

12,500 cu ft (354 m³)

This is all still in my userspace... --MikeVitale 21:38, 25 September 2007 (UTC)

[edit] Doh!

Ohhhhhh duhhhh. I told you I had no idea how templates really work, lol. Just smack me! Hee hee. Yeah that works, let me go get some figures that I know both values for to compare... from Vehicle Assembly Building: "encloses 129,428,000 cubic feet (3,664,883 m³) of space."

So... with this one we get:

129,428,000 cu ft (3,664,993 m³)

Hmmmm...Well, the conversion is not the same, but I don't know who originally converted it, those are the numbers as given straight from the NASA site itself, so it could be those were not exact. Still, it looks good, and I like how it puts in the commas! ArielGold 21:43, 25 September 2007 (UTC)

Okay, volume converter online says: 129,428,000 feet^3 = 3,664,992.8 meters^3 which says yours is right, and the original conversion was off, for whatever reason. ArielGold 21:47, 25 September 2007 (UTC)

[edit] Questions for Jimp

Hey there Jimp. My adopter, ArielGold, pointed you my way. Here's an idea of what I'm looking for.

First, I don't want someone to come in and "fix this for me." As she has indicated, I'm a programmer IRL, so I can probably (or, at least, eventually) figure out how to fix the template.

As a starting point, I would like to discuss the comments I put at the top of the doc in the "Planning" section. To move them here and allow the discussion continue here:

  • Single-input conversion should assume that the input is in ft**3, and output will be in m**3.
seem reasonable — Timotab Timothy (not Tim dagnabbit!) 23:30, 25 September 2007 (UTC)
  • Double-input conversion should work for ranges only (e.g. 100 ft**3 - 200 ft**3 ==> 30 m**3 - 61 m**3)
seems reasonable — Timotab Timothy (not Tim dagnabbit!) 23:30, 25 September 2007 (UTC)
  • Triple-input conversion should not be accepted....?
what would triple input mean? so, yes, that seems reasonable — Timotab Timothy (not Tim dagnabbit!) 23:30, 25 September 2007 (UTC)
  • Is convtype needed anymore? Can that now be assumed?

Leave comments either inline, or create a section for each below. Respond as you have time. My timezone is GMT-6 (US Central), and I hear that you're in Oz, so around GMT+9 or more. We're quite a bit off, but I'm sure that we can get this all knocked out. I think it's "almost there" already!

Thanks in advance for your assistance! --MikeVitale 22:01, 25 September 2007 (UTC)

~*jumps in*~ I'd suggest calling the template other than {{cft to cm}} given that cm means centimetres. as far as I can tell, ^ isn't anything special, so {{ft^3 to m^3}} would be fine, I think. — Timotab Timothy (not Tim dagnabbit!) 23:23, 25 September 2007 (UTC)
Actually yeah that thought about cm occurred to me earlier, but then it promptly fell out of my brain and got lost somewhere... ArielGold 23:24, 25 September 2007 (UTC)
I've considered that as well, but it's a rather minor consideration. Still, thanks for bringing it up. It's good to have it mentioned somewhere so it doesn't fall out of our brains, like happened to Ariel!  ;-) --MikeVitale 23:30, 25 September 2007 (UTC)
I think that it boarded Ariel's train of thought, that pulled out of the station a short time ago... ArielGold 23:31, 25 September 2007 (UTC)

Hello Mike,

Pleased to e-meet you. I hope I can be of some help.

My answers to the questions above
  • Single-input conversion should assume that the input is in sq ft, and output will be in m³.
    • Is this what the editor would expect? Seems a definite "Yes." on that one. I think that this is pretty safe. (Side note: down towards the bottom of the page when you're editing between "Do not copy text from other websites without a GFDL-compatible license. It will be deleted." and "Your changes will be visible immediately." you'll find a box full of symbols click on any of them & they'll appear (you can use them in templates too).)
  • Double-input conversion should work for ranges only ...
    • Yep, ranges are useful. Of course, this is not the only possible double input you might want but is probably the most intuitive. Why not?
  • Triple-input conversion should not be accepted....?
    • Well, you might want to enter the length, width and height and have the template calculate the volume (looks like you've thought of that). But allow this and someone might want to enter six parameters (i.e. from-length, from-width, ... to-width, to-height). Is it worth the extra code? (Let'em enter {{#expr:7*11*3}} if they can't or don't want to do the calculation.)
  • Is convtype needed anymore? Can that now be assumed?
    • I don't see the need for convtype. If there are two (and only two) unnamed parameters given, it's a range. If there's only one, it's not. (And perhaps if there are three, given these are dimensions.) Let the template count the number of parameters and figure it out automatically.
  • I'd suggest calling the template other than {{cft to cm}}
    • Yeah, {{ft^3 to m^3}} (or just {{ft3 to m3}} in line with other such template names). I found that puzzling. Minor in the sense that it's an easy fix but major in the sense that it would be very confusing.
A few ideas on how to simplify your code
  • I notice that you've included num, from & to and even l and w (but explicitely not h) as optional parameter designations.
    • The other templates do also ... for the life of me I cannot understand why. For the editor it's much easier to enter the value as an unnamed parameter.
    • I've had a quick look around at the transclusions of the templates. I haven't checked them all by any means but of those I have num is not used ... ever.
    • Eliminating these options would allow significant simplification of the code.
    • You don't have to follow suit.
    • It might be fruitful to view consistancy with the other templates in the light of the usage of this option.
    • Were someone to get it into his or her head to finally be done with this nonsense once and for all and go through eliminating all the nums (not only in the templates but, of course, in their transclusions too), they'd ever be grateful to you for not using this to begin with.
    • I dunno, weigh it up for yourself, but I know what I'd do.
  • You'll find that the following are equivalent.
    • {{#ifexpr: ({{#if:{{{1|}}}|1|0}} OR {{#if:{{{a|}}}|1|0}} OR {{#if:{{{b|}}}|1|0}} OR {{#if:{{{c|}}}|1|0}})|yay|nay}}
    • {{#if:{{{1|}}}{{{a|}}}{{{b|}}}{{{c|}}}|yay|nay}}
  • You don't need to give the default if you're not checking it. If spell is unspecified the software will compare {{{spell}}} to commonwealth and come out with a negative anyway. The following are equivalent (note how I've also saved three bytes by putting the met on the outside—harder to read perhaps but if the page has a lot of transclusions size does count).
    • {{#ifeq:{{LC:{{{spell|american}}}}}|commonwealth|metre|meter}}
    • met{{#ifeq:{{LC:{{{spell}}}}}|commonwealth|re|er}}
  • You've probably checked but cubic meter is a redirect so you could just link to that but you might prefer the direct link.
  • One trick that I like using is the sub-template. They can save a lot of typing and can also make for a smaller template (in terms of number of kilobytes)—note that these are not necessarily the same thing.
    • For example, instead of typing {{{1|{{{num|{{{l|{{{from}}}}}}}}}}}} over and over, type {{ft3 to m3/sub|{{{1|{{{num|{{{l|{{{from}}}}}}}}}}}}|... ...}} on the main page and simply use {{{1}}} on the subpage.
    • This can even mean the difference between a template that works and one that crashes. I have one, which I either wrote or rewrote, in mind that was repeatedly using {{PAGENAME}}. It must have blown the size limit. So I put the said {{PAGENAME}} on the main page and sent it to the subpage(s) as a parameter ... problem solved.
  • You've requested that the template not be fixed for you. I won't. I wouldn't fix it either. I'd redo it from scratch ... no offence but sometimes it's better to buy a new truck than fix a broken cart.
    • Often when something isn't working it's easier to delete the whole thing and rewrite it than go picking through to find the error—that aside though, with all respect to the author you're basing this code on, I'd do it differently.
    • You'd also probably get a better feel for template writing that way ... maybe.

Anyhow, have a good one & I'll be back to ya. Gotta go. Jɪmp 09:15, 26 September 2007 (UTC)

[edit] Yay, more responses

Jimp,

Thanks for looking over the template code and providing assistance. Some of what you mentioned was spot-on fully attributable to me, and some of what you mentioned was because I cut-and-pasted from the default {{ft to m}} template. I also hadn't quite gotten around to completely cleaning up my template, but you have instead convinced me to rewrite it mostly from the ground up. This process is now complete, and I hope looks more pleasing to the eye. (Well, as pleasing to the eye as Wikipedia template code can get. Frankly, I find it quite ugly, but that's a discussion for another time. At least it works. I think.)

You mention that there are potentially uses for two input parameters besides "range" calculations. I cannot think of any, which is why I posed the question in the first place. Can you elaborate?

You're right. I don't want to accept triple-inputs, simply because I don't also want to expand to accepting 6 inputs. Ugh, fear that code.

On your simplification suggestions:

  • num is no longer an acceptable parameter.
  • if statements should be simplified now.
  • Defaults no longer specified when not checked.
  • I know about the cubic meter redirect, but you're right in that I prefer the direct link.
  • I can probably expand this to use more templates. I particularly don't care for how many times throughout the entire set of subroutines that I've had to include the "0.0283168466" conversion constant. I'll probably fix that up next.

Again, thanks for the tips, tricks, and pointers. They're much appreciated. --MikeVitale 17:29, 26 September 2007 (UTC)

And I take full responsibility for the initial copy/paste of {{ft to m}}, as that was my suggestion for where to start with this, so feel free to flog me! ~*Giggle*~ ArielGold 18:08, 26 September 2007 (UTC)
"0.0283168466" conversion constant moved to its own subroutine, and things still appear to work. --MikeVitale 18:21, 26 September 2007 (UTC)
"Some of what you mentioned was spot-on fully attributable to me, and some of what you mentioned was because I cut-and-pasted ..." yeah, it looked familiar. It's coming along. The new code is a whole bunch simpler than the old. Of course, it could be made simpler still.
  • For example, here's another trick. Use the #if to decide which template to direct to. The following are equivalent (dim just ignores the second parameter).
    • {{#if:{{{2|}}}{{{to|}}}|{{User:MikeVitale/ft3 to m3 range|{{{1|{{{from}}}}}}|{{{2|{{{to}}}}}}|abbr={{{abbr|mos}}}|spell={{{spell|american}}}|wiki={{{wiki|no}}}|precision={{{precision|-999}}}}}|{{User:MikeVitale/ft3 to m3 dim|{{{1|{{{from}}}}}}|abbr={{{abbr|mos}}}|spell={{{spell|american}}}|wiki={{{wiki|no}}}|precision={{{precision|-999}}}}}}}
    • {{User:MikeVitale/ft3 to m3 {{#if:{{{2|}}}{{{to|}}}|range|dim}}|{{{1|{{{from}}}}}}|{{{2|{{{to}}}}}}|abbr={{{abbr|mos}}}|spell={{{spell|american}}}|wiki={{{wiki|no}}}|precision={{{precision|-999}}}}}
  • I notice that your subroutines are on whole new subpages of your user page. When you move the template into the template space are you moving them to {{ft3 to m3 range}}, {{ft3 to m3 dim}}, etc.?
    • It works either way but I kind of feel it's better from an organisational POV to have your subroutines be subpages of your template i.e. {{ft3 to m3/range}}, {{ft3 to m3/dim}}, etc.
    • You then don't have to worry so much about random users' stumbling onto the subroutine page and getting all puzzled. If they stumble onto a subpage, subpage–subroutine—makes sense + there's a link to the main page (it's automatic, see the top left of this page).
    • Yeah, {{ft to m}} does this but I wouldn't.
Here's a helpful link,
Help:Calculation
Jɪmp 01:27, 27 September 2007 (UTC)
Snuck (or wasn't that sneaked) over to your talk page and found your coment about the scrunched-upness of the code. Actually it doesn't have to be scrunced, you can space it out.
{{User:MikeVitale/ft3 to m3 {{#if:{{{2|}}}{{{to|}}}|range|dim}}
|          {{{1| {{{from}}} }}} <!-- You can even add comentary within the code if you like. -->
|          {{{2| {{{to}}} }}}   <!-- Just place it between these comment-whaternames.        -->
|     abbr={{{abbr|mos}}}       <!-- Line stuff up like that.                                -->
|    spell={{{spell|american}}} <!-- Note how you still don't need to include the default.   -->    
|     wiki={{{wiki|no}}}        <!-- Group your curlie brackets together like this.          -->
|precision={{{precision|-999}}} }}
Jɪmp 02:14, 27 September 2007 (UTC)

[edit] How very interesting...

Jimp, you are a fount of useful knowledge. I am indebted to you for all your assistance on this template stuff. You have excellent ideas all around here.

  • I have moved all subroutines to now be sub-pages. That's a great idea I hadn't considered.
  • I like the way you suggested switching sub-templates based on inputs. It's cleaner, and not that much harder to understand. Kinda like the difference between spelling out an if/then/else in Java and using the ?: ternary operator.
  • I love that I can now keep my code mostly-organized. Parts that are directly output to the screen (i.e., not a part of any kind of expression or if-statement/etc) must still be "scrunched up"...But I can live with that in light of the fact that the rest of the code is legible. In HTML terms, that even makes sense.
  • Unfortunately, my testing has shown me that I cannot remove the default to the named arguments when calling the subroutines. I get an error of "Expression error: Missing operand for round". Oh well.

Even in spite of that last bit there (and I still might be doing something wrong, but at this point, I don't know what that would be), you are still "daman" when it comes to templating! Thanks a ton! --MikeVitale 14:44, 27 September 2007 (UTC)

Yeah, sorry, try removing the default from everything but precision. Jɪmp 16:14, 27 September 2007 (UTC)
That apeearsappears (who typed that the first time? Certainly not me!) to have worked. Le woo, udaman.
So what's the next step here? Do I just be bold and move this into main template-space and let people start using it, or is there some kind of approval process for new templates (especially ones as intricate as this)? --MikeVitale 17:21, 27 September 2007 (UTC)
Just like an article, the only approval process is seeing how long it lasts out there. If it works, is not redundant, is useful and breaks no rules; it should stand the test of time. Intricacy is not a problem. Go ahead and move it. Of course, once it's out there it's a free-for-all, anyone can come and edit it (well, that's still possible now but ...), however, this not one of those template screaming "Fix me!" (There are a few about). Jɪmp 23:27, 27 September 2007 (UTC)
OK, great. I'll go move it. Is there a place to "announce" these things so that people who aren't watching the movelog will be able to find out about it? Or is that something that's just best done "organically"? --MikeVitale 23:52, 27 September 2007 (UTC)
Maybe at WP:VP but actually you rarely see such announcements if ever. It's in the category with the other conversion template, that's where I'd look if I wanted it. Jɪmp 02:53, 28 September 2007 (UTC)

[edit] Extra thingie

You've got a </noinclude> showing up in the documentation for the template, Mike (under "Examples in the Range conversions section.") I looked, but couldn't see why it was showing up, so it may be something with subpages? ArielGold 18:34, 27 September 2007 (UTC)

Thanks for noticing that! I hadn't seen that yet. There was an extraneous </noinclude> tag in the doc page. It's been eradicated.  :) --MikeVitale 18:52, 27 September 2007 (UTC)
I know this is going to sound cheesy, but I just want to say that I'm really impressed with how quickly you picked all this "foreign weirdo wiki script" stuff up (lol), and while you may not choose to devote your Wiki time to templates, I think you're just super talented with it, and it is great to see how fast you took an initial idea and turned it into a really clean, effective template that surely will have uses for many articles here. I know that I've personally wanted this template more than once, and I've seen it requested numerous times. You did just an awesome job with it. ArielGold 19:04, 27 September 2007 (UTC)
*blush* Thanks, Ariel. I appreciate it. It's not all that bad, to be honest. The more I learn, the more it all makes sense. I'm glad to hear/see that I can keep my code organized, indented, and looking like code. That's the best part, to be sure. I was really despising when I thought I had to scrunch it all up so that there were as few spaces as possible. At least this way, it looks like code. In fact, it's probably even more "spread out" than most people would do it. But that's how code goes. No two people ever like to see their code exactly the same way.  ;-)
Thanks for inroducing me to this part of Wikipedia. It's been a very interesting learning experience, even if this template has taken up most of the week...  :) --MikeVitale 19:24, 27 September 2007 (UTC)
Well I think it took you a lot less time than I thought it would, considering how complicated it was, and that there were really no equivalent templates for cubic anything to go from, so I think you did great! And I'm just so happy that Jimp had the time to help, and that he was able to explain so many things that obviously, I'd have never, ever been able to do! lol. Now, I'll have to think of something else for you to dig your teeth into, lol. ArielGold 19:58, 27 September 2007 (UTC)
It's certainly clear that wikicode was not designed as a programming language :) — Timotab Timothy (not Tim dagnabbit!) 20:25, 27 September 2007 (UTC)