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 Logic Theorist
Just to give the proof as a whole in this notation for others, assume (→) has lower precedence than (∨) and is right-associative (i.e. that a → b → c = a → (b → c)):

  Proving: (p ∨ q → p ∨ r) → p ∨ (q → r)
  Start from:
    (x → y) → (y → z) → x → z
  Replace x with q, y with p ∨ q, z with p ∨ r:
    (q → p ∨ q) → (p ∨ q → p ∨ r) → q → p ∨ r
  The first part (q → p ∨ q) is already a known tautology so via modus ponens
    (p ∨ q → p ∨ r) → q → p ∨ r
  Replace the last → with its definition, (a → b) = ¬a ∨ b:
    (p ∨ q → p ∨ r) → ¬q ∨ p ∨ r
  Use the commutative property of (∨):
    (p ∨ q → p ∨ r) → p ∨ ¬q ∨ r
  Then use the definition again:
    (p ∨ q → p ∨ r) → p ∨ (q → r)
  QED.
The first part is also valid in intuitionistic logic and essentially just transforms a known truth `x → y` into "continuation passing style" `∀z. (y → z) → x → z` with a valid result, I think this is why the authors were quite pleased with the proof.

The second half is the shifty bit for intuitionistic logic, going from `q -> Either p r` to `Either p (q -> r)` where it's really easy to see that you could not, say, have a Haskell function of that type generally.

drostie··on Mastodon WTF timeline (2017)
No see it's not quite true for either side.

It's called "outgroup homogeneity," when you are part of an us-vs-them scenario your "us" always seems to be a coalition of diverse viewpoints whereas your "them" is a single collective viewpoint.

So for example if you are in a team of white males you might want to get a token black person or a token woman on your team to "bring the black perspective" or "bring the female perspective" to whatever you're working on: that's a systematic bias, you're implicitly assuming that there's not going to be a diversity of black/female perspectives the way that you already know there's a lot of white male perspectives.

In fact the broader issue that will lead the US inexorably to civil war even if present communications difficulties abate is that we do elections by dividing our electoral bodies into independent seats and then run first-past-the-post elections for each seat. The issue is fixed-point theorems. Each election is a polity -> polity map; the fixed point of split-FPTP-elections is a polity which is 50% one party, 50% the other party, both parties are completely spineless chameleons which shift however they need to in order to maintain the 50/50 status quo, and people are loosely affiliated with one party while disgusted by the opposition. As the first US civil war showed, this disgust will naturally build without bound until the highly prominent issues at the time cause movements toward secession which then lead to active conflict.

I was going to say "if you're coming from a place that does proportional elections this probably seems like nonsense to you," but that is my own outgroup homogeneity effect rearing its ugly head again! The truth is that even proportionate systems have problems with this sort of divisiveness; witness Brexit in the UK and Geert Wilders in the Netherlands for two examples. But I would insist that there is a characteristic spinelessness that pushes this further from just "we are one nation with serious divisions to reconcile" to "they are awful and we will never reconcile, let's just get a divorce" in the US system.

drostie··on The Tyranny of the Rocket Equation (2012)
In six years nobody has corrected the fact that one of the propellants listed is not "Methane-Oxygen" but "Earth orbit to near-Earth asteroids", and the following is not "Methane-Oxygen" but "Hydrogen-Oxygen."
drostie··on I'm Scott Aaronson, quantum computing/computational complexity researcher. AMA
Hi Scott, I first stumbled across your blog while I was across the pond doing my Master's in Delft; it looks like you've been relatively successful since then.

I was wondering how you feel that success/celebrity has affected you. Does it actively drive you to something other than research -- say, are you viewing it as a building block to maybe publishing a book or so? Or does it feel like a distraction from research in that "oh why do I have these arguments online" way that we can often fall into?

drostie··on World Airports Voronoi (2014)
I'd guess more likely that they are chocolate nozzles -- it seems more straightforward to me to produce a precise chocolate "cup", pour or place the filling inside of it, then pipe a chocolate "lid" onto the cup. Presumably the multiple nozzles of chocolate would help it to settle flatter faster.

Edit: there's a video on Facebook that covers the whole process in a minute. My hunch is partly right: the wrapper and chocolate cup are indeed completed first, then a circle of peanut butter is indeed placed in, then the thing is shaken to encourage that peanut butter to fill the space uniformly. However the chocolate "lid" is just plopped on as one wide dollop from a hose, and then blown out across the cup with compressed air: so the Voronoi cells probably come either from this blowing phase, or else the hose has some sort of "spreader" inside of it or so.

drostie··on Why emergency braking systems sometimes hit parked cars and lane dividers
Yes.

That can be how a distant technology looks, if the stakes for failure are that people die.

You can get early adopters from one tail of the bell curve, hype, working prototypes, and people dying because prototypes fail. There may be a churn of companies... "We know that AlphaDrive and BetaDrive both killed people but we here at GammaDrive want to reassure you that we're totally committed to your safety!" "But that's what BetaDrive said." "Yeah but we REALLY MEAN it this time." "Wait, what to you mean, 'we'?" "Um, nothing..." "You hired BetaDrive's employees when they went out of business, didn't you?" "Uh... Oh would you look at the time!"

With that said I don't know Cruise and maybe they're doing better than Tesla.

drostie··on Price's Law: Why Only a Few People Generate Half of the Results
I liked the intriguing idea of how this article started but it did end on a cop-out, “now that I have suggested this phenomenon rather than understanding what causes it so that we can harness it in practice, I invite you (what must necessarily be the majority of my readership if the pattern holds true) to quit your jobs!”

It would be very interesting to work out a probability distribution f(r), 0 < r < ∞ support, such that when sampled N times independently half of the total sum is contained in the top √N terms. Like I would suspect it can be done with long-tailed distributions, though they might need to have an undefined cumulant or so... just that trying to set up that “sum of the top √N” integral sounds very tricky in a way that would foster some clever insight.

But of course the more likely explanation would probably have something to do with network effects. If you imagine that each person is a morphism (or a bounded number of morphisms?) in a category for example, perhaps whose objects are indirectly profit centers, then having N profit centers correlates to having N objects that your company relates, which correlates to N^2 employees connecting them together, so if the top 50% of profit resides in some fixed number of these objects, then only the ~N employees out of the ~N^2 who happen to deal with these “cash cows” would make up half of the profit. To detect this you would want to show that rather than linearly scaling with employees, the returns to scale might show a characteristic pattern of profit versus company size.

drostie··on Linux Cryptography: Speck's real standing with the academic community
Oh there are so many reasons. The easiest is the adoption problem, the same as hit HTTPS: at least 40% of top websites are still unencrypted even after a massive push from browsers to muscle them into submission; compare to the fact that with no massive push 90% of the ones that do support HTTPS don’t support SSL (they only support TLS, the old standard having severe security flaws). In other words there are concrete numbers to back up the point that when an algorithm is learned to be broken, it is easy to convince panicking folks to upgrade it. But when it simply doesn't exist and hasn't ever, it is harder to convince folks that they need it.

Even more to the point, attacks do not exist in isolation and there is no “secure/insecure” dichotomy. You can see this with AES where the AES-256 key schedule is much weaker than the AES-192 key schedule, but the place where this really shines is in related-key attacks, where AES-192 has about twice the bit-strength of AES-256. Does that mean you should switch over? Well, probably not: related key attacks are structurally harder to pull off.

The qualitative differences make comparison hard. Probably if the NSA had an exploit for Speck for example, it would take the form of "steal the device running Speck for an hour to get some carefully chosen challenge-response pairs, return it back to the user, budget a day or two of time on the supercomputer to look for patterns in that data, and finally you can recover the key." (I say this in part because it’s hard to hide backdoors in symmetric crypto.) Many applications would be more secure than nothing if that were the only applicable threat model.

But even quantitatively, in theory security is not a binary. It's much closer to a dollar amount: here is how much it costs to launch attacks against this system. And $0 on this scale is certainly lower than a serious vulnerability at the $100,000 level.

Basically this is a solid argument why you should not roll your own crypto but those arguments are categorically not transferable to crypto whose specifications are known openly and subjects of active cryptanalysis.

drostie··on Passive Wi-Fi: Bringing Low Power to Wi-Fi Transmissions
If I'm understanding it correctly then the answer is not much more than our present system. You get low power consumption in your device by being parasitic on a high-power monochromatic antenna furnished by the local WiFi.

There might be interesting attacks with other high-power antennas in the region creating pockets of destructive interference -- essentially localized denial-of-service type stuff.

The other risk you're taking is something like "the operator of this antenna can induce bit flips and such in your communications," which is true, but they wouldn't know what bits they're meddling with because they have to commit to the inconsistent signal before you use it. But they can already send arbitrary local packets pretending to be you at that granularity. Certainly if we're talking about the signal source managed by the WiFi operator, there is no dispute that this doesn't empower them -- they own the router, where they already have direct control over your internet communication and what they "hear from" and "say to" you.

Compared to the threat of opening your own access points with a suggestive name and just letting people connect to you, which you can also do with this range, being able to meddle with packets in a haphazard way doesn't seem very scary.

drostie··on Why soap bubbles are colourful and windowpanes are not
I mean, the spectrum still has a width, it's just a very large width -- which is why the coherence time is very low.

In a more abstract way, you're right that we are reaching for a metaphor here: if a frequency distribution is sharply peaked around one frequency then we can roughly say that the light "is that frequency" but then modify this by saying that the bits that are off-frequency, while they are "also that frequency," become "phase-incoherent" after a characteristic time or distance. That is not actually correct; they are simply different frequencies -- but it makes the interpretation easier. That metaphor begins to break down when you've got such a wide spread of frequencies: red light can only "pretend to be" blue light for a vanishing period of time.

To put it more plainly, the phase-coherence time is the inverse of the spectral width in frequency-space; multiply it by $c$ to get a phase-coherence length. If you applied it to a truly monochromatic ideal source, you would find that the time and length are infinite -- it only makes sense for real distributions with normal spread. But that's all distributions, including blackbody distributions like sunlight -- it's just that those distributions have very large spread and therefore very low coherence lengths: but it's the same definition either way.

drostie··on The Big Vitamin D Mistake
I mean, it does. The "fairy tale" that one hears in high school doesn't, but we put aside fairy tales when we became adults.

If you are done with the "undergrad level" of Popper and Kuhn it is worth reading Imre Lakatos's work on philosophy of science. It contains a moment where one realizes that research programs live or die by this "impact factor" and that this living or dying is a key part of the overall methodology of science. The gist is that science is actually participating in a survival-of-the-fittest evolution with certain foundational ideas as the "genes" which "reproduce". So scientific ideas are actually good or bad in no small part due to their ability to create further scientific research along similar lines. A low impact-factor therefore directly says "along this particularly important-to-science axis, this journal sucks."

drostie··on PHP 7.2.0 Released
The other thing is that they have partially fixed the most "wat" bug in PHP: for some arrays that aren't even all that hard to come by when interacting with JS, the following code could change `count($arr)`:

    foreach ($arr as $key => $val) {
        $arr[$key] = f($key, $val);
    }
The issue is that `$key` could be a string describing an integer, but `$arr[$key]` will automatically see that you're using a string-int and convert it to an int-int, setting a different key than the internal one.

It's only a partial fix but it hits the most common case: you have a JSON payload that happens to have an index of objects which happens to have been given numeric keys:

    {
      "abcdef": {"prop1": "hello", "prop2": 123}, 
      "987132": {"prop1": "world", "prop2": 456}
    }
If your framework hands JSON to you as a StdClass object then you would typically convert this to an associative array since that's semantically what it is: as opposed to the internal entities, which in this case appear to be full-fledged objects. (The difference is that the keys of a full-fledged object should be known in advance at a data-schema level and have a control structure of getting/setting `->prop_name`; the keys of a dictionary should be user-settable and have a control structure of `foreach ($dict as $key => $val) {}`.)

So the bug still maybe exists in some fringe cases as the underlying cause is not treated, but it is now autofixed by the common idiom of casting `$dict = (array) $params->dict`.

drostie··on About the security content of Security Update 2017-001
It's "log in to," as "log" is a verb whose meaning changes when it accepts the preposition "in".

Dutch has this much more systematically than English, where when this happens you can form the infinitive for the verb by prepending the verb with the preposition. So "someone who breaks in" would be an "in-breaker" and the infinitive form is "to in-break". (In modern English one would have to say a "breaker-inner" to convey the idea of one who breaks in.) Similarly the Dutch might look at the verb "with-hold" and assume that you would say "the company held with that information, not disclosing it" rather than "the company withheld that information."

Anyway, since the verb is "in-log" you "log in", as opposed to the conventional meanings for the verb "logging" (writing down something or clearing trees) where you might "log into" (respectively writing down into, or clearing trees from).

drostie··on Disable transparent hugepages
Hey, thanks for being a FreeBSD dev. Every time I've been on a FreeBSD system my reaction has been "this is kinda weird, but really nice." (Especially, compiling from ports.) The fact that y'all are connected with academic communities who can solve these problems in more principled ways is really wonderful, as are the BSD/Solaris attitudes of "hey let's wall off things that don't need to interact" and "the kernel is the most important part, but it's not the only thing."
drostie··on Love Your Bugs
If you like bug postmortems like this you may also enjoy the Jepsen presentations by @aphyr. A video summary is available here:

https://www.youtube.com/watch?v=eSaFVX4izsQ

and if you want to get into the weeds with any of them these are largely published publicly on aphyr.com; see for example:

http://jepsen.io/analyses

There's a lot of "oh, here's how this dirty read from the underlying system became a much bigger bug in the system we built on top of it!" but what I like most about Kyle is that he is generally pretty great about having an attitude of "these are actually really hard problems and it's not surprising that there are implementation bugs when you let me mess with the clocks and cut off nodes and whatnot."

drostie··on Time Inc. Sells Itself to Meredith Corp., Backed by Koch Brothers
This position is not indefensible but it is hard to defend: it implies that you could not possibly construct a state of comparable complexity to modern governance if the topmost layer were a libertarian paradise. But that position is very implausible. If you can construct a model of a state then you can easily analogize to whatever that is, instead of theft.
drostie··on Show HN: Quickfix, the best stupid idea for fixing problems in Node modules
No because how the hell would they know?

I author a module for my employer and describe it with their developers@ email and as UNLICENSED; how does NPM discover that I am legally authorized to use and modify this package?

drostie··on The Corrosion of High School Debate
I never participated in debate as a student, only as a judge. In this experience I have noticed that (a) debate judges are culled from the general populace, (b) given little to no guidance, (c) potentially given extraordinary latitude in their judgment but not necessarily made aware of that, (d) they generally have some personal connection to the school or the debate teams. (Of course, they should register a conflict of interest so that they don't judge their own school/team.)

After the first few times, and after I got a much better grip on my latitude and what was expected of me, I started to make it clear before I judged, "I find it somewhat hard to follow spreading and I have noticed that I tend to consider plausibility when evaluating arguments, please keep those in mind" and usually there is a flurry of quiet re-strategizing before the debate, followed by a somewhat more meaningful exchange. However it has never quite gotten to the level where anything really felt resolved and it indeed always feels like a bizarre "game".

drostie··on ‘Criticality safety event’ occurred at LANL’s plutonium facility
Yep! The mathematics is pretty simple and recurs in a bunch of other places, from the theory of evolution by natural selection, to the question of why things go viral on the Internet.

The basic idea is that these sorts of objects are routinely seeing spontaneous nuclear decays -- there might be billions per millisecond of these. What's important is that each nuclear decay is an explosion which releases debris that can cause other nearby nuclei to decay as a result. So it becomes important to know: what is the average number N of nuclei which fall apart as a direct result of getting hit by the shrapnel of one decaying nucleus?

Since nothing is terribly exact in physics there are two regimes to consider, N < 1 and N > 1. In that first regime we can roughly calculate that we need to multiply this baseline billions-per-millisecond rate of spontaneous decays by the number

    1 + N + N² + N³ + ... = 1/(1 - N)
The virality analogy is "Given one person shares it, what is the average number N of their friends who share it?" As you can see as this gets closer to N=1 it goes towards infinity.

For N > 1 the same multiplier holds but it cannot be summed infinitely: instead we realize that each term takes a slightly longer time period and thus the growth goes something like e^(k t) for some k, it's an exponential growth towards a majority of the sample reacting.

For fissile materials like plutonium, an easy way to increase N is to just bring two plutonium rods closer together: free debris from explosions in the one now cause new explosions in the other. This is called forming a "critical mass" hence the language about "criticality". Another way is to bring in these "neutron reflectors" that reflect the debris back into the same sample, it's basically the same principle.

drostie··on Rob Pike's Rules of Programming (1989)
I think #5, which is probably going to be thought of as great wisdom for our age, is secretly an empty tautology. That is, my amateurish work in schemas and validating data structures and type systems has led me to think that there is a somewhat hard-to-see but extremely-important bijection between data structures and the control structures that consume them. (In many ways this is theoretically a non-issue as there are Church and Scott encodings of those data structures, but I think it also extends lists to for-loops and not just folds.) Seen that way it's really just saying "the most important part of the algorithm is figuring out the right basic control structures to build the algorithm out of." Well, yeah, that's what programming is.
drostie··on Judge won’t release man jailed 2 years for refusing to decrypt drives
Look, it's not inconceivable that competent prosecution could prove that every murderer wasn't acting in self-defense, either. What's conceivable has little bearing on courtroom procedure.

What matters for procedure is, what's reasonable. It's reasonable that someone who claims they killed in self-defense would have to present evidence that they felt they were in serious danger. It's reasonable that someone who claims they were not sane at the time they committed a robbery, should have to explain with evidence the causes and circumstances of their insanity that distinguish their mental state from other mental states that we'd treat normally, like that of simply being greedy. These are routine situations where the burden of proof is on the defendant to mount the corresponding "affirmative defense." They arise because of a more fundamental principle that if you did fail to obey the law, but you want to argue that it's OK that you failed to do so, then you should be able to tell the court why you failed to do so, so that we can indeed evaluate whether it's OK.

The only difference here is that insanity, self-defense, entrapment and the like -- traditional affirmative defenses -- are self-evidently very exceptional circumstances. Forgetting is, by comparison, quite routine. Therefore the courts are actually incredibly lenient, putting only a weak burden of production on you so that the question of "why can't you?" is answered up-front, and then this reason will be evaluated under the assumption that you're innocent until proven guilty.

drostie··on Judge won’t release man jailed 2 years for refusing to decrypt drives
It is the government's job to prove you remember it. They have the burden of persuading the court that you don't remember it. This is spelled out explicitly in the Supplemental Order issued by the judge, PDF freely available at:

https://ia601303.us.archive.org/0/items/gov.uscourts.paed.50...

What is at stake is a burden of evidence production. The difference between production and persuasion, in a court room, is a distinction both of quantity and quality. You "produce" single pieces of evidence, whether weak or strong -- then the totality of all of the pieces of evidence, evaluated together according to their strengths, "persuades" the court. "Produce" is quality-agnostic and refers to single pieces of evidence; "persuade" or "prove" refers to all of the evidence on both sides and weighs them by their quality.

And what's really at stake is that your lawyer, at a contempt hearing, cannot merely claim, "Well, your honor, the prosecution has not proven that my client is definitely able to fulfill the order, because they have not disproven every possible reason why my client could not fulfill the order." The reason that this is not enough is that it is asking the government to prove a negative, "you cannot possibly have any excuse."

Instead the procedures that courts use to decide these cases require the defense to identify specific reasons why the defendant cannot fulfill the earlier order, and then the burden falls on the prosecution to prove that those specific reasons are BS. And for this purpose they need to produce some evidence -- it doesn't need to be strong, persuasive evidence -- that the defendant cannot fulfill the order for that reason. Because it does not have to be strong or persuasive, a statement of testimony is taken at face-value as sufficient.

The only attack the government can make at the evidence-production level is "even if this evidence were 100% persuasive the defendant would still be able to decrypt the drives", so the evidence has to have some clear logical relation to the excuse. But obviously if your sworn testimony that you cannot decrypt the hard drives were 100% persuasive, you would not be able to.

It's still the government's job to prove you remember it, but you need to produce some sort of pertinent evidence (no matter how flimsy) that you don't, so that the court even evaluates this defense in the first place.

drostie··on What does an innocent man have to do to go free? Plead guilty
Google cache, as I'm getting a "503 first byte timeout":

https://webcache.googleusercontent.com/search?q=cache:kM07g3...

drostie··on Judge won’t release man jailed 2 years for refusing to decrypt drives
At the contempt hearing, you are allowed to testify that you do not remember your password, and it puts the burden of proof on the government to prove that you secretly remember your password and are lying to the court when you say that you don't. Of course if you do testify this and you are lying, then that's a perjury charge -- which means that for example if you have told your lawyer that you do remember your password, your lawyer cannot knowingly allow you to lie on the stand and could be disbarred etc. if you do. But assuming that you're not lying and so forth, you can just say "I can't comply with this court order because I don't remember the password" and that will suffice for your defense at your contempt hearing unless the government can meet a strong burden of proof that you secretly do know your password and are lying about it, which you are of course entitled to counterexamine and poke holes in.

Rawls did not testify, at his contempt hearing, that he did not remember his password. He did not testify at all at that hearing. He said prior that he doesn't remember his password to the police, and he has said it afterwards to the media, and he might have even said it to a different judge in these weird follow-up hearings--but he didn't say it at the contempt hearing and as I understand it he didn't appeal this hearing directly to say "well shoot I didn't realize I was getting jailed on a technicality, let's re-do this hearing so that I can testify that I forgot it properly."

There are many reasons that Rawls might not have testified; possibly he has a very good lawyer who is concerned about some bigger issues that Rawls might have to address if he testifies at all; possibly he has a very bad lawyer who did not know that this is how forgot-my-password law works and did not read the Supplemental Order the judge wrote explaining why Rawls is being held in contempt of court. I do not know why he did not testify this. However, testifying this is sufficient to be not held in contempt of court, unless the government can meet a stiff burden of proof that you are lying.

drostie··on If you enroll in Equifax's TrustedID you waive your rights to sue Equifax
Yeah, sorry, IANAL either but that's total BS. The user has consideration in the form of being able to use the service.

For those who are unaware, contract law deals with a process of people exchanging things, usually in the form of promises -- "I will mow your lawn in exchange for $30" is a contract, even if it is never written down. There are a lot of interesting ways that this law works: for example you will see reasonably often something like "I'll give you $30 to mow my lawn" / "Deal!" / "What about $20?", where the one side seems to be assuming that there is no actual contract until they both say "Deal!" -- but actually the law believes that the first person implicitly consented simply by the form of the language of the "offer" above and if the sums were larger this could hypothetically be the sort of thing that a lawsuit begins over.

The "consideration" idea is about this word "exchange" that I started off the last paragraph with, it says that contract law explicitly does not apply with things that are just given away for free. If you say "Hey after I mow my lawn tomorrow I'll mow yours", and your neighbor says "great!", and then something comes up tomorrow so that you have to cut the job short only mowing your lawn and not your neighbor's lawn, the law says that was not a contract and your neighbor cannot sue you to mow their lawn for free. How do we know it wasn't a proper contract where things were exchanged? Because we can see that you don't get anything out of it. But "get anything out of it" might get into very abstract territory: for example if you are known among your neighborhood for collecting the dead grass you've mowed and turning it into expensive compost, and that's the reasonable expectation, that could be consideration. At some point -- possibly presently, I haven't reviewed them for this post -- the Creative Commons licenses said something like "to the extent that this is a contract, the consideration for me is that I'm getting to see my work used by other people who I don't know."

This exception to contract law obviously does not apply to the terms-of-service agreements for paid services. It might hold if you are not notified about the terms of service prior to making the agreement, but US law tends to be a bit lax about the details here and usually says "well if you used the service anyway after you found out about the terms of service then you agreed to be bound by those terms." See the cases on "shrinkwrap licenses" for details.

Note also that most free-software copyright licenses and so forth are simply not contracts; that doesn't mean that they have no legal standing, but just that their legal standing isn't in contract law per se.

drostie··on Sorting number strings numerically
I guess that makes sense and speaks to a bigger problem here, which is that with a very large number one certainly wants to simply store it in a massive file on disk, and the encoding to do that probably shouldn't be based on the printable ASCII digits--because why.
drostie··on Sorting number strings numerically
I mean, I think a case can be made for something like it, where possibly one adds to the problem statement "the bytes should be contiguous ASCII and should not cause the JSON standard to backslash-encode the characters." The biggest range which does this is 0x23 to 0x5B inclusive. But that only gives 57 workable characters.

If it helps, I am not the author of the original article.

drostie··on Sorting number strings numerically
Yes, this usage of UTF-8 is limited to the ASCII subset.
drostie··on Sorting number strings numerically
Very cool, thanks for mentioning.
drostie··on Sorting number strings numerically
Note that you would not have an encoding for negative numbers then, and you would have to use the alternative base64 table,

  +/0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
as the normal one is not order-preserving. Otherwise yeah, you could probably do that--and of course there are many ways to patch what you've got to handle negatives, e.g. by noticing that it is slightly wasteful (the base64 prefix ++++++++ is never used) or by using a leading character lower than + (so - is out but ! for example is available) and then encoding the rest of the string in an "ascii-reversed" way.

However I must object to the idea that "real hardware" cannot handle the petabyte scale. The in-article recursive approach of using the algorithm:

    function encode(number) {
        //calculate some base number_string
        return number < NUM_THRESHOLD?
            number_string :
            sigil + encode(number_string.length) + opt_divider + number_string;
    }
is not a particularly bad one. The only thing that maybe I'd balk at is that the given encoding requires a human editor to use an ASCII table to lookup their string lengths, which is clearly undesirable... one might instead go for the most naive case where NUM_THRESHOLD is simply 10 and have the number 123,456,789,012,345,678,901 be represented as:

    ~~2 21 123456789012345678901
so that it's clearly "there are going to be 2 length strings" (hence two tildes) -- the first always has length 1, it specifies "the next has length 2" and then "the next has length 21."

This is also pretty easy to parse and one can use a leading - sign to encode negative numbers, for example.

← PreviousPage 2 of 34Next →