MyBatis is a first class persistence framework with support for custom SQL, stored procedures and advanced mappings. MyBatis eliminates almost all of the JDBC code and manual setting of parameters and retrieval of results. MyBatis can use simple XML or Annotations for configuration and map primitives, Map interfaces and Java POJOs (Plain Old Java Objects) to database records.
MyBatis-Spring integrates MyBatis seamlessly with Spring. This library allows MyBatis to participate in Spring transactions, takes care of building MyBatis mappers and SqlSessions and inject them into other beans, translates MyBatis exceptions into Spring DataAccessExceptions, and finally, it lets you build your application code free of dependencies on MyBatis, Spring or MyBatis-Spring.
Today I try to delete a directory with 485,000+ files on Linux server. It shows the error message below.
/bin/rm: Argument list too long.
If you’re trying to delete a very large number of files in a single directory at one time, you will probably run into this error. The problem is that when you type something like rm -f /data/*. So how do we working with directories with a large number of files? Let talk about it below.
Show first files
To show first n files in the directory instead of to show all files.
ls -U | head -10
Count the number of files
ls -f | wc -l
Remove files
Using for Loop
for f in *.pdf; do echo rm "$f"; done for f in *.pdf; do rm "$f"; done
Using Find
Using find -delete. (2000 files/second, it is about three time faster rm)
find . -maxdepth 1 -type f -name "$.split-*" -print -delete
Using find and xargs. To find every file and pass them one-by-one to the “rm” command (not recommend, xargs is dangerous*)
Using HTTP domain visit my website is ok, but HTTPS not.
Error Info
ERR_TIMED_OUT
This site can’t be reached xxx.xxx.com took too long to respond. Try: - Checking the connection - Checking the proxy and the firewall - Running Windows Network Diagnostics ERR_TIMED_OUT
Solutions
ERR_TIMED_OUT represents this is a connection error, not SSL certificate errors.
Common Solution
Check whether the server IP or HTTP domain can be visited. If ok, the connection is OK.
Check whether the server reversed proxy is right, and server firewall is open 80 and 443.
Check whether the client browser and client network is right.
Current HTTP is work represented the connection is ok. And client browser can visit other HTTPS websites, represented client is ok.
You need to check your server reversed proxy is right, and ports 80 and 443 of your server firewall are open .
I call APIs of OSS (object storage services) to upload my local file with Java Input Stream.
Error Info
The uploaded file is 0 bytes.
Solutions
Check your accessed file exists and the file is not 0 byte.
Before the inputStream upload, using Java InputStream available() method to check out whether the remaining number of bytes that can be read from the file input stream is 0.
Make sure the remaining number of bytes that can be read from the file input stream is right.
Reasons
The reason of the size of my uploaded file is 0 byte is I read the input stream two times.
Most of input stream classes in Java API are not support read more than once. Because some Input Stream classes of Java API not support mark() and reset() method.
Although the FilterInputStream child classes can support read more than once by its mark(), reset() methods, and internal cache array byte buf[], you still need to call it manually. The reset() method is for repositions this stream to the position at the time the mark method was last called on this input stream.
An arrow function does not have its own bindings to this or super, this is inherited from the scope. In regular function, this is the function itself (it has its own scope).