sizeof in java or how much memory is this object going to consume
Identifying which Java thread is consuming the most CPU
I didn’t come up with this. I was shown how to do this by an esteemed college at work. I only tested this on Linux.
Introduction
Most (if not all) productive systems doing anything important will use more than 1 java thread. And when something goes crazy and your cpu usage is on 100%, it is hard to identify which thread(s) is/are causing this. Or so I thought. Until someone smarter than me showed me how it can be done. And here I will show you how to do it and you too can amaze your family and friends with your mad geek skillz.
Postgres Timestamps and Java
Postgres timestamps are up to microseconds resolution. This can be seen here in the Postgres V13 docs. This means that if you are trying to save a ZonedDateTime type into to the DB, you should cut-off the Nano-seconds portion of the time. Otherwise, if you save a time with Nano secs, and you read that time back from the DB, you will have different times. This is because the time from the DB is missing the nano-secs. So how does one go about doing this?
Creating PDFs in Java
What's a good way to make PDFs in java? iText, pdfbox, and perhaps other libraries?
However there is another way to create PDFs which is (at least for me and my use case) easier. And that is: create a HTML. Then convert that HTML into a PDF using flying saucer.