Tag Archives: ProgrammerAH

Method of generating MD5 file checksums under Windows

At the command prompt

Microsoft Windows 10 operating system has a built-in command line tool as certificate service, namely “certutil”. The command line provides a switch “hashfile”, so a hash string can be generated. Here, you can use the specified algorithm, such as MD5:

certutil -hashfile < file> & lt; algorithm>
certutil -hashfile myfile.zip MD5

Generating MD5 file checksums in command prompt of windows

Using PowerShell

There is also a command in PowerShell
this is the most effective and simple method, because it does not include any type of coding. If you use PowerShell 4.0, there are cmdlets on the command line. This cmdlet is also known as “get filehash.”. Thanks to this command line, you can easily generate a hash file:

Get-FileHash -Path < file> - algorithm < name>
Get-FileHash -Path myfile.zip -algorithm MD5

Using get filehash in PowerShell

Flask Startup Error: s.bind(server_address)PermissionError: [Errno 13] Permission denied

The contents of the error report are as follows:

File "xxx.py", line 4, in <module>  
  app.run(host='0.0.0.0' , port=80 , debug=true,threaded=False)
  File "/home/xxx/.local/lib/python3.6/site-packages/flask/app.py", line 922, in run
    run_simple(t.cast(str, host), port, self, **options)
  File "/home/xxx/.local/lib/python3.6/site-packages/werkzeug/serving.py", line 982, in run_simple
    s.bind(server_address)
PermissionError: [Errno 13] Permission denied

Looking up the relevant information on the Internet, I found that some people said that under the UNIX environment, ports smaller than 1024 can not be bound by ordinary users, and can only be bound by users with root authority, but using sudo command does not work, so it is necessary to bind a port larger than 1024, and the problem is finally solved

Set port to 8080

Splash fcgi: child exited with: 127 possible causes

The first is dynamic link library, please refer to https://blog.csdn.net/lucky_ huijun/article/details/105165359

The second is that there is no correct input path name. The following is wrong

spawn-fcgi -a 127.0.0.1 -p 9001 -f a.out

The right thing to do is

spawn-fcgi -a 127.0.0.1 -p 9001 -f /a.out

If it’s the second mistake, slap yourself^_^

Vue uses this. $refs. Subcomponent Ref. method to report an error: cannot read property ‘resetfields’ of undefined problem

Cannot read property ‘resetfields’ of undefined problem
Problem Description:
use element to develop background system, edit and add the same pop-up box
bind the commentform object in data
in order to clear the form in the new pop-up box, use this. $refs [formname]. Resetfields()
click Add to display the pop-up box for the first time, Will report an error
“[Vue warn]: error in event handler for” click “:” typeerror: cannot read property ‘resetfields’ of undefined “”

Cause of the problem: after mounted loads the table data, the hidden pop-up box is not compiled and rendered into the dom.

So @ Click = “dialogformvisible = true; Reset form (‘dlgform ‘) “when the click pops up

r

e

f

s

and

no

yes

Get

take

reach

d

o

m

element

element

guide

To

r

e

s

e

t

F

i

e

l

d

s

o

f

u

n

d

e

f

i

n

e

d

solution

Decision

square

method

one

(

Refs does not get DOM element, resulting in ‘resetfields’ of undefined solution: 1(

Refs does not get DOM element, resulting in ‘resetfields’ of undefined solution: 1. (after next update of nexttick DOM)

        resetForm(formName) {
            this.$nextTick(()=>{
                this.$refs[formName].resetFields();
            })                
        },

2. (if you click add for the first time, there is no need to reset. It is judged according to the element undefined.)

            if (this.$refs[formName] !== undefined) {
                this.$refs[formName].resetFields();
            }

Note: a series of JS operations on DOM should be put into the callback function of Vue. Nexttick()

Command MergeSwiftModule failed with a nonzero exit code (Xcode12.5.1)

error:
Command MergeSwiftModule failed with a nonzero exit code
MergeSwiftModule normal arm64 (in target ‘xxxx’ from project ‘Pods’)

<unknown>:0: error: circular reference
<unknown>:0: note: through reference here
<unknown>:0: note: through reference here
<unknown>:0: note: through reference here
<unknown>:0: error: circular reference
<unknown>:0: note: through reference here
<unknown>:0: note: through reference here
<unknown>:0: note: through reference here
Command MergeSwiftModule failed with a nonzero exit code

Steps To get fixes of these errors:

SWIFT_COMPILATION_MODE

forums

[Solved] Default native-compiler executable ‘cl.exe‘ not found via environment variable PATH

  Error packing native image as local image

PS C:\Users\cc\Desktop\java> native-image Example
[example:7472]    classlist:   1,642.36 ms,  0.96 GB
[example:7472]        setup:     586.88 ms,  0.96 GB
Error: Default native-compiler executable 'cl.exe' not found via environment variable PATH
Error: To prevent native-toolchain checking provide command-line option -H:-CheckToolchain
Error: Use -H:+ReportExceptionStackTraces to print stacktrace of underlying exception
Error: Image build request failed with exit status 1
PS C:\Users\cc\Desktop\java> a

Install Visual Studio

Select individual components

INCLUDE=C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\ucrt;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\um;C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\shared;D:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.16.27023\include.;
LIB=C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17134.0\um\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17134.0\ucrt\x64;D:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.16.27023\lib\x64;

Add to the PATH: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64

Linux C++ Error: invalid use of incomplete type [How to Solve]

Reason: the compiler doesn’t know the concrete implementation of struct or class,

Analysis: it usually occurs in the following situations: suppose we have a class some defined in some. H, implemented in some. CPP, and we need to use the method of this some in other. CPP, so we can declare a class some in other. H, and declare the method to be used. This will lead to the above problems,

Solution: include some. H in other.cpp, so the compiler will find the specific definition of class some according to the header file, and the problem will be solved.

Details:

1. Forget to define the header file

2. There is no reference header file

Grpc Error: failed to unmarshal the received message proto: can‘t skip unknown wire type 7

Recently, I encountered a problem when using golang grpc stream.

After receiving data for a period of time, the receiver suddenly prints grpc:   failed   to   unmarshal   the   received   message   proto:   can’t   skip   unknown   wire   type   seven

And it’s not going to recover.

Check the source code, found that this error, generally is the incoming message out of the problem, resulting in parsing failure.

It is also possible that the Pb used is not updated, resulting in failure of alignment and parsing.

So I tried to update all the Pb used, and found that this problem has not been solved.

Then we put the doubt on the message.

Looking at the code, we found that after the sender sent the data, this part of the data was modified by other cooperators!

[Solved] FileUploadException: the request was rejected because no multipart boundary was found

summary

Recently, in order to do a video detection, when using postman to upload a video, the code threw an error:

ERROR 13557 [] [http-nio-5000-exec-8] org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/].[dispatcherServlet] Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.web.multipart.MultipartException: Failed to parse multipart servlet request; nested exception is java.io.IOException: org.apache.tomcat.util.http.fileupload.FileUploadException: the request was rejected because no multipart boundary was found] with root cause

org.apache.tomcat.util.http.fileupload.FileUploadException: the request was rejected because no multipart boundary was found
        at org.apache.tomcat.util.http.fileupload.impl.FileItemIteratorImpl.init(FileItemIteratorImpl.java:178)

Background

File upload controller of business application layer:

@Resource
private FileService fileService;

@PostMapping(value = "video")
@ApiOperation(value = "Submit video recognition", httpMethod = "POST")
public Result video(@RequestParam("file") MultipartFile file, @LoginUser SysUser user, HttpServletRequest request) {
	Result<FileInfo> fileInfoResult = fileService.fileUpload(ArmConstant.BUCKET, file);
}

The file service in the above code is an interface defined based on feignclient

@FeignClient(name = ServiceNameConstants.FILE_SERVICE, fallbackFactory = FileServiceFallbackFactory.class, decode404 = true)
public interface FileService {
	@PostMapping(value = "/upload/{bucket}", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
	Result<FileInfo> fileUpload(@PathVariable("bucket") String bucket, @RequestParam("file") MultipartFile file);
}

The file service needs a supporting service, namely file center service, whose controller is defined as follows:

@RestController
@Slf4j
public class FileController {
	@PostMapping("/upload/{bucket}")
	public Result<FileInfo> fileUpload(@PathVariable("bucket") String bucket, @RequestParam("file") MultipartFile file) {
	}
}

analysis

Baidu and Google search all talked about how to set up postman, which once made me question the problem of postman, or my use of postman. Online search, we must take their own critical thinking analysis, many articles are blindly copied. Moreover, as a mature automatic interface testing tool, postman will hardly be found by you and me.

But I’m familiar with the use of postman. In fact, there is no problem with postman configuration:

shelve for one night.

It’s really impossible. Global search multipartfile :

suddenly find something. What’s the difference between @requestpart and @requestparam

Replace @requestparam in three places with @requestpart to solve the problem;

I have to say that feign has a lot of holes. However, we can’t find any information about fileuploadexception: the request was rejected because no multipart boundary was found in feign GitHub.

Feign’s pit, refer to my another blog fallback factory

Extension

What is the difference between @requestpart and @requestparam
write another article about the difference between @requestparam and @requestpart and feign’s comments

[Solved] Linux C++ warning: ISO C++ forbids converting a string constant to ‘char*‘ [-Wwrite-strings]

In C + +,

char* p = "abc";  // valid in C, invalid in C++

warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
Change to the following warning disappears

char* p = (char*)"abc";  // OK

perhaps

char const *p = "abc";  // OK

Reason analysis:

When learning C or C + +, we all know that if the types of variables on both sides of the equal sign are different during the assignment operation, the compiler will perform an operation called implicit conversion to make the variables be assigned.

In the above expression, “ABC” to the right of the equal sign is an invariant constant, which is called string literal in C + +, type is const char *, and P is a char pointer. What happens if you force the assignment?That’s right. We convert the constant coercion type on the right to a pointer. As a result, we are modifying a const constant. The result of compilation will be determined by the compiler and the operating system. Some compilers will pass, some will throw exceptions, and even if they pass, they may be killed because of the sensitivity of the operating system.

This kind of operation of directly assigning string literal to pointer is considered as deprecated by developers, but because many codes have this habit in the past, it is preserved for compatibility

User space operation GPIO error echo: write error: device or resource busy error resolution

Error when using echo 17 > /sys/class/gpio/export: -sh: echo: write error: Device or resource busy
-sh: echo: write error: Device or resource busy
Shows that gpio is occupied.

To check the occupancy status.

cat /sys/kernel/debug/gpio
If no such directory is available.
mount -t debugfs debugfs /sys/kernel/debug

Solution to the failure of ROS noetic initialization (rosdep init)

This method focuses on

 

ERROR: cannot download default sources list from:
https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list

I. Download rosdistro files manually
rosdistro is downloaded to the home directory by default

git clone https://github.com/ros/rosdistro.git

2.Modify 20-default.list

The terminal enters the following command to get the path of the home directory

pwd

Enter rosdistro/rosdep/sourceslist. D, open the 20-default.list file, and

https://raw.githubusercontent.com/ros/rosdistro/master

Amend to read

file:///home/username/rosdistro

Where/home/username is the path obtained by PWD command

3. Modify py file

1. Modification__ init__. py

cd ~/usr/lib/python3/dist-packages/
sudo gedit ./rosdistro/__init__.py

Convert DEFAULT_INDEX_URLs to

DEFAULT_INDEX_URL=” file:///home/username/rosdistro/index-v.yaml “

2, correct3.py

sudo gedit ./rosdep2/rep3.py

Change REP3_TAGETS_URL to

REP3_TAGETS_URL=”file:///home/username/rosdistro/releases/targets.yaml”

3. Modify sources_list.py

sudo gedit ./rosdep2/sources_list.py

Change DEFAULT_SOURCES_LIST_URL to

DEFAULT_SOURCES_LIST_URL=”file:///home/username/rosdistro/rosdep/sources.list.d/20-default.list”

4. Modify gbpdistro_support.py

sudo gedit ./rosdep2/gbpdistro_support.py

Change FUTURE_GBPDISTRO_URL to

FUTURE_GBPDISTRO_URL=”file:///home/username/rosdistro/releases/future.yaml”

4. Reinitialization

sudo rosdep init
rosdep update