HNHacker News
TopNewBestAskShowJobs

drostie

4,724 karma · joined January 19, 2012

Hi, my name is Chris Drost. I'm an application developer at U.S. Engineering Company in Kansas City, MO. If you're a talented software engineer in the KC region, hit me up -- we may be hiring.

I am @crdrost on Twitter and Facebook. I almost never check my Facebook.

I have an M.Sc. in Applied Physics from the TU Delft in the Netherlands. I am from Ithaca, NY originally.

You should listen to more Troubled Hubble.

    Don't you forget the, the image in your retina
    To foresee the future, and find a use for
    Them telling me, everything, 
      that would happen to me anyway.

    If it isn't science, it doesn't exist;
    We make our own problems and blame them on
    Birds and bees, but we ain't seen nothin' yet:
    and don't you ever forget it.
Also, more Glaze.

    Every night I wake up,
    Thinking there's something missing in my heart:
        a canvas for the art.
    Every day I hear the sound of whirring fans,
    But nothing more:
        another scene yet to be scored.
    
    You're the empress, I'm the king:
        together we will rule this world
    You'll paint the scene, I'll write the melody:
        we will rule this world.
Maybe also some '90s stuff.

    And of course you can't become, 
    If you only say what you would have done:
    So I missed a million miles of fun.
Email me by my HN username @zoho.com or my twitter handle @gmail.com.
submissionscomments
drostie··on An External Replication on the Effects of Test-driven Development [pdf]
I mean, you do incur a cost for programming with TDD though. The benefits may repay the cost in the end, but the cost is still there. And for that matter cars do undergo destructive testing, just not TDD--and the problem there is presumably that the car benefits from taking a holistic component-driven approach, "here is what I want the car overall to look like, and what components I want to fit into the space inside, now how can I reduce the rollover risk?" rather than "here are some basic expectations of a car, I expect it to be able to move forward and hold a passenger, let's make the smallest thing which causes that to happen. OK now let's add a single passenger, and let's test that bugs aren't flying into your face at highway speeds so that we remember to add a windshield eventually. (1000 steps later) Crap now we're testing the ability to shift into reverse and none of my homespun bare-minimum engine design is going to work there."

TDD probably pays its best rewards with relatively simple well-defined projects, and needs to be deployed with a modularization strategy. Possibly the wishful-thinking strategy of top-down design would be a natural complement, since when you wishfully think of a function you can hopefully quickly write a test or two for it.

drostie··on Scrypt is Maximally Memory-Hard
There's something to be said for both. It's true that there is a scaling intrinsic to the Bitcoin protocol (which it had to have, as it was based on fast functions) to allow arbitrary slowdown at the brute-force level. However ideally it would be nice to have an asymmetry there.

Just think of it purely in the manner of "why run exactly one unit of the work? why not run a hundredth of that unit to validate the proof?" An asymmetry allows you to more quickly verify the ledger, which is both a startup cost and a lesser ongoing cost for everyone.

I'm wondering however if there is a connection with asymmetric encryption, though. Imagine a one-way function h and two functions f(x), g(x) such that f(g(x)) = x. Suppose the task is "find M such that g(h(M)) lies within some narrow subset," then if g is much slower than f, you can verify a pair (M, g_h_M) not by verifying that g(h(M)) = M (slow) but rather by verifying that f(g_h_M) = h(M) (much faster). The importance of h is just that for the most obvious application (f(x) = x^E modulo N, g(x) = x^D modulo N), you also have that g(f(x)) = x, and this is a relatively common property of inverse functions.

drostie··on Vim for Humans
There's something to that, yes, that a lot of things become second-nature (e.g. once you learn Vim, when you're in Nano on an unfamiliar machine, you start finding yourself accidentally typing Esc-:w to try to save a file).

There's also something about "this is totally unfamiliar and not at all incremental upon what I know." I was vigorously against vim after trying to do it many times, eventually I found out a base set that allowed me to learn incrementally, now it's not so bad. The big thing is to totally forget all of these people who are saying "vim is like an awesome language for text editing." Maybe it is, but that's an awful sales pitch. This person wants to spend a few minutes editing source code, not spend a year learning a new language.

The minimal starter set for Vim is something like:

    # From Command Mode #
    dd     | deletes a line
    .      | repeat whatever you just did, for example pressing I, 
             then the delete key 4 times, then Esc is one command
             which dedents a space-indented line by 4; now you
             can go down a block hitting . at each line to 
             dedent it.
    i      | switch to edit mode at present cursor
    I      | edit at beginning of line.
    A      | edit at end of line.
    u      | undo
    Ctrl-r | redo
    
From there probably the next thing I would teach people is brace jumping with %, regex-jumping with /, visual-lines mode shift-V and either cutting with d or copying with y, then pasting with shift-P. Finally macros with qp ... q ... @p. After that, maybe dealing with multiple buffers. Just let people use the arrow keys to navigate, don't get too religious about the home row or letter repetitions like d5d.

I think that's a basic skillset that will let you say "okay, my thesis advisor is making me put two spaces after each period that's not an abbreviation in this document, what editor should I use for that? Well I want to step through everything just to make sure, but let's just use Vim where I know I can write "fix this one and then jump to the next period" as a macro, and interleave that with some basic navigation when it's not right."

drostie··on Proof by storytelling
Yeah. I think it works when you take three fingers from your left hand and mash them together with all five from your right, representing a set of 8 elements. Now to perform 8-choose-3 and choose a set of 3 out of the 8 elements, you separate your hands and you've "chosen" (albeit in advance by the topology of your hands) a group of 3 out of the 8, but your fingers are still bunched up because these are sets and you haven't ordered everyone yet. Now we ask for both sides to line up, you "order" them by flattening out your hands facing each other palm-to-palm, as if you were holding a box on its sides: the 3 and 5 fingers on either side are now lined up. Now if you've been following the math you have (8 choose 3) * 3! * 5! ways that you could have done those steps.

Now you take these 2 hands facing each other and turn them palms-down so that they form one line of 8 fingers, a permutation of the original set-of-8 which happens to have a piece of tape (or other division) separating the first 3 from the last 5. Ignoring this division you have just the permutation of 8.

With a little reasoning you get the one-to-one and onto properties of this mapping: if you got to some permutation of the 8 this way, there was only one choice of the 3 out of the 8, and only one ordering of the left, and only one ordering of the right, that generates that permutation of the 8. Furthermore every permutation can be generated by those very steps of choosing the first 3 of the permutation in the 8-choose-3 step and then ordering the two groups appropriately. Since this process is one-to-one and onto, it must be the case that (N choose K) K! (N - K)! = N!, the total number of possibilities for each must be the same.

Does that help?

drostie··on Noms – A versioned, forkable, syncable database
Right, it intentionally violates the URI spec by appending something to the end of it. The data structure they're storing has a natural pair-of-structures at its top level:

    data Database = InMemory | LevelDB Path | ViaHTTP URL

    newtype DataSet = DS Text
    newtype Hash = Hash Text 
    data Accessor = AccessDS DataSet | AccessValue (Either DataSet Hash) Path
    
    type DBAccessor = (Database, Accessor)
They elected to basically encode a DBAccessor above as a string which you can split on "::", with the URL above being stored on the left in the case of the ViaHTTP databases.
drostie··on The Birkana hexadecimal number symbols
The actual logic is a bit more benign.

Once upon a time, the digit for 0 was a dot, the digit for 1 was (close to) ι, the digit for 2 was (close to) μ, the digit for 3 was close to w with a leading descender like μ has. The digit for 4 might have been closer to a + sign that eventually morphed to look more like a backwards 2. It was the number of vertical lines which encoded 1, 2, or 3; with 4 and 5 and 6 there was more need to come up with more-abstract symbols.

In Arabic these first 4 digits have actually survived relatively unmolested, ٠‎ - ١‎ - ٢‎ - ٣‎, while the backwards 2 for 4 started hooking down to become a ٤ and some other stuff happened with the next 5 digits.

In English the digits for 2, 3, and 4 all rotated about 90 degrees counterclockwise while the tail disappeared for the 3 and the 4 didn't close up on the top until relatively late.

drostie··on When Librarians Are Silenced
> When you have political fact-checkers actually trying to claim that Trump thought email was 'bleached' with actual bleach, by taking his entire conversation out of context, I don't blame him.

The clip that circulated was [1] from around 1:09:00, widely quoted:

    And not only that, she bleached, which somebody said they never even heard of, in a very 
    expensive fashion, used chemical, so that nobody will ever be able to see 'em. 
You are claiming that this is out-of-context. It is not. Here is the surrounding context:

    But the only way to learn the full depth of her public corruption is to read the 33,000 emails
    that she deleted. They're gone. (Pause for the audience to chant "Lock Her Up.") It's very sad.
    And not only deleted, folks. This was after, this was after she was subpoena'ed by Congress to 
    produce. And not only that, she bleached, which somebody said they never even heard of, in a 
    very expensive fashion, used chemical, so that nobody will ever be able to see 'em. Who does 
    this? Who does this? Hillary Clinton said under oath that she turned over all of her 
    work-related emails. But we now know that is just one more Clinton lie. The FBI found thousands
    of work-related emails she never turned over, and then another 15,000 emails were just 
    discovered a few weeks ago. Now today another 30 emails were discovered by the State Department
    that Hillary Clinton failed to turn over. These were emails about Benghazi.
As you can see, it is not preceded or followed by any statements of "I mean, they weren't chemicals, it was just a program that happened to have the word "bleach" in its name, and also it's not professional security software like Eraser; it's amateurish software for freeing up space on your computer." In fact he seems to be saying not only that a chemical was used on the server, but also that he asked one of his aides and they said that they were surprised that you could/would erase a hard drive with actual bleach. He even bolsters it with a lie to say that the process is "very expensive" rather than saying "yeah, it's basically just downloading a program and running it on your desktop."

In further interviews he has repeated the phrase "acid washing" for this downloading-a-free-space-cleaner-upper-act, and repeated that it was expensive. [2] The same source apparently followed-up with the campaign:

    His campaign told us Trump didn’t literally mean that Clinton “acid washed” her emails. It 
    said that he was using a play on words, referring to Clinton’s joke a year ago about “wiping”
    her server with a cloth. 

    Sorry, we don’t get the play on words, which was not clear in any of Trump’s remarks. Let’s 
    look at the facts.
That excuse is one hell of a whopper; as the article notes, nobody can reasonably take this stuff as "wordplay." It's intentional misinformation; he is trying to mislead his own supporters to think that the unrecoverable emails contain some secrets so potent that post-subpoena, Hillary said "We have to brick this computer so bad the FBI can't recover anything out of it." He's not trying to lead them to the idea of "oh, there was a subpoena, and then there were some emails that were no longer on the email server but had instead been downloaded to a personal computer just the way POP3 works by default for most people, but then they couldn't be recovered from that PC because some fool had run a 'disk space freer-upper' in the interim, not realizing that it was deleting these emails."

> The media is clearly biased and working with the DNC to destroy all of their political enemies. This is corruption at the national-level needs to be stopped.

I mean, no. It's not "clearly" biased. If it's biased it's much more subtle. Like, Trump's video where he brags that he sexually assaults women and gets away with it because he's famous, came concurrently with the Podesta hack. CNN actually discussed a suicidal episode that a major Clinton Foundation employee had, simply because it was in the Podesta hack, even though it has nothing to do with Hillary's present campaign and happened 5 years ago. The media's bias seems to be whatever's salacious, not to whatever's liberal.

> The problem is that if you accuse any Mulim of anything in this country (when you have evidence or a good reason), you are called an 'Islamaphobe'..mostly because of PC culture.

Has this happened to you personally, or are you guessing? I was at a friend's apartment and he complained publicly -- with several witnesses -- about how the Muslims at the apartment across the way seemed to often be staring into his house and it made him pretty scared and he would usually get so creeped out that he would go into another room. Nobody accused him at the time of being Islamophobic, even though this is a literal fear-of-the-Muslims moment, we were all like "ooh, that's weird, I wonder what they're creeping around for." It was only after looking up what direction Mecca is in the US Midwest that we found out that this was part of their normal prayer, and now he's not scared anymore. (We actually had prematurely rejected this explanation; we were confused because his apartment is NE of their apartment, but Mecca is SE of Kansas City on a map. The issue is that they have to pray along the Great Circle route to Mecca and we're so far away from it that this actually points NE.)

> They are allowed to protest...and resign. just like BLM. Why is this wrong?

Nobody said they weren't entitled to; but why this is wrong is answered in the following sentence, "Part of what’s disturbing about both Kansas City incidents is the extent to which they illustrate the gap that has opened between police and the communities in which they work—a divide that, with horrifying regularity, produces far more disastrous and violent results in our inner cities."

Like, it makes sense for "Black Lives Matter" to trigger a resignation of some off-duty cops; you can make a tenuous case that the phrase "Black Lives Matter", even if the library wasn't intending to support it, supports a specific anti-police movement in the US. Like, I don't think that's correct but I think a police officer might reasonably believe it. But a display encouraging the reading of "books about black lives" should not be so offensive to an officer of a multiracial community that it nevertheless causes them to resign a job in a huff. If it does then it points to a serious discrepancy between the officer and the community they're policing, and if it's a systematic discrepancy then that's scary for the library itself, which presumably doesn't want to be targeted merely because they encourage people to read books about people of minority races.

> There are many Americans that choose not to go to the library. How is this the fault of the system?

I don't think the quote you quoted means whatever you think it means. o_O.

> You can't welcome an 'open and honest' discussion and then when someone discusses something that offends you, call them out as a 'racist', 'sexist', or 'islamaphobe'.

I mean, you can. You probably shouldn't, but you can; that can certainly be an open and honest reaction to various things that deserve it.

[1] https://www.youtube.com/watch?v=hWRrmAmi5AM [2] http://www.factcheck.org/2016/09/trump-pence-acid-wash-facts...

drostie··on Proof by storytelling
It's worth pointing out that the conventional formula for N choose K has a "story proof" as well, and it helps introductory students who can't necessarily keep straight whether, in these groups, order matters.

"There are N people in a room. Place a line of tape across the room dividing it into two halves; we'll say this tape goes North-South. Now ask K of them (politely, but also uniformly-at-random) to be on the East side of the tape and the N-K remainder are on the West side of the tape. We know from the definition that there are N choose K ways to do this.

"Now we ask the people on the East side to stand along the East wall and the people on the West side to stand along the West wall; along the way we will have to choose among the K! and (N-K)! different orderings for each set. So we have a uniform distribution of these people chosen from K! (N-K)! (N choose K) different possibilities.

"Now kindly ask them to walk in the order they're in to the North wall, but to remain on their side of the tape. You suddenly see that this result must be the same as simply asking the N people to line up uniformly-at-random along the North wall and you then place a piece of tape that divides them into the two groups. Every possibility in the one story comes from exactly one configuration in the other story and vice versa, therefore N! = (N choose K) K! (N - K)! no matter what N or K were."

drostie··on Total Functional Programming [pdf]
This looks like a long blog post but I will be happy to read it. ^_^
drostie··on Total Functional Programming [pdf]
> I get that being able to check for non-termination would be useful—but is there more?

It's not just that "there is more", it's that there is everything.

The halting problem which we're talking about here is actually easily generalizable into a set of generic theorems about static analysis of programs in general. The usual first step is to prove the first incompleteness theorem (no axiom system proves all of the interesting facts about the integers), then modify that into a proof of the second incompleteness theorem (that every logic which proves its own consistency must be inconsistent). But it goes way further than that to Rice's theorem: every nontrivial semantic property of a computer program is undecidable. Put another way, the only way for the compiler to know that something is true is for there to be a really simple up-front convention which makes it true.

Suppose you want to make sure, statically, that you never dereference a null pointer. This says that the only way a compiler could ever be strong enough to prove this is if it's syntactically impossible to create a null pointer in the language in the first place, so that it's a "trivial property" of all programs that they never dereference null pointers.

Suppose you want to prove that a certain block of code is the fastest possible code which does a certain thing. The only ways to do this require the language to "normalize" all of its expressions so that there is only one block of code for everything you want to do. If there's more than one way to do it, then the analysis "is this the fastest code?" is nontrivial and you can't prove it! (You can always get heuristics of course to try to cover the most common cases, but your heuristics will never cover everything you want.)

Suppose Microsoft wants to fix Word and Excel's macro systems to a new form that cannot contain viruses: the only way to do that is if the macro system is either (a) Turing-incomplete, so that you can analyze its programs, or else (b) unable to do the virusy things that you're worried about in the first place. Otherwise there will always be a macro-virus which passes the virus-checker.

drostie··on How it feels to learn JavaScript in 2016
This is kind of a cop-out, but I am constantly surprising coworkers with the (I thought simple!) things that I do with relatively old-school JS. I think if you're just starting out on a project -- any project, any skill level -- then your biggest obstacle is your own inertia, your tendency to evaluate options for how you might solve the problem, rather than just plunging right in and saying "I am going to code something, it may not be the right thing, but I am going to try to write this little function which does this little thing." (I once heard some conference speaker say something to the effect of "I found it very hard to floss until my dentist said 'hey, if you don't have time to floss between all of your teeth, please still try to floss just one.' Suddenly I'm at the mirror like, 'I don't wanna take that time to floss all my teeth... oh well, I'll floss just one to make my dentist happy... oh, and I might as well do another, and another..."). The hardest thing is to get started, which paradoxically can begin just about anywhere you want. You just have to choose something and do it. So a lot of this "what framework am I going to learn and use?" stuff gets in the way of this and slows you down from tackling this hardest-problem-that-should-be-a-non-issue. Just start with low-level JS and begin building, then let your pain in doing so guide your further choices.

Because low-level JS sucks, of course. It sucks that the DOM specifies that each node in HTML has a property .childNodes but the object that resides in that property is not an array with a .forEach() method so you find yourself either doing `Array.prototype.slice.call(x.childNodes, 0)` (in ES5, for compatibility), or `[... x.childNodes]` (in ES6 because it's prettier and more obvious what you're going for). And it sucks that HTML tables don't come with any built-in sorting mechanisms, and it sucks to be dealing with XMLHttpRequests directly. That's why these frameworks build on top of those things.

But I really think that if you're starting out, you should start out with this sucky stuff and then choose your framework based on what you learn about your pain points, rather than the other way around. If you find yourself needing to support older browsers then you will learn these cross-compilation tools; if you find yourself eventually turning it into a RESTful API written Node.js then you'll probably be OK with just ES6. Or if you find yourself writing similar sortable table widgets for the third time, you start googling "has some framework already solved this stuff?" and you eventually stumble upon the search "grid component" which will get you checking out either Vue.js, React (though you'll quickly realize that it's not native to React, there are several options there), and Ext.js, all of which have fine grid components that you might start using. Now you're doing a short research project to incorporate those things into your present workflow, which is much better than doing a long research project to decide which one of these things will be your Firm Foundation For All Things To Be Built Here.

The other huge thing about knowing plain JS is that you can start by messing with other peoples' web sites; just Ctrl-Shift-J on whatever page you happen to be on, "how would I add a little button that would replace all instances of the name 'Paul Graham' on this comments thread with the phrase 'my little pony'...? I think it would be hilarious if all these techies were talking about ponies instead."

drostie··on [dead]
You shouldn't be downvoted by the eval-is-evil folks for this; it's a legitimate question that has nothing to do with the sins of eval[1], since you're giving the page 100% full control anyway.

The answer is actually a bit common-sense after a moment: the difference between injecting a <script> and a eval() is that in the former case the code is in a file on some server, whereas in the latter case it's in a string. To hack up a solution with eval requires converting the file into a string, but to do that you need an XMLHttpRequest and to deal with origin policies and it rapidly explodes into a pointless mess because you're explicitly requesting that the loaded script have the power to interact with the context you're in, even if you're not using this power by boxing it into a context. (For example when you eval() in `function () { var secret = "this string is totally private!"; eval(code) }` that code has a power which no script tag has.)

[1] The sins of eval include ugly metaprogramming where it's not needed like `eval("someObject." + property + ".otherThing")` rather than `someObject[property].otherThing`, and accidental remote code exploits where none was intended like `var json = eval(thing_i_dont_actually_trust)`: whoops, someone passed `(function() { ... }())` instead of JSON and it went straight through my parser.

drostie··on Let 'localhost' be localhost
You can address them with whatever domains you choose; suffixing them with .localhost is no better than suffixing them with .local, .loc, .qwyjibo, or not suffixing them at all: these are merely personal choices you made to give the domains some look and feel, but they aren't intrinsically privileged by the system.
drostie··on Let 'localhost' be localhost
You know that you do not need to use that naming convention, right?

You might as well set up domains for www.pocalhost, files.pocalhost, doc.pocalhost.

Or, why even have that part at all? You can just as easily set up the hosts record in /etc/hosts for www, and then visit http://www/ and it should work just fine on both Windows and Linux.

drostie··on the will license
Variant of http://www.wtfpl.net/txt/copying/
drostie··on Bad Poems
Kind of reminds me of:

Train approaching

Whistle squealing

Stop

Avoid that run-down feeling

Burma-Shave

drostie··on So You Want to Be a Hero?
That's indeed what I remember as well, but in at least one of the sequels it made sense to transition to a fighter to gain the paladin powers on top of the rest. Playing for maximum freedom was actually incredibly constraining in certain ways; I vaguely recall that you get forced by class into a specific endgame for Trial By Fire.

I have to mention to anyone who stumbles across this comment that there have been remakes. The QfG1 remake in 1992 was okayish, but I personally preferred the 16-color version in all its limited glory. But the QfG2 remake in 2011 was worthy of multiple replays just like the original was:

http://www.agdinteractive.com/games/qfg2/homepage/homepage.h...

QfG3 is still playable via DOSBox if you can get a copy of the software. I want to play QfG4 again and I unfortunately have never played QfG5 as it landed when I was broke... but I did get a copy of the soundtrack via some filesharing network at the time, and Chance Thomas's work on that soundtrack was absolutely gorgeous.

drostie··on Researchers quantum teleport particle of light six kilometres
Are you still comfortable with this explanation if the photons are released with a 1-second gap between them and the tally is visibly shown building up into the interference effect on a computer screen? "Interfering with each other at an enormous rate" might mislead you a bit; neither "each other" nor "enormous rate" is particularly important in the double-slit interference pattern.
drostie··on Researchers quantum teleport particle of light six kilometres
Let me give you a couple pointers; I did my Master's thesis in quantum transport.

(A) Measurement and observation is NOT a simplified term for a well-understood complex process. It is an atomic term for a not-well-understood (therefore maybe simple or complex, we don't know) process which is really extremely simple if we take it at its surface meaning and don't poke inside it too far.

Let me take the simplest example, the Stern Gerlach experiment. This is really simple: put two long magnets next to each other with a "gap" between them, and preferably give them very different shapes; this creates an "inhomogeneous magnetic field" between them. It turns out a spinning electric charge, when it comes into such a field, should get deflected based on the direction that it's spinning.

Fire a beam of electrons at this apparatus, and you'll notice something interesting. Let me give some coordinates: if the gap between the two magnets is "horizontal" and the electrons go through it "forwards", they split into two beams, half going "up" and half going "down". We say that these have 'spin up" and "spin down" but that depends on a bunch of little arbitrary choices. If you put another apparatus "horizontal" in front of either beam, you'll notice that those ones going "up" all go "up" through the second set of magnets; likewise for the ones going "down".

So there's a lot to unpack here: first off, if they were normal spinny things, then this separation into two beams is really weird! Because what about an electron that's spinning "forward" or "left"? Why wouldn't nature recognize that mathematically it's spinning just as much clockwise as anticlockwise, vertically, and not deflect it up or down at all? So there should classically be lots of particles deflected between these two beams: it is very strange that this does not happen! In fact we can perform the experiment. We can use a second Stern-Gerlach magnet, this time oriented vertically, so that it deflects electrons into 2 beams going left or right, call these "spin left" and "spin right." Now we take the spin-left electrons and first put them through a vertical Stern-Gerlach magnet, make sure they keep going left, great. We just rotate the magnet and we find half of them go "up" and half of them go "down." Nature doesn't know the difference between "left" and some sort of 50/50 mixture of "up" and "down"; those are the same to Nature, at least where an electron's spin is concerned. And that finding is very robust: "up" is a 50/50 mix of "left" and "right" so if you use another Stern-Gerlach magnet on the electrons that went left and then up, you do NOT see them all go left again! They will all go up if it's horizontal, but they will not all go left if it's vertical. Instead half of them go left and half of them go right!

Now, we have a very folksy understanding of what we mean when we measure these things: we stick a very sensitive electron detector in some place, connect it to a counter, and we watch the counter erratically tick upwards. Of course it is so sensitive that it ticks upwards due to all sorts of other noise sources, even without a signal, but when we turn on the electron gun we start to see that in some places, pointed at the place where the beam hits the gap between the magnets, it starts rising much faster than the noise would provide, and in some places it doesn't rise any faster at all; it's all attributable to noise. That's how we know there are these two beams coming out; we move this detector around and see some peaks in the detection rate.

Now, a lot of our explanations of how the electron can do all of these weird interactions with the magnets, depend on saying that the electron does not just take one path at one time! Instead maybe it is "spread out" in space or it "takes all the paths available to it" or something -- these funky interpretations make the rest mathematics used to describe the electron unbelievably simple, you just have these "unitary transforms" and this "linear evolution" and all of that complicated quantum mechanics stuff is super-simple mathematically. But when we measure, we just see this counter jittering upward with highly unpredictable increments but with some very predictable average rate. Most of those clicks we'd like to think are actual electrons which have made up their mind to take this path or that path and have successfully made it to the counter. How this happens, is something of a mystery. If the electron takes all paths, why does it end up here or there? If it's spread out so that it's half on this detector and half on that detector, why do we see the counter increment and not, say, fuzz between the two numbers, having half-incremented and half-not? Why isn't our world more fuzzy, if it's made out of these fuzzy probabilities and amplitudes at its core? And yet why, when we use scanning tunneling microscopes, do these electron clouds of these atoms look like little balls, as if those electrons really aren't spread out over all that space but occupy one single place all of the time?

The mystery comes because there's a lot of really easy ways to explain this funky Stern-Gerlach stuff, but most of them view the world in a way that's alien to our own. The measurement problem is "we know how measurement works pragmatically, and it never showed us this alien world before, so how is this alien world 'collapsing' into the familiar world that we all know and love?"

(B) Entanglement has to do with strange correlations between remote systems which you can only notice when they are brought back together. My favorite example is a game where 3 people compete as a team in several trials where we secretly put them at cross-purposes to each other, call it "Betrayal." We split the team of 3 people into 3 separate rooms and we prohibit communication between team members. Each room has a screen that we display a goal on, and two buttons labeled 1 and 0. Sometimes the displayed goals for an individual and the actual goals for the team will be at odds; the individual never gets any reward in these cases: it's only, "if the team gracefully recovers from our meddling 100 times in a row, we will give them all a big cash prize."

Okay, so how do these work? Once the people are settled in their rooms, 1/4 of the time we will broadcast a "control round" where we tell them all "make the sum of your three button-presses even," and start a countdown timer. They win if they all push exactly one of their buttons once before the time is up, and the sum of their pushes is even. Really simple. Then 3/4 of the time we will choose one of them at random to be a "traitor" to the other two: we tell the traitor, "make the sum of your three button-presses even," but we tell the others "make the sum of your three button-presses odd," and the team wins only if they each push exactly one of their two buttons once, and the sum is odd."

It's easy to prove that you cannot win this game more than 75% of the time classically; each of the 4 situations is represented by some equation among the 6 correlated random variables, but when you add all 4 equations together you find out that they reduce to 0 = 1, an obvious contradiction, so they can't all be simultaneously satisfied no matter how you correlate the random variables. It is also easy to prove that if they all start out with a class of entangled states called a "GHZ state", such as

    |+++> + |---> = |000> + |011> + |101> + |110>
then they can either measure their state to get an even sum, or any two of them can perform the unitary transform mapping |+> to |+> and also mapping |-> to i |->, yielding the state

    |+++> - |---> = |001> + |010> + |100> + |111>,
and then any measurement must yield an odd sum. The two who are told to make the sum odd can do this with absolutely no help from the one who does nothing to make the sum even. In theory, the only limit to your accuracy is how long you can keep these GHZ states away from outside noise and disturbance. And of course we can account for that by only requesting that you pass, say, only 90% of the trials successfully -- with enough trials we can still prove that a classical team with their 75% upper bound on success in individual trials will almost always fail whereas a quantum team whose tech is good enough to get to a 95% success rate will almost always pass enough trials.

But, you can't use this spooky collaboration to transfer information faster than light. And that's precisely because you can't discover that the two measurements are correlated until you compare them! We instantly correlate but we aren't instantly aware of our correlation; I can't figure that out until you send me a message saying, "hey, is your set of numbers X?" and I say "yes it is! woah! spooky!"

drostie··on Closing in on high-temperature superconductivity
Yeah, basically. From what I can tell given some work I've done in a related field, what's happened is that they found a new way to do the math in a theoretical model some long time ago, and it revealed some cool new predictions within a certain temperature range, as well as some equivalent of high-T superconductivity at some other temperature range.

Now they went to test it, which they did by supercooling potassium atoms while using lasers to force them into one place. (Conveniently you can also use lasers for refrigeration though I'm not sure if they did.) Then they switched the lasers to describe a big 2D standing wave which the potassium atoms spread out into, forming a square grid. These are called "optical lattices"; they're difficult to work with because you don't have anything small enough to really poke at individual atoms and even if you did you'd have to deal with how the lasers are blasting your poker left and right... so, you just have to kind of throw your hands up, "I am not going to care about any of these individual atoms." However, you get some nice bulk properties: for an easy example, if you just turn off the lasers and let stuff drift and then image it, they all basically started from the same place and drifted according to their velocity which is proportional to their momentum, so you can get an image of |ψ[p]|², the momentum-space distribution of the wavefunctions of the individual atoms. So that's cool. But basically you have this tiny little dot of well-arranged well-controlled particles, but you can only do bulk operations on them (including e.g. bulk entanglements by bringing pairs of rows closer together by messing with the lattice and cool stuff like that).

While I'm not clear what the theoretical predictions were, exactly, apparently when they pushed the system into the first temperature regime described above they discovered whatever their theoretical model predicted. Hooray! This has given them some small confidence that maybe their theoretical model is a plausible step forward for understanding high-T superconductivity.

drostie··on If TypeScript is so great, how come all notable ReactJS projects use Babel?
The other nice thing is that bigger monoliths often (not always) make opinionated decisions. This is usually a good thing.

In my work I deal with a legacy system with an ExtJS GUI. The two ways that ExtJS fails to be opinionated are perpetual pain points for me and my team! One is: every component has a million optional configurations, not to mention all of the events you can listen on. For the most part this is great, but there was never any systematic separation for "here are the absolutely-required things, there are the things which are optional but must be configured together, and over yonder are the things which are totally optional." Then you could require that the required-configs were, say, statically known when you were deriving a concrete class from an abstract one. Instead ExtJS wanted to accept doing all of this stuff at runtime, so because it failed to take a strong stand on its required configs, when you inevitably forget to configure some of them, you get an error puked out from somewhere very deep in the framework, where the call-stack and error messages show nothing related to your class at all, just "TypeError: SomethingYouNeverCaredAbout is null." It would have all been saved if `Ext.define` looked for some "abstractProperties" array, and made sure that every new `Ext.define` either set abstract properties or propagated them, finally checking that whichever ones are still present in the `Ext.create` call are filled in. Simple descriptive error messages are then available when you forget a required config.

The other way ExtJS violates the principle is... God help you if you ever have to figure out how the underlying form submits and grid reloads actually work. You'd think with something so critical, it would be clear... it's not.

"My grid refreshes automatically when the underlying store loads. Great! The underlying store can be loaded or reloaded with the .load() method, which accepts a callback. Wonderful!" It starts off very promising. But then you dig deeper and find that the .load() method packages the params and the callback into some object and then calls some .read() method which doesn't exist on the class you're looking at (inheritance! go up to the superclass!). Once you've traced that down the actual .read() bounces to some .doAction() which repackages these into some `Operation{type: 'readAction'}` or whatever... and then this gets handed up to some Proxy object which then stores it in some meaningless array, because of course these things get batched together... if you're not sick yet you find out that the Proxy needs to push the stuff to some Reader and Writer, just in case you wanted to communicate with the server via XML instead of JSON, or wanted to store the resulting array under a key not named 'results'. But you don't want to do any of this because the query finally gets XMLHttpRequested somehow (God knows how) to some `router.php` which we stole from IBM[1] a long time ago, which finally took a stand, "I will accept these two inputs, send them to the backend this way, and emit one of two corresponding outputs." (Except for that then you open that and it contains code for some sort of `doAroundCalls` because apparently the original author[2] decided to vacillate on what they'd accept, trying to also allow you to bookend one RPC service with two other RPC services, which never happens because Ext.JS never does it!) It gets a little more complicated because there is one rather significant bug which nobody has ever fixed in IBM's router.php, which is that formHandler services get the $_POST params (an associative array) as their first argument whereas XMLHttpRequests get the `json_decode($HTTP_RAW_POST_DATA)` (a StdClass object) as their first argument, so there's no interoperability on the frontend or the backend. Happy debugging, you. It's all one big mess.

You begin to wish ExtJS had done what they eventually ended up doing[3], and just told people, "here is how you're going to do this thing. We have a Java router, a PHP router, here is how you set up your backend on these platforms..." That would have been very bold since ExtJS was originally just a set of helper classes to help automate GUI stuff with YUI, so I understand that the history made them feel a bit shaky about doing that, but... I really don't value that there's 10 layers of abstraction just in case I want to transmit the same stuff over-the-wire in XML rather than JSON.

If any developers of toolkits are reading this: please, please consider very firm protocols: "here is what you're going to send me, and here's what I'm going to respond with." Because, half of programming anyways is translating outputs to inputs; we all know how to write the adapters which connect the two. Please make your life really simple by not supporting a million different ways to do the thing. I promise, you're also making my life simple because even though I will grumble about spending a half-day writing that adapter, I will then save untold dozens of half-days because the overall architecture is modularized, "oh there's a bug in the adapter, my bad, but it's only a 5 minute fix." My communication with you must pass through a gateway; please limit me to only a very small choice of inputs which you are going to tolerate, and break very loudly at the gateway when I forget some of those. It's far better than having a nigh-undebuggable error somewhere in the middle of your framework code that I never want to read.

[1] http://www.ibm.com/developerworks/library/wa-aj-streamline/

[2] This could be Dan Dallala of Microsoft? His Gist appears to be an older version of the file and is one of the top results when googling strings out of the source file...

[3] It's not complete as to how the backend should be set up, but at least there is now a documented interface for this Ext.Direct communication. https://docs.sencha.com/extjs/6.0.1/guides/backend_connector...

drostie··on Cornell wants to drill 2-4mi underground for enhanced geothermal heating
I think it's more compelling, however, to just think about how much bigger the interior of the planet is than our existence at the surface.

We live on maybe ±1km of the surface or so; we don't dig much deeper than that except perhaps when exploring very deep caves or so. The radius of the Earth is approximately 6300 km. One volume is (4 pi/3) R^3 and the other is 4 pi R^2 dR, so the one volume is larger by a factor of 6300/3; we can only hope to visit one two-thousandth of the Earth's total volume with holes 1km deep. Up that to 10km deep and you'll still only get one two-hundredth of the Earth. Oh, and we've only got about a third of that because oceans.

drostie··on Simulation, Consciousness, Existence (1998)
Sorry, what is the "objective, logical, correspondence-based meaning" that you're referring to? Moreover, you've already laden a lot of interpretation in there, "1kg" vs "2kg", "counterbalance".

Let me put it to you a different way: suppose that I put two bags of some substance on one side of a beam attached to a fulcrum, and one bigger bag containing a substance that looks similar, on the other side of the beam. Suppose that the beam continues to tilt such that the bigger bag is resting on the ground. There are definitely some observer-relative ways to read this situation; but is there an observer-independent way to read it, which goes beyond what I have already said about it in this paragraph?

drostie··on Simulation, Consciousness, Existence (1998)
I am very happy to see this at least bring up one of the most strange parts of Everett's many-worlds (and others' "many-minds") theories: that in them, you are immortal; for there always exists a possible world which you didn't lose consciousness in, and your final consciousness will only propagate into those worlds.

Searle's objection still seems to hold some water, though. Consciousness does not seem to be a computation because whether something is a computation is observer-relative; for some observers this set of electrical flickering makes sense as a computation to produce a sunflower-like pattern of points based on emitting branches in directions of (pi * the golden ratio) radians... but for the vast majority of observers probably it doesn't seem like anything until I print out a picture of the result; and even then it might not mean anything to those observers (they might be blind, or they might not associate it with sunflowers, or they might have alien brains so differently wired from mine that they simply cannot appreciate art the way that humans can). We actually have formally defined computation to be observer-relative in precisely the way that the status of what words a book contains and what those words together mean is observer-relative (think that in some other parallel universes the English language was exactly the same but that the words for 'cat' and 'dog' were transposed, and so this same book tells a somewhat different story in those worlds).

The problem is that my two bunnies seem to be quite conscious, to say nothing of myself or my girlfriend. It's not just that they're conscious-relative-to-me-but-it-depends-who's-looking... if that's true then it's a very different perspective which almost nobody takes seriously and practices. My bunnies just seem to be conscious, full stop. They appear to have both interests and the capacity to feel pain (observer-relative consciousness), but it appears to be more than just an appearance! In some sense they are objective observers who their own consciousness is relative to; therefore they are objectively conscious in a way that computations just don't seem to be objectively anything.

The hope of the functionalist approach to consciousness, with its common-sensical "anything which could replace this airy-fairy consciousness stuff in all of its functional roles would be equally justified to be called conscious," is therefore that as processes with no-intrinsic-meaning become more complex and more involved, there is some way to say "no, the parts of that don't have much intrinsic meaning by themselves, but you put them together and then this thing is objectively computing X or Y, there is just no other way for an observer to view it, it has passed a complexity threshold beyond which there is only one interpretation of it." Our books, with the cat <-> dog substitution looming in our minds, clearly don't pass this threshold by-and-large, but perhaps things more complicated processes than those books' narratives can?

drostie··on The Fourier Transform and its Applications
Actually probably one of the best simple ones is Scholarpedia's article: in particular it covers one of the things that are kind of at the periphery of a non-applied statistician's mind when using cumulants: how the log-normal distribution serves as a handy counterexample to just about everything you'd like to prove about them (e.g. with some tweaking you can prove that the log-normal distribution's cumulant expansion is not unique, therefore you have an injection from PDFs to cumulants, not a surjection).

Something I've never seen rigorously explored: Cumulants appeared in my Master's work in condensed matter, where they at times seemed to have a mysterious tie to Feynman diagrams; that is, there seems to be some sort of analogy between how the Nth cumulant "subtracts out" all of the components of the Nth moment which are just products of the previous N-1 moments to obtain something "additive", and a Feynman diagram containing a vertex joining N particles. In particular Feynman diagrams for pairwise interactions seemed to be eerily similar to cumulant expansions which did not have any 3rd or higher moments. I confess I totally forgot this until I Googled today and saw a question on Math Overflow about it, but it was too sketchy to show me a real satisfying resolution of my mental curiosity. Similarly I remember seeing Young tableaux in some lecture notes on cumulants and then the day after I was working with Marcin Dukalski on some crazy approach he was taking in his thesis, and he spontaneously started talking about "hm, what do the Young tableaux look like for that?" and I was only able to help at all because of some limited understanding from the previous day's reading! So... there's definitely some mathematical resonances when you get to quantum theory.

drostie··on The Fourier Transform and its Applications
One of the fun ones, and this may or may not be covered by the link, is generating the "cumulants" for probability density functions. The basic idea in (basic, continuous) probability theory is that you have these things called "random variables" X,Y,Z which now need to be thought of taking on values with various probabilities; and the way we do that is to use calculus (where the d- in "dx" is a special notation coming from the word "difference"; "dx" means "a tiny little change in x"). The basic idea is that there is some joint density j(x, y, z) such that the probability that simultaneously x < X < x + dx, AND y < Y < y + dy, AND z < Z < z + dz, is simply given by j(x, y, z) dx dy dz.

With a bit of calculation you conclude that if we want to analyze Z = X + Y, then the probability-density for Z alone must be h(z) = ∫ dx j(x, z - x); there are a couple ways to do this but my favorite is to use Z = X + Y as a schematic to write a Dirac δ-function j(x, y, z) = j(x, y) δ(z - x - y), then the standard "what is the probability-density for Z alone? integrate over both x and y!" rule comes into play. But you can also reason it out by hand, if you want.

Anyway, then you come up with this cool definition of independence; X and Y are independent if j(x, y) factors nicely into f(x) g(y); independent probabilities tend to multiply. So that's cool.

Now here's where the Fourier transform comes in; consider using a convention where we denote the Fourier transform and with the same function-name but using square brackets rather than parentheses for its application,

f[q] = ℱ{p → q} f(p) = ∫ dp exp(-i p q) f(p).

When we Fourier-transform h(z) for Z = X + Y we get:

h[a] = ∫ dz exp(-i a z) h(z) = ∫ dx dy exp(-i a (x + y)) j(x, y)

and if the two are independent random variables we find that h[a] = f[a] g[a]; the sum of independent random variables has a product of Fourier transforms precisely because the above sum takes the form of a convolution.

Taking a logarithm, we have that the χ(a) = log h[a] = log f[a] + log g[a] and any properties of the logarithm of the Fourier transform of the density function must be additive amongst independent random variables. And this gives the cumulants of the random variables: pseudo-linear expressions (linear in independent random variables f(X + Y) = f(X) + f(Y), with f(k X) = q(k) * f(X) for some fixed q) which characterize the different "moments" of the random variables in question. In fact if we look carefully at the definition h[a] = ∫ dz exp(-i a z) h(z) we see that the variable P = k Z, having distribution b(p) = h(p/k) / k, generates b[a] = h[k a].

Calculating the zeroth, χ(0) = log h(0) = log 1 = 0. No biggie. Continuing the Maclaurin expansion gives χ'(a) = h'(a)/h(a) and at a=0 that's -i E(Z). We knew that the expectation value was linear, so no surprise there. The next term is (-i)^2 [h''(a) h(a) - h'(a) h'(a)]/[h(a) h(a)] which works out to just E(Z^2) - E(Z)^2, the familiar expression for the variance; so variance is pseudolinear (in this case q(k) = k^2). The point is, then you can just go on. There are in fact infinitely many pseudolinear cumulants which scale like q(k) = k^n, coming from this Maclaurin series, with a pattern based in fact entirely on the pattern of derivatives that comes out of log(f(x)).

As a freebie you have a proof of the central limit theorem. Take N independent identically-distributed random variables with characteristic functions χ(a), call them each X_i, form their sum S = sum_i X_i / N, and from the properties we've already seen in this comment its characteristic function must be ψ(a) = N χ(a / N). Do the Maclaurin series to 2nd order and ignore the latter terms for large N; you get convergence to a parabola, which means that the Fourier transform of the probability density is... a Gaussian! And the inverse Fourier transform of that Gaussian is just another Gaussian, so for large N the result must be a normal random variable with mean μ and variance σ²/N, which of course is what they must be, because means are linear and variances are pseudolinear.

drostie··on REST Anti-patterns
I like to think of DELETE as "if the response to the DELETE is 200-level then further GETs to the resource should be at the 400-level." Call those responses to GET requests "2XXing" and "4XXing" respectively.

Similarly a PUT should make sense whether the underlying resource 4XXes or 2XXes, and should in either case make it 2XX with the same response.

Then POST is just a verb which does not share these semantics at all; POST <url> can be done on a URL which either 4XXes or 2XXes, and even if the post succeeds that's no guarantee that the underlying URL will now exist. POST /update-caches for example might not change the HTTP statuses of anything.

drostie··on REST Anti-patterns
I mean, we're running up against one of the problems which metadata systems have to deal with, which is that metadata about an object really "lives" in parallel with that object, and not really "contained within it". But usually you just think of an object as containing all of the metadata we know about it so far, and under that model this makes perfect sense.

To do this in 100% RESTful style you would therefore probably store details about how an account was closed in the /accounts/440278/closed reference, so a PUT is correct, with GET /accounts/440278/closed returning either a 404 for accounts which are not closed or else the metadata about how the account was closed. This could live in parallel with a cache that's on the resource itself describing whether it was closed or not.

So, POST or PUT, with the PUT exposing more of the metadata interface to REST and POST putting more of it in the request bodies themselves.

drostie··on Maths in a Twist [pdf]
The cutting solution is a bit more easy to follow, in my opinion...

http://imgur.com/gallery/eBQq4

drostie··on Maths in a Twist [pdf]
Correct. If it helps, the given diagram clearly has exactly one edge and exactly one surface.
← PreviousPage 6 of 34Next →