why doesn't my openprocessing sketch run for my friends?

edited November 2014 in General Discussion

dear folks,

after posting a sketch on openprocessing (http://www.openprocessing.org/sketch/172851) and emailing my friends about it, a couple of them report that it doesn't run for them. it runs for me. what might be the problem? thanks in advance...

Answers

  • Java applets, for some time already, demands the user to whitelist sites in its plugin config! :-<
    In my case using OpenJDK in Linux, I wasn't able to whitelist OpenProcessing, b/c the applet itself resides in another domain! Therefore, only Oracle's Java plugin works there! :o3

  • edited November 2014

    Oops! It's already running under Processing.JS framework. X_X
    And since it's using a non-WebGL renderer, it shoulda been working even in old browsers! :-??

    Perhaps you should try http://studio.sketchpad.cc/ host site too:
    http://studio.processingtogether.com/sp/pad/export/ro.9NwgKBhS$Gxju/latest

  • new data: my sketch does not run in internet explorer. most other sketches on the site ran fine, but a couple didn't. otherwise, my sketch runs in firefox and chrome. what's different about running in internet explorer. and how can i tweak my sketch to get it to run in all browsers?

  • edited November 2014

    In relation to browser standards, IE has always been the rogue in the midst!
    When I program I don't mind whether my JS script's gonna work on IE! >:)
    Besides, due to the fact that IE is so entrenched in the Windows OS internals and the danger of its ActiveX,
    I have always stayed clear away from it even when I had Win98! [-X
    If you or your friends insist on taking the associated risks, at least make sure it's version 11 or more! :-@

  • my principal concern is that anyone with a browser can see my sketch, if that is doable.

  • edited November 2014

    here is my code:

    /*
     * undulating osculations
     * by  scott_me 
     * edited by GoToLoop
    
     circles are subject to two forces: an attraction to a neighbour,
     and a force perpendicular to that one.  however, because that 
     perpendicular force is defined with a sine function, some circles want
     to travel clockwise and some counter.
     */
    
    static final int NUM=1<<8,  //number of circle elements
                     IDX=NUM-1, 
                     DIAM=5;    //diameter of circles
    static final float RATE=0.2,    //rate of attraction between neighbour circles
                       P_RATE=0.2,   //rate of perpendicular force
                       LIMIT=5.0;   //preferred distance between neigbours
    
    final PVector places[]=new PVector[NUM];
    
    static final float[] perp=new float[NUM];
    static final color[] hues=new color[NUM];
    
    void setup() {
      size(600, 600, JAVA2D);
      smooth(8);
      noStroke();
    
      ellipseMode(CENTER);
      colorMode(HSB, NUM, 1, 1);
    
      for (int i=0; i<NUM; i++) {
        places[i]=new PVector(random(width), random(height)); //creates new circles
        perp[i]=sin(TWO_PI*i/NUM )*P_RATE;  //calculates perpendicular forces
        hues[i]=color((float) i, 1, 1);   //calculates colour of circles
      }
    }
    
    void draw() {
      background(20);
      PVector pos=places[0];
    
      for (int i=0; i<NUM; ) {
        display(hues[i], pos);
        move(perp[i], pos, pos=places[++i&IDX]);
      }
    }
    
    void keyTyped() {
      for (PVector p : places)
        p.set(random(width), random(height), 0);
    }
    
    void mousePressed() {
      if (mouseButton == LEFT)  keyTyped();
    }
    
    void display(color wheel, PVector place) {
      fill(wheel);
      ellipse(place.x, place.y, DIAM, DIAM);
    }
    
    void move(float right, PVector p, PVector n) {
      PVector v=new PVector();
      v.set(n);
      v.sub(p);  //v becomes vector separating a circle from its neighbour
    
      float len=v.mag();
      float adjust=(len-LIMIT)/len;
    
      v.mult(adjust*RATE);  //attraction to neighbour calculated
      p.add(v);  //attraction to neighbour is added to position
    
      v.normalize();
      p.add(v.y*right, -v.x*right, 0);  //perpendicular force is added to position
    
      p.x=constrain(p.x, DIAM, width-DIAM);  //  keeps circles  
      p.y=constrain(p.y, DIAM, height-DIAM);  //  within frame
    }
    
  • Answer ✓

    "my sketch does not run in internet explorer"
    You should be specific. IE11 is a beast far different from IE7, or even from IE9!

  • I had this issue, and I think it's likely to be in relation to p5.js rather than your code:

    1. IE8 and below are a bit archaic, not supporting several methods used in P5.js, e.g. 'bind'

    2. the console.log is supported weirdly in IE so that using the bind method on it throws an error (apparently in some versions of Safari as well) at line 4079 in p5.js: p5.prototype.print = console.log.bind(console). Info here.... Anyway, I gave up trying to find a general solution but as I don't need the console for this version, I just changed it to an empty function in P5. I.e. search for "console.log.bind" in P5, then replace that line with: function () {};

    3. the XMLHttpRequest can throw an error in some versions of IE if it is cross domain. In other words, you need to make sure that when you are referencing data you have it on the same site, and refer to it as e.g. "somefolder/mydata.csv" rather than "http://etc.com/somefolder.mydata.csv"

    There might be other stuff, but that's what it took to get mine working cross-browser mypolitics.org.uk/BESpanel2005-10/

    Good luck :)

Sign In or Register to comment.