Tips for debugging PIP on PI

Is current?: 
Yes

Tips for debugging PIP on PI

When using the showfiles.jsp (e.g., like this), use the "Check js syntax" link to find syntax errors in your script. Often, this will help you clean your script and find why it doesn't run properly. 

It is also recommended to open the browser's developer tools (F12 in Chrome and Firefox). The Console will sometimes print error and warning messages that could give you a clue what doesn't work, and the Network tab might give you clues about why your data are not saved properly. In Chrome's Console, it is recommended to open the right click menu and select "Preserve log upon navigation" so that you could still see the printings from the previous page, even when you continue to the next task (page). In Firefox's Developer tools, you can click on the setting button and select "Enable persistent logs".

 

Debugging a study involves modifying the file and testing whether the modification fixed the problem. Sometimes, a fix does not seem to work only because the browser does not show you the most recent file. This happens especially when you update images. The reason for this is that all browsers try to save time by not downloading the same file twice. If the browser knows that it already downloaded a file from the server, it does not always ask the server for the file again; it simply shows you the file it downloaded last time.

Obviously, while caching is great for saving time when surfing the web, it is a problem when you are constantly changing the file because you are trying to fix a problem.

What to do? First, try to make sure that indeed that is your problem. For instance, make a simple change that you can see right away (e.g., overwrite the file on the server with another file with the same name; or change a few words in the instructions at the beginnig of the task). Second, empty the cache. If you don't know how, Google it (.e.g. "How to empty cache Chrome"). Another method, instead of clearing the cache, is to open a window that does not read from the cache. In Chrome, that is incognito mode (ctrl-shift-n). In Firefox, that is private window (ctrl-shfit-p). 

 

 

When creating trials, it might be easier to create a test.js script with only the script for creating and running that one trial, with simple media and stimulus objects. First, make sure that the trial flow works as you want it to work, then add your stimuli and see that they are displayed the way you want them to be displayed. Last, deal with the sequence and inheritance issues.

If the data are not saved, make sure that:

(1) You used the 'log' action

(2) Each of your trials has the properties 'score', 'block', and 'condition' in its data object.

(3) You set the logger correctly (e.g., like in the stroop example).

(4) You don't log more than once in a trial. PIP can handle multi logs per trial, but Project Implicit's database currently accepts only one row per trial.

 

You can also try to understand what the problem is by looking at the developer tools window (see instructions above how to open it). Look at the Network view to see what is sent by the player to PI, and also to see the response from PI's server. A "200 OK" response means that the data was accepted fine by PI's server and was probably saved ok. When there is a problem with the data, you will usually see red messages and could try to understand what the reason is. Look at the data sent and at the response, and you might understand better what's going on.