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

testcontainers is great. I struggled a bit with testcontainers due to the nature of one container per test which just felt too slow for writing gray/blackbox tests. The startup time for postgres was > 10 seconds. After a bit of experimenting, I am now quite happy with my configuration which allows me to have a snappy, almost instant testing experience.

My current setup:

- generate a new psql testcontainer _or_ reuse an existing one by using a fixed name for the container - connect to the psql container with no database selected - create a new database using a random database name - connect to the randomly generated database - initialize the project's tables - run a test - drop the database - keep the testcontainer up and running and reuse with next test

With this setup, most tests run sub-second;


If your table setup process starts to get slow like ours, checkout psql TEMPLATE (https://www.postgresql.org/docs/current/manage-ag-templatedb...). Do the setup once to a db with known name, then use it as the template when creating the db for each test.


You can run Pg against a RAM disk too, if the container isn't effectively already doing that.

And tests can often use a DB transaction to rollback, unless the code under test already uses them.


Which is perfectly fine. However, you will be able to process only a single message per connection at once.

What you would do in go is:

- either a new goroutine per message

- or installing a worker pool with a predefined goroutine size accepting messages for processing


Another option is to have a read-, and a write-pump goroutine associated with each gorilla ws client. I found this useful for gateways wss <--> *.


UseMemo should not be used for fetching/kicking off a fetch either. UseMemo fans should be pure. Using logic that belongs into useEffect (logic that happens _outside_ the reactive flow) could potentially lead to other side effects which are very hard to debug. Just a example: a lot of fetch implementations are using fetch with a cache triggered in useMemo returning immediately. You will probably have a setState somewhere in the flow which will terribly interrupt react and break your page.

In case you trigger a native fetch, you've got no way to cancel the call due to the missing cleanup fn.


> UseMemo should not be used for fetching/kicking off a fetch either

Wrong. That's just like, your opinion.

The best time to kick off external calls is during first render, not after the component is mounted and React has gotten around to calling your useEffect callback.

useMemo can be a part of the solution along with useRef and useEffect cleanup(remember it's essentially to the unmount lifecycle hook as well).


Bikes are all about efficiency since you don't use any energy but your own. Things change a bit nowadays with e-bikes.

When it comes to efficiency, internal gear hubs sadly aren't yet in the range of a rear derailleur.

https://fahrradzukunft.de/17/wirkungsgradmessungen-an-nabens...

A dirty rear derailleur of course also reduces the drive train's efficiency by a lot - which can be solved by cleaning the chain every other month.

When moving towards belt drives, you need a very stiff frame which can be opened/split in the back to fit the belt. These frames are more expensive to produce which will furthermore increase the overall bike's price.

Ideally, we all train our legs to be able to handle a single speed setup ;-)


You don't NEED an opened/split frame for a belt. There are so many ways to solve this problem.



... besides the change towards hooks and the react dev team which does not seem to be clear about how to best use them.

The new beta docs just recently changed again removing old best practices concerning dependency arrays in useEffect hooks in favor of a new potential hook called useEffectEvent (which is still experimental).

I love to work with react. However, it takes _a lot of time_ onboarding new engineers for tasks which are a bit more complicated in nature. Also, using hooks the wrong way can really mess up your product big times.

It would be nice to see react moving in a direction which is by design/architecture less error-prone.


Umidigi is another company to mention. Their Bison models pretty much fill the gap between a massive rugged phone and a standard phone. The phone's battery @~6kmAh usually covers a 2-3 day trip without charging.


To me, the biggest problem with javascript as a backend language is - especially in large teams: people tend to mix backend code with frontend code after a while.

Looking at next.js for example. There are so many ways to fetch data for a page: getStaticProps, getInitialProps, getServerSideProps and the API handler (I hope I didn't miss any now). Each single one of those uses their own naming concepts (context vs req/res, query vs params). It is very easy - especially for newcomers to the frontend - to break things or leak data by not following the concepts of the frontend.

By dividing backend and frontend on a language level, you get a clear boundary on an API level which helps developers having a clear focus on their actual problem scope.

I guess you could solve the problem by having two node.js applications: one providing API endpoints and one taking care of the view. By then, I'd just switch to a properly type-safe language for the backend.


The knife throwing machine reminds me a lot of the slingshot channel:

https://youtube.com/c/Slingshotchannel


Have you seen NightHawkInLight:

https://www.youtube.com/channel/UCFtc3XdXgLFwhlDajMGK69w

LaserSaber:

https://www.youtube.com/channel/UCIKzUKkh7XtnSYPW0AJb-9w

or StyroPyro:

https://www.youtube.com/channel/UCJYJgj7rzsn0vdR7fkgjuIA

They have similarity to the Quint BUILDs channel that the knife throwing machine video came from. They all do some pretty crazy builds.


Let me show you its features!


I recommend Haberfellner - Systems Engineering (ISBN 303013430X).

The Incose handbook for systems engineering: https://www.incose.org/products-and-publications/se-handbook

(You might be able to find an older version for free)

Disclaimer: I've been participating in a Systems Engineering master program @ university a while back which was based on both Haberfellner (and is finally available in English also) and Incose.


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

Search: