104 karma · joined December 8, 2014
Maybe fine a better first example? It is quite code dense:
conv = c.aggregate({
"a": c.reduce(c.ReduceFuncs.Array, c.item("a")),
"a_sum": c.reduce(c.ReduceFuncs.Sum, c.item("a")),
"b": c.reduce(c.ReduceFuncs.ArrayDistinct, c.item("b")),
}).gen_converter()
conv(input_data)
when compared a trivial native python equivalent: conv = lambda data:{ 'a': [el['a'] for el in data ],
'a_sum' : sum( [el['a'] for el in data ]),
'b': list(set( [el['b'] for el in data ])), }
conv(input_data)
which appears to have the same functionality.
This is quite off putting and it took me a while to dig down to find why convtools can offer more than just an extra abstraction layer to learn.
Perhaps pick an example that shows off the non trivial functions like joins or GroupBy?[0] https://davidpartson024.github.io/no_host/encryptedPageMaker...
[1] https://www.reddit.com/r/programming/comments/47gjbv/experim...
[2] https://www.reddit.com/r/InternetIsBeautiful/comments/4o76gn...
How would I load in data that is stored on my harddrive (not web addressable) without having to run my own server or go through the file selector popup box each time. User JS can't just read the harddisk (a requirement for web security). If I have to run my own server then a major selling point of this is gone.
I work with large tabled data and very often use vectorised functions using numpy or pandas, working on entire columns with a fantastically simple interface. A = B * x, for arrays B, scalars x returning a new array A. Is there something as beautiful available, working around the lack of operator overloading in JS? I've only seen string abuse like p('A') = p('B*x'). Auh.
let a = {key: 'a'};
function foo( a ) {
a['otherKey'] = 'b';
}
foo( a );
console.log( a ); // {key: 'a',otherKey: 'b'}As you are allowing HTML entry, how are you protecting against Javascript inside user created pages?
Anyway, this is a great proof of tech.
A 100,000 data point file would be about 500kb transfered to the client. This is still a tiny amount of data to play around with in JS. It is possible to build an array of image tiles, and zoom around like google maps. But keeping the image tiles in memory could be worse than just replotting if the plot function is fast and optimized enough.
If you need 10000> points and interactivity you could try my own: http://generalsarsby.github.io/mjs_plot/
Assuming the usual sqrt(n+1) error on a count, as n is low. Combining the uncertainties from 83/66 [0] gives 1.258 +- 0.231 (1sd). It's only just likely that it is an actual improvement, but there is about a 30% chance that the orignal was better.
[0] (((1+66^0.5)/66)^2+((1+83^0.5)/83)^2)^0.5x83.0/66
EDIT
If we also include the errors on the total counts and use the fraction 83.0/66/6362x6392, then the error is:
(((1+66^0.5)/66)^2+((1+83^0.5)/83)^2+((1+6362^0.5)/6362)^2+((1+6392^0.5)/6392)^2)^0.5x83.0/66/6362x6392
which shows an improvement of 1.264+-0.234. Stastically nout.
https://www.reddit.com/r/programming/comments/47gjbv/experim...
You can rearrange the code to accept a context as the first argument if you are worried.
I'm more excited about Path2D[0] becoming adopted by more browsers.
See if you can use a regular quadTree if you can find a way to do it. It'll be faster than this.
I don't know about the _most_ efficient method. That is a field of research bigger than my weekend project.
Good luck.
However I think most people will look at the ideas involved and implement it in there own way as I've made a few assumptions about the structure of the objects being put in the tree.
http://xqt2.com/p/colours_sim_HUSL.html
You can toggle between normal HSL and HUSL. I find that the greens are too suppressed for my liking.
on pageload: var t = localStorage.getItem("textbackup"); if (t){ __editor.setValue(t); console.log('restoring from backup'); } else { __editor.setValue(document.getElementById('basic_intro').innerHTML); console.log('putting in the intro'); }
and on any action: var text = __editor.getValue(); localStorage.setItem('textbackup', text);
It's the approach I've taken in my version a playground for a different program. http://xqt2.com/mjslab/mjslab.html