Category Archives: How to Fix

Chrome local file translation tool

Chrome native file translation tool
Translation tool: https://qingcms.gitee.io/translator/

Chrome native files can not be translated solution

    Click to select local file and use the browser to translate the current page to refresh the page, you can re-select the file;
    can open multiple browser tabs and translate multiple files at the same time
The file will be displayed on the current page and the file will not be uploaded (JS FileReader). The tested browser: Chrome, Edge

VirtualBox + CentOS 7 virtual machine setting static IP address of host only NIC

I am not familiar with the use of VirtualBox. Every time I start the virtual machine, it will be automatically assigned a dynamic IP address (hosting-only), which is very inconvenient for me to use Hadoop and so on. I skipped this problem before, but it took me half a day to solve it finally today.
Specific treatment methods are as follows:
1. Start VirtualBox and select “Administration” –>; “Global Settings”, in the pop-up window, select “Network”, and then in the right window, select the “Host-only Network” TAB, as shown below;

If you don’t have a VirtualBox Host-only Ethernet Adapter, you can add it by clicking “+” on the right.
Then double-click the VirtualBox Host-Only Ethernet Adapter and the following image will pop up:

Select “DHCP Server” and uncheck the “Enable Server” status.


2. Start the virtual machine
Enp0s3 and enp0s8 represent two network cards: Enp0s3 and enp0s8 represent two network cards:
[hadoop@xhp1s2 ~]$ ifconfig
enp0s3: flags=4163< UP,BROADCAST,RUNNING,MULTICAST> MTU 1500
inet6 fe80::a00:27ff:fe4c:2f5b prefixlen 64 scopeid 0x20< link>
ether 08:00:27:4c:2f:5b TXQueuelen 1000 (Ethernet)
Packets 28 bytes 3361 (3.2 Kib)
R>rors 0 dropped 0 overruns 0 frame 0
Tx Pack>58 Bytes 6795 (6.6kib)
errors 0 dropped 0 overruns 0 carrier 0 Collision-losing 0
br> <>bb3 enp0s8: flags=4163< UP,BROADCAST,RUNNING,MULTICAST> MTU 1500
inet6 Fe80 :: A00:27ff: Fe46: D7F8 Prefixlen 64 scopeid 0x20< link>
ether 08:00:27:46: D7: F8 TXQueuelen 1000 (Ethernet)
Packets 24 bytes 6616 (6.4Kib)
R>rors 0 dropped 0 overruns 0 frame 0
Tx Pack>81 9555 bytes (9.3 KiB)
the TX errors 0 dropped overruns carrier collisions 0 0 0 0

In the directory CD /etc/sysconfig/network-scripts, you will see the presence of IFCFG-ENP0S3 file, copy a copy and change the name to IFCFG-ENP0S8, then edit IFCFG-ENP0S8, the final file contents are as follows:
TYPE=Ethernet
HWADDR= 08:00:27.46 :d7:f8 This indicates that the virtual network card address)
BOOTPROTO = static (here to change into the static)
DEFROUTE = yes
PEERDNS = yes
PEERROUTES = yes
IPV4_FAILURE_FATAL = no
IPV6INIT = yes
IPV6_AUTOCONF = yes
IPV6_DEFROUTE = yes
IPV6_PEERDNS = yes
IPV6_PEERROUTES = yes
IPV6_FAILURE_FATAL = no
NAME = enp0s8
UUID = 3 d54f693 – c56 bbef – 4-8984 – e0495a7c21s2 (this unlike enp0s3 coding)
DEVICE = enp0s8
ONBOOT = yes
IPADDR = 192.168.56.103
NETMASK = 255.255.255.0
GATEWAY = 192.168.56.1
Once this is done, start Service Network Restart and everything is OK.

A solution to the default invalid host only mode of CentOS virtual machine in VirtualBox

Because the network card is not activated at boot time.
Go to /etc/sysconfig/network-scripts/
Inside is the network card configuration file. Usually the hostonly configuration file name is: IFCFG-ENP0S8
If you open this file, you can see the ONBOOT=no line configuration. Change it to ONBOOT=yes and restart the virtual machine.

Initialization order of Java objects

The order in which Java objects are initialized

    static block of the parent class, static properties of the parent (tied for priority, according to the code in order to perform)
    (only in class load for the first time to perform a) subclasses of static code block, a subclass of static properties (tied for priority, according to the code in order to perform)
    (only in class load for the first time to perform a) code blocks in the construction of the parent class of the parent class non-static properties (tied for priority,
    every new object is executed) p>t constructor
    (every new o>t is executed) subclass constru> block, the non-static properties of the subclass (tie precedence, According to the code in order to perform)
    (once every new object will perform a) subclass constructor
    (once every new object will perform a)

Three methods of referencing DLL in Visual Studio 2015

Copy the DLL file to the directory where the executable is located
 
2. Transfer engineering attributes ->; Configure properties ->; Debugging – & gt; Change the working directory to the directory where the DLL files reside
 
3. Transfer engineering attributes ->; Configure properties ->; Debugging – & gt; Set the environment to the Path= DLL directory, for example: Path=$(SolutionDir)bin
 

Reproduced in: https://www.cnblogs.com/buyishi/p/10236780.html

Using Visual Studio 2015 to create. DLL and use. DLL

Use Visual Studio 2015 to create.dll and use.dll
In this paper, the implementation of an addition and meet function is taken as an example:
Create a DLL project:
1, File — New — Project — Win32 console application. Give it a name, like myadd. Click OK. Next, select DLL(D) for the application type and click Finish.
>
>
>
>
>
>
>
>
> You can delete it. Create a new one. CPP, name “mydll. CPP”, create a new “mydll.h”
3, write an addition and subtraction function for example; In mydll. CPP, write the following:

#include"stdafx.h"
#include"mydll.h"
int add(int a,int b)
{
    return a+b;
}

int sub(int c,int d)
{
    return c-d;
}

4. Write the following in mydll.h:

#pragma once
_declspec(dllexport)int add(int a, int b);
_declspec(dllexport)int sub(int a, int b);

5. Build — Build the solution. (select Debug X86 mode) and it will be in the project root directory (with.sln directory), under the Debug folder. Generate.dll and.lib files.

> File — New — Project — Win32 Console Application Give it a name like MyDllTest, click OK, Next, Console Application (W), Empty Project (E), Finish;
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> Right click, add an existing item, and add mydll.h to the header file.

#include<iostream>
#include "mydll.h"
using namespace std;

int main()
{

    int ad, su;
    ad = add(100, 200);
    su = sub(10, 20);
    cout << "ad: " << ad << endl;
    cout << "su: " << su << endl;
    getchar();
    return 0;
}

5, in the project “resource file” right click, add – existing item; Select the.lib file and click OK.
6, Build, Solution, Run That’s it.

Error: importerror: DLL load failed: the page file is too small to complete the operation.

ImporError: DLL Load Failed: The page file is too small to complete operation.

Cause analysis,

2
2
2
2
2
2
2
2
2> Other programs are running, solution: wait for the other programs to finish running or close the other programs. Turn off all useless programs on your computer. Also, Python.ext should not be used by two programs at the same time. For example, if you are using PyDev + Anaconda, turn one off. *

The pychar / pytorch page file is too small to complete the operation

Possible reasons for
If baidu, most can tell you is because virtual memory is insufficient, let you increase virtual memory. On Windows, PyTorch may have a problem with its num_workers, which needs to be set to 0.
The solution
The lack of virtual memory may not be a setup problem, but it may simply be a lack of disk space. I cleaned up the disk and the problem was solved successfully.

Jedis exception resolution: noauth authentication required

The introduction
Before, the project worked just fine because the default was DB0. Then the new requirement came, instead of default DB0, it chose DB for the parameter.
the modified code is as follows, but an error NOAUTH Authentication required.

The solution
The problem is usually a password error, or a problem with the firewall on the Redis machine not turning off the lights.
I checked the password firewall etc and there is no problem.
later through the debug finally found the problem, modify the code is as follows:

when selecting a number the db, it needs to connect redis, but now I will choose the library code on the configuration code before the number, lead to the newspaper password error problem.
conclusion
The problem is actually very simple, actually calm down and think carefully can know what is wrong.
Programming requires a quiet mind, otherwise it is really difficult to make progress, I hope to remind myself.

An error was reported when springboot connected to redis Servlet.service () for servlet [dispatcherServlet] in context with path [] threw e

Made a day, finally 11 o ‘clock more than solved, record once. SerializationException: Cannot SerializationException: Cannot SerializationException: Cannot SerializationException: Cannot SerializationException: Cannot SerializationException: Cannot SerializationException: Cannot SerializationException: Cannot SerializationException:
Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.data.redis.serializer.SerializationException: Cannot serialize; nested exception is org.springframework.core.serializer.support.SerializationFailedException: Failed to serialize object using DefaultSerializer; nested exception is java.io.NotSerializableException: com.wanghaixin.springboot.model.Student] with root cause
Solution:
NotSerializable is not serialized objects, object Article cannot be serialized therefore appeared this problem.
JavaBeans to cache must implement the Serializable interface, because Spring serializes objects before storing them in Redis
For this exception, just modify the corresponding JavaBean object, mine is Student

public class Student implements Serializable