HNHacker News
TopNewBestAskShowJobs

Nimelrian

139 karma · joined July 7, 2017

submissionscomments
Nimelrian··on Reddit appears to be restoring edited/deleted comments
Can confirm, I ran an edit-delete purge a couple of years ago and now have comments from ~10 years ago visible again, with the original content.
Nimelrian··on Guilty Gear Strive takes 3 minutes to load due to 127 sequential HTTPS requests
127 HTTPS requests, each building a new TLS encrypted TCP connection, makes for quite a latency for anyone not living in Japan (aside from the fact that doing 127 independent requests sequentially just asks for trouble)
Nimelrian··on Learn Vim (the Smart Way): a book to learn the good parts of Vim
What a hackjob that is.
Nimelrian··on Saturn's largest moon may be the only place beyond Earth where humans could live
Getting stuff to mercury is hard though. IIRC it takes around 16,000 m/s of dV to get from LEO to the surface of mercury. Titan would take even more (19,000) but a huge chunk of it can be reduced by making use of aerobraking.
Nimelrian··on ‘No Way to Prevent This’ Says Development Community Where This Regularly Happens
I'm living outside of the US and this is the first time I heard of this. I did not have any intentions to link my release to a recent shooting.
Nimelrian··on ‘No Way to Prevent This’ Says Development Community Where This Regularly Happens
I didn't create the post here, only the original one on Medium. I can't correct the title over here.
Nimelrian··on ‘No Way to Prevent This’ Says Development Community Where This Regularly Happens
That would definitely fix the "my small React CRUD SPA relies on 10k package maintainers" issue, but would still leave other issues open.

There's actually an active proposal for a standard library, but it is met with a lot of contempt from the JS community [0]

[0] https://github.com/tc39/proposal-javascript-standard-library...

Nimelrian··on ‘No Way to Prevent This’ Says Development Community Where This Regularly Happens
You are indeed correct in that assessment. I actually put it into a small footnote in case people reading the post miss the "joke".
Nimelrian··on ‘No Way to Prevent This’ Says Development Community Where This Regularly Happens
Author here!

Yeah, it was just a parody of the articles The Onion regularly releases regarding another topic and to be honest I didn't quite expect my post to take off the way it did.

I'm also sorry I posted it on Medium, which I personally dislike, but since Medium is frequented by many JS devs it seemed the ideal place to put that joke.

Nimelrian··on The coal mine that ate Hambacher forest
The jobs at risk are not only those in the coal industry but also the jobs powered by the coal. You can't run a business without electricity. So if coal makes up about a third of the power then about a third of the jobs in Germany could be lost.

That is one of the most ridiculous statements I have ever heard.

Nimelrian··on GDPR Enforcement Tracker: List of GDPR fines
You inform your national data protection authority:

https://edpb.europa.eu/about-edpb/board/members_en

Nimelrian··on UX clichés
Not the person you're responding to, but I was on a team which probably did the same thing.

Instead of listening directly to the event store for events you have another non-abstracting layer on top and listen to that.

A sensible architecture would have that layer be an abstraction layer for business use cases, so instead of listening to "user-created", "user-edited" and "user-deleted" events and rebuilding the user state in the consumer every time an event is fired, you'd have that layer expose a single user state stream. The rebuilding is handled entirely within the layer.

Many people skip that and just re-expose the "primitive" streams of the event store, because they read "don't expose your persistence layer" and skipped the important ", expose the business state layer instead" which usually comes right after that.

Nimelrian··on Removing Array Duplicates
And today I learned something new. Been a long time since I wrote my last lines of C++ anyway.
Nimelrian··on Removing Array Duplicates
It's much easier to implement in Javascript, too, even though JS has a much smaller standard library. The main problem is Go's lack of generics.
Nimelrian··on Removing Array Duplicates
Yup, you can implement the whole ordeal in C++ like this:

  int main(int argc, char** argv) {
    std::vector<std::string> strings{
      "apple", "cAt", "cat", "Dog", "apple", "dog", "Cat",
      "Apple", "dOg", "banana", "cat", "dog", "apple",
    };
  
    strings.erase(
      std::remove_if(
        std::begin(strings),
        std::end(strings),
        [seen = std::unordered_set<std::string>{}](std::string_view str) mutable {
          std::string lower = "";
          std::transform(std::begin(str), std::end(str), std::back_inserter(lower), ::tolower);
          if (seen.find(lower) == std::end(seen)) {
            seen.insert(lower);
            return false;
          }
          return true;
        }
      ),
      std::end(strings)
    );
  
    for (auto& str : strings) {
      std::cout << str << "\n";
    };
  }
Nimelrian··on KV Storage, the Web's First Built-In Module
I recommend reading through this issue [1]. It's amazing how much the JS community is firing against a bigger standard library, just because stuff like lodash exists and everyone can make their own packages anyways.

[1] https://github.com/tc39/proposal-javascript-standard-library...

Nimelrian··on Major bank accidentally published a private package to the public NPM Registry
The npm docs also state that the "files" property of the package.json limits what gets installed if you install that package in another project.

Ever tried installing a local package via a file path? NPM just symlinks it into node_modules, causing issues because you suddenly have duplicated dependencies. Yarn does the same, btw.

I have given up any hope regarding npm/yarn acting sensible long ago.

Nimelrian··on Bootstrap 5 will remove jQuery as a dependency
Nowadays you'd use fetch anyway which would reduce that code to not much more than the jQuery samples.

That is, if you don't need to support IE (And I feel like we're finally in the phase where it slowly, but steadily dies off). Otherwise you can ponyfill it.

Nimelrian··on Rust’s standard library was vulnerable for years and nobody noticed
Good rust code doesn't have to be free of unsafe blocks. In some cases you can't avoid them, e.g. when doing memory mapping. Instead, the unsafe blocks semantically designate areas you should keep an eye on. I rather have 20 unsafe one-liners surrounded by safe wrappers in a project with several thousand LOC, than a 1k LOC C project where I have to take extra care with every step.
Nimelrian··on Nginx quick reference
Like this? https://nginxconfig.io
Nimelrian··on Porting 30K lines of code from Flow to TypeScript
Higher kinded types are currently not supported by the TS compiler and would be a highly appreciated feature.
Nimelrian··on Porting 30K lines of code from Flow to TypeScript
The proposal explicitly states that everything in the standard library would not be tied to specific target environments:

Such a library would only cover features which would be useful in JavaScript in general, not things which are tied to the web platform. (A good heuristic: if something would make sense on a web browser but not in node or on embedded devices or robots, it probably isn't in scope.)

Nimelrian··on Porting 30K lines of code from Flow to TypeScript
Not entirely.

For example, a function which takes a property path (in the form of an array of strings) and an object as parameters and returns the value at that path inside the object still needs overloads for every single tuple length.

  type Key = string | number | symbol;
  
  function get<T, K extends keyof T>(path: [K], obj: T): T[K];
  function get<T, K1 extends keyof T, K2 extends keyof T[K1]>(path: [K1, K2], obj: T): T[K1][K2];
  function get<T, K1 extends keyof T, K2 extends keyof T[K1], K3 extends keyof T[K1][K2]>(path: [K1, K2, K3], obj: T): T[K1][K2][K3];
  function get<T, K1 extends keyof T, K2 extends keyof T[K1], K3 extends keyof T[K1][K2], K4 extends keyof T[K1][K2][K3]>(path: [K1, K2, K3, K4], obj: T): T[K1][K2][K3][K4];
  function get(path: Key[], obj: any) {
      if (path.length === 0) {
          return obj;
      }
      const key = path[0] as Key;
      const rest = path.slice(1) as [Key];
      return get(rest, obj[key]);
  }
  
  
  interface Foo {
      foo: {
          bar: {
              baz: {
                  val: number;
              }
          }
      }
  }
  
  declare const foo: Foo;
  const num = get(["foo", "bar", "baz", "val"], foo);
In this case, num is implicitly typed as number, but if the path would be longer, you'd need to add more overloads.
Nimelrian··on Before the Electric Car Takes Over, Someone Needs to Reinvent the Battery
Last time I checked, the extraction process for lithium, which is needed for the batteries, still has a heavy impact on the environment. This article mentions a cost of 500,000 gallons (almost 2 million litres) of water for a tonne of lithium. [1] Considering that as of now the most lithium is produced in desert regions of Bolivia and Chile, using what little water exists there in the first place may be detrimental to the population of these regions.

Are there any news regarding new, more environment friendly mining processes?

[1] https://www.wired.co.uk/article/lithium-batteries-environmen...

Nimelrian··on Why should I have written ZeroMQ in C, not C++ (2012)
Especially since the GoF Design Patterns, which are often cited as the main reason for Java being verbose, were described in the original book using C++ (and smalltalk) examples.

Just because they may be overused in Java doesn't mean people shouldn't use them at all in other languages.

Nimelrian··on The State of JavaScript 2018
I think your link regarding experience should be this: https://2018.stateofjs.com/demographics/years-of-experience
Nimelrian··on Chinese Tokamak reaches over 100M degrees
Longer-lived would be thousands of years for the steel structure until it is manually handable. 50-100 years for remote handling.

> It was shown that wait times are required in the order 50–100 years for the remote handling recycling option and hundreds (Li4SiO4) to thousands (Eurofer) years for hands-on handling.

Source: https://doi.org/10.1016/S0022-3115(02)01273-4

Nimelrian··on Microsoft Releases a Linux Version of the ProcDump Sysinternals Tool
For the people who weren't around back then:

"Embrace, extend, extinguish" was one of Microsoft's key strategies.

https://en.wikipedia.org/wiki/Embrace,_extend,_and_extinguis...

Nimelrian··on iPhones are allergic to helium
Even a single hydrogen atom is bigger than a single Helium atom. The charge of the helium nucleus is higher and thus "pulls" the two electrons further inward than Hydrogen's single proton pulls its single electron.
Nimelrian··on C++: Associative map containers with compile-time lookup
Also highly recommended: Anything by Jason Turner and Ben Deane.

Examples:

- Ben Deane - Using Types Effectively [0]

- Jason Turner - Rich Code for Tiny Computers: A Simple Commodore 64 Game in C++17 [1]

- Ben Deane & Jason Turner - constexpr ALL the Things! [2]

[0] https://www.youtube.com/watch?v=ojZbFIQSdl8

[1] https://www.youtube.com/watch?v=zBkNBP00wJE

[2] https://www.youtube.com/watch?v=PJwd4JLYJJY

Page 1 of 2Next →