HNHacker News
TopNewBestAskShowJobs

msbarnett

12,236 karma · joined April 12, 2010

submissionscomments
msbarnett··on Rogers network outage across Canada hits banks, businesses and consumers
Swoop is owned by WestJet, it's just their discount brand. Flair's actually independent and used to be based in Kelowna but is now based in Edmonton – they're probably who GP is thinking of.
msbarnett··on Show HN: Localization and translations should be code, not data
> Regarding the link, I was more thinking about how your system handles the some.introductory.paragraph translation and how you differentiate between potential HTML in the translation vs HTML in the click_here variable vs HTML in another potential variable containing user input.

Well, the differentiation is between strings which are dev-authored and parsed during compilation/boot time – which are trusted (untainted) and thus may contain HTML that's rendered directly – and tainted strings which come in at runtime either from user input or from via the translations lookup (among other things), and which can never be rendered without fully HTML escaping (without the code explicitly untainting them, at least, but that would never survive code review because it's profoundly unsafe to do this).

click_here isn't a "real" variable in the source language, it's just something that the translation API can replace during the translation load. To the extent that it can contain HTML, it can do so if and only if it is bound to an untainted string instance during the translation load – binding it to a tainted instance would cause any HTML that gets inserted into there to get fully escaped. "link" being dev-controlled produces untainted strings, but might itself consume a tainted string for its title (and thus escape that while rendering the title as part of outputing its untainted string), etc.

> how you differentiate between potential HTML in the translation

it's very simple: the translation is not trusted and thus can't contain HTML that gets rendered without being fully escaped, and thus looking like garbage. If you really wanted to style something in the middle of the paragraph (which again, effectively never really comes up in my experience) you would have to split the paragraph into 3 keys: everything leading up to the start of a tag, whatever's inside the tag, and everything after the tag.

msbarnett··on Show HN: Localization and translations should be code, not data
> My experience is that most translators actually do know basic HTML or can at least translate an english base string containing HTML into their own language without messing it up. CSS would of course not be present, just sematic HTML (or any other kind of "rich text" -- it wouldn't have to be HTML specifically).

I don't know what to tell you other than that it is not my experience at all that translation services offer or even accept HTML as a source-format, and if they did they would no doubt command a significant premium over translators who know the languages but lack such tech skills.

And I absolutely wouldn't trust a third party to directly author HTML we were serving anyways. Manual audits of 3rd-party input aren't enough – your tooling should be automatically protecting you from 3rd parties inserting unsanitized HTML (as below)

> I'm not sure I understand how your example prevents that HTML threat model you mention, unless the "link" function generates some kinds of magic placeholders that you then replace with HTML in another step you did not mention. If "link" generates an A tag, then you're already trusting the translation with HTML powers anyway

Good lord, no – you should never be rendering externally controlled strings directly as unescaped HTML, and that includes strings from 3rd party translators.

The lookup function for translation keys produces instances of an "unsanitized" (tainted) string class which is escaped on rendering, so if "link" in this case takes two arguments (the URL, which will become the href, and the text that will get wrapped in the A tag – the text argument will be completely escaped such that attempting to embed HTML in the translation key .a.fancy.link.name would result in mangled output, eg)

translation file:

    a.fancy.link.name: <script src="some-evil-bitcoin-miner-script.js"></script>Click Here!
HTML template:

    <%= link(foo_service_url, t(.a.fancy.link.name)) %>
would produce the final HTML:

    <a href="http://www.foo.com">&lt;script src=&quot;some-evil-script.js&quot;&gt;&lt;/script&gt;Click Here!</a>
> (not that I find that much of a problem -- at least not with my approach where XSS via params is not possible).

That's... hardly the only threat you face if you have a translator feeding you malicious strings

msbarnett··on Show HN: Localization and translations should be code, not data
> So let me just first say that just sending a CSV/JSON/YAML/whatever file to professional translators and expect good results back is just not going to work. We've done that and sometimes the context is just horribly wrong. The only way to get good results is for the translators to actually see the UI or even better run the app themselves.

You give them some context, and let them ask you questions if they feel things are too ambiguous for them to produce an accurate translation for the context it will be used in. In some cases we will include a screenshot of the rendered English page/component/etc so that the translator can map the key values they're seeing to the presentation context.

I can only tell you that this process has scaled to 10s of millions in sales in foreign languages, and that the translation services we use absolutely do not have any time or interest in signing additional NDAs around source code, in getting their employees set up with bespoke code and dev environments, etc. It would be a gigantic drag on their business model.

> I absolutely think the right way is to have translations be HTML fragments.

These translators do not know HTML and are not going to be able to work with it in any way – again, this would require the services to totally overhaul their business model, and spend a bunch of money/time on training or hiring more specialized translators with HTML/CSS skills, which they have no interest in doing.

It would also open up a threat model that's currently non-existent for us. Total non-starter.

> How else would you know what part of the sentence should be italic or contain a hyperlink?

Translation keys contain a simple substitutional form that can be replaced on key lookup, so

     some.introductory.paragraph: Call to action: %{click_here}
     a.fancy.link.name: Click to purchase!
in code:

     t('.some.introductory.paragraph', click_here: link(target_url, t('.a.fancy.link.name'))
The developer can inject formatting that way if necessary, etc, although generally speaking this is a really rare use-case in my experience: randomly italicizing or bolding or otherwise styling words in a paragraph looks fairly unprofessional/isn't typically done.
msbarnett··on Show HN: Localization and translations should be code, not data
> You can't have a single source of truth for presentation decisions in a multilingual product. Different languages have different typographic traditions, will demand different minimum container sizes based on word lengths and maybe this is shocking but they sometimes run in different directions.

Maybe this is shocking but I'm fluent in a language that is sometimes written veritcally.

"You can't have one single common presentation for every translation" is true in an absolute sense but often not true in practice – eg) we hit most of Europe and North, Central, and South America with ~10 static translations rendered into one common presentational template, none of which run into any of the truly complex layout differences that right-to-left or vertical presentations would bring. We extensively QA all of the languages we do support, and presentation issues are truly pretty damn rare. It's your classic "80% of the result for 20% of the effort" tradeoff.

Now, if you truly do need to localize in every language under the sun then yeah, something like this can make sense, as it gives you maximum flexibility wrt to varying your layout alongside the translation.

But if you have any simpler use-case (eg. supporting just English, Spanish, French and Portuguese will give you an enormous chunk of the planet with minimal overhead, as they have very similar word lengths and presentation requirements) then the approach here is just taking on all of the effort and maintenance overhead of the maximally-complex case when you have absolutely no need to.

msbarnett··on Show HN: Localization and translations should be code, not data
It's a neat idea but by intermixing code, presentation, and data you're going to run into a bunch of issues that the "traditional" approach avoids.

For one thing, we get our translations by handing a yaml file to external contractors. They don't need to squint at a file full of code to distinguish the bits of english that need translating from the bits that don't – they just have to translate the right side of every key, and there's specialized tooling to help them with this.

And for another, even in your toy example in the readme you've now lost a Single Source of Truth for certain presentation decisions. So now when some stakeholder comes to you and says they hate the italicization in the intro paragraph and to lose it ASAP, instead of taking the markup out of a common template that different data gets inserted into, you have to edit each language's version of the code to remove the markup (with all of the attendant ease of making errors that comes along when you lack a SPOT – easy to miss one language, etc). I'd expect these kinds of multiplication-of-edit problems to grow increasingly complex when you scale this approach beyond toy examples.

Basically this seems really hard to scale to large products, and doesn't play well with division of labour.

msbarnett··on Why Can't Database Tables Index Themselves? (2006)
> I think a good DBA ought to be able to better than an automatic process possibly could

Absolutely, although in modern orgs I'd expect this to be the domain of backend engineers rather than "a DBA", a mythical creature I've never actually seen in real life.

msbarnett··on Full-office tech jobs pay 1.9x less than full-remote
Also a sample size of 1, but: my current full-time remote job is strictly 9-5/5 days a week with upper management extremely concerned about ensuring people have a solid work/life balance and sufficient time off.

It also pays 2x what I’d make locally.

Just to say that fully remote is by no means necessarily a stealth sweatshop.

msbarnett··on Ask HN: Can competitors catch up to Apple Silicon?
To reach 87% of the perf of a 12900K at a max clock of 3.2 GHz versus the 12900K‘s monstrous 5.2 GHz, the M1 has something like a 75% IPC advantage.

Are you seriously claiming that you expect a single node shrink from Intel 10nm (roughly equivalent to TSMC 7nm) to Intel 7nm (equivalent TSMC 5nm, the M1’s node) to give Intel an enormous 75% increase in IPC such that they’d be able to compete on performance per watt by not having to clock so stratospherically high (with the attendant voltage penalties) to compensate for their low IPC?

That would be an unprecedented outcome for several node shrinks, let alone a single one. It’s Apple’s super-wide design that’s the primary factor in the IPC here. To pin it all on a single node shrink is magical thinking.

msbarnett··on US regulators to examine Boeing 737 Max production
> My understanding is that they had to change some things about the plane due to efficiency regulations, which should have resulted in a new plane which would require flight lessons. They kept the things that they had to to escape FAA definitions of "different plane" and MCAS made the resulting monstrosity airworthy.

Again, not really. They wanted to put more efficient engines on the 737 to compete with the A320Neo, but keep the 737’s basic height in order to be compatible with the huge number of gates at old regional airports that are essentially built for the exceptionally low shape of the 737. Compatibility with those airports is essentially a competitive advantage for Boeing, as it’s what’s been keeping Airbus from eating their lunch with more efficient planes.

But the new engines were essentially too big for the low slung 737, so they moved them super far out from under the wing, making the plane basically unstable. Yeah, if they’d solved this by redesigning the plane to have more room under the wings it would have moved them out from under the 737’s grandfathered approval and thus required a lot more certification certainty and new training – but it would also have messed up the fundamental sales pitch of “buy this instead of the A320 Neo so that you don’t have to renovate your gates at every regional airport you fly to”.

the big engines moved so far forward creates the inverted stick forces that aren’t a training issue – no amount of training would have permitted them. It’s a Fundamental Airworthiness Requirement that they not occur, and the MCAS exists explicitly to make them not occur.

eg)

> Engineers observed a tendency for the plane’s nose to pitch upward during a specific extreme maneuver. After other efforts to fix the problem failed, the solution they arrived at was a piece of software — the Maneuvering Characteristics Augmentation System (MCAS) — that would move a powerful control surface at the tail to push the airplane’s nose down.

Again, that “tendency for the plane’s nose to pitch upward” isn’t a training issue – it’s flat out illegal for commercial planes to have that characteristic:

https://www.law.cornell.edu/cfr/text/14/25.175

So the MCAS is just an airworthiness issue caused by the legacy market Boeing was trying to continue to be compatible with. They were careful not to call attention to the MCAS to avoid the FAA adding training requirements that would have upset Southwest, is the main thing where that factors in.

msbarnett··on US regulators to examine Boeing 737 Max production
> The MCAS system exists because SWA insisted on no retraining

This is somewhat inaccurate (and appears to trade on the oft-repeated but completely incorrect misunderstanding that the MCAS acts as a sort of “normal 737 emulator”).

In fact, the MCAS exists because without it the MAX would be 100% uncertifiable for commercial flight.

The central problem is that, due to the lopsided aerodynamics of the MAX, as the nose of the MAX moves up and approaches a stall, the forces on the pilot’s stick “invert” such that it becomes easier to continue to pull into the stall than push away from the stall.

Commercial aircraft are not allowed to have inverted stick forces at any angle. When Boeing realized this, they decided to implement a kind of hack that would use the trim to put pressure on the nose downwards to counteract the forces on the stick such that they never invert. The MCAS is the system that commands this downwards trim.

The desire to avoid retraining led Boeing to conceal the existence of the MCAS, but it is not why it exists. The plane flatly is uncertifiable without it. No amount of training would change this, as inverted stick forces are a failure of fundamental airworthiness requirements.

msbarnett··on US regulators to examine Boeing 737 Max production
> Examine what production? Surely no-one is buying this airplane any more ...

Instead of making assumptions, you could easily just find the facts: https://en.wikipedia.org/wiki/List_of_Boeing_737_MAX_orders_...

There are over 4000 orders still outstanding. Hence the ABC investigation repeatedly finding engineers on the project citing time pressure in the manufacturing process: they’ve got a huge backlog of orders.

msbarnett··on US regulators to examine Boeing 737 Max production
It’s not just the computers. The linked ABC report goes into the details:

> More than 42 incidents involved equipment malfunctions, and on more than 40 occasions, flight crews chose to ground the affected aircraft while problems were fixed.

> …

> In one incident on an American Airlines flight in April last year, multiple systems including both autopilot functions stopped working soon after take-off. On landing, the crew found the backup power unit, considered vital for safe flight, had failed and was emitting a strong electrical smell.

>…

> He said some other reports raised by the ABC were bizarre, such as an incident involving a United Airlines flight last August where fuel was found leaking into an overhead passenger bin. Fuel reserves are located in the wings.

>…

> One mechanic said they observed sub-standard manufacturing and testing of the planes, which resulted in wires being left exposed and debris such as rubbish, metal slivers and washers lodging itself inside various parts of the plane, which could lead to electrical short circuits or fires.

>…

> Griffith University's Dr Carim Jr reviewed several incidents from last year involving malfunctions with the MAX's stabiliser trim and said failures involving the component were "quite concerning".

etc

msbarnett··on Is the Ride over for Uber?
> Food delivery also isn’t very practical in developed country markets without a huge increase in productivity vs labor costs

What on earth are you talking about. Pizza and Chinese restaurants have been profitably delivering food for decades.

The UberEats model in particular may be unprofitable, but there are absolutely profitable models that have existed for far longer than I’ve been alive.

msbarnett··on 40% of Google users now connect via IPv6
> Yes, rules do work exactly the same, but with IPv4, you just let all the connections out through, and let just the established and connected ones back

Yeah and? How do you think IPv6 works, it’s exactly the same.

My router’s firewall’s ipv6 section help: “All outbound traffic coming from IPv6 hosts on your LAN is allowed, as well as related inbound traffic. Any other inbound traffic must be specifically allowed here.”

msbarnett··on New California law requires high schools to start later
> Sleep deprivation comes in large part from online behavior

Longitudinal studies observing that teenage circadian rhythms shift towards sleeping in later long predate "online behavior".

msbarnett··on Meta slashes hiring plans, girds for 'fierce' headwinds
Share price has tanked anyway, compensation at FB is less competitive than it used to be.

IME your top performers are generally less compensation motivated than "interesting problem and interesting environment" motivated. Many companies will bend over backwards to give a top performer from a FAANG as much autonomy and interesting work as they want, for compensation differences that aren't that major anymore.

msbarnett··on Meta slashes hiring plans, girds for 'fierce' headwinds
Like I said, I've been through this first hand.

I was exceeding expectations, and given a big promotion in the middle of it. But people I worked with and interacted with every day were feeling extremely stressed and worried about their ability to meet the new bar. Now, in many cases, they didn't need to be worried, but it's natural to question these things in an environment where you're seeing people get PIP'd and unceremoniously shitcanned regularly.

Morale was through the floor, it was an absolutely miserable environment to work in – even though I was personally doing quite well. So I said "fuck this" and was the first person out the door on my team. The second highest performer quit a week later.

The least technically capable person on the team was there for another year.

msbarnett··on Meta slashes hiring plans, girds for 'fierce' headwinds
Yeah, "we hired people we shouldn't have so now we're going to make it increasingly unpleasant to work here" doesn't work.

First-hand, what I've seen happen is that your most talented people, who are the most in demand, leave the organization quite quickly because they correctly realize they don't have to put up with this bullshit. It's the coasters who fear they'll never land an equally cushy job who attempt to ride out the heat as long as they can.

msbarnett··on Modern city dwellers have lost about half their gut microbes
It's probably simpler than that: it's simply not energy-efficient to keep producing an enzyme throughout its life for a sugar that's rare-to-non-existent in an organism's diet for most of that life. Because mammals don't have any means of obtaining milk once they separate from their mother, lactose intolerance for their lifetime after weaning is almost universal among mammals. Over millions of years, the slight energy efficiency win of turning off that enzyme's production post-weaning probably won out.

Humans are odd in that we harvest milk for consumption at all beyond our own mother's, which is probably why we're the only species with a notable population with the genetic mutation that allows some of us to digest it – there's no competitive advantage to that mutation in most other mammals, because where would they even obtain milk?

msbarnett··on Modern city dwellers have lost about half their gut microbes
This has been studied, but the results tend to argue that it's purely genetic, eg)

https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6669050/

> Studies that have measured changes in endogenous lactase activity after an intervention period consistently show a lack of enzyme induction, suggesting that lactose intake does not affect an individual's lactase activity. Although these studies are scarce and have relatively few subjects, data from cross-sectional studies support the theory of purely genetic regulation

msbarnett··on Modern city dwellers have lost about half their gut microbes
No. In fact, almost all mammals stop producing lactase once they stop nursing from a mother. Humans are quite rare in that there's a significant population with the mutant "lactose tolerant adult" gene.
msbarnett··on Modern city dwellers have lost about half their gut microbes
> People are becoming even lactose intolerant.

This isn't new, and certainly isn't some crisis of the last 100 years. Historically only a minority of the planet has ever been lactase persistent into adulthood. It's a well-understood genetic trait, not some product of gut microbes.

msbarnett··on Arm Unveils Next-Gen Flagship Core: Cortex-X3
This is the argument Apple fans used to make during the PowerPC G4 days – “it doesn’t matter that Intel makes faster CPUs, because I can’t buy a Mac with them, so the comparison is irrelevant and not worth looking at”. Except, over time, it did matter as sales bled off to Windows machines.

Yeah, the OS matters, but it isn’t the only thing that matters to most people (and with the web, the loss-of-applications cost of switching your OS is a lot lower than it used to be).

msbarnett··on Arm Unveils Next-Gen Flagship Core: Cortex-X3
AArch64 is, effectively, a totally new instruction set. It was designed to allow for fully regular decoding, unlike AArch32 & Thumb, which is a big part of why getting those off of the chip is a big win – it's not just the decoders you clean up, you can now make your pipeline and speculation deeper because you can peek N instructions into the future without having to decode the N-1 instructions in front of it first to figure out where the Nth instruction lies. That's part of why you see AArch64-only designs like this and the A12+ cores with much larger reorder buffers.
msbarnett··on Arm Unveils Next-Gen Flagship Core: Cortex-X3
Obviously some of those are intentional architectural deviations, but is there a good reason to believe the stuck HCR_EL2.E2H bit isn't just an errata?
msbarnett··on Arm Unveils Next-Gen Flagship Core: Cortex-X3
No, like the X3 they dropped 32-bit compatibility (Apple dropped it in the A11, ARM dropped it for Cortex-X in the X2)
msbarnett··on As eng manager, you so frequently get request to drop what you are doing
Yeah, but running around with your hair on fire from half-finished “urgent request” to half-finished “urgent request” is still a recipe for complete failure all the same.

How you communicate where a customer’s urgent request falls on the roadmap may change, but it’s never a smart move to upend the roadmap just because the customer thinks something is urgent.

msbarnett··on SQLite or PostgreSQL? It's Complicated
If I had a dollar for every time I saw someone doing application-layer-only validation of data and end up being surprised that some data that wasn't supposed to be valid ended up in the database only to later blow up in their face, I'd be a fairly well-off man.

In practice, declaratively creating data constraints at schema-creation time has a much much higher success rate than trying to imperatively enforce data constraints at write time, in my experience. The missed cases and bugs always come back to haunt you.

msbarnett··on SQLite or PostgreSQL? It's Complicated
Sorry, "corruption" was probably misleading there. By "silent data inconsistency/corruption" I mean, "a bug in my application led to me storing strings in an integer column, or too-long data in a too-short column, and SQLite just silently let me do that"-type errors – the data consistency is logically (but not physically) corrupted. The author encountered 2 separate occurrences of this just in their simple use-case, evidently.
← PreviousPage 5 of 34Next →