Decorative image frame

Solito

Buring silence in SHA.

Solito

PyQt Learning & Practice

Install

1
2
3
4
5
6
7
8
9
$ pip install PyQt5
Collecting PyQt5
Downloading https://files.pythonhosted.org/packages/43/cf/f89c7e632014cb8725fc30b36292ca709a5b5598e4e99fff09cb677fc898/PyQt5-5.15.1-5.15.1-cp35.cp36.cp37.cp38.cp39-none-win32.whl (51.2MB)
|████████████████████████████████| 51.2MB 117kB/s
Collecting PyQt5-sip<13,>=12.8 (from PyQt5)
Downloading https://files.pythonhosted.org/packages/69/eb/bb296c8a96eadacd5e91df3f5d600d9e4727b90e8b010cb86e146f995ce4/PyQt5_sip-12.8.1-cp37-cp37m-win32.whl (50kB)
|████████████████████████████████| 51kB 233kB/s
Installing collected packages: PyQt5-sip, PyQt5
Successfully installed PyQt5-5.15.1 PyQt5-sip-12.8.1
Read More...

Sonar Fix (Java backend)

This is a record for sonar fixing for backend based on Java.

CERT issues

Extract this increment or decrement operator into a dedicated statement.

Rule: Increment (++) and decrement (–) operators should not be used in a method call or mixed with other operators in an expression

1. original code:
1
2
u8a = ++u8b + u8c--;
foo = bar++ / 4;
Read More...

Skip html labels in JS

1
str = str.replace(/<[^<>]+>/g, '');

sample:

1
2
3
4
var error = "<html><head><title>Error</title></head><body>Unauthorized</body></html>";
error = error.replace(/<[^<>]+>/g, '');
console.log(error);
// print ErrorUnauthorized

Sonar Fix (node.js backend)

This is a record for sonar fixing for backend based on node.js.

Security Hotspots

Security Hotspots aren’t necessarily issues, but they need to be reviewed to make sure they aren’t vulnerabilities.

Make sure that using a regular expression is safe here

Rule: Using regular expressions is security-sensitive

1. original code:
1
let re = /^\d+(\.\d+)?$/;

the rule recommend not using group() to reduce evaluate work load. 个人理解是,group内外都有\d+,可能有重复校验的问题

Read More...

3PP Upgrade

This is a record for my work to product 3pp upgrade.

Preparation

log on a host server to build docker image and test deployment:

  • log on a jump server first
  • ssh e-id@seroius01502

use xxxx/xxx-compiler(cdt2 image) to build frontend
use xxx/xxx-base(node image) to build backend

Compiler (frontend, cdt2) debugging

Run upgraded cdt2+node images as a container first:

1
2
$ docker run --rm -it -d --mount type=bind,src=/home/eshibij/cec-3pp-upgrade,dst=/usr/share sekidocker.rnd.ki.sw.ericsson.se/bolte/bcam/bcam-compiler:cdt_2.6.1-node_14.5 cat
e2849d6f818cb1ccacc1ce58c41d2695d0315b60b37f976c221397a997a856a2

[–rm](https://blog.csdn.net/nzjdsds/article/details/8hexo 1981732): clean up
-it: wait for container cmds to be executed
-d: run in background and return container id
–mount: https://blog.csdn.net/longlong6682/article/details/104730138
cat: seems like catting the container id

Read More...

Request API

Request used in send request to other domain.
https://blog.csdn.net/wuqingdeqing/article/details/99061026
https://blog.csdn.net/miss1128726/article/details/49976855
a basic sample of request:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
var options = {
uri: 'http://api.example.fr/example/1.xml',
auth: {
user: 'test',
pass: 'test',
sendImmediately: false
}
};
request(options, function(error, response, body){
if (!error && response.statusCode == 200){
console.log('body : ' + body)
}
else{
console.log('Code : ' + response.statusCode)
console.log('error : ' + error)
console.log('body : ' + body)
}
});

This method has limitation for case that expecting to send datas to more than one server. Like, I want to send xml sais to multiple bdc servers, it turns out to only transfer datas to the last bdc. (using request(options, responseHandler)

Read More...

Timeout in Node.JS

Thanks for answers in https://stackoverflow.com/questions/6214902/how-to-set-a-timeout-on-a-http-request-in-node
The problem can mainly divided into two part in my implemention:

  • connection timeout
  • response timeout
  1. connection timeout
    On request stage:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    // set the desired timeout in options
    const options = {
    //...
    timeout: 3000,
    };
    // create a request
    const request = http.request(options, response => {
    // your callback here
    });
    // use its "timeout" event to abort the request
    request.on('timeout', () => {
    request.abort();
    });
    Read More...

Tips when using postgresql

[ERROR] column “xxx” does not exist

This issue happens when run db=> select * from "ExxJobs" where status="Ongoing";
It returns

1
2
3
4
5
6
ERROR:  column "Ongoing" does not exist
LINE 1: select * from "ExxJobs" where status="Ongoing";
^
ERROR: column "ongoing" does not exist
LINE 1: select * from "ExxJobs" where status=Ongoing;
^

Solution
just change “” to ‘’.

1
2
3
4
5
db=> select * from "ExxJobs" where status='Ongoing';
id | type| xxxJobId | xxxJobUrl | status | errorMessage | createdAt | updatedAt
----+-----------------+----------+--------------------------------------------------------------------------------------------------------+---------+--------------+----------------------------+----------------------------
16 | ... | 22947534 | {"..."} | Ongoing | | 2020-05-18 06:17:32.525+00 | 2020-05-18 06:17:32.544+00
(1 row)

similarly:

1
2
3
4
5
6
cecdb=> delete from "ExxJobs" where 'xxxJobId'=22674314;
ERROR: invalid input syntax for integer: "xxxJobId"
LINE 1: delete from "ExxJobs" where 'xxxJobId'=22674314;

db=> delete from "ExxJobs" where "xxxJobId"='22674314';
DELETE 1

docker errors in daily use

Error1

  • Steps to reproduce the error:

    1
    2
    $ kubectl get pods -A
    Unable to connect to the server: EOF

    According to this answer, I tried

    1
    2
    $ docker ps -a --filter name=k8s_kubedns_kube-dns --format "table {{.ID}}\t{{.Image}}"
    Error response from daemon: open \\.\pipe\docker_engine_linux: The system cannot find the file specified.
    1
    2
    3
    4
    5
    6
    7
    8
    $ docker ps
    Error response from daemon: open \\.\pipe\docker_engine_linux: The system cannot find the file specified.
    $ docker info
    Client:
    Debug Mode: false
    Server:
    ERROR: Error response from daemon: open \\.\pipe\docker_engine_linux: The system cannot find the file specifie d.
    errors pretty printing info

    Search for Error response from daemon, I found this issue same to mine

    Read More...