Closed joebo closed 2 years ago
The approach worked largely as expected (not saying it's the best approach).
There were two modifications to the code:
The html2 folder was populated as follows
# copy the html assets into html2
cp -r jfe/lib ../../../bin/html2/
# copy the wasm engine assets into html2
cp ../html/emj.* .
Some of the codemirror stuff were broken symbolic links and not files so I fixed most of them with this:
cp ./j807/addons/net/websocket/demo3/codemirror/* ../bin/html2/codemirror/
Additional broken dependencies are noted in the issue text (j.js and matchbrackets.js)
Great!. Pulling your edits, it works, but carriage return is missing after a line is run. I am trying to see where now.
I don't see the missing carriage return. Can you give an example?
On Thu, Apr 7, 2022 at 5:42 AM Jon Hough @.***> wrote:
Great!. Pulling your edits, it works, but carriage return is missing after a line is run. I am trying to see where now.
— Reply to this email directly, view it on GitHub https://github.com/jsoftware/j-playground/issues/19#issuecomment-1091687517, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMDJAMNFMVOXCS3NM4D6DDVD3J3ZANCNFSM5SX4VYOQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>
In the modified websocket.js
send: function(cmd) {
//console.log(cmd);
var ret = jdo1(cmd);
//tcmreturn slices the first character off
tcmreturn(' ' + ret);
}
example
]a=: i.5
0 1 2 3 4a
Solution is
tcmreturn(' ' + ret + '\n');
This is an odd issue. In Term
a=: i.5
a
0 1 2 3 4
b
|value error: b
b=: 1
|value error: b
b
1
b
1
a=: i.5
1
2 issues that I can see. Even after defining "b", the value error is shown. After redefining "a", the previous result is shown.
Perhaps we need to flush the jengine?
It seems to be cleared up by doing (the horrible hack)
let ret = jdo1(cmd);
//tcmreturn slices the first character off
tcmreturn(' ' + ret + '\n');
jdo1("''");
i.e. flushing jengine with empty jdo1
. But obviously that doesn't answer why it is happening.
websocket was used in 2018 J Playground because javascript frontend needed to interface with native code J engine. If both web ui frontend and wasm J engine are javascript, then I think the websocket middle-ware is redundant.
Yes, but the functions have been modified to call the wasm jengine. Filename is still websockets.js so it will cause confusion. I think it is only intended for proof of concept testing, for now.
Are you using the old codemirror or have upgraded to a newer version?
On Thu, Apr 7, 2022 at 7:32 AM Jon Hough @.***> wrote:
Yes, but the functions have been modified to call the wasm jengine. Filename is still websockets.js so it will cause confusion.
Message ID: @.***>
Are you using the old codemirror or have upgraded to a newer version?
old codemirror for now. This initial rough port was just to prove it could be integrated with the wasm engine with minimal changes to original j playground code. That's why websockets.ijs was modified instead of hacking into the rest of the jplayground code. We'll rework that as this matures
On my machine:
a=: i.5 a 0 1 2 3 4 b |value error: b b=: 1 b 1
On Thu, Apr 7, 2022 at 6:18 AM Jon Hough @.***> wrote:
This is an odd issue. In Term
a=: i.5
a 0 1 2 3 4 b |value error: b b=: 1 |value error: b b 1 b 1 a=: i.5 1
2 issues that I can see. Even after defining "b", the value error is shown. After redefining "a", the previous result is shown.
— Reply to this email directly, view it on GitHub https://github.com/jsoftware/j-playground/issues/19#issuecomment-1091727009, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMDJAKNFFEBVEQBZ27NU6TVD3ODFANCNFSM5SX4VYOQ . You are receiving this because you commented.Message ID: @.***>
Ah, symlinks! Sorry about that, I symlink all the time and just forget about it.
I have updated the play.zip file on google drive with the symlinks resolved.
On Thu, Apr 7, 2022 at 4:41 AM joebo @.***> wrote:
The approach worked largely as expected (not saying it's the best approach).
There were two modifications to the code:
- Catch websocket calls and redirect to WASM engine: https://github.com/jsoftware/j-playground/blob/j903_wasm/bin/html2/websocket.js#L17
- include emj.js in index.html https://github.com/jsoftware/j-playground/blob/j903_wasm/bin/html2/index.html#L6
The html2 folder was populated as follows
copy the html assets into html2
cp -r jfe/lib ../../../bin/html2/
copy the wasm engine assets into html2
cp ../html/emj.* .
Some of the codemirror stuff were broken symbolic links and not files so I fixed most of them with this:
cp ./j807/addons/net/websocket/demo3/codemirror/* ../bin/html2/codemirror/
Additional broken dependencies are noted in the issue text (j.js and matchbrackets.js)
— Reply to this email directly, view it on GitHub https://github.com/jsoftware/j-playground/issues/19#issuecomment-1091632222, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMDJAOTQSSA2F6SHZGUUCTVD3CV7ANCNFSM5SX4VYOQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Chris Burke shared the 2018 J Playground code that runs https://code2.jsoftware.com/play.html . The 2018 J Playground has nicer aesthetics and functionality that would be a large step forward from the current implementation.
It should be possible to port this code to use the WASM engine instead of calling out to J on the server.
Upon review, the smallest possible change to make this work seems to be:
Conceptual example:
Instead of:
To:
Where jdo1 is defined at: https://github.com/jsoftware/j-playground/blob/j903_wasm/bin/html/app.js#L4 or could be easily redefined to a cleaner name (I can't remember why there is the "1" suffix)
Activities:
[x] Review code and come up with an idea of how to integrate (above)
[x] Confirm that 2018 J Playground can be built / run locally
[x] Check 2018 J Playground into bin/jplayground (or something like that)
[x] Modify websocket.js per above to try approach
[x] Publish 2018 J Playground through github pages as an alternative to the current implementation of J Playground https://jsoftware.github.io/j-playground/bin/html2/
[x] Fix plot addon
[x] Ask Chris for missing files
/home/chris/dev/apps/js/js/codemirror_jmode/j.js /home/chris/dev/apps/js/js/codemirror/addon/edit/matchbrackets.js
[ ] More rigorous testing
[ ] Use/adapt build script to consolidate .js files