Author Archives: Robins

Linux QT download / usr / include / C + + / 7/ cstdlib:75 : 15: fatal error: stdlib. H: no such file or directory error

The phenomenon of
I recently wrote a small program under Ubuntu that always reports the following errors when running:

/usr/include/c++/7/cstdlib:75:15: fatal error: stdlib.h: No such file or directory #include_next <stdlib.h>


The reason:
I found out that:

This is because GCC7 has included libstdlib.h for better optimization, and the C Library header stdlib.h USES Include_next, which is sensitive to the GCC system header path.

Solutions:
Method 1: remove the following line from the.pro file in Qt:

INCLUDEPATH +=/usr/include

Method 2:
add the following line to the Qt. Pro file:

QMAKE_CFLAGS_ISYSTEM = -I

Reference: https://stackoverflow.com/questions/52532936/usr-include-c-7-cstdlib7515-fatal-error-stdlib-h-no-such-file-or-directo

Error: current transaction is aborted, commands ignored until end of transaction blockp

In normal database programming, we encountered errors from time to time: Current Transaction is aborted, commands ignored until the end of transaction BlockP. How to solve it?We usually look it up on the Internet. If you’re a little bit better at English you can tell from the error message that there’s probably something wrong there. But if the experience is not very rich, or the Internet to find more convenient. The most basic error message can see from the official documentation (http://www.postgresql.org/docs/8.4/interactive/errcodes-appendix.html).
The error above is the cause of improper transaction control, which can be written as follows.
Improper writing 1:
Connection OPEN.
Try {
Try {
Database operation A.
} Catch (Exception e) {
The log. The error (” do something “);
}
 
Database operation B. // The above error may occur during this data operation.
The transaction commits commit.
} Catch (Exception ex) {
Transaction rollback rollback.
} the finally {
Close the connection.
}
 
Improper writing method 2:
Connection OPEN.
Try {
Database operation A.
Database operation B.
The transaction commits commit.
} Catch (Exception ex) {
Database operation C. // The above error may occur during this data operation.
The transaction commits commit.
} the finally {
Close the connection.
}
 
In a Postgres database, if there is an error in a database operation in the same transaction, all subsequent databases in that transaction will fail.
If there is an error in database operation A, the same database operation B will report an error when it is executed. If there is an error in database operation A or database operation B, the same database operation C will report an error.
To avoid errors, someone is using the re-open method, which in effect throws away all previous operations (not in the case of auto-commit) and adds overhead by re-opening, which is not recommended.
Depending on the cause of the error, we can treat the processing before the possible error as a transaction. The processing after the error is then treated as a transaction, depending on the specific logic. That way you can avoid making mistakes.
In this way, we can change the improper 1 to
Try {
Database operation A.
} Catch (Exception e) {
Transaction rollback or commit;
The log. The error (” do something “);
}
Database operation B.  
 
In this way we can change the improper notation 2 to
} Catch (Exception ex) {
Transaction rollback or commit;
Database operation C.   
The transaction commits commit.
} the finally {
Close the connection.
}
 
 
 

Git initializes the local existing project

1. Initialize the warehouse

git init

2.remote

git remote add origin warehouse address

3. Pull the Master branch from the remote branch and merge with the local master branch

git pull origin master:master

4. Submit the local branch to the remote branch

git push -u origin master

5. Add and submit existing projects for upload

git add -A
git commit -m ''
git push --set-upstream origin master

Centos7 hive started to report an error. There is no route to the host. The firewall has been closed

Problem
hive startup error, firewall closed

	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at org.datanucleus.plugin.NonManagedPluginRegistry.createExecutableExtension(NonManagedPluginRegistry.java:606)
	at org.datanucleus.plugin.PluginManager.createExecutableExtension(PluginManager.java:301)
	at org.datanucleus.NucleusContextHelper.createStoreManagerForProperties(NucleusContextHelper.java:133)
	at org.datanucleus.PersistenceNucleusContextImpl.initialise(PersistenceNucleusContextImpl.java:420)
	at org.datanucleus.api.jdo.JDOPersistenceManagerFactory.freezeConfiguration(JDOPersistenceManagerFactory.java:821)
	... 58 more
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)
	at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:981)
	at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:339)
	at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2253)
	at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2286)
	at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2085)
	at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:795)
	at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:44)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)
	at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:400)
	at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:327)
	at java.sql.DriverManager.getConnection(DriverManager.java:664)
	at java.sql.DriverManager.getConnection(DriverManager.java:208)
	at com.jolbox.bonecp.BoneCP.obtainRawInternalConnection(BoneCP.java:361)
	at com.jolbox.bonecp.BoneCP.<init>(BoneCP.java:416)
	... 70 more
Caused by: java.net.NoRouteToHostException: No route to the host (Host unreachable)
	at java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
	at java.net.Socket.connect(Socket.java:589)
	at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:211)
	at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:298

I read all the tutorials on the Internet that it’s a firewall problem
but my firewall has been turned off

this hive is the one I copied from another virtual machine via SCP command
but the parameters in the hive site.xml have not changed

is changed to the corresponding host name
wq remains exit

start hadoop cluster
start hive
success!

[root@node01 conf]# hive
which: no hbase in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/export/servers/jdk1.8.0_131/bin:/export/servers/apache-zookeeper-3.6.2-bin/bin/:/export/servers/hadoop-2.7.7/bin/:/export/servers/hadoop-2.7.7/sbin/:/export/servers/apache-hive-2.1.1-bin/bin/:/root/bin)
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/export/servers/apache-hive-2.1.1-bin/lib/log4j-slf4j-impl-2.4.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/export/servers/hadoop-2.7.7/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]

Logging initialized using configuration in jar:file:/export/servers/apache-hive-2.1.1-bin/lib/hive-common-2.1.1.jar!/hive-log4j2.properties Async: true
Hive-on-MR is deprecated in Hive 2 and may not be available in the future versions. Consider using a different execution engine (i.e. spark, tez) or using Hive 1.X releases.
hive> 

Error using tensorflow GPU: could not create cudnn handle: cudnn_STATUS_NOT_INITIALIZED

Error in using Tensorflow-GPU:
Error

Could not create cudnn handle: CUDNN_STATUS_NOT_INITIALIZED
***Error: Failed to get convolution algorithm. This is probably because cuDNN Failed to initialize, so try looking to see if a warning log message was printed above.

The error mainly points to cudnn, but the CUDA version and cudnn version are in line with the current tensorflow requirements (meaning there is no need to change the CUDA version and cudnn version)
, so it can only be caused by GPU use problem (meaning it is not the fault caused by the program needs to call GPU for many times)
The solution: **
Set GPU on-demand allocation mode
Tensorflow – GPU 2.3.1(be aware of the version of TensorFlow)****

config= tf.compat.v1.ConfigProto()
config.gpu_options.per_process_gpu_memory_fraction = 0.7 #0.7parameter, meaning the percentage allocated to gpu-memory.
sess=tf.compat.v1.Session(config=config)

Older version of TensorFlow-GPU

`config= tf.ConfigProto()
config.gpu_options.per_process_gpu_memory_fraction = 0.7 #0.7parameter, meaning the percentage allocated to gpu-memory.
sess=tf.Session(config=config)`

* Set GPU to apply video memory dynamically
Tensorflow – GPU 2.3.1(be aware of the version of TensorFlow)****

config = tf.compat.v1.ConfigProto()
config.gpu_options.allow_growth = True
session = tf.compat.v1.Session(config=config)

Older version of TensorFlow-GPU

`config = tf.ConfigProto()
config.gpu_options.allow_growth = True
session = tf.Session(config=config)

Please insert the above code into the front of any part of the program to solve the problem

Springboot package error: failed to execute goal org.apache.maven.plugins:maven-resources-plugin: 3.2.0…

The solution was written above: modify the version of maven-Resources-plugin

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>

        <!--Modify the version here-->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <version>2.4.3</version>
        </plugin>
        <!---->

    </plugins>
</build>

Question: Today want to wrap springboot item packaged into a Jar or war packages, all of a sudden has been told me Failed to execute goal. Org. Apache maven. Plugins: maven - resources - the plugin: 3.2.0 </ code>, package </ code> and install </ code> command cannot be performed, Then I see that the version of my Maven-resources-plugin is 3.2.0. After looking up a lot of information, I wonder if it is the version problem. Then I change the version number below, and it becomes.

continue!

Verilog testbench common blocks

1. System function block
Read in the local file, the last two can default

$readmemb ("<Data file name>",<Repository name>,<Start address>,<End address>)
$readmemh ("<DataFileName>",<RepositoryName>,<StartAddress>,<EndAddress>)

reg [379:0] CAL2_sample[0:2999];
initial $readmemb ( "./../matlab/ideal_high_freq_sample_bits.txt", CAL2_sample,0,2999 );

tdc_finecode_i <= CAL2_sample[samlpe_cnt];

Save the print results to the document

// finetime_o finetime_valid_o output:dut
integer fid;
initial
	fid = $fopen("fintimeout_ideal1.txt","w");
	
integer finetime_cnt=0;
always@(posedge main_pll_clk_80m_i or negedge rst_n) begin
	if(!rst_n) begin
		finetime_cnt <= 'd0;
	end
	else if(finetime_cnt==2999) 
		$fclose(fid); 
	else if(finetime_valid_buf==2'b01) begin
		finetime_cnt <= finetime_cnt + 1'b1; 
		$fwrite(fid,"%d\n",finetime_o); 
		$display("%d",finetime_o);
	end 
	finetime_valid_buf <= {finetime_valid_buf[0],finetime_valid_o};
end

Mybatis single parameter pass in exception (How to Fix)

MyBatis passes in an exception for a single parameter

Integer or java.lang.String, if we do not perform dynamic SQL splicing, it will not report an error, when performing dynamic splicing, it will report an error, the error is as follows

Caused by: org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  Cause: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'rname' in 'class java.lang.String'
### Cause: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'rname' in 'class java.lang.String'

1. Interface code

 int selectCount(String rname);

2. Configuration file code

  <select id="selectCount" resultType="int" parameterType="string">
        select count(*) from cst_customer where 1=1
        <if test="rname!=null and rname!=''">
        and cust_name like #{rname}
        </if>
    </select>

3. How to solve it

   <select id="selectCount" resultType="int" parameterType="string">
        select count(*) from cst_customer where 1=1
        <if test="_parameter!=null and _parameter!=''">
        and cust_name like #{rname}
        </if>
    </select>

4. Why are errors reported

When passing a single parameter to dynamically splice sql, mybatis converts our parameter to _parameter by default, or you can add the @Param comment to the interface field.

[problem solving] property[ elasticsearch.version ] is missing for plugin [head]

Error message:

[2019-09-28T11:41:25,169][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [node-1] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.IllegalArgumentException: property [elasticsearch.version] is missing for plugin [head]
	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:140) ~[elasticsearch-6.3.2.jar:6.3.2]
	at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:127) ~[elasticsearch-6.3.2.jar:6.3.2]
	at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-6.3.2.jar:6.3.2]
	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-6.3.2.jar:6.3.2]
	at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-6.3.2.jar:6.3.2]
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93) ~[elasticsearch-6.3.2.jar:6.3.2]
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:86) ~[elasticsearch-6.3.2.jar:6.3.2]
Caused by: java.lang.IllegalArgumentException: property [elasticsearch.version] is missing for plugin [head]
	at org.elasticsearch.plugins.PluginInfo.readFromProperties(PluginInfo.java:187) ~[elasticsearch-6.3.2.jar:6.3.2]
	at org.elasticsearch.plugins.PluginsService.readPluginBundle(PluginsService.java:484) ~[elasticsearch-6.3.2.jar:6.3.2]
	at org.elasticsearch.plugins.PluginsService.findBundles(PluginsService.java:463) ~[elasticsearch-6.3.2.jar:6.3.2]
	at org.elasticsearch.plugins.PluginsService.<init>(PluginsService.java:147) ~[elasticsearch-6.3.2.jar:6.3.2]
	at org.elasticsearch.node.Node.<init>(Node.java:311) ~[elasticsearch-6.3.2.jar:6.3.2]
	at org.elasticsearch.node.Node.<init>(Node.java:252) ~[elasticsearch-6.3.2.jar:6.3.2]
	at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:213) ~[elasticsearch-6.3.2.jar:6.3.2]
	at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:213) ~[elasticsearch-6.3.2.jar:6.3.2]
	at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:326) ~[elasticsearch-6.3.2.jar:6.3.2]
	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:136) ~[elasticsearch-6.3.2.jar:6.3.2]
	... 6 more

Reason for error: Placing the ES Head plug-in decompression package under the Plugins directory of the ES package causes an es startup error
Solution: Create a new directory under the es installation package and just move the location

On and off of timer in JS

setInterval()
When a function
is called for a specified period of time:

setInterval(function,time,lang)

function: function to be called or code string to be executed
time: required parameters, every how long to call the function, in milliseconds
lang: optional parameters, running JScript | VBScript | JavaScript
clearInterval()
Means to stop the setInterval timer call function

function getTime() {
        console.log(123);
        if (true) {
            clearInterval(db)
        }
    }

let db = setInterval(getTime, 1000)

setTimeout()
Call a function after a certain time
syntax:

setTimeout(function,time,lang)

Function:
function: required, to be called
time: required, number of milliseconds to wait before executing code
lang: optional, script language: JScript | VBScript | JavaScript