HNHacker News
TopNewBestAskShowJobs

mediumdeviation

1,791 karma · joined October 27, 2012

submissionscomments
mediumdeviation··on Best practices for user account, authorization and password management
bcrypt is old enough to vote this year
mediumdeviation··on Safari Password Generation
Yes - for instance it makes the Correct Horse Battery Stapler passphrase strategy[1] difficult to apply, because now you can only pick words up to ~4 letters long.

[1]: https://xkcd.com/936/

mediumdeviation··on Germany replaces US as country with best international image
Historically, equatorial countries in Africa, South and South East Asia were colonies. I think we can also assume each country weights equally on the regression line, even though they vary greatly in population - this favors latitudes with lots of small wealthy countries, which Europe is.
mediumdeviation··on Chrome breaks the Web
It seems Firefox supports a non-standard fourth parameter, so that won't work either.

addEventListener is possibly the worst organically grown API I've seen in a long time. If anything, its sordid history should be a lesson to the Chrome dev team that fucking around with proprietary extensions (which this most definitely is) just leads to future technical debt and pain for everyone. Why do they never learn?

mediumdeviation··on Chrome breaks the Web
In older browsers, useCapture is NOT an optional parameter, and in most cases you do NOT want to use event capture instead of event bubbling. There's no trivial way to support addEventListener(event, handler, { passive: true }) on both new and old browsers without that really ugly feature detection code in the article.
mediumdeviation··on Show HN: Attributed strings in Swift 4
I've had the pleasure of working with Swift for a few months last summer to develop some iOS prototypes. To borrow something Douglas Crockford said about JavaScript and the DOM in 2006[1], Swift is a pretty good language saddled with an awful API. I cannot believe that this is the stuff a multi-billion dollar company (Apple) is giving to developers to build the billion dollar "App economy".

As an example: To this day I have no idea what media formats are supported by AVAudioPlayer on iOS[2]. The documentation's links (Cmd+F "iOS Hardware and Software Audio Codecs") have been broken for so long that not even the Wayback Machine has a copy. And Googling for the same information only gives me Stack Overflow answers that references the same broken link. I suspect at this point not even Apple knows what formats their own audio framework is capable of playing.

[1]: https://yuiblog.com/blog/2006/10/20/video-crockford-domtheor...

[2]: https://developer.apple.com/documentation/avfoundation/avaud...

mediumdeviation··on React 16
Counterpoint: React is no less opinionated, fast, or has less of a DSL than Vue.

Opinionated: React is a library written for a language that is not JavaScript (the first prototype was written in OCaml). It demands immutability, which JS has no native support for. it wants you to use FP, but JS natively has little support for FP both in its standard library and syntax. FP only looks good in JS if you've never used a real FP language.

DSL: JSX is a DSL - I can't remember the last time I've seen someone use && as a poor man's if statement, or ternary statements dozens of lines long until I started writing JSX. JSX is neither idiomatic JavaScript nor HTML.

Fast: Performance benchmarks (which admitted are flawed as they can't capture real-world usage) show that React and Vue have similar rendering speeds. Vue's computed property dependency tracing means that a lot of the performance optimizations which require manual work to enable in React (manually memoize expensive computation, shouldComponentUpdate, PureComponent etc.) are handled automatically by the framework.

mediumdeviation··on Why is it faster to process a sorted array than an unsorted array? (2012)
Our school introduced it in a year 2 computer organization course that was required for all CS majors. It went into how the processor converts assembly into instructions for the ALU, instruction pipelining, branch prediction (though only qualitatively), and the instruction and data cache, amongst other things.
mediumdeviation··on Flow and TypeScript
Flow bakes React libdefs right into the binary https://github.com/facebook/flow/blob/master/lib/react.js - so yes, Flow damn well have good React support, because the React libdef is given the same level of importance as Node and DOM APIs.

Of course it also means you can't upgrade React without upgrading Flow, and you can't target a specific (older) version of React without downgrading Flow.

mediumdeviation··on Flow and TypeScript
Let me add a few cons then

- Saying the error messages are "not intuitive" is a bit of an understatement. Most memorably, this was an actual message I was presented with after upgrading to Flow v0.53 - https://imgur.com/UseQxEz.png

- Flow's goal appears to be ensuring correctness rather than being useful. Object.value produces an array of mixed, effectively erasing their type (https://github.com/facebook/flow/issues/2174). document.body is a Maybe (https://github.com/facebook/flow/issues/4783). All use of getters and setters are marked as unsafe, with no way to selectively opt in or out (https://github.com/facebook/flow/issues/2826). These are pedantic to the point of uselessness.

- When a function call's parameter type disagrees with the function signature, Flow flips a coin and marks one of them as incorrect. GitHub issue from Oct 2016 - https://github.com/facebook/flow/issues/2587 (issue is closed because they're 'working on it', not because it's actually resolved)

- Flow's libdef is a fraction of TypeScript's. I frequently convert TypeScript libdefs to Flow libdefs. I have yet to see a library that has Flow libdef but not TypeScript libdefs.

mediumdeviation··on How it feels to learn JavaScript in 2017
Wow, Safari Mobile only gained support in iOS 10. That's September 2016, and leaves out iPhone 4S, iPad 2 and iPad 3, devices from 2011 and 2012.
mediumdeviation··on Stencil – A reusable web component generator
Ironically we have the exact same problem, except worse with Safari, since it has (relatively) poor support for some cutting edge APIs, and unlike Edge/IE we can't even legally test it in a VM because Apple doesn't even allow their OS to be put in a virtual machine.

At least Microsoft has the good grace to put up free VMs for browser testing - https://developer.microsoft.com/en-us/microsoft-edge/tools/v...

mediumdeviation··on Vue.js vs. React
It's a matter of personal opinion, but I guess I'm more used to server-side templating languages, which Vue's looks much more similar to. I have the same problem as you for JSX - I keep trying to read it as HTML, except it's not, and mentally translating it is annoying.
mediumdeviation··on Vue.js vs. React
JSX is closer to JS than HTML, which means it annoying to write in some cases. Quick, what does this render as?

  <a href="...">Link 1</a> |
  <a href="...">Link 2</a> | 
  <a href="...">Link 3</a>
It's not

  Link 1 | Link 2 | Link 3
as you'd expect - instead, the whitespace after the pipe character is eaten by JSX. This is because HTML is whitespace sensitive, but JS is not, and so to allow indentation, JSX trims whitespace.

Here's another -

  <dl>
    { Object.entries(definitions).map(([term, definition]) => (
       <dt>{ term }</dt>
       <dd>{ definition }</dd>
    )}
  </dl>
This does not work - instead, you need to return an array, but the result is ugly - the commas are part of JS, not HTML, and don't appear in the output, but reading this quickly it's hard to see that (the difference is the braces surrounding the block).

  <dl>
    { Object.entries(definitions).map(([term, definition]) => ([
       <dt>{ term }</dt>,
       <dd>{ definition }</dd>,
    ])}
  </dl>
Vue's 'weird DSL' is HTML (the same is not quite true for Angular's). What you see is exactly what you get. Having a DSL also means you can define your own syntax. Things that are verbose (due to historical reasons in JS), such as iterating over an object, can be made simple -

  <dl>
    <template v-for="(definition, term) in definitions">
      <dt>{{ term }}</dt>
      <dd>{{ definition }}</dd>
    </template>
  </dl>
mediumdeviation··on React and Redux are a joke right?
Updating an array element

  arr[3] = 'New content';
Updating an array element immutably

  arr = arr.map((element, index) => {
    if (index === 3) return 'New content';
    return element;
  });
It's possible, sure, but it feels terrible. JavaScript objects want to be mutated - it's the most idiomatic way of interacting with them. Whether functional programming paradigm is good (I certainly feel it is) is beside the point - JS wasn't designed for it.

When I think of immutable primitives, I think of Python's tuples, which will raise a big fat error when you try to mutate them, or even better, Swift's structs, which gives you a new copy with every mutation.

mediumdeviation··on React and Redux are a joke right?
React feels like a library written for a language that's not JavaScript. JavaScript defaults to mutability by default - there are no immutable primitives that you can easily use, and even in ES6 just maintaining immutability without deep cloning everything takes a lot of effort. In that respect React is heavily opinionated.
mediumdeviation··on A vulnerability rating of your IP address
On a side note, if your fan started spinning up when you opened this, it's because of the particle simulation in the header.

I know because I reviewed this library (https://github.com/VincentGarreau/particles.js) when a colleague wanted to add something similar to our site. The problem is it uses a naive O(n^2) algorithm for linking up particles when they get near each other, which wastes a lot of CPU cycles.

Running this script with a large number of particles and auto-linking on is ill-advised - but fortunately you can delete the <canvas> element quite easily to stop the script.

mediumdeviation··on Firefox Roadmap for Flash End-Of-Life
The Flash authoring tool comes bundled with a standalone Flash movie player that can open .swf files. It's available here, but I have no idea if this will continue to work (the page warns against using this if you're not a developer): https://www.adobe.com/support/flashplayer/debug_downloads.ht...

It's also possible to export any Flash movie as a standalone executable with the Flash runtime baked in. This should be immune to any sort of deprecation. Of course this relies on the developer who holds the original source file to do the exporting.

mediumdeviation··on Voten.co, a Real-Time Reddit Alternative Launches Public Beta
Laravel 5.4 integrates with Vue. https://laravel.com/docs/5.4/frontend#writing-vue-components

Laravel can act as the API backend to the frontend (basically a set of REST endpoints that the frontend can talk to), or alternatively the Vue components are used only where heavy client-side interactions are required, while the rest of the pages are still served up by Laravel normally.

mediumdeviation··on Noun Project – Icons for Everything
But those are product logo, not icons https://imgur.com/a/4kAKt. They don't serve the same purpose - logos are brand assets and are suppose to be distinct, otherwise they can't be trademarked.
mediumdeviation··on China congress: BBC team forced to sign confession
>> having an agent buy their tickets/hotels so it looked like a local was going instead of the BBC?

It is not legal, no. Travel on railway and plane and booking hotels all require you to present your ID, as is signing up for a mobile phone.

mediumdeviation··on A strengthening dollar is bad for the world economy
Economics is not called the dismal science for nothing
mediumdeviation··on Reddit cracks down on abuse as CEO apologizes for trolling the trolls
> To China and Iran - facebook is a "disruptive community." To use reddit's language.

There is a vast difference between the government banning you and reddit banning you (which they are not actually doing here, but for the sake of argument).

You have the right to free expression. You do not have the right to free expression on someone else's platform. reddit is not the Internet - if reddit does not like what you say, you can set up your own space on the Internet. If the government does not like what you say, then there is literally no legal alternative. That's the difference.

Oh, and stop confusing net neutrality with this issue. It's not the same.

mediumdeviation··on Introducing Custom Elements
Custom HTML tags are valid HTML. Note the requirements for custom tags to always include a '-' in their names. This distinguishes custom tags from native ones. https://html.spec.whatwg.org/#valid-custom-element-name
mediumdeviation··on The Myers-Briggs Personality Test Is Pretty Much Meaningless
You're conflating two things here - the instrument, which is the survey, and the data it is measuring - the MBTI. Even if we assume the MBTI itself is accurate - that is, it is possible to categorize the entire human race into 16 distinct personality categories, the fluctuating survey results indicate that the instrument used to measure it is wildly imprecise, and using it to make any sort of important decision is irresponsible.
mediumdeviation··on Dropbox, Google Drive and Microsoft OneDrive blocked in Turkey following leaks
Actually what happens in China is that homegrown tech companies will take over the market space left by Western ones, which the government is perfectly happy to let happen because

1. It keeps the tech industry domestic

2. The servers are physically inside China, guaranteeing them access to the data

This is why I've always thought that the Great Firewall's purpose is not only censorship, but also a form of Internet-age protectionism.

mediumdeviation··on Does LinkedIn access your email or contact list?
Cross-origin window.opener objects are not full window objects. You can test this out on any browser - the most they can do is what the articles you linked to says - redirect the parent window, which can be used for phishing, but is otherwise relatively harmless.
mediumdeviation··on 16-year-old British girl earns £48,000 helping Chinese people name their babies
"Bing" as it is commonly pronounced in English doesn't exist in the Chinese language. Words with the pinyin 'bing' does, but saying it means 'disease' in mandarin is somewhat disingenuous, because it could refer to any of the four inflection and the very large number of words under each of those, like the word for ice, soldier, sideburns, guests, etc.
mediumdeviation··on Uber's Failure in Japan
The taxi stops are there simply for the convenience of drivers and people looking for taxis. Taxis can still stop and pick up passengers anywhere cars are allowed to stop (double yellow line).
mediumdeviation··on NASA Data Shows Toxic Air Threat Choking Indian Subcontinent
So I'm not really sure what happened, but I couldn't read the article because the page ate up more than 1.5GB of RAM on Firefox and caused it to peg an entire core at 100% utilization http://i.imgur.com/j3q686E.png

And if I scroll down a bit more you'll find a web worker spawned by the same page consuming another 120MB of RAM. This is a lot of stuff happening on what is suppose to be just a news article.

← PreviousPage 6 of 9Next →