development

Summary: How to Write Go Code

Summary: How to Write Go Code The code organization follows repository -> module -> packages. Use go mod init and initialize module root as desired e.g. example.com/user/hello The Go binary goes to the path set in GOBIN All imported modules are stored in GOPATH/pkg/mod subdirectory The command go clean -modcache cleans downloaded packages. Reference https://golang.org/doc/code.html […]

Read more
development, greedy algorithms, NP problems

How to Write a Conference Scheduler

The conference schedule is an NP problem since it is O(2**n). A greedy approach is pragmatic to solve the problem. We can pick various strategies to prepare a schedule such as the biggest talk first, smallest talk first, random selection, etc. The Python code uses the Longest talk first and random selection to prepare schedules. […]

Read more
development

Notes on Python Decorator

Notes on Python Decorator Python decorator is a function wrapper. It helps you wrap essential tasks around your functions such as logging, ratelimits, metrics updates etc. However, it has a peculiar behavior due to its dynamic implementation. If you run the following code, what is the expected output? def register(func): print(“hello to decorator!”) def another(): […]

Read more