HNHacker News
TopNewBestAskShowJobs

kmontrose

350 karma · joined January 9, 2011

Microsoft employee.

Formerly I worked on Stack Overflow and Stack Exchange.

http://stackoverflow.com/users/80572/kevin-montrose

submissionscomments
kmontrose··on Show HN: LINQ for Go
Another approach using code generation is gen: http://clipperhouse.github.io/gen/

(Disclaimer, I work with the guy behind it)

Personally these sorts of libraries just strengthen my opinion that golang really needs proper generics. However, if you're already gonna use Go they're pretty neat.

kmontrose··on What Every Software Developer Must Know About Unicode (2003)
There's a reason a ton of legacy code is UCS-2^/UTF-16 and not UTF-8.

The code is older than UTF-8.

Windows NT was first released in '93, UTF-8 didn't exist (much less have wide adoption) for most of it's development. Likewise, NeXTSTEP had an initial release in '89. Java and JavaScript (both '95) could have adopted UTF-8, but they're almost certainly running on an OS that expects UTF-16 soooo... yeah.

^UCS-2 was superceeded by UTF-16, so you'll find them used interchangeably a lot.

kmontrose··on Go 1.2
AOT is a Mono extension to .NET, there are some cases it doesn't work and generics can cause some of them. See: http://www.mono-project.com/AOT for more details

For .NET proper, new machine code is generated at runtime. I believe (but do not know for sure, offhand) that it basically takes the IL definition of the generic method, slots the now known type into it, and JITs it to get the machine code it needs. I do know that there are couple bits of IL that are meant to make it possible to write the same code to deal with both reference and value types, which is probably related.

Ngen (http://msdn.microsoft.com/en-us/library/6t9t5wcf(v=vs.110).a...) let's you transforms assemblies into machine code up front, while still being .NET proper. However, if it can't find a use of generics with concrete types found at runtime (ie. you generate a List<int> via reflection) you'll still load up and use the JIT (see some discussion here: http://stackoverflow.com/q/16647568/80572).

I don't use AOT or Ngen regularly, so the particulars may be a little off in my explanations. But that's the gist of it.

kmontrose··on Go 1.2
Why would you expect execution to be slower? If you invoke List<T>.Add(T) where T = int you end up running the same machine code that would have been generated if instead you had a method List.Add(int). There is a cost paid to generated that specific method, but it's on the first invocation. I'd expect it to be much faster than boxing, because you can elide a bunch of a allocations and generate tighter code since you have additional typing information at code gen time.

I suppose debugging could go sideways in theory, but it doesn't happen in practice on .NET and I doubt the go team couldn't figure out how to make it work.

It's worth noting that .NET never interprets bytecode, it always converts a method into machine code before execution. Go has already had dynamic code generation as part of it's implementation (I don't know if it's still around in 1.2), so it's hardly like it can't do the same thing .NET is.

kmontrose··on Go 1.2
In C#...

At compile, there's one version of a generic method (say List<T>.Add). Compilation isn't slowed down like in C++.

At runtime, a generic method is compiled (on demand) into unique versions for each T encountered if T is a ValueType (int, double, etc. including user defined ValueTypes). This avoids boxing, like in Java.

Also at runtime, for all T's that are reference types a single common version is used with implicit casting as in Java.

C#'s draw back is that there is a small cost incurred on the first use of a generic method, and then an additional cost for each new ValueType used (if any). In practice this doesn't ever seem to be an issue, but it's there.

See http://stackoverflow.com/q/5342345/80572 and http://www.artima.com/intv/generics.html (which is linked from the former).

kmontrose··on TypeScript and the Road to 1.0
TypeScript appears to compile even in the face of undefined variables.

Just went to the playground and dropped a random jQuery sample in: http://www.typescriptlang.org/Playground/#src=%24(%20documen...

You get squiggles yes, but you also get valid javascript. So it looks like you can paste random javascript into TypeScript and get it to compile. I went and tried with the actual compiler (to make sure it's not some artifact of the playground website), and confirmed you get a proper .js file out (and 2 messages, about $ being undefined).

Quick google makes it sound like getting rid of the squiggles / messages is pretty easy: http://stackoverflow.com/a/12755602/80572

I'm not sold on TypeScript yet (or any of the transpiled javascript languages, honestly), but this:

> False. Typescript will choke on most JavaScript files from the web.

Seems to be the actual false statement in this thread.

kmontrose··on Did Stack Exchange staff members assist in the apprehension of Ross Ulbricht?
Don't forget user support. It's not all that uncommon for someone to forget their account, lose a password, or an email address. Circumstantial evidence can support ownership of the account, and let us fix things for them.

There are also errors on our end like account merge bugs, moderation mistakes, dropped/flagged/whatever recovery emails, and so on. Keeping additional historical data can help us recover in those cases.

If you're smart about what you track it's not that much data; we record most changes to user records into a history table (likewise, and for the same reasons on post records). Keeping traffic logs around and queryable forever would be really, really expensive though. We keep some around, but only really recent stuff is easy to query (about 2 days) since that tends to be what's needed when reproducing bugs. I don't even think we have all traffic history, and old stuff would require digging a tape out (if we even move those to tape like we do with DB backups, I honestly don't know; it's never come up).

Moderation is a good reason to keep lots of data around, you're right, but it's not the only one.

Disclaimer: Stack Exchange, Inc. employee.

kmontrose··on The Bonehead Mistake That Brought Down an Online Drug-Dealing Empire
What I was pointing out was that there was a confirmation of some sort presented to the user that indicating something that personally identified them was being shared.

Stack Overflow does take a "full name" (in OpenID attribute exchange terms) as a user name if provided by an OpenID provider, though we explicitly don't demand it (it is not "required" in AX terms). Exactly how a provider deals with "optional" attribute requests is up to them, in practice I think most everyone ignores it unless it's also public information on their service (ie. full name == user name).

Offhand I want to say Facebook is the only login option used by > 5% of our users that provides a name. I did not actually confirm that by testing, just working from memory.

You are correct in that Stack Overflow never displays user emails during normal operation, excepting employees and moderators (who are bound to an agreement before accessing such information: http://stackoverflow.com/legal/moderator-agreement ).

Disclaimer: Stack Exchange Inc. employee

kmontrose··on The Bonehead Mistake That Brought Down an Online Drug-Dealing Empire
There would have been an interstitial page mentioning that his email was being given to Stack Exchange by his OpenID provider.

Depending on when exactly when he registered, there may have been (and now always is, when using a third party login iirc) another page on the Stack Overflow side that confirms new account creation and again displays the provided email.

Basically, he clicked through at least one "sending personally identifiable information, are you sure?" page. Maybe more than one.

Disclaimer: Stack Exchange Inc. employee, I've done some work on our user login stuff in the past.

kmontrose··on Where Is .Net Headed?
At Stack Overflow we ran on Bizpark til sometime in 2012, it really is a very nice program (everyone seems to forget that you keep the licenses you get, it's not like you have to re-buy everything when you graduate).

While I suppose in theory Joel could have thrown a lot of money away just because it didn't happen that way. Stack Overflow was running on it's own income until the first round of funding ( http://blog.stackoverflow.com/2010/05/announcing-our-series-... ), excepting the pre-launch period (everyone might have just taken equity then, I don't know I wasn't around until just before the series A). I think it was mostly ad income, though Careers ( http://careers.stackoverflow.com/ ) was around fairly early too.

Disclaimer: Stack Exchange employee

kmontrose··on Rails 3.2.13 - Performance regressions and major bugs
We're on ASP.NET MVC4, a stock build.

We've configured route registration a little bit specially* to speed up some common cases and we don't necessarily use every feature in the framework; but we're far from a proper fork.

ASP.NET MVC performs well enough that we get more bang from focusing on our own code basically.

*This amounts to registering our highest traffic routes _first_, and checking left-hand matches before Regex'ing (since we have a ton of "/foo/\d+/bar"-ish routes).

kmontrose··on Stack Exchange’s Colocation Move: Lessons Learned
You give up a lot moving to a cloud solution.

http://blog.serverfault.com/2011/03/23/performance-tuning-in... is my go to "we couldn't do things like this in the cloud" example.

Not to say the cloud is never the right choice, it's just never made sense for us.

kmontrose··on Stackoverflow abuses nofollow (2011)
Those should have been un-nofollow-ed (went and looked the algorithm up), so that's probably a bug.

I'll dig into it, should have a fix in the next deploy (assuming it is a bug, but I don't see what else it'd be).

kmontrose··on Stackoverflow abuses nofollow (2011)
This was dealt with more than a year ago, when we did remove nofollow from trusted posts links' http://meta.stackoverflow.com/questions/111279/remove-nofoll....

Would have been dealt with even earlier, but our experiments with it (http://meta.stackoverflow.com/a/69032/130213) lead us to believe Google was starting to treat us as a link farm.

What we were seeing in our earlier attempt wasn't pages appearing lower in results (which could reasonably be expected in some cases as a result of the change; and we wouldn't care, 2nd on a search under an equally good resource is fine by us), but pages being removed entirely; almost universally pages that had newly un-nofollow-ed links to stores, or ad-laden sites (mostly legitimate posts, but some spam that stuck around for a bit before the community deleted it). So, "classified as link farm" seemed like the most likely problem. Google naturally won't tell you why your ranking drops, so it was (and remains) just an educated guess as to what happened.

So we stopped, putting it on the "wish we could, but reality doesn't let us"-list until Google reached out to us (among thousands of others, I'm sure) to change our nofollow practices. Google didn't describe any changes in their algorithm, but it seems reasonable to me that there would have been some tweaks around nofollow to accompany a new policy; again just an educated guess.

Basically, this is an old post complaining about a long since addressed concern that we had tried to address even earlier but ran into practical problems with.

While the exact details of our algorithm are secret by necessity, I will say that we've had to consider posts individually to prevent spammers from kiting a single account up to post nofollow-less spam content. People still try, it's kind of astounding how much spammers try (I suspect SEO's opaqueness cuts both ways here), but it doesn't work (well, you can get one link in your profile; but there's less SEO juice to pass and you are hard-capped at one, no matter how long it takes someone to delete your account).

Disclaimer: Stack Exchange employee, I was on all the relevant calls but has been a couple years so grain of salt and all that.

kmontrose··on New Jersey To Allow Voting By Email
I was under the impression that was because the PA law was challenged on discrimination/disenfranchisement grounds which falls under the Voting Rights Act. I want to say certain states do have to get pre-approval before any voting changes under the VRA due to a history of voter discrimination, but I'm pretty sure PA isn't one of them.

Not aware of any blanket deadline on changing voting processes, do you know which law that's in?

kmontrose··on Stack Overflow's Original 99designs Logo Contest
That was so long ago, I'm pretty sure the (then 3, counting Jeff) developers weren't even getting paid yet. Might still have been running the site on a (single!) box under somebody's desk. Was still a few months til the private beta started.

I'd imagine (since I wasn't around at the time) it was more of a choice between "pay nothing" and this, Stack Overflow had no income until after launching (ads I think were the first thing) and no funding for years after that.

kmontrose··on Peer review of "Quantitative Analysis of the Full Bitcoin Transaction Graph"
Calling this peer review is... charitable. Glancing over the commenters, most of them have some bitcoin related activity and none of them have any cryptography related publications or notable work (that I can easily find anyway).

So far as I can see, this is just bitcoin fans trying to discredit a paper co-written by Adi "I helped invent RSA" Shamir which is somewhat unflattering to bitcoin.

kmontrose··on OAuth 2.0 finalized
I haven't gone over the final spec in depth yet, so I can't really address OAuth 2.0-final specifics.

In general though, I think the ease of development that comes from query strings trumps any supposed security gains of using headers for passing parameters.

Fundamentally, if you're worried about secrets being logged you're worried about MITM attacks (if either endpoint stores secrets insecurely, that's a whole other concern). If someone's actually managed to MITM a user, it's no harder to capture headers than query strings; so it's a mostly false sense of security. To prevent MITMs, you should just mandate HTTPS; that gives you some real improvement, not just one for the very narrow "traffic logs subsequently compromised" case (and even that assumes the log in question isn't capturing headers, which may be typical but is by no means universal).

kmontrose··on What the Heck Is CSS Specificity?
That's the spec as of CSS3, pseudo elements get ::, pseudo classes get :.

Practically speaking browsers will accept : for everything, possibly forever.

kmontrose··on OAuth 2.0 finalized
Facebook's implementation of OAuth 2.0 differs from the (now final) spec.

It's mostly trivial things last I looked (comma delimited scopes instead of space delimited, `expires` instead of `expires_in`, and so on). Glancing over the final spec, seems headers are preferred now (which is almost always dumb IMO, but that's a whole separate rant) and Facebook only does query strings.

Looks as though the spec bloated a bit, though there's probably still a sane-ish kernel worth implementing in there compared to OAuth 1.0a.

kmontrose··on Help find a bright object on Mars
Technical our email-based login is also OpenID; https://openid.stackexchange.com/ , we just hide the details.

And even more nitpicking-ly, our Facebook login is OAuth 2; not OpenID.

But yeah, there's no relation between user display names and their logins.

kmontrose··on Stack Exchange Machine Learning Contest
Everyone seems to have skipped right over this:

"In a perfect world, we'd be able to offer specific, targetted guidance for authors whose posts were likely to be shot down, before they ever showed up on the site, and without requiring as much up-front effort from our community."

Which is waaaaay before the classification line.

kmontrose··on Stack Exchange Machine Learning Contest
There is a 0% chance of replacing moderators with bots.

I don't even know how you could read that blog post and come to that conclusion...

kmontrose··on Stack Exchange Machine Learning Contest
It's in the terms of service.

But seriously, Stack Exchange thrives because of its focus (which is maintained in large part by its culture of moderation, though only a small part of that is done by actual "moderators"; the community self-polices pretty well).

This contest is aimed at catching posts that would be closed before they're posted. Ideally we'll get a classifier that lets us give guidance to the askers. Better education of new/confused/troublesome users, leading to better posts, and fewer closed questions overall.

(Disclaimer: SE Inc. employee, yadda yadda yadda)

kmontrose··on Preparing Yourself for Modern JavaScript Development
Nonsense, a VM is what it's defined to be. If you wanted the x86 (or ARM, or PPC, etc.) instruction set to be your bytecode, you've got it.

That article starts from the assumption that any in browser VM will resemble the JVM; which is a faulty assumption. In fact, any in browser VM would have to be very different from the JVM since Rule 0 for any such VM would be "acceptable Javascript performance".

From that article:

> Meanwhile, JVMs don't do these optimizations. Since all types are statically

> known, the compiler knows exactly how much storage they need and what

> operations they support. It can then generate appropriate tight code for those

> types. This is fast if your language is statically typed, but if you're trying to

> compile a dynamically typed language to the JVM, it won't be able to run as fast as a

> VM that can assume dynamic typing all the way down and optimize specifically

> for that.

A whole wasted paragraph. Of course a browser VM wouldn't be statically typed, that'd make compiling/running Javascript a bear. One would hope there'd be some system of type-hinting, because eliminating dynamic dispatch is really low hanging fruit in terms of optimization, but JVM/CLR-style static typing? Madness.

kmontrose··on Preparing Yourself for Modern JavaScript Development
There's a wholly unconvincing argument as to why Dart isn't pushing a VM as well, http://www.dartlang.org/articles/why-not-bytecode/ . Might as well be titled "Why not the JVM?" in my opinion.
kmontrose··on StackOverflow Man Remakes Net One Answer at a TIme
You can vote before you can comment (15 and 50 rep generally speaking).

Once you get over 200 rep anywhere in the network, you'll automatically get a +100 rep bonus on other sites you join so you don't have to "grind it out" for the basic privileges.

The low rep hurdles (anything < 100) are basically "know how everything works" bars (the number of people who mistake "answer" for "forum-style reply" and "community close votes" as "moderators" backs up the need for such hurdles), the high ones (down vote, edit, close, etc.) are the "strong community" ones.

kmontrose··on Java 8 Lambdas
> This means classes with a better implementation can just override Count() and suffer none of the problems of the extension method approach.

Instance methods are bound before extension methods, if someone provides an implementation of Count() in a subclass it'll be invoked instead (provided your reference is typed appropriately). More narrow extension methods are bound before general ones, so you can even "override" within extension methods.

Scala has some neat stuff, but it's not Java 8 so I don't see how it's relevant.

> Btw, C# has some limited form of implicits, too, but I haven't seen any serious usage of them for a while.

C# has implicit conversion operators you can define, http://msdn.microsoft.com/en-us/library/z5z9kes2(v=vs.100).a... . You'd better have a really good reason for defining one though, silent conversions are generally frowned upon.

kmontrose··on Java 8 Lambdas
What about interface defaults prevents or precludes that hack/optimization? You have exactly the same information after all.

For example (disclaimer, it's been a bit since I've touched these classes; but you should get the idea), an extension of Iterator that adds a longSize() method would probably want to make use of ArrayList's size() rather than iterating over the whole thing too.

As an aside, if your code absolutely and utterly depends on a certain operation's runtime performance you had better be using a type that actually guarantees that performance. List<T> guarantees Count is O(1) ( http://msdn.microsoft.com/en-us/library/27b47ht3.aspx ) , IEnumerable<T> doesn't ( http://msdn.microsoft.com/en-us/library/bb338038 ); that's your bug.

kmontrose··on Java 8 Lambdas
C# extension methods are used for considerably more than adding new methods to existing interfaces, though that is a valid use of them.

They also don't require you have access to the source (anybody can write an extension method on System.Collections.IEnumerable, not just the BCL team). That they work on any type (not just interfaces) also makes them considerably more general than default implementations.

I also find the idea of an interface carrying implementation a little weird, the abstract class/interface line gets a lot blurrier.

That said, lambda support that only worked on new code would be pretty lackluster; so it's good some thought has gone into getting them into legacy code.

← PreviousPage 2 of 4Next →