AWS Lambda HTML to PDF

The Nightmare is Over Rendering PDF in Lambda took longer than expected. Tutorials exist in both AWS Lambda and the Serverless Framework. Most do not work, though. The wktohtml and phantomJS libraries in nodeJS are problematic. They don't fully support NodeJS 12.X. So fear no more, some people have figured it out. Headless Chromium to the Rescue The key is to use the chrome-aws-lambda tooling. The catch is you must install a Lambda layer (instructions exist in the Readme). Serverless provides an easy way to apply layers. You can always manually add one in the Lambda AWS dashboard. Once there, you can write a Lambda function to load a headless browser to perform work. I hope this is helpful to you! Share your thoughts in the comments!

Modifying the timezone in Ruby or with ActiveSupport

Sometimes you may need to query an SQL record in ruby and convert the UTC time into a local timezone. This is usually done in a framework like Ruby on Rails. Many web frameworks use the Active Support gem. From their enhanced tooling, they may set the timezone on the thread by calling: = "Requests Time Zone". The Time class in ruby (w/ ActiveSupport) can then access this by calling the getter method: Here are some examples of how this plays out in action. See the TimeZone documentation if you need more info. Hope this may be helpful and please comment if you have any questions or additional advice!

Java Base64 URL Safe Encoding

When it comes to common tooling in Java, Guava is your best friend. If you are still using Apache Commons, stop now. Below is the gradle dependency information for guava as of this writing.

Microservices Tech Stack with Spring and Vert.X

It’s been awhile since my last blog post, and it’s been for several reasons. The primary, is that our team has been challenged to implement a Microservice Architecture (MSA) that fit’s my current company's needs. It’s been a process defining the stack, learning the new stack and providing tooling/components for developers to innovate.

Understanding Immutable Classes In Java

I recently reviewed an article that claimed immutable classes in Java are not always thread safe. Ultimately, this is not true since any immutable class cannot contain state and therefore no two threads could change it's state. To understand this more, I would like to do a quick dive into what an Immutable class is in Java.

Yes, Immutable Means Thread Safe. It's that simple.

Plain and simple, IMMUTABLE IS ALWAYS THREAD SAFE, and it is a very simple concept. If somethings state cannot change upon instantiation, no two threads can ever write to the object and break it's state. The other day I was curious what people thought about this topic. A top hit from DZone claimed not always, and I would like to rebuttal. Here is a link. And my response:

Spring HATEOAS - Embedded Resources with HAL

One common issue I see on the web is people having trouble rendering their JSON objects in HAL with embedded resources. For this example I am using groovy, but it explains how to configure the rendering of resources in a spring applicaiton.