Hacker News new | past | comments | ask | show | jobs | submit | blackrobot's comments login

HowGood | Remote (EDT timezone) | Full-time | Frontend EM

https://www.howgood.com/careers?hn#openings

We build carbon accounting software, to track environmental impact, and make food companies more sustainable.

The role is for a frontend engineering manager (aka tech lead in some places). Your work will be 90% coding and 10% management.

Tech Stack:

  * Typescript
  * React
  * Redux
  * Vite
You can read more about the role and apply here: https://www.howgood.com/careers?hn#openings


This is a good idea! https://youtu.be/BNhriA2xq9E


Why don't you share a TOTP between all of you? Just take a screenshot of the authenticator QR code, or save it to a shared 1password secret.

Google's login protection mechanisms seem to be satisfied by TOTP usage, and you won't be locked out anymore (or at least much less likely to be).


You're right that would totally work with Google. In our case the boss is quite computer illiterate and trying to get him to use LastPass was hard enough. He will tolerate a lot of pain from getting locked out before he'll be willing to learn TOTP :-(

And for many of the SaaS that we use, TOTP doesn't help you avoid the security lock outs.


Are there any good articles or examples you can share that elaborate on why using services is best? Writing a custom model manager method for these sorts of operations seems to work best. For instance, the create_account service could easily be part of the User.objects manager:

  class UserManager(models.Manager):
      def create_account(self, sanitized_username: str, ...):
          # the rest of the code in this method is the same as the example.
          ...
          return user_model, auth_token
  
  class User(models.Model):
      ...
      objects = UserManager()
  
  >>> User.objects.create_account(sanitized_username="blackrobot", ...)
  (<User: blackrobot>, 'fake-auth-token:12345')
The benefit here is that other parts of your code only need to import the User model to access the manager methods. It also allows for the User.objects.create_account(...) method to be used by related models, without risking a circular import, by using the fk model's Model._meta.get_field(...) method.

I'm not opposed to services, I just don't see when they'd be particularly useful.


I like your approach and I think what you’re proposing can also be fine in many situations. Managers are not the same as models and using them here is not drastically different than using a separate service class/function. Managers can be accessed through the model and they have “enough” exposure to table wide operation (querysets). I usually start with managers in a separate file (managers.py) for my business logic and when the project grows, I extract the logic into services in a way that only queryset definitions remain in the manager. You can mock manager’s methods for tests (get_queryset) and the business logic code in them can be written in a relatively portable manner.


It might be a little bit more convenient, but really, models are central to everything else. You're spamming your most central code with arbitrary crap that you are only interested in perhaps 0.1% of the time.

Once you get out of the OOP mentality, it's much easier to shuffle code around, and keeping things that logically belong together close to each other in separate files. Move the crap out of the way and enjoy the cleanliness. Less mental overhead helps you make better decisions faster.

And yes, sometimes you have to deal with a circular import, but it's not the end of the world, just decide which file is the most basic, and don't let that import other less basic files at the top level, but only inside functions. Or try to decouple the logic.


Isn't a mix of fat models and services best? Say for a user model you have first name, middle, and last name. You add a property "full_name" that joins those 3. Putting that logic in a service feels confusing and unintuitive.

On the other end, if you have a complex auth mechanism that needs to talk to several external APIs, putting that in a service feels natural. You're making remote API calls, possibly pulling in other models, and it's a clearly defined "business area".


In my opinion and experience, treating the model as anything but a way to talk to the database behind a service interface is a very slippery slope.

My service methods receive and return pure objects (pydantic or attrs) that I serialize from the models. No other part of the app gets to pass around that service’s model, updating it willy nilly, maybe saving the updates, maybe not.

The service completely hides the model and all corresponding persistence logic behind its interface.

The decoupling you achieve is worth the extra boilerplate. It’s the only way I have ever seen Django apps not become giant balls of mud.


Reading your example code and explanation already makes me hope I never have to open my debugger on this code. :)

A simple service that I explicitly import and call methods on is so much easier to understand. Hell, even if all services were global, singleton, objects with static methods that'd even be preferable.


Where does the `@sql` decorator come from? If it's not adding attributes that are django specific, then you lose most of django's functionality built around models: automatic admin, user model, etc...


An idea that I submitted for discussion here:

https://github.com/ppinard/dataclasses-sql/issues/4

My belief is that the django functionality can be added back in the form of decorators.

I have similar work to add @graphql to python dataclasses.


The author of the repo says to just use pypy. https://github.com/fijal/jitpy/issues/7#issuecomment-3335573...


What's the best external tv hardware box these days? It needs to be something easy enough for my non-technical family to use, that's also stable enough that I don't have to worry about upgrading or debugging it, and provides all of the popular providers controlled by a remote -- or is at least compatible with a universal remote.

Up until recently, my Roku ticked all of the boxes -- Amazon Prime, Netflix, HBO Now/Go, Plex, CNN, Hulu, all controlled by a Logitech universal remote. But as of August 1st, HBO has pulled their apps from Roku.

Is one of these a better option?

- Android TV

- Amazon Fire

- Apple TV (without other iOS devices?)

- something else?


The nice thing about Android TV and firetv is that you can sideload apps like NewPipe (better YouTube client without ads) and Kodi. Android TV has been better than FireTV until now, as it has not had an annoying homescreen littered with ads, like the FireTV.

I'd switch to an AppleTV, if I could sideload things like NewPipe, but for now I'm sticking with my Nvidia Shield, which runs Android TV.


Most Dockerfiles for python projects will have a line to install their python dependencies though.

  COPY requirements.txt ./
  RUN pip install -r requirements.txt
If you're building the image on a CI server, docker can't cache that step because the files won't match the cache due to timestamps/permissions/etc... The same is true for other developer's machines.

This is a problem if your requirements includes anything that uses C extensions, like mysql/postgresql libs or PIL.


You can achieve a similar caching improvement by either:

1. Using poetry which keeps a version lock file so all changes are reflected/cached, or

2. Doing a similar thing yourself by committing `pip freeze` and building images from that instead of requirements.txt.


To be clear, the only file in question is requirements.txt; Docker has no idea what files `pip install ...` is pulling and doesn't factor them into any kind of cache check. Beyond that, I didn't realize that timestamps were factored into the hash, or at least if they were, I would expect git or similar to set them "correctly" such that Docker does the right thing (I still think Docker's build tooling is insane, but I'm surprised that it breaks in this case)?


I just tested if timestamps are factored in, and I was wrong. According to the documentation:

https://docs.docker.com/develop/develop-images/dockerfile_be...

> For the ADD and COPY instructions, the contents of the file(s) in the image are examined and a checksum is calculated for each file. The last-modified and last-accessed times of the file(s) are not considered in these checksums. During the cache lookup, the checksum is compared against the checksum in the existing images. If anything has changed in the file(s), such as the contents and metadata, then the cache is invalidated.


Not been an issue for me using Gitlab CI runners, at least..? Which may be because Gitlab CI keeps working copies of your repos.

If the CI system keeps the source tree the Dockerfile is being built from around rather than removing it all after every build, it caches stuff as normal.


What was misleading about the NYT piece?


He may not be a suspect, but it is troubling when someone befriends a known pedophile:

  Mr. Gates started the relationship after Mr. Epstein was convicted of sex crimes.
from the NYT article: https://www.nytimes.com/2019/10/12/business/jeffrey-epstein-...


I have a close relative who is a pedophile. I still give them my time. Don't underestimate human compassion, regardless of your value judgement on it.


Are you saying that Gates was being compassionate toward Epstein? Gates hid the depth of his affiliation with Epstein until this NYT article came out. He knew it was wrong.

Much more likely is that Epstein had dirt on Gates and/or connections Gates wanted.


No, it isn't wrong; guilt by association is not a civilised concept.

And if someone commits a crime then the courts determine an appropriate punishment and that is the end of what gets called 'wrong'.

I'm on board if you don't want to talk to convicted paedophiles - seems reasonable to me - but being judgemental of someone else's relationships is not fair.


Thank you, the way people bring out the pitchforks merely over guilt-by-association is one of the worst parts of social media.

I swear we're going to have to relearn all of the lessons we learned over the centuries of developing civil society, all in the name of some strange utopian perfectionism we're putting on every popular person. Mob justice is rarely good justice.


There are obviously times when mob justice goes too far. I do not think Epstein is one of those cases. He was a sex trafficker for the rich and powerful. His associates should be investigated and their attempts to get the media to bury the story should be pointed out.


I wasn't talking about you per se or even Gates alone, so please don't take it as a personal attack. There's plenty of examples of people taking this guilt-by-association stuff way too far. A popular one is when politicians take a photo with an unsavoury character, even though they took a hundred that night alone, and the media spins it like their buddies.

The Gates case is more complicated, as you mentioned, but the general trend is worrying and I personally wouldn't public tell people I met with Epstein either.


>No, it isn't wrong; guilt by association is not a civilised concept.

When it comes to courts, absolutely.

When it comes to making a judgement call (and also associating with people), it's expected.

You make a choice who you maintain relationships with. You can, and will be judged by the choices you make.


[flagged]


But that's mob justice. I'm not saying you're wrong, but failure of our courts can lead to extraordinarily bad times.


It most definitely will lead to bad times!

That being said, it's not like people are out with actual pitchforks. We're talking about people on the internet criticizing Bill Gates' affiliation with Epstein. Gates is still rich, powerful and free from any real repercussions other than a deserved hit to his reputation (and really, barely even that).

Sadly I think we'll never see true justice since those tasked with it seem completely unwilling to do their job in this case.


Is Gates a close relative of Epstein? Did your relative serve his time?

If so then your example has nothing to lend.


Well, pedophiles are also people. And if they show remorse and moved on (or in therapy) etc. I do not see a problem.

The problem here is just, that apparently he did not moved on at all and just continued undisturbed.


OT maybe, but I wish people would stop using pedophile as if it were a crime.

> Pedophilia is a psychiatric disorder in which an adult or older adolescent experiences a primary or exclusive sexual attraction to prepubescent children. [0]

The problem and crime is, when those people act on those attractions and the way society reacts to pedophiles is certainly not helping anyone and I’d assume hindering some of them from seeking or even receiving help.

[0] https://en.wikipedia.org/wiki/Pedophilia


I've known men that have slept with women who were 15 in countries where it was legal. Not only were these men great examples of humanity but they actively helped those less fortunate than themselves.


Consider applying for YC's Summer 2025 batch! Applications are open till May 13

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

Search: