HNHacker News
TopNewBestAskShowJobs

victorNicollet

656 karma · joined February 18, 2011

submissionscomments
victorNicollet··on Scala Native
Purity is not a goal in itself, its purpose (its meaning) is to help me answer useful questions about the behaviour of the program.

In a typical IO function, `fn()` only gives me 10% of the code in `fn`: the part up to the first bind. To get the rest, I need to `do` it, and this is where purity is no longer meaningful:

    a <- fn "a"
    b <- fn "b"
Can I swap these two lines ? The IO monad tells me there might be consequences, but what are they ? Another example:

    foo fn 
Will `foo` trigger the IO effects of `fn` zero, one or more times ?

I believe these are meaningful questions, and yet, a program built from pure functions can answer them no better than an imperative program.

victorNicollet··on Scala Native
In a typical IO function, the first 10% of the code returns a monad-bind that holds the remaining 90% of the code in a closure. The pieces are pure, but the whole isn't meaningfully pure.
victorNicollet··on Tech firms “can and must” put backdoors in encryption, AG Barr says
This isn't a ban on end-to-end crypto. A company would still be able to use end-to-end crypto, as long as they control one end, which is already the case in ecommerce.
victorNicollet··on LinkedIn is moving to Azure
As an Azure customer, I have hopes that having a bigger fish in the pond would help improve reliability and availability, but those would likely happen for services that are already reliable.
victorNicollet··on PEG Parsers
This has always struck me as significant effort invested in making a bad user experience only slight less bad: the REPL overloads the meaning of "enter" to mean both "insert a new line" and "execute command", and then attempts to guess what the user meant by tweaking the grammar of the language. Why not distinguish between "insert a new line" and "execute command" as two distinct inputs, and eliminate all ambiguity ?
victorNicollet··on Distributed Monoliths are secretly plotting against you
In this architecture, events are a persistence strategy. Once created, they are saved forever, so if they get dropped, it calls for an investigation and a restore from backup.

Having worked with such a system before, the real pain is that any data exposed by one microservice to another becomes an API, and it is very hard to design events that are both a good public API and a private data persistence system. Immutability means consumers of your API will need to understand, and deal with, obscure concepts and business rules from five years ago, because those events are still around.

One of the major points of an API is to hide private complexity behind a public abstraction that you can design and update as needed.

victorNicollet··on France has approved a digital services tax despite threats of retaliation by US
It's true that when a French person comes to your country to buy your product, then goes back to France, the burden is on them to pay the relevant customs and taxes.

On the other hand, I would argue that the market of people who would come to your country to buy your product is significantly smaller than the market of people who buy it on the internet and have it delivered---and it's fairly typical for companies sending products to France to be asked to collect any duties, customs and taxes from the purchaser. Why would electronic delivery be different ?

victorNicollet··on Why Cutting Costs Is Expensive How $9/Hour Engineers Cost Boeing Billions
From what we know about the 737 MAX issue so far, the software not performing as specified was not one of the causes. The article's jump from "these accidents cost lives and money and can be resolved by a software patch" to listing tools and processes that ensure software behaves as specified, seems unjustified.

Even the idea that a good software engineer would have caught the problem in the specification seems far fetched. The MCAS software was designed with a low impact (small individual corrections, small maximum total correction) that would have appeared safe to anyone, and those constants were increased later on. Do we expect good software engineers to second-guess changes in physical aero constants coming from aero engineers?

victorNicollet··on Type inference has usability problems
Going a bit off-topic...

At some point, if a module/pass/service is large enough, it becomes worth investing in a local naming convention that carries the relevant type information, and enforce that convention through code reviews. Module-specific hungarian notations, if you will.

I'm working on an inference pass in a compiler, and it's up to 2000+ lines of F# manipulating tuples/dimensions/tables/chains/indices, and identifiers referencing these.

1. each variable in the module can have one of these ten types, not immediately obvious from their names. While I can hover the variable and have the IDE tell you the type, it happens so often that it feels like hunting for an invisible cow.

2. a typical method will contain several variables related to the same concept. When inferring a "group by" statement, I will have an "origin tuple", from which I infer the "origin chain", from which I extract the current "origin table", and construct an "origin index", from which I discard duplicates to obtain an "unique index", which defines a new "unique table" for which it is the primary "unique dimension", and there is a corresponding foreign "origin dimension" on the "origin table". Some of these will also need to be indirected through identifiers.

In the end, there's a "hungarian.md" file in the module that explains that a `vec` suffix is a vector, `vecs` is a vector tuple, `vid` is a vector identifier, and so on.

victorNicollet··on Web Single Sign-On, the SAML 2.0 perspective
I agree that the service provider shouldn't expect the SAML identifier to be an email. I suspect that the SUNetId is something readable (based on the human's name) as opposed to a fully opaque alphanumeric string ?

On the other hand, having emails (or namespaced identifiers that look like emails but aren't) does provide a nice way to start the login process from the service provider's login page, as opposed to having to start from the IdP side, since the service provider can infer which IdP to use based on the identifier's namespace.

victorNicollet··on Web Single Sign-On, the SAML 2.0 perspective
I'm saying all of this as the CTO of a B2B service that accepts SAML for authentication.

> How well does it actually work in practice?

For authentication, pretty well. No downtimes observed on Google, Microsoft or customer-owned IdPs over the last 4 years of using SAML in production.

The customer's IT can easily provide you all the necessary data about their IdP as a standard format metadata.xml file. In return, you give them two URLs (your entityId and your ACS endpoint).

In case of IdP certificate change (once every few years unless something happens), they just send you ahead of time a new metadata.xml containing both old and new certificates, so you don't have to be there with you finger on the button to change the certificate on your side.

The only complex thing is whether any user that comes you way should have an associated user profile created in your application (i.e. any employee in your customer's directory is one of your users by default) or if you deny access to users that have not been manually registered in your application by the customer's admins.

> How does the authorization part work?

Not as elegantly as authentication. You need the IdP to provide you with additional information, such as roles. Not all IdPs can do this properly. Then, you need to manage your own mapping from that information to actual authorization info. Also, since you only get data from the IdP once (as part of the identity assertion), you won't have the granularity to provide per-resource access control.

In the end, we've found it far easier to use SAML only for authentication, and to implement an RBAC on our side, based on the identity of the users.

> How easy/hard is it for a developer? How about setting up an identify provider in dev?

Mature libraries exist for all major languages to deal with the crypto part, and the SAML protocol itself is trivial in terms of HTTP (redirect user to appropriate page on the IdP, receive a crypto-signed identity assertion on your ACS endpoint). It took me 3 days to go from zero to fully implemented and tested, in C#, and with extensive logging to detect sign-in issues.

Whenever possible, use the email as the user identifier. You can manage with any other kind of identifier, but debugging is significantly easier, since you don't have access to the customer's IdP to know the correspondance between an actual user and its opaque identifier.

Another important tip: even if you have a strong ownership between a customer and a customer subscription, some employees of your customer may need to access several customer subscriptions (for example Wrike project management: you can use it internally, and also participate as external contributors in projects from other companies) so you need to either allow an user account to access several customer subscriptions (likely hard) or allow a single SAML login to connect to several user accounts in several customer subscriptions. With email + password this could be worked around by using mail aliases (e.g. victor+companyA@example.com, victor+companyB@example.com) but with SAML you are limited to only one identity, so if you don't allow multi-user SAML, you end up in a situation like Wrike (again) where we actively discourage our customers from using Wrike internally because we want their employees to connect to our Wrike subscription...

Setting up an IdP... depends on how much you want to dogfood. If you have Office 365 or Google Suite, you already have an IdP that you can use easily to connect to your own system. I used Salesforce, which has a "free" level.

victorNicollet··on Show HN: Empirical – a language for time-series analysis
I really like the `asof` keyword, so I'll be stealing it for my own language :-)

I suppose that `from ..` does not print the result, but rather returns a new dataframe that just happens to be printed by the REPL ?

victorNicollet··on We got banned from PayPal after 12 years of business
I dislike PayPal as much as the next guy, but I don't get this:

> PayPal will also stop letting you refund the percent they take out so you will be holding the bag when you refund a customer.

When I refund a customer, I wouldn't expect the power company to refund the electricity spent serving that customer, and I wouldn't expect UPS/FedEx to refund the delivery of that customer's package. Why should PayPal refund the costs of the customer's transaction ?

victorNicollet··on Foundations of Databases (1995)
A well-known OpenGL book was also the Red Book.

http://www.opengl-redbook.com/

victorNicollet··on WTF Is Big O Notation?
I believe the point was that, if your linear search happens to return your first element, you did not perform 1000 operations.

The context is a linear scan, not alternative algorithms that could make use of a sorted data set.

victorNicollet··on Dreaming of a Parser Generator for Language Design
In most programming languages, a fact like "Foreach loops have a variable binding, a collection to iterate through, and a body" is guaranteed by the parser, and the rest of the language implementation can assume that the foreach loops are well-formed and concentrate on lexical and type checks.

An S-Expression parser will accept (loop for in do), and the rest of the language implementation has to deal with detecting that there is no variable, no collection and no action.

victorNicollet··on Windows 10: New study shows Home edition users are baffled by updates
Not the author, but I regularly leave my computer with a debugging session open (because it's 7pm and it's time to go home). If Windows reboots, it sometimes takes hours to reproduce the bug and reach the same breakpoints again.
victorNicollet··on Growing a Compiler: Getting to Machine Learning from a General Purpose Compiler
Shadow IT. A client asks: if we cancel our subscription tomorrow and our competitor acquires your company next year, will our data have been deleted by then ? And if you have employees sharing customer data with each other over unsanctioned channels, you can't really answer "yes".

Blocking Google Docs is by far the cheapest way to prevent its use, even considering the downsides of a complete block.

victorNicollet··on Pricing algorithms can learn to collude with each other to raise prices
This result is not surprising. Having a rule that sets your prices, with your competitors' prices as the only variable input, creates a dynamic system that can easily converge on supracompetitive prices with the right parameters, and you are likely to change parameters when they result in a price collapse in the first few days of operation, overfitting your way into mutual agreement.

I would be interested to see if a pricing system that tries to estimate elasticity and seasonal demand (and product lifecycle), in effect using customer behaviour as an input, can also converge in this way in a reasonably short time.

victorNicollet··on 38% of bugs at Airbnb could have been prevented by using types
I mentioned Typescript as an example of language where I could do this, so... Yes?

Typescript is not a language I would say has a verbose type system.

victorNicollet··on 38% of bugs at Airbnb could have been prevented by using types
In a statically typed language, the code will not run until I have convinced the compiler that it should. If I wanted to explore the behaviour of `frobnicate` before committing to a design, I would still have to define all those satellite types that may well become unnecessary.
victorNicollet··on 38% of bugs at Airbnb could have been prevented by using types
The problem is not that it takes a while, but that it takes a while when I'm in the middle of a complex task. Because of language verbosity, I might need to context-switch away from solving a hard problem.

For instance, if I am writing a complex function `frobnicate(x)` and I notice that I need to pass a configuration object to the function, I can just `frobnicate(x, opts)` in the function declaration, and `x.foo` to access the relevant option, and go back to the complexity that is still fresh in my mind.

With a verbose type system, I need to pick a type for `opts` NOW, which means I need to define a new type NOW, which will typicaly involve a new file with at least a dozen lines. By the time I'm done generating those stubs, the hard bits of the original function will have faded from my mind.

The code I write, in either case, isn't the final code. Once I have an initial working version where the complexity has been embedded in actual code instead of floating around in my mind, I can start iterating, refactoring, annotating, and so on. In TypeScript, at this point I will define a new options type and annotate `opts` with it.

victorNicollet··on How many keywords I can fit into a single C# expression?
Given the rule:

  expr := 'if' expr 'then' expr 'else' expr
An expression may start with a sequence 'if if if if ...' of arbitrary length (and will contain that same number of 'then' and 'else' keywords, although not as a sequence).
victorNicollet··on Notices have already been issued under Australia’s new encryption laws
The hotel room analogy is almost correct.

Hotel rooms usually provide a small safe for which guests can pick the combination. There is also a secret backdoor combination or master key that lets hotel staff open the safe.

This creates an obvious security hole : if the backdoor combination is easy to guess, or a copy of the master key falls into the hands of unscrupulous employees or ex-employees, then the contents of the safe can be stolen. As a guest, there is nothing you can do to reduce this risk.

Now, imagine that a hotel found a solution where locked safes are destroyed and replaced at almost no cost to them, and could give up on the backdoor. Burglaries involving the backdoor would vanish, and although this slightly increases the risk of losing your belongings by forgetting your combination (since the hotel can no longer open the safes of forgetful guests), it's a net improvement in security.

Ten years later, the hotel community has reached a consensus that safes-without-backdoors are the Right Thing to Do. The state then mandates that all hotels should be able to give access to the contents of those safes to the police. But they're not saying that hotels have to use a backdoor combination or master key, so they're not really asking anyone to reduce the security of their safes...

victorNicollet··on Event Sourcing is Hard
Migrating snapshots just moves the pain of changes : instead of letting the new projection logic replay all past events, you write code to migrate snapshots and hope that it will give the same result as the replay.

In those cases, I would rather do the replay, but do it offline before the release.

victorNicollet··on Ask HN: What do you use for authentication and authorization?
Custom rules on top of ASP.NET middleware.
victorNicollet··on Ask HN: What do you use for authentication and authorization?
We use SAML set up for our customers' identity providers (most of the time, Office365 Azure AD or Google Suite), from a NuGet package.

From there, it's a bearer token encoded in JWT format for ease of debugging. From another NuGet.

We also support username and public key authentication for our SFTP server.

We do support username and password if necessary.

victorNicollet··on Why you should learn F#
This is what F# does (define multiple classes), but each of these classes only takes one line of code.
victorNicollet··on Why Use F#?
C# now has active patterns (which feel like the `is` pattern matching) in the ability to declare a variable as you pass it as an out parameter to an extension function, e.g.

    if (num.IsNotPrime(out var a, out var b))
        WriteLine($"{num} = {a} × {b}");
victorNicollet··on Why Use F#?
To this list, I would add code quotations. You can <@...@> around any expression and get a syntax tree at runtime that you can explore, transform and even compile. While C# does have a similar feature in Linq.Expressions there are entire categories of (completely banal) C# expressions that cannot be quoted.
← PreviousPage 4 of 9Next →