Tag Archives: development language

[Solved] Error:Kotlin: Module was compiled with an incompatible version of Kotlin. The binary version of

Problem Description: my project was fine the day before yesterday. Suddenly, the following error was reported after opening it the next day

Error:Kotlin: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.16.

I didn’t use kotlin either. Finally, I recompiled the project when compiling

Done!

[Solved] Errorjava Compilation failed internal java compiler error

Error Messages:

Errorjava Compilation failed internal java compiler error

 

Solution:

1. view the project’s jdk (Ctrl+Alt+shift+S)
File ->Project Structure->Project Settings ->Project

2, view the project’s jdk (Ctrl+Alt+shift+S)
File ->Project Structure->Project Settings -> Modules -> (Name of the project to be modified) -> Sources ->

3. View Java configuration in idea
File ->Setting ->Build,Execution,Deployment -> Compiler -> Java Compiler

If the above three steps still fail
Clear IDEA cache Restart IDEA
File->Invalidate Caches/Restart

show dbs Error: [js] uncaught exception: Error: listDatabases failed

When mongo is built with replica set cluster.
If you log into one of the SECONDARY nodes and execute the command show dbs, you will get an error:

2022-08-16T15:20:00.606+0800 E  QUERY    [js] uncaught exception: Error: listDatabases failed:{
    "operationTime" : Timestamp(1660634399, 2),
    "ok" : 0,
    "errmsg" : "not master and slaveOk=false",
    "code" : 13435,
    "codeName" : "NotMasterNoSlaveOk",
    "$clusterTime" : {
        "clusterTime" : Timestamp(1660634399, 2),
        "signature" : {
            "hash" : BinData(0,"NPF356c5NKl0PqHLlmiQ9vey9e4="),
            "keyId" : NumberLong("7101680539345616897")
        }
    }
} :
_getErrorWithCode@src/mongo/shell/utils.js:25:13
Mongo.prototype.getDBs/<@src/mongo/shell/mongo.js:147:19
Mongo.prototype.getDBs@src/mongo/shell/mongo.js:99:12
shellHelper.show@src/mongo/shell/utils.js:906:13
shellHelper@src/mongo/shell/utils.js:790:15
@(shellhelp2):1:1

 

This is because the SECONDARY node does not have the permission to execute the show dbs command.
In this case, there are two solutions
1. Login to the PRIMARY node
2. Use the cluster connection method
mongo –host  testmongo/ip:port,ip:port,ip:port -uusername -p’passwd’ –authenticationDatabase admin

[Solved] pycallgraph Install Error: subprocess-exited-with-error

In the win7 system, under the command terminal, the two methods of installing pycallgraph report the exception of subprocess exited with error


Solution: downgrade setuptools

1. First check the current version of setuptools.

pip show setuptools

2. The version of setuptools has been downgraded. Here, I downgraded it to 57.5.0

pip install --upgrade setuptools==57.5.0

3. Try installing pycallgraph again

pip install pycallgraph

[Solved] Python Selenium Error: AttributeError: ‘WebDriver‘ object has no attribute ‘find_element_by_xpath‘

Python selenium Error:

el = driver.find_element_by_xpath('//*[@id="changeCityBox"]/ul/li[2]/a')
driver.find_element_by_xpath('//*[@id="search_input"]').send_keys('python',Keys.ENTER)

Solution: Modify the codes above to:

from selenium.webdriver.common.by import By
el = driver.find_element(By.XPATH,r'//*[@id="changeCityBox"]/ul/li[2]/a')
driver.find_element(By.XPATH,r'//*[@id="search_input"]').send_keys("python",Keys.ENTER)

War here to use the browser driver for Google, other browsers can also be Edge to edge, modify the driver needs to configure the environment

from selenium.webdriver import Chrome
from selenium.webdriver.common.keys import Keys   # Button commands for the keyboard
from selenium.webdriver.common.by import By
driver = Chrome()
driver.get("https://www.lagou.com/")
# Find the element copyxpath that the browser needs to operate on
el = driver.find_element(By.XPATH,r'//*[@id="changeCityBox"]/ul/li[2]/a')
# el = driver.find_element_by_xpath('//*[@id="changeCityBox"]/ul/li[2]/a')
el.click() # Click event
# find the input box F12 element copyxpath, enter python content, enter or search button xpath
driver.find_element(By.XPATH,r'//*[@id="search_input"]').send_keys("python",Keys.ENTER)
# driver.find_element_by_xpath('//*[@id="search_input"]').send_keys('python',Keys.ENTER)

RuntimeError: stack expects each tensor to be equal size, but got [x] at entry 0 and [x] at entry 1

RuntimeError: stack expects each tensor to be equal size, but got [x] at entry 0 and [x] at entry 1

Problem description: When generating a dataloader, the training set can be run, but the test set has this error: RuntimeError: stack expects each tensor to be equal size, but got [200] at entry 0 and [116] at entry 1.

How to Solve: In generating the dataloader, I need to generate a dataset, so my error occurred because there is a minibatch in the dataset with a different number of data than the other minibatch, so I went into the custom dataset method to check, and through print debugging, I found that it was a problem with the dataset label.

Solution: Go into the dataset and print the output of the dataset.

[Solved] catkin_make Error: Invoking “make -j12 -l12“ failed

While studying the official ROS tutorial Writing a Simple Publisher and Subscriber (C++), the following error occurred when running catkin_make:

Base path: /home/free/catkin_ws
Source space: /home/free/catkin_ws/src
Build space: /home/free/catkin_ws/build
Devel space: /home/free/catkin_ws/devel
Install space: /home/free/catkin_ws/install
####
#### Running command: "make cmake_check_build_system" in "/home/free/catkin_ws/build"
####
####
#### Running command: "make -j12 -l12" in "/home/free/catkin_ws/build"
####
[  0%] Built target std_msgs_generate_messages_lisp
[  0%] Built target std_msgs_generate_messages_nodejs
[  0%] Built target std_msgs_generate_messages_cpp
[  0%] Built target std_msgs_generate_messages_py
[  0%] Built target std_msgs_generate_messages_eus
[  0%] Built target _beginner_tutorials_generate_messages_check_deps_Num
[  0%] Built target _beginner_tutorials_generate_messages_check_deps_AddTwoInts
[ 58%] Built target beginner_tutorials_generate_messages_py
[ 64%] Built target beginner_tutorials_generate_messages_eus
[ 58%] Built target beginner_tutorials_generate_messages_lisp
[ 58%] Built target beginner_tutorials_generate_messages_cpp
[ 76%] Built target beginner_tutorials_generate_messages_nodejs
[ 76%] Built target beginner_tutorials_generate_messages
[ 82%] Linking CXX executable /home/free/catkin_ws/devel/lib/beginner_tutorials/talker
[ 88%] Linking CXX executable /home/free/catkin_ws/devel/lib/beginner_tutorials/listener
/usr/bin/ld: CMakeFiles/listener.dir/src/listener.cpp.o: relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: Final link failure: output non-representable links
collect2: error: ld returned 1 exit status
beginner_tutorials/CMakeFiles/listener.dir/build.make:112: recipe for target '/home/free/catkin_ws/devel/lib/beginner_tutorials/listener' failed
make[2]: *** [/home/free/catkin_ws/devel/lib/beginner_tutorials/listener] Error 1
CMakeFiles/Makefile2:1344: recipe for target 'beginner_tutorials/CMakeFiles/listener.dir/all' failed
make[1]: *** [beginner_tutorials/CMakeFiles/listener.dir/all] Error 2
make[1]: *** Waiting for unfinished tasks....
/usr/bin/ld: CMakeFiles/talker.dir/src/talker.cpp.o: relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: Final link failure: output non-representable links
collect2: error: ld returned 1 exit status
beginner_tutorials/CMakeFiles/talker.dir/build.make:112: recipe for target '/home/free/catkin_ws/devel/lib/beginner_tutorials/talker' failed
make[2]: *** [/home/free/catkin_ws/devel/lib/beginner_tutorials/talker] Error 1
CMakeFiles/Makefile2:1381: recipe for target 'beginner_tutorials/CMakeFiles/talker.dir/all' failed
make[1]: *** [beginner_tutorials/CMakeFiles/talker.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j12 -l12" failed

After looking for the reason for a long time, I finally found that the final error was due to the wrong version of GCC and G + +. After changing GCC and g++ 5.5.0, I successfully compiled

Process for installing GCC and g++ version 5.5.0:

sudo add-apt-repository ppa:ubuntu-toolchain-r/test 
sudo apt-get update 
sudo apt-get install gcc-5
sudo apt-get install g++-5

Change GCC and g++ versions

cd /usr/bin 
sudo rm gcc 
sudo ln -s gcc-5 gcc 
sudo rm g++ 
sudo ln -s g++-5 g++

Finally, check whether the modification is successful

gcc --version
g++ --version

Recompile:

catkin_make clean   #Clear the front compile
catkin_make 

[Solved] Maven Startup Error: Malformed \uxxxx encoding

Problem Description:

The project started well in the morning, but not in the afternoon 😂 What is this situation… At first, the project could not be started because the HTTP resources would be filtered out after Maven version 3.8.1. Later, it was still impossible to change HTTP to HTTPS,

The best way is to modify the Maven version. I changed it to Maven version 3.6.3. After that, I can download the package. However, it didn’t take long before there was another problem. Malformed \uxxxx encoding.

Let’s start with this error report today: malformed \ uxxxx encoding (the problem encountered today has been solved for half an afternoon and the reason has finally been found…)

Solution Summary:

First of all, the solutions are nothing more than the following:

1, first check the project .properties, .yml, pom.xml, logback and other configurations, whether there is a path error in the use of

2, update the maven repository, re-download the jar package

3, delete the path-to-the-library or resolver-status.properties file

In either case, it is recommended to restart the editor. For idea, click the Invalidate Caches/ Restart button to clear the cache and restart the idea

After opening IDEA and updating the project to start.

1, suddenly found build failure reported a strange error: Malformed \uxxxx encoding.

2. The <project> tag in the pom.xml file is also marked in red with the error.

But but but the code in the pom is exactly the same as on master, others are fine, but not their own, some of the import classes in the file will also report an error Can’t find.

Reason: When updating the jar packages that the project depends on, the downloaded jar packages may be incomplete due to network problems.

Solution: Delete the downloaded jar package and download it again.

In fact, it is not necessary to delete and re-download the package in general, so I think there must be a way to find the problematic package. To do accurate deletion

The quick solution is:

# Use the -X parameter to type out the error file information
mvn pakage -X
# Check the log, then delete or change the name of the file with the error to something else
# This will allow you to re-download the wrong file

I solved this problem through method 3

(1) In the . /m2/ folder (modify as you see fit), find path-to-the-library and delete it (if this file is not present, you can simply ignore this step).
(2) In the . /m2/repository (modify according to your situation) folder, search globally for the file: resolver-status.properties, delete all the files found, and recompile.

How to Configure OpenFPGA Environment (Probable Errors & Their Solutions)

Openfpga environment configuration and problem-solving


Environment configuration process

git clone https://github.com/LNIS-Projects/OpenFPGA.git​

cd OpenFPGA/.github/workflows​
# Add ‘sudo’ before apt-get in script: install_depencies_build.sh​
source install_depencies_build.sh  # (install all depencies)​

# back to OpenFPGA
python3 –m pip install –r requirements.txt​
make all​

# During make, watch the error messages and see which package is missing, repeatly using  ‘sudo apt install XXX’ to install them like:​
Tcl.h:   sudo apt install tcl-dev​
readline:   sudo apt install readline-dev​

How to Solve the Errors:

Compilation error

SIGSTKSZ Error

  • Cause: Guess it is a C compilation tool chain version problem caused by different source change
  • Solution: Update the version of catch.hpp and replace

 

1. Download

wget -O ~/Downloads/catch.hpp https://github.com/catchorg/Catch2/releases/download/v2.13.9/catch.hpp

2. Replace the file

cd {OpenFPGA_File_location}/libs/EXTERNAL/libcatch/
mv catch.hpp catch.bak.hpp
mv ~/Downloads/catch.hpp ./

FATAL ERROR issues about TBB

  • Cause: system problem missing header file tbb_stddef.h
  • Solution:
wget -O ~/Downloads/tbb_stddef.h https://raw.githubusercontent.com/wjakob/tbb/9e219e24fe223b299783200f217e9d27790a87b0/include/tbb/tbb_stddef.h
sudo mv ~/Downloads/tbb_stddef.h /usr/include/tbb

Missing header file task_scheduler_init.h

wget -O ~/Downloads/task_scheduler_init.h https://raw.githubusercontent.com/wjakob/tbb/raw/master/include/tbb/task_scheduler_init.h
sudo mv ~/Downloads/task_scheduler_init.h /usr/include/tbb

Dependency not found

  • Uniform problem: Error or not running when running install_dependencies_build.sh or when pip install
  • Solution: rerun both steps and install separately if there is still a problem
Note
# Missing ffi.h
sudo apt install libffi-dev
# Missing tcl.h
sudo apt install tk tcl tk-dev tcl-dev
# Missing readline
sudo apt install readline-dev libreadline6-dev

run-task error

Check the log. The most observed problem is that envYAML package is not installed

pip3 install envyaml

ModuleNotFoundError ‘prettytable’

When running run_vtr_task.py, it prompts: ModuleNotFoundError: No module named ‘prettytable’
processing:

# update pip
python -m pip install --upgrade pip
# install PrettyTable package
pip install PrettyTable

Script unsatisfiable

  • ctags, qt5-default are not available candidates (no installation candidate)
  • Solution: In most usage scenarios, these two packages are not important, edit the install_dependencies_build.sh file and delete the lines ctags and qt5-default

Network environment problems

include:

  1. Connection refused Connection refused
  2. 443 SSL could not be established
  3. Clone failed Clone failed

Solution:

  1. Modify hosts
  2. Open accelerator/VPN
  3. Use personal hotspot for mobile traffic

Runtime problems

Permission Denied | Can not find directory…

Problem Analysis: The command is incorrectly run with the root user when git clone or install dependencies, resulting in the personal user not having any modification rights.
Solution: In the root directory of OpenFPGA

sudo chown -hR {user name}:{user group, usually same as user name} . /
# Change all file owners to individual users

In the yosys shell, when the show command views the circuit diagram, it prompts an error

Problem: lack of dot matrix graphic display tool
solution: try running sudo apt-get install xdot

Kotlin: How to Solve kapt import error

The first problem encountered was that the BR file could not be found

Log: unresolved reference: BR

Reason: the plug-in developed by kotlin does not support cross module, so the reference of databinding when using APT Technology br file does not determine the directory, so the error (unresolved reference: be) is caused, so it needs to be completed by kapt

Solution:

apply plugin: 'kotlin-kapt'
kapt {
    generateStubs = true
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    //The version should be the same as the gradle version
    kapt  "com.android.databinding:compiler:3.5.0"
}

New problem: Class not found Custom generated class can not be generated.

Reason: If you already have kapt, you need to replace it with kapt

Solution: In Kotlin, you need to add the kotlin-kapt plugin to activate kapt and replace the annotationProcessor with kapt.

[Solved] asList().add() error: UnsupportedOperationException

ArrayList.add() and aslist().add() problem

using aslist().add() report an error: UnsupportedOperationException


Cause and analysis

asList() is using the internal class ArrayList of Arrays, this internal class does not override the add() method, so the add method used here is the parent class abstract class of the ArrayList class, the add() method here by default is to throw an exception: UnsupportedOperationException

Internal class of arrays

  private static class ArrayList<E> extends AbstractList<E>
        implements RandomAccess, java.io.Serializable
    {
        private static final long serialVersionUID = -2764017481108945198L;
        private final E[] a;

        ArrayList(E[] array) {
            a = Objects.requireNonNull(array);
        }

        @Override
        public int size() {
            return a.length;
        }

        @Override
        public Object[] toArray() {
            return a.clone();
        }

        @Override
        @SuppressWarnings("unchecked")
        public <T> T[] toArray(T[] a) {
            int size = size();
            if (a.length < size)
                return Arrays.copyOf(this.a, size,
                                     (Class<?extends T[]>) a.getClass());
            System.arraycopy(this.a, 0, a, 0, size);
            if (a.length > size)
                a[size] = null;
            return a;
        }

        @Override
        public E get(int index) {
            return a[index];
        }

        @Override
        public E set(int index, E element) {
            E oldValue = a[index];
            a[index] = element;
            return oldValue;
        }

        @Override
        public int indexOf(Object o) {
            E[] a = this.a;
            if (o == null) {
                for (int i = 0; i < a.length; i++)
                    if (a[i] == null)
                        return i;
            } else {
                for (int i = 0; i < a.length; i++)
                    if (o.equals(a[i]))
                        return i;
            }
            return -1;
        }

        @Override
        public boolean contains(Object o) {
            return indexOf(o) != -1;
        }

        @Override
        public Spliterator<E> spliterator() {
            return Spliterators.spliterator(a, Spliterator.ORDERED);
        }

        @Override
        public void forEach(Consumer<?super E> action) {
            Objects.requireNonNull(action);
            for (E e : a) {
                action.accept(e);
            }
        }

        @Override
        public void replaceAll(UnaryOperator<E> operator) {
            Objects.requireNonNull(operator);
            E[] a = this.a;
            for (int i = 0; i < a.length; i++) {
                a[i] = operator.apply(a[i]);
            }
        }

        @Override
        public void sort(Comparator<?super E> c) {
            Arrays.sort(a, c);
        }
    }

Add method of ArrayList() class

 public boolean add(E e) {
        ensureCapacityInternal(size + 1);  // Increments modCount!!
        elementData[size++] = e;
        return true;
    }

Add method of AbstractList class

Aslist() uses this method

public void add(int index, E element) {
        throw new UnsupportedOperationException();//This is where the exception is thrown
    }

[Solved] Vue Error: Error in v-on handler (Promise/async): “[object object]“

[Solved] Vue Error: Error in v-on handler (Promise/async): “[object object]“

Solution:

Use try_ catch package async… await function

  /**
   * export
   */
  async download () { // export
    try {
      const { parkName } = this.formInline
      const res:any = await exportInvoice({ parkName })
      this.downSteam(res)
    } catch (_) {}
  }