Category Archives: How to Fix

Can’t connect to MySQL server on ‘192.168.64.132‘

Sqlog failed to connect to MySQL database in Linux system
error message: can’t connect to MySQL server on ‘192.168.64.132’

It can be connected before, but it is not enough to install the virtual machine image. According to the data, you can use SSH connection, and the configuration is as follows:

If you don’t use SSH connection, you need to use win’s telnet to test whether telnet 192.168.64.132 3306 and telnet 192.168.64.132 22 can connect 1, the virtual machine does not set IPv4 forwarding,
2, the virtual machine opens the firewall and does not expose port 3306( 22 can be connected, 3306 can not be connected).

Reference blog

Error in mounted hook: “TypeError: Cannot read property ‘init‘ of undefined“

Error in mounted hook: “TypeError: Cannot read property ‘init’ of undefined”

let myChart = this.$echarts.init(document.getElementById('radar1'))

Error reason: ecarts version is too high, after unloading. Install lower version:

cnpm install [email protected] -S

  However, it is found that there are still errors:

Error: ENOENT: no such file or directory, open

terms of settlement:

Restart the service. Recompile!

package xxx does not exist cannot find symbol

When deploying services on Linux, a large number of packages were thrown and no exception was found

[ERROR] /home/jenkins/agent/workspace/pipeline_p-h6sbk-4/src/main/java/com/UserServiceImpl.java:[3,28] package com.alibaba.fastjson does not exist

[ERROR] /home/jenkins/agent/workspace/pipeline_p-h6sbk-4/src/main/java/com/User.java:[9,2] cannot find symbol

[ERROR]   symbol: class Data

[ERROR]   location: class com.xxx

[ERROR] /home/jenkins/agent/workspace/pipeline_p-h6sbk-4/src/main/java/com/User.java:[3,14] package lombok does not exist

[ERROR] /home/jenkins/agent/workspace/pipeline_p-h6sbk-4/src/main/java/com/User.java:[9,2] cannot find symbol

[ERROR]   symbol: class Data

[ERROR]   location: class com.xxx

[ERROR] -> [Help 1]

[ERROR] 

[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.

[ERROR] Re-run Maven using the -X switch to enable full debug logging.

[ERROR] 

[ERROR] For more information about the errors and possible solutions, please read the following articles:

[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

This is Maven’s problem

    check whether the settings.xml file is configured. Check & lt; in the settings.xml file; localRepository> If the path is configured correctly, & lt; mirror> Whether the image address is correct and the network is unblocked. Whether the jar package and the corresponding version exist in Maven warehouse. Whether the Maven version configured in pom.xml corresponds to the Linux Installation version

The solution of “error in NLS loop more than 50” in R language

When using multiple nonlinear regression (NLS function) in R language, we often encounter the problem that “the number of error in NLS cycles exceeds the maximum of 50”.

The main reason is that the default maximum number of iterations in NLS is 50. At this time, you only need to use NLS. Control to modify the maximum number of iterations
for example, change the maximum number of iterations to 1000:

nlc <- nls.control(maxiter = 1000)
m1 <- nls(y ~ a * x1 ^ b * x2 ^ c, 
          control = nlc, 
          start = list(a = 1, b = 1, c = 1),
          trace = T)

Error installing redis: redis requires Ruby Version > = 2.3.0

Error installing redis: redis requires Ruby Version & gt= 2.3.0.

Error installing redis: redis requires Ruby Version & gt= 2.3.0.

Recently, the following error was reported when installing redis cluster:
the version of ruby in centos7 Yum library supports 2.0.0, but gem needs at least 2.3.0 to install redis, and uses RVM to update ruby

Follow the steps below

1. Install curl

yum -y install curl

2. Install RVM

curl - L get.rvm.io | bash - s stable
this is an installation failure error

this situation mostly occurs in self signed certificates. The error report means that the issuing certificate authority is not authenticated and cannot be identified.

3. Modify hosts

VI/etc/hosts
add the following
199.232.28.133 raw.githubusercontent.com

4. Execute curl command and download RVM

curl - L get.rvm.io | bash - s stable

Load shell configuration
source/usr/local/RVM/scripts/RVM

5. Check the known Ruby versions in RVM library

rvm list known

6. Install the ruby version

rvm install 2.6.3

7. Use Ruby Version

rvm use 2.6.3

8. Set the default version

ruby --version

9. Uninstall the old version

rvm remove 2.0.0

10. Install the interface version of redis and ruby

gem install redis

This is the perfect solution~

Mxnet general optimizer usage

 
Adam optimizer:

weight_decay=5e-4

adam_lr=0.01
optimizer = mx.optimizer.Adam(learning_rate=adam_lr, wd=weight_decay)

 
 

wd = 0.0005

   opt = optimizer.SGD(learning_rate=lr,
                        momentum=0.9,
                        wd=wd,
                        rescale_grad=1.0/len(ctx),
                        clip_gradient=None)

 

Apache Groovy——java.lang.NoSuchMethodError: x.x.x: method <init>()V not found

Original address: Apache groovy — Java. Lang. nosuchmethoderror: x.x.x: method() V not found 🙃)

Problem description

During the execution of groovy code, the following error occurred:

ava.lang.NoSuchMethodError: com.lispstudio.model.TeamLispstudio: method <init>()V not found

Cause of the problem

After inheriting the parent class, the constructor of the parent class is not called.

resolvent

There are two solutions: 1) call the same constructor as the parent class; 2) Use inheritconstructors annotation;

Call the same constructor as the parent class

class Creature {
    Creature (String feature) {}
}

class Humman extends Creature{
    Humman (String feature) {
		super(feature)
    }
}

new Humman("legs")

Using inheritconstructors annotation

class Creature {
    Creature (String feature) {}

Solve the problem of using logback console to print log Chinese characters in IDEA as garbled characters

The first step is to set the idea to open File->Settings->Editor->File Encodings

The second step is to set the tomcat VM options,

The third step is to set idea, idea64.exe.vmoptions or idea.exe.vmoptions

The fourth step, the configuration of the first three steps is usually OK, if it is still garbled, under the configuration custom_vmoptions,

Idea configuration open help->Edit Custom vm Options 

Add to the open file 

The above configuration is all OK, basically it can solve the UTF-8 garbled problem

A solution to automatically convert special characters into Unicode when taking out data from MySQL and encapsulating it into JSON

    @Test
    public void xxx() throws ParseException, UnsupportedEncodingException, Exception {
        ArrayList<JSONObject> list = new ArrayList<>();
        String s = "Appliances jerry-built, poor quality clothing ...... still believe that "e-commerce custom products" more affordable";
        JSONObject json = new JSONObject();
        json.put("title", s);
        JSONObject json1 = new JSONObject();
        json1.put("title", s);
        list.add(json);
        list.add(json1);
        System.out.println("old:"+list.toString());
        System.out.println("new"+StringEscapeUtils.unescapeJava(list.toString()));
    }

Output:
before transformation: [{“title”: “home appliances cut corners and poor clothing quality”}]
after transformation [{“title”: “home appliances cut corners and poor clothing quality”}]
after transformation [{“title”: “home appliances cut corners and poor clothing quality”} Also believe that “e-commerce customized products” are more affordable “}, {” title “:” home appliances cut corners, poor quality of clothing Also believe that “e-commerce customized products” are more affordable “}]

Web Crawler: How to get the data in the web page and disguise the header, disguise as a browser to visit many times, avoid a single visit leading to IP blocked

User agent: user agent. It is a kind of identification that provides information such as browser type, operating system and version, CPU type, browser rendering engine, browser language, browser plug-in, etc. The UA string is sent to the server every time the browser makes an HTTP request

Referer: http referer is a part of the header. When a browser sends a request to a web server, it usually brings a referer to tell the server which page I’m linking from, so that the server can get some information for processing

	public static String getHtmls(String url) throws IOException {
		RequestConfig globalConfig = RequestConfig.custom().setCookieSpec(CookieSpecs.IGNORE_COOKIES).build();
		String html = "";
		CloseableHttpClient httpClient = HttpClients.custom().setDefaultRequestConfig(globalConfig).build();
		HttpGet httpget = new HttpGet(url);
		//Browser identifier (OS identifier; encryption level identifier; browser language) Rendering engine identifier Version information
		httpget.setHeader("User-Agent","Mozilla/5.0 (Linux; U; Android 2.3.6; zh-cn; GT-S5660 Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 MicroMessenger/4.5.255");
	    // Camouflage head
		httpget.setHeader("Referer", "https://mp.weixin.qq.com");
		
		try {
			HttpResponse responce = httpClient.execute(httpget);//
			int resStatu = responce.getStatusLine().getStatusCode();
			if (resStatu == HttpStatus.SC_OK) {

				HttpEntity entity = responce.getEntity();
				if (entity != null) {
					html = EntityUtils.toString(entity);// Get html source code
				}
			}
		} catch (Exception e) {
			System.out.println("request " + url + " error!");
			e.printStackTrace();
		} finally {
			// close
			httpClient.close();
		}
		return html;
	}