Commit 433823d9 authored by Matevz Golob's avatar Matevz Golob Committed by Ivan Tyagov

Master

Added Business template to be used in tutorial and updated wendelin-standalone-bind.sh

/reviewed-on !33
parents 4d01c19f 6d911518
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no" />
<title>Ndarray Gadget</title>
<!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<!-- custom script -->
<script src="ndarray_bundle.js" type="text/javascript"></script>
<script src="gadget_ndarray.js" type="text/javascript"></script>
</head>
<body>
</body>
</html>
\ No newline at end of file
/*global window, rJS, nj */
/*jslint indent: 2, maxerr: 3 */
(function (window, rJS, nj) {
"use strict";
// parse dict in string in python pprint.pfromat
function parserPythonPformatDict(s) {
s = s
.replace(/False/g, "false")
.replace(/True/g, "true")
.replace(/\(/g, "[")
.replace(/\)/g, "]")
.replace(/, }/g, "}")
.replace(/\'/g, '"')
return JSON.parse(s);
}
// Initial idea from https://github.com/BillMills/numpychuck/blob/master/helpers.js
// https://github.com/numpy/numpy/blob/master/doc/neps/npy-format.rst#format-specification-version-10
function unpackNPY(dv) {
return new RSVP.Queue()
.push(function () {
var HEADER_LEN = dv.getUint16(8, true),
offset = HEADER_LEN + 10,
dataLength = dv.byteLength - offset,
i,
header_string = '',
char,
header_dict,
value_length,
getValue,
shape = [],
array = [],
value;
for (i = 10; i <= offset; i ++) {
char = String.fromCharCode(dv.getUint8(i, true));
header_string += char;
if (char == '}') {
break;
}
}
header_dict = parserPythonPformatDict(header_string);
return unpackArray(dv, header_dict, offset);
});
}
// Initial idea from https://github.com/BillMills/numpychuck/blob/master/helpers.js
// https://github.com/numpy/numpy/blob/master/doc/neps/npy-format.rst#format-specification-version-10
function unpackArray(dv, header_dict, offset) {
var i,
array = [];
if (offset === undefined) {
offset = 0;
}
return new RSVP.Queue()
.push(function () {
if ((header_dict.descr === "<i8")
& (header_dict.fortran_order == false)) {
for (i = 0; i < dv.byteLength - offset - 1; i += 8) {
array.push(dv.getUint8(i + offset, true))
}
} else if (header_dict.descr == "<f8"
& (header_dict.fortran_order == false)) {
for (i = 0; i < dv.byteLength - offset - 1; i += 8) {
array.push(dv.getFloat64(i + offset, true))
}
} else {
throw("Unsupported dtype: " + header_dict.descr +
" with fortran_order = " + header_dict.fortran_order);
}
return nj.ndarray(array, header_dict.shape);
});
}
rJS(window)
.ready(function (gadget) {
})
.declareMethod('unpackNPY', function () {
return unpackNPY(arguments[0]);
})
.declareMethod('unpackArray', function () {
return unpackArray(arguments[0], arguments[1]);
})
}(window, rJS, nj));
\ No newline at end of file
Includes gadgets used in the Wendelin tutorial.
\ No newline at end of file
web_page_module/rjs_gadget_ndarray_html
web_page_module/rjs_gadget_ndarray_js
web_page_module/rjs_ndarray_bundle_js
\ No newline at end of file
web_page_module/rjs_gadget_ndarray_html
web_page_module/rjs_gadget_ndarray_js
web_page_module/rjs_ndarray_bundle_js
\ No newline at end of file
web_page_module/rjs_gadget_ndarray_html
web_page_module/rjs_gadget_ndarray_js
web_page_module/rjs_ndarray_bundle_js
\ No newline at end of file
erp5_wendelin_tutorial
\ No newline at end of file
001
\ No newline at end of file
......@@ -3,7 +3,7 @@
# the way to use it is to wget it and then simply run it.
# it requires socat command
ZOPE_PIDS="$(slapos node | grep 'zope\|jupyter-lab' | awk '{print substr($0, 91, 5);}')"
ZOPE_PIDS="$(slapos node | grep 'zope\|jupyter-lab' | awk '{print substr($0, 92, 5);}')"
LOCAL_IPv4="$(/sbin/ifconfig ens3 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}')"
port=20000
......@@ -16,7 +16,7 @@ for pid in $ZOPE_PIDS;
echo $pid, $ip_port, $port
# socat
if [[ $ip_port == 2001* ]];
if [[ $ip_port == 2001* ]] || [[ $ip_port == fd46*]];
then
ipv6_ip=${ip_port:0:10}
ipv6_port=${ip_port:11:15}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment