Generative Design Variations M.6.2.2 Asynchronous loading of an XML text

This is the second and last theoretical exercise about the chapter ‘Data from the Internet.’ Here is again a brief description of the Generative Design book: ‘Loading a file, especially from the Internet usually takes much more time than the duration of a frame. However, when the XML is loaded while the program is running, program execution is interrupted constantly during that time. This is especially annoying when something is supposed to move continually on the display. In order to avoid this, a function is included in the Generative Design library with which the XML can be loaded asynchronously (ie without interrupting the program flow)’. So far the summary of this exercise. And here is the original program.

Basically, this exercise is not much different from the previous one. You download XML data from Wikipedia’s Superegg page. The XML text is displayed in the Processing Console. The difference is that during that download procedure Processing is running an animation. In addition to that, the draw block must constantly check whether the download process has already started and finished. If all the XML is downloaded, Processing displays a text in the console that the XML text is available.

If I run the program (M_6_2_02) it shows that it is not working. Nothing is displayed in the Processing console. Although the animation is running in Processing’s display window. When I’m clicking in the display window I get a comment in the console which says: “XML not loaded yet. Plus a remark [Fatal Error]: 1: 1: Premature end of file. So I suspect that this is the same mistake as in the previous program (M_6_2_01). And it is! The URL in the program begins with http://. The correct URL begins with https://. When I change that, the program works fine. First it begins with the animation. After the display window is clicked, the XML text is displayed in the console.

That‘s basically all there is to say about this exercise. I‘ve considered for a moment making a number of animations that are more complex than the one which is generated by this program. But that‘s a bit crap because the next exercise does just that. So it’s better to make variations on that exercise. I understand the principle behind this one so I leave it for what it is and I am going to concentrate on the next exercise.


Comments? Leave a reply.

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s