How to Query a Shape file for Point inside a polygon using ogr python

Recently I was trying to build a quick geo lookup service in python, which could be used like an “info tool” in QGIS. This task is trivial in almost all geospatial databases, however I wasn’t able to find much online around querying a shape file. In this post I will demonstrate a simple python code to query a shape file which contains world countries. The file can be downloaded from here.
Read more →

How to read a csv file in go

One of the most common task for a programmer is either to read or write a csv file Read a csv file package main import ( "bufio" "encoding/csv" "os" "fmt" "io" ) func main() { // Load a csv file. f, _ := os.Open("/path/to/my/csv/file.csv") // Create a new reader. r := csv.NewReader(bufio.NewReader(f)) //define seperator r.Comma = ',' for { record, err := r.Read() // Stop at EOF. if err == io.
Read more →

How to integrate Google container engine with Stackdriver with kubernaties

Most folks have been using Grafana or something similar to monitor Kubernaties cluster. If you are using Google cloud container engine , then the standard unified place to monitor all your application and services is Slackdriver. According to googles documentation, when you create a new container cluster using GUI or gcloud, Slackdriver is automatically configured with a sink, however It did not work out of the box for me hence this post :)
Read more →

Binary Search Tree in python

BST data structure supports many dynamic-set operations including Search Minimum Maximum Predecessor Successor Insert Delete These basic operations allow us to treat this data structure both as a dictionary and as a priority queue. Basic operations on a binary tree takes time proportional to the height of the tree, O(lg n) [worst case] and even O(n) if the tree is a linear chain. If you want to learn more about practical application of these trees check this post out.
Read more →

Heap Sort in python

The (binary) heap data structure is an array object that we can view as a nearly complete binary tree. Each node of the tree corresponds to an element of the array. The tree is completely filled on all levels except possibly the lowest, which is filled from the left up to a point. An array A that represents a heap is an object with two attributes: length, which (as usual) gives the number of elements in the array.
Read more →