Golang logging with k8s.io/klog (fork of glog)

You can add the k8s.io/klog to your module as follows: 

go get k8s.io/klog@v1.0.0

You need to create a init method as follows in your library or main.go file as follows.   :

Recipe : Running mongodb and mongo-express in Docker and initializing databases on startup

This is a recipe to setup a mongodb container for your development purposes or otherwise. In production donot use mongo-express at all. The database intialization is tricky but if you follow this guide you'll be done with some leeway for customizations in a matter of minutes.
So this is how your docker-compose.yml file is supposed should look like:

How to download an artifact from Nexus repo via curl using REST API

So I can't take credit for the curl solution. The following script was a result of various stackoverflow searches to see why it wasn't working. In the end the curl command had to look like below and work in 2 steps to download the artifact I needed.

The below script assumes the following:

Installing alternative java on Ubuntu

When installing an alternative java on ubuntu, this is what you need to run approximately (The number 1 denotes your preference for this alternative whereby 1 is the highest and any other greater number is last preferred) :


Search for a Schema

So now that we have a backend, we need to store something in our backend. For that we need to have a schema for our domain. What is our domain ? Excellent question, not sure yet. But a customer and perhaps products he orders seem to be a good enough choice to begin with. I am currently working for a telecommunication company, so am seeing a lot of customers and orders. Thereby this should be no surprise. But aside this point, pretty much every webapp has customers and orders in some form. So we should have some good learning opputunity here.

The Database Backend

The first thing that any webapp needs is a persistance storage. Generally speaking Oracle databases are generally a very safe choice. But for small and medium based businesses this can result in prohibitive costs. Mysql/MariaDB is a popular choice here and is running most of the web. But at this point I am deciding against the popular choice and going for Postgre. The main thinking and reason being that Postgre is considered very close to an Oracle DB. Hence later if I wish moving my schema over to an Oracle DB is generally considered do-able.

Building a Webapp Store

So I have been silent for some time. Mainly due to deep diving into new territories since I left Oracle. Now I think it is time to put my new skills to some work and test them out. To that end, I thought that I need to build a webapp project for myself. Just to assert what I am learning and to learn even more from hands on practice.

Memory Profiling for Novices ( Heap OutOfMemory OOME error )

So sometimes out of memory errors crop up in you application. But to troubleshoot these should not be that complicated. Let me show you with Oracle's Visual VM, how you can quickly get down to the root cause of your out of memory errors. All you need Oracle's Java JDK installed on your system and the VisualVM tool that comes with it. At the time of writing the version I used was with JDK 8 (1.8.0_144). On a Mac OSX system all you need to do is type "jvisualvm" on your terminal and it will just popup. If you have your paths properly setup under windows and linux, it should also just work.

Lambda Recipe for attribute validation of Collection of POJOs

So here is a recipe you can use to validate a POJO attribute for some value. In my case I will show you how to check if attributes were set to null. But you can expand on the example as an exercise for yourself.

So here is the template method for a single object and a collection of objects:

Gradle System Commands Cheatsheet

So I was reading this book "Gradle in Action" and thought I'd jolt down the more interesting technical niceties here. For your theory part I would recommend reading the book. The source code though is available freely for the book on github.


Subscribe to Ahsan's Corner RSS