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=…”);
div>
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 ol>
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
},
Dirsearch URL batch scan error
An error is reported when scanning the crawled web address in batch. The error is as follows:
in line 92 of Lib/core/scanner.py
first_response.body.decode()
Change to
first_response.body.decode('GBK')
Fallbackfactory error report solution
vengeance nested exception is java.lang.IllegalStateException: No
fallbackFactory instance of type class xxx.xx.xxx.fallback.XxxFallback found for feign client
The solution is:
@Component adds this notion:
Error report of covertotraditional conversion from simplified to traditional
Following the online teacher’s learning, I typed a simplified traditional Chinese conversion code as follows:
found the seventh line of code error, and moved the mouse to the code. The method covertotraditional (string) is undefined for the type zhconverterutil. In fact, it’s a jar package error. The zhconverterutil class in the jar package has no coverttotraditional method
we just need to change coverttotraditional to totraditional to complete the conversion from simplified to traditional Chinese
summary: if you report any error in this aspect in the future, you can go to the jar package to see if there is such a method.
Java error invaliddefinitionexception
Scenario: this error occurs when transferring parameters between springcloud and seat microservices. A service has the function of uploading files,
Service B needs to call the upload file interface of service A. there is a common parent class reference C between a and B.
The method defined in C is
| @RequestMapping(“/file/upload”) public R uploadFile(MultipartFile file); td> |
The method defined in a is
| @RequestMapping(“/file/upload”) public R uploadFile(MultipartFile file){ … } |
Call statements defined in B
| b.uploadFile(file); td> |
After writing in this way, report an error, such as the title
Add the annotation @ requestparam before the request parameter file in methods a and C.
div>
Failed to retrieve platformtransactionmanager for @ transactional test: [defaulttest]
Foreword: This is JUnit test class. I hope that the data can be rolled back after the test, and the previous data will not be affected. But I have no problem in other tutorials. I report an error, and then I check a lot of data, but it is fruitless. Finally, I solve it by myself
Error message: java.lang.illegalstateexception: failed to retrieve platformtransactionmanager for @ transactional test
java.lang.IllegalStateException: Failed to retrieve PlatformTransactionManager for @Transactional test: [DefaultTestContext@6356695f testClass = SystemServiceTest, testInstance = com.****.****.oc.coresystem.service.SystemServiceTest@716f94c1, testMethod = update@SystemServiceTest, testException = [null], mergedContextConfiguration = [WebMergedContextConfiguration@4f18837a testClass = SystemServiceTest, locations = '{}', classes = '{class com.****.****.Application, class com.****.****.Application}', contextInitializerClasses = '[]', activeProfiles = '{dev}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}', contextCustomizers = set[org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@4d3167f4, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@87f383f, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@5891e32e, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@42607a4f], resourceBasePath = 'src/main/webapp', contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map['org.springframework.test.context.web.ServletTestExecutionListener.activateListener' -> false]]
at org.springframework.util.Assert.state(Assert.java:94) ~[spring-core-5.1.18.RELEASE.jar:5.1.18.RELEASE]
at org.springframework.test.context.transaction.TransactionalTestExecutionListener.beforeTestMethod(TransactionalTestExecutionListener.java:185) ~[spring-test-5.1.18.RELEASE.jar:5.1.18.RELEASE]
at org.springframework.test.context.TestContextManager.beforeTestMethod(TestContextManager.java:291) ~[spring-test-5.1.18.RELEASE.jar:5.1.18.RELEASE]
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74) [spring-test-5.1.18.RELEASE.jar:5.1.18.RELEASE]
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86) [spring-test-5.1.18.RELEASE.jar:5.1.18.RELEASE]
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84) [spring-test-5.1.18.RELEASE.jar:5.1.18.RELEASE]
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) [junit-4.12.jar:4.12]
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:251) [spring-test-5.1.18.RELEASE.jar:5.1.18.RELEASE]
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97) [spring-test-5.1.18.RELEASE.jar:5.1.18.RELEASE]
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) [junit-4.12.jar:4.12]
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) [junit-4.12.jar:4.12]
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) [junit-4.12.jar:4.12]
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) [junit-4.12.jar:4.12]
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) [junit-4.12.jar:4.12]
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) [spring-test-5.1.18.RELEASE.jar:5.1.18.RELEASE]
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) [spring-test-5.1.18.RELEASE.jar:5.1.18.RELEASE]
at org.junit.runners.ParentRunner.run(ParentRunner.java:363) [junit-4.12.jar:4.12]
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190) [spring-test-5.1.18.RELEASE.jar:5.1.18.RELEASE]
at org.junit.runner.JUnitCore.run(JUnitCore.java:137) [junit-4.12.jar:4.12]
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69) [junit-rt.jar:na]
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33) [junit-rt.jar:na]
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:220) [junit-rt.jar:na]
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:53) [junit-rt.jar:na]
The core reason for this problem in my project is that I have three different data sources in this large project, and JUnit does not know which data source transaction you want to roll back! It requires you to specify a platform transaction manager
Configuration of one of the primary data sources:
The test class then specifies the transactionmanager
Re run the test method, the problem is solved!
div>
Unhandled project rejection type error: webassembly instance
Today, I created a new small program project in wechat developer tool
but when I opened it, such a bug appeared
which made me feel very confused
Unhandled promise rejection TypeError: WebAssembly Instantiation: Argument 0 must be a buffer source or a WebAssembly.Module object

It was very uncomfortable
I went to the wechat developer community and asked
it turned out that the default version of the basic debugging library was too high, which led to an error
A simple solution
Click the details button in the upper right corner
and select local settings
to adjust the basic debugging library back to 2.14.4

[JS] use date. Now(). Tostring() to generate serial number
Date. Now() returns the number of milliseconds from 00:00:00 (UTC) on January 1, 1970 to the current time.
console.log(Date.now());
output: 1623740295900
type is number,
tostring() method returns string type.