[Solved] RedisTemplate increment Error: io.lettuce.core.RedisCommandExecutionException: ERR value is not an intege

Redistemplate uses increment to report an error: io.lettuce.core.RedisCommandExecutionException: ERR value is not an intege

Problem analysis

We can learn from spring’s documents that spring has two rare serialization strategies for redis. One is the JDKSerializationRedisSerialzer serialization of RedisTemplate application. The serialized value contains object information, version number, class information, etc. after this serialization, a string cannot be self incremented.

The other is the StringRedisSerializer adopted by the StringRedisTemplate. This strategy converts the string value into a byte array, so the values saved in redis can be operated.

Solution:

Replace RedisTemplate with String RedisTemplate

[Solved] Log Error: NAN OR INFINITY

Log Error: NAN OR INFINITY

An error is reported in the log today: infinity or Nan. After checking the code, it is found that float performs the division operation /0.

In integer int operations, the divisor cannot be 0. Otherwise, an exception will be reported directly. But what is it like in floating-point arithmetic?Let’s have a look.

1.infinity: infinite

Observe the results of the following outputs:

        double POSITIVE_INFINITY = 1.0/0.0;
		double NEGATIVE_INFINITY = -1.0/0.0;
		System.out.println(POSITIVE_INFINITY);
		System.out.println(NEGATIVE_INFINITY);
		float POSITIVE_INFINITY2 = 1.0f/0.0f;
		float NEGATIVE_INFINITY2 = -1.0f/0.0f;
		System.out.println(POSITIVE_INFINITY2);
		System.out.println(NEGATIVE_INFINITY2);

Output results:

Infinity
-infinity
infinity
-infinity

Take another look at the following examples and output results:

        //Infinite multiplication by 0 results in NAN
		System.out.println(Float.POSITIVE_INFINITY * 0); // output: NAN
		System.out.println(Float.NEGATIVE_INFINITY * 0); // output: NAN

		//Dividing infinity by 0, the result remains the same, or infinity
		System.out.println((Float.POSITIVE_INFINITY/0) == Float.POSITIVE_INFINITY); // output: true
		System.out.println((Float.NEGATIVE_INFINITY/0) == Float.NEGATIVE_INFINITY); // output: true
		
		//Infinite does all operations except multiplying by zero, and the result is still infinite
		System.out.println(Float.POSITIVE_INFINITY == (Float.POSITIVE_INFINITY + 10000)); // output: true
		System.out.println(Float.POSITIVE_INFINITY == (Float.POSITIVE_INFINITY - 10000)); // output: true
		System.out.println(Float.POSITIVE_INFINITY == (Float.POSITIVE_INFINITY * 10000)); // output: true
		System.out.println(Float.POSITIVE_INFINITY == (Float.POSITIVE_INFINITY/10000)); // output: true

To determine whether a floating-point number is infinite, you can use the isinfinite method:

System.out.println(Double.isInfinite(Float.POSITIVE_INFINITY)); // output: true

2.NAN

System.out.println(0.0d/0.0); //NaN

Nan means non numeric. It is not equal to any value, or even to itself. To judge whether a number is a Nan, use the IsNaN method:

System.out.println(Float.NaN == Float.NaN); // output: false
System.out.println(Double.isNaN(Float.NaN)); // output: true

https://blog.csdn.net/susu1083018911/article/details/124993209

[Solved] Laravel admin Error: Symfony\Component\Debug\Exception\FatalThrowableError : Class ‘Doctrine\DBAL\Driver\PDOMySql\Driver’ not found

laravel-admin error

Error reporting information

An error occurs when running PHP artisan admin:make:

symfony\component\debug\exception\fatalthrowableerror: class'doc\dbal\driver\pdomysql\driver'not found

Operating environment

Windows 10
php:7.3.4
mysql:5.7.26
laravel:5.8
laravel admin:1.8.17

Cause

Doctrine/dbal not found

The reason why I read other people online may be that doctrine/dbal is 3* Caused by the version of.

Solutions

Run at terminal:

composer require doctrine/dbal:2.12.1

Or modify the composer.json as the following:

    "require": {
    	*
    	*
        "doctrine/dbal": "^2.12.1",
        *
        *
    },

Then run

composer update

How to Solve Error: Error parsing mapper XML

[Solved] Error parsing Mapper XML

Error parsing mapper xml
this error message is essentially a mapper XML error
failed resolve xxx XML, etc.
here we analyze some problems that will not become popular when writing, and that will cause errors when starting

1. ID conflict

The conflicts here are
resultmap

<resultMap type="com.newtouch.business.module.dto.T01agentComDTO" id="t01agentComMap">

<resultMap type="com.cpi.newtouch.business.module.dto.T01comDTO" id="t01agentComMap">

Specific SQL

<select id="findBy" >
<update id="findBy">

As long as two or more IDs are the same, an error will be reported. This usually happens because you don’t pay attention to copy and paste. You need to be careful!

2. Return type error

<resultMap type="com.newtouch.business.module.dto.T01agentComDTO" id="t01agentComMap">
<select id="findBy" resultType="t01agentComMap">

Like here, I returned the resultmap, but wrote the resulttype

Similarly, for example, if I return a string type, but I write a resultmap, I will also report an error

3. Not writing the full class name

<resultMap type="com.newtouch.business.module.dto.T01agentComDTO" id="t01agentComMap">

The resultmap, if I write it like this

<resultMap type="T01agentComDTO" id="t01agentComMap">

An error will be reported. Of course, if relevant settings are configured

[Solved] Golang Error: main.go:5:2: package go_code/chapter10/factory/model is not in GOROOT

golang Error: is not in GOROOT

The following errors are reported during operation

PS C:\goproject\src\go_code\chapter10\factory\main> go run main.go
main.go:5:2: package go_code/chapter10/factory/model is not in GOROOT (C:\go\src\go_code\chapter10\factory\model)

The process is as follows

PS C:\goproject\src\go_code\chapter10\factory\main> go run main.go
main.go:5:2: package go_code/chapter10/factory/model is not in GOROOT (C:\go\src\go_code\chapter10\factory\model)

PS C:\goproject\src\go_code\chapter10\factory\main>  go env
set GO111MODULE=

PS C:\goproject\src\go_code\chapter10\factory\main> go env -w GO111MODULE=off
PS C:\goproject\src\go_code\chapter10\factory\main> go run main.go
{tom 78.9}

[Solved] SpringCloud Compile Error: java: JPS incremental annotation processing is disabled. Compilation results on partial recompilation may be inaccurate.

Error:

SpringCloud Compile Error: java: JPS incremental annotation processing is disabled. Compilation results on partial recompilation may be inaccurate. Use build process “jps.track.ap.dependencies” VM flag to enable/disable incremental annotation processing environment.

 

Solution:
1.Add: -Djps.track.ap.dependencies=false

2. Clear the caches

[Solved] Python3.9 Pycropto RSA Error: TypeError: can’t concat str to bytes

python3.9 pycropto RSA Error: TypeError: can't concat str to bytes

1. Error reporting

The recent project uses the pycrypto package under python3.9. The following errors occur when using the RSA module, mainly because bytes and STR in python3 cannot be spliced

File "/usr/local/python-3.9.4/lib/python3.9/site-packages/Crypto/PublicKey/RSA.py", line 352, in exportKey
    keystring = ''.join([ struct.pack(">I",len(kp))+kp for kp in keyparts]) 
  File "/usr/local/python-3.9.4/lib/python3.9/site-packages/Crypto/PublicKey/RSA.py", line 352, in <listcomp>
    keystring = ''.join([ struct.pack(">I",len(kp))+kp for kp in keyparts]) 
TypeError: can't concat str to bytes

2. Modification

We can check the error file /python3.9/site-packages/crypto/publickey/rsa Py the main idea is to change the output variable into bytes for splicing. The original part of the file content is modified, line:346:

if format=='OpenSSH':
	eb = long_to_bytes(self.e)
	nb = long_to_bytes(self.n)
	if bord(eb[0]) & 0x80: eb=bchr(0x00)+eb
	if bord(nb[0]) & 0x80: nb=bchr(0x00)+nb
	keyparts = [ 'ssh-rsa', eb, nb ]
	keystring = ''.join([ struct.pack(">I",len(kp))+kp for kp in keyparts]) 
	return 'ssh-rsa '+binascii.b2a_base64(keystring)[:-1]

Modified to:

if format=='OpenSSH':
	eb = long_to_bytes(self.e)
	nb = long_to_bytes(self.n)
	if bord(eb[0]) & 0x80: eb=bchr(0x00)+eb
	if bord(nb[0]) & 0x80: nb=bchr(0x00)+nb
	keyparts = [ 'ssh-rsa', eb, nb ]
	new_list = []
	for kp in keyparts:
	    temp  = struct.pack(">I", len(kp))
	    if isinstance(kp, str):
	        kp = bytes(kp,encoding='utf-8')
	    temp += kp
	    new_list.append(temp)
	keystring = b''.join(new_list)
	return b'ssh-rsa '+binascii.b2a_base64(keystring)[:-1]

[Solved] Springboot error: Could Not Found xxmapper

springboot error: could not found xxmapper

Error Messages:

Unsatisfied dependency expressed through field ‘baseMapper’; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type ‘com.xxxx.server.mapper.AdminMapper’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

 

 

Solution: Add mapper package scan to springboot startup class

@MapperScan("com.xxxx.server.mapper")

How to Solve Cython-bbox pip install Error

Cython-bbox pip install error

Installation steps

    1. 1. Download Cython_bbox source code, click Download files to download.
    1. 2. Unzip the file.
    1. 3. Open setup.py, find line 31, replace extra_compile_args=[‘-Wno-cpp’] with extra_compile_args={‘gcc’: [‘/Qstd=c99’]}.
    1. 4. Save the changes and return to the cython_bbox-0.1.3 file directory. After calling cmd and jumping to this directory, use the command line
python setup.py build_ext install

The following command is displayed to indicate success:

you can also package the file back to the original compressed file and use the offline PIP installation.

https://blog.csdn.net/qq_28949847/article/details/124974088

[Solved] JAVA Operate Database Error: You have an error in your SQL syntax; Dao layer SQL statement error

JAVA Operate Database Error: You have an error in your SQL syntax; Dao layer SQL statement error

Specific error reports are as follows:

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?,?,?,?,?)' at line 1
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
	at com.mysql.jdbc.Util.getInstance(Util.java:408)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:944)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3978)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3914)
	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2530)
	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2683)
	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2491)
	at com.mysql.jdbc.StatementImpl.executeUpdateInternal(StatementImpl.java:1552)
	at com.mysql.jdbc.StatementImpl.executeLargeUpdate(StatementImpl.java:2607)
	at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1480)
	at cn.edu.wut.jwms.dao.TeacherDao.insertTeacher(TeacherDao.java:39)
	at cn.edu.wut.jwms.testDao.testTeacherInsert(testDao.java:14)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
	at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)
	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)

Error reporting location code:

public boolean insertTeacher(Teacher teacher)  {
        boolean b = false;

        try {
            //get the connection
            Connection connection = JDBCUtil.getConn();

            String sql = "INSERT INTO tb_teacher(teacher_num,teacher_pwd,teacher_name,teacher_tel,teacher_col_id) VALUES(?,?,?,?,?)";
            //compile
            PreparedStatement ps = connection.prepareStatement(sql);

            //Assigning values to placeholders
            ps.setString(1,teacher.getTeacherNum());
            ps.setString(2,teacher.getTeacherPwd());
            ps.setString(3,teacher.getTeacherName());
            ps.setString(4,teacher.getTeacherTel());
            ps.setInt(5,teacher.getTeacherColId());

            int i = ps.executeUpdate(sql);//Number of rows affected by the update operation on the data

            b = i>0?true:false;

            //close the connection
            connection.close();

        } catch (Exception e) {
            e.printStackTrace();
        }
        return b;
    }

Process: check the SQL statements for many times and no errors are found. The test data is also checked for many times to confirm that the rules formulated during table creation are met;

Result.

int i = ps.executeUpdate(sql); because in this code, pass in the sql statement again to report an error, modified to
int i = ps.executeUpdate();; after the error is resolved.
Reason: The sql statement has already been passed in when the compile operation is executed, so it does not need to be passed in again when it is executed.

[Solved] matlab Error: `Using exist to check

matlab Error: `Using exist to check

matlab Error: Using exist to check for a variable in the transparent workspace is not supported. To check for a function, folder, file, or class, specify the appropriate second input argument to exist: 'builtin', 'class', 'dir' or 'file'.

 

Solution:
Modify exist(savepath) to exist(savepath, ‘file’) (if it is to detect the existence of a file fill in file, otherwise replace file with one of ‘builtin’, ‘class’, ‘dir’ or ‘file’)

How to Solve OpenCV CVUI Error: LINK2019

OpenCV CVUI Error: LINK2019

1、Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol “void __cdecl cvui::init(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,int,bool)” (?init@cvui@@YAXAEBV?b a s i c s t r i n g @ D U ? basic_string@DU?basic 
s
​
 tring@DU?char_traits@D@std@@V?$allocator@D@2@@std@@H_N@Z) referenced in function main

2、Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol “bool __cdecl cvui::button(class cv::Mat &,int,int,class std::basic_string<char,struct std::char_traits,class std::allocator > const &)” (?button@cvui@@YA_NAEAVMat@cv@@HHAEBV?b a s i c s t r i n g @ D U ? basic_string@DU?basic 
s
​
 tring@DU?char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function main DotMatrix

3、Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol “void __cdecl cvui::printf(class cv::Mat &,int,int,double,unsigned int,char const *,…)” (?printf@cvui@@YAXAEAVMat@cv@@HHNIPEBDZZ) referenced in function main

4、Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol “void __cdecl cvui::update(class std::basic_string<char,struct std::char_traits,class std::allocator > const &)” (?update@cvui@@YAXAEBV?b a s i c s t r i n g @ D U ? basic_string@DU?basic 
s
​
 tring@DU?char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function main DotMatrix

 

Solution:

Add the codes below before the .cpp

#define CVUI_IMPLEMENTATION
#include "cvui.h"