kenbellows

Joined 14 years ago

Karma
508
Submissions
223
Member since
Nov 28
A web and software developer always looking to learn https://kenbellows.github.io/
View on Hacker News

Recent submissions

Comment · 7 years ago
Nowadays many applications, and especially most big-name business application suites (G Suite, Microsoft Office online, etc), are converting all their web applications to Progressive Web Apps, adding Service Workers and such so that they work just fine when you're offline and sync to backup document changes and such whenever you reconnect later. Give it a couple years and it won't be a problem anymore.
Comment · 7 years ago
"Walled garden" in what sense?
Comment · 8 years ago
To be precise, similes are a type of analogy
Comment · 8 years ago
Which is ironic, given that English developed as basically French + German (or some old versions of those languages).
Comment · 8 years ago
Not sure what you mean, can you explain more? When I open my console, I get:

    > true == 1
    -> true
    > false == 0
    -> true
Do you get something different? Or is the game claiming something different?
Comment · 8 years ago
In that sort of case I like to use explicit type casting, e.g.

    if (Number(myNum) === 2) {}
For me this also extends to using `Boolean(val)` instead of `!!val`, etc.; though I understand the appeal of those nifty one-liners, I think they cause confusion in many places and don't communicate intent nearly as well.
Comment · 8 years ago
Assuming you can include JS in the file, I imagine it would only run if the file was being parsed as HTML at the moment, not when parsed as a JPEG. That's the main point here: this file can be interpreted in two ways, but the data in it is treated very differently and has different effects depending on the way it's currently interpreted.
Comment · 8 years ago
This won't answer the question directly, but these sorts of discussions always bring to my mind the famous quote from Jeremy Bentham: "The question is not, Can they reason?, nor Can they talk? but, Can they suffer?"
Comment · 8 years ago
Nah, I doubt it's actually a forgotten feature, it's probably got some known use cases. I bet it will stick around
Comment · 8 years ago
I mean, if you think about it, any time you run any installer, whether via brew install, apt-get install, or an .exe or .msi, you're effectively running someone else's unknown code on your system, often as a superuser (e.g. with sudo apt-get install). Is there a significant difference here? At least in this case you could potentially download the shell file and read it before you run it, unlike with a binary executable.

Am I way off base here?

Comment · 8 years ago
1/x as x -> 0 is a famously tricky expression because your statement that it "obviously increases exponentially as x approaches zero" is only true half the time, because it's only true if you approach zero from the positive side, with x being set to smaller and smaller positive values. If, on the other hand, you set x to negative values of smaller and smaller size, 1/x actually decreases toward -Infinity. This is one of the several reasons that 1/x is typically considered undefined for the Reals.
Comment · 8 years ago
The OP didn't invent the definition of fields as defined by additional and multiplication, with division defined as the Inverse of multiplication. Even the Wikipedia article on fields (https://en.wikipedia.org/wiki/Field_%28mathematics%29#Defini...) defines them this way. (Not that Wikipedia is an authority on truth, but I find that it's a pretty good indicator of what positions are common/widespread regarding a subject.) It's a bit silly to claim that division is defined as axiomatic "in mathematics" given how fundamental fields, defined as the OP defined them, are to modern number theory and mathematics in general.
Comment · 8 years ago
Very good points. And thanks for the note about Object.getPrototypeOf(obj) and Object.setPrototypeOf(obj, newPrototype), I don't think I had ever actually looked that up!
Comment · 8 years ago
Ah, I see. The special thing here is the `new` keyword. When an object is created using `new myconstructor()`, the following steps occur (among others):

  1. create a new empty object; call it `newObj`
  2. call the constructor using `newObj` as its `this` context, so that `this.a = 1` is effectively `newObj.a = 1`
  3. if the constructor has a `prototype` property defined, invoke `newObj.__proto__ = myconstructor.prototype` to establish the prototype chain on the new object
The critical distinction here is between `constructor.prototype` and `object.__proto__`. For exactly this reason, it bothers me a bit that the article uses `Prototype`, with a capital "P", to mean "the thing that `object.__proto__` points to". This is completely different from the `prototype` (small "p") property of a constructor, which is essentially just a holding place for the `__proto__` property of any objects created by calling this constructor with the `new` keyword.

Hopefully that all made sense!

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton