Since python 3.6, immutable object now can be defined with named tuple (with optional/default variable in 3.6.1). This brings python syntax of defining data model close to my favorite Scala case…

Configuration for running the examples. from pymongo import MongoClient import gridfs mongo_mydata = MongoClient("localhost:27017").mydata mongo_mydata_fs = gridfs.GridFS(mongo_mydata, collections='my_item_fs') A simple queueing system for pick…

Docker has placed its own forwarding in the iptables, so blocking INPUT and OUTPUT would not protect services expose via docker publish port. In addition, Docker moves its own rules at the top of yours…

This happens so often but the solution is complicated # this works docker exec -it container_name bash # this works (typing and close with ctrl-d to EOF) docker exec -i container_name "bash" "-c" "cat -…

I rarely come across situation where I need Possessive quantifiers to do something that Greedy quantifiers could not perform. Greedy Reluctant Possessive Meaning X? X?? X?+ X, once or not at all X* X*? X*…

In a concurrent environment, we often see ConcurrentMap<Key, Integer>. An good example is tracking the number of subscriptions for a topic. Keeping this number thread-safe could be important if the number is…

What would the follow code print? public class Moo { private static Moo m = new Match (); private static final Boolean t = true; private Boolean b = t; public static void main(String[] args) throws Exception { System.out.…