Author Archives: Robins

Axios gets the upload progress error: xhr.upload.addEventListener is not a function

Error problem

Vue:xhr.upload.addEventListener is not a function

This problem is caused by mockjs changing the XMLHttpRequest object in Axios

According to the Axios source code, l is an XMLHttpRequest object

Mockjs changed the l variable from XMLHttpRequest object to MockXMLHttpRequest object

Therefore, l.upload is an empty object, which has no addEventListener method, so an error is reported

Solution:

Method 1

In the project node_modules/mockjs/dist/mock.js file, in the place where mockjs determines the conditions (search) -> / If no matching data template is found, then the native XHR is used to send the request. / is usually the location of line 8308, add the code

MockXMLHttpRequest.prototype.upload = xhr.upload;

Add a native xhr.upload method to the MockXMLHttpRequest object.

Method 2

Add the code to the project node_modules/mockjs/src/xhr/xhr.jsprototype usually on line 216

MockXMLHttpRequest.prototype.upload = xhr.upload;

This method needs to be recompiled to take effect

[Solved] scheduler Error: maximum number of running instances reached

Let’s look at a demo to reproduce this error:

from apscheduler.schedulers.blocking import BlockingScheduler
import time
from threading import Timer
from datetime import datetime

def test1(who):
    print("hello")
    print(datetime.now())

    time.sleep(20)
    print("this is %s" %who)
    print(datetime.now())


def scheduler_test():
    scheduler = BlockingScheduler()

    i=0
    while i<1:
        scheduler.add_job(test1, 'interval', seconds=10, id='test_job'+str(i), args=["xiao"+str(i)],next_run_time=datetime.now())
        i=i+1
        print("mmmmmmm")
    scheduler.start()

def timer1(who):
    who_tmp=who
    test1(who)
    Timer(20, timer_test,
          kwargs={'who': who_tmp}).start()

def timer_test():
    i=0
    while i<3:
        timer1("xiao"+str(i))


if __name__ == '__main__':
    #timer_test()
    scheduler_test()
    print("when")

You can see that the interval length is less than the execution length of the job, it will trigger this error maximum number of running instances reached

There are two solutions, 1, modify the interval duration of the add_job interface to make it greater than the execution duration of the job 2, add a parameter to the add_job interface, such as max_instances=20, to adjust the number of concurrency allowed.

[Solved] hive service hiveserver2 Error: GC overhead limit exceeded

1. Causes

Hive — service hiverver2 reports an error, which makes the hiverver2 service unusable

 

2. Error information

Exception in thread “HiveServer2-Handler-Pool: Thread-556” java.lang.OutOfMemoryError: GC overhead limit exceeded

 

3. Reasons for error reporting

JVM started by hive shell script is out of memory

 

4. Solution

cp hive-env.sh.template hive-env.sh
vi hive-env.sh
Release export HADOOP_HEAPSIZE=1024 (if you still get an error, make the memory bigger)

[Solved] jenkins Build python Program Error: ModuleNotFoundError: No module named ‘htmltestreport’

Background:

The project is built based on virtual environment, and the third-party packages are actually installed in:

E:\PyProject\py_basic\Lib\site-packages is not the same directory as Python installation directory

Question:

Both pycham and CMD can operate normally, but Jenkins build error:

C:\Users\86158\.jenkins\workspace\ihrm_code>python run_suite.py 
Traceback (most recent call last):
  File "run_suite.py", line 3, in <module>
    from htmltestreport import HTMLTestReport
ModuleNotFoundError: No module named 'htmltestreport'

Solution:

Add environment variables to Jenkins. This problem is usually caused by the configuration of environment variables

[Solved] android.content.res.Resources$NotFoundException: String resource ID #0xffffff85

java.lang.RuntimeException: Unable to start activity ComponentInfo:android.content.res.Resources$NotFoundException: String resource ID #0xffffff85

Reason: It usually happens when the parameter int resId is wrong, you assign String to the int resId, so the compiler can’t find the correct resource and report an error.

For example, I set the bill amount to int type

But in setText list.get(i).getNum() is int type, so the error is reported

Solution 1: change the parameter to String type

Solution 2: use String.valueOf(list.get(i).getNum())

[Solved] JMeter Generate the report of html Error

Error generating the report: org. apache. jmeter. report. dashboard. GenerationException: Error while processing samples: Consumer failed with message :Consumer failed with message :Consumer failed with message :Consumer failed with message :Begin size 0 is not equal to fixed size 5

The jdk I installed at first was jdk-17_linux-x64_bin.rpm which is jdk 17. When I generated the html report from the jtl file, I got the above error.

Later uninstalled the jdk. I reinstalled jdk1.8, jdk-8u202-linux-x64.rpm, and it generated it normally.

The uninstallation method of rpm is attached:

1. Check the version of JDK:

rpm -qa | grep jdk

2. Uninstall the JKD version installed by rpm

rpm -e –nodeps jdk1.8-1.8.0_202-fcs.x86_64

The conclusion is: it should be the compatibility problem of version 17 JDK. Try to change the JDK.

[Solved] MySQL Delete or Update Data Error: Error Code: 1175

Error Code: 1175. You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column.  To disable safe mode, toggle the option in Preferences -> SQL Editor and reconnect.

Because MySQL runs in the safe-updates mode, the update or delete commands cannot be executed under non primary key conditions.

1. show variables like ‘SQL_SAFE_UPDATES’; Check the switch status.

2. Execute command set SET SQL_SAFE_UPDATES = 0; Modify database mode

 

[Solved] android.content.ActivityNotFoundException: Unable to find explicit activity class

android.content.ActivityNotFoundException: Unable to find explicit activity class {com.x210.communication/com.x210.communication.ShowActivity};have you declared this activity in your AndroidManifest.xml?

The root cause of the error is that the Activity is not registered in the manifest file.

Solution: Open the manifest file AndroidManifest.xml

Check whether the activity is registered as shown in the picture

If not, register it, and if so, change the code of android:name=, and fill in the path of package com.example.xml in front of it. Fill in the path of package com.example.jizhangben1 in front of it

 

This should be written clearly package name to register it can be successful, try “ctrl + left click” click on those blue Activity name can jump, run a success also on the line

If it does not work

Check whether the button controlling the jump to this interface is set

 Button btnadd = (Button)findViewById(R.id.btn_add);

   btnadd.setOnClickListener(this);

[Solved] Failed to load the file C:\Users\Administrator\AppData\Roaming\npm\yarn.ps1, because script execution is prohibited in this system.

An error is reported after executing yarn install:

Unable to load file C:\Users\Administrator\AppData\Roaming\npm\yarn.ps1, because script execution is prohibited in this system.

Solution:

Runs PowerShell as administrator (Win7 location: C:\Windows\System32\WindowsPowerShell\v1.0)

Execution: set-ExecutionPolicy RemoteSigned