Better HN
topnewbestaskshowjobs
Log inSign up

GrumpySloth

4,901 karma · joined Sep 13, 2020 (6y ago) · 1,641 submissions

Submissions

comment 4y ago · link · parent

At dayjob we have a "commit queue" server. When a patch is accepted on Gerrit, there is a button to send it to the queue. The queue cherry-picks the commit onto the current master branch, makes several builds (different configs) and runs tests. If everything is ok, it pushes the commit to master and marks the patch on Gerrit as merged. If any of the builds or tests fail, it doesn't push the change and instead makes a comment on Gerrit with a link to the broken build/test.

So all commits are made sequentially, but most of the time developers don't need to rebase them themselves before pushing. The time distribution of commits sent to the queue is non-uniform, so you may have a long queue during the day, but by late evening it's pretty much empty. It has the greatest number of commits on Fridays.

comment 4y ago · link · parent

To me it's really annoying that I need to specify the sizes attribute in order for the browser to make a sensible choice about which image version to download. The browser could do it on its own based on layout. It really feels laborious (if done manually, or even implementing the automation) and like filling out the implementation details for the browser vendors.

Another hurdle is that you can't specify the heights of images. So now you're left with translating all those bounds from width x height to just width based on width x height of viewport. This srcset and sizes business feels really half-baked.

I wish I could just give the browser a list of image versions with their dimensions (both width and height), and the browser would just pick the smallest one with sufficient quality for a given viewport based on size of the viewport and dimensions of the img element in the given layout, i.e. the website author would only specify content and its different versions in a declarative way, not fill out algorithm details.

comment 4y ago · link · parent

The same attitude was shown by humans towards other humans a thousand years ago. If they couldn't understand the language of another tribe, they considered that tribe inferior and called them names signifying that.

The ancient Greeks called non-Greek-speaking peoples "barbarians", suggesting they are uncivilised, primitive. To this day, the name of Germany in Polish means "those-who-cannot-speak".

comment 4y ago · link · parent

> You'll hear people say things like "if evolution is real then why are there still monkeys?"

The only person I've ever met in my life who did not believe in evolution was a catholic priest. It's honestly bewildering to me that evolutionary sceptics are common enough to warrant a note in mainstream media or even just normal conversation. To me it's comparable to finding out there are still geocentrism apologists.

Although from what I've read it's more common in US. I'm in Europe so that may be the source of my bubble.

comment 4y ago · link · parent

I use Debian on desktop, because it's the most problem-free distro I've used. Once something works, it usually stays this way with no effort on my part. Ubuntu was the opposite for me, which is weird given how it's a Debian derivative.

I don't care about FOSS, so the principles are not a motivation for me.

comment 4y ago · link · parent

> Function type inference makes code impossible to read.

And the type errors very non-local and therefore hard to understand. The reason is that HM type inference infers types not only in the leaves->roots direction, but also roots->leaves. An expression gets assigned a type based on the context it appears in. It works wonderfully when the program type checks, because e.g. it allows one to write something like "let x = None" in Rust instead of "let x: Option<very long type name> = Option<very long type name>::None;" as long as further uses of x (such as returning it as the value of the enclosing function) clarify its type. However, when a program is during development, you change things here and there, when one variable binding (such as a function definition), which wasn't explicitly typed, appears in at least two places which require this variable to have conflicting types, then almost certainly the error is going to be generated for a line that you as a human see completely disconnected from where the error actually is. Maybe it's in the function definition, maybe it's in one of its uses. And those things can be further obscured by several indirections of intermediate functions with successfully inferred types.

comment 4y ago · link · parent

When I work on a side project, I pull out the Ethernet cable of my computer from the switch. Unfortunately, I can't do that in dayjob thanks to the tyranny of Slack.

When something doesn't involve a computer, I don't have the slightest problem staying focused. So when part of my job requires doing some maths on a piece of paper/window/whatever, when I want to read a book, when I engage in a hobby etc., I don't need to try hard to focus. It's only those bloody computers.

comment 4y ago · link · parent

You can replace "cat /usr/share/dict |" in that invokation with "</usr/share/dict" and it will be equally easy to switch between tr and sed. Yes, you can put that redirection at the start, not just at the end of a command line. Although I admit I still haven't got used to doing it.

comment 4y ago · link · parent

She never lost a fight. She's never shown to have any moral flaws. Compare that to Anakin who lost plenty of fights (thereby also losing parts of his body) despite being an overpowered character; he was also arrogant and impatient. What moral flaws does Rey have?

Doubting yourself and then winning at everything doesn't make you relatable. It makes you like that colleague from school who was stressed out before every exam, saying for sure they're gone fail, proceeding to have straight A's from every one of them. When you hear them doubt themselves next time, you don't empathise with them, you say "oh shut up".

comment 4y ago · link · parent

The movies you listed fail in a different way. There are plenty of explosions and fight scenes in The Last Jedi and Captain Marvel. What they do share is that the main character is an underdeveloped Mary Sue, without character flaws, without weaknesses they must overcome. They're just made awesome from the start. It probably stems from the inability of current Hollywood to portray female characters as having any weaknesses at all, that would be heresy. The result is that it's hard to empathize with and care about the main character. They don't have any dimensionality.

Of the ones you listed I watched The Last Jedi and Captain Marvel. I know what I wrote is also true for Mulan thanks to friends who watched it and the Critical Drinker. He has a couple good films on YouTube actually demonstrating this aspect of modern films:

- Mulan: <https://www.youtube.com/watch?v=kIH-eFqBLP4>

- Star Wars: <https://www.youtube.com/watch?v=GSj6wEm4zZY>

- Captain Marvel: <https://www.youtube.com/watch?v=WKHEjpFF6J0>

comment 4y ago · link · parent

> My experience is that Windows has far better UX for pretty most end users.

UPDATE: After seeing a reply to this comment, I googled some screenshots. It seems that Macs normally do display a hint for the shortcut to delete files. I'm not sure why mine doesn't.

Windows is also more learnable. On Mac at least today you're just supposed to know stuff. The most basic operation: deleting files. Seems like an operation you'd like to speed up with a shortcut, since you're going to be doing a lot of that with your computer. Mac has hints in its menus about shortcuts for different actions, just like Windows. However, they're hardly ever there. That sounds a bit contradictory, but mind the quantifiers. The selection of which actions have hints about their shortcuts is completely arbitrary. It's completely disconnected from the potential frequency of use, and the hints that are there are far and few between. So, back to deleting files: this is not hinted in the menu. You can select this action with the mouse, but come on, going to the menu, finding this action and clicking it is a ridiculously slow process for such a common operation. Dragging files to the trash bin is only marginally better. It has a shortcut, it's just that macOS won't tell you what this shortcut is. This is insider knowledge. And then you google it, and find that it's "Cmd+Delete". So you press that... and it doesn't work. Because on macOS Delete is Backspace and Delete is Reverse Delete.

Also, it's a theme that what requires a single keypress or two on Windows, on macOS requires a convoluted chord making you look like Axl Rose playing solo of November Rain. I mean, look at the shortcuts to take screenshots: <https://support.apple.com/en-us/HT201361> Wat??? 1. Who thought that would be easy to remember? 2. Who thought that would be easy to press?

comment 4y ago · link · parent

mawk is the worst, which, given the article's claim about POSIX, is ironic, because mawk is POSIX-compliant.

  $ mawk --version
  mawk: not an option: --version
  $ mawk --help
  mawk: not an option: --help
  $ mawk -W version
  mawk 1.3.4 20200120
  Copyright 2008-2019,2020, Thomas E. Dickey
  Copyright 1991-1996,2014, Michael D. Brennan

  random-funcs:       srandom/random
  regex-funcs:        internal
  compiled limits:
  sprintf buffer      8192
  maximum-integer     2147483647
And mawk is (was in 16.04 at least) the default version of awk on Ubuntu. How is the user supposed to know this magic incantation? ¯\_(ツ)_/¯

comment 4y ago · link · parent

Discovering the lie about Santa Claus was one of the first experiences that taught me not to take my parents' words at face value. So it's probably not something that parents would like, but in fact it's a valuable lesson for a child.

comment 4y ago · link · parent

Poster wrote that it works when compiled on Debian 3, but not on Debian 11. Support for Debian 3 ended on 31 March 2008. Most recent Debian release is Debian 11. Probably the most important things that changed are GCC and glibc.

comment 4y ago · link · parent

See <https://en.wikipedia.org/wiki/Secure_copy_protocol>

SFTP also transports data over SSH channels.

comment 4y ago · link · parent

> Does this mean the smallest /bin/true is actually an empty file?

That was exactly the implementation of /bin/true in Unix v7: <https://github.com/v7unix/v7unix/blob/master/v7/bin/true>

comment 4y ago · link · parent

Dupe: <https://news.ycombinator.com/item?id=30932095>

comment 4y ago · link · parent

Pedantic nit: Poland and Baltic states are a part of Eastern Europe.

comment 4y ago · link · parent

Yes. I was talking about milk chocolate. I didn't even know there was something like "dark chocolate" at that age. Incidentally, now I prefer dark chocolate over milk chocolate by and large.

I mentioned gluten not in relation to chocolate, but to other sweets that do contain gluten, but also have chocolate.

comment 4y ago · link · parent

Keep in mind that the lower bound on this chart is 65%, not 0. Threw me off at first.

comment 4y ago · link · parent

I was really allergic. I was born with a sick gastrointestinal tract. After 7 years it was cured with a short relapse some years later.

comment 4y ago · link · parent

Depended on the sweets. There was a whole bunch of allergies I don't even remember now. My whole gastrointestinal tract was perpetually sick (since birth), I would visit the hospital basically everyday. Most notably, I couldn't eat chocolate, because I was lactose- and gluten-intolerant. So I couldn't eat any sweets which had any chocolate in them, no sweets which were pastry-based etc.

Tangentially, in those times avoiding gluten wasn't as fashionable as it is today, and so there wasn't really any gluten-free bread to buy. My mum would bake bread herself for that purpose, because otherwise I wouldn't even be able to eat bread.

comment 4y ago · link · parent

I like:

1. VirtualAlloc:

1.1: separation of reserving memory from committing it, thus making overcommit unnecessary, when you want to have memory arenas and reserve a large contiguous chunk of virtual address space, but commit it (so tell the system that you actually want this virtual memory mapped to some physical memory), when you need it. So you can grow your arenas as you need more memory, without worrying that you may not have enough virtual space due to fragmentation, and without relying on invisible things like lazily committing memory on page-faults as long as your program doesn't have any bugs which make it touch that memory in advance and thus make the bugs go unnoticed silently and increase memory use

1.2: ability to implement a circular buffer[1] with a contiguous view instead of head + tail parts; thus making it possible to pass your ring buffer to functions which expect a normal array, and also avoid branches and complexity in code operating on the buffer.

Generally, VirtualAlloc > mmap IMO.

2. Behaviour in OOM conditions. Linux can become completely unresponsive for minutes. Windows is usually responsive enough to kill the offending applications.

3. GUI apps have reasonable baseline for performance of GUI. On Windows it's expected that watching YouTube/Netflix you won't see screen tearing. On Linux screen tearing with VOD in browsers is completely unsurprising.

4. Powershell is nice for a whole variety of reasons.

5. CreateProcess > fork [2]

6. MSVC, unlike GCC and Clang, doesn't come with guns for your children when you unknowingly dare trigger UB.

[1]: <https://docs.microsoft.com/en-us/windows/win32/api/memoryapi...>

[2]: <https://www.microsoft.com/en-us/research/uploads/prod/2019/0...>

(Posted from Linux btw.)

comment 4y ago · link · parent

When I was a child, I was allergic to a whole bunch of things, one of them being sweets. But I wasn't allergic to apples, carrots and blackberries, so those were given to me in place of sweets. Now in adulthood blackberries are my favourite snack, followed by apples, and I'm not a huge fan of sweets.

comment 4y ago · link · parent

I'm not on NixOS, but I do use Nix as a package manager on Debian and this is what I got:

  $ nix-env -qa | wc -l
  39168
Of course, it's important to note that Nix doesn't lag behind upstream as much as Debian. Actually, it's usually one of the first places where new versions of packages appear. So you don't have the problem such as the one Debian has with maintaining PHP 7.4.

comment 4y ago · link · parent

There is also the situation that is not created out of malice or greed, but out of lack of restraint and divergence of priorities between the authors and the users: compilation speed. When a piece of software makes me wait for it, I feel subservient to it. It feels like sitting in a state office, waiting until a civil servant decides to grant you an audience. Except there is no civil servant, there is only the computer. How much do I have to wait? It depends on the alignment of the stars, air humidity and will of the gods.

When I used to work in office, there was this one time when I had an urgent ticket from customer to resolve, so I made the necessary fix and started building it. Normally builds would take something like 15 minutes, provided they were incremental and this wasn't the first (clean) one. But they could also take hours. It was at the end of the working day, I was working hard on this fix, didn't even take a lunch break. I started building it and waiting, because I wanted to share the fix with the customer as soon as possible. 15 minutes passed... 30 minutes passed... 1 hour passed... 90 minutes passed... 2 hours passed... And it was still compiling. At that point I gave up, went out and started walking home. But due to not eating the whole day and then staying late waiting for the build to finish, now I was so hungry that my hands started trembling on my way home and I felt generally weak, on the edge of being able to reach home. The next day I found out this build took ~4h 30min.

The reason for this state of affairs: of course I shouldn't care that much about my work and just make the customer wait instead. Put my health and time above that. But another important reason is that the build times were so unpredictable: when I hit "compile", it could take anywhere from 3 minutes to 4.5 hours. There is no planning you can do around that. If it was just a fixed 3 hours, it would be even better, because then I could plan my day around it. But it being so unstable destroys everything. Of course, if every build took 3 hours, people making decisions would wake up and see that we've got a pathological situation and there is something seriously wrong with the project. But when you often hit 15 minutes, it's going to be brushed off. And for the C++ committee even though compilation speed may be an issue, it is never a priority. There are always going to be other issues which eclipse it.

Personally, I think a build for even a OS-size project like that shouldn't take more than at most 1 minute. Even the incremental times in this one are a travesty.

What I like about what was planned for Jai (still not released) is that it's designed to always make a clean build. And the clean builds need to be fast. There should be no reason to make incremental builds. They are hacks that make the situation worse, but make it look better. Suddenly you're dealing with weird bugs, because the build system did not detect a necessary recompile and used stale cache entries (happened multiple times to me). The compile times are unpredictable (see the above story of why that matters).

I've seen some Delphi jobs in my country a year ago I think. Maybe I should switch there...

comment 4y ago · link · parent

I think that GNU/Linux is a valuable distinction due to the significance of libc. Alpine keeps uncovering how applications rely on GNU-isms and there seems to be no end to those issues. libc, however anemic, makes a huge difference it seems. Maybe it should be "glibc/Linux" rather than "GNU/Linux"?

However from the Linux desktop end user's point of view, whether a system is glibc-based, or musl-based is less directly significant than whether it is Gnome or KDE-based; alternatively, whether it's systemd or OpenRC or runit-based. So if GNU wants some clout for glibc, then in fairness the name starts to sound more like "GNU/systemd/KDE/Linux" at which point it sounds ridiculous. And for all those components the famous "I'd like to interject for a moment" makes equal sense as for GNU.

I frequently work with busybox-based systems and they're not nearly as different from GNU/Linux as KDE is different from Gnome.

comment 4y ago · link · parent

While QNX is mentioned, does anyone know of any materials detailing the implementation of MX tables in QNX? I've stumbled upon a brief synopsis[1] of what they do, but it lacked implementation details (such as: do the entries need to be aligned on page boundaries? how many copies are made at the end? etc. etc.).

[1]: <https://cseweb.ucsd.edu/~voelker/cse221/papers/qnx-paper92.p...>

comment 4y ago · link · parent

Example program to show three ways of doing that:

  import System.Random

  randomInt :: IO Int
  randomInt = randomIO

  isEven1 :: Int -> Bool
  isEven1 n = (n `rem` 2) == 0

  isEven2 :: IO Int -> IO Bool
  isEven2 n = do
      m <- n
      return $ isEven1 m

  example1 :: IO ()
  example1 = do
      i1 <- randomInt
      let result1 = isEven1 i1
      putStrLn $ show result1

      i2 <- randomInt
      let result2 = isEven1 i2
      putStrLn $ show result2

      let result2' = isEven1 i2
      putStrLn $ show result2'

  example2 :: IO ()
  example2 = do
      result1 <- isEven2 randomInt
      putStrLn $ show result1

      result2 <- isEven2 randomInt
      putStrLn $ show result2

  randomIntIsEven :: IO Bool
  randomIntIsEven = isEven2 randomInt

  example3 :: IO ()
  example3 = do
      result1 <- randomIntIsEven
      putStrLn $ show result1

      result2 <- randomIntIsEven
      putStrLn $ show result2

  main :: IO ()
  main = do
      putStrLn "Example 1:"
      example1
      putStrLn "Example 2:"
      example2
      putStrLn "Example 3:"
      example3
In example1, result1 and result2 may differ, which is signalled by the arrow (instead of "="). result2 and result2' cannot differ, which is signalled by "=", where the right hand side is verbatim the same.

In example2, result1 and result2 may differ, which is signalled by "<-" (instead of "=").

In example3, result1 and result3 may differ, which is signalled by "<-" (instead of "="). Another argument here is that they may differ, because example3 is the same as example2, except it used randomIntIsEven in place of isEven2 randomInt. But we defined randomIntIsEven to be equal to isEven2 randomInt, so result1 and result2 being able to be different in example2 but not in example3, or vice versa, would be a contradiction.

comment 4y ago · link · parent

> Because it's obvious to anyone that has written any sort of complex program that those are not the same thing.

They are the same thing in Haskell (except for when forcing the thunks into eager values happens, due to the weirdness of laziness, but that has nothing to do with purity).

> I assume FP has answers for these things but the tutorials never cover them.

Except this one does:

> The <- works like an =, except it signals that equational reasoning doesn't apply to this value. You can't replace what_the_user_typed with getline - your program won't compile.

1
363738
55