Readit News logoReadit News
psi-squared commented on Hacker, Hack Thyself   blog.codinghorror.com/hac... · Posted by u/darwhy
sriku · 8 years ago
I don't trust myself enough to manage passwords properly for some small services I run 'cos I simply don't have the spare time to invest compared to investing in functionality.

For that reason I've been trying out a password-less login for a while now (works via email) and so far non tech folks haven't complained too.

It is pretty much as though you always used the "forgot password" mechanism to login.

Wrote about it here - http://sriku.org/blog/2017/04/29/forget-password/

psi-squared · 8 years ago
That's a really neat solution, and avoids the cognitive overhead of having to remember yet another password (or the security risk of re-using passwords). I particularly like the way you tie the log-in token to a particular browser session so that it can't be hijacked!

Plus by merging all of the log-in paths (registration, 'forgot password', and normal login), you have one thing to design and secure rather than three. That seems like a huge advantage from a security perspective.

psi-squared commented on Exploring DynamIQ and ARM’s New CPUs: Cortex-A75, Cortex-A55   anandtech.com/show/11441/... · Posted by u/msh
cm2187 · 8 years ago
Stupid question: if ARM keeps adding aggressively instructions and co-processors, how long before it becomes blotted and power hungry like the x86 architecture? Isn't its simplicity the strength of the ARM platform?
psi-squared · 8 years ago
It's worth noting that, if you need something which runs on really low power, ARM have their R and M series processors. So even if the A series did become really power-hungry, the other two lines presumably wouldn't.
psi-squared commented on Vectorized Bloom Filters for Advanced SIMD Processors (2014) [pdf]   pdfs.semanticscholar.org/... · Posted by u/tjalfi
jbapple · 8 years ago
This is a nice piece of work and still relevant. The source is available:

http://www.cs.columbia.edu/~orestis/vbf.c

It has very high throughput for L2-resident filters, as long as most queries return "false" and you can use a bulk API. It was, IIRC, about 4x faster than a hand-made "horizontal" SIMD Bloom filter, and 20x faster than cuckoo filters.

By "horizontal" SIMD, I am using the language of a follow-up paper by the same team at Columbia, "Rethinking SIMD Vectorization for In-Memory Databases", http://www.cs.columbia.edu/~orestis/sigmod15.pdf, http://www.cs.columbia.edu/~orestis/sigmod15source.zip. In that paper, they call "vertical" SIMD for hash-based containers "process[ing] a different input key per vector lane". "Horizontal" SIMD is putting the same key in each lane.

I suspect the results in this paper could be improved with more modern gather techniques on newer x86-64 processors.

psi-squared · 8 years ago
> I suspect the results in this paper could be improved with more modern gather techniques on newer x86-64 processors.

By that, do you mean the AVX2 'gather' type instructions? If not, I'd be interested to know what those techniques are.

As for AVX2 gathers, I had to look this up recently and it sounds like they're about as fast as manually unpacking the vector and performing scalar loads. That is to say, they're decidedly not fast. On the other hand, it sounds like (as of Skylake) they're bottlenecked on accesses to the L1 cache, so they're about as fast as they reasonably could be.

Source: https://stackoverflow.com/questions/21774454/how-are-the-gat...

Not sure about performance on Zen, but I would imagine it's similar?

psi-squared commented on Approximating sin(x) to 5 ULP with Chebyshev polynomials   mooooo.ooo/chebyshev-sine... · Posted by u/wallacoloo
qooiii2 · 8 years ago
Under those constraints, Chebyshev approximation will probably outperform minimax. Minimax approximations have non-zero error at the endpoints, so they wouldn't quite hit zero at sin(pi) and your relative error would be horrible.
psi-squared · 8 years ago
If you want exactly zero at the end points, you could do something like the post does, of approximating sin(x) / x(pi+x)(pi-x), or similar. You can still do that with the Remez algorithm.

Also, a while ago I realized that you can tweak the Remez algorithm to minimize relative error (rather than absolute error) for strictly-positive functions - it's not dissimilar to how this blog post does it for Chebyshev polynomials, in fact. I should really write a blog post about it, but it's definitely doable.

So combining those two, you should be able to get a good "relative minimax" approximation for pi, which might be better than the Chebyshev approximation depending on your goals. Of course, you still need to worry about numerical error, and it looks like a lot of the ideas in the original post on how to deal with that would carry over exactly the same.

psi-squared commented on Over 150 new families of Newtonian periodic planar three-body orbits   arxiv.org/abs/1705.00527... · Posted by u/msuvakov
MichailP · 8 years ago
I wonder how can authors claim such great certainty in their results, after all, it is all based on number crunching. Some floating point error, and similar is bound to creep in...
psi-squared · 8 years ago
The paper has a section on this, around the end of page 4, which is really interesting. The short version is: They compared their double-precision results to extremely high-precision Taylor expansions (with theoretical 70+ digit accuracy, and calculated in 100+ digit accuracy), and found that they matched to the accuracy you'd expect.

That doesn't guarantee that the orbits are perfectly periodic, I suppose, but it does suggest that the orbits are stable with respect to rounding errors up to those you get from using doubles.

psi-squared commented on What CSS minifiers also leave behind   luisant.ca/css-opts-surve... · Posted by u/remy_luisant
bigbugbag · 8 years ago
Gzip compression over https is a vulnerabilty[1].

Depending on the scale, shaving a few kB here and there can amount to significant savings in the long run.

[1]: https://en.wikipedia.org/wiki/BREACH

psi-squared · 8 years ago
I am not a security researcher, but I think you could keep the benefits of both compression and security, as long as you're careful on the server side:

Say you have a document structured like [boring data] [secret data] [boring data]. I don't know if any existing compressor lets you do this, but the gzip file format (really the 'deflate' format used inside it) allows you to encode this (schematically) as follows:

[compressed boring data] || [uncompressed secret data] || [compressed boring data]

where each || is i) a chunk boundary (the Huffman compression stage is done per-chunk, so this avoids leaks at that level), and ii) a point where the encoder forgets its history - ie, you simply ban the encoder from referencing across the || symbols.

If you wanted, you could even allow references between different "boring" chunks (since the decoder state never needs resetting), just as long as you make sure not to reference any of the secret data chunks.

Edit to add: Also, if the "boring" parts are static, you can pre-compress just those chunks and splice them together, potentially saving you from having to fully recompress an "almost static" document just because it has some dynamic content.

psi-squared commented on Tunable eyeglass lenses to replace bifocals   wsj.com/articles/could-th... · Posted by u/candiodari
dorfsmay · 9 years ago
I had to watch the video twice, here's the important piece of text:

"the curvature of each lens changes,"

"responding to input from an infrared distance meter build into the bridge of the frames"

So the glasses have to know your personal prescription. I know very little about optic, but one thing I've been wondering for a long time is why can't there be a camera pointed to your eyes that adjust the lens until the image on your eye is in focus?

psi-squared · 9 years ago
I had an eye test recently (in the UK, if it's relevant), and they had a device which seemed to do that. You sit down, look into the device and see a blurry image, which sort of "snaps" into focus as it works out the shape of your eyes.

That device was a fairly big thing linked to a desktop, though - no idea if it could be miniaturised or not. In addition, they followed it up with more "traditional" tests, which in my case disagreed with the results from that device. So maybe it's not quite there yet?

psi-squared commented on Ask HN: What are your favorite algorithms?    · Posted by u/EFruit
daurnimator · 9 years ago
The burrows-wheeler transform is pretty interesting https://en.wikipedia.org/wiki/Burrows%E2%80%93Wheeler_transf.... It's behind the bzip compression format.
psi-squared · 9 years ago
This is related to my current favourite algorithm: Because the BWT is closely related to the suffix tree of the original string, there's an algorithm to search for a substring of length 'm' in a BWT-ed string of length 'n' in O(m log n) time!

The one downside is that you have to pre-process the string, which takes O(n) time and between 5n and 9n space depending on exactly how you do it. But after that, you can do as many searches as you want practically "for free".

There's a paper outlining the various algorithms available here: (PDF) http://www.cosc.canterbury.ac.nz/research/reports/HonsReps/2...

psi-squared commented on How Does the SQL Server Query Optimizer Work?   xameeramir.github.io/How-... · Posted by u/xameeramir
psi-squared · 9 years ago
There's a really nice article about the Postgres query optimizer, which goes into much more detail about the algorithms used (it's likely that at least the basic ideas are shared with SQL server, though I can't say for sure). I really like the exposition in this:

http://jinchengli.me/post/postgres-query-opt/

psi-squared commented on Memory Deduplication: The Curse that Keeps on Giving [video]   media.ccc.de/v/33c3-8022-... · Posted by u/ianopolous
bitwiseand · 9 years ago
AFAIK, this is how docker CoW works. Your read-only parts i.e. base OS / starting point of the image is always shared. As you make changes a per-container R/W layer records those changes. This link explains it well -

https://docs.docker.com/engine/userguide/storagedriver/image...

psi-squared · 9 years ago
Okay, so on reading through that it looks like the answer to my question is "it depends":

* On-disk, the layered approach always saves space, as expected

* In memory, it depends on which storage backend you use: apparently btrfs can't share page cache entries between containers, while aufs/overlayfs/zfs can - I'm not sure if this is due to btrfs or docker's btrfs backend.

From looking at the relevant sources, it looks like (but I could be wrong if I looked in the wrong places) both exec() and dlopen() end up mmap-ing the executable/libraries into the calling process's address space, which should mean they just reuse the page cache entries.

So, if I understand correctly, as long as you pick a filesystem which shares page cache entries between containers, then you do indeed only end up with one copy of (the read-only sections of) executables/libraries in memory, no matter how many containers are running them at once. That's good to know!

u/psi-squared

KarmaCake day72August 23, 2015View Original