Error reported in Xcode: unknown attribute ‘observableobject’
Error reason:
@ObservableObject var vm: ViewModel = ViewModel()
Modify to the below:
@ObservedObject private var vm: ViewModel = ViewModel()
Error reported in Xcode: unknown attribute ‘observableobject’
Error reason:
@ObservableObject var vm: ViewModel = ViewModel()
Modify to the below:
@ObservedObject private var vm: ViewModel = ViewModel()
Today, after writing a program, I found that the compiler always reports an error: error converting to execution character set illegal byte sequence. When compiling by default, it is parsed according to UTF-8, and when the character set is not specified, it is always treated as UTF-8. So you have to add the following in settings->compiler->Global compiler settings->Other options:
-fexec-charset=GBK
-finput-charset=UTF-8
The former represents the encoding interpretation format of the input file during compilation, and the latter represents the encoding format used for the display of the generated execution file during execution.
At the same time. In settings -> Editor-> gernal settings-> Other settings, set the file encoding format saved by default to UTF-8, and keep the encoding formats of both sides the same.
But after I did this, I found it useless… Later, I found that my program didn’t know when it was changed to ANSI format, so it had been either compiled incorrectly or Chinese garbled.
To solve this problem, you can open the code file with notepad and select the file – & gt; How to select the encoding format of UTF-8 to save as.
The problem encountered today in running mapreduce locally:
Could not locate executable null \bin\winutils.exe in the hadoop binaries Unable to load native-hadoop library for your platform… using builtin-Java classes where applicable
Reason:
Solution: Download these two files, download and import these two files into the bin directory under the hadoop directory
edition:
Ant Design Pro 5,typescript
Background:
One project was finished and waited for communication in the later stage, so I went to do other projects. When you look back at this project, you can’t start it and delete the node_Modules also failed to start.
Solution:
Delete src/.umi folder, restart the server, and the project starts normally.
Call the weight file of yolov3 with OpenCV to obtain the names of the three scale output layers and report an error
ln = [ln[i[0] - 1] for i in net.getUnconnectedOutLayers()]
Error reporting
indexerror: invalid index to scalar variable
This code was a few years ago. It may be a problem with the version. Now it will report an error
Solution:
Remove [0] and modify as below:
ln = [ln[i - 1] for i in net.getUnconnectedOutLayers()]
Ibufg reports an error during compilation
ERROR :;NgdBuild:770 - IBUFG ‘IBUFG_inst4’ and IBUFG ‘PLL_doub_u/clkin1_buf’ on net ‘clk_pll’ are lined up in series. Buffers of the same direction cannot beplaced in series. ERROR:NgdBuild:462 - input pad net ‘clk pll’ drives multiple buffers: pin o on block IBUFG_inst4 with type IBUFG, pin I on block PLL_doub_u/ clkin1_buf with type IBUEG.
Ibufg error analysis
The first error says that the buffer has the same point
The second error refers to multiple buffer conflicts on the clock pin clk_pll that I have defined.
map compilation failed
Solution:
This error is caused by adding buffer to the input clock source in the IP core of PLL
after modifying to no buffer, we can use our global ibufg
error: db5 error(11) from dbenv->open: Resource temporarily unavailable error: cannot open Packages index using db5 - Resource temporarily unavailable (11) error: cannot open Packages database in /var/lib/rpm CRITICAL:yum.main: Error: rpmdb open failed
1. Fault
Android studio start error: internal error
java.util.concurrent.CompletionException: java.net.BindException: Address already in use
the IDE cannot be opened due to such an error
2. General solutions
According to the analysis of many people, it is necessary to use Netsh Winsock reset on CMD to reset the network:
netsh winsock reset
If you restart your computer and open Android Studio again, you can open it successfully if you open it immediately, but if you open Android Studio after a while after your computer restarts, you may still report an error and cannot open it. There is also a possibility that if you open it this time, you will not be able to open it again next time.
So this solution does not work.
On the Internet, there are also those who turn off the firewall, and add a line of code disable.android.first.run=true at the end of Android Studio\bin\idea.properties in the installation directory, but they are not reliable.
Uninstall Android Studio and reinstall it.
3. The ultimate solution
Android Studio will start the server on the local host for internal processes and try to bind on any port between 6942 and 6991. And the computer Hyper-V will reserve many ports, once the ports 6942~6991 are in reserved state, Android Studio cannot be opened (report java.util.concurrent.CompletionException: java.net: Address already in use error).
Check the reserved port using the command.
netsh int ipv4 show excludedportrange protocol=tcp
Solution: exclude the port range we need and don’t let Hyper-V keep it
Restart the computer, open CMD with administrator authority
, and enter the following instructions:
netsh int ip add excludedportrange protocol=tcp startport=6942 numberofports=50
It’s that simple. If you solve the problem, there will be no problem that Android studio can’t open and report errors in the future.
Such errors may occur when using the above instructions:
This is because, after restarting the computer, the commands are entered too slowly and are taken up by Hyper-V before they have a chance to be executed. Remember to be fast.
Or, go to the BIOS to turn Hyper-V off, then start the computer, slowly enter the above instructions, and when the instructions are finished, go to the BIOS to turn on Hyper-V
Error description
When running vibe, the CentOS
server without display is used. When using pyrender
for off screen
rendering, errors are reported OpenGL.error.GLError: GLError(err = 12296
), as follows:
Traceback (most recent call last):
File "demo.py", line 416, in <module>
main(args)
File "demo.py", line 278, in main
renderer = Renderer(resolution=(orig_width, orig_height), orig_img=True, wireframe=args.wireframe)
File "***/VIBE/lib/utils/renderer.py", line 60, in __init__
point_size=1.0
File "***/anaconda3/envs/vibe-env/lib/python3.7/site-packages/pyrender/offscreen.py", line 31, in __init__
self._create()
File "***/anaconda3/envs/vibe-env/lib/python3.7/site-packages/pyrender/offscreen.py", line 134, in _create
self._platform.init_context()
File "***/anaconda3/envs/vibe-env/lib/python3.7/site-packages/pyrender/platforms/egl.py", line 177, in init_context
assert eglInitialize(self._egl_display, major, minor)
File "***/anaconda3/envs/vibe-env/lib/python3.7/site-packages/OpenGL/platform/baseplatform.py", line 409, in __call__
return self( *args, **named )
File "***/anaconda3/envs/vibe-env/lib/python3.7/site-packages/OpenGL/error.py", line 232, in glCheckError
baseOperation = baseOperation,
OpenGL.error.GLError: GLError(
err = 12296,
baseOperation = eglInitialize,
cArguments = (
<OpenGL._opaque.EGLDisplay_pointer object at 0x7f883a03a170>,
c_long(0),
c_long(0),
),
result = 0
)
Solution
Ubuntu: https://pyrender.readthedocs.io/en/latest/install/index.html#installmesa Use OSMesa
to offscreen render
.
It is more convenient to use · CONDA · to install osmesa
as follows:
conda install osmesa
Note: after installing osmesa
, reinstall pyopengl
, otherwise an error will still be reported, as follows:
pip uninstall pyopengl
git clone https://github.com/mmatl/pyopengl.git
pip install ./pyopengl
Specify PYOPENGL_PLATFORM
before running the scriptis osmesa
, as follows:
# demp.py
import os
# os.environ['PYOPENGL_PLATFORM'] = 'egl'
os.environ['PYOPENGL_PLATFORM'] = 'osmesa'
Note: os.environ[‘PYOPENGL_PLATFORM’] = ‘osmesa’ should ideally follow import os to ensure that PYOPENGL_PLATFORM is changed to osmesa before using render, or you can explicitly specify os.environ before using render specifically [‘PYOPENGL_PLATFORM’] = ‘osmesa’.
Error Messages:
— Configuring done — Generating done CMake Error: Running ‘D:/Qt/Tools/Ninja/ninja.exe’ ‘-C’ ‘D:/code/build-EFR-linux247-Debug’ ‘-t’ ‘recompact’ failed with: ninja: error: build.ninja:1802: multiple rules generate Debug/xxx.exe [-w dupbuild=err] |
Cause:
Duplicate multiple targets
CMAKE If the specified target is the same as the target path automatically generated by qt, this problem will occur
Solution:
Modify the target path
Problem description
First, an error occurred:
error:spawn failed...
After some blog operations, the following problems will occur:
fatal: cannot lock ref 'HEAD': unable to resolve reference HEAD: Invalid argument error: src refspec
Or:
error: src refspec HEAD does not match any.
The following picture is an error report after uploading GitHub by myself hexo d
:
FATAL {
err: Error: Spawn failed
at ChildProcess.<anonymous> (D:\Program Files\blog\node_modules\hexo-util\lib\spawn.js:51:21)
at ChildProcess.emit (node:events:526:28)
at ChildProcess.cp.emit (D:\Program Files\blog\node_modules\cross-spawn\lib\enoent.js:34:29)
at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12) {
code: 128
}
} Something's wrong. Maybe you can find the solution here: %s https://hexo.io/docs/troubleshooting.html
Cause analysis:
The problem is mostly due to git doing a push or hexo d and changing some of the content under the .deploy_git file.
Solution:
Solution: 1
1. Delete .deploy_git
folder
2. Enter git config --global core.autocrlf false
3. Then, execute in sequence:
hexo clean
hexo g
hexo d
Solution: 2
1. Enter the hexo root directory
2 Direct the arrow to .deploy_git
and public
are deleted directly
3. Then, execute in sequence:
hexo clean
hexo g
hexo d
Be careful!!: Deleting these two folders will not affect you! After the implementation of hexo, the third company will redeploy simple violence!
JNI DETECTED ERROR IN APPLICATION: GetStringUTFChars received NULL jstring
A/k.myapplicatio: java_vm_ext.cc:545] JNI DETECTED ERROR IN APPLICATION: GetStringUTFChars received NULL jstring
java_vm_ext.cc:545] in call to GetStringUTFChars
java_vm_ext.cc:545] from void com.sdk.myapplication.MainActivity.triggerGetStringUTFCharsNPE(java.lang.String, java.lang.String)
The reason for the above message, from a Jni method, refers to the case where the JVM calls the method and the GetStringUTFChars entry jstring is empty, it must not refer specifically to the method body where the GetStringUTFChars call has a NULl pointer, but includes other C/C++ method calls in the method that have a NULL pointer. NULL pointer. So we have to look at the crash stack carefully to quickly locate the place where the NULL pointer is generated to avoid invalid output.
the above example is extracted according to our own business code
the example code is as follows
java
public class MainActivity extends AppCompatActivity {
// Used to load the 'native-lib' library on application startup.
static {
System.loadLibrary("native-lib");
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Example of a call to a native method
TextView tv = findViewById(R.id.sample_text);
tv.setText(stringFromJNI());
triggerGetStringUTFCharsNPE("hello", null);//introduce a null
}
/**
* A native method that is implemented by the 'native-lib' native library,
* which is packaged with this application.
*/
public native String stringFromJNI();
public native void triggerGetStringUTFCharsNPE(String p1, String p2);
}
jni
#include <jni.h>
#include <string>
#include <android/log.h>
static const char* TAG = "Demo";
void nestFunction(JNIEnv *env, jstring p2) {
//Here p1 is simply passed in via a parameter, but the actual business logic may be obtained by other methods/ways
const char* pStr = env->GetStringUTFChars(p2, nullptr);
__android_log_print(ANDROID_LOG_DEBUG, TAG, "pStr:%s", pStr);
env->ReleaseStringUTFChars(p2, pStr);
}
extern "C" JNIEXPORT jstring JNICALL
Java_com_sdk_myapplication_MainActivity_stringFromJNI(
JNIEnv* env,
jobject /* this */) {
std::string hello = "Hello from C++";
return env->NewStringUTF(hello.c_str());
}extern "C"
JNIEXPORT void JNICALL
Java_com_sdk_myapplication_MainActivity_triggerGetStringUTFCharsNPE(JNIEnv *env, jobject thiz,
jstring p1, jstring p2) {
const char* pStr1 = env->GetStringUTFChars(p1, nullptr);
__android_log_print(ANDROID_LOG_DEBUG, TAG, "pStr1:%s", pStr1);
env->ReleaseStringUTFChars(p1, pStr1);
//故意让nestFunction产生 JNI DETECTED ERROR IN APPLICATION: GetStringUTFChars received NULL jstring
nestFunction(env, p2);
}