Today's Question:  What does your personal desk look like?        GIVE A SHOUT

 ALL


  Time to think about supporting max/min functions for integers in GoLang

Sometime back we wrote a post explaining why there is no max/min function support for integers in GoLang, one of the reasons is that no overloading is supported and the function name has been used for other numeric types float64. To solve this problem and make max/min function support integer as well, either GoLang should support overloading like in Java or the same set of functions need to be created in a different package other than standard math. These don't look like good options as overloading is more a OOP concept and supporting the same set of functions in a different package doesn't so...

4,885 0       GOLANG GENERICS MAX MIN


  Install and enable redis extension in PHP 5.X on Windows

Redis is frequently used as a caching layer for web applications to improve its performance. In PHP 5.x, if one wants to use Redis, the redis extension needs to be installed and enabled first.This post will show how to install and enable redis extension on Windows with PHP 5.X. Basically there are two dlls to be downloaded: php_redis.dll and php_igbinary.dll.Below are detailed stepsGo to http://windows.php.net/downloads/pecl/releases/redis/2.2.7/ and find the respective php_redis zip matching your environment.Go to windows.php.net - /downloads/pecl/releases/igbinary/2.0.1/ and f...

5,167 4       PHP WINDOWS REDIS PHP 5.6


  Fix --go_out: protoc-gen-go: plugins are not supported

When generating RPC code using proto file template in GoLang, one may face the issue like below when running the command protoc.Error: exit status 1Output: --go_out: protoc-gen-go: plugins are not supported; use 'protoc --go-grpc_out=...' to generate gRPCSee https://grpc.io/docs/languages/go/quickstart/#regenerate-grpc-code for more information.Normally this issue is caused because the version of protoc-gen-go being used is not correct. One way to fix the issue is to follow the instructions provided by Google to run a new command.Another way to fix this is by having the Github version of proto...

15,722 0       PLUGIN GOLANG PROTO BUFFER


  Top 10 Go Coding Traps and Tips

Go is currently the most common programming language in cloud development. Though I use it very much in my work, I am still repeating certain mistakes. This article is more a record of these errors, figuring out the causes and solutions so that people who read this article will save themselves time when coming across the same problems.Let’s cut through to the tips.Don’t rely on index var in the for loopThe most common mistake we make is that we often create goroutine inside a for loop and rely on the index variable. For example,package mainimport ( "fmt" "sync")fun...

1,490 0       TIPS GOLANG NIL INTERFACE


  New function signal.NotifyContext in GoLang 1.16

os/signal package in GoLang may not be frequently used but it provides some good features like Shutdown() which can be used to gracefully shutdown a running HTTP server.func (srv *Server) Shutdown(ctx context.Context) errorWith this function, there is no need to use third party library to gracefully shutdown HTTP server. How is it being used?package mainimport ( "context" "fmt" "net/http" "os" "os/signal" "time")func main() { server := http.Server{ Addr: ":8080", } http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { time.Sleep(time.Second * 10) fmt.Fprint(w, "Hello world!") ...

6,480 0       GRACEFUL SHUTDOWN NOTIFYCONTEXT GOLANG


  Kubernetes Authentication & Authorization 101

If we want to build a system with user modules, Authentication and Authorization are something that we can never ignore, though they could be fuzzy to understand.Authentication (from Greek: αὐθεντικÏŒς authentikos, “real, genuine”, from αὐθέντης authentes, “author”) is the act of proving an assertion, such as the identity of a computer system user — from wikiAuthorization is the function of specifying access rights/privil...

2,285 0       KUBERNETES AUTHENTICATION AUTHORIZATION RBAC


  Install Kubernetes with minikube and docker on Ubuntu

When someone just wants to play around Kubernetes on its local environment without accessing to Cloud provider resources, one can set Kubernetes up on local environment with minikube with single node mode.This post will provide a simple guideline on how to set up KUbernetes with minikube and docker on Ubuntu.Before all the steps can be started, you may need to first set up kubectl which is a command line tool to operate on Kubernetes resources.Post that, can ensure that docker is installed on Ubuntu, in case it's not installed, can follow below steps.Update local software repository databasesu...

1,810 0       UBUNTU DOCKER KUBERNETES MINIKUBE


  A walk through of different ways accessing Kubernetes application

When a web application is deployed on KUbernetes, to access the application, there must be some set up needs to be done so that external users can access the resource within the Kubernetes clusters. IN this post, we will walk through different ways to access application from outside.Before exploring different ways, let's set up a simple nginx eb application which will just serve the nginx welcome message when loading.# deployment.yamlapiVersion: apps/v1kind: Deploymentmetadata: name: nginx-deploymentspec: selector: matchLabels: app: nginx replicas: 2 # tells deployment to run 2 pods...

5,466 4       LOADBALANCER NODEPORT CLUSTERIP SERVICE PORT FORWARD KUBERNETES INGRESS