- Postgres – Subqueries and CTEs
Scalar subqueries, IN, EXISTS and the difference that matters when the inner query returns NULL. WITH for naming the steps of a query you can still read next month, the MATERIALIZED keyword that Postgres 12 made optional and when to force it, recursive CTEs, and writing to two tables in one statement with a data-modifying CTE.
- Git restore deleted commit
Sometime you commit something but then accidentally deleted it and then you would like to bring it back or continue working on it. I had this happened to me and it was frustrating to redo everything I deleted. But then I found out there is a way to recover deleted commit. Well, you want to […]
- Git reset
Get list of commits to choose from git log Git reset can change the branch pointer to point to any commit in the tree. git reset –hard <hash> $ git reset –hard 07a2a46 HEAD is now at 07a2a46 Updated index.html If you quickly check the log, you will see no history of the commits […]
- Git stash
The git stash command is used to stash away your current work and revert back to a clean working directory which matches the HEAD commit. Let’s say for example that you are in a middle of working on a feature branch and suddenly a customer issue comes up. At this point you want to […]
- Spring Data Query to DTO
We will show here how you can map a DTO to a query using constructor. First create your entity class. Here we will have a User class. Second create your DTO class. In this case we will have a UserDto. As you can see that all fields and values must be loaded into the UserDto […]