Jeremy

Forum Replies Created

Viewing 15 posts - 1,396 through 1,410 (of 1,522 total)
  • Author
    Posts
  • in reply to: .zip file problems #4944
    Jeremy
    Keymaster

    I don’t have other recommendations, AWS is actually a decent choice because it is widely used, which increases the likelihood to see features being implemented and support on problems you might encounter

    I have updated the dev-elise branch to fix the error you were seeing, feel free to sync again and see whether the original error disappeared

    Also, I did find that S3 buckets do seem to have limits on the number of requests they can handle, but the numbers are quite high:

    Your applications can easily achieve thousands of transactions per second in request performance when uploading and retrieving storage from Amazon S3. Amazon S3 automatically scales to high request rates. For example, your application can achieve at least 3,500 PUT/COPY/POST/DELETE or 5,500 GET/HEAD requests per second per prefix in a bucket. There are no limits to the number of prefixes in a bucket. You can increase your read or write performance by parallelizing reads. For example, if you create 10 prefixes in an Amazon S3 bucket to parallelize reads, you could scale your read performance to 55,000 read requests per second.

    https://docs.aws.amazon.com/AmazonS3/latest/dev/optimizing-performance.html

    So I’m not sure how it could have happened, but if you’re the only one experiencing this problem and it happens across browsers, chances are that your IP has been flagged on aws, or something like that…

    Jeremy

    in reply to: .zip file problems #4942
    Jeremy
    Keymaster

    Ah, I made a mistake and PennController didn’t compile correctly, that’s why you see this error message–my bad

    Maybe you made too many requests to your S3 bucket so that your new requests are somehow being blocked. But are you saying that you see the same problem on Firefox that you saw on Opera?

    Jeremy

    in reply to: .zip file problems #4940
    Jeremy
    Keymaster

    I see, I didn’t realize there were issues specific to Opera with PennController

    If you’d like to give it a try, you could update your version of PennController (following the instructions on the documentation) using the branch dev-elise (you can always go back to 1.7 using the branch 1.7)—I updated a suspicious bit of code (based on the messages your console reported) hopefully that should fix the issue

    Jeremy

    in reply to: .zip file problems #4938
    Jeremy
    Keymaster

    I’m pretty sure it’s not related to preloading the images per se (or only indirectly) as the error messages you get suggest that the script sometimes fails to build your page’s structure

    After reloading your experiment a few times, it did fail to preload the image 1.png on occasion—I think that what happens is that when your S3 bucket receives several requests for the ZIP file from the same address within a short delay, it can put those requests on hold to prevent too much traffic, and the default preloading time is not long enough for the zip files to be downloaded when those delays happen (I see you’ve been playing around with CheckPreloaded though, that’s probably a good idea since you can make the max preloading time longer)

    But again, when that happens, the trial loads fine in my browser, I just can’t see one of the two pictures, but I can still see the other one and I can press F or J to validate the trial. What browser do you use? Could it be Safari by any chance?

    Jeremy

    in reply to: .zip file problems #4935
    Jeremy
    Keymaster

    Hi,

    Did you make sure to properly configure the CORS settings with this new link? You need both a direct link to your file, and CORS access authorization to allow your participants’ browser to download the zip file automatically in the background

    Also, do you really to need to convert the files from wav to mp4 when you upload them to the farm? I thought it was coded so that it would serve wav files normally, but I’ll look into that

    I agree with you, it’s both cumbersome to upload individual audio files to the farm and it can also quickly use much of your allocated space—I’m working on a better installment of it though where you’ll be able to drag-n-drop multiple files at once, or even entire folders

    Jeremy

    in reply to: .zip file problems #4932
    Jeremy
    Keymaster

    Hi Elise,

    I’m not able to reproduce the bug on my end, but I think I know where the problem is coming from. Try replacing the replacePreloadingText function with this:

    let replacePreloadingText = ()=>{
        let mainPs = $(".PennController-PennController div p");
        if (mainPs.length == 2 && mainPs[0].innerHTML == "Please wait while the resources are preloading")
            mainPs.parent().empty().append('

    Laden...

    ') else window.requestAnimationFrame( replacePreloadingText ); }; window.requestAnimationFrame( replacePreloadingText );

    And create a file named global_z.css in your Aesthetics folder to define your nice preloading loop animation:

    .loader {
        border: 16px solid #f3f3f3;
        border-radius: 50%;
        border-top: 16px solid cadetblue;
        width: 120px;height: 120px;
        -webkit-animation: spin 2s linear infinite; /* Safari */
        animation: spin 2s linear infinite;
    }
    @-webkit-keyframes spin {
        0% { 
            -webkit-transform: rotate(0deg); 
            
        }100% { 
            -webkit-transform: rotate(360deg); 
            
        }
    }
    @keyframes spin {
        0% { 
            transform: rotate(0deg); 
        }
        100% { 
            transform: rotate(360deg); 
        }
    }

    Hopefully that should fix the HTML structure of your document and PennController should no longer fail to set the style of its DOM element

    Let me know if that fixed your problem

    Jeremy

    in reply to: .zip file problems #4927
    Jeremy
    Keymaster

    Hi,
    I have a similar problem going on. I don’t think my experiment was able to access the zip file properly. I followed the instructions in the documentation and uploaded a zip folder containing audio files(.WAV) to a school server along with the .htaccess, which the IT department said should work, but now I’m not really sure what’s going on. The debugger didn’t mention any type of error occurring as it was running the experiment.

    The link to my zip file is https://mfile.umich.edu/?path=/afs/umich.edu/user/t/j/tjuan/Public/Spanish%20Pupillometry%20Project%20Resources/Audio_Files.zip

    It appears that this URL is not a direct link to the zip file: you need to login onto the UMichigan portal before you can access the file. Not sure what the IT department told you, but this link clearly won’t work with PCIbex (or anything else for the matter, since access is password-protected). In addition to the CORS setup, you want to make sure you have a link that directly gives you the zip file when you use it in a new, private navigation session in your browser.

    Jeremy

    in reply to: .zip file problems #4923
    Jeremy
    Keymaster

    Hi Elise,

    What 404 error exactly are you referring to? The experiment at the link you gave works quite well for me: the zip file gets downloaded (as visible in the Logs tab of the Debugger: [15:17:19] Download of https://chaipictures.s3.eu-central-1.amazonaws.com/Pictures.zip complete (PennController: 31)) and the resources get preloaded normally.

    The Errors tab does report a few errors, but they have to do with your Template commands referencing tables named “Practice_N” (with N a number from 2 to 6) when the only tables you have in your experiment come from the files “Materials_fillers_Questions.csv,” “Materials_DO_Questions.csv,” “Materials_fillers_Pictures.csv,” “Materials.csv,” “Materials_DO_Pictures.csv”, and “Practice_1.csv” (the debugger suggests that you reference that file instead).

    It’s true that I do get a 404 error in the web console for https://expt.pcibex.net/ibexexps/Potsdam-experiments/Chai/1.jpg, but that’s because PennController always also looks for each resource file locally (ie. at the experiment’s URL) even if you use a ZIP file (or the AddHost command) and then uses the first file that is successfully resolved by one of the requests (local, zip, distant host).

    Best,
    Jeremy

    in reply to: Upload audio samples to the server #4920
    Jeremy
    Keymaster

    Hi,

    Several people have reported having trouble uploading audio samples to their server, and unfortunately there’s no one-size-fits-all solution, everyone’s server configuration is different.

    However, most often the problem comes from failed attempts at cross-domain requests, and the error code that you report (0) is consistent with that. So here are a couple questions:

    • Is your experiment hosted on the PCIbex Farm? Line 6 of the PHP script on the documentation page assumes that the samples are coming from https://expt.pcibex.net/
    • Are you sending the sample to a secure domain? The PCIbex Farm is at a secure domain (https) and the server where you send your audio samples also need to have secure credentials
    • Someone had a problem when uploading large files: their PHP configuration would only allow uploads of up to 10MB or 100MB, and archives of several long audio samples get large very quickly

    I can’t think of anything else at the moment, but feel free to share your experiment’s link with me so I can troubleshoot more eaisly

    Jeremy

    in reply to: mathematical operations with variables #4918
    Jeremy
    Keymaster

    Hi Cindy,

    I have to admit that the way that Var elements work can be very confusing, and I have struggled a lot about how to best implement them when designing PennController: the current state is my best attempt at making them user-friendly, so I guess it is complicated indeed… (or maybe I’m just very bad at making things simple)

    At some point (and you’ve reached that point here) it becomes important to understand how PennController commands are evaluated: the new* commands that create in-trial elements are actually evaluated when you open your experiment (ie. your experiment always starts by referencing all the elements of all your trials), but the commands that you call on the elements (print, wait, …) are evaluated upon runtime. Now, that delayed evaluation is also what makes it possible to use getVar('name') with the expectation that it will return the value at the time when the command is evaluated. However, if you try to use getVar('name') anywhere else, like inside a new* command, it will return something completely different (something that “represents the need to evaluate later,” if you will, but not the value itself)

    TL;DR: you cannot refer to getVar inside the parentheses of your newVar commands (or any new* command for the matter). Here is a very minimal change to the bit of code you report that should do the trick (notice the two-step subtraction method):

    newVar('a_set').set( getVar('a_items_selected') ).set( v => row.a_maximum_items-v >= 0 ),
    newVar('b_set').set( getVar('b_items_selected') ).set( v => row.b_maximum_items-v >= 0 )
         .test.is(true).and( getVar('a_set').test.is(true) )

    Here is a full example of a script that uses a slightly different method, hopefully it will give you an idea of how things work (I’m using uppercase and lowecase letters as ‘items’). It’s maybe a bit too sophisticated in some sense, but I think it’s a good illustration of how Var elements work:

    PennController.ResetPrefix(null)
    
    AddTable('mytable', `U1,U2,U3,U4,l1,l2,l3,l4,max_U,max_l
    A,B,C,D,a,b,c,d,2,3
    E,F,G,H,e,f,g,h,3,1`)
    
    // We'll call this function to create three Var, Selector and Text elements for all 8 items in a trial
    add_item = (row,item) => [
        newVar(item, false)             // The element is unselected at the beginning of the trial (=false)
        ,
        newSelector(item).callback(     // When the element is clicked, proceed conditionally
            getText('error').remove() 
            , 
            // Note: item[0] below returns the first character of item, which is either U or l
            getVar(item).test.is(false) // Flag as true and increment U/l_selected if was unselected
                .success( getVar(item).set(true) , getVar(item[0]+'_selected').set(v=>v+1) )
                .failure(               // If was selected, unselect, flag as false and decrement U/l_selected
                    getSelector(item).unselect()
                    ,
                    getVar(item).set(false)
                    ,
                    getVar(item[0]+'_selected').set(v=>v-1)
                )
        )
        ,
        // Don't forget to print text element onto the page and add it to the selector
        newText(row[item]).selector( item )
    ]
    
    
    Template( 'mytable' , row=>
        newTrial(
            newText("error", 'You can only select up to '+row.max_U+' uppercase letters and up to '+row.max_l+' lowercase letters!' )
            ,
            defaultText.center().print()
            ,
            // These will keep track of how many items are selected in each category
            newVar('U_selected',0),newVar('l_selected',0)
            ,
            // We use the helper function here to execute the commands defined above on all 8 items
            add_item(row,'U1'),add_item(row,'U2'),add_item(row,'U3'),add_item(row,'U4'),
            add_item(row,'l1'),add_item(row,'l2'),add_item(row,'l3'),add_item(row,'l4')
            ,
            newButton("Validate").center().print().wait(
                // Wait will be validated only if U_selected and l_selected are below or at max_U and max_l
                // NOTE: the forum adds a space between < and = which should NOT be here
                getVar('U_selected').test.is( v => v <= row.max_U )
                    .and( getVar('l_selected').test.is( v => v <= row.max_l ) )
                    .failure( getText("error").print() )
            )
        )
    )

    Let me know if you have any questions,

    Jeremy

    in reply to: Display of error / warnings in another language #4916
    Jeremy
    Keymaster

    Hello,

    If you are using the Form controller, you can use the obligatoryErrorGenerator, obligatoryCheckboxErrorGenerator and obligatoryRadioErrorGenerator parameters to return custom error messages (see the Ibex documentation). I think you can find an example of how to use it in the script of newly created experiments on the original Ibex Farm.

    If you are using the PennController element Html, you can use the commands checkboxWarning, inputWarning and radioWarning.

    Best,
    Jeremy

    in reply to: .test(var) not working #4901
    Jeremy
    Keymaster

    Glad that fixed the issue

    Just a note that the following works just fine (using PennController 1.7) so maybe the problem was due to some other interaction?

    AddTable("testTable", `Naming_Order,A_set_image,B_set_image
    AB,boyTalking.png,girlTalking.png
    BA,boyTalking.png,girlTalking.png`)
    
    Template("testTable", row=>
        newTrial(
            newVar('left_word',""),
            newVar('right_word',""),
            newVar('name_order', row.Naming_Order),
            getVar('name_order')
                .test.is('AB')
                .success(
                    getVar('left_word')
                        .set(row.A_set_image),
                    getVar('right_word')
                        .set(row.B_set_image)
                    )
                .failure(
                    getVar('left_word')
                        .set(row.B_set_image),
                    getVar('right_word')
                        .set(row.A_set_image)
                    )
            ,
            newText().text( getVar("left_word") ).print(),
            newText().text( getVar("right_word") ).print()
            ,
            newButton("next").print().wait()
        )
    )
    in reply to: .test(var) not working #4899
    Jeremy
    Keymaster

    Hi Cindy,

    How and where do you access the left_word and right_word Var elements? If you need to access them in a different trial than they are set, you need to make them global.

    Also, are you sure that there’s no standing space character before or after AB in your cell values?

    If you’re only using the name_order Var element to conditionally set the left_word and right_word ones, there’s a simple javascript way of doing it:

    newVar('left_word',(row.Naming_Order == 'AB' ? row.A_set_image : row.B_set_image)),
    newVar('right_word',(row.Naming_Order == 'AB' ? row.B_set_image : row.A_set_image)),
    in reply to: Choosing subet of items to present #4892
    Jeremy
    Keymaster

    Hi Maddie

    1. I can see a couple ways to do this, but you’ll need some plain javascript anyway. Here’s a suggestion, assuming you have an Item column in your table that goes from 0 to, say, 100 for your filler items:

    numberRows = 100;
    numberDraws = 50;
    randomIDs = [...new Array(numberRows)].map((v,i)=>i).sort(v=>Math.random()>0.5).splice(0,numberDraws);
    
    Template( defaultTable.filter( r => r.type=="filler" && randomIDs.indexOf(Number(r.Item))>-1 ),
      variable => newTrial(
        // ...
    

    2. I think what you are looking for is anyOf, you can use it like this: Sequence( "intro" , randomize(anyOf("experiment","filler")) )

    in reply to: DashedSentence in a PennController trial #4889
    Jeremy
    Keymaster

    Hi Daniela,

    The Controller element, as such, is supposed to go inside a trial created with newTrial (previously PennController). In your script, you are trying to use it like a regular native-Ibex definition, which won’t work because your newController commands appear outside newTrial/PennController. If you want to use the old Ibex definition, just build on Option 1 in my first message. If you want to use the Controller element, build on the example I gave in my Edit instead.

    Also, I’m not sure what you’re trying to do with your arrays of variable. in the s parameter: what should happen to all those values?

Viewing 15 posts - 1,396 through 1,410 (of 1,522 total)