When setting up an Android application, you only need to select the minimum required SDK to Android 4.0 (API 14) or above, and there will be no annoying appcompat_ V7
Tag Archives: solution
Configure HTTPS and self signed certificate for nginx
1、 Get the certificate ready.
The steps are similar to those described in using OpenSSL to self issue the server’s HTTPS certificate. Again here.
Making CA certificate:
1 ca.key CA private key:
OpenSSL gensa - DES3 - out ca.key 2048 code>
making the decrypted CA private key (generally unnecessary):
OpenSSL RSA - in ca.key -out ca_ decrypted.key
ca.crt CA root certificate (public key):
OpenSSL req - New - x509 - days 7305 - key ca.key -out ca.crt code> make and generate the certificate of the website and use CA signature for authentication. Here, assume that the website domain name is blog.creke.net generate blog.creke.net Certificate private key:
OpenSSL genrsa - DES3 - out blog.creke.net .pem 1024
Making the decrypted blog.creke.net Certificate private key: OpenSSL RSA - in blog.creke.net .pem -out blog.creke.net . key code> generate signature request:
OpenSSL req - New - key blog.creke.net .pem -out blog.creke.net . CSR code> in common Fill in the website domain name in the name, such as blog.creke.net Can generate a certificate to change the site, but also can use the pan domain name, such as * creke.net To generate site certificates available for all secondary domain names. Sign with Ca:
openssl ca -policy policy_anything -days 1460 -cert ca.crt -keyfile ca.key -in blog.creke.net.csr -out blog.creke.net.crt
Among them, the policy parameter allows the signed Ca and website certificate to have different country, place name and other information, and the days parameter is the signature time limit. If "I am unable to access the /… /Ca/newcerts directory/etc/PKI/TLS/ openssl.cnf Then: MKDIR - P Ca/newcerts touch CA/ index.txt Touch Ca/serial echo "01" & gt; then re execute the signature command. Finally, put ca.crt Paste the contents of to blog.creke.net . CRT. This is more important! If not, some browsers may not support it. OK, now you need the private key of the website blog.creke.net . key and website certificate blog.creke.net . CRT is ready. Next, start to configure the server.
2、 Configure nginx
Open a new virtual host and set it in the server {} section
listen 443;
ssl on;
ssl_certificate /path/to/blog.creke.net.crt;
ssl_certificate_key /path/to/blog.creke.net.key;
The path is the path of the website certificate just generated. Then use the following command to detect configuration and reload nginx: detect configuration: nginx - T code> reload:
nginx - s reload code>
3、 Optimize nginx configuration
- optimize nginx performance by adding:
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
According to the official documents, the 1m cache can store 4000 sessions. Add: keep alive to the virtual host server {} configured with HTTPS_ Timeout 70; code> sometimes, you will find that after the program such as phpMyAdmin logs in, it will jump to HTTP by mistake. The solution is to locate "location ~. * (PHP | PHP5)?${}" in include fcgi.conf ; or in fastcgi_ Add after param configuration:
fastcgi_param HTTPS on;
fastcgi_param HTTP_SCHEME https;
Here is the official document of nginx about HTTPS, which can be used as a reference.
Note: transferred from http://blog.creke.net/762.html
Solution to electron error “cannot find module app”
Solution:
The original code looks like this:
var app = require('app');
var BrowserWindow = require('browser-window');
To be amended as follows:
const electron = require('electron');
const app = electron.app;
const BrowserWindow = electron.BrowserWindow;
Cause of error: the version of electron used is too new, and this API has been removed in electron v1.0.0. “Cannot find module…” appears again Basically, it’s all because the module is directly introduced by require. If there are errors in the introduction of other modules, you have to check the API now. Not all of them are “const Balabala”= electron.balabala ”For example, the introduction of IPC is:
const ipc = electron.ipcMain;
How to Solve Error: could not list the contents of folder
when I was using phpstorm, I encountered the error of could not list the contents of folder. Using external FTP tools, I could connect to the server normally, but not on phpstorm. After struggling for a long time, I found the following content on phpstorm’s official website
PhpStorm seems to connect to the server but can’t list files or perform upload
This may be because the deployment server requires a so-called passive FTP connection. To set this mode, select Project Settings | Deployment, open Advanced Settings for the server and toggle Passive mode.
Limiting the number of concurrent FTP connections may also help in this situation. To do this, select Project Settings | Deployment, open Advanced Settings for the server and toggle Limit concurrent connections mode setting the number of connections (usually 3-5 concurrent connections is OK for any server if you experience problems with a higher number of connections).A link to visit is attached:
http://confluence.jetbrains.com/display/PhpStorm/Troubleshooting
The translation means:
Phpstorm appears to be connected to the server, but cannot list files or perform uploads
this may be because the deployment server requires a so-called passive FTP connection. To set this mode, select project settings | deployment, find and open advanced settings, and select passive mode.
limiting the number of concurrent FTP connections also helps. To do this, select project settings | deployment, set the number of connections for the server and switch the limited concurrent connection mode, and open advanced settings (usually 3-5 concurrent connections can be for any server if you have a higher number of connections).
In this way, try to use the above solution.
open the server configuration interface tools & gt; deployment & gt; configuration, and then on the interface, find the advanced settings button, open it, check the passive mode option, and then OK
Test again, you can upload normally.
It seems that if you have a problem, you should first check the official documents~
How to Solve SQL state [HY000]: general error 2503
SQLSTATE[HY000]: General error 2503
This error is caused by $this – & gt; query. In version 3.2.3, the query and execute methods should be called separately, otherwise an error will be reported in debug mode
After 3.2.3, the TP framework requires different method calls for read and write operations. If it is used incorrectly, an error will be reported in non debugging mode.
Read data using $this->query
Write data using $this->execute
After TP5, it is written as follows:
Read data using Db::query
Write data using Db::execute
[docker] error in deleting image: image is referenced in multiple repositories
Error in deleting according to image ID:
[root@master-gxf zipkin-ui]# docker rmi 66ce95468449
Error response from daemon: conflict: unable to delete 66ce95468449 (must be forced) - image is referenced in multiple repositories
Docker images finds that the same image ID is tagged into multiple different warehouses
[root@master-gxf zipkin-ui]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
blanchedingding/zipkin-ui logvisualization 66ce95468449 23 minutes ago 78.8MB
doraemon/zipkin-ui logvisualization 66ce95468449 23 minutes ago 78.8MB
zipkin-ui latest 66ce95468449 23 minutes ago 78.8MB
Use R epository:tag You can delete it in the following way:
[root@master-gxf zipkin-ui]# docker rmi doraemon/zipkin-ui:logvisualization
Untagged: doraemon/zipkin-ui:logvisualization
[root@master-gxf zipkin-ui]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
blanchedingding/zipkin-ui logvisualization 66ce95468449 25 minutes ago 78.8MB
zipkin-ui latest 66ce95468449 25 minutes ago 78.8MB
[solution] the resource file cannot be found in the jar package of Java
The file is placed in the Resources folder and will appear in the boot after it is typed as a jar package_ INF/classes/ xx.xx The second one is the second one;
The file path uses “absolute path”/ xx.xx “, load URL and create InputStream with classloader:
URL fileURL=this.getClass().getResource("/xx.xx");
InputStream is=this.getClass().getResourceAsStream("/resource/res.txt");
When MySQL is running, the server suddenly goes down, which causes Mysql to be unable to restart
When MySQL is running, the server suddenly goes down, which causes Mysql to be unable to restart
When MySQL transfers files, it suddenly loses power. Find the database file under data, delete/move the previous database folder, and then restart.
Phpstrom reported an error when using SVN: CreateProcess error = 2, the system could not find a solution for the specified file
After phpstrom is installed, the following error will appear during SVN checkout:
Cannot load supported formats: Cannot run program “svn”: CreateProcess error=2
The reason is that SVN uses command-line tools. If there is no SVN command-line tool locally, it will lead to an error.
Solution
Re install SVN, select the installation command line and complete the installation
Change to:
Then all the way to next, the installation is successful.
Restart phpstrom, SVN can be used normally.
PHP in Windows combined with bat batch processing to achieve multi process verification proxy server function
PHP in Windows combined with bat batch processing to achieve verification proxy IP server function
1、 Capture and verify proxy through curl of PHP
Second, multi process processing through bat
Third, merge the results of multi process processing
PHP in Windows combined with bat batch processing to achieve verification proxy IP server function
due to business, proxy server is needed. There are many sites providing proxy server information on the Internet, so you can get information from these sites. However, due to the network or other reasons, some of the obtained IP is inaccessible, so we need to do verification filtering to get the proxy server that can be used.
1、 Capture and verify proxy through curl of PHP
grab with curl
thinking
1. Curl grabs website content;
2. Simple_ html_ DOM (click to download) parses the captured content, parses the key information, and saves the file (or cache);
3. Perform curl verification on the key information (IP and port of proxy server);
4. Verification is divided into HTTPS and HTTP methods, which should be distinguished.
2、 Multi process processing by bat
thinking
1. A single CMD window can run a php.exe Process, multiple processes can run multiple processes;
2. Modify the PHP program, support the parameter transfer of CLI mode, different website links can be captured through different parameters;
3. Run multiple CMDS through the start command (view the description), and use & amp; Connect, make main.bat File;
4 main.bat The running status of other CMD windows can be monitored in the file, which can be obtained in the tasklist by setting the title of the CMD;
5. After the running of other CMD windows (PHP tasks) is completed, the result set is merged.
3、 Merging the results of multiprocessing
take out the file saved in the first step, and then merge the result with PHP code, and output it to result_ xxx.json It can be done in the middle;
The code will not be posted for the time being. It will be updated later.
On the use of cnzz statistics advertising research note
when I was working on a website, the first thing I thought of was cnzz data statistics service, which is now merged by the alliance.
I often find that advertisements appear in the website for no reason, but I have not joined any advertising alliance myself. I felt very strange. I searched the Internet and found that what I said on the Internet was basically abuse of cnzz
Abuse of cnzz
I also feel very depressed. I feel that they are killing themselves. Then I encountered this problem again today. I changed Baidu’s statistics and found that there is still this problem. Then I looked at the problems and the reasons carefully
Found something in the red wire.
http://w.c-cnzz.com/cl.php #This web address, the following parameters are not written
After several times of cleaning up, this thing and advertisement appeared all the time. I was depressed for a long time. Looking back one time, I suddenly found the problem:
http://w.c-cnzz.com # There are advertisements
https://s13.cnzz.com/ #JS link of cnzz, no advertisement
It turns out that the problem lies here. The two domains are different, but they seem to be related to each other. They all have cnzz characters, which makes people easily associate with each other.
Later, after testing, I found that because my own website is HTTP protocol, I didn’t open HTTPS, so when I took the link of Baidu JS in the figure above, it was wrong http://push.zhanzhang.baidu.com/push.js For this unsafe address, others have a good chance to get a W.C- cnzz.com We’re going to see the ads coming out. Really bad!!!
I checked the IP addresses of the two domains again:
w.c- cnzz.com The IP address of Alibaba cloud is 47.91.169.239
s13. cnzz.com The IP is 116.253.191.237
Then the correct solution is to use all the external resource files in the way of HTTPS, so there will be no problem.
In summary, we should be more careful when we encounter problems in the future. It’s better to use HTTPS to protect resources outside the station!
The solution of a Java exception has occurred. And error exception in thread when eclipse runs
This problem is caused by a Java class file compiled by a higher version of JDK trying to run on a lower version of JVM.
1. The solution is to ensure that the versions of JVM (Java command) and JDK (javac command) are consistent. If it is the Linux version, enter the Java – version and javac – version commands in the command line to see if the versions are consistent. I use 1.7.0_ 80。
2. The same version still can’t solve the problem. I don’t compile with javac directly from the command line, but with eclipse compiler. Because many compilers come with javac, rather than using the compiler in the operating system. If your compiler is eclipse, you need to set the JDK version in the properties of the project. The method is to right-click the project — & gt; properties — & gt; Java compiler — & gt; enable project specific settings — & gt; and set the compiler compliance level to 1.7, which is the version consistent with the JVM (the version shown by Java – version in the command line). Because of the need to be compatible with other software before, I reduced the Java version from 1.8 to 1.7, but eclipse did not move, so after opening it, I found that the default was 1.8, so I manually reduced it to 1.7, recompiled it, and finally passed!
To sum up, if you are compiling with a compiler, make sure that the JDK version of the compiler is consistent with the Java version of the operating system.
The screenshot is as follows: