Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Optional line checksum information in the editor — Gideros Forum

Optional line checksum information in the editor

SinisterSoftSinisterSoft Maintainer
edited May 2013 in Suggestions & requests
The other day I helped try to get some kids into computer programming at a local Secondary school. I gave them all a printed copy of a new Gideros guide I wrote (it's available from here: https://www.facebook.com/sinistersoft?fref=ts ).

I hoped to encourage them to type in the listings, play them, modify them, etc...

It was a great success, the kids loved Gideros and there was some really good results.

The only real problem came from them typing in the listings, it was difficult for them to get everything correct - especially the upper and lowercase letters, etc.

I think that if the Gideros editor could have an optional 'checksum' column that could be enabled/disabled it would solve the problem. The children would realise that the checksum on the editor and the checksum in the listing did not match - so they could then recheck that line more carefully.
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
https://deluxepixel.com

Comments

  • ar2rsawseenar2rsawseen Maintainer
    @SinisterSoft , can you elaborate more on how that supposed to work? I can't seem to grasp the idea
  • @ar2r, the checksum was an old technique used generally with the older 8-bit computers where most of the entry was numbers as it was assembly code. Each line had a checksum at the end. So when the user typed all of that and made a mistake, the checksum would display that there was an error in line xxx and you could go, read that properly and fix it.

    Not sure how that would be done with textual data/code.
    twitter: @ozapps | http://www.oz-apps.com | http://howto.oz-apps.com | http://reviewme.oz-apps.com
    Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
    Cool Vizify Profile at https://www.vizify.com/oz-apps
  • ar2rsawseenar2rsawseen Maintainer
    @OZApps meaning then the editor must already know what program should be entered line by line?
  • SinisterSoftSinisterSoft Maintainer
    edited May 2013
    No, I propose that the column can be made visible or not. If I do a screen grab of the editor then it will have the checksums on it (eg to the left of the line no).

    If I put the screen shot in a leaflet or book then the reader can check that they have each line typed in correctly as they go. This way they don't have loads of errors due to spelling mistakes or upper/lower case problems.

    I don't propose the compiler checks the checksum - it's just an optional editor feature if they are typing in a listing that was screen grabbed (or printed from the editor?).

    The magazine listings in the 80's had them printed and the editors were hacked to display the number on screen. The best way of getting kids to learn is by getting them to type things in rather than just load or download routines - it's also more fun.

    The checksum could be a 16 bit number in hex.
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
  • @SinisterSoft, I actually think this is a really good idea. I doubt it'll get done since the IDE has been at the bottom of the pecking order for updates compared with the rest of the SDK but I can see how useful it is to encourage people (kids especially) to type stuff in rather than copy/paste.

    One possibility might be to encourage one of the other compatible IDEs like @paulclinger 's ZBS to add this as a feature.

    best regards

    Likes: SinisterSoft

    +1 -1 (+1 / -0 )Share on Facebook
  • @SinisterSoft, @bowerandy, it's an interesting idea. I think it's more doable if you put this checksum in a comment at the end of the line (-- 0xbeef). I may be able to write a small code snippet you can drop in a config file in ZBS that would add a menu item ("Check code"?) that would run a check against those checksums that are specified (by stripping comments and calculating the checksums) and giving you a list of lines that don't match. You can then click on that line to navigate to the code.

    ZBS also includes static analyzer that is supposed to catch most of these errors.

    If you give me your checksum algorithm, I can probably take a stub at it today... you can then tweak it to your liking...

    Likes: SinisterSoft

    +1 -1 (+1 / -0 )Share on Facebook
  • SinisterSoftSinisterSoft Maintainer
    edited May 2013
    It should be easier to keep a running checksum of each line - it would not need to be stored with the file.

    The kids like typing things in, so the listings would also have the checksum printed next to the line (either by screenshot or by a listing print from the editor?).

    Having the checksum next to the line they are typing gives the an extra element of 'fun' when typing in listings.

    A live checksum should be easy to code (you just recalc the checksum if the line changes).

    I've not got a checksum algorith yet. lol. Currently it's just an idea. Whatever it is though it should skip leading and edge blanks/tabs, etc as that would just complicate things.

    With the new push in the UK for computer programming in Primary/Secondary education Gideros could well be used in quite a lot of schools if they play their cards right.

    In the UK the Government has announced that from September 2013 ICT is being changed to Computing for all four keystages (KS1 to KS4) with programming having a major role.

    At the school I went to the kids seemed to prefer this to Scratch and Python - typing things in and the possibility of getting things displayed on their own phone or tablet is very exciting for them.
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
  • OZAppsOZApps Guru
    edited May 2013
    @SinisterSoft, with languages like RPG on the AS/400, Cobol, these would be practical, with a forgiving language like Lua, an extra space or missing a space can make a whole lot of difference in the checksum.

    for examle
     local a = 1
    local  b=2
    local c =3
    twitter: @ozapps | http://www.oz-apps.com | http://howto.oz-apps.com | http://reviewme.oz-apps.com
    Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
    Cool Vizify Profile at https://www.vizify.com/oz-apps
  • With regards to the algorithm, each line can be xor'ed to get a checksum and add to that the length of the line in characters, that should not be difficult at all, but that would also make it so rigid and tight that even an extra space would render the checksum not to match.
    twitter: @ozapps | http://www.oz-apps.com | http://howto.oz-apps.com | http://reviewme.oz-apps.com
    Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
    Cool Vizify Profile at https://www.vizify.com/oz-apps
  • SinisterSoftSinisterSoft Maintainer
    edited May 2013
    local a = 1
    local b=2
    local c =3

    These should me ok with the space missing shouldn't they? Before the checksum is created, strip all spaces/invisible characters. At least the checksum will show that the line is incorrect and they should check it (even with a checksum then line may be incorrect but the checksums match).

    I'd say use the standard crc32 algorithm, but keep only the lower 16 bits - eg just show something like FEDC, don't even bother with the 0x or $.

    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
  • bowerandybowerandy Guru
    edited May 2013
    @SinisterSoft, @paulclinger, I think the algorithm is very straightforward. For each line use a regex to replace all whitespace characters by a single space then xor up all characters.

    However, where to display it is slightly trickier. I don't think a comment is a good idea for two reasons. First is that this needs to be displayed as the user types. That would mean altering th source as you type, which would be messy. Also the comment would have to go at the end of each line, which would be visually unappealing. Although it may not be a five minute addition I think there should be an extra margin pane in the editor that displays the checksum as the line is being typed. This could be left or right justified.

    @SinisterSoft, the reason I suggested ZBS for this is that I've had several conversations with @paulclinger in the past and know that he's interested in the educational potential of Lua. I'm also keen on this and, since I'm in the UK too, am very interested in your thoughts on getting stuff into UK schools.

    Best regards

    Likes: SinisterSoft

    +1 -1 (+1 / -0 )Share on Facebook
  • Actually, this could also be another call for @atilim to open source the code for the IDE. I've said before that I don't think the IDE is really a part of the core IP of Gideros and you could gain significantly by opening this up for for third party modification.

    Best regards
  • ar2rsawseenar2rsawseen Maintainer
    @bowerandy we discussed this option, and most probably this is the way it will go, but not yet. IDE right now has too deep integration with Licensing/Exporting thus firstly these things needs to be separated.
  • SinisterSoftSinisterSoft Maintainer
    edited May 2013
    @bowerandy Not a comment - a column (I don't think I ever mentioned a comment :) ). To the left of the line numbers. This column could be optional on/off. It would not affect source code, it wouldn't be in any files.
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
  • @bowerandy Not a comment - a column (I don't think I ever mentioned a comment :) ). To the left of the line numbers. This column could be optional on/off. It would not affect source code, it wouldn't be in any files.
    I know but that was @paulclinger 's idea above.

    best regards

    Likes: SinisterSoft

    +1 -1 (+1 / -0 )Share on Facebook
  • SinisterSoftSinisterSoft Maintainer
    Then yep, 100% a comment is a bad idea. ;)
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
  • @bowerandy, @sinistersoft, yes, the comment was my idea. The main reason I suggested that is that many editors are not that customizable to add a column to the left of the line numbers (or anywhere for this matter). For example I know Scintilla editing component well and it does allow different types of margins, but as far as I know, there is no way to add a column with some arbitrary content as would be needed in this case.

    Another reason for suggesting comments was that you not only need to type them, but you also (as a teacher) need to print them. It would be trivial to write a script that adds these comments before printing (but not so trivial if it's kept in a separate column in the editor).

    I can propose an alternative that should work well with ZBS (and probably other IDEs). I can display this checksum in the status bar, which would allow you to see it for the line the cursor is on. It would be updated every time you change something in the editor (or when you move the cursor). Your users can still use it as a quick check mechanism, but it's not going to be in their ways.

    > For each line use a regex to replace all whitespace characters by a single space then xor up all characters.

    That's easy enough. I can probably take few minutes to try this...

    Likes: SinisterSoft

    +1 -1 (+1 / -0 )Share on Facebook
  • SinisterSoftSinisterSoft Maintainer
    Yes, that would also work as an alternative to the column.

    (So you use Scintilla for your editor component? So do I in my reports program: http://reportcomplete.com/ :) Scintilla is great. )
    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
Sign In or Register to comment.