Hacker Newsnew | past | comments | ask | show | jobs | submit | acidbaseextract's commentslogin

The normal way? You can implement whatever kind of index you like — b-tree index, bitmap index, hash index are all useful and conceptually simple if you're familiar with the backing data structures.

For example, if you want to index a "foreign key" id stored in each "record" in a JSON array of objects, you build a hash table from the FK id values to the JSON array indices of the objects that have that id. It can be as stupid simple as an `fk_index = defaultdict(set)` somewhere in your program, to use a Pythonism.

Now when someone wants JSON objects in that array matching a given FK id, they can just O(1) look in the index to know the position of records that match. Much better than an O(N) scan of every item in the array.

Of course you have to to maintain the index as writes to the JSON happen, but that's not bad once you understand how things work. No real secret sauce.


The secret sauce may be the need to take control of the write path.


I'm so sorry. Thank you for sharing your story.


Thanks. We are all as good as we can be now, Life, aside of finding ways, continues.


I don't regret putting it off until my 40s because it let me find a person I want to have a family with

Thank you for including this tidbit. I'm a man in my early 30s interested in having kids and recently discovered that I've poorly vetted my 5+ year SO's interest in having kids. Her "yeah, I'm hypothetically interested" has become "hard not interested".

The requirement to break up with her if I want kids is deeply painful, but the real source of my dread is the feeling that I won't then be able to find someone good in time. I'm very glad you found someone good to have a family with.


Break up with her now. There are plenty women your age of younger that know they are getting closer to the point of no return and are desperate to have kids. I’m similar age but my wife is 35 and lemme tell you what, she wants to have some dang kids now (and we’ll have one soon).

And what do you mean by “in time”? Assuming you are 32/33 you have plenty of time to find another partner. When you’re 50 you will feel so silly for feeling old at 32/33. Just make sure the next partner is on the same page relatively early.

It’s your life, not your partner’s, go live it how you want.


I just left a relationship for this reason, and it is so deeply painful. I wish you the best. I think it is the right decision and that making it sooner rather than later is best, but it is not easy.


Please google "future faking." It's a typical thing that people with narcissistic tendencies do. I don't know your situation or your girlfriend, of course, so I could be totally off-base. But the painful and avoidable situation you're in set off red flags in my mind. (I was in a long relationship with a narcissist and unfortunately had to learn all about their habits in order to figure out what was going on.)


This made me feel really sad. If you had to decide today, what are you gonna do? Did you know you wanted kids 5y ago?


> I've poorly vetted my 5+ year SO's interest in having kids. Her "yeah, I'm hypothetically interested" has become "hard not interested".

Can't this be a simple yes/no answer? I have never been a relationship. So pardon me if I am being ignorant.


I'll give you my answers to your questions as someone writing production JS/TS. Answering your questions is precisely illustrative of why hooks issues are hard to catch.

unexpected null/undefined values

This is an issue and has led to bugs. Switching to TS and making the compiler flag them fixed it.

mistyping variable or attribute names

Not an issue. Code obviously breaks if you have incorrect names.

using the wrong number of equal signs

This is an issue but causes few bugs. Linting generally catches it, though cute boolean punning still bites us.

failing to catch errors and handle rejected promises, etc.

This is an issue and has led to bugs.

Pretty much anything where there's some implicit details that the compiler or linters can't reason about programmers find a way to get wrong. One thing I like about the hooks linter setup is that what it encourages you to do by default will prevent most bugs, only lead to potential performance issues, unnecessary rerenders, unnecessary refetches.


>> failing to catch errors and handle rejected promises, etc.

> This is an issue and has led to bugs.

> Pretty much anything where there's some implicit details that the compiler or linters can't reason about programmers find a way to get wrong. One thing I like about the hooks linter setup is that what it encourages you to do by default will prevent most bugs, only lead to potential performance issues, unnecessary rerenders, unnecessary refetches.

This is something that can be mitigated via the no-floating-promises linter rule if you're using TypeScript[0]. For the cases where you actually want to just swallow errors, you can just add a `.catch(noop)`. This makes such situations explicit. You can get even stricter with the no-misued-promises rule[1].

[0]: https://github.com/typescript-eslint/typescript-eslint/blob/...

[1]: https://github.com/typescript-eslint/typescript-eslint/blob/...


Thanks for those references, I've recently been handed an overwhelmingly "JavaScript" project and this'll be a great way to expose some overlooked code paths.


> Pretty much anything where there's some implicit details that the compiler or linters can't reason about programmers find a way to get wrong.

touching on an immortal truth!


I'm curious if you've used useDeepCompareEffect, the use-deep-compare-effect npm package? I've found that it is pretty reasonable foolproofing for many of these identity questions. I'm well aware of Dan Abramov's objections to the deep equality checking [1] but I still find it a bit easier for me and other devs to reason about when doing things like data fetching.

[1] https://twitter.com/dan_abramov/status/1104414469629898754


Hadn't heard of that -- thanks for sharing!

Crazy how many choices there are in the mix (use-deep-compare-effect, the `JSON.stringify` approach mentioned by Dan, `useMemo`, and `useMemoOne`). Feels like a "pick your poison" scenario, as each one has a significant issue.

That being said, `useDeepCompareEffect` does seem the most "foolproof", and "foolproof" is probably more important than intuitive or performant in most cases.


Polymatter recently had a great video on the way the college ranking system is a hustle for foreign student money, and just how heavily it distorts colleges incentives: https://www.youtube.com/watch?v=cQWlnTyOSig


Who or what is Polymatter? Why do you trust them?

It would be useful if people said why they trust whatever they are linking to. Random stuff on the Internet isn't worth the time.


Here is another idea of the same theme through a more reputable source (you be the judge)

https://www.nytimes.com/2022/03/17/us/columbia-university-ra...


Thanks. That article is about a different distortion of college rankings; there are many.


It’s a brand for a YouTube channel, like the name for TV programs.

Judge the content for yourself.


> Judge the content for yourself.

IMHO the onus to establish an assertion (as a general term) is on the person making it:

1. Imagine I post an assertion, 'the moon is made of blue cheese', and it's read by 20 people. Should all 20 do the research themselves? That's much less efficient than my doing it - I already know where I got it, it's my claim, and it's 1/20th the labor.

2. Think of all the assertions you read: Do you have time to research them all?

3. The Internet is filled with information, mostly BS. I don't have time for even a fraction of the accurate info. If we had 1% of the info, but it was backed by credible research, it would be no loss in info (nobody can process even 1%) and great gain.

Finally, people can't judge content it unless they have expertise in the domain. There is plenty of research showing that to be true - that fact is fundamental to misinformation and disinformation, even something as simple as paid Amazon reviews - and it's easy to observe. Think of something in which you have expertise, like your profession: Could you persuade a non-expert? I could persuade one of almost anything, it seems; they just have no idea what are the questions, the facts (beyond a very limited range), or the answers.


To 99.99% of people on the internet, your comment would be "random stuff on the Internet".

I'm sorry, but who are you and why should I trust your reasons to trust other people?


Wut? I just make websites man.

I don't want to be dismissive, but I hate deploying my applications for this reason. I'm an application developer. I'm not averse to infrastructure as code, and containerization, and I'm happy to do ops for my preferred stack. But I can't learn all this stuff too.


Conveniently, Docker has abstracted 99% of what she said away from you.


Does `podman trust` also work yet? Shell commands from the first Docker docs link above:

  docker trust key generate jeff
  # docker trust key load key.pem --name jeff

  docker trust signer add --key cert.pem jeff registry.example.com/admin/demo
  docker trust sign registry.example.com/admin/demo:1

  export DOCKER_CONTENT_TRUST=1
  docker push registry.example.com/admin/demo:1


  docker trust inspect --pretty registry.example.com/admin/demo:1

  docker trust revoke registry.example.com/admin/demo:1


Gassée also started Be Inc which created BeOS. Beyond being great in and of itself, BeOS was also slated to be the successor to Mac OS 9. If you're an operating system or file system nerd, you will find it very worth looking into BeOS. Gassée overplayed his hand and Apple's acquisition of Be Inc fell through.

Apple ultimately went with the NeXT / Steve Jobs combo, quite wisely, but for a long time there was a whole gang of BeOS fanboys lamenting that decision.



Yes, exactly. Would be awesome if those could be designed/ordered as easily and cheaply as PCBs.


Zglue does exactly that but for things like microcontrollers and sensors. Maybe one day it will come to high-end chips.


I've always had a soft spot in my heart for PHP style "raw query in the template". Even as we've moved away from that I feel like GraphQL recapitulates a lot of the reasons why having queries tightly bound to views is convenient.

It feels like "put the template in the query" is a great Uno reverse to "put the query in the template" and the associated issues it brings, but I'll have to think on the consequences more. Thought provoking article!


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: