Category Archives: How to Fix

An error occurred while loading commit signatures

After a new computer is replaced, the following error will be reported when you re open the gitlab project management web page in chrome:

An error occurred while loading commit signatures

Or the following error:

Error fetching diverging counts for branches. Please try again.

This is probably a proxy problem, so you need to check whether the proxy settings are correct. My problem is that I installed an ad plug-in (Adblock plus – a free ad blocker) in chrome, which blocks the normal access to web pages, so I just need to suspend the use of this plug-in.

After closing, all access is normal.

Exception loading sessions from persistent storage

Tomcat error:
serious: IOException while loading persistent sessions: java.io.EOFException
Exception loading sessions from persistent storage

Error Description:
0 The session data stored in the hard disk failed to read. Eofexception indicates that the end of the file or the end of the file stream was unexpectedly reached during the input process, resulting in the failure of reading data from the session. This exception is a problem of Tomcat itself, generally because some active sessions were persisted when Tomcat was shut down abnormally last time. When Tomcat was restarted, Tomcat tried to recover these sessions N but failed to read

Solution:
find the corresponding project under Tomcat / work / Catalina / localhost session.ser File, and then delete it

The original text is reproduced from: http://blog.csdn.net/angeldhp/article/details/4742075

Error reporting in CentOS 7 using yum

Yesterday, we encountered a problem. CentOS 7 reported an error using the yum installation command

yum install unzip zip

yum install unzip zip

Error reporting
Baidu error reporting is probably due to the image problem. To use the alicloud image
modification command, first backup CentOS- Base.repo , rename it

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

Then download the image
centos7:

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

And then you see, there’s a new CentOS- Base.repo
Just clear the yum cache and regenerate it

yum clera
yum makecache

When the cache is regenerated, it will run for a while. When the cache is generated and no error is reported, you can download it using yum

java.sql.SQLException: Incorrect string value:

Chinese prompt for inserting MySQL database java.sql.SQLException : incorrect string value: error.

When solving this problem, it is not good to change the database code and table code to utf8.

Finally, we find that the collation of the field is Latin1_ swedish_ Ci, change it to utf8_ general_ Ci is OK.

View field code command: show full columns from tablename;

Change field command: alter table tablename modify column columnname varchar (100) character set utf8 collate utf8_ general_ ci not null;

(2) unrecoverable error: corrupted cluster config file

stay https://blog.csdn.net/zly_ On the basis of this blog post 9117 / article / details / 83349778, we found another error when starting redis. The error content is as follows

➜  7000 ../redis-server redis.conf &
[1] 11045
11045:C 24 Oct 2018 19:26:52.320 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
11045:C 24 Oct 2018 19:26:52.320 # Redis version=999.999.999, bits=64, commit=54e8dd11, modified=0, pid=11045, just started
11045:C 24 Oct 2018 19:26:52.320 # Configuration loaded
11045:M 24 Oct 2018 19:26:52.322 * Increased maximum number of open files to 10032 (it was originally set to 7168).
11045:M 24 Oct 2018 19:26:52.323 # Unrecoverable error: corrupted cluster config file.

The literal meaning is a damaged cluster configuration. Similarly, find the corresponding error throw point in the source code and find the following information

1. The output point of the error log is the code below

fmterr:
    serverLog(LL_WARNING,
        "Unrecoverable error: corrupted cluster config file.");
    zfree(line);
    if (fp) fclose(fp);
    exit(1);
}

According to the source code interpretation found that we did not build nodes.conf By default, this method returns a C_ Err, and then the caller clusterinit function creates a new file and a cluster. The overall code of clusterloadconfig function is as follows. But now I found this document and read it to prove it wrong redis.conf There is an error in the configuration file. After searching the configuration file, it is found that the parameter of cluster config file is configured incorrectly, and it is changed to cluster config file nodes.conf Problem solving.

/* Load the cluster config from 'filename'.
 *
 * If the file does not exist or is zero-length (this may happen because
 * when we lock the nodes.conf file, we create a zero-length one for the
 * sake of locking if it does not already exist), C_ERR is returned.
 * If the configuration was loaded from the file, C_OK is returned. */
int clusterLoadConfig(char *filename) {
    FILE *fp = fopen(filename,"r");
    struct stat sb;
    char *line;
    int maxline, j;

    if (fp == NULL) {
        if (errno == ENOENT) {
            return C_ERR;
        } else {
            serverLog(LL_WARNING,
                "Loading the cluster node config from %s: %s",
                filename, strerror(errno));
            exit(1);
        }
    }

    /* Check if the file is zero-length: if so return C_ERR to signal
     * we have to write the config. */
    if (fstat(fileno(fp),&sb) != -1 && sb.st_size == 0) {
        fclose(fp);
        return C_ERR;
    }

    /* Parse the file. Note that single lines of the cluster config file can
     * be really long as they include all the hash slots of the node.
     * This means in the worst possible case, half of the Redis slots will be
     * present in a single line, possibly in importing or migrating state, so
     * together with the node ID of the sender/receiver.
     *
     * To simplify we allocate 1024+CLUSTER_SLOTS*128 bytes per line. */
    maxline = 1024+CLUSTER_SLOTS*128;
    line = zmalloc(maxline);
    while(fgets(line,maxline,fp) != NULL) {
        int argc;
        sds *argv;
        clusterNode *n, *master;
        char *p, *s;

        /* Skip blank lines, they can be created either by users manually
         * editing nodes.conf or by the config writing process if stopped
         * before the truncate() call. */
        if (line[0] == '\n' || line[0] == '\0') continue;

        /* Split the line into arguments for processing. */
        argv = sdssplitargs(line,&argc);
        if (argv == NULL) goto fmterr;

        /* Handle the special "vars" line. Don't pretend it is the last
         * line even if it actually is when generated by Redis. */
        if (strcasecmp(argv[0],"vars") == 0) {
            for (j = 1; j < argc; j += 2) {
                if (strcasecmp(argv[j],"currentEpoch") == 0) {
                    server.cluster->currentEpoch =
                            strtoull(argv[j+1],NULL,10);
                } else if (strcasecmp(argv[j],"lastVoteEpoch") == 0) {
                    server.cluster->lastVoteEpoch =
                            strtoull(argv[j+1],NULL,10);
                } else {
                    serverLog(LL_WARNING,
                        "Skipping unknown cluster config variable '%s'",
                        argv[j]);
                }
            }
            sdsfreesplitres(argv,argc);
            continue;
        }

        /* Regular config lines have at least eight fields */
        if (argc < 8) goto fmterr;

        /* Create this node if it does not exist */
        n = clusterLookupNode(argv[0]);
        if (!n) {
            n = createClusterNode(argv[0],0);
            clusterAddNode(n);
        }
        /* Address and port */
        if ((p = strrchr(argv[1],':')) == NULL) goto fmterr;
        *p = '\0';
        memcpy(n->ip,argv[1],strlen(argv[1])+1);
        char *port = p+1;
        char *busp = strchr(port,'@');
        if (busp) {
            *busp = '\0';
            busp++;
        }
        n->port = atoi(port);
        /* In older versions of nodes.conf the "@busport" part is missing.
         * In this case we set it to the default offset of 10000 from the
         * base port. */
        n->cport = busp ? atoi(busp) : n->port + CLUSTER_PORT_INCR;

        /* Parse flags */
        p = s = argv[2];
        while(p) {
            p = strchr(s,',');
            if (p) *p = '\0';
            if (!strcasecmp(s,"myself")) {
                serverAssert(server.cluster->myself == NULL);
                myself = server.cluster->myself = n;
                n->flags |= CLUSTER_NODE_MYSELF;
            } else if (!strcasecmp(s,"master")) {
                n->flags |= CLUSTER_NODE_MASTER;
            } else if (!strcasecmp(s,"slave")) {
                n->flags |= CLUSTER_NODE_SLAVE;
            } else if (!strcasecmp(s,"fail?")) {
                n->flags |= CLUSTER_NODE_PFAIL;
            } else if (!strcasecmp(s,"fail")) {
                n->flags |= CLUSTER_NODE_FAIL;
                n->fail_time = mstime();
            } else if (!strcasecmp(s,"handshake")) {
                n->flags |= CLUSTER_NODE_HANDSHAKE;
            } else if (!strcasecmp(s,"noaddr")) {
                n->flags |= CLUSTER_NODE_NOADDR;
            } else if (!strcasecmp(s,"nofailover")) {
                n->flags |= CLUSTER_NODE_NOFAILOVER;
            } else if (!strcasecmp(s,"noflags")) {
                /* nothing to do */
            } else {
                serverPanic("Unknown flag in redis cluster config file");
            }
            if (p) s = p+1;
        }

        /* Get master if any. Set the master and populate master's
         * slave list. */
        if (argv[3][0] != '-') {
            master = clusterLookupNode(argv[3]);
            if (!master) {
                master = createClusterNode(argv[3],0);
                clusterAddNode(master);
            }
            n->slaveof = master;
            clusterNodeAddSlave(master,n);
        }

        /* Set ping sent / pong received timestamps */
        if (atoi(argv[4])) n->ping_sent = mstime();
        if (atoi(argv[5])) n->pong_received = mstime();

        /* Set configEpoch for this node. */
        n->configEpoch = strtoull(argv[6],NULL,10);

        /* Populate hash slots served by this instance. */
        for (j = 8; j < argc; j++) {
            int start, stop;

            if (argv[j][0] == '[') {
                /* Here we handle migrating / importing slots */
                int slot;
                char direction;
                clusterNode *cn;

                p = strchr(argv[j],'-');
                serverAssert(p != NULL);
                *p = '\0';
                direction = p[1]; /* Either '>' or '<' */
                slot = atoi(argv[j]+1);
                if (slot < 0 || slot >= CLUSTER_SLOTS) goto fmterr;
                p += 3;
                cn = clusterLookupNode(p);
                if (!cn) {
                    cn = createClusterNode(p,0);
                    clusterAddNode(cn);
                }
                if (direction == '>') {
                    server.cluster->migrating_slots_to[slot] = cn;
                } else {
                    server.cluster->importing_slots_from[slot] = cn;
                }
                continue;
            } else if ((p = strchr(argv[j],'-')) != NULL) {
                *p = '\0';
                start = atoi(argv[j]);
                stop = atoi(p+1);
            } else {
                start = stop = atoi(argv[j]);
            }
            if (start < 0 || start >= CLUSTER_SLOTS) goto fmterr;
            if (stop < 0 || stop >= CLUSTER_SLOTS) goto fmterr;
            while(start <= stop) clusterAddSlot(n, start++);
        }

        sdsfreesplitres(argv,argc);
    }
    /* Config sanity check */
    if (server.cluster->myself == NULL) goto fmterr;

    zfree(line);
    fclose(fp);

    serverLog(LL_NOTICE,"Node configuration loaded, I'm %.40s", myself->name);

    /* Something that should never happen: currentEpoch smaller than
     * the max epoch found in the nodes configuration. However we handle this
     * as some form of protection against manual editing of critical files. */
    if (clusterGetMaxEpoch() > server.cluster->currentEpoch) {
        server.cluster->currentEpoch = clusterGetMaxEpoch();
    }
    return C_OK;

fmterr:
    serverLog(LL_WARNING,
        "Unrecoverable error: corrupted cluster config file.");
    zfree(line);
    if (fp) fclose(fp);
    exit(1);
}

 

The influence of the loading order of props, data and computed in Vue

The influence of the loading order of props, data and computed in Vue

1. Computed and watch can only be used as change monitor, never initialization!!!

2. Because the loading order is props – & gt; methods – & gt; data – & gt; computed – & gt; watch

3. All init methods must directly call the database or this$ store.getters Read memory instead of computing it

Go: How to Fix plug-in installation failure in vscode of windows system

1.Run go env -w GO111MODULE=on //enable mod   
  Run go env -w GOPROXY=https://goproxy.cn,direct //set proxy
2. Go to GOPATH directory, create src/golang.org/x/ directory, go to src/golang.org/x/ directory
    git clone https://github.com/golang/tools.git
    git clone https://github.com/golang/lint.git
3.Then you can install the go plugin in vscode as prompted (odds are it still won't work)
 So you need to execute the following command in the terminal of %GOPATH%/src directory
    go get -u -v github.com/mdempsky/gocode
    go get -u -v github.com/uudashr/gopkgs/cmd/gopkgs
    go get -u -v github.com/ramya-rao-a/go-outline
    go get -u -v github.com/acroca/go-symbols
    go get -u -v golang.org/x/tools/cmd/guru
    go get -u -v golang.org/x/tools/cmd/gorename
    go get -u -v github.com/go-delve/delve/cmd/dlv
    go get -u -v github.com/stamblerre/gocode
    go get -u -v github.com/rogpeppe/godef
    go get -u -v github.com/sqs/goreturns
    go get -u -v golang.org/x/lint/golint
    go get -u -v github.com/cweill/gotests/...
    go get -u -v github.com/fatih/gomodifytags
    go get -u -v github.com/josharian/impl
    go get -u -v github.com/davidrjenni/reftools/cmd/fillstruct
    go get -u -v github.com/haya14busa/goplay/cmd/goplay
    go get -u -v github.com/godoctor/godoctor
4.There may still be errors after performing the above steps, just follow the instructions prompted by vscode to fix them.


Note: There may be problems with the following:
    Error: go: cannot find main module; see 'go help modules'
    Solution go env -w GO111MODULE=off
GO111MODULE There are three values: off, on and auto (default).

GO111MODULE=off, no module support, find dependencies from $GOPATH and vendor folders.
GO111MODULE=on, with module support, go ignores the $GOPATH and vendor folders and only downloads dependencies based on go.mod.
GO111MODULE=auto, the go command line will decide whether to enable the modules feature based on the current directory.
There are two scenarios.
	module support is enabled when the project is outside of $GOPATH/src and the project root directory has a go.mod file.
	the project is inside $GOPATH/src and module support is not provided even if the go.mod file exists.

JavaScript removes the number specified in the array

code

Method 1: return a new array
/ / remove all elements in array arr whose values are equal to item. Do not modify the array arr directly, and the result will return a new array
instead**

function clearArrItem(arr,item){
	var arrs=[];
	for(var i = 0;i<arr.length;i++){
		if(arr[i] !== item){
			arrs.push(arr[i])
		}
	}
	return arrs
}
var arrs = [1,2,5,4,2,1,5,2,1,2,5,42,1,4,11,1,1,1,1,11];
console.log(clearArrItem(arrs,1));

**

Method 2: operate in the original array
/ / remove all the elements in the array arr whose values are equal to the item, directly operate on the given arr array, and return the result
to the user**

function clearArrItem2(arr,item){
	var index;
	for(var i = 0;i<arr.length;i++){
		if(arr[i] === item){
			if(arr[i+1] === item){
				arr.splice(i,1);
				i--;
				continue;
			}
			arr.splice(i,1);
		}
	}
	return arr;
}
var arrs = [1,5,6,3,5,4,1,1,1,1,1,1,1,5,8,4,5,1,5,1,5,1,1];
console.log(clearArrItem2(arrs,1));

**