Implementing Pessimistic Locking With Spring JPA (OR JDBC) and Postgres
June 22, 2023Prerequisites I will not be going through the developer setup (installing java, postgres, maven, etc..) but the sample code assumes you have…
Prerequisites I will not be going through the developer setup (installing java, postgres, maven, etc..) but the sample code assumes you have…
For when you want to write a test that interacts with the database. How to write a JPA integration test 1. Create a new test class and…
Background Rate limiting is when an API restricts the number of invocations over time for a client (could be a user, another application…
Quickly showing how to get started with Selenium using Java and Maven. The setup step assumes Google Chrome is installed, but Selenium…
Background OAuth allows you to give a third party fine grained access to your resources (via access tokens) without granting them full…
How Home Network Traffic Works Every device you use in your home has a private IP address, which means it can only be accessed via that…
How to create a Go project Create a new folder. Ex: my-project. Run go mod init to initialize a go module (project). It will create a go…
Background Spring retry is an easy way to add retry to your Spring application. Spring Boot Implementation Assuming this is a Spring Boot…
Sample Log4j2 Configuration and Explanation Below is a sample log4j2 properties file and configuration file. By default log4j2 searches for…
Just quick steps for my zsh setup Install Zsh Zsh comes pre-installed in many distributions, but can install it if not. Install powerlevel…
Ultrawide monitors are great but the 21:9 aspect ratio means recording a 1080p video is not as straightforward as with a standard 16:…
The basic way to deploy a NextJS app is simply to run it on a node server. However, wouldn't it be great if you could deploy it serverlessly…
VSCode Debugging VSCode React Debugging - here Intellji Debugging Intellji React Debugging - here React Developer Tools React has a chrome…
Log locations /var/log/ - general logging folder /var/log/ecs/ecs-agent.log - in depth info on startup errors More Reading: ECS Logs…
Collections This one is basic, but I've seen many people not use collections and spend unnecessary time looking through the History tab for…
Summarized tips/info on AWS Networking. Use Cases & Setups Setting up internet access The internet is not part of your VPC (Virtual Private…
Web applications generally are composed of multiple components such as the frontend, backend and database among other things. Docker compose…
There are many routing options when using AWS ALB (Application Load Balancer). You can route based on url paths, http headers, host headers…
Using json type in postgres grants access to json data manipulation functions (ex: json_agg), but how do you insert data from an application…
Background Desktop entry files, .desktop, are used to create shortcuts (taskbar and search) for installed applications. Generally polished…
Background Lombok is a java code generation tool, it can remove a lot of boilerplate code. Installing Lombok To configure intellji, there…
You can use pyenv to install and manage different python versions. Below uses brew.
Basic Example There are three basic phases to writing unit tests. Mocking, Execution, Verification. Each of the steps are shown in the…
Background The biggest name when it comes to performance testing is Jmeter. However, Jmeter isn't very initituive to set up, even for a…
Reentrant Locks Reentrant locks are a good way to force mutual exclusion of resources. Re-entrant locks are not "global" locks persay, you…
Summary API calls should be retried if possible to avoid customer impact. However, retrying apis risks the possibly of duplicate operations…
Background Some tips on Intellji. The proper Intellji term for a collection of folders is "Project" but I sometimes use the term "Workspace…
Background The HTTP header Content-Type describes the kind of data being sent in the request. It can be set to things like text/plain…
Background Sonar: Static analysis for code coverage and code quality (bad practices, bugs, etc..) Jacoco: Java code coverage tool which can…
Note: <> represents variable info in the post and should be replaced with your own values. Creating Commits Create normal commit with…
You might want to find (and kill) a process on a port. Here's how. Mac/Linux Find process on port. You may need to use sudo if the process…
Background The linux screen utility allows you to run commands or programs in the background easily. This is great for when you need to…
Homebrew is a package manager that makes installing extra software very easy. Originally it was only for Mac, but a version for linux was…
Background Briefly, performance testing tells you the speed and reliablity of your system when under different load conditions. It is great…
Here are some REST API design tips. Quick Intro to REST First, some basic background on REST. REST is an API interface style guide around…
Are you tired of passing in your private key and user on every ssh connection? Then just create a user ssh configuration file ~/.ssh/config…
It's important to always have a backup of your data. In general, you should view your computer as a tool (replacable), but your data as…
I recently had an issue with my Ubuntu 18.04 laptop starting up. It can be daunting to fix startup errors since you do not have access to…
First things first. If you have read anything about SSL, you have probably also seen the term TLS thrown in as well. TLS is interchangeably…
Most meaningful scripts require or will benefit from the ability to pass in options. In Python, Argparse is a built in module that makes…
Software applications may need different configuration values depending on where they are running. For example, an API that interacts with a…
The only way, from the server side, to detect client information like OS and browser type is through the User-Agent String passed along in…