Home

Ktor Database Beginners Guide

I have been using Ktor, PostgreSQL, and Jetbrains Exposed for a backend in a hobby project. I was adding a new feature that required making changes to the database, so after a quick Google search found a Stackoverflow answer recommending using Flyway to manage the database migrations. I was looking for a more complete solution to this answer, so ended up creating a sample project to share my learnings in migrating a Postgres database with Flyway in a Ktor project.

Read more

Surviving Android Process Death With SavedStateFlow

I was perusing Reddit the other day when someone asked how they could use SavedStateHandle with a StateFlow similar to the SavedStateHandle.getLiveData() version. The most upvoted comment originally was saying that this functionality is not officially supported, but one could convert the LiveData to a Flow using the LiveData.asFlow() extension function. That seemed pretty simple for anyone to do, however testing that would then require using LiveData in your tests which might be annoying if you were using StateFlow to manage state. So after looking over the API, it seemed pretty simple to write a wrapper that could expose this functionality directly as a StateFlow and that is how the SavedStateFlow library was made!

Read more

How to build a Slackbot with Kotlin

One day at my day job, I noticed that there were a couple of services we used that anytime an event happened there was a very manual process for the developer to copy paste data into a Slack channel for others to be aware of the issue. I thought there had to be a better way to automate this whole process and prevent a developer from having to do this tedious task. That was when I came up with the idea of creating a Slackbot application to do this. So in this article I will describe the process I went through to create a Slackbot using Ktor and webhooks that can post messages to your Slack channel of choice and how to deploy to Heroku. For this example, we will be using Github webhooks to supply data to our Slackbot but the same principal applies to your service of choice that offers webhooks.

Read more

Physical Workspace

One aspect of a programmer’s work that I think can get overlooked is the actual physical workspace where he or she works. Over the years I have invested a lot of time and effort into creating a home office that is ergonomic and promotes a workflow that works for me. By no means am I trying to tell everyone that…

This is the way

Read more