Better HN
topnewbestaskshowjobs
Log inSign up

mediumdeviation

1,791 karma · joined Oct 27, 2012 (14y ago) · 297 submissions

Submissions

comment 8y ago · link · parent

But how would they measure bounce rate when analytics won't work when the user is disconnected? :)

Anyway since we're on HN you should know that Chrome has a "offline" button in its network tab in its developer tool, used for testing offline features, so you can take a single tab offline, instead of disconnecting everything.

comment 8y ago · link · parent

I find the lack of granularity annoying. Your search history is generally less sensitive than your location, but both are bundled up in 'Web & App Activity'. There's no way to get Google to remember my search queries from my phone without it also creepily recalling every single location I brought my phone to. This feels almost like a dark pattern, like bundling a newsletter subscription when signing up to service.

comment 8y ago · link · parent

Enums are not JavaScript, and I've never heard of an Enum stage X proposal.

comment 8y ago · link · parent

> I suspect that humans will adapt to this new way of life we've brought upon ourselves.

You can't beat the laws of thermodynamics. When the wet bulb temperature reaches the human body's natural 37 degrees Celsius, it'll be impossible for the body to expel heat via sweating (evaporative cooling). At that point no amount of adaptation will help, and humans need technology to stay alive.

comment 8y ago · link · parent

Webpack and Gulp were never meant to be simpler alternatives. Gulp used streams instead of serially processing files like Grunt, which made it faster, but obviously streams working in parallel are more complex than just processing the files one by one.

Webpack pulls dependencies into one file and deduplicates them. This is obviously even more complex since now you have dependency resolution logic as well as dealing with the various module systems JavaScript has invented.

comment 8y ago · link · parent

Example: https://imgur.com/oR3Nk8q

This was generated by one line of code, simply applying the hoist-non-react-statics library as recommended by the official React docs https://reactjs.org/docs/higher-order-components.html#static...

JavaScript in many cases can be too dynamic to be properly typed. I'd rather have it than not - it has saved my ass a good number of times - but let's not pretend TS/Flow is totally wonderful.

comment 8y ago · link · parent

Their actual efficacy is questionable at best though. After about 10 minutes of breathing, water vapor from your own breathing would have rendered it more or less permeable to anything infectious. Sneezing into a handkerchief would probably be more effective.

comment 8y ago · link · parent

I have seen similar issues with overly aggressive parser in Messenger for Business, but with dates instead. It tried to turn the words in the following real conversations into dates for adding appointments

* "Christmas" in "Merry Christmas, and have a nice day"

* "at 100" in "It could be that you're not viewing the image at 100% zoom"

* Four digit module codes from my university that looks like four digit military time

and so on, ignoring context or even prefix/suffix text which makes it clear the text is not a date. It would be funny if these don't keep getting in the way when random words in conversation gets turned into links.

comment 8y ago · link · parent

Consider the opposite - would Christians go out and start murdering people if they stopped believing in God? If tomorrow incontrovertible proof came out that the ten commandments and the Bible were in fact not the word of God, would my Christian friends suddenly start stealing from me or stick a knife in my back? As an atheist I find that absolutely appalling and I don't know how anyone can live like that.

comment 8y ago · link · parent

Actually, I noticed YouTube's recommendations seems _heavily_ biased towards what you watched recently. This is likely due to how people watch videos - much like people binge watching TV serials, they are very much likely to continue watching videos from the same or similar channels.

In most cases this is harmless - play a song, and YouTube will automatically create a playlist of songs in the same genre. Watch a cooking video, and it'll give you a dozen other recipes by the same chef.

Unfortunately this doesn't work for political videos, as you've noticed. But there is absolutely no incentive for YouTube to insert videos from opposing viewpoints into the recommendations. YouTube is just giving people what they want.

comment 8y ago · link · parent

It's amazing how the world's largest internet company cannot build a good blog. I don't know why Google is so insecure it thinks it needs to resort to the same tactics used by third-rate blogspam sites to keep users reading their blog posts.

This is what the site looks like with both sticky bars open on my 900px high screen. This is atrocious. https://i.imgur.com/o5hcENG.png

comment 8y ago · link · parent

bcrypt is old enough to vote this year

comment 8y ago · link · parent

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/

comment 9y ago · link · parent

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.

comment 9y ago · link · parent

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?

comment 9y ago · link · parent

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.

comment 9y ago · link · parent

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...

comment 9y ago · link · parent

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.

comment 9y ago · link · parent

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.

comment 9y ago · link · parent

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.

comment 9y ago · link · parent

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.

172.

Undercover in Temp Nation(projects.thestar.com ↗)

1 points · by mediumdeviation · 9y ago · discuss

173.

The Photos the U.S. And Saudi Arabia Don’t Want You to See(nytimes.com ↗)

4 points · by mediumdeviation · 9y ago · discuss

comment 9y ago · link · parent

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.

comment 9y ago · link · parent

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...

comment 9y ago · link · parent

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.

comment 9y ago · link · parent

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>

comment 9y ago · link · parent

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.

comment 9y ago · link · parent

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.

180.

'Hate speech' tweets painted at Twitter HQ in protest(bbc.com ↗)

1 points · by mediumdeviation · 9y ago · discuss

1
567
10