Folks,
I’m getting some reports that when you click “run” in the slides the embedded Ruby doesn’t work on some systems.
This feedback is very helpful. Thank you. For those of you who are having problems, I may hijack your laptop if you have it with you to observe what is happening.
At the very end of this post, a word or two on why you shouldn’t worry too much if the embedded Ruby isn’t working for you…
You may have noticed that some code fails when the irb checkbox is checked. This is because irb-style evaluation proceeds line-by-line, and if there is a statement or expression that works over multiple lines (example: do/end) then you don’t get any intermediate output, and the embedded irb gets confused. But I’ve added some code so that in most cases the checkbox will initially be set correctly.
How to reset JRuby if embedded scripts aren’t running:
1. First off, remember: for now, Firefox only.
2. At times, JRuby has to be re-loaded. To do this, go to the URL and delete the pound sign and everything following. In other words, if your URL says:
http://e168f07.7fff.com/private/lectures/E168-02.html#(36)
Change it to:
http://e168f07.7fff.com/private/lectures/E168-02.html
2. Press return
4. Then re-load by pressing control-R or by clicking the re-load button.
5. Then wait a bit before clicking for the next slide; JRuby is loading. Maybe 10 seconds. In theory, you shouldn’t have to wait, but there may be some subtle timing issues: I’m loading JRuby in a separate thread (or at least using JavaScript’s setTimeout feature).
6. Now click to the next slide. When you get to the first code example, trying clicking run.
7. If THAT isn’t working, let me know.
Two more things:
1. If you click “run” or click inside the textarea that holds the Ruby, you will have to click outside the Ruby code (i.e., on the slide) so that clicks go to the slide, rather than to the textarea. HTML Slidy (the framework I’m using to write the slides) has a yucky event structure and I have to intercept the events. It’s not worth going into, but you may find that advancing the slides is not working the way you want because the Ruby textarea is “owning” the vents.
2. And, finally, remember: You can always cut-and-paste examples right into irb! The examples are supposed to be illustrative. My hope in putting all of these together was that it would be illustrative in the pedagogical setting of the lectures and section: Having the Ruby run in your browser is a bonus: Great if it works, but there’s a clear work-around, and possibly one that will provide more learning: Try code in irb.
Recent Comments