Author Archives: Robins

[Vue warn]: Error in nextTick: “TypeError: Cannot read property ‘map‘ of null“

When using element UI in Vue project, an error is reported: [Vue warn]: error in nexttick: "typeerror: cannot read property 'map' of null"

The error message is as follows:

It’s ridiculous. I studied it myself and recorded it. It’s all the fault of carelessness:

The reason is that the data source of El table is initially set to null. When the default sort attribute is used, the table will map the data source by default and report an error
change currentpagedata: null to currentpagedata: [] .

Resolution process:

Locate the error location 10051 line according to the error information:

array.map reports the error as null, and then locate the array up:

according to the parameters and contents of this method, it is basically determined that the error information is caused by the default sort attribute of El table, that is, the data source array of El table during compilation and sorting is null
looking back at the data source, I found that the data source was initially assigned null. No wonder
change the initial value of the data source array to [] empty array.

Itself is a very simple mistake, but I didn’t expect it.

[Solved] Git Error: client_global_hostkeys_private_confirm: server gave bad signature for RSA key 0

Error message:

client_ global_ hostkeys_ private_ confirm: server gave bad signature for RSA key 0

Client \ global \ host key \ private \ confirm: the server provided the wrong signature for RSA key 0

When I submit git using the following instruction

git add .
git commit -m 'feat :Push'
git push origin

Solution:

Scheme 1: make sure your ~ /. SSH/config contains the following:

Host gitlab.com
UpdateHostKeys no

Scheme 2: try regenerating the public-private key

[Solved] pytorch CrossEntropyLoss Error: RuntimeError: 1D target tensor expected, multi-target not supported

resolvent

crossentropyloss (predicted value, label) the required input dimensions are:

    1. when there is batch, the predicted value dimension is 2 and the size is

[batch]_ When size, n]

    1. , the dimension of label is 1, and the size is

[batch]_ Size]

    1. when there is no batch, the dimension of the predicted value is 2, the size is

[M, n]

    1. , the dimension of the label is 1, and the size is

[M]

Problem analysis

One case can illustrate:

import torch
import torch.nn as nn
import numpy as np

a = torch.tensor(np.random.random((30, 5)))
b = torch.tensor(np.random.randint(0, 4, (30))).long()
loss = nn.CrossEntropyLoss()

print("a的维度:", a.size()) # torch.Size([30, 5])
print("b的维度:", b.size()) # torch.Size([30])
print(loss(a, b)) # tensor(1.6319, dtype=torch.float64)

Gitlab nginx wont start to work. [down: nginx: 1s, normally up, want up; run: log: (pid 20128)xxx]

conclusion
I got this problem as well. and now I’ve solved it.
solution
I’ve modified the /etc/gitlab/gitlab.rb file, changed into
nginx[‘redirect_http_to_https_port’] = 80
nginx[‘listen_port’] = 443
and sudo gitlab-ctl reconfigure + sudo gitlab-ctl restart, and it works.
process
in the past, the reason i could connect to gitlab server is because that my colleague have set something in the /var/opt/gitlab/nginx/conf/gitlab-http.conf file.

Redirects all HTTP traffic to the HTTPS host
server {
  listen *:80;

  server_name gitlab.xxxxx.com;
  server_tokens off; ## Don't show the nginx version number, a security best practice


  location/{
    return 301 https://gitlab.xxxxxx.com:443$request_uri;
  }

  # health checks configuration
  include /var/opt/gitlab/nginx/conf/gitlab-health.conf;

  access_log  /var/log/gitlab/nginx/gitlab_access.log gitlab_access;
  error_log   /var/log/gitlab/nginx/gitlab_error.log;
}

server {
  listen *:443 ssl http2;


  server_name gitlab.xxxxxx.com;
  server_tokens off; ## Don't show the nginx version number, a security best practice

and once if I’ve use the command sudo gitlab-ctl reconfigure, and the file gitlab-http.conf would be covered by /etc/gitlab/gitlab.rb. and the nginx settings in /etc/gitlab/gitlab.rb would start to take position that makes me cannot visit gitlab server after using the command sudo gitlab-ctl reconfigure. and now I’ve set the nginx settings right in /etc/gitlab/gitlab.rb just like in the solution part. hope it could help. thx.

[Solved] Error while trying to use the following icon from the Manifest

Error while trying to use the following icon from the manifest: http://localhost:8080/img/icons/android -chrome-192×192.png (Download error or resource isn’t a valid image)

The main reason for this error is that the android-chrome-192×192.png image in the icons folder under img under public is deleted by mistake
my solution: re create the same folder and file (if you find a picture, you won’t report an error!)

Unable to read workspace file ‘D:\angular.json‘: Invalid JSON character: “ “ at

Question:

Unable to read workspace file 'D:\font-end\antd\angular.json': Invalid JSON character: " " at 36:71.`Insert code snippet here`

Step 1: introduce the notes of the angular ecarts.min.js
you have a problem with the angular ecarts.min.js, but if the notes are started, the following error will be reported:

Error: The target entry-point "ngx-echarts" has missing 

Xcode debugging for the real iPhone Error: code signature version is no longer supported

Details

Unable to install "MyApp"
Domain: com.apple.dt.MobileDeviceErrorDomain
Code: -402620375
-

The code signature version is no longer supported.
Domain: com.apple.dt.MobileDeviceErrorDomain
Code: -402620375
User Info: {
  DVTRadarComponentKey = 261622;
  MobileDeviceErrorCode = "(0xE8008029)";
  "com.apple.dtdevicekit.stacktrace" = (
0  DTDeviceKitBase           0x000000011edd83b8 DTDKCreateNSErrorFromAMDErrorCode + 220
1  DTDeviceKitBase           0x000000011ee16ae1 __90-[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:]_block_invoke + 155
2  DVTFoundation            0x0000000107881b7c DVTInvokeWithStrongOwnership + 71
3  DTDeviceKitBase           0x000000011ee16822 -[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:] + 1440
4  IDEiOSSupportCore          0x000000011eccf999 __118-[DVTiOSDevice(DVTiPhoneApplicationInstallation) processAppInstallSet:appUninstallSet:installOptions:completionBlock:]_block_invoke.294 + 3534
5  DVTFoundation            0x00000001079b4931 __DVT_CALLING_CLIENT_BLOCK__ + 7
6  DVTFoundation            0x00000001079b655b __DVTDispatchAsync_block_invoke + 1191
7  libdispatch.dylib          0x00007fff20508603 _dispatch_call_block_and_release + 12
8  libdispatch.dylib          0x00007fff205097e6 _dispatch_client_callout + 8
9  libdispatch.dylib          0x00007fff2050f5ca _dispatch_lane_serial_drain + 606
10 libdispatch.dylib          0x00007fff2051008d _dispatch_lane_invoke + 366
11 libdispatch.dylib          0x00007fff20519bed _dispatch_workloop_worker_thread + 811
12 libsystem_pthread.dylib       0x00007fff206b04c0 _pthread_wqthread + 314
13 libsystem_pthread.dylib       0x00007fff206af493 start_wqthread + 15
);
}
-

It may be caused by inconsistent signatures on the framework, such as do not embed , and embed and sign

Possible solutions:
app targets -> General -> Frameworks,Libraries,and EmbeddedContent -> Modify embed and sign to do not embed .

Unable to find bundled Java version =>Mac Flutter [Android Studio Arctic Fox 2020.3.1]

Terminal: flutter doctor -v
1. problem: android studio prompts Unable to find bundled Java version

[!] Android Studio (version 2020.3)
    • Android Studio at /Applications/Android Studio Preview.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    ✗ Unable to find bundled Java version.
    • Try updating or re-installing Android Studio.

Treatment method:

cd /Applications/Android\ Studio.app/Contents/jre
ln -s ../jre jdk
ln -s "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin" jdk

Perfect result:

[✓] Android Studio (version 2020.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)

2 questions

[!] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.

Terminal input: Shuttle doctor — Android licenses. The following error is reported

Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema

at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156)

at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)

at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81)

at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:73)

at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)

Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema

at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)

at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)

at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)

... 5 more

Treatment method

one   Update the SDK manager in the tools/bin directory of the Android SDK

Terminal input:/users/* * */tools/bin/sdkmanager — update

2. Configure Java_ HOME

JDK under MAC is installed under /library/Java/javavirtualmachines by default. The real path is shown in the figure below:

WJdeMacBook-Pro:~ wj$ cd /Library/Java/JavaVirtualMachines
WJdeMacBook-Pro:JavaVirtualMachines wj$ ls -la
total 0
drwxr-xr-x  3 root  wheel   96  3 21 15:25 .
drwxr-xr-x  4 root  wheel  128  1  1  2020 ..
drwxr-xr-x  3 root  wheel   96  4  3  2019 jdk1.8.0_77.jdk

Refer to Apple’s documentation for the command/usr/libexec/Java_ Use the – V option after home to list all versions of Java_ Home, i.e. the following results:

WJdeMacBook-Pro:JavaVirtualMachines wj$ /usr/libexec/java_home -V
Matching Java Virtual Machines (2):
    1.8.77.03 (x86_64) "Oracle Corporation" - "Java" /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
    1.8.0_77 (x86_64) "Oracle Corporation" - "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home
/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home

Select the JDK version you need and configure it to. Bash_ In profile

Terminal input:

one     open .bash_ profile

two     export JAVA_ HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_ 212.jdk/Contents/Home

export PATH=$JAVA_ HOME/bin:$PATH

three   The above 2 configuration paths are copied with. Bash_ In profile file

four   After saving, in order for the configuration to take effect immediately, you need to execute: source ~ /. Bash_ Profile command

Input: fluent doctor at the terminal again

[!] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor
      --android-licenses

Terminal input: fluent doctor — Android liceses

Multiple occurrences: review licenses that have not been accepted (Y/N)?        All input: y and then press enter

Perfect result:

WJdeMacBook-Pro:~ wj$ flutter doctor
***
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
***

Error: EACCES: permission denied, unlink ‘xxxx/xxxx/xxxx‘ [How to Solve]

Scenario: on the Mac, if you want to use the code command to open vs code, (CMD + Shift + P) search the shell, find this:

Results Click to find:

	Error: EACCES: permission denied, 
	unlink '/usr/local/bin/code'

In fact, I don’t have read-write permission, and it’s ineffective to search a lot on the Internet. However, I’m used to using the command line to open vs code. The final solution is:

Enter at the command line

sudo chown -R [yourusername] [filePath]

Yourusername: user preferences – & gt; Users and groups – & gt; Current user
filepath: the path displayed when an error is reported

Tips: if not, try to move the path forward. Take me as an example:

sudo chown -R xxx /usr/local/bin

Inconsistency between adapter data and UI data after dragging recyclerview (data disorder)

Firstly, the function of dragging and sliding is added on the basis of recyclerview. It is written directly according to the official document as follows

 ItemTouchHelper(object : ItemTouchHelper.Callback() {
            override fun getMovementFlags(
                recyclerView: RecyclerView,
                viewHolder: RecyclerView.ViewHolder,
            ): Int {
                //item dragging direction
                var dragflag =
                    ItemTouchHelper.UP or ItemTouchHelper.DOWN or ItemTouchHelper.LEFT or ItemTouchHelper.RIGHT
                return makeMovementFlags(dragflag, 0)
            }

            override fun onMove(
                recyclerView: RecyclerView,
                viewHolder: RecyclerView.ViewHolder,
                target: RecyclerView.ViewHolder,
            ): Boolean {
                myAdapter.notifyItemMoved(viewHolder.layoutPosition, target.layoutPosition)
                return true
            }


            override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) {}

            override fun canDropOver(
                recyclerView: RecyclerView,
                current: RecyclerView.ViewHolder,
                target: RecyclerView.ViewHolder,
            ): Boolean {
                //The current ViewHolder can be placed on the target ViewHolder
                return true
            }

            override fun isLongPressDragEnabled(): Boolean {
                //Turn on long press drag
                return true
            }

        }).attachToRecyclerView(binding.myRV)//add to RecyclerView

After running, it is found that the UI is normal, but when obtaining adapter.items, it is found that the data has not changed, so perform data exchange and sorting in onmove:

ItemTouchHelper(object : ItemTouchHelper.Callback() {
            override fun getMovementFlags(
                recyclerView: RecyclerView,
                viewHolder: RecyclerView.ViewHolder,
            ): Int {
                var dragflag =
                    ItemTouchHelper.UP or ItemTouchHelper.DOWN or ItemTouchHelper.LEFT or ItemTouchHelper.RIGHT
                return makeMovementFlags(dragflag, 0)
            }

            override fun onMove(
                recyclerView: RecyclerView,
                viewHolder: RecyclerView.ViewHolder,
                target: RecyclerView.ViewHolder,
            ): Boolean {
                if (viewHolder.layoutPosition < target.layoutPosition) {
                    for (i in viewHolder.layoutPosition until target.layoutPosition) {
                        Collections.swap(myAdapter.items, i, i + 1) 
                    }
                } else {
                    for (i in viewHolder.layoutPosition downTo target.layoutPosition + 1) {
                        Collections.swap(myAdapter.items, i, i - 1) 
                    }

                }
                myAdapter.notifyItemMoved(viewHolder.layoutPosition, target.layoutPosition)
                myAdapter.notifyItemChanged(target.layoutPosition)
                return true
            }


            override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) {}

            override fun canDropOver(
                recyclerView: RecyclerView,
                current: RecyclerView.ViewHolder,
                target: RecyclerView.ViewHolder,
            ): Boolean {
                return true
            }

            override fun isLongPressDragEnabled(): Boolean {
                return true
            }

        }).attachToRecyclerView(binding.myRV)

If you want to listen to the end of drag, you can override the Clearview method to listen