Category Archives: Error

[Windows] elasticsearch.exceptions.RequestError: <unprintable RequestError object>

elasticsearch.exceptions.RequestError: <unprintable RequestError object>

There are many ways to solve this problem.
Use the following two commands in Pycharm
$pip install django haystack
$pip install elasticsearch==2.4.1

Note that the server-side elasticsearch should be consistent with the pip install elasticsearch==2.4.1 version

[Solved] Android Studio 3.0 Error: Error: INSTALL_FAILED_TEST_ONLY

Reason: After Android Studio 3.0, when generating debug apk, the android:testOnly=”true” attribute is automatically added in the application tag of the apk’s manifest file. android:testOnly=” true” This tag was originally used for testing, so packages with this tag cannot be installed in general, and need to be installed in a special way (by adding the -t flag).

Solution:

Method 1: Set: android.injected.testOnly=false in the global configuration gradle.properties file in the project

Method 2: Add -t property: adb install -t app-debug.apk

 

[Solved] SyntaxError: Invalid regular expression: invalid group specifier name

SyntaxError: Invalid regular expression: invalid group specifier name

Regular problem

SafariSyntaxError: Invalid regular expression: invalid group specification name
FirefoxSyntaxError: invalid regexp group
Mobile terminal: Android is normal, iOS is not

reason

Firefox, IE, and IOS do not support the following writing methods: ?<=, ?<!, ?!, ?=

Look ahead is a kind of conditional judgment, such as if statement
(?=exp) the position that satisfies expression exp after positive look ahead match
(?!exp) the position that does not satisfy expression exp after negative look ahead match

Solution:

let reg = /ab?<=cd/
Modify to
let reg = new RegExp('ab(?<=cd)')

error LNK2019: Unresolvable external symbols “__declspec(dllimport) public: int __thiscall QString::toWCharArray(wchar_t

Problem: Compiling poppler-0.42.0\qt4 on win10 with cmake and vs2010 reports the following error.

2>poppler-document.obj : error LNK2019: Unresolvable external symbol “__declspec(dllimport) public: int __thiscall QString::toWCharArray(wchar_t *)const ” (__imp _?toWCharArray@QString@@@QBEHPA_W@Z), the symbol in the function “public: __thiscall Poppler::DocumentData::DocumentData(class QString const &,class GooString * ,class GooString *)” (? ? 0DocumentData@Poppler@@QAE@ABVQString@@@PAVGooString@@1@Z) is referenced in

Reason: The Qt library itself compiles with /Zc:wchar_t- , if your program compiles with /Zc:wchar_t it will cause the compiler to have different rules for adapting function names
Whichever one it is, consistency is good.

Solution: Project – Properties – C/C++ – Language, Set wchar_t as a built-in type and change it to match the Qt library

[Solved] Error:E0415 no suitable constructor exists to convert from “int“ to “Rational“

Scene:

The problem is that the constructor for is missing or is declared as explicit.

Please refer to the following scenario.

#include <iostream>

using std::cout;
using std::endl;

class Rational1
{
public:
	Rational1(int n = 0, int d = 1):num(n), den(d)
	{
		cout << __func__ << "(" << num << "/" << den << ")" << endl;
	}

public:
	int num; 
	int den;
};

class Rational2
{
public:
	explicit Rational2(int n = 0, int d = 1) :num(n), den(d)
	{
		cout << __func__ << "(" << num << "/" << den << ")" << endl;
	}

public:
	int num;
	int den;
};

void Display1(Rational1 r)
{
	cout << __func__ << endl;
}

void Display2(Rational2 r)
{
	cout << __func__ << endl;
}


int main()
{
	Rational1 r1 = 11;
	Rational1 r2(11);
	Rational2 r3 = 11; // error E0415
	Rational2 r4(11);

	Display1(1);
	Display2(2); // error  E0415
	return 0;
}

Explicit keyword

1. Specifies that the constructor or conversion function (from C++11) is explicit, that is, it cannot be used for implicit conversion and copy initialization
2. Explicit can be used with constant expressions The function is explicit if and only if the constant expression evaluates to true (From C++20)

Problem description

Error:E0415 no suitable constructor exists to convert from “int“ to “Rational“

Solution:

1. Implement the corresponding constructor yourself. (Recommended)
2. Delete the constructor modified by the explicit keyword. (Not recommended)

How to Solve elasticsearch and logstash Install Error

Turning on the logstash service appears: Failed to start logstash.service: Unit not found.

[root@localhost ~]# systemctl start logstash
Failed to start logstash.service: Unit not found.

Issue 1:
First problem: Failed to start logstash.service: Unit not found.
Solution idea.
Generate logstash.service file

[root@localhost ~]# sudo /usr/share/logstash/bin/system-install /etc/logstash/startup.options systemd

Check if the service can be opened normally

Issue 2:
The second problem: If you use this access could not find any executable java binary. Please install java in your PATH or set JAVA_HOME.

[root@localhost ~]# sudo /usr/share/logstash/bin/system-install /etc/logstash/startup.options systemd
Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME.

Reason: logstash can’t get to AVA_HOME variable, need to add refresh profile in the configuration file
Solution.

[root@localhost ~]# vi /etc/profile                #Add the specified version of the JDK directory installed on the local machine
export JAVA_HOME=/usr/local/jdk1.8
export CLASSPATH=$JAVA_HOME/lib:$JAVA_HOME/jre/lib
export PATH=$JAVA_HOME/lib:$JAVA_HOME/jre/bin:$PATH:$HOME/bin

[root@localhost ~]# vi /usr/share/logstash/bin/logstash.lib.sh
Add source /etc/profile in the last line
[root@localhost ~]# vi /usr/share/logstash/bin/logstash
Add source /etc/profile in the last line

Refresh the configuration file, and then see if the service can be opened normally

Issue 3:
Third problem : /usr/share/logstash/vendor/jruby/bin/jruby:line 388: /usr/bin/java: No that file or directory
Unable to install system startup script for Logstash.
Reason: Can’t get the java executable file
Solution:

[root@localhost ~]# ln -s /usr/local/jdk1.8/bin/java /usr/bin/java

Reinstall the service to install.

[root@localhost ~]# rpm -e logstash
Error: package logstash is not installed
[root@localhost ~]# rpm -ivh /mnt/logstash-5.5.1.rpm
Warning: /mnt/logstash-5.5.1.rpm: Head V4 RSA/SHA512 Signature, key ID d88e42b4: NOKEY
In preparation…                          ################################# [100%]
Package logstash-1:5.5.1-1.noarch is installed

Generate logstash.service file

[root@localhost ~]# sudo /usr/share/logstash/bin/system-install /etc/logstash/startup.options systemd
Using provided startup.options file: /etc/logstash/startup.options

Start successfully!

[root@localhost ~]# systemctl start logstash

[Solved] Hexo FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed

After I upgrade npm, an error report:

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed
0xb00d90 node::Abort() [hexo]

Solution: The cause is memory overflow

Increase memory

sudo npm i -g increase-memory-limit
increase-memory-limit
    Expand the memory for NODE operation
export NODE_OPTIONS=--max_old_space_size=4096

The value should not be too large, which may affect the server operation

[Solved] fatal: not in a git directory Error: Command failed with exit 128: git

fatal: not in a git directory Error: Command failed with exit 128: git

brew install cmake  execute error:

Already downloaded: /Users/kingcall/Library/Caches/Homebrew/downloads/b7ef8d6eb909e967d072212c62e71bfb8e94e6227ae2d3567bbabcc561fd9fff--cmake-3.21.4.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/cmake/blobs/sha256:c86a0bb0e37c293e2d4475519d28f2784c430e871f74969a1a2afeb64b540a7d
Already downloaded: /Users/kingcall/Library/Caches/Homebrew/downloads/1e8ca69a4444469a3f380baf4e514072d4d0f0b5d5ccd43b8ce3eb68081eff3d--cmake--3.21.4.arm64_monterey.bottle.tar.gz
fatal: not in a git directory
Error: Command failed with exit 128: git

The solution is as follows:

Running brew -v will give you two prompts to set the file paths for homebrew-cask and homebrew-core to safe.directory, i.e. using the following names.

Follow the prompts

git config --global --add safe.directory /opt/homebrew/Library/Taps/homebrew/homebrew-core
git config --global --add safe.directory /opt/homebrew/Library/Taps/homebrew/homebrew-cask

Then executearch -arm64 brew install cocoapods will be OK!

If the above error is encountered, follow the prompts

git config --global --add safe.directory /opt/homebrew/Library/Taps/homebrew/homebrew-services

Then execute arch -arm64 brew install cocoapods again to succeed.

After successful execution, we execute our installation command againbrew install cmake

[Solved] VsCode + gfortran Compiler Error: error: ld returned 1 exit status

After a file is executed in the VsCode control panel, if a new f90 file is created (multiple programs share the same panel port), an error message as shown in the figure will often appear

Solution:
The tasks.json file should add the presentation property `

{
    "version": "2.0.0",
    "tasks": [
      {
        "label": "compile",
        "type": "shell",
        "command": "gfortran",
        "args": [
          "-g",
          "${file}",
          "-o",
          "${workspaceRoot}\\${fileBasenameNoExtension}.exe"
        ],
        "problemMatcher": [],
        "group": {
          "kind": "build",
          "isDefault": true
        },
        "presentation": {
          "echo": true,
          "reveal": "always",
          "focus": false,
          "panel": "new", //Here shared means shared, after changing to new each process creates a new port
          "showReuseMessage": true,
          "clear": false
        }
      }
    ]
  }

“Shared” indicates sharing. After changing to new, each process creates a new port.

[Solved] Error: L6218E: Undefined symbol vApplicationGetIdleTaskMemory (referred from tasks.o).

I am using F103ZET6 board, after successful porting

I got two errors in stm32f10x_it.c

void SVC_Handler(void)

void PendSV_Handler(void)

Occupancy problem of two functions

Then the following two problems appeared in the compilation:

..\OBJ\LED.axf: Error: L6218E: Undefined symbol vApplicationGetIdleTaskMemory (referred from tasks.o).

..\OBJ\LED.axf: Error: L6218E: Undefined symbol vApplicationGetTimerTaskMemory (referred from timers.o).

 

Including the header file and the path of the header file

That’s a program error

The method is simple:

In FreeRTOS

Cancel the static memory request of FreeRTOS

#define configSUPPORT_DYNAMIC_ALLOCATION        1                       //Support for dynamic memory requests
#define configSUPPORT_STATIC_ALLOCATION 1 //Support static memory requests
#define configTOTAL_HEAP_SIZE ((size_t)(20*1024)) //System all heap size

#define configSUPPORT_DYNAMIC_ALLOCATION        1                       //Support for dynamic memory requests
#define configSUPPORT_STATIC_ALLOCATION 1 //Support static memory requests
#define configTOTAL_HEAP_SIZE ((size_t)(20*1024)) //System all heap size