Author Archives: Robins

TS eslint angle bracket Error: Parsing error: Identifier expected

Today, I configured the next eslint. There was an error report, which made me neither know how to modify nor how to turn off the relevant inspection of eslint. I was very distressed. I pondered for a while and recorded it. After all, I just used a for loop. It’s not fun not to use it

Error reporting location

Error reporting reason

Angle bracket type assertions are used earlier, which is probably because eslint is not suitable for ts

Error modification

Replace angle bracket type assertion with as type assertion

No more error reporting

[Solved] c# yolo cuDNN Error: CUDNN_STATUS_BAD_PARAM

The following problems occurred when loading the weight file:
cudnn status error in: File: D: \Darknet master\SRC\revolutionary_layer.c : cudnn_convolutional_setup() : line: 253 : build time: Dec 31 2021 – 14:37:05

cuDNN Error: CUDNN_STATUS_BAD_PARAM

The online search said that the data type was wrong and there was not enough video memory, but they didn’t solve my problem

After tossing for a day, it was found that the parameters read when loading the cfg file did not match those in the file, as shown in the following figure:

By comparing the yolowrapper in Darknet with that in my program, it turns out that the two versions are different. There is one more initializeyolo parameter in the initialization function Use the yolowrapper in the program to solve the Darknet problem.

Solve the problem of link: fatal error LNK1104: unable to open the file “d3dx9. Lib”

Solve the problem of link: fatal error LNK1104: unable to open the file “d3dx9. Lib”

First install the microsoft directx SDK (June 2010). The installation package name is DXSDK_ Jun10. Exe,
microsoft directx SDK 2010 version download http://www.microsoft.com/en-us/download/details.aspx?id=6812
Version:
Date Published:
9.29.1962
6/7/2010
File name:
File size:
DXSDK_ Jun10. exe
571.7 MB

 

If there is an error before the installation is completed, uninstall 86 and x64 redistributions of VC + + 2010 in the computer (10.0.xxx, XXX higher than 30319 is probably this number. As long as it is higher than this version, the installed 86 and x64 redistributions of VC + + 2010 must be deleted),

Reinstall the microsoft directx SDK (June 2010) again and the installation will be successful

Then select release from the drop-down box next to the compile button, and click the green compile button on the right side of Win32. If an error is reported at this time, it says that d3d9x cannot be found Lib
select the project name in the left column, right-click to open the lowest project – properties – configuration properties – VC + + directory, or directly press Alt + F7 to open the VC + + directory setting window
add these two paths to the beginning of the containing directory and Library Directory respectively, and be sure to separate them with semicolons and subsequent paths,

Include directory: D: \ program files (x86) \ microsoft directx SDK (June 2010) \ include
Library Directory: D: \ program files (x86) \ microsoft directx SDK (June 2010) \ lib \ x86;

Because:
d3dx9 Lib and d3d9 Lib is located in D: \ program files (x86) \ microsoft directx SDK (June 2010) \ lib \ x86 directory
d3d9 H (header file of Direct3D) is located in D: \ program files (x86) \ microsoft directx SDK (June 2010) \ include directory

Note that the premise of this setting is that the microsoft directx SDK (June 2010) must be installed in D: \ program files (x86) \ microsoft directx SDK (June 2010)

Select debug from the drop-down box next to the compile button and click the compile green button on the right side of Win32. Generally, no error will be reported because these two paths already exist in the include directory and Library Directory of the project – properties – configuration properties – VC + + directory

[Solved] gitee Push Error: error: failed to push some refs to

Today, I created a project in gitee to push the local code. I found an error. The error is as follows:

error: failed to push some refs to 'https://gitee.com/xxxx'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

Analysis reason:

Because readme The MD file is not in the local code directory

Solution:

Execute the following command to set readme MD pull to local

git pull --rebase origin master

Then execute the following command to push the file

git push origin master

[Solved] ERROR: HTTPSConnectionPool(host=’center.conan.io’, port=443):

Recently, I used Conan center to download the third-party library. It was good before, but suddenly it didn’t work

update the URL corresponding to Conan center. The latest is:

conan-center: https://center.conan.io [Verify SSL:True]

Previously, the default value was

https://conan.bintray.com/

Update Conan version

pip install --upgrade conan

the first run will automatically delete things related to the certificate. If not, go to the relevant directory and delete them manually. So far, the problem has been solved</ h6>

conan --version

WARN: Migration: Updating settings.yml
WARN: ****************************************
WARN: settings.yml is locally modified, can't be updated
WARN: The new settings.yml has been stored in: /home/xuke/.conan/settings.yml.new
WARN: ****************************************
Removing the 'cacert.pem' file...
Search Successfully

conan search boost -r=conan-center

Existing package recipes:

boost/1.69.0
boost/1.70.0
boost/1.71.0
boost/1.72.0
boost/1.73.0
boost/1.74.0
boost/1.75.0
boost/1.76.0
boost/1.77.0
boost/1.78.0

[Solved] MYSQL Remote Connect Error: ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES)

1. Enter the container

Docker exec – it [MySQL container name]/bin/Bash

2. Log in to MySQL

mysql -uroot -p

Password: [enter your password] or enter directly

3. Execute the following command:

use MySQL;

4. Authorization
grant all privileges on ** to ‘root’@’%’ identified by ‘yourPassword’;

5. Refresh

Flush privileges;

[Solved] Vue Axios error: TypeError: Cannot set property ‘tableData‘ of undefined

Problem background

Recently, I just started Vue, and there is a typical scene, which is also a simple pit. After requesting data through Axios, you need to give the data to tabledata in data, and the table component will automatically render according to the two-way binding of tabledata.

But when I assign a value, typeerror: cannot set property 'tabledata' of undefined. What the hell is going on.

analysis

The code looks like there’s nothing wrong with it…

export default {
  data() {
    return {
      total: 0, //Total number of default data
      searchParam:{
        limit: 10, //number of data items per page
        page: 1, //default start page
        certNumber: "",
        certLevel: "",
        certCompanyName: "",
      },
      tableData: []
    };
  },
onSearch: function(){
      axios.post('/api/certCompany/list2',JSON.stringify(this.searchParam))
      .then(function (response) {
        console.log(response);
        this.tableData=response.data.data;
        this.total=response.data.count;
      })
      .catch(function (error) {
        console.log(error);
      });
    }
};

However, the problem is this.tabledata because the functionis used, in the function, this points to the function itself, which is no longer the default this outside.

Solution:

Use a  that point  Outsite this , then call  that.tableData , easy to get.

onSearch: function(){
      const that=this; //Use that to solve the function internal this pointing problem
      axios.post('/api/certCompany/list2',JSON.stringify(this.searchParam))
      .then(function (response) {
        console.log(response);
        that.tableData=response.data.data;
        that.total=response.data.count;
      })
      .catch(function (error) {
        console.log(error);
      });
    }

[Solved] ConnectionPoolTimeoutException: Timeout waiting for connection from pool

background

An error was found in the monitoring system today. The error is as follows

org.apache.http.conn.ConnectionPoolTimeoutException: Timeout waiting for connection from pool
	at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.leaseConnection(PoolingHttpClientConnectionManager.java:316)
	at org.apache.http.impl.conn.PoolingHttpClientConnectionManager$1.get(PoolingHttpClientConnectionManager.java:282)
	at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:190)
	at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186)
	at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
	at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
	at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:108)
	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56)

action

At first, it was suspected that the connection pool setting was too small, so check the code’s setting of the connection pool size

It is found that the connection pool setting is large enough that our business can not use so many connections at all, so it is suspected that the connections have not been released after running out. View the number of connections on the server

netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'

Check the code and find that the connection is not released, as shown below

HttpResponse response = httpclient.execute(httpPost);

List<String> lines = IOUtils.readLines(response.getEntity().getContent(), "utf-8");
StringBuffer res = new StringBuffer();
for (String line : lines) {
   res.append(line);
}
       
ChatMessage chatMessage = getChatMessage(sendChatMessageDTO, replyMessageInfo, sendMessageesResultBO);
return chatMessage;

Solution:

Once the problem is found, we can return the connection to the connection pool.

HttpPost httpPost = new HttpPost(connectUrl);
InputStream inputStream = null;
try {
            
    HttpResponse response = httpclient.execute(httpPost);
    inputStream = response.getEntity().getContent();
    List<String> lines = IOUtils.readLines(inputStream, "utf-8");
} catch (Exception e){
    logger.error("connect error", e);
    if(httpPost != null){
    	httpPost.abort();
     }
} finally {
    if(inputStream != null){
        try {
            inputStream.close();
         } catch (Exception e){
            logger.error("", e);
         }
    }
}

Thinking (based on version 4.5)

What is the principle of httpclient connection pooling?

There are three main attributes in the connection pool, which are used for connections in different states

//Store the connection in use
private final Set<E> leased;
// holds the available connections
private final LinkedList<E> available;
// holds pending connections 
private final LinkedList<PoolEntryFuture<E>> pending;

What is the default connection pool size?

We check the official code (version 4.5) and find that the default total size is 20, and the default maximum size of each route is 2

 public PoolingHttpClientConnectionManager(
        final HttpClientConnectionOperator httpClientConnectionOperator,
        final HttpConnectionFactory<HttpRoute, ManagedHttpClientConnection> connFactory,
        final long timeToLive, final TimeUnit timeUnit) {
        super();
        this.configData = new ConfigData();
        this.pool = new CPool(new InternalConnectionFactory(
                this.configData, connFactory), 2, 20, timeToLive, timeUnit);
        this.pool.setValidateAfterInactivity(2000);
        this.connectionOperator = Args.notNull(httpClientConnectionOperator, "HttpClientConnectionOperator");
        this.isShutDown = new AtomicBoolean(false);
    }

How does close work?

There are two kinds of close

CloseableHttpResponse.Close(): this method is to put the exhausted connections back to the available collection of the connection pool, rather than actually closing the connections.Release() is called internally

httpClient.Close(): This is to close the connection pool and release all resources in the pool, that is, to really close the connection

[Solved] MYSQL Export Sheet Error: –secure-file-priv option so it cannot execute this statement

When MySQL exports a file, the following is displayed:

mysql> select * from users into outfile '/root/users.txt';
ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement

The reason is not clear. It is said on the Internet that operations like into are only allowed to users with file permission. In short, it is about permissions. Here we need to use a table that stores the system parameters of MySQL:

mysql> show variables like 'secure_file_priv';
+------------------+-----------------------+
| Variable_name    | Value                 |
+------------------+-----------------------+
| secure_file_priv | /var/lib/mysql-files/ |
+------------------+-----------------------+
1 row in set (0.01 sec)

Here, my secure_file_priv field has a value and is fixed in /var/lib/mysql-files/, which means that Mysql export data can only be exported to this directory, and export is not authorized in other places:

mysql> select * from users into outfile '/var/lib/mysql-files/users.txt';
Query OK, 6 rows affected (0.00 sec)

The value of the secure_file_priv field here can be set (I don’t know how to change it, Baidu myself)

  • If it is empty, the variable is invalid and can be exported without restriction. This is not a safe setting
  • If set to the name of a directory, the server will restrict import and export operations to only process files in that directory. The directory must exist; the server will not create it.
  • If set to NULL, the server will disable import and export operations.

Modify system variables

mysql> set global secure_file_priv = ''; 
ERROR 1238 (HY000): Variable 'secure_file_priv' is a read only variable //
Directly modify the display read only, so you can only start from the configuration file

Open another window and directly modify the configuration file my.cnf. I have omitted a lot of comments here. When making changes, please note that you cannot directly add secure_file_priv=” to the last line. This is incorrect, because the last line is in the [mysql] column. Variables need to be added under [mysqld]

[root@VM-0-7-centos mysql-files]# vim /etc/my.cnf
……
[mysqld]
……

datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
……
secure_file_priv = ''   //correct position added here, [ mysqld ] in which
[mysqld_safe] 
…… 
[mysql]
……

Restart MySQL service after adding

[root@VM-0-7-centos mysql-files]# service mysqld restart
Redirecting to /bin/systemctl restart mysqld.service

After restarting, log in to MySQL again and find that it has been changed:

mysql> show variables like 'secure_file_priv';
+------------------+-------+
| Variable_name    | Value |
+------------------+-------+
| secure_file_priv |       |
+------------------+-------+
1 row in set (0.00 sec)