General

Kotlin Standard Library Safari: Strings

This blog post accompanies the first episode of our YouTube series “Kotlin Standard Library Safari”, which you can find on the official Kotlin YouTube channel, or watch here directly!

What’s Kotlin Standard Library Safari?

In the “Kotlin Standard Library Safari” series, we’re going through the useful functionality the standard library in Kotlin has to offer, one subject at a time. In the process, we’re hopefully going to unearth some hidden gems together, which will come in handy the next time you write Kotlin code. Because if you know how to wield it, the Kotlin standard library is a powerful tool which can help you be more productive solving your problems, and be more expressive in your code.

Tips and tricks for your Kotlin code explorations

This blog post accompanies a video from our YouTube series which you can find on our Kotlin YouTube channel, or watch here directly!

We’re going to take a look at some handy tips and tricks to help you explore Kotlin code, no matter whether it’s your own code or the code from the Kotlin standard library or any of your other dependencies. They will equip you to discover some of the goodies in the code you’re working with on your own.

Hosting Kotlin/JS on GitHub Pages via GitHub Actions

GitHub Pages is an easy way to host your Kotlin/JS application - and in combination with the continuous integration service GitHub Actions, you can easily set up a smooth development (and deployment!) experience for your projects. Read on to learn how you can build and test your application on GitHub’s CI, and get your Kotlin/JS web apps published for free.

In this post, we are going to configure GitHub Actions and Pages so that new code pushed to our repository or added via pull request is automatically validated (by having the project built and our tests run on GitHub’s servers), and code pushed to the main branch of our project is automatically made available to the public (by generating and publishing production artifacts of our app).

Deploying server-side Kotlin Ktor applications on Dokku

In my last article, I talked about “[Publishing server-side Kotlin applications built with Ktor on Heroku]({% post_url 2021-01-15-Kotlin-on-heroku %})”. I really like Heroku as a place to host my Kotlin apps because the time from setting up my application to having it available to the public is very short – I can confidently get my prototype applications running in the cloud in less than 10 minutes, and even if I need a database or integration with some other service, it can be spun up in mere minutes.

Kotlin, Ktor and Exposed on Heroku

Getting an application into the hands of the first users is the best feeling. Seeing them try out an app for the first time and collecting feedback from them for future improvement has always felt very rewarding to me. For server-side apps, this usually means getting the app deployed somewhere – published on the web.

Today I want to share one quick way to get Kotlin applications built with Ktor onto the web: Using Heroku.

Running Create-React-Kotlin-App on Heroku

(This post is a tutorialized version of the workarounds that I worked out together with Andrey Skladchikov in this YouTrack issue for CRKA.)

As the name might suggest, create-react-kotlin-app (CRKA) is the Kotlin equivalent of JavaScript’s create-react-app: A wonderful little tool to automate all the webpack and configuration stuff for your React/Kotlin application, having you focus completely on the actual application logic.

Getting create-react-kotlin-app to run on Heroku, however, is not without its pitfalls. After having struggled through it myself, I’ll run you through how you can deploy your CRKA application on Heroku, proper production builds and all.

Developing for Raspberry Pi using IntelliJ Deployment

So a few days ago I published the Thermal-Kotlin library which allows use of thermal printers in conjunction with a Raspberry Pi. That library and the way I developed it will get its own article soon, but I wanted to pick out one part that was particularily interesting for me: Automatic Deployment using IntelliJ.

When prototyping the library, I had to run it on the Raspberry Pi often, in order to figure out the exact workings of the protocol used by the printer and even try out timings that wouldn’t prevent the printer’s buffer from overflowing. At first I tried running IntelliJ on the Raspberry Pi to little success (unfortuantely the Pi isn’t nearly beefy enough to run a fully fledged IDE at a comfortable speed), but I didn’t want to miss out on all the great autocompletion and refactoring features that I have become so used to in IntelliJ.

Fixing PAGE_FAULT_IN_NONPAGED_AREA after Windows 10 Creators Update

After the last unsolicited update from Microsoft, the Creators Update for 2018, instead of a seamless upgrade, I was greeted by

PAGE_FAULT_IN_NONPAGED AREA. Cause of Error: SbieDrv.Sys

This was combined with Windows frantically trying to restart multiple times, trying to roll back the changes it had made, all to no avail. As I was sitting in front of the computer, beeping with every restart, I started researching on my phone in order to take matters into my own hands.

Hexagonal Grids

I was spending one of the recent days in the Loretta Bar here in Munich together with Alex, and we worked on a few tasks of the 2017 edition of Advent of Code. I was infatuated with the last task we worked on, the Day 11 challenge. You are supposed to find the distance of a position in a Hex Grid based on a path description. I had already read a few articles regarding hexagonal grids, because I feel it is one of the less intuitive data structures, but none of them really made me understand the topic extremely well. I decided to just grab a pen and doodle away at a napkin and (later on) a few pieces of paper, scribbling around and trying to figure things out. After I had managed to build an (albeit inefficient) solution for myself, I set out to understand more about the topic. When I managed to have somewhat of a personal breakthrough in understanding, and felt a lot better reasoning about the topic, I decided it would be time to improve upon the visualisations that I had seen on other blogs like Redblobgames. They’re still a great read any heavily recommended, but I thought I’d try my hand at one of these as well. So, amidst what seems like a heavy outage on the internet (with a very spotty connection), I managed to glue together a small demo. Because we all love interactivity, I’m going to throw the demo in first, and the rest of the text later.

Making my Fire HD 10 a YouTube machine

T’was the night of the 24th of december, I was sitting together with my family at my grandparent’s house and celebrated Christmas - and the Christkind blessed me with a Fire HD 10 Tablet, freshly made by Amazon (or whoever manufactures these things). It should serve as a replacement device for my Sony Xperia Tablet Z which unfortunately had an unplanned rendezvous with the floor.

So I set out to make this thing my classic YouTube watching machine that I was used to before. Which is when I encountered…