• [go] solve the cross domain problem of request origin not allowed by upgrader.checkorigin websocket


    If websocket is used under the gin framework, this error will be reported if it is a cross domain request request origin not allowed by Upgrader.CheckOrigin   The websocket library used is  ” github.com/gorilla/websocket” The following codes need to be added: upgrader = websocket.Upgrader{ ReadBufferSize: 1024, WriteBufferSize: 1024, //Solve cross domain problems CheckOrigin: func(r *http.Request) […]

  • Change careers as programmers, training or self-study? People come here to experience conscience sharing


    Hello, I’m Liang Xu. My friends who are familiar with me should know that I studied mechanics, but after graduation, I learned by myself and became a Linux application development engineer. I also made several videos related to career change before. Interested partners can go and have a look. In this article, I will introduce […]

  • Python time collection


    Statement: the following contents are my personal understanding. If you find any errors or questions, you can contact me for discussion Representation of time in Python 3 Format time string Format time string (string)_ Time) meansFormat output specifies the format and relative position of the output parameters, similar to the format function in Python, common […]

  • How to keep the stable output of services in case of traffic surge


    Service adaptive load shedding protection design Design purpose Ensure that the system is not overwhelmed by excessive requests Provide higher throughput as much as possible on the premise of ensuring system stability Design considerations How to measure system load Whether it is in the virtual machine or container, it is necessary to read the load […]

  • Front end 123: how browser caching works


    Workflow for browser caching Obtaining content through the network is slow and expensive. Large responses require multiple round-trip communications between the client and the server, which will delay the time for the browser to obtain and process content, and increase the traffic cost of visitors. Therefore, the ability to cache and reuse previously acquired resources […]

  • [go] type assertion and type judgment are in the form of if and type switch


    Use type assertions to determine whether an interface is a specified type If this simplified form:if _,ok:=x.(T);ok{ } Type switch type judgment form switch t := x.(type) { case int: fmt.Printf(1) case nil: fmt.Printf(2) default: fmt.Printf(3) }    Type assertion makes variables of the same interface behave differently at different times, which is the essence […]

  • [little knowledge] timeout setting of SSH connection in Linux system


    Determine whether the timeout is set Command line: echo $tmout For example:[[email protected] ~]# echo $TMOUT 100 If 100 is output, the timeout is 100 seconds. If the output is empty or 0 indicates no timeout, and the number n greater than 0 indicates that the channel is not used within N seconds, the timeout will occur. […]

  • Session sharing using memcached


    Session sharing using memcached Application scenario When there are many users, the login locations of these users are on different servers, because sessions are generated on the server. When users visit each other, sometimes they find that they have permission, sometimes they find that they do not have permission. Because the cache is centralized and […]

  • Sed command in shell


    grammar Sed [- hnv] [- e < script >] [- f < script file >] [text file] Parameter Description: -e<script>or–expression=<script>The input text file is processed with the script specified in the options. -F < script file >or–File = < script file >The input text file is processed with the script file specified in the options. […]

  • Hot deployment with springboot


    preface In the actual development process, every time you modify the code, you have to restart the project and re deploy it. For some large applications, the restart time costs a lot of time. For a back-end developer, the restart process is really hard. In the field of java development, hot deployment has always been […]

  • Creating temporary tables with MySQL


    When the query is not complex, you can create a temporary table, which is simpler SELECT * FROM (SELECT * FROM roles s left join role_has_permissions r on s.id=r.role_id ) temp WHERE temp.name=”Founder” This work adoptsCC agreementReprint must indicate the author and the link of this article

  • JS operation mechanism


    Single thread: JS is single thread. JS can only do one thing at a time. This is called single thread Task queue: asynchronous process and single thread itself seem to conflict. It is task queue that makes the two not conflict Note: synchronous task is prior to asynchronous task Synchronization task: the task running synchronously […]