Author Archives: Robins

[Solved] Sed Failed to Reference Variable error: extra characters after command

Environment:

Operating system: CentOS
Background: shell script

Question:

sudo sed -n '842,${line}p' /.../file > ./file1

After execution, an error is reported:
– e expression # 1, char 7: extra characters after command.

Solution:

After investigation, it is found that it is OK to replace single quotation marks with double quotation marks, as follows:

sudo sed -n "842,${line}p" /.../file > ./file1

If none of the methods found work, try this one.

Remember that variables cannot be referenced within single quotes.

DONE!

Android 10 SurfaceView Crash: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x4

Recently, it was found that SurfaceView crashed during the test on Android 10 system. The system tests before 10 will crash, but it is normal on devices after Android 11.

Error log

Native error message

signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x4
Cause: null pointer dereference
    eax 00000000  ebx f017756c  ecx 00000001  edx 00017af6
    edi 00017af6  esi edbe9140
    ebp c4c67938  esp c4c67920  eip f0169a71

backtrace:
      #00 pc 0000fa71  /system/lib/libutils.so (android::RefBase::incStrong(void const*) const+33) (BuildId: 288ba3aff5b46dbd7e74be954af88b83)
      #01 pc 00114620  /system/lib/libandroid_runtime.so (android::nativeDeferTransactionUntilSurface(_JNIEnv*, _jclass*, long long, long long, long long, long long)+96) (BuildId: 3643bee2c4fb7899d7781c565843060b)
      #02 pc 002a2325  /system/framework/x86/boot-framework.oat (art_jni_trampoline+213) (BuildId: 38176ebc9c3cce5f657a723b08d40d487952c484)
      #03 pc 0204d399  /memfd:/jit-cache (deleted) (android.view.SurfaceControl.access$2700+89)
      #04 pc 020421aa  /memfd:/jit-cache (deleted) (android.view.SurfaceControl$Transaction.deferTransactionUntilSurface+202)
      #05 pc 02036db1  /memfd:/jit-cache (deleted) (android.view.SurfaceView.applySurfaceTransforms+177)
      #06 pc 0204979f  /memfd:/jit-cache (deleted) (android.view.SurfaceView.setParentSpaceRectangle+95)
      #07 pc 020546cb  /memfd:/jit-cache (deleted) (android.view.SurfaceView.access$200+59)
      #08 pc 0204ae12  /memfd:/jit-cache (deleted) (android.view.SurfaceView$3.positionChanged+434)
      #09 pc 0203c004  /memfd:/jit-cache (deleted) (android.graphics.RenderNode$CompositePositionUpdateListener.positionChanged+148)

Error messages displayed in the application layer log

Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x10 in tid 6711 (hwuiTask0), pid 6669 (.crash)
Exception from repositionChild
    java.lang.NullPointerException: mNativeObject is null. Have you called release() already?
            at android.view.SurfaceControl.checkNotReleased(SurfaceControl.java:945)
            at android.view.SurfaceControl.access$800(SurfaceControl.java:77)
            at android.view.SurfaceControl$Transaction.setPosition(SurfaceControl.java:2170)
            at android.view.SurfaceView.applySurfaceTransforms(SurfaceView.java:1025)
            at android.view.SurfaceView.setParentSpaceRectangle(SurfaceView.java:1038)
            at android.view.SurfaceView.access$200(SurfaceView.java:99)
            at android.view.SurfaceView$1.positionChanged(SurfaceView.java:1081)

Find a relevant Google patch on the Internet according to the error information

commit	005c63e8c6e6e5b312dc9c4631c57fb12224df30	[log] [tgz]
author	Robert Carr <[email protected]>	Fri Sep 20 14:31:24 2019 -0700
committer	Robert Carr <[email protected]>	Fri Sep 20 14:48:40 2019 -0700
tree	939eaeca0159a44bca7b5abf44f41f5096c1fb90
parent	c48da419931a3a9272910f2631f815cecf05c9ba [diff]
SurfaceView: Destroy SurfaceControl from RenderThread

Currently there is a race where the UI thread can destroy
the SurfaceControl (free the C++ object) while the RenderThread
still has pending operations on it. To fix have the positionLost callback handle the destruction.

Bug: 139111930
Bug: 136808018
Test: go/wm-smoke
Change-Id: Id5225e1e47046d928f8298de38ff61662debe360
diff --git a/core/java/android/view/SurfaceView.java b/core/java/android/view/SurfaceView.java
index 90e69f3..262b9e5 100644
--- a/core/java/android/view/SurfaceView.java
+++ b/core/java/android/view/SurfaceView.java
@@ -136,6 +136,7 @@
     @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
     boolean mIsCreating = false;
     private volatile boolean mRtHandlingPositionUpdates = false;
+    private volatile boolean mRtReleaseSurfaces = false;
 
     private final ViewTreeObserver.OnScrollChangedListener mScrollChangedListener =
             this::updateSurface;
@@ -658,7 +659,14 @@
     }
 
     private void releaseSurfaces() {
+        mSurfaceAlpha = 1f;
+
         synchronized (mSurfaceControlLock) {
+            if (mRtHandlingPositionUpdates) {
+                mRtReleaseSurfaces = true;
+                return;
+            }
+
             if (mSurfaceControl != null) {
                 mTmpTransaction.remove(mSurfaceControl);
                 mSurfaceControl = null;
@@ -669,7 +677,6 @@
             }
             mTmpTransaction.apply();
         }
-        mSurfaceAlpha = 1f;
     }
 
     /** @hide */
@@ -1084,7 +1091,9 @@
             // the synchronization would violate the rule that RT must never block
             // on the UI thread which would open up potential deadlocks. The risk of
             // a single-frame desync is therefore preferable for now.
-            mRtHandlingPositionUpdates = true;
+            synchronized(mSurfaceControlLock) {
+                mRtHandlingPositionUpdates = true;
+            }
             if (mRTLastReportedPosition.left == left
                     && mRTLastReportedPosition.top == top
                     && mRTLastReportedPosition.right == right
@@ -1126,6 +1135,18 @@
                         frameNumber);
             }
             mRtTransaction.hide(mSurfaceControl);
+
+            synchronized (mSurfaceControlLock) {
+                if (mRtReleaseSurfaces) {
+                    mRtReleaseSurfaces = false;
+                    mRtTransaction.remove(mSurfaceControl);
+                    mRtTransaction.remove(mBackgroundControl);
+                    mSurfaceControl = null;
+                    mBackgroundControl = null;
+                }
+                mRtHandlingPositionUpdates = false;
+            }
+
             mRtTransaction.apply();
         }
     };

After updating, the SurfaceView getViewRootImpl() will always be empty. No patches for other updates were found
Because it is normal to test on Android 11, Android 11 solves this problem, so directly copy the code of Android 11’s SurfaceView. Because Android 11 has updated a lot of things, select relevant modifications to update.

diff --git a/frameworks/base/core/java/android/view/SurfaceView.java b/frameworks/base/core/java/android/view/SurfaceView.java
index d11548d687..3d1a5a3549 100644
--- a/frameworks/base/core/java/android/view/SurfaceView.java
+++ b/frameworks/base/core/java/android/view/SurfaceView.java
@@ -118,8 +118,7 @@ public class SurfaceView extends View implements ViewRootImpl.WindowStoppedCallb
     boolean mDrawFinished = false;

     final Rect mScreenRect = new Rect();
-    SurfaceSession mSurfaceSession;
-
+    private final SurfaceSession mSurfaceSession = new SurfaceSession();
     SurfaceControl mSurfaceControl;
     // In the case of format changes we switch out the surface in-place
     // we need to preserve the old one until the new one has drawn.
@@ -135,6 +134,7 @@ public class SurfaceView extends View implements ViewRootImpl.WindowStoppedCallb
     @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
     boolean mIsCreating = false;
     private volatile boolean mRtHandlingPositionUpdates = false;
+    private volatile boolean mRtReleaseSurfaces = false;

     private final ViewTreeObserver.OnScrollChangedListener mScrollChangedListener =
             this::updateSurface;
@@ -428,9 +428,16 @@ public class SurfaceView extends View implements ViewRootImpl.WindowStoppedCallb
     }

     private void performDrawFinished() {
+        if (mDeferredDestroySurfaceControl != null) {
+            synchronized (mSurfaceControlLock) {
+                mTmpTransaction.remove(mDeferredDestroySurfaceControl).apply();
+                mDeferredDestroySurfaceControl = null;
+            }
+        }
         if (mPendingReportDraws > 0) {
             mDrawFinished = true;
             if (mAttachedToWindow) {
+                mParent.requestTransparentRegion(SurfaceView.this);
                 notifyDrawFinished();
                 invalidate();
             }
@@ -658,7 +665,15 @@ public class SurfaceView extends View implements ViewRootImpl.WindowStoppedCallb
     }

     private void releaseSurfaces() {
+        mSurfaceAlpha = 1f;
+
         synchronized (mSurfaceControlLock) {
+            mSurface.release();
+            if (mRtHandlingPositionUpdates) {
+                mRtReleaseSurfaces = true;
+                return;
+            }
+
             if (mSurfaceControl != null) {
                 mTmpTransaction.remove(mSurfaceControl);
                 mSurfaceControl = null;
@@ -669,7 +684,6 @@ public class SurfaceView extends View implements ViewRootImpl.WindowStoppedCallb
             }
             mTmpTransaction.apply();
         }
-        mSurfaceAlpha = 1f;
     }

     /** @hide */
@@ -680,12 +694,21 @@ public class SurfaceView extends View implements ViewRootImpl.WindowStoppedCallb
             }
             return;
         }
-        ViewRootImpl viewRoot = getViewRootImpl();
-        if (viewRoot == null || viewRoot.mSurface == null || !viewRoot.mSurface.isValid()) {
+        final ViewRootImpl viewRoot = getViewRootImpl();
+        if (viewRoot == null) {
+            if (DEBUG) {
+                Log.d(TAG, System.identityHashCode(this)
+                        + " updateSurface: viewRoot null");
+            }
+            return;
+        }
+        if (viewRoot.mSurface == null || !viewRoot.mSurface.isValid()) {
             if (DEBUG) {
                 Log.d(TAG, System.identityHashCode(this)
                         + " updateSurface: no valid surface");
             }
+            notifySurfaceDestroyed();
+            releaseSurfaces();
             return;
         }

@@ -708,9 +731,14 @@ public class SurfaceView extends View implements ViewRootImpl.WindowStoppedCallb
         final boolean sizeChanged = mSurfaceWidth != myWidth || mSurfaceHeight != myHeight;
         final boolean windowVisibleChanged = mWindowVisibility != mLastWindowVisibility;
         boolean redrawNeeded = false;
-
-        if (creating || formatChanged || sizeChanged || visibleChanged || (mUseAlpha
-                && alphaChanged) || windowVisibleChanged) {
+        getLocationInSurface(mLocation);
+        final boolean positionChanged = mWindowSpaceLeft != mLocation[0]
+            || mWindowSpaceTop != mLocation[1];
+        final boolean layoutSizeChanged = getWidth() != mScreenRect.width()
+            || getHeight() != mScreenRect.height();
+        if (creating || formatChanged || sizeChanged || visibleChanged ||
+                (mUseAlpha && alphaChanged) || windowVisibleChanged ||
+                positionChanged || layoutSizeChanged) {
             getLocationInWindow(mLocation);

             if (DEBUG) Log.i(TAG, System.identityHashCode(this) + " "
@@ -744,7 +772,6 @@ public class SurfaceView extends View implements ViewRootImpl.WindowStoppedCallb

                 if (creating) {
                     viewRoot.createBoundsSurface(mSubLayer);
-                    mSurfaceSession = new SurfaceSession();
                     mDeferredDestroySurfaceControl = mSurfaceControl;

                     updateOpaqueFlag();
@@ -853,28 +880,7 @@ public class SurfaceView extends View implements ViewRootImpl.WindowStoppedCallb
                     final boolean surfaceChanged = creating;
                     if (mSurfaceCreated && (surfaceChanged || (!visible && visibleChanged))) {
                         mSurfaceCreated = false;
-                        if (mSurface.isValid()) {
-                            if (DEBUG) Log.i(TAG, System.identityHashCode(this) + " "
-                                    + "visibleChanged -- surfaceDestroyed");
-                            callbacks = getSurfaceCallbacks();
-                            for (SurfaceHolder.Callback c : callbacks) {
-                                c.surfaceDestroyed(mSurfaceHolder);
-                            }
-                            // Since Android N the same surface may be reused and given to us
-                            // again by the system server at a later point. However
-                            // as we didn't do this in previous releases, clients weren't
-                            // necessarily required to clean up properly in
-                            // surfaceDestroyed. This leads to problems for example when
-                            // clients don't destroy their EGL context, and try
-                            // and create a new one on the same surface following reuse.
-                            // Since there is no valid use of the surface in-between
-                            // surfaceDestroyed and surfaceCreated, we force a disconnect,
-                            // so the next connect will always work if we end up reusing
-                            // the surface.
-                            if (mSurface.isValid()) {
-                                mSurface.forceScopedDisconnect();
-                            }
-                        }
+                        notifySurfaceDestroyed();
                     }

                     if (creating) {
@@ -933,7 +939,6 @@ public class SurfaceView extends View implements ViewRootImpl.WindowStoppedCallb
                 } finally {
                     mIsCreating = false;
                     if (mSurfaceControl != null && !mSurfaceCreated) {
-                        mSurface.release();
                         releaseSurfaces();
                     }
                 }
@@ -944,48 +949,6 @@ public class SurfaceView extends View implements ViewRootImpl.WindowStoppedCallb
                 TAG, "Layout: x=" + mScreenRect.left + " y=" + mScreenRect.top
                 + " w=" + mScreenRect.width() + " h=" + mScreenRect.height()
                 + ", frame=" + mSurfaceFrame);
-        } else {
-            // Calculate the window position in case RT loses the window
-            // and we need to fallback to a UI-thread driven position update
-            getLocationInSurface(mLocation);
-            final boolean positionChanged = mWindowSpaceLeft != mLocation[0]
-                    || mWindowSpaceTop != mLocation[1];
-            final boolean layoutSizeChanged = getWidth() != mScreenRect.width()
-                    || getHeight() != mScreenRect.height();
-            if (positionChanged || layoutSizeChanged) { // Only the position has changed
-                mWindowSpaceLeft = mLocation[0];
-                mWindowSpaceTop = mLocation[1];
-                // For our size changed check, we keep mScreenRect.width() and mScreenRect.height()
-                // in view local space.
-                mLocation[0] = getWidth();
-                mLocation[1] = getHeight();
-
-                mScreenRect.set(mWindowSpaceLeft, mWindowSpaceTop,
-                        mWindowSpaceLeft + mLocation[0], mWindowSpaceTop + mLocation[1]);
-
-                if (translator != null) {
-                    translator.translateRectInAppWindowToScreen(mScreenRect);
-                }
-
-                if (mSurfaceControl == null) {
-                    return;
-                }
-
-                if (!isHardwareAccelerated() || !mRtHandlingPositionUpdates) {
-                    try {
-                        if (DEBUG_POSITION) {
-                            Log.d(TAG, String.format("%d updateSurfacePosition UI, "
-                                            + "position = [%d, %d, %d, %d]",
-                                    System.identityHashCode(this),
-                                    mScreenRect.left, mScreenRect.top,
-                                    mScreenRect.right, mScreenRect.bottom));
-                        }
-                        setParentSpaceRectangle(mScreenRect, -1);
-                    } catch (Exception ex) {
-                        Log.e(TAG, "Exception configuring surface", ex);
-                    }
-                }
-            }
         }
     }

@@ -994,12 +957,6 @@ public class SurfaceView extends View implements ViewRootImpl.WindowStoppedCallb
             Log.i(TAG, System.identityHashCode(this) + " "
                     + "finishedDrawing");
         }
-
-        if (mDeferredDestroySurfaceControl != null) {
-            mTmpTransaction.remove(mDeferredDestroySurfaceControl).apply();
-            mDeferredDestroySurfaceControl = null;
-        }
-
         runOnUiThread(this::performDrawFinished);
     }

@@ -1015,9 +972,8 @@ public class SurfaceView extends View implements ViewRootImpl.WindowStoppedCallb
     }

     private void applySurfaceTransforms(SurfaceControl surface, Rect position, long frameNumber) {
-        if (frameNumber > 0) {
-            final ViewRootImpl viewRoot = getViewRootImpl();
-
+        final ViewRootImpl viewRoot = getViewRootImpl();
+        if (frameNumber > 0 && viewRoot != null ) {
             mRtTransaction.deferTransactionUntilSurface(surface, viewRoot.mSurface,
                     frameNumber);
         }
@@ -1036,10 +992,10 @@ public class SurfaceView extends View implements ViewRootImpl.WindowStoppedCallb
         final ViewRootImpl viewRoot = getViewRootImpl();

         applySurfaceTransforms(mSurfaceControl, position, frameNumber);
-
-        applyChildSurfaceTransaction_renderWorker(mRtTransaction, viewRoot.mSurface,
+        if (frameNumber > 0 && viewRoot != null ) {
+            applyChildSurfaceTransaction_renderWorker(mRtTransaction, viewRoot.mSurface,
                 frameNumber);
-
+        }
         mRtTransaction.apply();
     }

@@ -1062,7 +1018,9 @@ public class SurfaceView extends View implements ViewRootImpl.WindowStoppedCallb
             // the synchronization would violate the rule that RT must never block
             // on the UI thread which would open up potential deadlocks. The risk of
             // a single-frame desync is therefore preferable for now.
-            mRtHandlingPositionUpdates = true;
+            synchronized(mSurfaceControlLock) {
+                mRtHandlingPositionUpdates = true;
+            }
             if (mRTLastReportedPosition.left == left
                     && mRTLastReportedPosition.top == top
                     && mRTLastReportedPosition.right == right
@@ -1096,14 +1054,27 @@ public class SurfaceView extends View implements ViewRootImpl.WindowStoppedCallb
             if (mSurfaceControl == null) {
                 return;
             }
+            final ViewRootImpl viewRoot = getViewRootImpl();

-            if (frameNumber > 0) {
-                final ViewRootImpl viewRoot = getViewRootImpl();

-                mRtTransaction.deferTransactionUntilSurface(mSurfaceControl, viewRoot.mSurface,
-                        frameNumber);
+            synchronized (mSurfaceControlLock) {
+                if (frameNumber > 0 && viewRoot != null) {
+                    if (viewRoot.mSurface.isValid()) {
+                        mRtTransaction.deferTransactionUntilSurface(mSurfaceControl, viewRoot.mSurface,
+                                frameNumber);
+                                       }
+                }
+                mRtTransaction.hide(mSurfaceControl);
+                if (mRtReleaseSurfaces) {
+                    mRtReleaseSurfaces = false;
+                    mRtTransaction.remove(mSurfaceControl);
+                    mRtTransaction.remove(mBackgroundControl);
+                    mSurfaceControl = null;
+                    mBackgroundControl = null;
+                }
+                mRtHandlingPositionUpdates = false;
             }
-            mRtTransaction.hide(mSurfaceControl);
+
             mRtTransaction.apply();
         }
     };
@@ -1348,4 +1319,29 @@ public class SurfaceView extends View implements ViewRootImpl.WindowStoppedCallb
     public SurfaceControl getSurfaceControl() {
         return mSurfaceControl;
     }
+
+    private void notifySurfaceDestroyed() {
+        if (mSurface.isValid()) {
+            if (DEBUG) Log.i(TAG, System.identityHashCode(this) + " "
+                    + "surfaceDestroyed");
+            SurfaceHolder.Callback[] callbacks = getSurfaceCallbacks();
+            for (SurfaceHolder.Callback c : callbacks) {
+                c.surfaceDestroyed(mSurfaceHolder);
+            }
+            // Since Android N the same surface may be reused and given to us
+            // again by the system server at a later point. However
+            // as we didn't do this in previous releases, clients weren't
+            // necessarily required to clean up properly in
+            // surfaceDestroyed. This leads to problems for example when
+            // clients don't destroy their EGL context, and try
+            // and create a new one on the same surface following reuse.
+            // Since there is no valid use of the surface in-between
+            // surfaceDestroyed and surfaceCreated, we force a disconnect,
+            // so the next connect will always work if we end up reusing
+            // the surface.
+            if (mSurface.isValid()) {
+                mSurface.forceScopedDisconnect();
+            }
+        }
+    }
 }

After modification, the test is normal, and the application will not crash, but an error log message will pop up from time to time
E/Layer: [SurfaceView – com. crash/com. crash. MainActivity # 3] No local sync point found

Check Layer.cpp when encountering this exception is to skip the logic, so it does not care, it is not clear if there are any other problems with this change.

 741 bool Layer::applyPendingStates(State* stateToCommit) {
 742     bool stateUpdateAvailable = false;
 743     while (!mPendingStates.empty()) {
 744         if (mPendingStates[0].barrierLayer_legacy != nullptr) {
 745             if (mRemoteSyncPoints.empty()) {
 746                 // If we don't have a sync point for this, apply it anyway. It
 747                 // will be visually wrong, but it should keep us from getting
 748                 // into too much trouble.
 749                 ALOGE("[%s] No local sync point found", mName.string());
 750                 popPendingState(stateToCommit);
 751                 stateUpdateAvailable = true;
 752                 continue;
 753             }
 754
 755             if (mRemoteSyncPoints.front()->getFrameNumber() !=
 756                 mPendingStates[0].frameNumber_legacy) {
 757                 ALOGE("[%s] Unexpected sync point frame number found", mName.string());
 758
 759                 // Signal our end of the sync point and then dispose of it
 760                 mRemoteSyncPoints.front()->setTransactionApplied();
 761                 mRemoteSyncPoints.pop_front();
 762                 continue;
 763             }
 764
 765             if (mRemoteSyncPoints.front()->frameIsAvailable()) {
 766                 ATRACE_NAME("frameIsAvailable");
 767                 // Apply the state update
 768                 popPendingState(stateToCommit);
 769                 stateUpdateAvailable = true;
 770
 771                 // Signal our end of the sync point and then dispose of it
 772                 mRemoteSyncPoints.front()->setTransactionApplied();
 773                 mRemoteSyncPoints.pop_front();
 774             } else {
 775                 ATRACE_NAME("!frameIsAvailable");
 776                 break;
 777             }
 778         } else {
 779             popPendingState(stateToCommit);
 780             stateUpdateAvailable = true;
 781         }
 782     }
 783
 784     // If we still have pending updates, wake SurfaceFlinger back up and point
 785     // it at this layer so we can process them
 786     if (!mPendingStates.empty()) {
 787         setTransactionFlags(eTransactionNeeded);
 788         mFlinger->setTransactionFlags(eTraversalNeeded);
 789     }
 790
 791     mCurrentState.modified = false;
 792     return stateUpdateAvailable;
 793 }

[Solved] Vue Error: error:0308010C:digital envelope routines::unsupported

Vue error: 0308010C: digital envelope routes:: unsupported

This error is due to the recent release of OpenSSL 3.0 in node.js V17, which adds strict restrictions on allowed algorithms and key sizes, which may have some impact on the ecosystem.

Solution:

Method 1:

Open the terminal (press Jian win+R to pop up a window, enter cmd on the keyboard, and then press Enter) and paste these according to the instructions: (Not necessarily, I tried but it failed)

Linux & Mac OS (windows git bash)

export NODE_OPTIONS=--openssl-legacy-provider

Windows command prompt:

set NODE_OPTIONS=--openssl-legacy-provider

Method 2:

Try to uninstall Node.js 17+ and reinstall Node.js 16+, then restart
1. Install nvm management tools (first turn off 360 and other software, or a warning will pop up!)
1. Download the installation package from the official website: https://github.com/coreybutler/nvm-windows/releases, download: nvm-setup.exe
2. Start the nvm installation.
(1) double-click the nvm-setup.exe file, select “I accept …” that line, click next

(2) you can customize the path disk according to their own situation, the path does not appear spaces or no-English symbols (the path is best in the root directory of the path disk, such as C disk, D disk under the root directory), click next after the selection

(3) Select the installation location of node.js, you can customize the path disk according to your own situation, the path does not appear spaces or Chinese symbols (the path is best to create a new folder in the root directory of the path disk, such as the root directory under the C disk, D disk), select it and click next. (If node.js is already installed in the system, then cmd open the terminal, type where node, check the location of node, and select this file directory)

(4) The last step, click install to complete the installation

3. Verify if the installation is successful
Enter the command and control line window (win+R, type cmd).
Type nvm -v, the version number appears that is successful.

4. Install node js

(1) Enter the command line nvm ls available to view the available nodes.js version.


(2) Enter the command line nvm install node version number (for example: nvm install 16.17.0)

(3) After the installation is successful, enter the command line nvm use node version number (nvm use 16.17.0)
If an errorexit status 1: Ȩ �� ִ � д˲ ; Enter cmd -> Run as administrator (command prompt) -> Re enter nvm use

(4) Verify whether the command line node – v and npm – v are successful Whether the installation of js and the corresponding npm is successful. If the version number can be displayed, the installation is successful.

Tip:
1. Enter the command line nvm ls to view all the Node.js version numbers you installed and the currently selected the running version of node.js

(2) If you want to delete a node For the js version, enter the command line nvm uninstall node version number (for example: nvm uninstall 18.10.0) to delete the corresponding version

2. Restart the application, no error is reported at 0308010C

npm run dev

EF core Creates pg library and Model Report an Error [Solved]

PM> Scaffold-DbContext "server=localhost;database=SimulationDatabase;uid=postgres;pwd=123456;port=5432;" Npgsql.EntityFrameworkCore.PostgreSQL -OutputDir PgModel -Force
Build started...
Build succeeded.
To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see http://go.microsoft.com/fwlink/?LinkId=723263.
Npgsql.PostgresException (0x80004005): 3D000: ���ݿ� "SimulationDatabase" ������
   at Npgsql.Internal.NpgsqlConnector.<ReadMessage>g__ReadMessageLong|215_0(NpgsqlConnector connector, Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage)
   at Npgsql.Internal.NpgsqlConnector.<Open>g__OpenCore|195_1(NpgsqlConnector conn, SslMode sslMode, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken, Boolean isFirstAttempt)
   at Npgsql.Internal.NpgsqlConnector.Open(NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken)
   at Npgsql.ConnectorPool.OpenNewConnector(NpgsqlConnection conn, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken)
   at Npgsql.ConnectorPool.<Get>g__RentAsync|28_0(NpgsqlConnection conn, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken)
   at Npgsql.NpgsqlConnection.<Open>g__OpenAsync|45_0(Boolean async, CancellationToken cancellationToken)
   at Npgsql.NpgsqlConnection.Open()
   at Npgsql.EntityFrameworkCore.PostgreSQL.Scaffolding.Internal.NpgsqlDatabaseModelFactory.Create(DbConnection dbConnection, DatabaseModelFactoryOptions options)
   at Npgsql.EntityFrameworkCore.PostgreSQL.Scaffolding.Internal.NpgsqlDatabaseModelFactory.Create(String connectionString, DatabaseModelFactoryOptions options)
   at Microsoft.EntityFrameworkCore.Scaffolding.Internal.ReverseEngineerScaffolder.ScaffoldModel(String connectionString, DatabaseModelFactoryOptions databaseOptions, ModelReverseEngineerOptions modelOptions, ModelCodeGenerationOptions codeOptions)
   at Microsoft.EntityFrameworkCore.Design.Internal.DatabaseOperations.ScaffoldContext(String provider, String connectionString, String outputDir, String outputContextDir, String dbContextClassName, IEnumerable`1 schemas, IEnumerable`1 tables, String modelNamespace, String contextNamespace, Boolean useDataAnnotations, Boolean overwriteFiles, Boolean useDatabaseNames, Boolean suppressOnConfiguring, Boolean noPluralize)
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.ScaffoldContextImpl(String provider, String connectionString, String outputDir, String outputDbContextDir, String dbContextClassName, IEnumerable`1 schemaFilters, IEnumerable`1 tableFilters, String modelNamespace, String contextNamespace, Boolean useDataAnnotations, Boolean overwriteFiles, Boolean useDatabaseNames, Boolean suppressOnConfiguring, Boolean noPluarlize)
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.ScaffoldContext.<>c__DisplayClass0_0.<.ctor>b__0()
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.<>c__DisplayClass3_0`1.<Execute>b__0()
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
  Exception data:
    Severity: ��������
    SqlState: 3D000
    MessageText: ���ݿ� "SimulationDatabase" ������
    File: d:\pginstaller_12.auto\postgres.windows-x64\src\backend\utils\init\postinit.c
    Line: 879
    Routine: InitPostgres
3D000: ���ݿ� "SimulationDatabase" ������

 

Solution:

PM> Scaffold-DbContext "Host=localhost; Port=5432 ;Database=simulation;Username=postgres;Password=123456" Npgsql.EntityFrameworkCore.PostgreSQL -OutputDir PostgreSqlModels -Context DBContext -force
Build started...
Build succeeded.
To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see http://go.microsoft.com/fwlink/?LinkId=723263.

torchvision.dataset Failed to Download CIFAR10 Error [How to Solve]

An error occurred while using dataset to download the dataset

urllib.error.URLError:urlopen error unknown url type:https 

Considering that there is no import ssl, add the following command

**import ssl
ssl._create_default_https_context = ssl._create_unverified_context**

Run again to import ssl

import ssl report an error: DLL load fail error

Solution:

First, configure the environment variable, find the current python installation directory, and add the following three paths to the PATH of the system variable

**E:\Anaconda3\envs\pytorch;      #python.exe所在路径
  E:\Anaconda3\envs\pytorch\Scripts;		
  E:\Anaconda3\envs\pytorch\Library\bin**

Then find the files libcrypto-1_1.dll and libssl-1_1.dll in the bin folder and copy them to the DLLs path.

This solves the download problem

[SteamVR] Not Initialized (109) Error [How to Solve]

[SteamVR] Not Initialized (109)

[SteamVR] Initialization failed. Please verify that you have SteamVR installed, your hmd is functioning, and OpenVR Loader is checked in the XR Plugin Management section of Project Settings.

VR equipment: HTC VIVE COSMOS

VR plug-in: SteamVR Plugin 2.7.3

Unit version: 2019.4.40f1

Error reporting scenario:

Each time you close unity, reopen it. Run the project and then report an error.

Solution:

Reopen the Project Setting panel of unity engine and close it. The error is solved. (unity menu bar find Editor->Project Settings, open, click the fork to close the panel). Because I am using git to do version control, I found that some oid in the file ProjectSettings.asset will change every time I report an error, so I thought it was related to Project Settings. I tried reopening the Project Settings panel and it worked. If you are using git to do version control, you can try to recover the ProjectSettings.asset file to solve the bug.

Jetson MONAILabel(arm) Failed to Run distributed Module [How to Solve]

Solution:

  • https://forums.developer.nvidia.com/t/pytorch-for-jetson/72048
  • Switch the version to v1.11.0
  • Then install the distributed development package
  • sudo apt get install python3 pip libopenblas base libopenmpi dev libomp dev

Verification:

Cause analysis:

It is possible to call distributed modules in v1.11.0. Maybe there is something wrong with the official whl compilation in the new version

How to Solve Win10 0x8007007E Error (OPC Component)

During the development of OPC client in Win10, the following missing component exception occurs when reading the device.
Message=Fail to retrieve the component with CLSID {28E68F9A-8D75-11D1-8DC3-3C302A000000} in COM class factory because of the following error: 8007007e The specified module could not be found. (Exception from HRESULT:0x8007007E).

Solution:

1. Copy the OPCDAAuto.dll file to the C:\Windows\SysWOW64 directory.
2. Press ” WIN + R ” to enter the CMD command line.
3, type: regsvr32 C:\Windows\SysWOW64\OPCDAAuto.dll, enter.
4, after successful registration, set in the configuration manager for the X86 platform (can not run under 64-bit)
5, regenerate the project solution, it can run normally.

[Solved] ByteTrack Error: ModuleNotFoundError: No module named ‘yolox’

1. Error Message:

File "tools/demo_track.py", line 10, in <module>
from yolox.data.data_augment import preproc
ModuleNotFoundError: No module named 'yolox'

2. Reason

Although the yolox folder exists under the project file, it cannot be called without the yolox library installed.

3. Solution
3.1 Answer from the original author

First of, please make sure you decide for a version of CUDA and consistently use that; I am using 11.3 in this.
I fixed this and many other installation and compilation errors, by uninstalling and re-installing the following programs in the exact order

  1. Clone the yolox repo and unzip it
  2. Install Virtual Studio 2019 Community (https://visualstudio.microsoft.com/downloads/)
  3. Download CUDA https://developer.nvidia.com/cuda-11.3.0-download-archive (I just did express installation)
  4. Get https://docs.conda.io/en/latest/miniconda.html for your version of python
  5. Install pytorch with cuda enabled conda install pytorch torchvision cudatoolkit=11.3 -c pytorch
  6. Navigate conda to the download directory (cd yolox_path) of yolox and type in:
    pip install -r requirements.txt
    pip install pycocotools # this should get added to requirements.txt @FateScript
    pip install -v -e . # or python setup.py develop
  7. Congratulations you fixed the error, now you’ll be able to run yolox as described in Quick Start > Demo (example: python tools/demo.py video -n yolox-s -c /path/to/your/yolox_s.pth –path /path/to/your/video –conf 0.25 –nms 0.45 –tsize 640 –save_result –device [cpu/gpu] )

A couple notices:

  • You can at the time of writing this; not install above CUDA 11.3, because conda does not provide a higher version in sources to compile with pytorch
  • You can not install a higher version of Virtual Studio, because of incompability with CUDA (devs did not add support for MSVS22 yet)
  • You’re forced to install MSVS; because this repo depends on it, to be able to compile as written in step 6.
  • You can not simply uninstall conda, because it removes its CUDA compiled pytorch version and that in return breaks yolox. But I think you could most likely avoid this

In short you kept getting this error, because you couldn’t compile yolox properly or not at all.

3.2 Summary

Add pycocotools in requirements.txt as below:

Run pip install -r requirements.txt

Run pip install -v -e . Or python setup.py develop command
The result after running.


Run Successfully!

 

Reference:

    ModuleNotFoundError: No module named ‘yolox’ ??how can i resolve it ?please!

[Solved] mvn -v error: Unsupported major. minor version 51.0

Mvn – v error: Unsupported major minor version 51.0

Error reason: Maven version and JDK version do not match

java.lang.UnsupportedClassVersionError: org/apache/lucene/store/Directory : Unsupported major.minor version 51.0
Could not find the main class: org.codehaus.plexus.classworlds.launcher.Launcher. Program will exit.

 

Solution:
J2SE 8=52,
J2SE 7=51,
J2SE 6.0=50,
J2SE 5.0=49,
JDK 1.4=48,
JDK 1.3=47,
JDK 1.2=46,
JDK 1.1=45

From the above correspondence can be seen from the jdk7 version error; because the maven version and jdk version is not compatible, I use the maven is 3.3.9, jdk is 1.6.0, and then replaced a jdk1.8.0 version will be able to; specific cmd use echo %JAVA_HOME% command to check their environment variables configured in the version;
Sometimes you will see version 1.8.0 with the java -version command, but you may see a different version of jdk with the echo %JAVA_HOME% command;
This phenomenon is mainly due to a bad personal habit of configuring multiple versions of jdk in environment variables and introducing only one of them in the path, which actually has disadvantages, for example, Tomcat will read the information in environment variables named JAVA_HOME by default, but not JAVA_HOME2;
So it is better to name the environment variable JAVA_HOME, and not to configure more than one jdk;