Tag Archives: bug

[Solved] Error: The superclass, ‘Animal‘, has no unnamed constructor that takes no arguments.

Error: The superclass, ‘Animal’, has no unnamed constructor that takes no arguments.

Problem Description:

Because the constructor cannot inherit
an error is reported during inheritance, which prompts that the constructor in the parent class is composed of parameters. You need to write the constructor in the subclass and pass the constructor of the parent class to parameters

class Animal {
  String name;
  int age;
  Animal(this.name, this.age);

  void printInfo() {
    print('$name is $age years old');
  }
}

//Inherit Animal class by extends keyword
class Cat extends Animal {
 
}

void main(List<String> args) {
  Cat cat = new Cat();
 print( cat.name);
}

Solution:

Super keyword

Try declaring a zero argument constructor in ‘Animal’, or declaring a constructor in Cat that explicitly invokes a constructor in ‘Animal’.dart(no_default_super_constructor)

Try declaring a zero parameter constructor in “animal” or a constructor that explicitly calls the constructor in “animal” in cat.dart (no default super constructor)

class Animal {
  String name;
  int age;
  Animal(this.name, this.age);

  void printInfo() {
    print('$name is $age years old');
  }
}

//Inherit Animal class by extends keyword
class Cat extends Animal {
  Cat(String name, int age) : super(name, age);

}

void main(List<String> args) {
  Cat cat = new Cat("Huahua",3);
 print( cat.name);
}

Spring cloud remote connect Nacos error [How to Solve]


Problem description

Spring cloud Alibaba micro service architecture is used, and Nacos is used in the service discovery and configuration center

At the beginning, Nacos was started locally, and everything was normal,

After Nacos is migrated to the cloud, change the Nacos address in the configuration file

The gateway service reports an error java.net.connectexception: no available server, because it is always connected to localhost:8848 .

The console outputs the following screenshot:

Cause location

Because the parent POM dependency is imported:

spring-cloud-starter-Alibaba-Nacos-config and spring-cloud-starter-Alibaba-Nacos-discovery

In local development, items such as testing, registration and discovery are configured in application.yml, the central configuration file bootstrap.properties is not created

Springboot automation configuration defaults to localhost:8848 , so there is no problem with the local environment.

Solution:

Remove useless dependencies (if nacos-config is not used, remove spring-cloud-starter-alibaba-nacos-config dependencies)

[Solved] bug: error Command failed with exit code 1.

After nodemon is installed, the data is updated,

Instead, an error was reported.

I tried to search for a solution, but I couldn’t solve it,

Tell me about my own operation,

Finally, it is handled:

Main here I have a look. It turned into index.js

Now it’s changed to app.js, that is, the background entry file.

Then it’s all right.

Java error: java.lang.NoSuchMethodError

The Java runtime reports an error
the postman test reports an error of 500. The exception information is displayed as follows:


reason: first, check whether there is a method of this attribute in the previous class. If so, it is mostly a problem of dependency conflict. In general, it may be that classes with the same package name and class name are introduced. The order in which dependencies are introduced in the POM file of the project is inconsistent, resulting in the use of other people’s classes with the same package and the same name, and there is no corresponding entity class attribute paramscheckresult. An error will be reported in the result. Query the full path name of the class you introduced.

 

Methods:

ProtectionDomain pd = Response.class.getProtectionDomain();
CodeSource cs = pd.getCodeSource();
System.out.println(cs.getLocation().toString());

Print result: the full path name of the imported class will be displayed

vue Error: Uncaught SyntaxError: Invalid shorthand property initializer

When defining an object using JSON format in JavaScript

An error occurred while debugging the browser: uncaught syntax error: invalid shorthand property initializer

<body>
    <div id=app>
        <button @click="handclick">Button</button>
        <p>{{name}}</p>
    </div>
</body>
<script src="./js/vue.js"></script>
<script>
    let app = new Vue({
        el: "#app",
        // The reason is that "=" should be written as ":"
        data: {
            name: "张三"
        },
        methods: {
            handclick() {
                this.name = 'lis'
            }
        },
        watch: {
            name(newVal, oldVal) {
                console.log(newVal, oldVal)
            }
        }
    })
</script>

[Solved] KeyError: ‘Transformer/encoderblock_0/MultiHeadDotProductAttention_1/query\\kernel is

Recently, I've been working on the application of Transformer to fine-grained images.
Solving the problem with the vit source code
 
KeyError: 'Transformer/encoderblock_0/MultiHeadDotProductAttention_1/query\kernel is not a file in the archive'
 
This is a problem when merging paths with os.path.join
 
Solution.
 
1. In the modeling.py file
 
Add '/' to the following paths:
ATTENTION_Q = "MultiHeadDotProductAttention_1/query/"
ATTENTION_K = "MultiHeadDotProductAttention_1/key/"
ATTENTION_V = "MultiHeadDotProductAttention_1/value/"
ATTENTION_OUT = "MultiHeadDotProductAttention_1/out/"
FC_0 = "MlpBlock_3/Dense_0/"
FC_1 = "MlpBlock_3/Dense_1/"
ATTENTION_NORM = "LayerNorm_0/"
MLP_NORM = "LayerNorm_2/"
 
2. In the vit_modeling_resnet.py file
 
ResNetV2 class Add '/' after each 'block' and 'unit'
 
self.body = nn.Sequential(OrderedDict([
    ('block1/', nn.Sequential(OrderedDict(
        [('unit1/', PreActBottleneck(cin=width, cout=width*4, cmid=width))] +
        [(f'unit{i:d}/', PreActBottleneck(cin=width*4, cout=width*4, cmid=width)) for i in range(2, block_units[0] + 1)],
        ))),
    ('block2/', nn.Sequential(OrderedDict(
        [('unit1/', PreActBottleneck(cin=width*4, cout=width*8, cmid=width*2, stride=2))] +
        [(f'unit{i:d}/', PreActBottleneck(cin=width*8, cout=width*8, cmid=width*2)) for i in range(2, block_units[1] + 1)],
        ))),
    ('block3/', nn.Sequential(OrderedDict(
        [('unit1/', PreActBottleneck(cin=width*8, cout=width*16, cmid=width*4, stride=2))] +
        [(f'unit{i:d}/', PreActBottleneck(cin=width*16, cout=width*16, cmid=width*4)) for i in range(2, block_units[2] + 1)],
        ))),
]))

[Solved] Dvc push Error: (ERROR: configuration error…)

When you can’t push it, check whether your remote warehouse is stored in the corresponding file

Click on your .Div file. There are two files beginning with config, config and config.Local

if your config.Local stores your remote warehouse address and there is nothing in config

So congratulations! Successful lying gun!


Solution:

When DVC identifies the directory of your remote warehouse, find the directory under your config file instead of config.Local, delete the config.Local file, and then remote add your warehouse path, and then you can push it
in a word, config cannot be empty

log4j:WARN Error during default initialization [How to Solve]

Error generation environment

Generated when mybatis sets log4j log

Error description

log4j:ERROR Category option " 1 " not a decimal integer.
java.lang.NumberFormatException: For input string: " 1 "

Error reason

In the log4j.properties file, there are more spaces in the log4j.appender.console.layout.conversionpattern attribute

Solution:

Before modification:

log4j.appender.console.layout.ConversionPattern =  %d{ABSOLUTE} %5p %c{ 1 }:%L - %m%n

After modification:

log4j.appender.console.layout.ConversionPattern =  %d{ABSOLUTE} %5p %c{1}:%L - %m%n

[Solved] Git Error: fsmonitor–daemon failed to start

Scenario:

Today, I want to upload local notes to gitee, and then when I git add., I report an error
no solution was found on Baidu. I saw the idea on GitHub later

First try to
turn off the daemon

git config core.useBuiltinFSMonitor false

Error reporting is not reported, but it does not solve the problem

Then try to start the daemon manually

git fsmonitor--daemon start

Fail

Solution:

Check if your git path has Chinese
it’s probably better to change the Chinese on the path
I haven’t noticed before, because this is the first time I met this problem and successfully solved it