Tag Archives: development language

[Solved] error C4996: QString::SkipEmptyParts declaration has been rejected

Recently upgraded QT version from Qt5 12.9 upgrade to qt5.0 15.2. There are several errors in compilation, one of which is error c4996: qstring:: skipemptyparts. The declaration has been rejected.

It is found that Qt5 In versions after 14, QString::SkipEmptyParts has been moved to Qt::SkipEmptyParts.

After modifying QString::SkipEmptyParts to Qt::SkipEmptyParts in the code, the compilation passes and the problem is solved.

[Solved] PHP post Datas json_decode Error: 4 JSON_ERROR_SYNTAX

Error description

In the PHP development process, when processing json strings, json_decode returns NULL, calling last_error returns 4 (JSON_ERROR_SYNTAX), but json strings can be correctly processed by other languages ​​such as python, javascript or some online json parsers.

Diagnosis

There are several situations that generally cause php json_decode errors here:

1. The json string is read from a file and the character order mark (BOM) is not removed

2. json contains invisible characters, json_decode parsing errors

3. json object value is a single-quoted string

In particular, the third error is relatively hidden, the naked eye is often easy to ignore

Solution:

The following solutions are given for the above three cases

1.BOM Issue:

Open the file in binary mode and confirm whether there is a BOM. If so, remove the BOM before parsing. The following code takes UTF-8 as an example to detect and delete BOM.

function removeBOM($data) {

if (0 === strpos(bin2hex($data), ‘efbbbf’)) {

return substr($data, 3);

}

return $data;

}

2.Invisible character

Remove invisible characters before parsing.

for ($i = 0; $i <= 31; ++$i) {

$s = str_ replace(chr($i), “”, $s);

}

3.Single quote string value

Let’s look at the following example:

<?php

$s = “{\”x\”:’abcde’}”;

$j = json_ decode($s, true);

var_ dump($j);

echo json_ last_ error() . “\n”;

PHP 5.5. 9 output

NULL

four

Generally, you only need to replace single quotation marks with double quotation marks. During specific processing, you should pay attention to that single quotation marks may also appear in other places. Whether to replace them globally needs to be analyzed according to the specific situation.

[Solved] Paramiko error: AttributeError: ‘NoneType’ object has no attribute ‘time’

Error message:


Exception ignored in: <function BufferedFile.__del__ at 0x1104b7d30>
Traceback (most recent call last):
  File "/Users/jerrylin/.conda/envs/pythonProject/lib/python3.8/site-packages/paramiko/file.py", line 66, in __del__
  File "/Users/jerrylin/.conda/envs/pythonProject/lib/python3.8/site-packages/paramiko/channel.py", line 1392, in close
  File "/Users/jerrylin/.conda/envs/pythonProject/lib/python3.8/site-packages/paramiko/channel.py", line 991, in shutdown_write
  File "/Users/jerrylin/.conda/envs/pythonProject/lib/python3.8/site-packages/paramiko/channel.py", line 967, in shutdown
  File "/Users/jerrylin/.conda/envs/pythonProject/lib/python3.8/site-packages/paramiko/transport.py", line 1846, in _send_user_message
AttributeError: 'NoneType' object has no attribute 'time'

Program code:

import paramiko
import sys
import time
# Instantiate SSHClient
client = paramiko.SSHClient()

# Auto add policy to save server's host name and key information, if not added, then hosts no longer recorded in local know_hosts file will not be able to connect
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())

# Connect to the SSH server and authenticate with username and password
client.connect()

# Open a Channel and execute commands
stdin, stdout, stderr = client.exec_command('ls data/data_target') # stdout is the correct output, stderr is the error output, and there is one variable with a value

# Print the execution result
print(stdout.read().decode('utf-8'))

# Close SSHClient

client.close()

Solution:

The reason for the error is that the output print conflicts with the close executed by the program. You only need to add a time before the close Sleep (1) is OK

The Java class generated by protocol reports an error: cannot access

The Java class generated by protocol reports an error:

The generated template class reported an error. It was said on the Internet that the version was wrong, but I was sure that the version used was correct. Later, it was checked that a proto was introduced into the command_Path causes the generated template class to report an error

Error command:

protoc --proto_path=D:\000\hadoop-2.7.2-src\hadoop-yarn-project\hadoop-yarn\hadoop-yarn-api\src\main\proto\ --proto_path=D:\000\hadoop-2.7.2-src\hadoop-common-project\hadoop-common\src\main\proto\ --proto_path=.\ --java_out=.\ .\*.proto

Change to the following command:

protoc --proto_path=D:\000\hadoop-2.7.2-src\hadoop-common-project\hadoop-common\src\main\proto\  --proto_path=.\ --java_out=.\ .\*.proto

One less — proto_Path, and then the problem is solved

How to Solve Java Runtime (class file version 53.0)ERROR

libs/granite/ui/components/shell/header/user/User has been compiled by a more recent version of the Java Runtime (class file version 53.0), this version of the Java Runtime only recognizes class file versions up to 52.0

Specific corresponding version:

JDK 1.1 = 45
JDK 1.2 = 46
JDK 1.3 = 47
JDK 1.4 = 48
Java SE 5.0 = 49
Java SE 6.0 = 50
Java SE 7 = 51
Java SE 8 = 52
Java SE 9 = 53
Java 10 = 54
Java 11 = 55
Java 12 = 56
…

 

So the question is, how to replace the version?
First of all, the easiest way is to check whether java has been installed through the command: java -version
View the java package of yum source: yum list java*
Install java108jdk software: yum -y install java-1.8.0-openjdk****
Verify that the installation is successful, check the java version: java -version

[Solved] QT Compile Error: nmake: fatal error u1077

One possibility is that the installation path of VS is not added to the environment variable
an error is reported:
nmake 👎 Error: u1077: “D:\program files (x86)\Microsoft Visual Studio 14.0\VC\bin\AMD64\link.Exe”: return code “0x486”

Solution:

Add to the environment variable:

D:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN

error: inlining failed in call to always_inline [How to Solve]

When compiling an open source project DB engine paradigms,

The project GitHub address reported an error as follows

/usr/lib/gcc/x86_64-linux-gnu/5/include/avx512vlintrin.h:10325:1: error: inlining failed in call to always_inline '__m256i _mm256_mmask_i32gather_epi32(__m256i, __mmask8, __m256i, const int*, int)': target specific option mismatch
 _mm256_mmask_i32gather_epi32 (__m256i __v1_old, __mmask8 __mask,

As soon as I see it, I’ll put cmakelists under the root directory of this project.txt

Add -mavx512vl! it’s awesome!

# Compiler flags for the different targets
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -mtune=native -std=c++14 -fPIC -Wall -Wextra -Wno-psabi -fno-omit-frame-pointer -Wno-unknown-pragmas -mavx512vl")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -Wall -Wextra -fno-omit-frame-pointer -march=native -fdiagnostics-color -mavx512vl")

[Solved] redis Error: Can‘t save in background fork Cannot allocate memory

redis-cli -p 12345

[root@localhost ~]# redis-cli -p 6379
127.0.0.1:6379> auth "123456"
OK
127.0.0.1:6379> info
# Server
redis_version:3.2.12
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:7897e7d0e13773f
redis_mode:standalone
os:Linux 3.10.0-1127.19.1.el7.x86_64 x86_64
arch_bits:64
multiplexing_api:epoll
gcc_version:4.8.5
process_id:1242
run_id:XXX
tcp_port:6379
uptime_in_seconds:1186639
uptime_in_days:13
hz:10
lru_clock:11977524
executable:/usr/bin/redis-server
config_file:/etc/redis.conf

# Clients
connected_clients:1
client_longest_output_list:0
client_biggest_input_buf:0
blocked_clients:0

# Memory
used_memory:3486652368
used_memory_human:3.25G
used_memory_rss:3548164096
used_memory_rss_human:3.30G
used_memory_peak:3486886808
used_memory_peak_human:3.25G
total_system_memory:16637546496
total_system_memory_human:15.49G
used_memory_lua:37888
used_memory_lua_human:37.00K
maxmemory:0
maxmemory_human:0B
maxmemory_policy:noeviction
mem_fragmentation_ratio:1.02
mem_allocator:jemalloc-3.6.0

# Persistence
loading:0
rdb_changes_since_last_save:8
rdb_bgsave_in_progress:0
rdb_last_save_time:1639367433
rdb_last_bgsave_status:ok
rdb_last_bgsave_time_sec:20
rdb_current_bgsave_time_sec:-1
aof_enabled:0
aof_rewrite_in_progress:0
aof_rewrite_scheduled:0
aof_last_rewrite_time_sec:-1
aof_current_rewrite_time_sec:-1
aof_last_bgrewrite_status:ok
aof_last_write_status:ok

# Stats
total_connections_received:3831251
total_commands_processed:18072447
instantaneous_ops_per_sec:15
total_net_input_bytes:1538227697
total_net_output_bytes:907587826299
instantaneous_input_kbps:0.61
instantaneous_output_kbps:3.07
rejected_connections:0
sync_full:0
sync_partial_ok:0
sync_partial_err:0
expired_keys:0
evicted_keys:0
keyspace_hits:7332354
keyspace_misses:6533
pubsub_channels:0
pubsub_patterns:0
latest_fork_usec:2025
migrate_cached_sockets:0

# Replication
role:master
connected_slaves:0
master_repl_offset:0
repl_backlog_active:0
repl_backlog_size:1048576
repl_backlog_first_byte_offset:0
repl_backlog_histlen:0

# CPU
used_cpu_sys:1586.86
used_cpu_user:625.00
used_cpu_sys_children:3198.40
used_cpu_user_children:46091.06

# Cluster
cluster_enabled:0

# Keyspace
db0:keys=936,expires=0,avg_ttl=0

 

 

redis maxmemory:0 There is no limit to the amount of memory that can be used.
linux
[root@localhost redis]# sysctl -a|grep overcommit_memory
vm.overcommit_memory = 0
vm.overcommit_memory = 0 Heuristic The size of the virtual memory allocated for this request and the current free physical memory on the system plus swap determine whether to release it. When the system allocates virtual address space for the application process, it determines whether the size of the currently requested virtual address space exceeds the remaining memory size, and if it does, the virtual address space allocation fails.
When redis saves in-memory data to disk, in order to prevent the main process from falsely dying, it forks a child process to complete this save operation. However, the forked subprocess will need to allocate the same amount of memory as the main process, which is equivalent to double the amount of memory needed, and if there is not enough memory available to allocate the required memory, the forked subprocess will fail to save the data to disk.
/etc/redis.conf
[root@localhost etc]# more redis.conf |grep “stop-writes-on-bgsave-error”
stop-writes-on-bgsave-error yes
stop-writes-on-bgsave-error: Whether to continue processing Redis write commands when generating RDB files with errors, the default yes Redis does not allow users to perform any update operations
Reasons.
1 The memory of redis itself is not limited. maxmemory:0.
2 redis forks the same memory as the main process when it forks the process to save data, which is memory double.
3 linux server vm.overcommit_memory = 0, which does not allow excessive memory overcommits.
4 redis configuration file default stop-writes-on-bgsave-error, which does not allow users to exceed when writes fail.
Optimization suggestions.
Modify vm.overcommit_memory = 0 vm.overcommit_memory = 1

 

[Solved] Annotation Customize Error: ElementType cannot be resolved to a variable

In the development process, you may use custom annotations (this article uses custom annotations when using JWT) to report an error:

ElementType cannot be resolved to a variable

Manually import packages:

import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.ElementType;

Perfect solution

[Solved] QT error: the packaged exe of Enigma virtual box reports an error cannot load library qt5core.dll

Question:

Put the enigma virtual box packaged exe to another computer for use, and an error will be reported when opening the EXE: cannot load library qt5core DLL
(in fact, the library qt5core.DLL is included when using enigma virtual box)

reason:

This is not the lack of qt5core DLL , nor is there a problem with this library. Because [problem solving] the code cannot be executed because libgcc_s_dw2-1.dll, libwinpthread.dll and libstdc + ± 6.dll cannot be found. Reinstallation may solve this problem. This problem is caused by the lack of libgcc_s_dw2-1.DLL, libwinpthread.DLL, libstdc + + - 6.dll , but the error cannot be reported after packaging load library Qt5Core.DLL, the analysis may be because qt5core DLL depends on the above libraries to run.

 

Solution:

From Qt5 12.0\5.12.0\mingw73_64\bin (different versions and different directories) copy the three dynamic libraries libgcc_s_dw2-1.DLL, libwinpthread.DLL, libstdc + + - 6.DLL , and then use the EXE packaged with enigma virtual box to avoid errors.

comparison of directories before and after modification: