Common pitfalls of GitHub Actions

If you create GitHub Actions via GitHub’s UI by going to the URL of the form `https://github.com///actions/new`, it provides templates for setting up the build. However, the template is broken. There are four problems with the default template

Go language

Inheritance in Go language

Go language does not have the concept of a class directly. It, however, has a concept of an interface as well as a struct. I’ll illustrate how this can be used to build most of the inheritance constructs that a language like Java or C++ offers.

Bad and good ways to test code

Writing tests at an early-stage startup is always heatedly debated. If a function has one call, adding a unit test doubles the number of calls, this not only doubles the current work but even slows down future code changes 2X! Further, if the code is not finalized, it is legitimate to ask why even bother writing test code. Here’s a better way to write tests

GraphQL vs gRPC

RPC calls allow one service to call functions in another service as if it is a part of the same service. And unlike a REST API, one gets strong type checking. The two services can even be in different languages. gRPC is a great framework for implementing an RPC service. Another language-agnostic framework for making RPC calls is GraphQL . Many people don’t think of GraphQL that way, however, it can serve the same purpose. ...

Android Logo

Android uncaught exception handler and ANR

While trying to install a custom exception handler to catch uncaught exceptions (crashes), I ended up writing

Infinite network timeouts in Java and Go

Java made a huge mistake of having no network timeouts. A network request can block a thread forever. Even Python did the same . The language designers should have chosen some conservative appropriate numbers instead. What’s surprising is that the Go language repeated it! Here’s a simple demo

Go language

Go Language concurrency and an easy pitfall

What should this code print?

Test changes to CircleCI config locally

Rather than pushing the code to a remote branch and then testing via Circle CI servers, it is best to run the tests locally first and make them work. Here’s how you can do that.

Android Logo

Android: Catching NDK crashes

On Android catching Java exceptions is easy via UncaughtExceptionHandler . Catching NDK crashes is a bit more convoluted. Since the native stack is probably corrupted, you want the crash handler to run on a separate process. Also, since the system might be in an unstable shape, don’t send the crash report to your web server or do anything fancy. Just write the crash report to a file, and on the next restart of the app, send to your web server and delete it from the disk. I ended up using jndcrash package for this.

Docker Logo

Docker: Be careful about the scratch image

After I wrote my previous post, some suggested that I can cut down the image size further by using a “scratch” image. And that’s true, “scratch i"s a reserved 0-sized image with nothing in it. And utilizing a scratch binary image did cut down the size of the final Docker image from 13MB to 7.5MB. Pretty good, right? Except the image cannot do an SSL cert verification because of the missing SSL certs!!! Bash 1 Failed to reach google.com: Get https://google.com: x509: certificate signed by unknown authority