HN user

modalduality

302 karma

[ my public key: https://keybase.io/modalduality; my proof: https://keybase.io/modalduality/sigs/AFEeqRQcdFDAsfFHFTYPcsi07V63-9j3xR2g3vW13Eg ]

Posts7
Comments41
View on HN

Most languages with monads have tools for working with them. In Haskell, for example, even without `liftM2` or `sequenceM`, you can simply do

    case (xm, ym) of
        (Just x, Just y) -> x + y
        _ -> 0

The main idea is to explore the concept of skinny triangles being unaesthetic (and thus undesirable for triangulations). This is true for many tasks in computational geometry, but not so true in art. Bringing these two together shows jarring conflict where the Delaunay Triangulation and your brain's sense of aesthetics disagree.

It's not really supposed to be useful, just exploration in reduction of an already reduced art style: what is lost when we enforce that all shapes are triangles that tend to be more large-angle? For one, I think this destroys the perspective since one common trope is to make objects narrower as they are farther away.

Although the entire thing is mostly a joke based on their shared last names.

What makes it okay to identify the naming of a large number with producing that large number of things (e.g. 1's)?

Nice catch! I glossed over this but this is pretty important. The issue is that for any _specific number_, it takes a constant amount of time to write a number larger than that. Related: solving chess is technically O(1) since there are a constant number of positions we have to check.

What we need instead for this concept is a series of numbers, those can be compared with the question "Does one eventually get to a point where it will always be larger than the second?". We can parametrize the "biggest number" by the number of seconds given, say we can write down one character per second. Then a person's largest number function might be something like "f(n) = 9 ^ n", which is easy to see _is_ a computable function, and thus smaller than BB(n) for the same number of seconds, eventually.

In practice, just something like BB(100) - or BB(BB(100)), even can't really be written out by any computable method in a finite amount of time.

which was: what characterizes the Busy Beaver function?

The proper one is just the number of 1s, but I talked about the shift function because it's easier to see why it's uncomputable. Tibor Rado proved that the Busy beaver function is also uncomputable in his 1962 paper, if you're interested you could check out his reduction.

In addition to 4Clojure, I found the Brave Clojure book (https://www.braveclojure.com/) helpful for understanding how to structure programs in a "Clojure-y" way, e.g., to a greater extent than OOP representing data in lists and maps instead of structured classes, or using the "nil" value effectively when chaining functions together, almost like the Maybe monad.

Crypto for kids 9 years ago

yup! they should have used a commitment scheme instead - for example, SHA256(winning numbers || 512-bit nonce). To reveal, reveal the winning numbers and the nonce and Mr X can check that the hash matches. The nonce is to introduce more entropy so Mr X can't just bruteforce the hash, but since finding any collision is difficult, it doesn't let the alien cheat by trying different nonces (unlike with different keys with encryption schemes).

Does anyone know why they might choose to encrypt-then-MAC vs. an AEAD scheme? Seems less error prone.

Good article (didn't realize there were other kinds of lookaround), but maybe the bottom should link to well-tested standards-based regexes instead.

    URL: ^(((http|https|ftp):\/\/)?([[a-zA-Z0-9]\-\.])+(\.)([[a-zA-Z0-9]]){2,4}([[a-zA-Z0-9]\/+=%&_\.~?\-]*))*$
I recently encountered a case where a URL had an underscore at the end of a subdomain name. It seems underscores are okay anywhere else, but while my friend on Windows was able to load the website, I wasn't (on Linux) using Firefox, curl, remote screenshot service which presumably ran Linux etc. According to various RFCs, they should be okay anywhere within the subdomain name.

Has anyone encountered this behavior? Couldn't find anything on the internet; maybe it's just my computer?

As the author mentions, this solution doesn't create identical distributions between the found case and the not-found case.

One other concern is that a db hit and miss could take very different amount of times (e.g., L1 hit vs miss that travels to disk).

* Don't waste server time hashing a password if you already know the user doesn't exist.

doesn't seem like too big of a concern, since you're spending the time anyway, it's just increasing server load marginally.

To solve the first problem, how about running two queries in parallel against the db, one for a fixed username and one for the given username? However, depending on the database, now you may run into caching issues with the fixed username, speeding up that query. Querying for a random username at the beginning might also push that row into the cache.

Maybe keep a large, randomized linkedlist of usernames on-disk (initialized on server startup), read out the next link, and use that as parallel username?

For these ideas I believe you would need to enforce a max-password-length and take up that many steps to check equality for all passwords.

In general it's much easier to reason about Boolean circuits because they always have an answer, unlike arbitrary programs that may never halt, for example, so you see a lot of theoretic results focusing on Boolean circuits (sometimes with limitations on the depth) instead.

Early on it was thought that considering circuits instead of regular programs could result in "polynomial with advice" algorithms for NP-complete problems, but results such as the Karp-Lipton theorem have shown this to be unlikely.

Not a Rust expert, but some thoughts on the negatives.

Compilation time is too large

Can you try compiling incrementally? https://blog.rust-lang.org/2016/09/08/incremental.html. Might still only be on nightly.

And, on the similar note, benchmarks.

I agree, profiling as well isn't as full featured as in more mature languages. Clojure, incidentally has great benchmarking due to being on the JVM.

Also the tuple assignments.

Can't you just do

    fn main() {
        let (a, b) = (5, 2);
        println!("{}, {}", b, a);
    }
>There are many cases where compiler could do the stuff automatically.

I think this will be solved with the new non-lexical lifetimes RFC. Also a problem I had when starting, I generally assume referential transparency.

.newsbeuter/config has a "browser" command where you can give arbitrary a shell command where %u is the URL, you could give it your own script that matches on the URL.

For example, mine is 'browser "urxvt -e elinks %u"'.

One common use is to test out your new contract code without using real ethereum. You could even imagine a time where you could run a fuzzer on your contract to try to find bugs.

Personally I don't think there's a real risk of exposing your real Ethereum wallet by setting up a testnet, as long as you only let localhost connect to it.

Good article. I found while doing the same thing a lot of the information online was out of date (for example referencing geth's built-in solc) and unusable.

One addition--Geth 1.6 released a very nice interactive tool called puppeth that creates genesis blocks and provisions testnets, I've found it easier than doing everything myself.

Although once again there really wasn't any tutorial or documentation about puppeth for Ethereum beginners, the only reference I could find was a Taiwanese Ethereum meetup blogpost, which was mostly in Chinese.

Right, but then the problem is no longer linear and approximating is more difficult. I'm not exactly sure what you mean by "exponential weight" in a linear program, do you have an example?

Often in approximations you can prove an upper bound on the optimal solution, even if you don't know the optimal solution itself.

An easy example is by using duality when solving linear programs.

And sometimes your upper bound is close enough to what you already have so you can just say something like "well my solution gets 190 points, I have an upper bound of 190.5 points, and all point rewards are integral so I must have the optimal solution."

The issue isn't about approximating a TSP instance, but ensuring that points aren't too far apart from each other, even at the cost of increasing total length.

I can't immediately think of a reduction that would factor this in so the best thing may be to just reduce this to the appropriate ILP instance and use a mixed ILP approximator like GLPK (or Gurobi is free for students too).

Incidentally, achieving a polynomially-sized ILP formulation for TSP isn't quite obvious. Wikipedia has a good explanation of how to do this: https://en.wikipedia.org/wiki/Travelling_salesman_problem#In.... I'm not sure if the metric TSP has a simpler formulation.

Edit: Now that I think about it, it may be difficult to express the constraint that edges should be balanced out in a linear way. I happened to write about a similar problem a while ago (https://modalduality.org/posts/optimizing-color-coding/), I ended up giving up on finding a linear formulation and went for sequential least squares instead.

I don't see why this wouldn't be possible, just tell Nginx (or whatever proxy) to serve one on 443 with appropriate TLS options and the root domain on 80. To a large extent subdomains are treated as different sites w.r.t. security. But it's possible Azure has some particular settings to make this impossible.

Interesting game. I have been looking for a web-based turn based strategy game for a while, this looks promising. Some thoughts:

1. Let the user press Enter or Space to go to the next dialog in the tutorial.

2. Let the user press Escape or another character to exit out of the current "move/attack" selection state.

3. Let the user undo/go back to the start of the turn if the user hasn't pressed "end turn" yet. Very often I click move on the player's own square or move instead of attack/capture or other similar mistakes.

4. The graphics are fine for me, but I just feel the UX in terms of actual gameplay is very unintuitive/more complicated than it could be. Maybe get a game designer to give you some feedback?