Tag Archives: bug

from keras.preprocessing.text import Tokenizer error: AttributeError: module ‘tensorflow.compat.v2‘ has..

Error from keras.preprocessing.text import tokenizer: attributeerror: module ‘tensorflow. Compat. V2’ has

Import the vocabulary mapper tokenizer in keras in NLP code

from keras.preprocessing.text import Tokenizer

Execute code and report error:

AttributeError: module 'tensorflow.compat.v2' has no attribute '__ internal__'

Baidu has been looking for the same error for a long time, but it sees a similar problem. Just change the above code to:

from tensorflow.keras.preprocessing.text import Tokenizer

That’s it!

[Solved] Sudo doesn‘t work: “/etc/sudoers is owned by uid 1000, should be 0”

1.error
When I type a sudo command into the terminal it shows the following error:

sudo: /etc/sudoers is owned by uid 1000, should be 0
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin

How do I fix this?
2. Solution:
Change the owner back to root:

pkexec chown root:root /etc/sudoers /etc/sudoers.d -R

Or use the visudo command to ensure general correctness of the files:

pkexec visudo

[Solved] Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.4:install (default-cli) on

This problem bothered me for a while. What I want to say is that I couldn’t find the problem when deploying springboot through Maven. Therefore, after quickly arranging a springboot project, I found that the error will still be reported

So I looked at this version number and added it in and it worked
   <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
<version>2.5.3</version>
            </plugin>
        </plugins>
    </build>

The request was rejected because the URL contained a potentially malicious String “//“

Problem description

After the introduction of spring security, there is no problem using Vue proxy locally. There is a problem using nginx. The problem is located in the nginx configuration

Solution:

# rewrite ^(/api/?.*)$ /$1 break;  // old
 rewrite ^/api/(.*)$ /$1 break;    // modified

Explanation
take blog.lhuakai.top/api/getxxx as an example

nginx found /API , replaced the match to /api.getxxx/ with $1 (the content in the first group) getxxx and finally became blog.lhuakai.top/getxxx

ModuleNotFoundError: No module named ‘sklearn.datasets.samples_generator‘

No module named ‘sklearn.datasets.samples_ generator’

Causes and solutions of error reporting

Problem reporting error

from sklearn.datasets.samples_generator import make_blobs

reason

samples_ The generator module has been removed in the new version of scikit learn .

samples_ The corresponding classes/functions in the generator module can be imported directly from sklearn. Datasets .

resolvent

Method 1:

Import make directly from sklearn. Datasets _ blobs

from sklearn.datasets import make_blobs

Method 2:

Version problem, reduce version

pip install scikit-learn==0.22.1

Reference: link

come on

thank you

work hard

[Solved] Java.lang.BootstrapMethodError: call site initialization exception

Causes of the problem:

When we upgrade the version of the company’s Flink, we type the task into a jar package and send it to the Flink cluster to run. Due to the upgrade of the version of the Flink, it has a certain impact on the components.

Question:

When collecting data, ES reported the following error
java.lang.bootstrap method error: call site initialization exception
java.lang.invoke.lambdaconversionexception: invalid receiver type interface org.apache.http.header; not a subtype of implementation type interface org.apache.http.NameValuePair

bug-fix:

In the POM file, HttpCore and httpclient are introduced separately, and then conflicting dependencies are excluded in the introduction of ES. However, this method does not solve my problem. Finally, it is solved by reducing the version of ES dependency, which is reduced from es7.11.1 to es7.2.0.

Use of $watch in Vue (solve rangeerror: maximum call stack size exceeded)

Problems encountered:

In a requirement, the change of a form needs a function of history recording. Because the form is very large (it is to edit an article), it is impossible to be specific to a certain attribute, so the method of watch monitoring is adopted, and {deep: true} is set. However, when previewing, I encountered the error of rangeerror: maximum call stack size exceeded . After some investigation, I found that it was caused by watch monitoring, and then I didn’t know what the problem was.

Even if nothing is written in the business code, a simple console.log will not work. As long as deep: true is set, an error will be reported, which is a headache. I didn’t find a similar case on the Internet. I thought again: since the error lies in the watch, can I dynamically monitor and cancel monitoring ?I found the answer on the official website https://cn.vuejs.org/v2/api/#vm -watch

Basic use of $watch (refer to the official website)

VM. $watch (exporfn, callback, [options]) the return value is a {function} unwatch , which returns a function to cancel the observation, which is used to stop the trigger callback option: deep, deep listening option: immediate, whether to execute once immediately

// Key Path
vm.$watch('a.b.c', function (newVal, oldVal) {
  // Do something
})

// function
var unwatch = vm.$watch(
  function () {
    // The expression `this.a + this.b` is called every time a different result is reached
    // the handler function will be called.
    // This is like listening for an undefined computed property
    return this.a + this.b
  },
  function (newVal, oldVal) {
    // Do something
  }
)

// Cancel the listener

unwatch()

My solution, for reference

// Call setWatchChapters when created, call removeWatchChapters in other cases, depending on the business case
export default {
	...
	data () {
		return {
			unWatchChapters: null
		}
	},
	created(){
		this.setWatchChapters()
	},
	methods:{
		setWatchChapters () { // Setting up a listener for chapters
			if (!this.unWatchChapters) { // prevent setting listeners more than once
				setTimeout(() => { // There are still some bugs, so use setTimeout to add to the event queue
					this.unWatchChapters = this.$watch('report.chapters', () => {
						// do something
					}, { deep: true })
				}, 0)
			}
    	},
    	removeWatchChapters () { // Unlisten to chapters
			if (this.unWatchChapters) {
				this.unWatchChapters()
				this.unWatchChapters = null
			}
		}
	}
}

NoClassDefFoundError: org/codehaus/jackson/map/ObjectMapper

Problem solving:

o.s.b.w.s.support.ErrorPageFilter - Forwarding to error page from request 
[/marketing/fastRide] due to exception [org/codehaus/jackson/map/ObjectMapper] 
java.lang.NoClassDefFoundError: org/codehaus/jackson/map/ObjectMapper

Cause of the problem:
there is a conflict between the imported version of jeckson jar and the version of jeckson introduced by other jars
or there is no imported version of jeckson
solution:
introduce this version of jeckson jar

<dependency>
   <groupId>org.codehaus.jackson</groupId>
   <artifactId>jackson-mapper-asl</artifactId>
   <version>1.9.2</version>
</dependency>
<dependency>
   <groupId>org.codehaus.jackson</groupId>
   <artifactId>jackson-core-asl</artifactId>
   <version>1.9.2</version>
</dependency>

[Solved] MybatisPlusException: Error: Method queryTotal execution error of sql

Cause: com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: Error: Method queryTotal execution error of sql :

Error reason:
the user-defined SQL is written in mapper, where is added too much, and the user-defined SQL is transferred into querywrapper, where cannot be added
error code:

String customSql="select * from ("+queryAll+") as q where ${ew.customSqlSegment}";
    @Select(customSql)
    IPage<BranchBasic> baseQuery(Page<Object> objectPage, @Param(Constants.WRAPPER)QueryWrapper queryWrapper);
   

Correct code:
as both case and upper case are OK

String customSql="select * from ("+queryAll+") as q ${ew.customSqlSegment}";
    @Select(customSql)
    IPage<BranchBasic> baseQuery(Page<Object> objectPage, @Param(Constants.WRAPPER)QueryWrapper queryWrapper);

[Solved] Failed to resolve: com.serenegiant:common:1.5.20

When using an appcloud project composed of multiple import modules, failed to resolve: com.se appears after the operation UI on the tablet side of the project is imported and synchronized renegiant:common : 1.5.20 find for many days can not solve, but today found the corresponding solution, record the first time to solve the bug excited, pro test effective.

Solution:

1. download the required common package

2. Set up an AARS folder in the root directory of the whole project, and unzip the downloaded common package and put it in it

After adding the folder and common package, you need to add the corresponding AAR dependency in the build. Gradle of the root directory, as shown on the right side of the figure above.

3. AAR dependency code to be added

//Adding aar dependencies
flatDir {
    dirs '../aars'
}

4. Set in build.gradle of the module to be referenced

implementation(name:'common-1.5.20', ext:'aar')

And note the previous code about the package, such as

implementation('com.serenegiant:common:1.5.20') {
    exclude module: 'support-v4'
}

Or

api “com.se renegiant:common :${commonLibVersion}”

5. After modification, synchronize the whole project, and then the problem is solved.