[Solved] Ubuntu18.04 Px4 (xtdrone) gazebo joint simulate error

Ubuntu 18.04 installs gazebo9.0 by default and starts indoor1 of Px4 Launch will report an error:

gzserver: symbol lookup error: /usr/lib/x86_64-linux-gnu/libsdformat.so.4: undefined symbol: _ZN8igniti

The reason is that the version of gazebo 9.0 is too low and needs to be upgraded to 9.13, 9.14 or 9.15 (I can use it when upgrading to 9.19) Upgrade method:

1 Uninstall the original gazebo
sudo apt-get remove gazebo* 
sudo apt-get remove libgazebo*
sudo apt-get remove ros-melodic-gazebo* #kinetic noetic Corresponding changes
2 Set up the computer to accept software from package.osrfoundation.org
sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list'
cat /etc/apt/sources.list.d/gazebo-stable.list
#If deb http://packages.osrfoundation.org/gazebo/ubuntu-stable xenial main appears, it means no problem
xenial should be 20.04 18.04 for bio
3 Set the key
wget https://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add -
sudo apt-get update
4 Install gazebo9.1 command.
sudo apt-get install gazebo9=9.1*
//If after executing the commands sudo apt install ros-melodic-gazebo9-* sudo apt install ros-melodic-gazebo-*, gazebo starts with an error like symbol (e.g. gzserver: symbol lookup error: /usr/lib/x86_64-linux-gnu/libsdformat.so.4: undefined symbol: _ZN8igniti). You can solve this problem by running sudo apt upgrade libignition-math2 first
5 sudo apt upgrade libignition-math2
If you type gazebo in the terminal after installation, Gazebo will open and the installation will be successful.
6 Gazebo itself is independent of ROS, so you need to install the Gazebo plugin for ROS
sudo apt install ros-melodic-gazebo9-*
sudo apt install ros-melodic-gazebo-*

[Solved] Flyway Error: Detected applied migration not resolved locally:2 and the execution script error

I preface

Flyway is used in actual development. Let’s briefly introduce flyway

1. Flyway introduction

Flyway is an open source database version management tool. It can be easily used in the command line or introduced in Java applications to manage our database version.

In a project or product, it is difficult to clarify the business at the beginning and design the database table well, so the data table will also iterate continuously in the iteration cycle. Using flyway in Java applications can be used to iterate the database table structure quickly and effectively, and ensure that the data tables are consistent when deployed to the test environment or production environment.

Please refer to flyway’s official documents for details


2. Flyway dependency package


3. Benefits of using flyway

In multi person development projects, we are used to using SVN or git to version control the code. The main purpose is to solve the problems of code conflict and version fallback in multi person development.

II Problem analysis

1. Flyway reports an error: detected applied migration not resolved locally:2

When using flyway for system management, my program reported such errors

1.1 problem analysis:

Reported error: Application migration not detected locally resolved

The reason for this problem is:

1. because the imported database contains flyway_schema_history table, so the local runtime version inconsistent error,

2. I migrated a version 2 sql, then I deleted it, and when I ran it again for the second time, I couldn’t find the V2__orange_cms file that I migrated before.

1.2 Solution
Special Note: Must be in test environment and local environment

1. mvn flyway:clean, this step will clear the existing data.

2. Ensure that the configuration file is open for flyway.

3. Start the project, complete the initialization of the flyway_schema_history table, backup the flyway_schema_history table after the startup is complete

4. Import the data, at this time the flyway_schema_history table will be updated to the version of the imported data

5. After the successful import, delete the flyway_schema_history table and replace it with the backup flyway_schema_history table

6. Start the application again, Success!


2. Script execution error

2.1 problem analysis

The general meaning of the error message: when flyway is opened in my project configuration file, it will explode: the execution of SQL is abnormal, and the “XXX” table cannot be found

This is a problem that has bothered me for a long time. I don’t know where my program and configuration are wrong

Error reason: because our flyway is based on the version of database mysql5.7, but my local database version is mysql5.5, the error “cannot find XXX table” is always reported when starting flyway configuration for database initialization

2.2 problem solving

Upgrade our database version, which is greater than or equal to our development database version. Due to the twists and turns in the road of upgrading the database, we suggest that you learn from it: more detailed


Open our flyway configuration after the database upgrade

Start the program to see if our project can start successfully


tensorflow2.3 InvalidArgumentError: jpeg::Uncompress failed [How to Solve]

When training your own dataset, you often report errors:

tensorflow2.3 InvalidArgumentError: jpeg::Uncompress failed
[[{{node decode_image/DecodeImage}}]] [Op:IteratorGetNext]


check whether the picture is damaged before training:

import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
import os

num_skipped = 0
for folder_name in ("Fruit apples", "Fruit bananas", "Fruit oranges"):
    folder_path = os.path.join(".\data\image_data", folder_name)
    for fname in os.listdir(folder_path):

        fpath = os.path.join(folder_path, fname)

            fobj = open(fpath, mode="rb")
            is_jfif = tf.compat.as_bytes("JFIF") in fobj.peek(10)

        if not is_jfif:
            num_skipped += 1
            # Delete corrupted image

print("Deleted %d images" % num_skipped)

Delete the damaged picture and train again to solve the problem
if an error is prompted again, use:

# Determine if an image is corrupt from local
def is_valid_image(path):
    Check if the file is corrupt
        bValid = True
        fileObj = open(path, 'rb')  # Open in binary form
        buf = fileObj.read()
        if not buf.startswith(b'\xff\xd8'): # whether to start with \xff\xd8
            bValid = False
        elif buf[6:10] in (b'JFIF', b'Exif'): # ASCII code of "JFIF"
            if not buf.rstrip(b'\0\r\n').endswith(b'\xff\xd9'): # whether it ends with \xff\xd9
                bValid = False
            except Exception as e:
                bValid = False
    except Exception as e:
        return False
    return bValid
 num_skipped = 0
for folder_name in ("fruit-apple", "fruit-banana", "fruit-orange"):
    #os.path.join() joins two or more pathname components
    folder_path = os.path.join(". \data\image_data", folder_name)
    # os.listdir(path) lists the subdirectories under this directory
    for fname in os.listdir(folder_path):
        fpath = os.path.join(folder_path, fname)
        flag1 = is_valid_image(fpath)
        if not flag1:
            print(fpath)#Print the path and name of the error file

Adjust the error file and train again to solve the problem.

[Solved] tsc execute error in VSCode Terminal

Premise: node and typescript are installed

Error: execute TSC xxx.ts in vscode, an error will be reported.

Solution: the execution mechanism of vscode is limited. Just change the execution mechanism

Exit vscode and run as administrator.
step 1:
execute get-ExecutionPolicy and return Restricted, which means it is restricted.
step 2:
execute  set-ExecutionPolicy RemoteSigned
step 3:
execute get-ExecutionPolicy and return RemoteSigned

Perform the above steps and execute TSC xxx.ts again is OK


[Solved] vivado Install Error: Xilinx Design Tool Display in Red

Vivado installation error: Xilinx design tool, already exists for 2019.2, specify a different program program group entry

Reason for error: vivado has been installed, and Xilinx Design Tools folder already exists

Solution: find the “Xilinx Design Tools” folder and delete it
Xilinx Design Tools folder path: C:\USER\USERNAME\AppData\Roaming\Microsoft\Windows\Start Menu\Programs


Python3.7 Capture exception error: Too broad exception clause

In Pycharm, using try…exception will result in the Too broad exception clause… warning

The reason for this error is that the exceptions caught in the past are generalized and not to specific exceptions, which lack relevance and can be solved by specifying the exact exception type.
such as:

Baseexception: the base class of all exceptions
systemexit: the interpreter requests to exit
keyboardinterrupt: the user interrupts execution (usually input ^c)

error: base class of general error
stopiteration: the iterator has no more values
generatorexit: the generator has an exception to notify the exit
standarderror: base class of all built-in standard exceptions
arithmeticerror: base class of all numerical calculation errors
floatingpointerror: floating-point calculation error
overflowerror: numerical operation exceeds the maximum limit
zerodivisionerror: division (or modulo) Zero (all data types)
assertionerror: assertion statement failure
attributeerror: the object does not have this attribute
eofilter: there is no built-in input, Reaching EOF tag
environmenterror: base class of operating system error
ioerror: input/output operation failure
oserror: operating system error
windowserror: system call failure
importerror: import module/object failure
lookuperror: base class of invalid data query
indexerror: this index is not in the sequence
keyerror: this key is not in the mapping
memoryerror: memory overflow error (not fatal for Python interpreter)
nameerror: undeclared/initialized object (no attributes)
unboundlocalerror: accessing uninitialized local variables
referenceerror: weak reference Trying to access an object that has been garbage collected
runtimeerror: general runtime error
notimplementederror: unimplemented method
syntaxerror: Python syntax error
indentationerror: indentation error
taberror: mixed use of tab and space
systemerror: general interpreter system error
typeerror: invalid operation on type
valueerror: passing in invalid parameters
Unicode error: Unicode related Error of
Unicode decodeerror: error in Unicode decoding
Unicode encodeerror: error in Unicode encoding
Unicode translateerror: error in Unicode conversion
warning: base class of warning
deprecationwarning: warning about deprecated features
futurewarning: warning about future semantic changes in construction
overflowwarning: old warning about automatic promotion to long integer (long) Warning of
pendingdeprecationwarning: warning about feature will be discarded
runtimewarning: warning about suspicious runtime behavior
syntaxwarning: warning about suspicious syntax
userwarning: warning generated by user code

If you are not sure about the possible errors, or you need to use exception and pycharm is not allowed to complain, how should you solve it
Method 1: turn off the option to detect exceptions in code detection in the compiler
Method 2: add # noinspection PyBroadException before the try statement

# noinspection PyBroadException
except Exception as e:

[Solved] docker skywalking error: no provider found for module storage

When I use docker to deploy skywalking, I always report an error: no provider found for module storage

Details are as follows:


  1. skywalking 9.1
  2. elasticsearch 7

Execute command:

docker run --name skywalking-oap --restart always -d \
-p 12800:12800 \
-p 11800:11800 \
--link es7:es7 \
-e SW_STORAGE=elasticsearch7 \

report errors:

no provider found for module storage



docker run --name skywalking-oap --restart always -d \
-p 12800:12800 \
-p 11800:11800 \
--link es7:es7 \
-e SW_STORAGE=elasticsearch7 \


docker run --name skywalking-oap --restart always -d \
-p 12800:12800 \
-p 11800:11800 \
--link es7:es7 \
-e SW_STORAGE=elasticsearch \

Modify sw_ Storage=elasticsearch7 to sw_ STORAGE=elasticsearch

Cause analysis:

  1. Before skywalking 8.8, it cannot automatically sense what the storage source is, and you need to manually specify whether it is es6 or 7;
  2. After 8.8, the version of the storage source can be automatically sensed, and there is no need to manually specify es6 or 7, just write es directly;


[Solved] Python Project Error: django.core.exceptions.ImproperlyConfigured: WSGI application ‘WebTool.wsgi.application

Problem Description: run Python project with pychart and report an error: django.core.exceptions.ImproperlyConfigured: WSGI application ‘WebTool.wsgi.application’ could not be loaded; Error importing module.

See the following for complete error reporting:

D:\Python\project\WebTool>python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
June 27, 2022 - 09:14:42
Django version 3.2.13, using settings 'WebTool.settings'
Starting development server at
Quit the server with CTRL-BREAK.
Exception in thread django-main-thread:
Traceback (most recent call last):
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\servers\basehttp.py", line 45, in get_internal_wsgi_application
    return import_string(app_path)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\site-packages\django\utils\module_loading.py", line 17, in import_string
    module = import_module(module_path)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "D:\Python\project\WebTool\WebTool\wsgi.py", line 16, in <module>
    application = get_wsgi_application()
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\wsgi.py", line 13, in get_wsgi_application
    return WSGIHandler()
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\handlers\wsgi.py", line 127, in __init__
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\handlers\base.py", line 40, in load_middleware
    middleware = import_string(middleware_path)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\site-packages\django\utils\module_loading.py", line 17, in import_string
    module = import_module(module_path)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'corsheaders'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\threading.py", line 926, in _bootstrap_inner
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\site-packages\django\utils\autoreload.py", line 64, in wrapper
    fn(*args, **kwargs)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\commands\runserver.py", line 138, in inner_run
    handler = self.get_handler(*args, **options)
  File "C:\Users\ext.azhang\AppData\Local\Programs\Python\Python37\lib\site-packages\django\contrib\staticfiles\management\commands\runserver.py", line 27, in get_handler
    handler = super().get_handler(*args, **options)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\commands\runserver.py", line 65, in get_handler
    return get_internal_wsgi_application()
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\servers\basehttp.py", line 50, in get_internal_wsgi_application
    ) from err
django.core.exceptions.ImproperlyConfigured: WSGI application 'WebTool.wsgi.application' could not be loaded; Error importing module.

Solution: WSGI module needs to be installed

pip install django-cors-headers

Reuse command python manage.py runserver to run the project after installation

After successful operation, see the figure below

[Solved] Git Error: fatal: refusing to merge unrelated histories

If you merge two different repositories for starting submission, you will find that the two repositories may not be the same in the new GIT. In order to prevent developers from uploading errors, you will give the following prompt

Git cannot pull warehouse refusing to merge unrelated histories

The problem is usually caused by the inconsistency between the local warehouse and the remote warehouse after the new warehouse is built,

Solution: add --allow-unrelated-histories after your operation command. Its original purpose is to remind you that these are two different libraries It’s time to merge.

If you are other command messages fatal: refusing to merge unrelated histories add – -allow unrelated histories in the same way, it is such a perfect solution!

H2 memory database Oracle mode page error: rg.springframework.dao.InvalidDataAccessResourceUsageException: could not prepar

I. Cause analysis:

1:When we use hibernate’s NativeQuery for paging, the underlying will use limit or rownum, and which paging method is determined by the dialect of different databases, the following will explain the h2 oracle pattern using NativeQuery for paging when the problem is solved org. InvalidDataAccessResourceUsageException: could not prepare statement; SQL [SELECT * limit ?] SQLGrammarException: could not prepare statement
We will find that h2’s oracle schema uses the limit method for paging, but using limit for paging will report an error
2:h2 paging method
Open h2’s dialect class H2Dialect, we can find that h2’s paging method is using limit

3: Oracle paging mode
open the dialect class of Oracle according to different Oracle versions

we will find that the bottom layer of Oracle is rownum for paging

II. Problem-solving
1: since we only solve the paging problem now, here we create a custom dialect class TestH2Dialect, Inherited from H2Dialect

2: because our custom dialect class inherits from H2Dialect, we don’t need to pay attention to other dialect problems. We just need to rewrite the paging method to solve the above problems. Here we have taken oracle12 as an example
Create TestH2Dialect to customize dialect

public class TestH2Dialect extends H2Dialect {

    private static final TestOracle12LimitHandler LIMIT_HANDLER = new TestOracle12LimitHandler() ;

    public LimitHandler getLimitHandler() {
        return LIMIT_HANDLER;


Create Oracle paging processing class

public class TestOracle12LimitHandler extends AbstractLimitHandler {
    public boolean bindLimitParametersInReverseOrder;
    public boolean useMaxForLimit;
    public static final TestOracle12LimitHandler INSTANCE = new TestOracle12LimitHandler();

    TestOracle12LimitHandler() {

    public String processSql(String sql, RowSelection selection) {
        boolean hasFirstRow = LimitHelper.hasFirstRow(selection);
        boolean hasMaxRows = LimitHelper.hasMaxRows(selection);
        return !hasMaxRows ?sql : this.processSql(sql, this.getForUpdateIndex(sql), hasFirstRow);
    public String processSql(String sql, QueryParameters queryParameters) {
        RowSelection selection = queryParameters.getRowSelection();
        boolean hasFirstRow = LimitHelper.hasFirstRow(selection);
        boolean hasMaxRows = LimitHelper.hasMaxRows(selection);
        if (!hasMaxRows) {
            return sql;
        } else {
            sql = sql.trim();
            LockOptions lockOptions = queryParameters.getLockOptions();
            if (lockOptions != null) {
                LockMode lockMode = lockOptions.getLockMode();
                switch(lockMode) {
                    case UPGRADE:
                    case PESSIMISTIC_READ:
                    case PESSIMISTIC_WRITE:
                    case UPGRADE_NOWAIT:
                    case FORCE:
                    case PESSIMISTIC_FORCE_INCREMENT:
                    case UPGRADE_SKIPLOCKED:
                        return this.processSql(sql, selection);
                        return this.processSqlOffsetFetch(sql, hasFirstRow);
            } else {
                return this.processSqlOffsetFetch(sql, hasFirstRow);

    private String processSqlOffsetFetch(String sql, boolean hasFirstRow) {
        int forUpdateLastIndex = this.getForUpdateIndex(sql);
        if (forUpdateLastIndex > -1) {
            return this.processSql(sql, forUpdateLastIndex, hasFirstRow);
        } else {
            this.bindLimitParametersInReverseOrder = false;
            this.useMaxForLimit = false;
            String offsetFetchString;
            if (hasFirstRow) {
                offsetFetchString = " offset ?rows fetch next ?rows only";
            } else {
                offsetFetchString = " fetch first ?rows only";

            int offsetFetchLength = sql.length() + offsetFetchString.length();
            return (new StringBuilder(offsetFetchLength)).append(sql).append(offsetFetchString).toString();

    private String processSql(String sql, int forUpdateIndex, boolean hasFirstRow) {
        this.bindLimitParametersInReverseOrder = true;
        this.useMaxForLimit = true;
        String forUpdateClause = null;
        boolean isForUpdate = false;
        if (forUpdateIndex > -1) {
            forUpdateClause = sql.substring(forUpdateIndex);
            sql = sql.substring(0, forUpdateIndex - 1);
            isForUpdate = true;

        int forUpdateClauseLength;
        if (forUpdateClause == null) {
            forUpdateClauseLength = 0;
        } else {
            forUpdateClauseLength = forUpdateClause.length() + 1;

        StringBuilder pagingSelect;
        if (hasFirstRow) {
            pagingSelect = new StringBuilder(sql.length() + forUpdateClauseLength + 98);
            pagingSelect.append("select * from ( select row_.*, rownum rownum_ from ( ");
            pagingSelect.append(" ) row_ where rownum <= ?) where rownum_ > ?");
        } else {
            pagingSelect = new StringBuilder(sql.length() + forUpdateClauseLength + 37);
            pagingSelect.append("select * from ( ");
            pagingSelect.append(" ) where rownum <= ?");

        if (isForUpdate) {
            pagingSelect.append(" ");

        return pagingSelect.toString();

    private int getForUpdateIndex(String sql) {
        int forUpdateLastIndex = sql.toLowerCase(Locale.ROOT).lastIndexOf("for update");
        int lastIndexOfQuote = sql.lastIndexOf("'");
        if (forUpdateLastIndex > -1) {
            if (lastIndexOfQuote == -1) {
                return forUpdateLastIndex;
            } else {
                return lastIndexOfQuote > forUpdateLastIndex ?-1 : forUpdateLastIndex;
        } else {
            return forUpdateLastIndex;
    public final boolean supportsLimit() {
        return true;
    public boolean bindLimitParametersInReverseOrder() {
        return this.bindLimitParametersInReverseOrder;
    public boolean useMaxForLimit() {
        return this.useMaxForLimit;

3. Modify the dialect class used in the configuration file


III. summary
if you encounter other dialect problems later, you can use the same method to solve them