Open jo-pol opened 4 years ago
Same happens when I save a local copy of https://mlweb.loria.fr/lalolab/lalolib.html
and add the two lines to function ex1 ()
First, note that Lalolab performs all computations in a separate web worker. You can do that in a stand-alone page by create a "Lab", see : https://mlweb.loria.fr/lalolab/lalolib.html#safer . Otherwise, if it takes more than a few seconds a browser usually blocks the script. However, it seems that I observe the same issue even in lalolab so far.
The weird thing is that it hardly takes any time when tried on https://mlweb.loria.fr/lalolab/index.html So what is the essential difference with the "safer" example?
Tried again with example 2 and 3 but now I get
Security Error: Content at file:///XXX.html may not load data from http://mlweb.loria.fr/lalolibworker.js.
Tried to tweak the following code with a local copy of both .js
files but I'm too unfamiliar with these things to succeed.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>test</title>
<script type="application/x-javascript" src="http://mlweb.loria.fr/lalolib.js "></script>
</head>
<body>
<script>
var lab = new Lalolab() ; // open a standard Lab
// define a variable in the current scope
var A = [[0,0,0,0,0,0,0,1,0,0,0,0,1,-1,0,-1,0,-1,0,0],[0,0,0,0,0,0,1,-1,0,0,-1,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,-1],[0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,-1,1,0,0],[0,0,1,0,0,0,0,0,1,-1,0,0,-1,0,0,0,0,0,0,0],[1,0,0,0,1,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,1,0,0,0,1,1,-1,0,0,0,0,0,0,-1,0],[0,-1,0,0,0,0,0,0,0,0,0,1,0,0,-1,1,0,0,0,0],[0,0,-1,1,-1,0,-1,0,0,0,0,0,0,0,1,0,0,0,0,0],[-1,1,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,1,0,0,1],[0,0,0,0,0,0,0,0,0,1,0,0,-1,-1,0,0,0,0,1,0],[0,0,1,0,0,0,-1,-1,0,0,0,0,1,0,0,0,0,0,0,0],[0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,-1,-1],[0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,-1,-1,0,1],[1,0,0,0,0,1,0,0,-1,-1,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,-1,-1,1,0,0,0,1,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,1,0,0,-1,-1,0,0,0,1,0,0,0,0],[0,0,0,1,0,0,0,0,0,0,0,0,0,0,-1,-1,0,1,0,0],[0,0,-1,-1,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0],[-1,-1,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0]];
lab.load(A, "A", function (result) { // load the variable in the lab
res3.innerHTML = "The matrix A = " + laloprint(result,true) + " has been loaded in the lab.<br>";
});
lab.do("n = nullspace(array2mat(data))"); // do some computation in the background
lab.getObject("n", function ( result ) { // recover the value of a variable from the lab
res3.innerHTML += "The nullspace of A is stored in the lab variable n which equals " + result;
}); </script>
</body>
</html>
If you use a local copy, you need to execute chrome wth additional flags so that it allows other js files. Look at the "chromelab" executable in lalolab folder for the precise flag.
Fabien.
De: "Jo Pol" notifications@github.com À: "lauerfab/MLweb" MLweb@noreply.github.com Cc: "moi" fabien.lauer@loria.fr, "Comment" comment@noreply.github.com Envoyé: Mercredi 23 Septembre 2020 20:46:47 Objet: Re: [lauerfab/MLweb] infinite nullspace on standalone page (#12)
Tried again with example 2 and 3 but now I get Security Error: Content at file:///XXX.html may not load data from http://mlweb.loria.fr/lalolibworker.js.
Tried to tweak the following code with a local copy of both .js files but I'm too unfamiliar with these things to succeed. <!DOCTYPE html > < html lang =" en " > < head > < meta charset =" UTF-8 " > < title > test </ title > < script type =" application/x-javascript " src =" http://mlweb.loria.fr/lalolib.js " > </ script > </ head > < body > < script > var lab = new Lalolab ( ) ; // open a standard Lab // define a variable in the current scope var A = [ [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 1 , - 1 , 0 , - 1 , 0 , - 1 , 0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, 0 , - 1 , - 1 ] , [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , - 1 , - 1 , 0 , 1 ] , [ 1 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , - 1 , - 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] , [ 0 , 0 , 0 , 0 , - 1 , - 1 , 1 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] , [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , - 1 , - 1 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 ] , [ 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 1 , - 1 , 0 , 1 , 0 , 0 ] , [ 0 , 0 , - 1 , - 1 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 ] , [ - 1 , - 1 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 ] ] ; lab . load ( A , "A" , function ( result ) { // load the variable in the lab res3 . innerHTML = "The matrix A = " + laloprint ( result , true ) + " has been loaded in the lab.
" ; } ) ; lab . do ( "n = nullspace(array2mat(data))" ) ; // do some computation in the background lab . getObject ( "n" , function ( result ) { // recover the value of a variable from the lab res3 . innerHTML += "The nullspace of A is stored in the lab variable n which equals " + result ; } ) ; </ script > </ body > </ html >— You are receiving this because you commented. Reply to this email directly, [ https://github.com/lauerfab/MLweb/issues/12#issuecomment-697871546 | view it on GitHub ] , or [ https://github.com/notifications/unsubscribe-auth/ADNPBCEVIB3OLBOPTEKJBTLSHI7BPANCNFSM4PIPHA7Q | unsubscribe ] .
I'd like to apply these scripts on a public website. I can't and should not ask from non-tech users to circumvent security measures against cross-site scripting that way.
Let me return to the original issue. I want to do a nullspace calculation client-side by JavaScript on a public web page. The calculation runs quickly on https://mlweb.loria.fr/lalolab/index.html but takes forever when tried in example-1 on https://mlweb.loria.fr/lalolab/lalolib.html
Tried it publicly with https://github.com/jo-pol/test-lalolib/blob/master/index.html published at https://jo-pol.github.io/test-lalolib/
Now I get
Security Error: Content at https://jo-pol.github.io/test-lalolib/ may not load data from http://mlweb.loria.fr/lalolibworker.js.
Could you please replace http
with https
where ever applicable?
I tried a nullspace calculation which seem to run forever in a standalone web-page. The same two JavaScript lines run quickly on https://mlweb.loria.fr/lalolab/index.html
I tried to import the script from the head section as shown below, tried also in the body, in both cases with and without the type attribute. Tried firefox and chrome. What am I missing?