News for hackers. Stuff that matters.

MJSplot_author

Re:Self Host a Wiki or Knowledge Base for Your Team on Monday July 13, 2020 @04:31AM (#23818502)
Zim desktop wiki seems to fit you requirements. It's local and designed for a single user, but if coupled with Syncthing works across devices nicely.
Just my initial response.

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?
Re:Show HN: Web pages stored entirely in the URL on Sunday June 30, 2019 @09:33AM (#20318112)
Similar to this [0] from a few years ago. That one also had some basic encryption included. Some previous discussions[1,2] of that tool highlights that this can easily be abused for xss or distribution of illegal materials which you may not want to find yourself the focus of.

[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...

Re:Show HN: Observable Notebooks on Wednesday January 31, 2018 @03:49PM (#16277417)
I like the idea, I've even written something similar myself, but for me a few things were not clear.

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.

Re:Deep-copying in JavaScript on Thursday January 25, 2018 @03:42PM (#16234466)
But it is also true that:

    let a = {key: 'a'};
    
    function foo( a ) {
      a['otherKey'] = 'b';
    }
    
    foo( a );
    
    console.log( a ); // {key: 'a',otherKey: 'b'}
There is another solution for having citations and references in figures: use Inkscape as suggested in the OP. In particular the save to pdf+latex feature. Any text elements in the figure are generated using latex. This means the correct font and the ability to write any latex you want as text. I still like hand editing figures to add complex annotations so I like being able to use Inkscape's GUI.
Re:Txt.fyi on Friday February 24, 2017 @01:17PM (#13726109)
I just want to chime in and say that I've had a look and a quick play with mypost.io and think it looks awesome. Like many of the links on this HN thread, but with way more feature.

As you are allowing HTML entry, how are you protecting against Javascript inside user created pages?

Ask HN: Where to watch the 2016 leap second?

The 2016 leap second is later today[0], and I'm trying to make a countdown timer so I can see it happen.I've tried to make a timer in Javascript using the built-in Date() method, but this dosn't show the special 23:59:60 that I want [1] (only true at timezone +0000). As a side question, how is the leap second handled in JS? I also tried python's Datetime object, but that has the same results as...

( Read More... | no comments | 2 points | on HN )
Re:Island in the Sun on Tuesday November 22, 2016 @11:50AM (#13015340)
I think it would be interesting to read about the decision process that decided on the 1.4MW of power generation to 6MWh of storage ratio. This is around 1:4.2h. Is this ratio very specific to Ta’u island, with their usage patterns, or can this ratio be used as a guide for future installations? I'm guessing that Ta'u has not as much technology that stays on overnight, and a more realistic ratio would be 1:6h or more.

Anyway, this is a great proof of tech.

Re:Plottable.js – Flexible, interactive charts for the web on Monday September 05, 2016 @04:49PM (#12432170)
If you are plotting using a canvas - not building a SVG or on the dom - then even 50000 points is fine, no need to filter even on mobile devices.

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.

Re:Plottable.js – Flexible, interactive charts for the web on Monday September 05, 2016 @04:41PM (#12432137)
It uses SVG on D3. So I don't think so.

If you need 10000> points and interactivity you could try my own: http://generalsarsby.github.io/mjs_plot/

Re:20 lines of code that beat A/B testing (2012) on Wednesday April 06, 2016 @09:23AM (#11438561)
The fact that on the summary page there isn't a number showing the significance is very worrying. As the whole reason for it is to make a binary choice, there could be a 2 line chuck of js that just says "B might be better (60% probablity)".
Re:20 lines of code that beat A/B testing (2012) on Wednesday April 06, 2016 @08:59AM (#11438434)
Running their numbers:

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.

Re:Show HN: Experimental URL abuse on Wednesday February 24, 2016 @08:51PM (#11171833)
HN protects itself quite well from very long URLs. But reddit[0] will happily host 20kB.

https://www.reddit.com/r/programming/comments/47gjbv/experim...

Show HN: Experimental URL abuse

http://xqt2.com/p/everything.html#DwIw9gJgngBAzgFygGwKYF4BEAHAhhCASwDsBzALhgEZUBbAbhltwA8BaAd0IgQAtKALAAY6jZgCdSJNmgBmCSrgCuCMGNyTp4wqV4KYy1fUwA+AFAwYwXlXhI0WBKhYI2uZDuKUAxqmJPxYxMAQRAlOBJSGD5UGABVACUAGQBCYAB6G3NLYGwQ5GQYDl5cBBgoMCV4VFjeVHFYwjgYbzB-PzLW-1wSVAgiwj4SaLr45IAqADoMvIsrPJgATUqW3GIYcNiKpXEYEHEwDjh65o5UEDYIVAA3aLAwZGaACm1dTo9vAGsYNhgSOGwqG8ZVQaFoHQAlHcmJBCLJYENmnhSKgADQjPwbY4YqwIBAmZifVBPCEZPEmGCyJTEYGENrosC7GJMXBEvYqVTrECgw7o1QwMCA9a4GDEVAcGDI2JcPjlSq7Q7rLpOfyTGAAFVGHmIn2aa36zKlzW8DV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wAAL7ohhrDCEk9EK120PXMws50hOygCYIAA

( Read More... | 1 comment | 3 points | on HN )
Re:Using the Best Date Format on Tuesday January 05, 2016 @04:18PM (#10846130)
I like YYYY-MM-DD as it is also sortable and doesn't require any escaping as a file name on windows or Linux. It's part of ISO8601.
Re:Reddit shell on Friday September 18, 2015 @06:23PM (#10242394)
I remember someone built it, they abused self posts for storage. My google-fu is failing and I can't find it.
Go for it!
If you know what you are doing it's fine, but it might cause incompatibility issues from namespace collisions.

You can rearrange the code to accept a context as the first argument if you are worried.

Yes, but this is as simple. It's not really my maths, it's quite standard stuff.

I'm more excited about Path2D[0] becoming adopted by more browsers.

[0] https://developer.mozilla.org/en-US/docs/Web/API/Path2D

Older »