Nillability and zero-values in go

Beeing a long time java-developer, I am obsessed with null-checking and handling null values. In golang, the story is somewhat different. In this post I will try to describe how nil and zero-values are used in golang. non-nillable and nillable types Types can be either nillable or non-nillable in go. The non-nillable types can never be nil and will never cause you a nil-panic (the java equivalent of nullpointerexception) But when are dealing with the nillable types, we have to take a bit of caution although not as much as in java(or other languages with nillable types). [Read More]

Write go like a pro

So you enjoy go and are ready to take your go-application to production standards. Here is a listing of some tricks on how to get your application production-ready. Not all these advices will apply to all kinds of applications, pick and choose whatever makes sense to your application. Use Make to build and test your app Heavy-weight applications written in heavyweigh JVM languages has gradle/maven/ant/sbt/leiningen. Javascriptish languages has npm/yarn/hotoftheday. For go, you should lean on a rock-solid lightweight tool like Make, to build and test your app. [Read More]

Store and forward with kafka

Store and forward is a technique normally applied in hardware-routing and networking to avoid package-loss. If we apply the same technique when sending records to kafka, we dont have to deal downtime of your kafka-cluster. Store and forward “Store and forward” is a technique used widely in telecommunications and in router technology. The idea is simple: when we want to send a packet, instead of sending it directly, the packet is stored in a cache or a local storage and sent to the network at a later point. [Read More]

Concurrency made easy(easier) with coroutines

Coroutines can be looked at as lightweight threads that enables us to write simple concurrent code in kotlin. It enables us to execute concurrent code without much effort and write async code in a sequential style, hiding the noise introduced by explicitly handling async events and callbacks. The result is readable, high-performant code. Instead of the dealing with callbacks and synchronisation, the developer can focus on real, value-adding code and let the runtime handle callbacks transparently. [Read More]

Using griblib for Meteorology

Griblib is a library written in go to read grib2 files and do some filtering on the content. This post describes some details about how griblib is built and intended usage. GRIB2: a binary format for meteorology GRIB: G eneral R egularly-distributed I nformation in B inary form Grib2 is a binary file-format used to store forecasts and historical data. The content can be meteorological, space-weather, sea-conditions etc. In this post I will only focus on meteorological data. [Read More]

Converting an android project to kotlin

This is a small write-up of my experiences from converting a native android-app from java to kotlin. TLDR; Convert the project using android studio Handle nullability-compilation errors Android annotations build script apply lateinit on @ViewById Convert your data-objects into small classes, go for immutable classes Kotlin is cool, and immutability rocks. Bugs in android-studio shows that it is still early days for kotlin-development on android. Convert your project! [Read More]

Using your tensorflow model with go

This post will serve as a simple end-to-end example of how to use your own tensorflow-model to do inference in your go-application. You will need to train your own model with tensorflow in order to make it work properly. If you are doing inference in java (or any other language) the blogpost will still be useful since the principles are the same for languages with bindings to tensorflow. TLDR; Name your tensors and operations in the tensorflow graph before exporting the model. [Read More]

Comparing sizes of protobuf vs json

update: now comparing gzipped json vs gzipped protobuf Google Protobuffer is a binary format claiming to much more compact than json and other text-formats, but just how much less space does it require? Does it hold for large arrays of data? In this blogpost I will compare the sizes of the two formats. Test-data with array of tickers I will generate test-data with a home made tool, you can find it on github: https://github. [Read More]
proto  json 

Hello hugo on github.io

This blog is built using hugo. So my first blogpost is dedicated to how I set it up on github. installation install the bleeding edge hugo version by running go get -v github.com/spf13/hugo verify the installation by typing hugo -h this should display the help screen for hugo create hello world create blog hosted on github.io On github, create a repository “<yourusername>.github.io”, e.g. “nilsmagnus.github.io” . Clone the repo and cd into the directory. [Read More]