Best Practice Ignoring Fields from a PUT payload

Sources https://stackoverflow.com/questions/51680343/ignore-fields-from-specific-request-in-spring-boot https://stackoverflow.com/questions/12505141/only-using-jsonignore-during-serialization-but-not-deserialization https://www.concretepage.com/jackson-api/jackson-jsonignore-jsonignoreproperties-and-jsonignoretype

May 16, 2022 · 4 words · Peter Dieleman

Date format JSON

https://stackoverflow.com/questions/10286204/what-is-the-right-json-date-format

May 16, 2022 · word · Peter Dieleman

Jackson exclude null values

Sources https://stackoverflow.com/questions/64868946/how-to-not-return-null-value-in-responseentity https://www.baeldung.com/jackson-ignore-null-fields https://stackoverflow.com/questions/11757487/how-to-tell-jackson-to-ignore-a-field-during-serialization-if-its-value-is-null Issue We have the following setting in the application.yml file, but it is ignored: spring: jackson: default-property-inclusion: non_null Manually annotating the classes with @JsonInclude(JsonInclude.Include.NON_NULL) did reinstate the wanted behaviour. However, this is painful for classes that are pulled from libraries. Root cause seems to be related to the following: https://stackoverflow.com/questions/62819472/spring-jackson-default-property-inclusion-ignored. ObjectMapper Bean in our config. Add the following: .serializationInclusion(JsonInclude.Include.NON_NULL).

May 16, 2022 · 63 words · Peter Dieleman

React Select / Randomness

Sources https://mui.com/material-ui/react-select/ https://v3.mui.com/demos/selects/ Solve - No overload matches this call error in TypeScript # https://bobbyhadz.com/blog/typescript-no-overload-matches-this-call https://stackoverflow.com/questions/71499278/error-no-overload-matches-this-call-on-component-menuitem This is because of the MenuItem value. It is LiHTMLAttributes prop, and it only allows string | string[] | number. You can change the true/false values to yes/no and can easily convert into boolean.

May 16, 2022 · 50 words · Peter Dieleman

Full boot sector linux

run uname -r remove older kernels under /boot/ run sudo apt-get autoremove --purge E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root? peter@peter-UX430UAR:~$ sudo apt --fix-broken install https://askubuntu.com/questions/668582/false-disk-full-error-apt-get-unable-to-install-or-remove

May 14, 2022 · 31 words · Peter Dieleman

Feign Client converting GET to POST

Sources https://stackoverflow.com/questions/53340164/feignclient-converts-get-method-to-post https://stackoverflow.com/questions/53340164/feignclient-converts-get-method-to-post https://stackoverflow.com/questions/58468968/feign-client-get-request-throws-method-not-allowed-request-method-post-not Presence of requestbody automatically converts it to a POST

May 12, 2022 · 13 words · Peter Dieleman

Postgres Memory Error

Sources https://www.postgresql.org/docs/current/runtime-config-resource.html https://dba.stackexchange.com/questions/64570/postgresql-error-out-of-memory <> SQL Error: 0, SQLState: 53200 out of memory Could not extract ResultSet, nested exception is org.hibernate.exception.GenericJDBCException: could not extract ResultSet https://stackoverflow.com/questions/70158261/postgresql-14-2-out-of-memory-failed-on-request-of-size-24576-in-memory-conte Failed on request of size 24576 in memory context "TupleSort main" https://postgrespro.com/list/thread-id/2437174 SQL Error: 0, SQLState: 53200 ERROR: out of memory Detail: Failed on request of size 152 in memory context "ExecutorState" ERROR: out of memory Detail: Failed on request of size 32800 in memory context "HashBatchContext"....

May 6, 2022 · 72 words · Peter Dieleman

Runtime environment variables in React + nginx

Injecting Variables Through (b)ash https://github.com/facebook/create-react-app/issues/2353 https://www.freecodecamp.org/news/how-to-implement-runtime-environment-variables-with-create-react-app-docker-and-nginx-7f9d42a91d70/ https://medium.com/free-code-camp/how-to-implement-runtime-environment-variables-with-create-react-app-docker-and-nginx-7f9d42a91d70 https://www.bencode.net/posts/react-build/ <– check https://sinclert.github.io/react-env-vars/ https://gist.github.com/lezhkin11/d6b0a14127b4920feaece278e5323ee1 Using a Multi-stage Dockerfile Another option is to use a multi-stage Docker file, where the first stage is still using nodeJS, like this. This way node can still parse the environment variables as you would during local development, and the final deployed image is. However, in large organizations deploying such a multistage container in a production environment may irk some SecOps people....

May 6, 2022 · 82 words · Peter Dieleman

PostgreSQL mock data insertion

Sources Inefficient, but does the job: https://dev.to/antjanus/using-postgres-for-loop-to-generate-data-3mm2 DO $FN$ BEGIN FOR counter IN 1..100 LOOP RAISE NOTICE 'Counter: %', counter; EXECUTE $$ INSERT INTO items(name, active) VALUES ('Test item ' || $1, true) RETURNING id $$ USING counter; END LOOP; END; $FN$

May 5, 2022 · 42 words · Peter Dieleman

Spring Validation Context

Sources https://stackoverflow.com/questions/69828371/how-to-handle-multiple-combination-of-java-bean-validation-in-spring https://www.baeldung.com/spring-mvc-custom-validator#custom-class-level-validation https://stackoverflow.com/questions/19089649/best-practices-for-validation-depending-on-actions-spring-mvc https://www.baeldung.com/javax-validation-groups https://reflectoring.io/bean-validation-with-spring-boot/#using-validation-groups-to-validate-objects-differently-for-different-use-cases

May 5, 2022 · 6 words · Peter Dieleman