Author Archives: Robins

[Solved] WordPress Error: Allowed memory size of 134217728 bytes exhausted

After the website uses Vultr for arrears, it crashes and restarts, and an error occurs:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 32768 bytes) in /www/wwwroot/******.com/wp-content/plugins/header-footer-elementor/inc/class-hfe-settings-page.php on line 422
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 32768 bytes) in /www/wwwroot/******.com/wp-content/plugins/wordpress-seo/lib/model.php on line 1

Analysis: After inspection, it is found that the memory size refers to the php cache, which is judged to be a memory overflow problem.

Solution:
1. Modify the background PHP configuration parameter memory_limit 128M to 80M
2. Service>>>Reload configuration>>>Restart>>>Refresh the browser

[Solved] MATLAB/SIMULINK Generate Codes Error: change the default character encoding setting

SIMULINK click to generate C code to report an error
Error message:
Error encountered while executing PostCodeGenCommand for model ‘RTW_sc3’: Close all block diagrams (using ‘bdclose all’) before trying to change the default character encoding setting
Caused by:
Close all block diagrams (using ‘bdclose all’) before trying to change the default character encoding setting

reason:
Caused by not setting the default encoding

 

Solution:


Add these two sentences in the initialization:

currentCharacterEncoding = slCharacterEncoding();
slCharacterEncoding('Windows-1252');

[Solved] Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder ‘custom.property.hello’ in value “${custom.property.hello}” config

Exception encountered during context initialization – cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘scopedTarget.configController’: Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder ‘custom.property.hello’ in value “${custom.property.hello}”
The JsonProperySourceLocator class in the spring cloud config source code swap is wrongly written to get the value
Modify get value to get key

[Solved] Rabbitmq startup Error: FAILED – check /var/log/rabbitmq/startup_{log, _err}

Report an error:
Starting rabbitmq-server: FAILED – check /var/log/rabbitmq/startup_{log, _err}
This way
Check the startup_log:
ERROR: epmd error for host 192: badarg (unknown POSIX error)
like this

Solution:
1. Turn off SELINUX:
Enter the command: vi /etc/selinux/config
Modify: SELINUX=disabled
2. Enter the command: vi /etc/rabbitmq/rabbitmq-env.conf
Add a line: NODENAME=rabbit@localhost
Start again successfully.
Enter the command: service rabbitmq-server start

MYSQL Error: Invalid use of group function [How to Solve]

select
	orderNumber,
	sum(priceEach * quantityOrdered) as totalvalues
from
	orderdetails
where 
	sum(priceEach * quantityOrdered) > 60000;

Error reporting reason:

This is because the aggregate function is used in the where statement.

Functions and differences between where and having:
Where is a constraint declaration that constrains the query conditions in the database before the result of the query is returned, that is, it works before the result is returned, and “aggregate function” cannot be used after where, because the execution order of where is before the aggregate function.

Having is a filtering declaration. Filtering is performed after the result of querying the database is returned, that is, it works after the result is returned, and “aggregation function” can be used after having. Note: having is used to filter the found results. You cannot use having for values that are not found. I always thought that having must be used together with group by. I tried it today. It’s just a screening condition. There’s no stress on binding.

Correct writing:

select
	orderNumber,
	sum(priceEach * quantityOrdered) as totalvalues
from
	orderdetails
group by
	orderNumber
having sum(priceEach * quantityOrdered) > 60000;

Another thing to note is that SQL syntax:

SELECT [DISTINCT|DISINCTROW|ALL] select_ expression,… — Query results
[from table_references — specify the table to query
[where where_definition] – where clause, filter criteria for query data
[group by col_name,…]– Group the query results of [matching where clause]
[having where_definition] – conditionally restrict the grouped results
[order by {unsigned_integer | col_name | formula} [ASC | desc],…]– Sort query results
[limit [offset,] rows] – limit the number of displayed results
[procedure procedure_name] – query the result set data returned by the stored procedure
]

The writing order of query statements must follow the above rules.

[Solved] Mvel user-defined function error: duplicate function

The mvel custom expression repeats and reports an error: duplicate function

Reason: the function will be cached during the first call, and the function will be prompted to repeat when calling again

Scheme: put funciton into the cache first, and call the function in the declaration cache directly when calling again

The user-defined function name should not be the same as the parameter name

Example code:

@RunWith(SpringRunner.class)
@SpringBootTest
public class MvelTest {
        
    @Test
    public void evalTest(){
        String roundup = "def roundup(num) { roundnum = null; if(num != null){ int roundnum = Math.round(num); } return roundnum; }";
        VariableResolverFactory functionFactory = new MapVariableResolverFactory();
        MVEL.eval(roundup, functionFactory);

        VariableResolverFactory resolverFactory = new MapVariableResolverFactory();
        resolverFactory.setNextFactory(functionFactory);
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("A", new BigDecimal(2.33));
        map.put("B", new BigDecimal(4));
        String exp = "roundup(A*B)";
        System.out.println(MVEL.eval(exp, map, resolverFactory));

        System.out.println("------------");

        VariableResolverFactory resolverFactory2 = new MapVariableResolverFactory();
        resolverFactory2.setNextFactory(functionFactory);
        Map<String, Object> map2 = new HashMap<String, Object>();
        map2.put("A", new BigDecimal(3.33));
        map2.put("B", new BigDecimal(2));
        System.out.println(MVEL.eval(exp, map2, resolverFactory2));
    }
}

Error code example

Add the roundup function to the cache

Successful first execution

Call again and add the roundup function to the cache again

A function in variableresolverfactory threw an exception

[Solved] No converter found for return value of type: class org.json.JSONObject

No converter found for return value of type: class org json. Jsonobject
run error:

Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; 
nested exception is java.lang.NullPointerException] with root cause
java.lang.NullPointerException:
····································

I can’t see any specific mistakes here

Go to the front page F12 and see the display: no converter found for return value of type: class.org.json.jSONObject

Layer controller code:

//    Update the Users' information
    @ResponseBody
    @RequestMapping(value = "/user/update", method = RequestMethod.POST)
    public Object updateUserMsg(HttpServletRequest req) {
        JSONObject jsonObject = new JSONObject();
        String id = req.getParameter("id").trim();
        String username = req.getParameter("username").trim();
        String password = req.getParameter("password").trim();
        String sex = req.getParameter("sex").trim();
        String phone = req.getParameter("phone").trim();
        String email = req.getParameter("email").trim();
        String birth = req.getParameter("birth").trim();
        String introduction = req.getParameter("introduction").trim();
        String location = req.getParameter("location").trim();
//        String avatar = req.getParameter("avatar").trim();
//        System.out.println(username + "  " + password + "  " + sex + "   " + phone + "     " + email + "      " + birth + "       " + introduction + "      " + location);

        if (username.equals("") || username == null) {
            jsonObject.put("code", 0);
            jsonObject.put("msg", "The Username or Password is Wrong");
            return jsonObject;
        }
        Consumer consumer = new Consumer();
        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        Date myBirth = new Date();
        try {
            myBirth = dateFormat.parse(birth);
        } catch (Exception e) {
            e.printStackTrace();
        }
        consumer.setId(Integer.parseInt(id));
        consumer.setUsername(username);
        consumer.setPassword(password);
        consumer.setSex(new Byte(sex));
        consumer.setPhone(phone);
        consumer.setEmail(email);
        consumer.setBirth(myBirth);
        consumer.setIntroduction(introduction);
        consumer.setLocation(location);
//        consumer.setAvatar(avatar);
        consumer.setUpdateTime(new Date());

        boolean res = consumerService.updateUserMsg(consumer);
        if (res) {
            jsonObject.put("code", 1);
            jsonObject.put("msg", "Modified Successfully");
            return jsonObject;
        } else {
            jsonObject.put("code", 0);
            jsonObject.put("msg", "Failed to Modified");
            return jsonObject;
        }
    }

Reason for error reporting:
java original org.json.jsonobject cannot return JSON data as a return value

solution:
requires

Introduce in POM:

<dependency>
    <groupId>com.alibaba</groupId>
    <artifactId>fastjson</artifactId>
    <version>1.2.47</version>
</dependency>

[Solved] yarn Install Module Error:check python checking for Python executable “python2” in the PATH

Problem Description: when installing with yarn, node sass reports an error, as shown in the figure

Solution:

1. Uninstall node

2. Reinstall node and be sure to check the following steps

3. After node installation, the following script will pop up automatically. Click any key to continue

Note: Python, vs Build Tools and the installation tool chocolate for windows will be installed here.

4. The script here says that chocolate will be installed, and use this tool to install other tools. Click any to continue

5. Start PowerShell to install chocolate, Python and vs build tools

different versions of node have different vs and python installed. I installed Python 3 and vs2017 build tools. Due to the local environment, they have been installed, so the screenshot is as follows

6. the installation speed of vs build tools will be very slow. Do not forcibly stop powershells, otherwise the installation of vs build tools will be incomplete </ font>

7. After the installation is successful, chocolatey installs python2 choco install python2

8. Delete node_ Modules folder, yarn cache clean clear cache, reinstall, successful!

common problem

The installed node version is node-v14.0 18.2, so Python 3 and vs2017 build tools are installed

error msb4132: unrecognized tool version "2.0". The available tool versions are "14.0", "4.0"

Reason: a higher version of vsbuildtools is installed

Solution: use chocolate to install vs2017buildtools, and enter it on the command line

choco install visualstudio2017-workload-vctools --version 1.3.3

Chocolatey is slow to install python2. You can uninstall chocolatey and reinstall

it is useless to uninstall node, because chocoloatey will not be uninstalled automatically when node is uninstalled. Find the specific method by yourself.

View all installed software in the current system, and enter choco list - Li in the command line

[Solved] python MATLAB Error: OSError: MATLAB Engine for Python supports Python version 2.7, 3.4, 3.5 and3.6, but your version of python is 3.8

Because the coordinates of broken line graph and curve graph are to be read recently, Python is used to call matlab to try, but an error is reported in this process:

The matlab2017b I use does not support Python 3 Version 8.

Solution:

I chose to create a virtual environment in anaconda.

As follows:

Because the maximum version of 3.6 is supported, a version of 3.6 is created

Open pycharm, set it in setting, and select Add

Generally, the virtual environment created is in the envs of anaconda

After setting the environment, it can be executed successfully again

Test:

Run successfully