Tag Archives: study

[Solved] Error (suppressible): (vsim-12110) All optimizations are disabled because the -novopt option is in effect…

Questasim Error(vsim-12110)

Questasim simulation optimization acceleration problem (object no signal, could not see waveform)

Makefile script:

Compilation error:

Solution:

Remove -novopt, which is no longer used in modelsim after version 10.7, so as long as you do not use -novopt, no error will be reported. So how can we see the signal and see the waveform while using optimization?

Here I modify modelsim.ini

Find modelsim.ini file address

Modify VoptFlow = 1

In addition, you can replace -novopt with -voptargs= “+acc”

[Solved] gyp ERR! stack Error: Could not find any Python installation to use

Header error prompt

gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp ERR! find Python
gyp ERR! find Python Python is not set from command line or npm configuration
gyp ERR! find Python Python is not set from environment variable PYTHON

Tail error prompt

gyp ERR! find Python **********************************************************
gyp ERR! find Python You need to install the latest version of Python.
gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
gyp ERR! find Python you can try one of the following options:
gyp ERR! find Python - Use the switch --python="C:\Path\To\python.exe"
gyp ERR! find Python   (accepted by both node-gyp and npm)
gyp ERR! find Python - Set the environment variable PYTHON
gyp ERR! find Python - Set the npm configuration variable python:
gyp ERR! find Python   npm config set python "C:\Path\To\python.exe"
gyp ERR! find Python For more information consult the documentation at:
gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
gyp ERR! find Python **********************************************************
gyp ERR! find Python
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Python installation to use
gyp ERR! stack     at PythonFinder.fail (D:\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:330:47)
gyp ERR! stack     at PythonFinder.runChecks (D:\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:159:21)
gyp ERR! stack     at PythonFinder.<anonymous> (D:\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:248:16)
gyp ERR! stack     at PythonFinder.execFileCallback (D:\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:294:16)
gyp ERR! stack     at exithandler (node:child_process:406:5)
gyp ERR! stack     at ChildProcess.errorhandler (node:child_process:418:5)
gyp ERR! stack     at ChildProcess.emit (node:events:527:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:289:12)
gyp ERR! stack     at onErrorNT (node:internal/child_process:478:16)
gyp ERR! stack     at processTicksAndRejections (node:internal/process/task_queues:83:21)
gyp ERR! System Windows_NT 10.0.22000
gyp ERR! command "D:\\nodejs\\node.exe" "D:\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd G:\aidex\font-end\aidex-ui\node_modules\deasync
gyp ERR! node -v v16.15.1
gyp ERR! node-gyp -v v9.0.0
gyp ERR! not ok

Solution:

NPM installation

npm i -g node-gyp

Yarn installation

yarn global add  node-gyp

 

Python Error: [9880] failed to execute script [How to Solve]

1. When I was packing the game, the exe in dist flashes back. You can’t see what the error is.

After recording the screen with the video recorder, the error code is found as follows:

2. According to the error content, scoreboard There is a problem with line 18 of Py:

The cause of the error has been highlighted.

3. Problem-solving:

It is in the font setting “None”, can not be translated, so lead to error, change the “None” to the system font, here changed to ‘SimHei’

When checking the information, I found that other people encountered the problem: the path of the image. The relative path written is not correct, you have to write the absolute path.)

PS: At this point the game can still only be used on your own computer, also because of the picture path problem. The path on your own computer is not the same as the path on other people’s computers. To let others play too, you still have to change it.

[Solved] stream Convert list to map Error: java.lang.IllegalStateException: Duplicate key

I background

In many scenarios, the data of List needs to be transformed into the key-value pairs of Map scenarios to facilitate quick query data. For example: the need to query the corresponding person name details scenario according to the work number. There are two kinds of scenarios, the first one is to query the database once by each work number, which is obviously not reasonable because it is not good for DB pressure and connection. The second will be a collection of work number (need to consider the volume of data scenarios, Oracle supports a maximum of one thousand, mysql, although no online, but consider the performance and memory consumption need to consider the upper limit recommended 1000 below), the next is the second way to expand.

Translated with www.DeepL.com/Translator (free version)

II Development practice

List<User> userList = new ArrayList<>();

userList.add(User.builder().id(123).name("TEST123").build());

userList.add(User.builder().id(1231).name("TEST1231").build());

userList.add(User.builder().id(1232).name("TEST1232").build());

userList.add(User.builder().id(1233).name("TEST1233").build());

userList.add(User.builder().id(1234).name("TEST1234").build());

1.The stream implementation was not available before Java 1.8

Map<String, Long> idNameMap = new HashMap<String, Long>();

for(User user : userList ){

     idNameMap.put(user.getName(),  user.getId());

}

return idNameMap ;

2.Java 1.8 onwards supports stream implementation

return userList.stream().collect(Collectors.toMap(User::getName, User::getId);

III Existing problems

If you use the 2.1 way, the possible problems, if there are two data with the same name in the data, it will report an error java.lang.IllegalStateException: Duplicate key.

When using stream stream, it will not overwrite the data directly like the above way, but will report an error. So it needs to be optimized as

return userList.stream().collect(Collectors.toMap(User::getName, User::getId , (entity1, entity2) -> entity1);

It can solve the problem of error reporting.

Pod install Error: LoadError [How to Solve]

The boss told me that this is the problem that M1 may encounter, but I’m not M1, and I haven’t updated the system!!! Hahaha, fuck
these two pits are encountered
x 'require': incompatible library version........ (LoadError)

cannot load such file -- 3.0/ffi_c (LoadError)

Screenshot above
when these two pits are encountered. Baidu, there are few online solutions, and the cocoapods are deleted and retried. It’s useless
finally, read the tips carefully!! Let’s enter
gem pristine executable - hooks -- version 1.6.1
but we still can’t
finally, we found it was input 👆 This command has insufficient permissions
you can reuse cocoapods by adding sudo before this command, and pod install is normal. The correct command is as follows
sudo gem pristine executable - hooks -- version 1.6.1

Redis Stand-alone Builds a Master-slave Copy Error [How to Solve]

Premise: connect Huawei ECS purchased by individuals on the xshell platform, install redis, and build a master-slave replication architecture on a single machine

Problem: after the setup is completed, start the slave node. The slave node Ping the master node succeeds, but the master status is displayed as down, and the background log prompts that the connection times out. As shown below:

Solution:

1. Check the configuration of the slave node: is replicaof correct.

It should be configured as the IP of Linux and the redis port of the master node

2. Check whether the master node is configured with a password. If so, the slave node also needs to be configured with a password

3. Check whether the Ping configuration of the primary node configures a single non own IP. If so, comment it out or change it to 0.0.0.0

4. Check whether the firewall is on. There are two types of firewalls

1. Iptables firewall

View firewall service iptables status     If this firewall is not installed, the query will fail.

Stop firewall   service iptables stop

Turn on the firewall   service iptables start

service iptables restart   service iptables restart

Permanently turn off the firewall   chkconfig iptables off

Restart firewall after permanent shutdown   chkconfig iptables on

2.Firewall firewall

View firewall service status   systemctl status firewalld

Turn off firewall   service firewalld stop

View firewall rules   firewall-cmd --list-all

Permanently open 80 ports   firewall-cmd --permanent --add-port=80/tcp

service iptables restart  firewall-cmd --reload (restart after modifying firewall configuration)

4. After I tried the above, I still reported the same error. Finally, I found that the IP configuration of my slave node replicaof was wrong. I mistakenly thought that the IP connected to xshell was the Linux IP I should configure. Who knows, I actually need to use my local IP 127.0.0.1

Solve host key verification failed [valid]

Host key verification failed

When I wanted to connect to my server on the Mac, I found that there was a problem with my key, so Baidu took a look and made a record.

The first terminal is the picture of the problem, and the second terminal is a code to solve the problem

SSH keygen - R IP address you want to access
SSH keygen - R 192.168.1.5

Reference blog

[Solved] Use the truss console to connect to the public blockchain network error: mnemonic invalid or undefined

Error prompt

Error: Mnemonic invalid or undefined

Cause:. Env file naming error

Change the process.env file name directly to .Env and then execute the truss console --network Kovan command

Steps for connecting the common chain of truss
Install dotenv and truffle-hdwallet-provider

npm install dotenv --save-dev -g
npm install truffle-hdwallet-provider --save-dev -g

Note: The windows system may need to restart these two dependent packages to take effect in the project

Create an .env file in the project of root directory, write Mnemonic and INFURA_API_KEY via Form of key-value pairs in the .env file

INFURA_API_KEY= your infura_api_key
MNEMONIC="your mnemonic"

Configure in truffle-config.jsor or truffle.js file:

// Import the dotenv library created to read the settings in the `.env` file
require('dotenv').config();
// import the truffle-hdwallet-provider library to rebuild the wallet
const HDWalletProvider = require('truffle-hdwallet-provider');

module.exports = {
  networks: {
    development: {
     host: "127.0.0.1",     // Localhost (default: none)
     port: 7545,            // Standard Ethereum port (default: none)
     network_id: "*",       // Any network (default: none)
    },
    // Useful for deploying to a public network.
    // NB: It's important to wrap the provider as a function.
    kovan: {
      provider: () => new HDWalletProvider(
        process.env.MNEMONIC, 
        process.env.INFURA_API_KEY
      ),
      gas: 5000000,
      gasPrice: 25000000000,
      network_id: 42
    },
  },
  solc: {
    optimizer: {
      enabled: true,
      runs: 200
    }
  }
}

Enter truffle console --network kovan in the console to connect to the public chain, and you can enter web3.eth.getBlock('latest').then(console.log) for verification. If the following content is returned, the connection is successful:

{ author: '0x03801efb0efe2a25ede5dd3a003ae880c0292e4d',
  difficulty: '340282366920938463463374607431768211454',
  extraData:
   '0xde830206028f5061726974792d457468657265756d86312e33362e30826c69',
  gasLimit: '0x7a1200',
  gasUsed: '0x17d23',
  hash:
   '0xc7390c4f492c8c1da60608135fc9e05930123b645b39f221cba33d8b3c577b2a',
  logsBloom:
   '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000080000000000000000000100000008000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400800000000000010000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009000000008000000',
  receiptsRoot:
   '0x3d05bb2ed4fcc90234eea6d840e7d0e3ce7f598a15e5314536b17bcd11c78b5b',
  sealFields:
   [ '0x84175e8801',
     '0xb84155a8cdb108dccec1d314124058fa6f22e7400ee200db0a94b7b165e4c3454c1818cc05f815cb7ce48f7a88b8401515740311a3566d9cf079428d506a6daca50101' ],
  sha3Uncles:
   '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347',
  signature:
   '55a8cdb108dccec1d314124058fa6f22e7400ee200db0a94b7b165e4c3454c1818cc05f815cb7ce48f7a88b8401515740311a3566d9cf079428d506a6daca50101',
  size: 877,
  stateRoot:
   '0x03af5adce52a81ce5d332cddb9955e344214bff00859b78868116e1e839efdf7',
  step: '392071169',
  timestamp: 1568284676,
  totalDifficulty: '4524524338444961608702071789512829094373049115',
  transactions:
   [ '0xded7fed0842fd65ec808bc3652ec4175bc190acc11345c49c44b1fb5d954610f',
     '0x7e9112a46fa3c07aad813ea86355b15eebb44023c040d198ee7d15d379bbc2be' ],
  transactionsRoot:
   '0x0dd10d90686dda2684bd0ba70d1c9e1d9a5302c30ca75eb2c5b07a7b6e4498b9',
  uncles: [] }

Note: every time you want to call the contents of the. Env file, you must first import the dotenv Library in the JS file, otherwise you cannot read the contents of the file

Processing method of eslint verification error

Processing method of eslint verification error

When encountering the eslint verification rule, the following errors or warnings are reported:

1. When encountering no unused vars, no unused expressions, no undef, no restricted globals and other errors, you can verify that the function is turned off by configuring the rules in eslint
2. If there are too many errors and warnings when encountering a file (such as the imported plug-in min.js), you can create it in the root file = & gt Eslintcore (don’t forget the previous point) and configure it, as shown in the following figure:
/SRC/view = & gt; The view file under SRC file ignores the verification
[ Insert picture description here]( https://img-blog.csdnimg.cn/49aecec84d054cc5a2e4eae7fe6fbbda.png#pic_ center

1. If eslint is configured in a separate file

Configure the required verification rules in the created. Eslintrc.js, as shown in the following figure:

2. Referenced scaffolds, such as create react app

Configure verification rules in package.json:

Linux learning experience sharing

1. What’s the use of learning Linux?

Learning Linux well will let you break the limitation of windows, come and go freely in the open source world, there are a lot of free software for you to use, especially the students of computer department,.
If you only use Linux as the only tool to make a living, you can choose the direction mainly in the operation and maintenance, system level software development and other fields. Linux occupies the vast majority of the server market, such as the Internet industry, front-end web development, back-end web servers, databases, storage devices are basically running on Linux, so you have to fight with Linux to do software development Although I think Linux brings you a different world view. There is no good or bad technology, the key is to see how you understand it.

2. I think there are many English words in Linux. Is it difficult to learn them?

Many people may think that there are many English words and documents in Linux. Is it difficult for us to learn them, but these commands are just abbreviations of English words, such as LS – list, CD – change directory, PWD – print working directory, CP – copy, MV – move, RM – remove these commands are abbreviations of English words, as long as you understand the meaning (understand), this shoe command will be very simple.
Therefore, don’t be afraid of English. English, as the most widely circulated language in the world, always has its value. It is also necessary to study and further study. Why not learn English together while learning Linux?If you have such an idea, then I’m sure you can learn Linux well.

3. I want to learn Linux, but I’m too busy with my work. I can learn less every day, and then Bala

Linux is a skill that makes a lot of things. In fact, it doesn’t require you to spend a lot of time learning it, but requires you to keep on and accumulate it. So, for office workers, it is the key to be good at using fragmented time. As long as you take out half an hour every day and persist in learning for a year, there will be a breakthrough!
Finally, there is the saying: “if you want to learn, nothing is an excuse. If you don’t want to learn, everything is an excuse.”

4. Some people say that “learning Linux is going in laughing and coming out crying”. Is that right?

Those who say that everything (skills) is easy to get started and difficult to learn later are all excuses for not learning well. Linux is just a basic computer skill. It has no requirements for learners’ background, knowledge structure and age. As long as they make unremitting progress, there is nothing they can’t learn. Of course, in learning there will always be bottlenecks, this time we need to self-regulation, adhere to. There are a lot of things to remember in learning Linux. If you are too lazy to recite, study and understand the command options of Linux, you will find it difficult to learn. Or that sentence, down-to-earth, there will always be harvest.

5. My qualifications are average and I don’t have any foundation. Generally, I have to study Linux in non working hours. How long can I pass RHCE?

It varies from person to person how long they have passed the certification. According to past experience, most people spend 1 or 2 hours a day studying hard for 2 to 4 months, so they should be able to pass the RHCE. I personally don’t agree with the method of storming RHCE half a month, because the certificate is secondary to learning Linux, and the main thing is to improve my working ability. Certification like this can be used as a phased goal for you to learn Linux, but it is not the main purpose of your study.

6. I want to teach myself Linux. What’s a good textbook to recommend.
When it comes to teaching materials, there are quite a lot of Linux teaching materials on the market. If you really want to recommend them, you can recommend many books. Next, I mainly recommend a book that I think is more suitable for beginners: This is how to learn Linux written by Liu Trent.
This book was started in 2015, and is still in the process of being written. It is a relatively new book. Compared with the Linux books on the market a few years ago, it is more suitable for the current environment, so as to improve the efficiency Redhat7 is a teaching system. Compared with other books, you can learn a lot of useful things. For a classmate with zero basis in Linux, the knowledge of this book is certainly enough, and what you have learned can be used in work It’s OK in the RHCE exam. The main points and difficulties of Linux system management are all covered in it. It’s easy to learn in order, and you don’t have to worry about the fracture of the knowledge layer.

7. I want to learn Linux, but I have no patience. How can I persist?

I don’t think this is a case. Many beginners will ask this question. In fact, what I want to say is that patience should be cultivated slowly. One of the most important things in learning Linux is interest. Generally speaking, people who want to learn Linux are interested in Linux or have what they want. In addition, a good learning environment and a good example will naturally lead to patience If you keep learning, you will be in touch with Linux every day. You can turn books whenever you have time. Therefore, interest is the best teacher. Although this sentence is vulgar, it’s quite right.

8. I want to learn Linux. Can I completely study by myself without taking any training courses?

You can download a free copy of “this is how to learn Linux” http://www.linuxprobe.com/book Take a look at it by self-study, but I don’t recommend not to apply for classes at all. In fact, Linux is a simple thing: you will use it after you learn it. For example, when you take exams and use them in your work, you will be short of learning by yourself at the beginning, which will directly affect your study time and greatly increase the cost of study. Therefore, when you first get started, you still need a Linux teacher to guide you to get started;
when you get started, you need a Linux teacher to help you get started Secondly, in fact, there are certain rules in learning Linux. We can call it the knowledge architecture of Linux. If you just look at the content in the textbook without the teacher’s summary and explanation, it’s easy to forget after learning. If you follow the teacher to learn Linux at the beginning, you can establish the correct knowledge architecture of Linux. On the contrary, if you don’t set up a good structure at the beginning, even if you teach yourself to the intermediate level, you may find it difficult to learn in the face of some unfamiliar problems, and your interest in learning will weaken, leading to giving up in the end. In addition, if it’s class learning, you can find like-minded partners to study together in a class, which is also a kind of promotion for your own learning.

Generally speaking, they can learn by themselves, but they are difficult and easy to take detours. Knowledge on the Internet is scattered, and there are mistakes and loopholes. If there is a teacher’s advice, on the one hand, it can help you to summarize in time, on the other hand, it can also play a role in urging you to learn.

Spring security failed to log in, error: there is no passwordencoder mapped for the ID “null”

After writing the websecurityconfig class that inherits the websecurityconfigureradapter class, we need to define authentication in the configure (authentication manager builder auth) method, which is used to obtain information sources and password verification rules. (the name of the configure function doesn’t matter. The official name seems to be configureglobal (…) )It is important to configure the authenticationmanagerbuilder in the class annotated by @ enablewebsecurity or @ enableglobalmethodsecurity or @ enableglobalauthentication).

The source of authentication information I used at the beginning was in memory authentication. The code is as follows

 
    protected void configure (authentication manager auth) throws exception { // inmemoryauthentication gets from memory auth.inMemoryAuthentication ().withUser("user1").password("123456").roles("USER"); }

The login page of spring security is used. As a result, when logging in, the user name and password are correct, and the resource cannot be opened, so it still stays on the login page. There is no passwordencoder mapped for the ID "null".

Baidu found that this is because spring security 5.0 added a variety of encryption methods, but also changed the password format.

Let's take a look at the official documents. Here are the original words of the official documents:

 

-------------------------------------------------------------------------------------------------------------------

The general format for a password is:

{id}encodedPassword

Such that id is an identifier used to look up which PasswordEncoder should be used and encodedPassword is the original encoded password for the selected PasswordEncoder. The id must be at the beginning of the password, start with { and end with }. If the id cannot be found, the id will be null. For example, the following might be a list of passwords encoded using different id. All of the original passwords are "password".

{bcrypt}$2a$10$dXJ3SW6G7P50lGmMkkmwe.20cQQubK3.HZWzG3YB1tlRy.fqvM/BG 
{noop}password 
{pbkdf2}5d923b44a6d129f3ddf3e3c8d29412723dcbde72445e8ef6bf3b508fbf17fa4ed4d6b99ca763d8dc 
{scrypt}$e0801$8bWJaSu2IKSn9Z9kM+TPXfOc/9bdYSrN1oD9qfVThWEwdRTnO7re7Ei+fUZRJ68k9lTyuTeUp4of4g24hHnazw==$OAOec05+bXxvuu/1qZ6NUR+xQYvYv7BeL1QxwRpY5Pc=  
{sha256}97cde38028ad898ebc02e690819fa220e88c62e0699403e94fff291cfffaf8410849f27605abcbc0

-------------------------------------------------------------------------------------------------------------------

 

The storage format of passwords in spring security is "{ID}.....". The front ID is the encryption method, the ID can be bcrypt, sha256, etc., followed by the encrypted password. In other words, when the program gets the passed password, it will first find the ID included by "{" and "}" to determine how the subsequent password is encrypted. If it cannot be found, it will be considered that the ID is null. This is why our program will report an error: there is no passwordencoder mapped for the ID "null". In the example of official documents, various encryption methods are used to encrypt the same password. The original password is "password".

 

If we want our project to log in normally, we need to modify the code in configure. We need to encrypt the password from the front end in some way. Spring security officially recommends using bcrypt encryption. So how to encrypt the password?Just specify it in the configure method.

After modification, it looks like this:

 
    protected void configure (authentication manager auth) throws exception { // inmemoryauthentication gets from memory auth.inMemoryAuthentication ().passwordEncoder(new BCryptPasswordEncoder()).withUser("user1").password(new BCryptPasswordEncoder().encode("123456")).roles("USER"); }

After inmemoryauthentication(), there is ". Passwordencoder (New bcryptpasswordencoder())", which is equivalent to using bcrypt encryption to process the user password when logging in. The previous ". Password (" 123456 ")" is changed to ". Password (New bcryptpasswordencoder(). Encode (" 123456 ")", which is equivalent to bcrypt encoding and encryption of the password in memory. The comparison is consistent, which indicates that the password is correct and login is allowed.

If you are also using the password from the memory, then according to the above modification should be successful login, no problem.

If you use to store the user name and password in the database, you usually use bcrypt code to encrypt the user password and store it in the database. And modify the configure() method, add ". Passwordencoder (New bcryptpasswordencoder())" to ensure that users use bcrypt to process the password when they log in, and then compare it with the password in the database. As follows:

 
    // inject the implementation class of userdetailsservice auth.userDetailsService (userService).passwordEncoder(new BCryptPasswordEncoder());
     

reprint https://blog.csdn.net/canon_ in_ d_ major/article/details/79675033