Unbelievable Bug!!!

Report bugs. Post bug workarounds or fixes

Moderator: MSandro

Post Reply
SimpleSi
Posts: 330
Joined: Jul 2nd, '17, 13:47

Unbelievable Bug!!!

Post by SimpleSi » Oct 27th, '17, 06:08

Either this is the strangest bug I've ever seen, there really are Ghosts in the Machine or I've finally gone mad!!!

Code blocks are disappearing from a script!

I'm working on my GIFReader which has a long script in it and a couple of days ago - some blocks in the script seemed to have have been deleted

Now - this can happen if you slip up during debugging but on this occasion - there were blocks missing from several parts of the script

Strange I thought but I just opened up a previous version and copied the missing blocks back in

It has now happened again!

I will take an oath that when I went to bed last night - the code was working and complete

I've come back to it this morning and pressed Go - got an error and yet again blocks are missing from the script!

Now I know what you must be thinking!!! #LOL but blocks are missing from two separate parts of the script (Just as happened 2 days ago)

Happening once I can put down to quantum fluctuations in space-time but not twice in 2 days!!!!

How on earth can this occur!!!!!

Thoroughly befuddled Simon!!!!

JohnM
Posts: 379
Joined: Sep 11th, '15, 14:42

Re: Unbelievable Bug!!!

Post by JohnM » Oct 27th, '17, 17:09

Sorry that you're losing random bits of your scripts.

This is probably a GP bug, perhaps related to the overall number of blocks in the scripting area. (I think it is may be the largest amount of code written in a single scripter pane, and the main script is certainly one of the longest I've seen.

If you're running on WIndows or Linux, there could be some hints in the GP terminal window.

Since the appears random, it may be difficult to reproduce. I'm just guessing, but it might help to split the code into separate methods or shared blocks (read GCE, read Image Descriptor, read Color Table, read Image Data, etc.)

A trick that may help you back up your work is to select "copy all scripts to the clipboard" in the scripting pane right-click menu and then paste the result into a text editor. That will give you a dump of your code as text. If you need to recover some lost code, you can select and copy the text, create a new class, and select "paste scripts" from the scripting pane right-click menu. You'll need to recreate by hand any instance variable (and maybe shared variables) used by the scripts. Or, if you've just just a few blocks, you can select the relevant lines of text, paste them into a GP workspace, and use "blockify it..." to turn them into blocks.

Meanwhile, it's probably good to save your big GP project with different version numbers (e.g. GIFReader10, GIFReader11, GIFReader12, ...) as it appears that you are doing. That way, if GP totally messes up the project when it saves it you have the previous version to go back to.

Please let me know if you get any clues about what is causing blocks to get lost. For example, if you lose blocks you just added during a session it could indicate that the save operation failed. In that case, the write-time of the file would probably indicate that the file wasn't saved -- or the file might not be openable by GP because the save failed partway through writing the file.

SimpleSi
Posts: 330
Joined: Jul 2nd, '17, 13:47

Re: Unbelievable Bug!!!

Post by SimpleSi » Oct 27th, '17, 17:22

I'm just guessing, but it might help to split the code into separate methods or shared blocks (read GCE, read Image Descriptor, read Color Table, read Image Data, etc.)
Yep - good idea

The program just grew and grew as I was reading

http://www.matthewflickinger.com/lab/wh ... _bytes.asp

and adding to the script as I went deeper and deeper down the gif format rabbit hole

Current version has replaced using large arrays with using binary data (and not making copies of the whole image data but working on the 255 blocks one at a time) so it should reduce its working memory requirements

JohnM
Posts: 379
Joined: Sep 11th, '15, 14:42

Re: Unbelievable Bug!!!

Post by JohnM » Oct 28th, '17, 13:00

By the way, I'm very impressed that you wrote a GIF reader using the GP scripting system. Most of the GP system code for things like the PNG file reader is written in the textual form GP code using an external text editor. At the beginning, we needed to do that because there was no GP blocks system yet. But GP is now getting to the point where someone like you, who is willing to dig into the system palette to find things like BinaryData, can write serious system code using GP blocks. This is a testament to your perseverance with GP in it's current state, but it's also evidence the people can follow a path from Scratch-like programming in non-developer mode to exploring the underlying GP system to becoming a developer who creates useful GP extensions.

You're only the second person to do this -- the first person who tried, a couple of years ago, had to gave up because GP wasn't ready.

At Xerox PARC they had a saying for people trying out the brand new computer systems they were creating: "You can tell the pioneers -- they're the ones with the arrows in their backs." So, sorry about the arrows, but congratulations on being a real pioneer!

SimpleSi
Posts: 330
Joined: Jul 2nd, '17, 13:47

Re: Unbelievable Bug!!!

Post by SimpleSi » Oct 28th, '17, 14:13

Thanks but...

.... its really thanks to you for making GP so open and "simple" :)

Obvious the whole morph thing isn't simple but the concept of GP being written in GP until we get down to primitives has made things very accessible

And letting us have access to everything above the VM has shown that GP is very moldable and not a fixed "take it or leave it" language like many others

I've always thought that block programming is only limited by the underlying language construction and not in itself a barrier to advanced programming and education

At the moment, here in UK, pupils are being moved directly from Scratch in primaries (age 7 -11) to Python in secondaries (11 onwards)

I've always felt that we need something to make that transition from block to text based as easy as possible (both for pupils AND their teachers)

A young (13 yr old now) person who I know is working on Edublocks http://edublocks.org/ which is Python syntax in block format as one method to achieve this

But I can actually see GP as negating the need for it as all the necessary programming knowledge required for pupils to know, to be exam tested at 15, could be learnt from using GP

:)

Post Reply