Lambda set to map duplicate key error solution

  If the same key exists in this method, an error will be reported

Map<String,JKStackRedEx> result = v.stream().collect(Collectors.toMap(a->a.getManuId(),a->a));

The following method can be used to avoid error reporting. The parameter returned by return can specify which value to use to override value1 or Value2

Map<String,JKStackRedEx> result = v.stream().collect(Collectors.toMap(a->a.getManuId(),a->a, (value1, value2) -> {
    return value2;
}));

You can also use multiple attributes to splice keys

Map<String,JKStackRedEx> result = v.stream().collect(Collectors.toMap(a->a.getManuId().concat(a.getStackingNum()),a->a, (value1, value2) -> {
                    return value2;
                }));

 

No module named numpy error in Python code

Generally, numpy is installed in “control panel + CMD”

Enter “PIP install numpy” in the command line window

The numpy installed at this time is not in the directory line of Python

No module named numpy will report an error, even if “import numpy as numpy” is imported at the beginning of the python program

2. Solutions:

(1) It is to directly find the python installation location in the DOS window and directly enter the “PIP install numpy” statement

Enter enter and wait for installation

(2) Is it mandatory to download the latest version after installation

Find the installation location of Python in DOS window, and input “PIP install numpy — ignore installed numpy” statement

Will be forced to reload in a new location, this is to install the numpy package into python

Note that the following statement is entered in the win system

If you want to build a Linux system, you should add more “sudo” fields in front of it

Namely: “sudo PIP install numpy — ignore installed numpy”

This chapter is my opinion, let’s make progress together

When websocket transmits JSON text, the parse method reports an error

When using websocket to push the JSON data to the front end, websocket needs to convert the JSON data into a string for transmission. In the front end, JavaScript is used to restore the text to a JSON object. Generally, the JSON. Paser () method is used to complete this work. However, in the actual transmission, there is a problem. The JSON. Parse() method always reports an error

Uncaught SyntaxError: Unexpected token ‘ in JSON at position 1
    at JSON.parse (< anonymous>)
    at WebSocket.ws.onmessage ((index):28)

After checking and comparing, it is found that in the process of transferring string by websocket, double quotation marks in string are replaced by single quotation marks, while JSON. Parse() method requires double quotation marks in string. After finding this reason, it is easy to solve it. Before parse conversion, single quotation marks in string are replaced by double quotation marks.

ws.onmessage = function (evt) {
       
        var a = evt.data.replace(/'/g, '"');
        var obj = JSON.parse(a);
        .....
       
       

 
 

Invalid cluster ID. ignore in building Doris database environment

This problem bothered me for five days, and for several days I fought hard into the night. I don’t want to eat all day long, but I finally solved it. Because there is little information on the Internet, I’d like to record here. If you have any questions about Doris, please exchange them~

The error information is as follows:

waiting to receive first heartbeat from frontend
waiting to receive first heartbeat from frontend
waiting to receive first heartbeat from frontend
waiting to receive first heartbeat from frontend
waiting to receive first heartbeat from frontend
master client, get client from cache failed.host: , port: 0, code: 7
invalid cluster id. ignore

View the result returned under be node in Fe node:

+-----------+-----------------+------------+------------+---------------+--------+----------+----------+---------------+---------------+-------+----------------------+-----------------------+-----------+------------------+---------------+---------------+---------+----------------+-----------------------------+---------+---------------------------+
| BackendId | Cluster         | IP         | HostName   | HeartbeatPort | BePort | HttpPort | BrpcPort | LastStartTime | LastHeartbeat | Alive | SystemDecommissioned | ClusterDecommissioned | TabletNum | DataUsedCapacity | AvailCapacity | TotalCapacity | UsedPct | MaxDiskUsedPct | ErrMsg                      | Version | Status                    |
+-----------+-----------------+------------+------------+---------------+--------+----------+----------+---------------+---------------+-------+----------------------+-----------------------+-----------+------------------+---------------+---------------+---------+----------------+-----------------------------+---------+---------------------------+
| 16006     | default_cluster | 172.17.0.2 | 172.17.0.2 | 9050          | -1     | -1       | -1       | NULL          | NULL          | false | false                | false                 | 0         | .000             | 1.000 B       | .000          | 0.00 %  | 0.00 %         | invalid cluster id. ignore. |         | {"lastStreamLoadTime":-1} |
+-----------+-----------------+------------+------------+---------------+--------+----------+----------+---------------+---------------+-------+----------------------+-----------------------+-----------+------------------+---------------+---------------+---------+----------------+-----------------------------+---------+---------------------------+

Problem solving:

Delete be under/storage/cluster_ ID
Restart be.

Cause of the problem:

Refer to the official document

it may be that the Fe node has been rebuilt many times, resulting in cluster failure_ If the ID recorded in the ID file is incorrect, deleting the file and restarting be will generally solve the problem.

Note: if it is only port: 0, code: 7, please use telnet to check the connectivity of container port.

No route info solution for rocketmq error reporting

Possible problems:

1. If the rocketmq storage folder is not created, the broker log will also report an error

2. If the topic is not automatically created, the IP accessed at startup is different from the IP in broker.config configuration, and an error will be reported.

 nohup sh mqbroker -n localhost:9876 autoCreateTopicEnable=true &

3. If the client version is inconsistent with the MQ version, an error may be reported

Wechat applet background image error

In the development process, the background image is set by using background, and the error is reported as follows

Cause of error:   Wechat applet sets background through background image: only supports online pictures and Base64 pictures, not local pictures.

Solution: 1. Put pictures on the server and use online pictures

2. The steps of Base64 image setting are as follows:

2-1 on the website http://imgbase64.duoshitong.com/ Convert image to text in Base64 format

2-2 use the above text in wxss:

background- image:url (“ data:image/png; base64,iVBORw0KGgo=…”);

 

Record the python package EXE file running error importerror, but do not prompt specific error solution

Problem Description:
I made a program, the main program is osrr.py, which imports the other two files excela.py and excelb.py. When I run in visual studio, the program can run normally, but after I use pyinstaller to package it into a separate EXE file, the operation will report an error of “importerror”, but there is no prompt to import which name, The packing command is: pyinstall – F osrr.py – P excela.py – P excelb.py — hidden import excela — hidden import excelb. The error is as shown in the figure below

Problem solving process:
when I didn’t create a new excelb.py, osrr.py and excel.py can be packaged normally. When I created a new excelb and imported it into osrr.py, an error was reported. So I created a new project in excelb.py and imported it into osrr.py. After that, an error was also reported, as shown in the figure below

I deleted all the imports in test1.py, and then tried them one by one, and found that there was a problem with this string of codes:
from pynput.keyboard import key, controller, but the code I wrote ran directly in vs without any error, so I could run normally.

Solution:
I found an article on the Internet, which introduced the reasons and solutions (I’m sorry I didn’t know how to blog before, but I can’t find that article after I finally found this function, I’m sorry for the old brother of the original author)
the cause of the problem is the version of pynput. If the latest version 1.7.3 is installed, the above problems will appear when using the package. Use “PIP install pynput” to uninstall the package, and then use the command “PIP install pynput = = 1.6.8” to install version 1.6.8. After the installation is completed, no error will be reported whether the package exe program or running directly in vs.

Solution of Greenplum query calling function error

We may often encounter the need to call custom functions in query, but in Greenplum, if you have query in the function and then call the function in query, you will report it wrong.

Example:
create function

iap=# create or replace function f1() returns text as $$
declare
c1 text;
begin
execute 'select info from tt1 limit 1' into c1;
return c1;
end;
$$ language plpgsql;

Invocation in query:

iap=# select f1() from tt1;
ERROR:  query plan with multiple segworker groups is not supported
HINT:  likely caused by a function that reads or modifies data in a distributed table
CONTEXT:  SQL statement "select info from tt1 limit 1"
PL/pgSQL function f1() line 5 at EXECUTE statement

This is due to the feature of MPP in greenplus. Only part of the data is saved in each node. GP6 supports copying tables. Then we need to change the table into a copying table to ensure that each node has a complete data.

In addition, we need to modify the function to immutable.

Change the table distribution to replicated type

iap=# alter table tt1 set Distributed REPLICATED;
ALTER TABLE

– modify the function to immutable type

iap=# create or replace function f1() returns text as $$
declare
c1 text;
begin
execute 'select info from tt1 limit 1' into c1;
return c1;
end;
$$ language plpgsql immutable;
CREATE FUNCTION

Call again:

iap=# select f1() from tt1 limit 1;
                f1
----------------------------------
 d810ed19ec188ddf3af8a14dbd341c3c
(1 row)

Summary:
, if you need to call UDF function in query, if you encounter “ERROR: query plan with multiple segworker groups is is,” then the solution is as follows:

    modify table to copy table; Modify the function to immutable type

Error analysis of queryformap method of jdbctemplate

  The queryformap method of jdbctemplate reported an error   If the queryformap method is not used properly, an error will occur  

The queryForMap method in JdbcTemplate only expects a single row to be returned, The return value for this method will be a map of column names to column values for the single result row.

The size of the result set returned by the queryformap method must be 1. In the returned map, the name of the column is used as the key and the value obtained is used as the value  

public void test() {
   String SQL_GET_ATTRIBUTE = "select * from test where rownum<1";
   Map<Object, Object> map = getJdbcTemplate().queryForMap(SQL_GET_ATTRIBUTE);
   Set<Entry<Object, Object >> entrySet = map.entrySet();
   for (Entry < Object, Object > entry :entrySet){
        System.out.println("key is "  + entry.getKey());
        System.out.println("value is "  + entry.getValue());
   }
}

The output will list all the fields of test as key, and the queried value is vlaue. Here, Oracle database is used, and “where rownum & lt; 1 “to restrict the return of only one line.  
Using spring’s getjdbctemplate(). Queryformap, if an empty set is returned, a  
org.springframework.dao.emptyresultdataaccessexception: incorrect result size: expected 1, actual 0. The solution is to catch this exception and return null.  
java code    
 

 try{  
       return getJdbcTemplate().queryForMap("select s.fb,s.pb,s.tu,s.qt,s.fbc,s.pbc,s.tt,s.ft,s.lt from gbc$view_user s where s.ud = ? and ad= ?", new Object[]{ud,ad});  
    }catch (EmptyResultDataAccessException e) {  
        return null;  
    } 

 

Invalid Host header

Error reporting due to intranet penetration

Invalid Host header

Project root directory manifest. JSON — & gt; Source view – & gt; Add – & gt;

 		"devServer" : {
			"disableHostCheck":true
         },