Author Archives: Robins

[Solved] django DRF This field may not be null, This field cannot be blank

target

You need to change the original mandatory field to non mandatory

realization

First, update the fields in models, and add null = true, default = none, blank = true

1
2
name = CharField(max_length=64, verbose_name='name', null=True, default=None, blank=True)
account = CharField(max_length=64, verbose_name='account', null=True, default=None, blank=True)

serializers update

1
2
name = CharField(required=False)
account = CharField(required=False)

execute python manage.py makemigrations
execute python manage.py migrate

Error:

May appear this error:

1
This field may not be null.

or

1
This field cannot be blank.

Solution:

You need to change serializers to this

1
2
name = CharField(required=False, allow_blank=True, allow_null=True)
account = CharField(required=False, allow_blank=True, allow_null=True)

allow_blank=True to solve This field cannot be blank.
allow_null=True to solve This field may not be null.

[Solved] Greenplum Use the Storage Error: function cannot execute on a QE slice because it accesses relation

Error message:

In Greenplum database, when we use stored procedures to query data, we will report the following error information

function cannot execute on a QE slice because it accesses relation

First, let’s understand the replication table below

Replicated table

Greenplum 6 supports a new distribution strategy: copy table, that is, the whole table has a complete copy on each node.

test=# CREATE TABLE t2 (id int) DISTRIBUTED REPLICATED;
CREATE TABLE
test=# INSERT INTO t2 VALUES (1), (2), (3);
INSERT 0 3
test=# SELECT * FROM t2;
 id
----
  1
  2
  3
(3 rows)

test=# SELECT gp_segment_id, * from t2;
 gp_segment_id | id
---------------+----
         0 |  1
         0 |  2
         0 |  3

UDF cannot access any tables on segment. Due to the characteristics of MPP, any segment only contains part of the data, so the UDF executed in the segment cannot access any tables, otherwise the data calculation is wrong.

yydzero=# CREATE FUNCTION c() RETURNS bigint AS $$
yydzero$#  SELECT count(*) from t1 AS result;
yydzero$# $$ LANGUAGE SQL;
CREATE FUNCTION
yydzero=# SELECT c();
 c
---
 6
(1 row)

yydzero=# select c() from t2;
ERROR:  function cannot execute on a QE slice because it accesses relation "public.t1"  (seg0 slice1 192.168.1.107:25435 pid=76589)

If the above T1 is changed to a copy table, this problem does not exist.

Avoid distributed query plans:

If the data of a table is copied on each segment, a local connection plan can be generated to avoid data movement between different nodes of the cluster. If a replicated table is used to store a table with a small amount of data (such as thousands of rows), the performance will be significantly improved. A table with a large amount of data is not suitable for the replicated table mode.

Solution:

If the reason is found, it is simple. You only need to modify the table creation statement to solve the problem

ALTER TABLE table_name SET DISTRIBUTED REPLICATED;

[Solved] ubuntu 18.04 Fix Error: “libpng12.so.0: cannot open shared object file: No such file or directory”

Error “libpng12.so.0: cannot open shared object file: No such file or directory”
When running ORB_SLAM3, I encountered the error “libpng12.so.0: cannot open shared object file: No such file or directory”. Execute the command “sudo apt install libpng12-0” to install libpng12.so.0 and solve the problem.
The command log of the error:

/proj/hankf/slam/ORB_SLAM3$ ./Examples/Stereo/stereo_euroc ./Vocabulary/ORBvoc.txt ./Examples/Stereo/EuRoC.yaml /proj/hankf/hankf/slam/euroc-mav-dataset/MH_04_difficult ./Examples/Stereo/EuRoC_TimeStamps/MH04.txt dataset-MH04_stereo
./Examples/Stereo/stereo_euroc: error while loading shared libraries: libpng12.so.0: cannot open shared object file: No such file or directory

Installed command record

hankf@XSZGS4:/proj/hankf/hankf/slam/opencv-4.5$ sudo apt install libpng12-0
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  libpng12-0
0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
Need to get 0 B/116 kB of archives.
After this operation, 285 kB of additional disk space will be used.
Selecting previously unselected package libpng12-0:amd64.
(Reading database ... 315713 files and directories currently installed.)
Preparing to unpack .../libpng12-0_1.2.54-1ubuntu1.1_amd64.deb ...
Unpacking libpng12-0:amd64 (1.2.54-1ubuntu1.1) ...
Setting up libpng12-0:amd64 (1.2.54-1ubuntu1.1) ...
Processing triggers for libc-bin (2.27-3ubuntu1.4) ...

[Solved] Windows ADB devices port is occupied error: cannot connect to daemon

Windows ADB devices reports an error cannot connect to daemon because the port is occupied

Solution:

1. View the port occupation process

netstat -ano |findstr 5037

2. View the program corresponding to the process

tasklist |findstr 23568

3. Upon investigation, tadb was found Exe, Tencent computer manager is installed on the computer, and this program will be generated when he connects to the mobile device, so you need to kill this process, use taskkill, and use taskkill /?View its usage

C:\Users\Rivamed001>TASKKILL /?

TASKKILL [/S system [/U username [/P [password]]]]
         { [/FI filter] [/PID processid | /IM imagename] } [/T] [/F]
Description:
    Use this tool to terminate a task by process ID (PID) or image name.
Parameter list:
    /S system Specifies the remote system to connect to.
    /U [domain\]user Specifies the user context in which this command should be executed.
    /P [password] Specifies the password for the supplied user context. If ignored, prompt for
                           Enter.
    /FI filter Applies a filter to select a group of tasks.
                           The use of "*" is allowed. For example, image name eq acme*
    /PID processid Specifies the PID of the process to be terminated.
                           Use TaskList to obtain the PID.
    /IM imagename Specifies the image name of the process to be terminated. The wildcard '*' can be used to
                           Specify all task or image names.
    /T Terminates the specified process and the child processes enabled by it.
    /F Specifies to force the termination of the process.
    /F                    Displays a help message.

Filter:
    Filter name Valid operators Valid values
    ----------- --------------- -------------------------
    STATUS eq, ne RUNNING |
                                            NOT RESPONDING | UNKNOWN
    IMAGENAME eq, ne Image name
    PID eq, ne, gt, lt, ge, le PID value
    SESSION eq, ne, gt, lt, ge, le Session number.
    CPUTIME eq, ne, gt, lt, ge, le CPU time in the format
                                            hh:mm:ss.
                                            hh - hours, mm - minutes, ss - seconds.
                                            mm - minutes, ss - seconds
    MEMUSAGE eq, ne, gt, lt, ge, le memory usage in KB
    USERNAME eq, ne user name in the format [domain\]user
    MODULES eq, ne DLL name
    SERVICES eq, ne service name
    WINDOWTITLE eq, ne window title
    Description
    ----
    1) The /IM toggle can only use the wildcard '*' if a filter is applied.
    2) Remote processes always have to be forcibly (/F) terminated.
    3) The "WINDOWTITLE" and "STATUS" filters are not supported when specifying a remote machine.

For example:
    TASKKILL /IM notepad.exe
    TASKKILL /PID 1230 /PID 1241 /PID 1253 /T
    TASKKILL /F /IM cmd.exe /T
    TASKKILL /F /FI "PID ge 1000" /FI "WINDOWTITLE ne untitle*"
    TASKKILL /F /FI "USERNAME eq NT AUTHORITY\SYSTEM" /IM notepad.exe
    TASKKILL /S system /U domain\username /FI "username ne NT*" /IM *
    TASKKILL /S system /U username /P password /FI "IMAGENAME eq note*"

Access denied during use

The reason is: the permission is not enough. Open CMD with administrator permission

4. Finally, the device is successfully connected

[Solved] Weblogic error: java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11G

Error message: Java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11G

After looking at the background, locate the error code as follows

//Save a thumbnail image locally
BufferedImagesrc=ImageIO.read(file2);
FilelocalDir=newFile(GlobalConstants.SAVE_PATH+GlobalConstants.SMALL_IMAGE_SAVE_PATH);
if(!localDir.exists()){
    localDir.mkdirs();
}
//The following code starts reporting errors
BufferedImageoutImg=newBufferedImage(60,60,BufferedImage.TYPE_INT_RGB);
outImg.getGraphics().drawImage(src,0,0,60,60,null);

Solution:

Open the setDomainEnv.sh configuration file under the weblogic domain service bin

Add parameters in the following positions:

JAVA_OPTIONS="${JAVA_OPTIONS} -Djava.awt.headless=true " ​
export JAVA_OPTIONS

[Solved] Vue Project Error: Invalid prop: custom validator check failed for prop “percentage”.

1.Question:

The progress bar component using elementui in Vue reports an error

2. The error information is as follows:

vue.runtime.esm.js:619 [Vue warn]: Invalid prop: custom validator check failed for prop "percentage".

found in

---> <ElProgress> at packages/progress/src/progress.vue
       <AllStoreStatisticsDialog> at src/components/vdialog/dialog/Baomu/AllStoreStatisticsDialog.vue
         <Dialog> at src/components/vdialog/VDialog.vue
           <DialogGroup> at src/components/vdialog/vDialogGroup.vue
             <App> at src/views/SYS/App.vue
               <App> at src/App.vue
                 <Root>

3. Causes and Solutions

The original code is as follows

<el-progress :percentage="percentage" :color="customColor"></el-progress>

reason:

The percentage attribute value set exceeds 100, and the value range of percentage is 0-100

Solution:

When assigning the percentage attribute, just make a ternary operation judgment. The code is as follows

<el-progress :percentage="percentage>100?100:percentage" :color="customColor"></el-progress>

jenkins Build Error: “‘: Failed to establish a new connection: [Errno -2] Name or service not known'”

Problem phenomenon

An error is reported when an interface request is initiated in Jenkins container:

Analysis

Report that the host cannot be obtained. Ping the host domain name in the Jenkins container (if Ping is not installed, install the Ping tool first). If the Ping fails, it indicates that the network connection configuration is wrong

Solution:

A new line of configuration is added to/etc/hosts in Jenkins container. The format is: host IP address domain name

If necessary, check testerhome Com initiates a request, first use the ping command to determine the IP, and then edit it into the hosts file

Precautions

After restarting the container each time, the hosts file will be initialized, resulting in the invalidation of the previously added configuration. You can continue to add
after restarting

docker exec -it -u root 647bf755ba2e /bin/bash -c "echo -e $loccalhost_ip $domain1 $domain2 >> /etc/hosts"

[Solved] ShardingJDBC Error: The bean ‘dataSource’, defined in class path resource [org/apache/shardingsphere/shardingjdbc/spring/boot/SpringBootConfiguration.class], could not be registered.

Error message

This means that there is already a bean with the same name in springboot, and rewriting this bean is not allowed

***************************
APPLICATION FAILED TO START
***************************

Description:

The bean 'dataSource', defined in class path resource [org/apache/shardingsphere/shardingjdbc/spring/boot/SpringBootConfiguration.class], could not be registered. A bean with that name has already been defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class] and overriding is disabled.

Action:

Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true

Solution:

In application Add the following configuration in properties: it is allowed to rewrite duplicate beans and overwrite the previous bean

spring.main.allow-bean-definition-overriding=true