HNHacker News
TopNewBestAskShowJobs

lhecker

558 karma · joined July 6, 2015

submissionscomments
lhecker··on When I tell the Windows Terminal team something is simple, I am "misguided"
I didn't say they were pointless anywhere. They were anything but.

I did say however: If we had figured out a way to solve the issue while we continue using Direct2D, we would've definitely sticked with Direct2D. Since there was no solution, there was only one other way to solve it and it's a way that has many other terminals already do it.

lhecker··on When I tell the Windows Terminal team something is simple, I am "misguided"
We actually took the same approach Casey suggested, at least when it comes to the drawing part which is what this is about. A lot of terminals implement it that way. We have a long way ahead of us to improve the performance of our text ingestion now though.

I'm not sure what role Casey's feedback had in this being considered for implementation. His original termbench tool was _incredibly_ valuable for sure, but I'm not sure later discussions changed the outcome of that. If we had figured out a way to solve the issue while we continue using Direct2D, we would've definitely sticked with Direct2D. Since there was no solution, there was only one other way to solve it and it's a way that has many other terminals already do it.

lhecker··on When I tell the Windows Terminal team something is simple, I am "misguided"
I'll try to avoid sarcasm in the future.

What I haven't understood yet is what significance "The solution is trivial" being sarcastic or not has on the article itself. I understand it's reflecting poorly on it due to what I said earlier, but is there something that makes the article harder to understand due to this? (I realize this question sounds a bit rude, but I'm genuinely curious and I don't know how else to phrase it.)

lhecker··on When I tell the Windows Terminal team something is simple, I am "misguided"
Thank you for your suggestion! I believe I can't just edit the article now, since that would be disingenuous, but I'll try to avoid sarcasm in the future and use something like you suggested instead.
lhecker··on When I tell the Windows Terminal team something is simple, I am "misguided"
Oh yeah, for sure. I can't tell you how much I regret being that defensive about something that benign. This was certainly a life lesson. I've apologized to Casey in person before (well, to my best ability) and I'll apologize again if given the opportunity to do so.

I just wish people wouldn't say I'm taking credit, when it's an old, widely used idea and when I spent such an incredible amount of time reading and understanding DirectWrite/Direct2D's code in order to ship this renderer in the state it is.

lhecker··on When I tell the Windows Terminal team something is simple, I am "misguided"
Hi! I'm the person who wrote that blog post. If you have any questions whatsoever, please let me know!

English is not my native language and "The solution is trivial" was meant sarcastic. The solution isn't trivial at all, nor is it complete, because solving the corner cases is complex.

I'd also like to mention ahead of time that DirectWrite/Direct2D is very fast at drawing western (Latin) text without coloring (>2000 FPS). In other words, in most situations Casey's suggestion doesn't help much, but it does address his termbench issue. At the time we assumed we were using the API incorrectly, after all Direct2D already had everything Casey suggested we should implement and it ran very fast outside of termbench. The new solution is largely identical to regular Direct2D with the only major difference being that ClearType/Grayscale gamma-correction is run on the GPU instead.

Casey's suggestion wasn't unique to me, as a significant number of other terminals do it exactly that way in OpenGl, something I was quite familiar with already. Originally I credited alacritty in the blog, because that's how I knew how to do it, but I removed it to keep the article as succinct as possible.

Update: I'm very sorry for publishing the blog post without giving proper credit where it is due, and it's been updated since. I'm sorry for my continued, overly defensive behavior.

lhecker··on 51 Star Flag (2011)
Some very important goods are almost exclusively produced in rural areas (food for instance, being produced by few people). The importance of these goods might be as important as the goods produced by people living in large cities (services for instance, being produced by many people).

If we start considering the people living in an area as the likely maintainers and experts of their field, I could imagine that we might want to assign the importance of votes based on the total importance of the "produced goods" in that area. That way these "maintainers" have a say in politics relative to their actual importance in society. I guess?

lhecker··on From Google to the world: the Kubernetes origin story
> Also, like k8s & Bazel, [gRPC] is less advanced and lower performance than their internal technology.

Are you sure about that? As far as I know gRPC is literally just as good as Bazel, which is why Google is even migrating to it internally.

For instance this comment agrees with me: https://news.ycombinator.com/item?id=12348286

lhecker··on Small Indiana county sends more people to prison than San Francisco
...which surely depends on the circumenstances. It could just as well be 3 years or more (for instance if you're part of a gang) and I think this is reasonably since you want that person to change (i.e. stop dealing) and not destroy his/her entire life, right?
lhecker··on Huge helium discovery 'a life-saving find'
As I've written in another comment:

> That's because the weight of the gas cylinder is relative and you got the point of reference wrong: The base weight is when it's a vacuum inside the cylinder, because otherwise it doesn't even displace the air which you don't want to measure for your reference weight, making it appear heavier. Whatever you add inside the gas cylinder now will make it heavier and the difference you get is the weight of the gas.

lhecker··on Huge helium discovery 'a life-saving find'
That's because the weight of the gas cylinder is relative and you got the point of reference wrong: The base weight is when it's a vacuum inside the cylinder, because otherwise it doesn't even displace the air which you don't want to measure for your reference weight, making it appear heavier. Whatever you add inside the gas cylinder now will make it heavier and the difference you get is the weight of the gas.
lhecker··on Huge helium discovery 'a life-saving find'
Just put it into a gas cylinder (it doesn't even need to be compressed or anything).

ELI5 version: It might be lighter than air, but that just means that it will "float" ontop of heavier things - like oil ontop of water. But all those things still obviously have a certain weight. If you put it into a cylinder it will thus under the influence of gravity still weigh down onto it, which then can easily be measured.

lhecker··on GitLab 8.9 released
Can someone explain me why workers where only alive for 6 seconds? Even now: Why are they only alive for 20 minutes and why is that even acceptable? Is it due to memory leaks?

I'd probably instantly lose my job if any of my systems would crash that often without me fixing it, regardless of the reason...

lhecker··on Why Can't Programmers Program? (2007)
I think what'd be even more interesting is whether a candidate can transform a simple recursive algorithm to an iterative one and vice versa.

It's taught in CS courses for instance but I know a lot of software "engineers" who aren't able to come up with a solution for such problems. (Hint: It's rampant in the webdev crowd)

As a side note: Yeah I also think that recursion is really seldom needed, but sometimes it's actually your only option. For instance I wrote a Future/Promise library with support for continuation for Rust (it'd be the same for C++). Simply said: Since the Promise is a generic the actual type (and thus it's machine code) changes from type to type so you have to use virtual function calls to invoke the next promise in the continuation chain. This obviously has the disadvantage compared to dynamic languages that the chain length is limited by the stack size.

lhecker··on What I learned while securing Ubuntu (2015)
tl;dr: Slashdot and SourceForge have a new owner which removed all this nonsense from those sites - including the adware.

I believe the average HN reader - including you - should be interested in this then: https://www.reddit.com/r/sysadmin/comments/4n3e1s/the_state_...

lhecker··on Async and Await
And the "correct" code would be this for instance:

  export default function getUsers () {
    return getUsers().then(users => {
      return filterUsersWithFriends(users)
        .catch(err => trySomethingElse(users));
    });
  }
Or if you like one-liners:

  export default function getUsers () {
    return getUsers().then(users => filterUsersWithFriends(users).catch(err => trySomethingElse(users)));
  }
lhecker··on Wangle – an asynchronous C++ networking and RPC library
ASIO can be used standalone with any C++11 compiler and the compile times are quite good.

If I should make a guess then I'd say that the original author of that part of the library either started before ASIO was standalone and/or simply has a hatred for boost (which would be unwarranted), or he/she was simply more experienced with libevent...

IMHO it's quite sad that they didn't use ASIO though as it's far more extensive.

lhecker··on Schools Are Slow to Learn That Sleep Deprivation Hits Teenagers Hardest
I'd be careful with "europeans", because primary school started at 7:00 for me in germany and gymnasium at 7:10. I had to stand up at 5:30 every day (and got to bed at about 23:00).

Most german friends I know of started earlier than 8:00 too (most started at 7:30). And yes I'm talking about actual lessons starting at that time - not "day care". Even though from our point of view there seemingly wasn't really a difference between those anyways...

lhecker··on Microsoft deletes 'teen girl' AI after it became a Hitler-loving sex robot ()
AFAIK the raid was mainly coming from here: http://archive.is/bEyye

There is also some stuff on here: http://archive.is/XEKxe

lhecker··on Leftpad-rs
Your version is quite inefficient too... If you call `insert(_:atIndex:)` N times it will obviously move the entire content of the string N times by only a single character.

The optimal solution would be instead if you create a `CollectionType` which repeats the padding character N times. That way you could use `insertContentsOf(_:at:)` to insert N characters at once into the string and move the contents of the string only once.

If that doesn't work for you might as well simply allocate a new `String`, reserve `pad` chars of space, insert the `pad` chars and then insert the previous string. Even that is probably still faster than your previous approach.

In the end it's still probably the easiest approach in practice to simply use the `NSString` method `stringByPaddingToLength(_:withString:startingAtIndex:)`... :D

lhecker··on Leftpad-rs
Your code is a bit inefficient. I took the liberty of fixing that for you: https://gist.github.com/lhecker/8e89d998c156f0bfdd2d

(You can use that code freely and without any attribution if you want to.)

The important part here is to use `String::with_capacity()` to prevent unnecessary reallocations. Furthermore I used `usize::saturating_sub()` because it's neat and cleaned up the code with `rustfmt` (which you should use).

lhecker··on Stephen Hawking confirms: The problem is Capitalism, not robots
Because the linked article does not capture his original words well. Instead he said:

> If machines produce everything we need, the outcome will depend on how things are distributed.

> Everyone can enjoy a life of luxurious leisure if the machine-produced wealth is shared, or most people can end up miserably poor if the machine-owners successfully lobby against wealth redistribution.

> So far, the trend seems to be toward the second option, with technology driving ever-increasing inequality.

lhecker··on LLVM Patches Confirm Google Has Its Own In-House Processor
Maybe they just don't want to backport their backend code again and again for every LLVM snapshot they do, because that can be a tedious thing to do compared to just having it in origin/master forever for free.
lhecker··on Amazon Has Just Registered to Sell Ocean Freight
You will probably like http://fakespot.com/ for discovering those fake reviews. ;)

Unfortunately it does not always work accurately, but I think it gives a good estimation whether a product is legit.

Example for AmazonBasic: http://fakespot.com/product/amazonbasics-mid-back-mesh-chair

And for "Engineered Now": http://fakespot.com/product/headrest-for-herman-miller-aeron...

lhecker··on GitLab 8.3 released with Auto-merge and GitLab Pages
I can definitely confirm that somewhere around the 8.0 release (I forgot when exactly) GitLab got a lot faster in general. Previously with the 7.x line it took about a couple seconds at least to load a page but now I barely get over a second until "onload", with response times of about 400ms.

In general I wouldn't consider performance with GitLab an issue and denote it as a selling point for Gogs anymore - it would just be nice if it no longer felt like a Ruby on Rails website...

A optimized site of mine with similiar complexity and database setup has a response time of 16ms and an "onload" event after about 400ms (using PHP-FPM 7 & MariaDB). ;)

lhecker··on WebExtensions in Firefox 45
Does this suffice? http://www.jqueryscript.net/demo/Responsive-Fluid-Sidebar-Pl...

You need to use a Smartphone for the Demo above though (i.e. sth. that can produces touches and has a small enough screen), but it was the first thing I found by googling "hammerjs sidebar".

I'm sure that if you look at a few demos from hammer.js (which is a very - maybe the most - popular touch library) you'll understand why everything you always wanted has already been solved years ago - just not in a very easy way.

But it seems that didn't stop the world from writing libraries that make swiping, panning, and fluid 60fps easy to achieve. Just like with any other language, framework, etc. you just need to learn it well enough...

lhecker··on Seemingly impossible functional programs (2007)
AFAIK most compiler will do tail-recursion optimization if the method ends in a tail call to the current function (obviously) or to a "sibling" function (i.e. if a() calls b() which calls a() again and so on) and is sufficiently short to be suitable for inlining.

It's important to remember local objects with destructors will make this impossible, since destructors are run at the end of the function scope and thus after what's seemingly a perfect tail call.

lhecker··on Microsoft Invented Google Earth in the 90s, Then Blew It
Whenever I read stories like this about Microsoft I have to chuckle about all the similarities to Aperture-Science from Portal 2...
lhecker··on Windows game developer about porting to and using OS X
Oh... Thanks! :)
lhecker··on Windows game developer about porting to and using OS X
My personal experience:

Visual Studio feels a lot more "enterprise-y" than Xcode and offers a lot more advanced features and tools on pretty much all fronts, especially in the UI (e.g.: Xcode doesn't even have file tabs, but sth. I'd describe as big "whole-UI-tabs"). But...

Xcode has llvm. This compiler and it's tools (i.e. the analyzer, debugger, etc.) just make VS' compiler look like it's from the 90s. Really.

-> Have you ever heard of llvm's "address sanitizer"? Forget the days of endless debugging! This little helper has revolutionized my debugging productivity and solved so many little subtile bugs for me...

So in the end you'll loose a lot of nice UI gimmicks and additional tools, but the compiler suite makes up for that.

And even if you don't need those llvm features, you still get a unix environment, which makes working on many fronts a lot easier. E.g. I'm primarely working on different kinds of web servers: To test everything I can just install whatever I need... brew, curl, netcat, wrk, ... And it will just work. And let's not forget all those "standard" unix tools like find, xargs, grep, etc.!

← PreviousPage 2 of 3Next →