• Iterator & foreach


    <?php class Traverable { } abstract class Iterator extends Traverable { abstract public function current(); abstract public function key(); abstract public function next(); abstract public function rewind(); abstract public function valid(); } class myIterator implements Iterator { private $position = 0; private $array = [ “firstelement”, “secondelement”, “lastelement”, ]; public function __construct() { $this->position = […]

  • Using three machines to build three master and three slave redis cluster in CentOS 7


    The author‘s document is reproduced here. It is convenient for later installation.

  • Speed and passion of compiling: from 10mins to 1s


    Original text:Speed and passion of compilation: from 10mins to 1s | alloyteamAuthor: glendonli Introduction: for large-scale front-end projects, the stability and ease of use of construction is very important. In the iterative process of Tencent documents, the problems caused by complex project structure and compilation are increasing day by day, which greatly increases the cost […]

  • Go how to pull data from channel every second


    Go how to pull data from channel every second This work adoptsCC agreementReprint must indicate the author and the link of this article

  • Django — model creation of multi table operation, one to many add records, many to many add, modify, delete records, many to many other APIs


    1Model creation of multi table operation 1. Book list, author list, author detail list, publishing list, (the third intermediate table) 2. Author and author details: it’s one-to-one. You can write the associated field on either side Books and publishers: one to many. Once the one to many relationship is established, the related fields are written […]

  • Brush leetcode with rust


    Problem Implement atoi which converts a string to an integer.The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this character, takes an optional initial plus or minus sign followed by as many numerical digits as possible, and interprets them as a numerical value.The string […]

  • V-distpicker “Chongqing Municipal District Jiangbei District” bug solving


    Jiangbei District This version of Jiangbei District will report an error. Yesgithub: 2019 9-29The author just modified thisbug。 Because there are twoJiangbei District。solve: upgradev-distpickerRecompile After the v-distpicker component is installed, when it is found that the selected district in “Chongqing municipal district” is “Jiangbei District”, click to report an error Adapt the translated code! Let […]

  • Installing ffmpeg under centos7


    1. Update system sudo yum install epel-release -y sudo yum update -y sudo shutdown -r now 2. Installing the nux dextop source sudo rpm –import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro sudo rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm 3. Install ffmpeg and ffmpeg development kit sudo yum install ffmpeg ffmpeg-devel -y 4. Testing ffmpeg -h This work adoptsCC agreementThe author and the link […]

  • How to publish a technical book


    Many people want to write a book and summarize it as a stage of their career. However, the standard of publishing a paper book is usually very high, the process is very long, and the material return may be very low. If there is no deep feelings, extraordinary will, or improper method, it is easy […]

  • Modify centos7 to alicloud source by default


    1. Backup local Yum source: mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup 2. Download the new CentOS- Base.repo To / etc/ yum.repos .d/ wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo 3. Survival cache: yum clean all yum makecache 4. View the source of Yum: yum repolist This work adoptsCC agreementThe author and the link to this article must be indicated in the […]

  • How to build a self built Yum warehouse


    For the first time, I want to sum up what I have learned and share my learning experience. If there is any deficiency, please give me your advice. 1、 Environment: take a rhel8 virtual machine as the network Yum source, and mount / dev / CDROM / DVD to mount the local image source to […]

  • MIT6.824-Lab2A


    Lab2A Lab2a address: https://pdos.csail.mit.edu/6.824/labs/lab-raft.html Lab2a needs to complete theLeader Electionpart.According to figure 2, the following functions are realized: Initial election Candidate releasedRequestVote rpc Leader releaseAppendEntry rpcIncluding the heartbeat Server state transition (follower, candidate, leader) The experimental results showed that: 1 byraft.goAdd the required status. definitionlog entryThe structure of. fillRequestVoteArgsandRequestVOteReplyStructure. modifyMake()To create a background goroutine, which […]