HNHacker News
TopNewBestAskShowJobs

fyp

585 karma · joined November 4, 2019

submissionscomments
fyp··on Tesseract.js: Pure JavaScript OCR for 100 Languages
A while back I ported several c++ libraries with emscripten and it's usually just 2-10x slower than native. It gets maybe another order of magnitude worse if you're a porting a library that heavily relies on vectorization which isn't available on the web.
fyp··on This Page is Designed to Last
I don't think there's any good solution to the dead link problem. For example there are 11 links in this article:

  https://jeffhuang.com/
  https://gomakethings.com/the-web-is-not-dying/
  https://archivebox.io/
  https://webmasters.stackexchange.com/questions/25315/hotlinking-what-is-it-and-why-shouldnt-people-do-it
  https://goaccess.io/
  https://victorzhou.com/blog/minify-svgs/
  https://evilmartians.com/chronicles/images-done-right-web-graphics-good-to-the-last-byte-optimization-techniques
  https://caniuse.com/#feat=webp
  https://uptimerobot.com/
  http://www.pgbovine.net/python-tutor-ten-years.htm
  http://jeffhuang.com/designed_to_last/
How many of these will still be alive in 10 years? How many times do you have to fix your page to make your page "last"?
fyp··on Best Illusion of the Year Contest - 2019 Finalists
A lot of illusions work so well we don't even consider them illusions anymore. For example movies are just flashing pictures. Pictures/monitors/cameras themselves only need to capture 3 colors instead of the full spectrum (if we were mantis shrimps we would need 12!).

I guess I was hoping there would be some HNer with specific expertise who can talk about how these tricks are applied in graphics. For example there was some buzz a few years back on how a company managed to trick the brain into seeing the color black in AR (which shouldn't be physically possible without blocking light).

fyp··on Best Illusion of the Year Contest - 2019 Finalists
What are some interesting applications of optical illusions?

For example, perspective illusions can be used to trick drivers into slowing down: https://www.insider.com/optical-illusions-3d-crosswalk-drivi... or crashing: https://imgur.com/a/kYr94

But I rarely see any of the crazier optical illusion effects used. Maybe these don't affect the population in a consistent enough way to use as a feature? (based on how white/gold and black/blue split the internet)

fyp··on Introduction to Stochastic Processes [pdf]
I struggled through graduate analysis and measure theory as prereqs just to get to measure theoretic probability.

But I didn't retain much since it wasn't good for building intuition (informal proofs were better for that) and a lot of the corner cases it fixed didn't matter for the real world.

The language of measure theory makes a lot of proofs much shorter and easier to remember though. For example, markov's inequality: https://en.wikipedia.org/wiki/Markov%27s_inequality#In_the_l...

fyp··on A Thread about Internet Archive's “Silent Killer”
I relived a part of my childhood by playing Chip's Challenge again the other day: https://archive.org/details/chips_challenge_windows_3.x
fyp··on Brain Unrolling: Generators and the Sweet Syntactic Sugar of Coroutines
I love generators in python/javascript/etc but nowadays whenever I reach for C++ it's because I need performance. What's the cost of using this abstraction? Are compilers smart enough to convert the equivalent of "for i in range(n)" from python into a regular for loop?
fyp··on Why databases use ordered indexes but programming uses hash tables
Looking at the performance graphs of different hash table implementations is the best way to invalidate the idea of "constant time":

https://probablydance.com/2018/05/28/a-new-fast-hash-table-i...

HN submission with related comments: https://news.ycombinator.com/item?id=17177798

fyp··on Why databases use ordered indexes but programming uses hash tables
Even if you need range queries when programming, it's rare that you need it for a dynamic dataset. This means you can get better constant factors just by sorting your data and binary searching. You only need trees if you need to insert/delete/update items in the middle.

Most programming tasks work with static datasets because memory is volatile. We are always loading the data from somewhere else and usually just once because reactively updating the in-memory collection is nontrivial to hook up. On the other hand, this is the default for databases.

fyp··on Two Years Working at Dropbox
I wonder if the IPO related issues mentioned are common.

Specifically having half the senior engineers quit because they are now rich while some others become "underleveled" due to stock price falling 50%.

fyp··on A new way to make quadratic equations easy
I am also familiar with Vieta from math competitions but I think this is more than that.

Given two numbers, r1 and r2, if you know their arithmetic mean:

  m = (r1 + r2) / 2
and geometric mean:

  g = sqrt(r1 * r2)
then following Loh's derivation you get a very cute formula:

  r1 = m - sqrt(m^2 - g^2)

  r2 = m + sqrt(m^2 - g^2)
Vieta gives an easy way of finding those means from a quadratic equation: r1+r2=-b and r1*r2=c. So you can plug in m=-b/2 and g=sqrt(c) in the equation above.

The fact that you can state roots in terms of their means is the more novel insight to me. (note: Loh doesn't talk about geometric means but I thought using just product of the roots isn't as "symmetric")

fyp··on A new way to make quadratic equations easy
I think it's useful to think of this as refactoring code to make it more readable (and therefore more teachable).

If you're a memorizer, your code might as well be obfuscated code:

    def quadratic_formula(a, b, c):
        return [
            (-b - math.sqrt(b ** 2 - 4 * a * c)) / (2 * a),
            (-b + math.sqrt(b ** 2 - 4 * a * c)) / (2 * a)
        ]
If you understand the importance of the expression under the square root (i.e. the sign of the discriminant) you can rename one subexpression:

    def quadratic_formula(a, b, c):
        discriminant = b ** 2 - 4 * a * c
        return [
            (-b - math.sqrt(discriminant)) / (2 * a),
            (-b + math.sqrt(discriminant)) / (2 * a)
        ]
Of course you can refactor it further with pointless stuff like denom = 2a, but that doesn't add much semantic value. So the above is more or less the vocabulary we have about quadratic equations today.

Loh's contribution is a specific way of refactoring the code by first dividing by a:

    def quadratic_formula(a, b, c):
        b = b / a
        c = c / a
        discriminant = b ** 2 - 4 * c
        return [
            -b / 2 - math.sqrt(discriminant) / 2,
            -b / 2 + math.sqrt(discriminant) / 2
        ]
Which then unlocks the ability to talk about the subexpressions in relation to the roots (a la Vieta's formula):

    def quadratic_formula(a, b, c):
        b = b / a
        c = c / a
        sumOfRoots = -b
        productOfRoots = c
        averageRoot = sumOfRoots / 2

        # Want roots [averageRoot - delta, averageRoot + delta]
        # such that:
        #   productOfRoots == (averageRoot - delta) * (averageRoot + delta)
        #                  == averageRoot ** 2 - delta ** 2
        delta = math.sqrt(averageRoot ** 2 - productOfRoots)

        return [
            averageRoot - delta,
            averageRoot + delta
        ]
Your code is no longer using single-letter variable names!
fyp··on A new way to make quadratic equations easy
People are criticizing this because it is still the same quadratic formula. But of course it is! Math is consistent.

But representation matters. A good chunk of mathematics is just about rewriting the same mathematical fact in a different way. For example the equation of a line could be written with coefficients or in slope/intercept form or in polar coordinates or in homogeneous coordinates or etc etc.

Here the claim is that explicitly giving a name to the variable -b/2 makes the equation easier to think about. I see nothing wrong with that.

fyp··on An industrious mouse tidies up a retired electrician’s tool shed each night
I saw this on reddit a few weeks ago and it actually had useful comments: https://www.reddit.com/r/AnimalsBeingBros/comments/dwj7i3/a_...

tl;dr; the mouse is nesting

fyp··on Features of a successful therapeutic fast of 382 days' duration (1973) [pdf]
I wonder if it's the same process that bears go through when they hibernate?
fyp··on Many elementary teachers don’t understand math, and it makes them anxious
School usually start with remainders instead of trying to teach repeating decimals at the same time. So here the answer is just 0 remain 1.

The same process still works if you want to calculate the decimals though. Just pretend you're doing (1000000/7) * (1/1000000) or however many digits you want.

fyp··on React in concurrent mode: 2000 state-connected comps re-rendered at 60FPS
I think he's way off on the complexity. He might be confusing it with text diffs where you need to find the longest common subsequence for the shortest possible diff but that is still O(N^2). If you are just diffing a list with unique ids (like react child nodes are, with their required key prop), it's just a set intersection which is linear.

I can see it being a bit more complex if you need to track how nodes move across different parents. But it seems like react doesn't handle this: https://github.com/facebook/react/issues/3965#

fyp··on React in concurrent mode: 2000 state-connected comps re-rendered at 60FPS
Rendering "thousands" of anything is usually not how you impress people. The scheduler is still cool though.
fyp··on Advent of Code 2019
I wouldn't say "1-2 minutes" but definitely within 1-2 hours even for the harder problems.

This guy finished in the top 10 last year and streamed(not live) his solutions so you can see how fast you need to be to be competitive: https://www.youtube.com/watch?v=Hgv6d6rrQxo&list=PLZhotmgEsC...

fyp··on Ask HN: Any (tech) black friday deals you'd recommend?
If you're building a PC, I suggest pcpartpicker.com for comparisons and checking historical prices.

The really good deals (along comments about caveats that aren't apparent from specs) will usually show up on https://www.reddit.com/r/buildapcsales or https://www.reddit.com/r/buildapc

fyp··on Inventing an Operation to Solve x^x = y (2000)
Is this problem correctly stated? Substituting in x=f(y) you get

  f(f(f(y))) = 3f(y)
so

  f(3y) = 3f(y)
This suggests a linear solution but then you get f(x)=sqrt(3)x which doesn't work since it's N -> N.
fyp··on Do we need a web API?
Pouchdb/firebase/backend-as-a-services were supposed to be the answer to getting rid of CRUD apis. The problem is authorization and validation becomes really difficult if you don't have a backend that you can trust.
fyp··on Ask HN: Where is the web animation community on the Internet?
If you mean javascript/css animation effects then there are a lot of cool demos at:

https://codepen.io/search/pens?q=animation

https://dribbble.com/shots/popular/animation

For webgl there's:

https://www.shadertoy.com/results?query=&sort=popular&filter...

https://experiments.withgoogle.com/search?q=WebGL

And for codegolfing, there's https://www.dwitter.net/top/all which restricts you to 140 characters or less.

If you mean the flash-animation community, I also wonder where they disappeared off to. I felt like they peaked in the mid 2000s. Now you just made me remember some newgrounds movies that I am going binge watch for nostalgia now: "There she is!!"(2003) https://www.youtube.com/watch?v=WsWgrf3XLKQ

fyp··on The Simulation Argument and the Simulation Barrier
Can someone help me imagine what a world with different math is like? It’s easy enough to imagine a world with different physics (such as in video games). But math is just a list of rules/axioms and the results of following those rules. They might find different axioms more applicable but our math should still work in their universe even if it’s considered pure math with no applications.
fyp··on Mergeable replicated data types – Part I
The "characteristic relations" of a datatype looks really interesting. It's similar to abstract data type (ADT) except you only care about modeling the state but not the operations.

And if you ignore operations, many datatypes reduce down to very simple mathematical objects. For example even though set and priority queues are very different in code, they both only need membership (R_mem) to fully specify because you can rebuild a priority queue knowing just the members. To specify a list/queue/stack, you only need to additionally know ordering (they denote this relationship as R_ob for "occurs before").

The advantage of converting a datatype (bijectively) to this relational domain is that you can essentially do "state-based" merging. You only need to define: how to convert to the relational domain, how to merge within that domain (which is still rich enough for you to specify relational invariants you need preserved), and how to convert back to the concrete datatype. Contrast this with operation-based syncing, where you would need a quadratic explosion of definitions for how any two operations should merge together. Here you don't even need to handle any particular operation individually (e.g., if it works for push_front, you will likely get push_back for free). Essentially it is saying the semantics of an operation is captured by the delta caused to the characteristic relations of the datatype.

fyp··on Towards a unified theory of reactive UI
If the academic stuff is interesting to you, then take look at functional reactive programming stuff from the scala ecosystem.

For example there is a paper by Martin Odersky himself on incremental computations on lists (which should be very familiar to you due to your work on Xi's ropes): https://link.springer.com/chapter/10.1007/978-3-642-39038-8_...

fyp··on Towards a unified theory of reactive UI
Side question: How do you make DAGs immutable? Unlike trees where changing a node only requires a path copy of all ancestors, changing a node in a DAG has the potential to affect all other nodes. There are techniques such as using fat nodes[1] but I don't know of anyone using them in the real world.

[1] https://en.wikipedia.org/wiki/Persistent_data_structure#Fat_...

fyp··on 100k+ page views a month for $5 with a self-hosted static site
There's an overblown meme floating around that cloudflare is a man-in-the-middle attack on your SSL connection. But even if you don't use cloudflare, your SSL connection typically terminates at your cloud provider's load balancers anyway. Would people then say the load balancer is a MITM attack? At some point you just have to trust the cloud infrastructure you paid for.
fyp··on Ask HN: Do you feel the quality of SWE has gone down?
It's a really deep problem actually! Doing y then x is better but it's far from "optimal".

These parallel programming course notes have an example of using z-order curves which is slightly better yet: http://ppc.cs.aalto.fi/ch2/v7/

And the best solution requires something like Halide https://halide-lang.org/ to find the best traversal order.

fyp··on Microsoft REST API Guidelines
I said this in another comment and got downvoted too. Can the downvoters explain what they are downvoting for? What's wrong with if-match?
← PreviousPage 4 of 5Next →