Author Archives: Robins

[Solved] QuestDB Exception–ERROR: Cannot insert rows out of order.

I am trying to migrate the data and insert the history into QuestDB. I create the table as

create table records(
type INT,
interval INT,
timestamp TIMESTAMP,
name STRING) timestamp(timestamp)

And inserts data through JDBC.

1. Question details

I received the error “cannot insert rows out of order”. I read that QuestDB supports are out of order, but somehow I can’t make it work.

Caused by: org.postgresql.util.PSQLException: ERROR: Cannot insert rows out of order. Table=/root/.questdb/db/dwd_robot_running_data
	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2674)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2364)
	... 19 more

2. Cause of problem

You can only insert rows in the partitioned table out of order, create a new partitioned table and copy the data into it

3. Solution

Adding partitions during table creation

create table records2(
 type INT,
 interval INT,
 timestamp TIMESTAMP,
 name STRING
) 
timestamp(timestamp) partition by DAY

insert into records2
select * from records

drop table records

rename table records2 to records

After that, you can insert out of order into the table records

[Solved] Fatal Python error: initfsencoding: Unable to get the locale encoding

Error Message:

Fatal Python error: initfsencoding: Unable to get the locale encoding

ModuleNotFoundError: No module named 'encodings'

 

Solution:

#1.unset
unset PYTHONHOME
unset PYTHONPATH
#2.update pip
python -m pip install --upgrade pip

Then it can be solved.

pip install decord failed. The reason is that pip has a problem. After the update, it is installed normally

[Solved] E Sub-process usrbindpkg returned an error code (1)

1. The problems are as follows:

An error was reported when installing the software

dlz@ubuntu:~$ sudo apt install wireshark-qt

2. Solution

The code is as follows (example):

root@ubuntu:~# sudo mv /var/lib/dpkg/info /var/lib/dpkg/info_old
root@ubuntu:~# sudo mkdir /var/lib/dpkg/info
root@ubuntu:~# sudo apt-get update
Hit:1 http://mirrors.ustc.edu.cn/ubuntu focal InRelease
Hit:2 http://mirrors.ustc.edu.cn/ubuntu focal-updates InRelease                
Hit:3 http://mirrors.ustc.edu.cn/ubuntu focal-backports InRelease              
Hit:4 http://mirrors.ustc.edu.cn/ubuntu focal-security InRelease               
Hit:5 http://ppa.launchpad.net/linrunner/tlp/ubuntu focal InRelease            
Reading package lists... Done
root@ubuntu:~# sudo apt-get -f install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 518 not upgraded.
3 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
Setting up wireshark-common (3.2.3-1) ...
Setting up wireshark-qt (3.2.3-1) ...
Setting up wireshark (3.2.3-1) ...
root@ubuntu:~# sudo mv /var/lib/dpkg/info/* /var/lib/dpkg/info_old
root@ubuntu:~# sudo rm -rf /var/lib/dpkg/info
root@ubuntu:~# sudo mv /var/lib/dpkg/info_old /var/lib/dpkg/info
root@ubuntu:~# 

[Solved] YOLOv5 Error: SyntaxError: EOL while scanning string literal

1. Error details

When running the detect.py file of YOLOv5 module, the following error occurs:

Complete error reporting code:

  File "C:\Projects\pythonProject\yolov5-5.0\detect.py", line 110
    with open(txt_path + '.txt', 'a') as f:
                                           ^
SyntaxError: EOL while scanning string literal

This problem occurs because detect.py encoding error

2.Solution

Delete the two lines of code at the top of the file, and the problem can be solved and detected.

# -*- coding : utf-8-*-
# coding:unicode_escape

[Solved] docker Error response from daemon driver failed programming external connectivity on endpoint lamp

Docker containers do port mapping error:

docker: Error response from daemon: driver failed programming external connectivity on endpoint lamp3 (46b7917c940f7358948e55ec2df69a4dec2c6c7071b002bd374e8dbf0d40022c): (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 86 -j DNAT --to-destination 172.17.0.2:80 ! -i docker0: iptables: No chain/target/match by that name.

 

Solution:

The custom chain DOCKER defined at the start of the docker service is cleared

Restart and it will be OK! systemctl restart docker

[Solved] cv2.error: OpenCV(4.5.3) :-1: error: (-5:Bad argument) in function ‘circle‘

Here, I operate on the image

import cv2
import numpy as np
img=cv2.imread('a.jpg',cv2.IMREAD_GRAYSCALE)
row,col=img.shape[:2]
print(row,col)
circle=np.zeros((row,col),dtype='uint8')
cv2.circle(circle,(row/2,col/2),100,255,-1)
result=cv2.bitwise_and(img,circle)
cv2.imshow('a',img)
cv2.imshow('circle',circle)
cv2.imshow('result',result)
cv2.waitKey(0)
cv2.destroyAllWindows()

An error is found during operation, as shown in the following figure

The error reported is a type error, which makes it impossible to analyze the coordinates of the center of the circle. This is mainly because our center coordinate is obtained by dividing the width and height of the picture by two. It is of float type, and the others are of int type. We can convert the center coordinate type to int type

cv2.circle(circle,(row//2,col//2),50,255,-1)

The results after operation are shown in the following figure:

 

[Solved] Django Configurate celery error: django.db.utils.DatabaseError

Error on execution of asynchronous task: 

django.db.utils.DatabaseError: DatabaseWrapper objects created in a thread can only be used in that same thread. The object with alias ‘default’ was created in thread id 3047101641304 and this is thread id 3047208084584.

 

Solution:

Original start command (under Windows):
celery -A xxx worker -l info -P eventlet (xxx is the project name)
Modified start command, celery version 4x:
celery -A xxx worker -l info -P solo

Mac: make: *** [Zend/zend_language_parser.lo] Error 1

Error reporting content:

/Users/dre0m1/CTF/Study_notes/PHP_source_code/php-src/Zend/zend_language_parser.y:1317:5: error: implicit declaration of function 'yystpcpy' is invalid in C99 [-Werror,-Wimplicit-function-declaration]

                                yystpcpy(yyres, "end of file");

                                ^

/Users/dre0m1/CTF/Study_notes/PHP_source_code/php-src/Zend/zend_language_parser.y:1317:5: note: did you mean 'stpcpy'?

/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/string.h:130:7: note: 'stpcpy' declared here

char    *stpcpy(char *__dst, const char *__src);

         ^

/Users/dre0m1/CTF/Study_notes/PHP_source_code/php-src/Zend/zend_language_parser.y:1324:29: error: implicit declaration of function 'yystrlen' is invalid in C99 [-Werror,-Wimplicit-function-declaration]

                yystr_len = (unsigned int)yystrlen(yystr);

                                          ^

/Users/dre0m1/CTF/Study_notes/PHP_source_code/php-src/Zend/zend_language_parser.y:1324:29: note: did you mean 'strlen'?

/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/string.h:82:9: note: 'strlen' declared here

size_t   strlen(const char *__s);

         ^

/Users/dre0m1/CTF/Study_notes/PHP_source_code/php-src/Zend/zend_language_parser.y:1345:4: error: implicit declaration of function 'yystpcpy' is invalid in C99 [-Werror,-Wimplicit-function-declaration]

                        yystpcpy(yyres, buffer);

                        ^

/Users/dre0m1/CTF/Study_notes/PHP_source_code/php-src/Zend/zend_language_parser.y:1352:10: error: implicit declaration of function 'yystrlen' is invalid in C99 [-Werror,-Wimplicit-function-declaration]

                return yystrlen(yystr) - (*yystr == '"' ?2 : 0);

                       ^

/Users/dre0m1/CTF/Study_notes/PHP_source_code/php-src/Zend/zend_language_parser.y:1365:2: error: implicit declaration of function 'yystpcpy' is invalid in C99 [-Werror,-Wimplicit-function-declaration]

        yystpcpy(yyres, yystr);

        ^

5 errors generated.

make: *** [Zend/zend_language_parser.lo] Error 1

Implicit declaration of function ‘yystpcpy’ is invalid in C99. Looking up information on the Internet, we can find that this error type is related to the header file or the previous define. From the prompts in the error report, we can see that the function yystpcpy is missing.

Access the file php-src/Zend/zend_language_parser.c. You can see this code below:

Add the definitions of yystpcpy and yystrlen to it, guess that their original functions should be stpcpy and strlen functions: re-make after modification, and compile successfully.

[>]

1. Questions 

[<twisted.python.failure.Failure < class  ' OpenSSL.SSL.Error ' >>]

solution:

If it is under Windows, the corresponding version of pyOpenSSL needs to be additionally installed. For example, pyOpenSSL- 0.13 .winxp32-py2. 7 .msi; if it prompts that there are no compiled files, you may also need to install mingwg. 
If it is under Linux, it is very simple, just pip install scrapy directly, it will automatically install the dependent package twisted. Using the same command under windows will cause the above problem, so additionally install the corresponding software.