Category Archives: How to Fix

Centos8 solves the problem of “failed to set locale, defaulting to c.utf-8”

Problem description

>
>
>
>
>
>
>
>
>

systemctl status mysqld.service

journalctl -xe


Failed to set locale, defaulting to C.UTF-8
How to solve
To set the system locale, use the localectl command. For example, if you want to use UTF-8 encoded American English (US), run the following command.
download centos docker mirror system default is ISO/IEC 15897 character set
need to utf-8.
to install all of the first character set

dnf install langpacks-en glibc-all-langpacks -y

Set character set

localectl set-locale LANG=en_US.UTF-8

Restart the mysql
bingo!!!!!!
success

Plug in loaded: fastmirror, langpacks / var / run/ yum.pid Locked, another program with PID 2323 is running

Question:
The plugin is loaded: FastestMirror, Langpacks
/var/run/yum.pid is locked and another program with pid 2323 is running.
Another app is currently holding the yum lock; waiting for it to exit…
Another application: PackageKit
Memory: 155 MB RSS (574 MB VSZ)
Started: Mon Mar 23 14:13:26 2020-01:07 before
Status: Running, process ID: 2323
Solution:
[root@chao ~]#

rm -f /var/run/yum.pid

 

No artifacts package solution for idea to configure Tomcat

I don’t know why my idea is always inexplicably wrong, maybe it is aimed at me
1. At this point you can see that there are no artifacts and there are warnings in the bottom that cause Tomcat to not be successfully configured

2. The solution I found on the Internet is to check this box, but my default is that the box does not solve my problem
 

3. I updated the Maven environment and solved it successfully

Conclusion: Just update the Maven environment
 

The reason and solution of the error of join function: sequence item 0: expected STR instance, int found

When I was writing code the other day, the task was to separate the incoming parameters with “_” and then append them to the file
Direct up code

def operate(file_path, *args):
    f = open(file_path, mode="a", encoding="utf-8")
    s = ""
    s = '_'.join(args)
    f.write(s)
    f.flush()
    f.close()
operate("hhhh.txt", 123, 456, 789)

Receive a string, but I wrote a number by mistake, then reported an error
TypeError: sequence item 0: expected STR instance, int found TypeError: sequence item 0: expected STR instance, int found TypeError: sequence item 0: expected STR instance, int found
Then look for the document, and here’s the original text
Return a string which is the concatenation of the strings in iterable. A TypeError will be raised if there are any non-string values in iterable, including bytes objects. The separator between elements is the string providing this method.
The join function is a string function, and the arguments and inserts are strings
So:
S = ‘_’.join(args) to

s = '_'.join(str(args).strip())

That’s it!
 
 
 

Type error: sequence item 0: expected STR instance, int found

TypeError: sequence item 0: expected STR instance, int found TypeError: sequence item 0: expected STR instance, int found
List1 =[1,’two’,’three’,4]
print(‘ ‘.join(list1))
I thought it would print 1, two, three, four
The result was an error
Traceback (most recent call last):
File “< pyshell#27>” , line 1, in < module>
print(” “.join(list1))
peerror: sequence item 0: expected STR instance, int found
p> (“.join(list1))
TypeError: sequence item 0: expected STR instance, int found
A list of numbers cannot be converted directly to a string.
Print (” “.join(‘%s’ %id for id in list1))
That is, iterating through the elements of the list, converting them to strings. So I can print 1, 2, 3, 4.

AES CBC PKCs × 7 encryption

Performing encryption behind Java. Security. InvalidKeyException: illegal Key Size
Because the key is more than 128, sell Java. Security. InvalidKeyException: Illegal key size. Because the key length is limited, the Java runtime environment reads restricted policy files.
solution :
lution A:
g> the official download of the JCE unrestricted permission policy file, and replace the corresponding file
JDK7 download address: http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html
JDK8 download address: http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html
Download after decompression can see local_policy. Jar and US_export_policy jar and readme. TXT
if installed JRE, put the two jar files in % JRE_HOME % \ lib \ security directory under the cover of the original file
if installed JDK, and put the two jar files are in % JDK_HOME % \ JRE \ lib \ security directory to cover the original file
Option B:
Replace Oracle JDK with OpenJDK, the free and open source Java version of Oracle. OpenJDK does not have this limitation, and most Java services run on the OpenJDK environment

Hexo + next add bilibilibili icon through custom style

Next uses the Font Awesome library as the icon library by default. However, some Chinese social network ICONS are not available in the Font Awesome library, including the familiar ones Bilibili, Douban, and Jianshu. So if we want to use these ICONS, we need to manually add them using local ICONS.
First, you can find the icon you need on a site like Alibaba’s Vector Icon Library and download it in SVG format. Bilibili, for example, the SVG files placed in hexo engineering/source/images/Bilibili SVG.
Edit the source/_data/styles.styl file (create your own if you don’t) and add the following styles:

.fa-bilibili {
  background: url(/images/bilibili.svg);
  background-position: 50% 75%;
  background-repeat: no-repeat;
  height: 1rem;
  width: 1rem;
}

Note: Source under the Hexo project directory, not the source under the theme
Next, uncomment the style section of custom_file_path in the theme configuration file (such as theme/next/_config.yml).

custom_file_path:
  style: source/_data/styles.styl

Finally, reference it in the social link of the theme configuration file (such as theme/next/_config.yml).

social:
  Bilibili: https://space.bilibili.com/userid/ || fab fa-bilibili


I failed with hexo-cli 4.2.0 and NexT 8.2.1. Can anyone tell me how?
Reference reading:
https://theme-next.js.org/docs/advanced-settings/custom-files.html#Custom-Icon-Imagehttps://www.zywvvd.com/2020/03/28/next/20_custom_style/custom-style/