Implement DCI architecture
preface
In the concept of object-oriented programming, an application is an abstraction of the real world. We often model real things as classes / objects ("what") in the programming language, and the behavior of things as methods ("what to do"). Object oriented programming has three basic characteristics (encapsulation, in ...
Posted by nanobots on Sat, 09 Oct 2021 22:12:37 -0700
grpool collaboration pool - a sharp tool for controlling the number of goroutine s
objective
The purpose of grpool is to control the number of goroutines to execute tasks, so as to avoid creating too many goroutines and causing the memory consumption to soar
Simple use
func UseWorkerPool() {
pool := grpool.NewPool(100, 50)
defer pool.Release()
for i := 0; i < 10; i++ {
count := i
pool.JobQueu ...
Posted by subesc on Fri, 08 Oct 2021 23:42:07 -0700
2. Best practices for writing neat and maintainable go code
Writing neat and easy to test and maintain code is very simple at first glance, but it is not easy to do in practice. Fortunately, the birth of go language is accompanied by a set of best practices for us to learn and refer to.
In my experience, these best practices have a positive effect on code quality measurement and can reduce the increase ...
Posted by SystemLord on Fri, 08 Oct 2021 20:21:55 -0700
k8s basic knowledge learning supporting dark horse
Kubernetes
1. Introduction to kubernetes
1.1 evolution of application deployment mode
There are three main periods in the way of deploying applications:
Traditional deployment: in the early days of the Internet, applications will be deployed directly on physical machines
Advantages: simple, without the participation of other techno ...
Posted by dupreelove on Mon, 04 Oct 2021 13:49:29 -0700
[sduoj] deep understanding of buffer
2021SC@SDUSC
introduction
In a oj system, the core content is the judgment part. Whether it is a real user or a question judging machine, to detect whether the code written by the user is correct, you only need to compile the source file where the running code is located, and then compare whether the program output result is the same as the s ...
Posted by madchops on Mon, 04 Oct 2021 10:46:47 -0700
Go -- Concurrent Programming
math/rand package crypto/rand package generates random numbers
This part is supplementary and does not involve concurrency
1. math/rand package
math/rand package implements the pseudo-random number generator
1.1 main methods
(1)func Seed(seed int64)
Set random seed. If not set, the default seed is (1)
(2)func Int() int
Retur ...
Posted by clown[NOR] on Mon, 04 Oct 2021 10:31:17 -0700
channel 2 concurrently published by Golang's Way to Growth
1. Use channel s to wait for the task to finish
Used in many places in the previous content:time.Sleep(time.Millisecond)For example:
func chanDemo(){
var channels [10]chan int //Create channel Array
for i := 0; i < 10; i++{
channels[i] = creatworker(i)
}
for i := 0; i < 10; i++{
channels[i] <- 'a' + 1
...
Posted by kristalys on Mon, 04 Oct 2021 09:56:20 -0700
go language basic data types
go language basic data types
Go is a strongly typed language. This means that each variable you declare is bound to a specific data type and accepts only values that match this type.
Go has four types of data:
Basic types: numbers, strings, and BooleansAggregate types: arrays and structuresReference types: pointer, slice, map, function, and ...
Posted by phplearner on Sun, 03 Oct 2021 18:43:26 -0700
Summary of Li Chi's Knowledge in September 2021
This paper is a summary of knowledge for September 221.
R&D Coding
C / C++
None.
golang
Several passages related to time conversion:
exTime := "20210901"
mytime, _ := time.Parse("20060102", exTime)
fmt.Println(mytime.UTC().Unix(), mytime.Local().Unix())
// Convert in local time format
mytime, _ = time.ParseI ...
Posted by benrussell on Thu, 30 Sep 2021 12:41:57 -0700
gin introduces viper and gorm (tutorial part2)
preface
I'm a programmer. This is the tutorial (part2) for creating the zero foundation of gin + vue. I will update the front and back source code of this tutorial to my gitee account synchronously: https://gitee.com/coderwusi . github account: https://github.com/coderwusi.
Create a new project root folder, gin base cli, and create a new mai ...
Posted by kartul on Wed, 29 Sep 2021 11:21:59 -0700