Mozilla WebThing Server and Other feedback

Issue #42 resolved
Turgut Guneysu created an issue

Hi John,

Thanks for the directions on the MWTS. I started using it and noticed the following:

1st and last characters are getting dropped, unless single quotes are used around the input designated URLencoded.

Given the small sample code:

Here are the outputs displayed for various browser inputs:

  1. http://localhost:6473/mb/setVar/globalVar/textValue

  2. http://localhost:6473/mb/setVar/globalVar/'textValue'

  3. http://localhost:6473/mb/setVar/globalVar/Some%20URLencoded%20Text

  4. http://localhost:6473/mb/setVar/globalVar/”Double-Quoted

  5. http://localhost:6473/mb/setVar/globalVar/PlainText

  6. http://localhost:6473/mb/setVar/globalVar/”PlainText

  7. http://localhost:6473/mb/setVar/globalVar/%27%20Some%20URLencoded%20%22text%22%27

  8. http://localhost:6473/mb/setVar/globalVar/'888abc333'

    Then IMMEDIATELY after this statement, I do a GETVAR to read what has been changed, and I got:
    http://localhost:6473/mb/getVar/globalVar

    This happens to be a value that was used just previous to the last one I did during the tests.
    Then I REPEATED the GETVAR statement and this time I got the correct value 888abc333:

    After this, I thought maybe it is happening because of the CACHE content. So I repeated the test of SETVAR followed by GETVAR with Chrome CACHE clears in between, and I got exactly the same results.

    This “display of the previously set value” happens also with numeric data.

  9. http://localhost:6473/mb/setVar/globalVar/FALSE

    true sets to true setting the var in code to true reads true
    TRUE sets to true (UC → LC) TRUE reads TRUE
    false sets to false false reads false
    FALSE sets to ALS FALSE reads FALSE

Related to #9, the “true” value setting of a var doesn’t evaluate as I expected in the condition blocks.
eg: if I set var to “true”, then I expect the evaluation of IF VAR to be TRUE and iF NOT VAR to be FALSE, but it is not.
On the other hand, the “false” setting of a var evaluates correctly.
Similarly, setting a var to 1, evaluates wrong in “true/false” sense, but setting it to 0 evaluates correctly.
Maybe a clarification of how the logical states and values are operating internally will be helpful.

Since things are still in development stage, if I should not test these things please advise and I’ll wait till it is OK to test.

Comments (6)

  1. Turgut Guneysu reporter

    OK, #9 description got botched up due to formatting. Here is a clearer version:

    Setting the var via browser to:

    true sets to true
    TRUE sets to true (UC → LC)
    false sets to false
    FALSE sets to ALS

    in code.

    setting the var in code to:

    true reads true
    TRUE reads TRUE
    false reads false
    FALSE reads FALSE

    in browser getvar

  2. John Maloney repo owner

    I’ve looked into this. There are two bugs – one in handling string variables and one that causes old variable values to get reported. Will try to fix both in the next version. Thanks again for the testing!

  3. John Maloney repo owner

    Booleans in MicroBlocks

    In conditional and boolean expressions, the boolean value “true” is the only value that evaluates to true. All other values, including strings, numbers, and the boolean value “false” evaluate to false. For example, the body of “if n …” will be executed only if the variable n is the boolean true. It won’t be executed if n is 0, 1, or “hello” (i.e. if n is any number or string). This differs from the semantics of C-like languages, where 0 is treated as false and all non-zero values are treated as true.

  4. John Maloney repo owner

    The Mozilla Web Thing Server issues reported above will be fixed in the 0.2.2 release.

  5. Log in to comment