Today, I encountered such a strange bug. After searching for a long time, I didn’t find it. When I finally reviewed the code, I found that the in the error reporting function called an undeclared function . But the compiler didn’t give me a hint and found that it took a certain amount of time. Finally, I declare and implement the function, and the bug is gone.
Category Archives: How to Fix
IOS warning – this block declaration is not a prototype
About warnings
We define a block without parameters, usually in the following way
|
one |
|
A warning is prompted in xcode9
|
one two |
|
The solutions can be as follows
|
one |
|
But in this way, many third parties need to change, the scope involved is too large, it may not be suitable at present, although this is the trend
Or, if it’s only a few places, it can be used
|
one two three four |
|
A complete temporary solution to all such warnings
In the setting of the project

Set to no, the warnings disappear
However, this is not a good habit. It’s just a temporary way not to prompt this type of warning
C# Member XXX cannot be accessed with an instance with an instance reference;qualify it with a type
C # error report:
Member XXX cannot be accessed with an instance with an instance reference;qualify it with a type name instead
Cannot access member XXX with an instance reference; qualify it with a type name instead
Solution: the method is static, so use the Class.Func Call instead of instantiation.
Attributeerror: ‘bytes’ object has no attribute’ encode ‘
When training the model, the following error is reported:
attributeerror: ‘bytes’ object has no attribute’ encode ‘
solution: click error report to enter the corresponding error report document, and change encode to decode.
This is because in python3, the encoding distinguishes between string and binary https://www.jianshu.com/p/a4cf632d97f1
Learning notes of Python 3: debugger speedups using Python not found
When you first run the PY module (eclipse), you usually encounter warning
warning: Debugger speedups using cython not found. Run '"C:\Python\Python36\python.exe" "C:\D\J2EESpace\eclipseNEON2\plugins\org.python.pydev.core_6.3.3.201805051638\pysrc\setup_cython.py" build_ext --inplace' to build.
pydev debugger: starting (pid: 10056)
The warning will not affect the running of the program. Indicates that cython was not found.
Python is an extension module tool of python, which is mixed with Python and C language to speed up the efficiency of Python.
According to the prompt, enter the “pysrc” directory and execute
python setup_cython.py build_ext --inplace
That’s it.
Note that “Microsoft Visual C + + 14.0 is required” error sometimes occurs during execution.
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools
Therefore, it is necessary to ensure that Microsoft Visual C + + 14.0 (download address) is installed on the PC.
Attributeerror: the solution of module ‘urllib’ has no attribute ‘quote’
Record:
Today, I saw the interface document provided by others. When parsing the text, I used urllib.quote In the end, we found that it was a version problem. The way to write python2 is urllib.quote , python3 should be changed to urllib.parse.quote That’s it.
IOS solves the problem of this action could not be completed. Try again


Perfect solution for terminal executing three commands
Respect the labor achievements of the Creator

- cd ~ mv .itmstransporter/ .old_ itmstransporter/ “/Applications/ Xcode.app/Contents/Applications/Application Loader.app/Contents/itms/bin/iTMSTransporter ”
be careful:
We must wait for the third command to be executed!
Python 3 error typeerror: ‘dict’_ keys‘ object is not subscriptable
Problem: using in Python encoding dict.keys (), typeerror: ‘dict’ will be reported_ Keys’ object is not subscriptable

Solution: you need to use list in Python 3, as shown in the figure

Reason: Dict_ Keys ([‘No surfacing ‘,’flippers’]) returns a dict_ The keys object is no longer of the list type and does not support index
Therefore, the list type can be used
If there is any omission in my statement, please don’t hesitate to give me advice. Thank you very much!
If you think it’s useful, please praise it, creative power!
Gcc compiler warning solution: “extra tokens at end of ifndef directive” Tags: GCC, warning
Recently, after checking all the warnings in the project, we found an interesting warning: “extra tokens at end of ifndef directive”. Literally, “there are invalid instructions after ifndef.”. I wrote a small program verification in private, and found that there are two situations that can generate this warning.
Procedure 1:
// directive_1.c
#include <stdio.h>
#ifndef MIN
#define MIN(x, y) ((x) > (y) ? (y) : (x))
#endif /**/x
int main()
{
printf("min val = %d\n", MIN(100, -1));
return 0;
}
The above program intentionally adds an invalid character X after “ENDIF / * * / and compiles with GCC with – wall parameter as follows:
GCC directive_ 1. C - wall - O out1
an alarm is generated immediately:
directive_1.c:5:12: warning: extra tokens at end of #endif directive [-Wendif-labels]
#endif /**/x
I was immediately shocked. Such an obvious “error” problem was that GCC was just a warning, and generated an executable binary file to execute . / out1 . The result was normal, and the effect was as follows:
min val = -1
Procedure 2:
// directive_2.c
#include <stdio.h>
#ifndef MIN
#define MIN(x, y) ((x) > (y) ? (y) : (x))
#endif
int main()
{
printf("min val = %d\n", MIN(100, -1));
return 0;
}
Remove the redundant “X” above, and the compilation will be completely normal. As follows:
wangkai@fiberserver:extra-tokens-at-end-of-#ifndef-directive$ gcc directive_2.c -Wall -o out1
wangkai@fiberserver:extra-tokens-at-end-of-#ifndef-directive$
After further divergence of the possible situation after ifndef, it is found that there is another situation that can cause this alarm.
Procedure 3:
// directive_3.c
#include <stdio.h>
#ifndef MIN(x, y)
#define MIN(x, y) ((x) > (y) ? (y) : (x))
#endif
int main()
{
printf("min val = %d\n", MIN(100, -1));
return 0;
}
Execute the command “ GCC directive"_ 3. C - wall - O out3 , this alarm also magically appears, as follows:
wangkai@fiberserver:extra-tokens-at-end-of-#ifndef-directive$ gcc directive_3.c -Wall -o out3
directive_3.c:3:12: warning: extra tokens at end of #ifndef directive
#ifndef MIN(x, y)
^
The reason is that the preprocessing of # ifndef in C language only checks the keywords, and the “(x, y)” after it is considered as redundant characters. If the brackets are removed and written as # ifndef min , there will be no alarm.
Solution to failure of SSL configuration in synergy
After the synergy Pro is activated, the SSL certificate is automatically generated and SSL encryption is turned on. However, due to some unknown bug, the certificate automatically generated for the first time on the Mac can’t be used. This error will be reported:
[2017-01-25T09:57:03] INFO: OpenSSL 1.0.2 22 Jan 2015
[2017-01-25T09:57:18] ERROR: ssl error occurred (system call failure)
[2017-01-25T09:57:18] ERROR: eof violates ssl protocol
[2017-01-25T09:57:18] ERROR: failed to accept secure socket
[2017-01-25T09:57:18] INFO: client connection may not be secure
It needs to be solved as follows:
- in the settings of synergy pro, uncheck use SSL to close the current synergy pro, open the terminal, enter
~ / library / synergy / SSL to delete all files in the directory, reopen synergy pro, check use SSL in the settings, the software will regenerate the certificate, stop the original client, re connect, trust the certificate in the pop-up box, the problem is solved. If there is such a problem when the client connects:
[2017-01-25T09:59:13] ERROR: ssl error occurred (generic failure)
[2017-01-25T09:59:13] ERROR: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol
[2017-01-25T09:59:13] ERROR: failed to connect secure socket
It indicates that either client or server does not enable SSL. Please check all servers and clients. SSL must be enabled or not. There must not be only some enabled.
Spring ApplicationContext – Resource leak: ‘context’ is never closed
Compiling environment: Eclipse
Problem: in spring MVC applications, I use the following method to initialize variables in one of the service classes
ApplicationContext context=new ClassPathXmlApplicationContext("Beans.xml");
HelloWorld obj=(HelloWorld) context.getBean("helloWorld");
obj.getMessage();
In the first line of the above code, the ‘context’ variable generates a warning. The warning is as follows:
Resource leak: 'context' is never closed
Solution: because ApplicationContext has an instance of classpathxmlapplicationcontext, it has a close () method. We just need to throw the context object and call the close () method, as shown below.
((ClassPathXmlApplicationContext) context).close();
In addition, if the ApplicationContext uses an abstractapplicationcontext instance, you need to throw the context object of that type and call the close () method.
import org.springframework.context.support.AbstractApplicationContext;
...
...
...
...
((AbstractApplicationContext) context).close();
Animation event has no receiver in unity animation
In the process of editing animation by unity, this prompt always appears:
AnimationEvent ‘XXXXXX’ on animation ‘XXXXXX’ has no receiver! Are you missing a component?
After a long time, I changed the value, but it didn’t work
Hang the script of the method you want to execute on the object you want to execute the animation, and that’s it!
Yes, it’s that simple. But waste me a long time!!!