Category Archives: Error

[How to Solve] Unexpected space before function parentheses Error

Unexpected space before function parentheses error reporting solution

Unexpected space before function parentheses

this error is the configuration in .eslintrc.js file. Add code to the rules in this file:

"space-before-function-paren": 0

Or the attribute space-before-function-paren already exists in the file. Visit the eslint document
to view the parameters and change them according to the document.

[Solved] C++ reason ncnn model error: Segmentation fault (core dumped)

The reasoning code is as follows:

#include "net.h"
#include <iostream>
#include <fstream>
#include <algorithm>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc.hpp>
#include <stdio.h>
#include <vector>
#include <opencv2/opencv.hpp>

using namespace std;

void pretty_print(const ncnn::Mat& m)
{
    for (int q=0; q<m.c; q++)
    {
        const float* ptr = m.channel(q);
        for (int y=0; y<m.h; y++)
        {
            for (int x=0; x<m.w; x++)
            {
                printf("%f ", ptr[x]);
            }
            ptr += m.w;
            printf("\n");
        }
        printf("------------------------\n");
    }
}
//main fuction
int main(){
    string img_path = "person1.jpeg";
    cv::Mat img = cv::imread(img_path, cv::IMREAD_COLOR);
    cv::Mat img2;
    int input_width = 512;//Input size specified when going onnx
    int input_height = 512;
    
    cv::resize(img, img2, cv::Size(input_width, input_height));
  

    // Load the converted and quantized alexnet network
    ncnn::Net net;
    // net.opt.num_threads=1;
    net.load_param("cps_simplif.param");
    net.load_model("cps_simplif.bin");
    // Convert opencv mat to ncnn mat
    ncnn::Mat input = ncnn::Mat::from_pixels(img2.data, ncnn::Mat::PIXEL_BGR, img2.cols, img2.rows);
    const float mean_vals[3] = {0.485, 0.456, 0.406};
    const float norm_vals[3] = {0.229, 0.224, 0.225}; //[0.485, 0.456, 0.406]),std=np.array([0.229, 0.224, 0.225]
    input.substract_mean_normalize(mean_vals, norm_vals);
    // ncnn forward calculation
    ncnn::Extractor extractor = net.create_extractor();
    extractor.input("input.1", input);
    ncnn::Mat output0;
    extractor.extract("1035", output0);

    //ncnn::mat ->>>>> cv::mat
    cv::Mat a(input_height,input_width, CV_8UC3);
    output0.to_pixels(a.data, ncnn::Mat::PIXEL_BGR2RGB);
    
    cv::imwrite("ncnninfer.png", a);
    
    // pretty_print(output0);
    // pretty_print(output1);

    cout<<"done"<<endl;
    return 0;
}

Only segmentation fault (core dumped) is reported after running

No core file is generated. Check through ulimit -c, the size of core file is unlimited and there is no problem. This method solves the problem of not generating core file

With core file

Pass under the terminal

apt-get update
apt-get install gdb

Install GDB

Installation completed, passed

gdb ./Execution file name   core

The core here can be modified according to its own core file name.
the error is found at:

Corresponding to the reasoning code above

output0.to_pixels(a.data, ncnn::Mat::PIXEL_BGR2RGB);

It is the code to realize the conversion from ncnn:: mat to cv:mat. After debugging, it is found that the reasoning results of ncnn are all Nan, which leads to the conversion failure

Adjust the previous input, normalization is not done well.

[Solved] Springcloud Add gateway to Startup Error: Exception encountered during context initialization – cancelling refresh

Springcloud adds gateway startup error

**********************************************************

Spring MVC found on classpath, which is incompatible with Spring Cloud Gateway at this time. Please remove spring-boot-starter-web dependency.

**********************************************************


15.366 WARN  o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext:559  Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'gatewayConfigurationService' defined in class path resource [org/springframework/cloud/gateway/config/GatewayAutoConfiguration.class]: Unsatisfied dependency expressed through method 'gatewayConfigurationService' parameter 1; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.core.convert.ConversionService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Qualifier(value=webFluxConversionService)}
15.369 INFO  o.a.c.core.StandardService    :173  Stopping service [Tomcat]
15.385 INFO  o.s.b.a.l.ConditionEvaluationReportLoggingListener:136  

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
15.521 ERROR o.s.boot.SpringApplication    :837  Application run failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'gatewayConfigurationService' defined in class path resource [org/springframework/cloud/gateway/config/GatewayAutoConfiguration.class]: Unsatisfied dependency expressed through method 'gatewayConfigurationService' parameter 1; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.core.convert.ConversionService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Qualifier(value=webFluxConversionService)}
	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:797)
	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:538)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1338)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517)
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:893)
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:879)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551)
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750)
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
	at com.course.gateway.GatewayApplication.main(GatewayApplication.java:18)

reason:

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-gateway</artifactId>
</dependency>

It has been introduced

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>

Find the duplicate import in the POM file or the POM file of the parent project, as shown in the following figure:

start the error report at this time
Solution: delete the redundant import

<dependency>  
  <groupId>org.springframework.boot</groupId> 
   <artifactId>spring-boot-starter-web</artifactId>
</dependency>

After deletion, the startup is successful

the deeper original is the gateway. The underlying layer is the weblux framework. Web initialization has been done in spring-cloud-starter-gateway. If springmvc goes to initialize again, it will conflict, resulting in an error

[Solved] gateway Error: reactor.core.Exceptions$ErrorCallbackNotImplemented

The production environment is fine, but suddenly all front-end requests are cross-domain and the requests are 500. gateway reports an error.
reactor.core.Exceptions$ErrorCallbackNotImplemented:java.lang.IndexOutOfBoundsException: Index: 0, Size: 0. All interfaces are reported.
The reason is that the gateway also integrates with springboot-admin, which opens the actuator endpoint of the application, leading to a code injection attack

Solution: Use nginx to intercept the path directly, add the following configuration to conf, and reload nginx.

location /actuator {
    return 404;
}

 

[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] 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!

[Solved] Failed to allocate graph: MYRIAD device is not opened.

Error reporting prompt:

Failed to allocate graph: MYRIAD device is not opened.

Solution:
please check whether the device is properly connected. Please execute: lsusb | grep 03e7. If it is connected, you will see the following similar results:

$ lsusb | grep 03e7
Bus 001 Device 120: ID 03e7:2485 Intel Movidius MyriadX

Check the device manager on windows to see if the device manager has the last device.

After the equipment is correctly connected, the following model conversion operations can be carried out.

 

[Solved] error when starting dev server:Error: listen EACCES: permission denied 0.0.0.0:80 at Server.set

error when starting dev server:Error: listen EACCES: permission denied 0.0.0.0:80 at Server.set

error when starting dev server:
Error: listen EACCES: permission denied 0.0.0.0:80
at Server.setupListenHandle [as _listen2] (node:net:1313:21)
at listenInCluster (node:net:1378:12)
at Server.listen (node:net:1465:7)Using cnpm install works

mac to 8090.

mac terminal port view command
View Port thread lsof -i:4700
$ lsof -i:4700
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
node 12159 yyyyyy 23u IPv4 0x76b4f5051c4983f3 0t0 TCP *:netxms-agent (LISTEN)

The PID here is the process number that occupies port 4700
kill 4700
Solution:
View mac terminal port command netstat -AaLlnW
Method 1
// Check if port 80 is occupied
sudo lsof -i :80

Method 2
netstat -anp tcp | grep 80
The following command can directly end all processes that are occupying the port.
lsof -P | grep ‘:80’ | awk ‘{print $2}’ | xargs kill -9

Ps -ef|grep program name

 

[Solved] ZooKeeper Configurate Error: Error contacting service. It is probably not running.

After the ZooKeeper download and decompression configuration is successfully started, the execution of zkServer.sh start reports the following error.

The reason why I report an error is that the 2 and 3 node jdks do not set environment variables, resulting in an error contacting service It is probably not running.

I only configured JDK environment variables on node 1, and did not configure JDK environment variables on nodes 2 and 3. (I have three machines configured here)

Execute the VIM /etc/profile command to set the environment variables.

After setting the environment variable, use the command: source /etc/profile to make it effective

After the JDK environment variables of the three machines are set successfully.

Check zookeeper status at startup: zkServer.sh status  three nodes started successfully

Successfully resolved.

[Solved] error Component name “index“ should always be multi-word vue/multi-word-component-names

preface

This article mainly records the solution of Vue eslint error component name “index” should always be multi word Vue/multi word component names.

1.  Reason for error reporting

Create a project using the latest Vue-cli. When NPM run serve runs the project, an error is reported, as shown in the following figure.

The reason is that the eslint-plugin-vue version has been updated, and compared to the previous version, there are many new rules in the @8 version, the first one is ‘vue/multi-word-component-names’: ‘error’, which requires component names to be named in camel format, so index.vue will report an error.

2. Solutions

  • Follow the rules and use camel naming, e.g. AppHeader.vue
  • Turn off the naming convention in the .eslintrc.js file
// .eslintrc.js
module.exports = {
  root: true,
  env: {
    node: true,
  },
  extends: [
    "plugin:vue/vue3-essential",
    "eslint:recommended",
    "@vue/typescript/recommended",
    "plugin:prettier/recommended",
  ],
  parserOptions: {
    ecmaVersion: 2020,
  },
  rules: {
    "vue/multi-word-component-names": [
      "error",
      {
        ignores: ["index"], //Component names to be ignored
      },
    ],
  },
};

[Solved] DPDK Error: insmod: ERROR: could not insert module igb_uio.ko: Invalid parameters

Load IGB_UIO modules

sudo modprobe uio
sudo insmod igb_uio. ko

Excribing errors:

insmod: ERROR: could not insert module igb_uio.ko: Invalid parameters

 

Solution:

First use uname -r to view the current kernel version

Use modinfo IGB_uio.ko check whether the vermagic field is consistent with the current kernel version, and find that it is inconsistent

Recompile the dpdk. After compilation, check the consistency