Author Archives: Robins

[Solved] STM32 Use DAP to Download Error: Error: Flash Download failed – “Cortex-M3“

When using the DAP of wildfire, there is a problem in the title, and there is no Autodetect option in Magic Wand/Debug/Reset.

The Enable option in the pack needs to be removed.

At this time, the Autodetect option appears. Select this option, and the title problem will not occur again.

[Solved] RuntimeError: a view of a leaf Variable that requires grad is being used in an in-place operation

source code

	def anim(i):
		# update SMBLD
		cur_beta_idx, cur_step = i // num_steps, i % num_steps
		val = shape_range[cur_step]
		mesh.multi_betas[0, cur_beta_idx] = val  # Update betas
		fig.suptitle(f"{name.title()}\nS{cur_beta_idx} : {val:+.2f}", fontsize=50)  # update text

		return dict(mesh=mesh.get_meshes(), equalize=False)


Modified code

Add with torch.no_grad(): will be OK!

	def anim(i):
		# update SMBLD
		cur_beta_idx, cur_step = i // num_steps, i % num_steps
		val = shape_range[cur_step]
		#print("\ncur_beta_idx:",cur_beta_idx,mesh.multi_betas[0, cur_beta_idx])
		with torch.no_grad():###添加
			mesh.multi_betas[0, cur_beta_idx] = val  # Update betas
		fig.suptitle(f"{name.title()}\nS{cur_beta_idx} : {val:+.2f}", fontsize=50)  # update text

		return dict(mesh=mesh.get_meshes(), equalize=False)

[Solved] Jenkins Publish to rancher Error: ERROR: Build step failed with exception java.lang.ClassCastException: class com.

error message

ERROR: Build step failed with exception
java.lang.ClassCastException: class com.fasterxml.jackson.databind.node.NullNode cannot be cast to class com.fasterxml.jackson.databind.node.ObjectNode (com.fasterxml.jackson.databind.node.NullNode and com.fasterxml.jackson.databind.node.ObjectNode are in unnamed module of loader jenkins.util.AntClassLoader @3e61f18f)
	at io.jenkins.plugins.rancher2.Rancher2RedeployBuilder.perform(Rancher2RedeployBuilder.java:136)
	at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123)
	at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:78)
	at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:806)
	at hudson.model.Build$BuildExecution.build(Build.java:198)
	at hudson.model.Build$BuildExecution.doRun(Build.java:163)
	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:514)
	at hudson.model.Run.execute(Run.java:1888)
	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
	at hudson.model.ResourceController.execute(ResourceController.java:99)
	at hudson.model.Executor.run(Executor.java:432)
Build step 'Redeploy Rancher2.x Workload' marked build as failure

How to Solve:

When publishing to the router, the corresponding node cannot be found, so confirm whether the router path configuration in jenkins is correct. The following two paths must be consistent:

The router configuration in jenkins

The actual router path

[Solved] error: invalid operands of types ‘const char [6]‘ and ‘const char [6]‘ to binary ‘operator+‘

 

preface

When using strings in C++, we habitually use + to connect two strings enclosed in "". The error is reported: error: invalid operators of types' const char [6] 'and' const char [6] 'to binary' operator+',


1. Scenarios

	//std::string str = "hello" + "world"; // error: invalid operands of types 'const char [6]' and 'const char [6]' to binary 'operator+'
	//std::string str = std::string("hello") + " world"; // correct
	//std::string str = "hello" + std::string("world"); //correct
	std::string str = "hello"" world"; //correct

    cout << "str=" << str << endl;

When using the+operator to connect two strings wrapped with "", an error occurs. The reason is that in C++, the strings enclosed by "" are regarded as const char* types, rather than string types.

2. Solution

Refer to the explanation on stackoverflow. For details, please read error: invalid operators of types’ const char * ‘and’ const char * ‘to binary’ operator+’

1. Explicitly declare one of them as std::string type (recommended)

std::string str = std::string("hello") + " world";

2. Remove the+and let the compiler splice strings (not recommended)

std::string str = "hello"" world";

Most compilers automatically splice strings enclosed by "", but it is not guaranteed that all compilers are normal. It is recommended to display strings declared as string types and then perform the+operation.


3. Validation

	std::string str1 = std::string("hello") + " world" + "!"; // correct
    std::string str2 = "hello" + std::string(" world") + "!"; //correct
    std::string str3 = "hello"" world" "!"; //correct

    cout << "str1=" << str1 << endl;
    cout << "str2=" << str2 << endl;
    cout << "str3=" << str3 << endl;

[Solved] Unity Error: Assertion failed on expression: ‘m_ErrorCode == MDB_MAP_RESIZED

Unity报错Assertion failed on expression: ‘m_ErrorCode == MDB_MAP_RESIZED

Assertion failed on expression: ‘m_ ErrorCode == MDB_ MAP_ RESIZED || ! HasAbortingErrors()’

Asset database transaction committed twice!

Assertion failed on expression: ‘errors == MDB_ SUCCESS || errors == MDB_ NOTFOUND’

The three errors are reported all the time without code prompt; The reason is that the Unity license has expired;

Solution: Restart Unity, open Unity Hub and reactivate the license; Re-open the project

[Solved] Vivado System Generator for DSP: “Error evaluating ‘OpenFcn‘ callback of Xilinx Block“

When using Vivado System Generator for DSP, I encountered the error “Error evaluating ‘OpenFcn’ callback of Xilinx Block”, the solution is as follows.

1 check whether the installed System Generator and Matlab version match, I use Matlab2019b + Vivado19.2 version, the specific installation method of the expansion package see Baidu.

2 check whether it is opened from System Generator, the software will automatically open Matlab, no additional separate open Matlab software, Matlab will open the following content.

3 If the above error still occurs, open System Generator 20xx.x MATLAB Configurator software,

The following interface pops up. After checking MATLAB, remove, close and reapply;

4 Input simulink in MATLAB,

The following interface appears, and select Blank Model;

5 Click Library Browser,

Find xilinx blockset, and the corresponding option appears,

Add a module, the parameter configuration dialog box appears, and the problem is solved!

[Solved] AttributeError: module ‘keras.preprocessing.image‘ has no attribute ‘load_img‘

Original code:

from keras.preprocessing import image
img         =   image.load_img(img_path,target_size=(224,224))
x           =   image.img_to_array(img)

report errors:

AttributeError: module 'keras.preprocessing.image' has no attribute 'load_img'

Reason: The keras version has been updated.

Solution:

from keras.utils import image_utils
img         =   image_utils.load_img(img_path,target_size=(224,224))
x           =   image_utils.img_to_array(img)

[Solved] MYSQL Error: ERROR! MySQL server PID file could not be found!

After restarting the MySQL database on the Linux server, various errors were found, causing the MySQL database to fail to work normally.

No matter stop, start or mysql connection, there are different error messages. The specific error messages are:

# service mysqld stop
ERROR! MySQL server PID file could not be found!

# service mysqld start
Starting MySQL.. ERROR! The server quit without updating PID file (/data/mysql/mysql.pid).

# mysql -uroot -p
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)

 

1. Error reason:

In fact, the above three different MySQL errors are all caused by one reason: the root directory disk is full.

2. Check the large files that cause the disk to be full:

1. First, use the df command to check the disk usage:
# df
You may see in the output:
/dev/mapper/VolGroup-lv_root 39841176 37788792 28552 100% /

2. Use # du – sh * to view large files. For example, the root directory is data. Use the command to view:
# cd/data
# du – sh *
You will find that the mysql folder occupies more than n gigabytes, and then view which files:
# cd mysql
# du – sh *
You will find many large files, such as
581M mysql-bin.000029
28K mysql-bin.000030
7.6G mysql-bin.000031
4.0K mysql-bin.000032

These files are MySQL Binary Log binary files, which are mainly used for data recovery and master-slave replication of master-slave servers.

Since I have no master and slave servers, I decided to delete them.

3. Solution:

1. Delete these large files:
# rm -rf mysql-bin.000031
~~~

2. After deleting them, open my.cnf under /etc/, find
log-bin=mysql-bin
binlog_format=mixed
Comment out these two lines, that is, add the “#” sign in front:
#log-bin=mysql-bin
#binlog_format=mixed

3. Restart the MySQL server, and it is OK
service mysqld restart

[Solved] 1:1 error Component name “Header“ should always be multi-word vue/multi-word

An error occurred while starting the vue project:

1:1 error Component name “Header” should always be multi-word vue/multi-word

The reason is that the nonstandard code (that is, nonstandard naming) is regarded as an error during the syntax check

Solution:

Add the configuration: lintOnSave: false in the vue.config.js file, as follows:

const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
  transpileDependencies: true,
  lintOnSave: false
})

[Solved] Error attempting to get column ‘xxxx_time‘ from result set. Cause: java.sql.SQLFeatureNotSupportedEx

Error Message:
Servlet.service() for servlet [dispatcherServlet] in context with path [/security] threw exception [Request processing failed; nested exception is org.springframework.dao.InvalidDataAccessApiUsageException: Error attempting to get column 'xxxx_ime' from result set.  Cause: java.sql.SQLFeatureNotSupportedException
; null; nested exception is java.sql.SQLFeatureNotSupportedException] with root cause

 

Error Cause
Java entity class in the field used LocalDateTime type, in the conversion time error: Error attempting to get column ‘xxxx_ime’ from result set……..

Solution:
1. upgrade druid version to 1.1.22 or above to eliminate the problem

2. Change the entity class date type to java.util.

[Solved] AttributeError: ‘WebDriver‘ object has no attribute ‘find_element_by_id‘

1. Question:

When learning the selenium part of the crawler, AttributeError appears: ‘WebDriver’ object has no attribute ‘find_ element_ by_ Id ‘problem.

2. Reasons:

Because of version iteration, find_element_by_id method is not supported in the new version of selenium.

3. Solution:

Modify button = browser.find_element_by_id(‘su’) to the following codes:

button = browser.find_element(By.ID,'su')

Add the following code at the front of the code page,

from selenium.webdriver.common.by import By