Constructors in Golang

There are no default constructors in Go, but you can declare methods for any type. You could make it a habit to declare a method called «Init». Not sure if how this relates to best practices, but it helps keep names short without loosing clarity. package main import «fmt» type […]

delete map[key] in go?

package main func main () { var sessions = map[string] chan int{}; delete(sessions, «moo»); } seems to work. This seems a poor use of resources though! Another way is to check for existence and use the value itself: package main func main () { var sessions = map[string] chan int{}; […]

Технология CRUD-матрицы. Практический опыт

Технология CRUD-матрицы — это хороший инструмент для каждого члена Agile-команды на протяжении всего жизненного цикла продукта. CRUD-матрица позволяет наладить адекватный диалог с клиентом и выявить дублирование функционала, а также устранить противоречивость модели. Что касается оценки времени, то в этом моменте CRUD-матрица значительно уступает такому инструменту, как “planning poker”, который позволяет […]

Find the total size of certain files within a directory branch

23 The ultimate answer is: { find <DIR> -type f -name «*.<EXT>» -printf «%s+»; echo 0; } | bc and even faster version, not limited by RAM, but that requires GNU AWK with bignum support: find <DIR> -type f -name «*.<EXT>» -printf «%s\n» | gawk -M ‘{t+=$1}END{print t}’ This version […]

Recursively counting files in a Linux directory

This should work: find DIR_NAME -type f | wc -l Explanation: -type f to include only files. | (and not ¦) redirects find command’s standard output to wc command’s standard input. wc (short for word count) counts newlines, words and bytes on its input (docs). -l to count just newlines. […]

Accessing private properties in PHP

Private properties can only be accessed by the class that defines the property… right? Actually, PHP has a few ways to circumvent this: reflection, closures and array casting. Reflection: slow, but clean PHP provides a reflection API to retrieve metadata of classes, methods, interfaces, and so on. Of special interest […]

Awesome HTTP Load Balancing on Docker with Traefik

Why Traefik? Traefik is the up-and-coming ‘Edge Router / Proxy’ for all things cloud. Full disclosure, I like it. The cut back features compared to products like F5 which I have used throughout my career is refreshing — these products still do have their place, and they can do some […]

Zero Downtime Deployments With Docker Swarm

Zero downtime deployments is an important topic when it is come to hosting a highly available software. This is especially the case with frequent software deployments ,following Agile methodologies, and trying to apply continuous deployment guidelines and techniques. The Problem The zero-downtime deployment topic is most relevant to the web […]

Очистка места на диске после docker

Технология Docker позволяет упаковать приложение или сервис в контейнер, который легко может быть запущен в любом окружении. Однако при активной работе с Docker жесткий диск быстро засоряется неиспользуемыми образами, контейнерами и томами данных. Давайте разберемся с набором инструментов для чистки системы, предоставляемым Docker и рассмотрим несколько примеров! Как мы уже […]