Tag: javascript

A SCORM-Ready Template: Part 4B. Qualtrics Quizzes : End of Survey Message

Create an “End of Survey” message

We’ll start at the end first: in order to communicate with the learning module, your Qualtrics quizzes will all need to reference a custom End of Survey message, which will be located in your Qualtrics message library.

Continue reading

Associative Arrays

If you’ve used javascript much, you are probably familiar with arrays. Typically arrays are used to manage lists of items. I frequently use arrays for maintaining information about the state of pages and quiz questions in learning modules, storing a series of properties for each item.

But, there is a problem. To find the particular item you want to use, you must loop through the whole array. Sometimes you can get yourself into a situation requiring multiple loops to get one item of information and performance will suffer.

I recently got to wondering if there weren’t a way to jump straight to the desired item, if the ID of the item were known. Yes there is!

Enter “associative arrays“. Associative arrays allow you to index items by any string key, not just the usual arbitrary index numbers. So you can go straight to the exact item by name without testing for property matches while looping through the array.

Continue reading

Caching in Google Gadgets

When creating a Google gadget that pulls data from an XML file, you will probably notice that the data doesn’t update right away in the gadget even after you have changed the file. This caching behavior can make it very difficult to troubleshoot, and you’ll probably want to shut it off while developing.
It took me a while to find this so I’m posting it here:

From Google’s “Refreshing the Cache” instructions:


To make sure your gadget fetches fresh new content at least once per interval, simply specify a value (measured in seconds) for the refreshInterval parameter. For example:
// Fetch fresh content every half hour
_IG_FetchContent("http://news.google.com/?output=rss", callback, { refreshInterval: (60 * 30) });

// Fetch fresh content every 10 minutes
_IG_FetchContent("http://news.google.com/?output=rss", callback, { refreshInterval: (60 * 10) });

// Fetch fresh content every 30 seconds
_IG_FetchContent("http://news.google.com/?output=rss", callback, { refreshInterval: 30 });

// Disable caching completely and fetch fresh content every time --  !! Try to avoid using this !!
_IG_FetchContent("http://news.google.com/?output=rss", callback, { refreshInterval: 0 });

function callback(response) { ... } 


Continue reading

Changing the window scope in Firebug

If I had to choose one piece of advice for new web developers, I’d tell them to learn to use Firebug. Firebug is probably the most valuable debugging tool available, but if you are just getting started, it may seem pretty opaque at first.

In addition, some things do not appear to work as advertised. In particular, the “cd” function does nothing as far as I can tell.

The page that documents the commands you can use within Firebug lists the cd command as a way of changing the window scope:

Picture 23.png

Continue reading