Tag Archives: LINQ

How to Solve linq Statement IsNullOrWhiteSpace Error

Using the IsNullOrWhiteSpace method in a linq statement will report an error,

Error message: System.NotSupportedException: ‘LINQ to Entities does not recognize the method ‘Boolean lsNullOrWhiteSpace(System.String)’ method, and this method cannot be translated into a store expression.’

You can use the method below to solve:

You can also use IsNullOrEmpty, IsNullOrEmpty method does not report an error, normal operation

The following figure is the analysis of these two methods:

[Solved] error when starting dev server:Error: listen EACCES: permission denied 0.0.0.0:80 at Server.set

error when starting dev server:Error: listen EACCES: permission denied 0.0.0.0:80 at Server.set

error when starting dev server:
Error: listen EACCES: permission denied 0.0.0.0:80
at Server.setupListenHandle [as _listen2] (node:net:1313:21)
at listenInCluster (node:net:1378:12)
at Server.listen (node:net:1465:7)Using cnpm install works

mac to 8090.

mac terminal port view command
View Port thread lsof -i:4700
$ lsof -i:4700
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
node 12159 yyyyyy 23u IPv4 0x76b4f5051c4983f3 0t0 TCP *:netxms-agent (LISTEN)

The PID here is the process number that occupies port 4700
kill 4700
Solution:
View mac terminal port command netstat -AaLlnW
Method 1
// Check if port 80 is occupied
sudo lsof -i :80

Method 2
netstat -anp tcp | grep 80
The following command can directly end all processes that are occupying the port.
lsof -P | grep ‘:80’ | awk ‘{print $2}’ | xargs kill -9

Ps -ef|grep program name

 

[Solved] RuntimeError: An attempt has been made to start a new process before the current process…

When running the Pytorch expression recognition code during hands-on training, the following error occurred:

RuntimeError:
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.
 
        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:
 
            if __name__ == '__main__':
                freeze_support()
                ...
 
        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.

 

Here is to take multi-threaded tasks, using a single thread to complete, the solution is also very simple, there are the following two.
1. remove the num_workers parameter

 

train_dataloader = torch.utils.data.DataLoader(train_dataset,batch_size=batchsize,shuffle=True,num_workers=0)
val_dataloader = torch.utils.data.DataLoader(val_dataset,batch_size=100,shuffle=False,num_workers=0)

2. Add if __name__=='__main__' before epoch :

if __name__ == '__main__':
    for epoch in range(epochs):
        loss = 0.0
        acc = 0.0
        n = 0
        for image,label in train_dataloader:

Then it can run normally.

[Solved] org.thymeleaf.exceptions.TemplateInputException: Error resolving template

This problem occurs when spring boot} integrates thymeleaf

By querying other people’s blogs. I understand that there are several possible errors

1 when the method corresponding to your controller layer returns the HTML path and name, add an additional /.

For example, return “/index”. If this ‘/’ causes an error, the solution is to remove the ‘/’ in front of the return, such as return “/index”

2. Introduction package problem (I solved it this way)

Add dependency in porn

<dependency> 
<groupId>net.sourceforge.nekohtml</groupId> 
<artifactId>nekohtml</artifactId> 
<version>1.9.22</version> 
</dependency>

DingDing Error: missing mainframe dll [How to Solve]

Repair steps:
1. Press “windows logo key + X”, Start Windows PowerShell (administrator) Enter the command “auto repair system
2. Dism/online/cleanup image/scanhealth” to scan all system files and compare them with the official system files to scan for inconsistencies in the computer
3. The command dism/online/cleanup image/checkhealth must be used when the system file is found to be damaged after the previous command is executed
4. Dism/online/cleanup image/restorehealth this command restores those different system files into official system source files
5. Restart after completion. No matter whether the above is successful or not, type the following command: SFC/scannow

[Solved] Stream Error: stream has already been operated upon or closed

public class StreamTest {
    public static void main(String[] args) {
        //Generate a Stream of type String
        Stream<String> stringStream = Stream.of("1", "2", "3", "4", "5");
        // Convert string type in stream to int type using map method
        stringStream.map(
                (String s) ->{
                    return Integer.parseInt(s);
                });
        stringStream.forEach(i -> System.out.println(i));
    }
}

As shown in the figure, the code runs with an error:

The stream has been used or closed

This is a feature of streams: a stream can only be used once!