Category Archives: How to Fix

Type error: object (…) is not a function

error description:

TypeError: Object(...) is not a function

this problem is common for the following reasons:

data and methods in the same name, the solution: change the name.

I’ll discuss another error here: the same error we would have made if we hadn’t added the double brackets when we introduced the axios method

the error code is as follows:

the correct code is as follows:

CONDA failed to create environment (collecting package metadata(repodata.json): failed)

conda command can refer to: [conda commonly used command collation]

1, problem

failed to create environment using conda creation-name py3.6.8 python==3.6.8. At the first step: Collecting package metadata (repodata.json): failed has failed.

below is the related log:

Collecting package metadata (repodata.json): failed

# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<

    Traceback (most recent call last):
      File "/usr/local/anaconda3/lib/python3.7/site-packages/urllib3/contrib/pyopenssl.py", line 453, in wrap_socket
        cnx.do_handshake()
      File "/usr/local/anaconda3/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1915, in do_handshake
        self._raise_ssl_error(self._ssl, result)
      File "/usr/local/anaconda3/lib/python3.7/site-packages/OpenSSL/SSL.py", line 1639, in _raise_ssl_error
        raise SysCallError(errno, errorcode.get(errno))
    OpenSSL.SSL.SysCallError: (104, 'ECONNRESET')

version information for:

2, Solution

search data, guess and conda version may be related, this idea comes from [conda issues-9004]. Conda is degraded with the command

conda config --set allow_conda_downgrades true
conda install conda=4.6.14

after the downgrade, the conda creation-name py3.6.8 python==3.6.8 environment was created successfully. The problem was solved successfully.

other

several frequently used conda commands, more can refer to [conda commonly used command consolidation]

  • conda install -n py3.6 python==3.6
  • conda activate py3.6.8
  • 0 conda deactivate1

    2

  • 3 4 conda install nb_conda5 // install Conda -envs conda info –envs // view all conda environments
  • conda list // view conda’s existing installation packages

Spring boot integrates es cluster error report collection

problem 1: ELK version must be unified

when installing ELK, the version number must be the same, for example, the version number is “5.6.12”, then:

  • Elasticsearch version number must be: 5.6.12
  • Logstash must be: 5.6.12
  • Kibana version number must be: 5.6.12
  • ik word divider version number must be: 5.6.12
problem 2: spring-boot-starter-data-elasticsearch corresponds to es version inconsistency, resulting in an error

this problem is a problem that breaks programmers. When your ELK is installed and SpringBoot integrates ES cluster, it will add spring-boot-starter-data-elasticsearch. We must think that the version number of this plug-in has nothing to do with the version number of ES. A lot to do, they have a version number of the corresponding relationship between the original and the diagram below (picture from official: https://docs.spring.io/spring-data/elasticsearch/docs/current/reference/html/#new-features) :


So friends, if you do ES cluster function, remember to set up according to the SpringBoot version number, do not wait for the installation of ELK, only to find that the SpringBoot version number does not correspond, which will cost a lot of time (because ELK is not easy to install).

other issues will continue to update…

Android studio simulator architecture choose arm or x86 to solve the problem of missing libraryexception

first of all, if your APP can be installed normally including third-party or self-compiled, then use x86, because the architecture of the virtual machine is very fast; If, like me, the so in the compiled APK is ARM, then an ARM-architecture virtual machine is required, otherwise the following error will be reported. X86 compatibility is not enough, many apps can not be installed or installed to play. Most emulators on the market are x86, so if you can’t install them, consider the reason why they don’t support the x86 architecture. Google official emulator, Intel x86 system mirror, opened KVM acceleration, the result installed several applications failed, such as qq various versions, jingdong client, touch input method, etc. The message is Failure [INSTALL_FAILED_NO_MATCHING_ABIS], presumably because these applications are not compatible with x86 devices. Baidu Takeaway and X-Plore were installed successfully.

after using the simulator to install the application software to run today, an error was found as follows:

MissingLibraryException: lib/x86/libgnustl_shared. So

02-07 02:53:39.122 7607-7639/com.gala.video E/AndroidRuntime: FATAL EXCEPTION: jobmanager-5-12
Process: com.gala.video, PID:>

02-07 02:53:39. 7607
com. Getkeepsafe. Relinker. MissingLibraryException: Lib/x86/libgnustl_shared. So
the at com. Getkeepsafe. Relinker. ApkLibraryInstaller. InstallLibrary (ApkLibraryInstaller. Java: 85)
the at Com. Getkeepsafe. Relinker. ReLinkerInstance. LoadLibraryInternal (ReLinkerInstance. Java: 180)
the at com. Getkeepsafe. Relinker. ReLinkerInstance. LoadLibrary (ReLinkerInstance. Java: 136)
the at com.getkeepsafe.relinker.ReLinkerInstance.loadLibrary(ReLinkerInstance.java:92)

my emulator is the default Android studio configuration when it was created and is an x86 architecture emulator. Why is the system an emulator of this architecture by default?Before Windows installed virtual machines, we had to turn on the BIOS virtual device switch: HAXM was needed to speed up the AVD emulator on an Intel CPU host.

  • step 1: enter the BIOS to enable VT (Virtualization Technology) option; Step 2: download Intel x86 Emulator Accelerator(HAXM install)

from the SDK Manager of Android studio

after we create an emulator, the default configuration is the x86 architecture, which has the advantage of fast speed. However, it has a big disadvantage of insufficient compatibility, which results in many applications compiled with ARM architecture cannot be installed, or the boot error is reported after installation. The above error means that the emulator you have turned on is x86, so the relevant SO library in your APP is also x86. However, in your packaged APP, only the SO library of ARM was found, so the error was reported. So what we’re going to do is create an ARM architecture virtual machine:

we configure an ARM processor architecture virtual machine as shown in the figure below:

select ARM virtual machine, lower right corner will prompt, this is more than 10 times slower than x86, pro test, may be more than 10 times slower.

of course you can increase the virtual machine memory a little bit:

after the above completion, start our ARM virtual machine, try to install apk can

SqlNullValueException: Data is Null. This method or property cannot be called on Null values.

1. Problem description:

Unhandled Exception: System.Data.SqlTypes.SqlNullValueException: Data is Null. This method or property cannot be called on Null values.
at System.Data.SqlClient.SqlBuffer.get_DateTime()
at System.Data.SqlClient.SqlDataReader.GetDateTime(Int32 i)

EF Core model read a Null date field.

solution:
1. Set the date as nullable type

public class Student
{
  public int Id { get; set; }
  // public DateTime Entry_Date { get; set; }
  public DateTime? Entry_Date { get; set; }
}

2. Modify data.

Mmdet error modulenotfounderror: no module named ‘mmcv_ ext‘

problem : when installing MMMCV, ModuleNotFoundError: No module named ‘MMCV._ext’ problem often occurs.
environment : ubuntu16.04+Anaconda3+python3.7.7+cuda10.0+cuDNN7.6.4.3

solution : do not use :

when installing

pip install mmcv

use:

pip install mmcv-full

use the MMCV version that is appropriate for your environment if you have weird problems, such as

pip install mmcv-full==latest+torch1.5.0+cu101 -f https://openmmlab.oss-accelerate.aliyuncs.com/mmcv/dist/index.html

can be viewed on MMCV’s github description, as follows:

https://github.com/open-mmlab/mmcv

more questions on the official github.

Problem solving module ‘ tensorflow.compat . V2 ‘has no attribute’ contrib ‘and importerror cannot import name’ auto ‘

Error:
The current version of tensorflow is 1.13.1 and 2.0.0b1 report errors module ‘tensorflow.compat.v2’ has no attribute ‘contrib’,

try to import tensorflow.compat.v1 as tf instead of import tensorflow as tf,

But ImportError cannot import name ‘auto’

Solution:

as shown in the figure below, refer to article 1 to point out that tf2.0 alpha began to remove tf.contrib and needed to be upgraded.

therefore, upgrade to tensorflow 2.1.0 using PIP install –upgrade tensorflow.

reference article:

1. https://stackoverflow.com/questions/55870127/module-tensorflow-has-no-attribute-contrib

How to Fix unexpected directory layout in go language

1. Make sure the path is set correctly </h2 b> There is a problem with the directory structure of the

project. Suggested structure:

project:
  - bin (可不需要)
  - src
    - sub-project-1
      - module1
      - module2
      - vendor
    - sub-project-2 
  - pkg (可不需要)

and appends the project directory to the environment variable GOPATH. Only one path

is saved in GOPATH

##设置环境变量
vim /etc/profile
##编辑器中首行填写如下内容,GOPATH和GOROOT根据读者自己情况修改
export GOPATH=/root/go
export GOROOT=/usr/lib/golang
export PATH=$GOPATH/bin:$PATH
##wq保存退出文件,并执行
source /etc/profile

2. Check to see if there are duplicate folders </h2 b>

in the centos directory, or GOROOT directory, it was found that SRC/had the same directory file as the project in GOPATH, after deleting it and recompiling the project in GOPATH, the problem was solved. Where XXX stands for compilation engineering project.

rm -rf /usr/lib/golang/src/XXX

 

Python: How to Fix “Ord() expected string of length 1, but int found”

code as follows:

import base64

def decode(ciphertext):
	plaintext = ''
	ciphertext = base64.b64decode(ciphertext)
	for i in ciphertext:
		s = ord(i)-16 ######################
		s = s^32
		plaintext += chr(s)
	return plaintext

cipher = 'XlNkVmtUI1MgXWBZXCFeKY+AaXNt'
flag = decode(cipher)
print(flag)

In python3, running

with a hash sign will fail and python2 won’t, because in python3 the ord() accepts a string of length 1, whereas in python3 the I is already an integer, and you can just use i-16 to do the operation

Python3 ord() expected string of length 1, but int found

How to Fix The Latest Version of chrome cannot install the IDM plug-in IDMGCExt.crx

recently installed the idmgcext.crx plug-in in developer mode and always showed the CRX HEADER INVALID. The solution is as follows:

1. Drag installation (recommended)

(generally updated date is relatively recent, can basically apply to this method)

Open the developer mode switch and drag the xxx. CRX file into the middle of chrome to get

hold xxxxxx. CRX drag to the chrome extension

 

the prompt box of installation confirmation pops up, indicating the operation is successful. Click ok to

 


 

ii. Violent installation

(this method is not recommended, you can try violent installation if method 1 drags the installation invalid)

the downloaded XXX. Contents </ code> extensions to the XXX. Zip </ code> </ p>
Open the developer mode switch and drag the xxx.zip file into the middle of chrome to

as shown below, hold xxxxxx.zip and drag to the chrome extension

after the installation is completed, it will be seen directly, open the plug-in switch can be

this method can be successful in most cases, occasionally will receive a browser security alert, ignore can


 

Error: package android.support.annotation Does not exist

I see a lot of posts online, are written half, not specific enough, or do not fit, I tried a lot of myself, finally got the solution.

prerequisite

Android studio 3.5.1 track of

the JDK 1.8 com. The Android. View the build: gradle: 3.5.1 track of migration to the
project androidx

step 1: check to see if build.gradle is configured

search build. If there is a keyword in gradle com. Android. Support: support - annotations
if not, you need to add configuration, the steps as shown in figure

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "com.android.support:support-annotations:28.0.0"
}

modifier error file

view the file with the error and modify the import package.

import android.support.annotation.IntDef;
import android.support.annotation.WorkerThread;

import androidx.annotation.IntDef;
import androidx.annotation.WorkerThread;

shortcut
Ctrl + Shift + R

import android. Support. The annotation.
with
import androidx. The annotation.

synchronization project Sync