CG programming for non-programmers, lesson 9

Thanks to J. Peterson for point out the lack of error messages in his comment yesterday. When your program stops running, I wasn’t providing any way for you to see where the error is.

For this ninth lesson, I’ve kept everything the same except that I’ve added some behind-the-scenes infrastructure. Now when your program stops running, there is an explanatory message along the top, and an arrow that shows you which line of your program is causing the problem.

Let me know if this works for you. I would love to get constructive feedback.

You can see this lesson by CLICKING HERE.

12 Responses to “CG programming for non-programmers, lesson 9”

  1. Al says:

    I find the current implementation outputting. When you type anything, it immediately updates and the textbox you are typing in moves around the screen.

    Recommendations:
    * Move the error text to the bottom of the page (so it doesn’t matter how long it is, it won’t move the code box or output).
    * Put a fixed width placeholder in for the arrow on the left so when it appears, it doesn’t move the code box or output.
    * Possibly put a small delay (one or two seconds) before running the check so it waits for the user to stop typing before displaying any error.

    Thanks for this, really enjoying it so far.

  2. Al says:

    Dam, you always do your best proof reading 2 seconds after hitting submit!

    First sentence should read:
    >”I find the current implementation off-putting.”

  3. admin says:

    It doesn’t do that on my MacBook running Chrome. Tell me what OS and browser you are using so I can debug for that platform.

  4. Al says:

    Windows 7 & Firefox
    (have tested on internet explorer and it worked fine).

  5. admin says:

    As you type in Firefox does the text shift horizontally or vertically or both?

  6. admin says:

    OK, I think I fixed it. Turns out that Firefox no longer properly supports the horizontal rule (<hr>) tag. So I needed to replace that by a <table> object, and also do a check to see whether you are in the Firefox browser, because if you are then I need to do the math differently to put the arrow in the right place.

    In short, if you make sure to refresh your browser page then it should all work now in Firefox.

  7. J. Peterson says:

    Nice! One minor issue is long error messages (like the error from using “20” instead of “20.” while computing x or y) push the image output window off to the right. Still 100% functional, just looks a bit clunky.

  8. J. Peterson says:

    (Chrome running on Mac OS X 12.6)

  9. admin says:

    Ah, good catch. OK. that should be fixed now if you refresh the page.

  10. J. Peterson says:

    Another minor issue: probably a good idea to turn off spell checking in the source code window. On Chrome/Win10 it’s flagging “vPos.x” with a red “spelling error” underline when I make other edits on that line of text. It may leave the uninitiated concerned about “fixing” code that’s not broken.

    https://stackoverflow.com/questions/4524000/

    (Now, it’d be really cool if you got the red underline if the variable/keyword was indeed undefined, a-la Visual Studio…but that’s probably beyond the scope of what you’re trying to do).

  11. Al says:

    Sorry for the delay in responding – didn’t get a chance to get near a computer over the weekend.

    It certainly has stopped the ‘bouncing around’ I was seeing earlier though the arrow pointing to the error is still not in the correct location.

    https://screenshots.firefox.com/e2JjpCNPlEOVjIcD/mrl.nyu.edu

  12. admin says:

    Unfortunately there are limitations to my ability to query your browser at runtime to figure out exactly what platform you are running on. In Firefox on my MacBook the arrow is now in the right place. To get this working for you, I would have to find some way to figure out not only that you are running Firefox, but also that you are also on Windows 7. At some point, trying to compensate for the same browser doing different things on different computers becomes an exercise in rabbit chasing. I am glad to hear it runs properly for you in IE.

Leave a Reply