Category Archives: Error

[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.

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)
***

Template argument deduction/substitution failed: couldn‘t deduce template parameter [How to Solve]

Article catalog

Error code error reason solution

Error code

We want to implement a generic function to find the maximum value of the interval. The parameters are left and right iterators, which return the maximum value.

#include<iostream>
#include<vector>
using namespace std;
template<class T>
T findmax(typename vector<T>::iterator left,typename vector<T>::iterator right){
    T ret = *left;
    for (;left!=right;++left){
        ret = (*left)>ret ?*left : ret;     
    }
    return ret;
}

int main(){
    vector<int> a({3,4,6,2,1,5});
    cout << findmax(a.begin(),a.end());
    return 0;
}

error:
15:38: error: no matching function for call to ‘findmax(std::vector::iterator, std::vector::iterator)’
15 | cout << findmax(a.begin(),a.end());
5:3: note: candidate: ‘template T findmax(typename std::vector::iterator, typename std::vector::iterator)’
5 | T findmax(typename vector::iterator left,typename vector::iterator right){
5:3: note: template argument deduction/substitution failed:
15:38: note: couldn’t deduce template parameter ‘T’
15 | cout << findmax(a.begin(),a.end());

The reason
The compiler cannot guess that the template T is int based on the type vector< int >::iterator passed in

Solution
Specify the template manually at the place where the function is called.
Replace the used findmax with findmax< int >:

#include<iostream>
#include<vector>
using namespace std;
template<class T>
T findmax(typename vector<T>::iterator left,typename vector<T>::iterator right){
    T ret = *left;
    for (;left!=right;++left){
        ret = (*left)>ret ?*left : ret;     
    }
    return ret;
}

int main(){
    vector<int> a({3,4,6,2,1,5});
    cout << findmax<int>(a.begin(),a.end());
    return 0;
}

Run successfully

Taro Use React Hooks Error: TypeError: Object(…) is not a function

  I stepped on a version of the pit today

In the taro project, you want to use react hooks. The code is as follows. Errors are always reported in the wechat development tool

After looking at the official documents, I found that taro was introduced after version 3.xx   Usestate and so on need to be introduced from the corresponding framework react

The code is modified as follows:

// React Hooks
import { useState, useEffect } from 'react' 
import { View, Text } from '@tarojs/components'
import './index.scss'
function Index() {
    const [userName, setUserName] = useState('Ashely')
    return (
        <View>
            <Text>{userName}</Text>
        </View>
    )
}

export default Index

You can compile normally

[Solved] Android Studio Error: The binary version of its metadata is 1.5.1, expected version is 1.1.15.

Question:

Android studio reports an error: module was compiled with an incompatible version of kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15.
Solution 1:

Add ext.kotlin in build.gradle of the project_ Version = "1.3.72" (lower version) changed to ext.kotlin_ Version = "1.5.21" (not necessarily 1.5.21, but also the latest version). Just sync and run again

Solution 2:

Open build.gradle under your module (my module name here is MyLibrary) directory, delete some lines in dependencies, and only the corresponding lines in the second figure are left. Just run it again

these lines remain: