Tag Archives: note

Docker Run ‘echo core > /proc/sys/kernel/core_pattern‘ Error

1、 Background

In the previous article, the research group needs to encapsulate AFL as a web API with docker in order to make a visual display of AFL on the web side. When the script is redeployed, the AFL boot fails when calling AFL for fuzzing. Because before executing AFL fuzzy , if the system is configured to send core dump file (core) notification to external programs, the delay between sending crash information to fuzzer will increase, and the crash may be falsely reported as timeout. So you have to modify the core temporarily_ Pattern file, as follows:

echo core > /proc/sys/kernel/core_pattern

However, an error occurs when executing the above command in the docker container:

bash: /proc/sys/kernel/core_pattern: Read-only file system

Core_ Pattern is a system read-only file and cannot be modified

2、 Doubt

When docker is executed, the root user executes various commands internally. Why can’t you change the files with read-only permission?With this question, baidu found it again and again, but it didn’t find one. Therefore, it checked a machine turned post, which is also ambiguous.

Since Baidu can’t, then Google. After checking for two minutes, I found a blog of compatriots across the Strait and found a solution.

3、 Solution

Direct code:

# Add the --privileged parameter when building the container
docker run -idt -p xx:xx --privileged afl-api:0.0.3

As with the above command, the problem can be solved by adding an additional -- privileged parameter when building the container.

4、 Cause

About version 0.6, privileged was introduced into docker
with this parameter, the root in the container has real root permissions
otherwise, the root in the container is only an external ordinary user permission
with the container started by privileged, you can see many devices on the host and execute mount
it even allows you to start the docker container in the docker container

That is, the container with the -- privileged parameter can really execute root permission.

The ADB server port is changed to 10001, and appium cannot connect to the device

After modifying the ADB server port to 10001, enter ADB devices – L in CMD to successfully detect the device:

Open appium and run the script. The appium running log shows that the device cannot be connected and has been killing the port number 5037 ADB server. The error information is as follows:

I changed the port number of the ADB server to 10001. Why do I still kill 5037?

Seeing this error, when I first thought about it, the environment variable of the modified port was not configured to appium. Click the edit configurations button of appium, and I found that there were no new buttons, but only the default environment variable:

I searched a lot of information on the Internet and found no solution. Finally, I found a solution in an appium Chinese user guide,   Put the guide link here: appium Chinese User Guide – Jianshu (Jianshu. Com)

Modify the running script and add ‘adbport’: ‘10001’ to desired_ In caps Dictionary:

Restart appium, run the script again, connect the device successfully, and solve the problem!

PS: when using appium, you can familiarize yourself with the above instructions and have a general understanding of appium; Then, when running, you should pay attention to the running log. Many problems can be located step by step through the error reporting of the log

maven_ Unable to create servlet file under Java Web project

Add the following code in pom.xml:

<!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api -->
<dependency>
   <groupId>javax.servlet</groupId>
   <artifactId>javax.servlet-api</artifactId>
   <version>4.0.1</version>
   <scope>provided</scope>
</dependency>
 
<!-- https://mvnrepository.com/artifact/jstl/jstl -->
<dependency>
   <groupId>jstl</groupId>
   <artifactId>jstl</artifactId>
   <version>1.2</version>
</dependency>

Vue modifies the value passed by props error: Avoid mutating a prop directly since the value will be overwritten whenever the par

When doing a project, you will sometimes encounter this kind of error
this sentence means to avoid changing the prop directly, because as long as the parent component is re rendered, the value will be overridden. Instead, use data or calculate properties based on the prop value
you can’t directly change the props passed by the parent component, so what can you do?You can use emit to trigger the events of the parent component
parent component

<template>
    <div class="class">
        <Student :show="isShow" @hideStudent="hideStudent" />
        <button @click="showStudent">点我显示学生</button>
    </div>
</template>

<script>
import Student from "./student";
export default {
    name: "class",
    components: { Student },
    data() {
        return {
            isShow: false,
        };
    },

    methods: {
        showStudent() {
            this.isShow = true;
        },
        hideStudent() {
            this.isShow = false;
        },
    },
};
</script>

Subcomponents

<template>
    <div class="student" v-show="show">
        <nav>Mike</nav>
        <button @click="close">点我关闭student</button>
    </div>
</template>

<script>
export default {
    name: "student",
    props: {
        show: {
            type: Boolean,
            default:false
        },
    },
    methods: {
        close() {
            this.$emit("hideStudent");
        },
    },
};
</script>

Of course, subcomponents can also write like this, using watch to listen

<template>
    <div class="student" v-show="showStudent">
        <nav>Mike</nav>
        <button @click="close">点我关闭student</button>
    </div>
</template>

<script>
export default {
    name: "student",
    props: {
        show: {
            type: Boolean,
            default:false
        },
    },
    data() {
        return {
            showStudent:false
        };
    },
    watch:{
        show(){
            this.showStudent=this.show
        },
    },
    methods: {
        close() {
            this.$emit("hideStudent");
        },
    },
};
</script>

Finally, let’s take a look at the rendering


for more details about the value transmission of vueprops, see the value transmission of Vue parent-child components

Anti card limited Drag Based on react draggable drag

Recently, a project requirement is to click the question mark to display the prompt window. The window is fixed, does not scroll with the scroll bar, and can be dragged within the scope. It does not affect the lower form input.

I think of using anti card combined with react draggable. Record the implementation code here:

import React from 'react';
import { Modal, Button, Card, Icon } from 'antd';
import Draggable from 'react-draggable';

export default class App extends React.Component {

    constructor(props) {
        super(props);
        this.state = {
            cardShow: false,
            disabled: true,
            bounds: { left: 0, top: 0, bottom: 0, right: 0 }, // Initialize drag boundary
        };
        this.draggleRef = React.createRef();
    }

    onStart = (event, uiData) => {
        const { clientWidth, clientHeight } = window.document.documentElement;
        const targetRect = this.draggleRef.current.getBoundingClientRect();
        this.setState({
            // Set the drag boundary to limit the dragging distance from the top, bottom, left and right of the initial position, the following setting is draggable in the browser window
            // If the page has a fixed display header, it must be draggable below the header, you can set top: -targetRect.top + uiData.y + height of the header.
            bounds: {
                left: -targetRect.left + uiData.x,
                right: clientWidth - 300,
                top: -targetRect.top + uiData.y,
                bottom: clientHeight - (targetRect.bottom - uiData.y),
            },
        });
    };

    onClickShow = () => {
        this.setState({
            cardShow: true,
        })
    }

    onClickClose = () => {
        this.setState({
            cardShow: false,
            bounds: { left: 0, top: 0, bottom: 0, right: 0 },
        })
    }

    render() {
        const {disabled, bounds, cardShow} = this.state;
        return (
            <div style={{width: '100%'}}>
                <Draggable
                    disabled={disabled}
                    bounds={bounds}
                    onStart={(event, uiData) => this.onStart(event, uiData)}
                >
                    <div ref={this.draggleRef}>
                        {cardShow &&
                        <Card
                            title={
                                <div
                                    style={{
                                        width: '100%',
                                        cursor: 'move',
                                    }}
                                    onMouseOver={() => {
                                        this.setState({
                                            disabled: false,
                                        });
                                    }}
                                    onMouseOut={() => {
                                        this.setState({
                                            disabled: true,
                                        });
                                    }}
                                    onFocus={() => {}}
                                    onBlur={() => {}}
                                >
                                    {'Title'}
                                </div>
                            }
                            extra={
                                <span onClick={() => this.onClickClose()}>
                                    <Icon type={'close'} style={{fontSize:'16px'}}/>
                                </span>
                            }
                            style={{ width: 300, position: 'fixed', zIndex: 999 }}>
                            <p>Conetent</p>
                        </Card>}
                    </div>
                </Draggable>
                <span >{'Help'}</span><Icon onClick={() => this.onClickShow()} type="question-circle" />
            </div>
        );
    }

}

Springboot running shows application run failed [How to Solve]

Error:

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-06-28 14:27:13.827 ERROR 7512 --- [  restartedMain] o.s.boot.SpringApplication               : Application run failed

Background

It’s time to review. The teacher asked me to write a springboot project, but I couldn’t run it. Running application shows that application cannot be run
some errors were encountered in the process. I searched Baidu, and the result is as follows:
in the annotation of application, there is @ springbootapplication , which should be replaced by @ springbootapplication (exclude = datasourceautoconfiguration. Class) , but the result still doesn’t work.

Exclude to exclude such autoconfig, that is, to prohibit springboot from automatically injecting data source configuration. In this case, the automatic injection of mybits is excluded. As a result, there is a problem in the mapper layer.

Let the teacher have a look today. There is something wrong with the YML file.

Forget to write spring keywords, which I don’t understand.

server:
  port: 5050 # tomcat port
  servlet:
    context-path: /UserModel

spring:# I forgot to write it here, so that datesource belongs to the server
  datasource:
    type: com.alibaba.druid.pool.DruidDataSource
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://localhost:3306/1202?useSSL=false&serverTimezone=Asia/Shanghai&characterEncoding=utf-8
    username: root
    password: root

An error occurred while accessing the controller

The error reported is the same as this:

would dispatch back to the current handler URL [/UserModel/queryUserById] 

The difference between @Controller and @RestController is actually confusing
@Controller, @RestController?
Forgot the difference between get and post

Written by.
http://localhost:5050/UserModel/deleteUserByIds?ids=3,4

Error handling of apt instruction e: unmet dependencies. Try ‘apt — fix broken install’ with no packages in Ubuntu 20.04

Record the error handling of * * e: unmet dependencies. Try ‘apt — fix broken install’ with no packages and errors were accounted while processing and E: sub process/usr/bin/dpkg returned an error code (1) * *
only my process and solutions are recorded here.

Process

This error was reported when using apt and apt get packages today.

$ sudo apt install git
[sudo] password for wh: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 cypher-shell : Breaks: neo4j (< 3.1.4) but 2.1.5 is to be installed
 git : Depends: liberror-perl but it is not going to be installed
       Depends: git-man (> 1:2.17.1) but it is not going to be installed
       Depends: git-man (< 1:2.17.1-.) but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

Follow the prompts to run sudo apt -- fix broken install , and report an error. The echo is as follows:

YPreconfiguring packages ...
(Reading database ... 209743 files and directories currently installed.)
Preparing to unpack .../neo4j_1%3a3.5.14_all.deb ...
-----------------------------------------------------------------------------
It looks like you are upgrading from Neo4j 2.x. Many configuration
changes and improvements have been made in 3.0, including the location of
the databases. These changes cannot be handled automatically by this package
installation.

You will need to upgrade from Neo4j 2.x to Neo4j 3.2 and THEN to this release.
The upgrade guide for Neo4j 3.2 can be found at 
https://neo4j.com/docs/operations-manual/3.2/upgrade/
-----------------------------------------------------------------------------

dpkg: error processing archive /var/cache/apt/archives/neo4j_1%3a3.5.14_all.deb 
(--unpack):
 new neo4j package pre-installation script subprocess returned error exit status
 1
Errors were encountered while processing:
 /var/cache/apt/archives/neo4j_1%3a3.5.14_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Here I want to install neo4j_ 1%3a3.5.14_ All.deb, but I already have neo4j 2. X. I need to upgrade from neo4j 2. X to neo4j 3.2, and then to this version
the following error report also means to analyze neo4j_ 1%3a3.5.14_ Error in all.deb
(but I didn’t look at the above information carefully, so I only know that the following error report says my neo4j_ 1%3a3.5.14_ All.deb parsing error)

I’ve checked a lot of blogs here, but it doesn’t work for a long time
I followed the method in reference 1. Method 1 and method 2 are useless. I have achieved method 3
the process of trying method 3 is as follows:

$ sudo rm /var/cache/apt/archives/neo4j_1%3a3.5.14_all.deb 
$ sudo apt-get clean
$ sudo apt-get autoremove
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 cypher-shell : Breaks: neo4j (< 3.1.4) but 2.1.5 is installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

When you run sudo apt get autoremove , you will be prompted

The following packages have unmet dependencies:
 cypher-shell : Breaks: neo4j (< 3.1.4) but 2.1.5 is installed

At this time, I realized that there is a 2.1.5 version of neo4j in my system
if this step is not successful, the following instructions will not be executed successfully.

Here, I query the directory of neo4j version 2.1.5 through the where is command, and modify the corresponding directory name. It is reasonable to say that after the modification, the system cannot find neo4j2.1.5, sudo apt get autoremove should be able to execute successfully. But it didn’t.

In fact, it’s very simple here. We just need to uninstall neo4j in version 2.1.5. As follows:
perform sudo apt get remove neo4j uninstall
then follow method 3 in reference blog 1 to execute it again. The above error will not be reported in the process.

Then apt and apt get can be used normally.

reference resources

    Fix “Sub-process /usr/bin/dpkg returned an error code (1)” In Ubuntu

Qt development, using ODBC interface, query mysql, appear qsqlquery:: Value: not positioned on a valid record

Qt development, using ODBC interface, query mysql, appear qsqlquery:: Value: not positioned on a valid record

Question: in the library management system developed by QT craetor integrated development environment, the newly created database class is used to operate the database. It inherits from QObject and uses the interface provided by ODBC to connect with the database. The database is mysql5.7, When using the following query statement, we report an error:

error information: qsqlquery:: Value: not positioned on a valid record

we query the relevant information:
the solutions we have found
try according to the solutions provided in the article, the problems still exist.

Later, some information was printed in various locations, and it was found that qdebug & lt& lt; condition<& lt; content<& lt;“ The variables condition and content in “on” can be printed normally, but “on” printed out is “?”
when I thought of creating a window before, the window title set in Chinese would be garbled. The solution I found at that time was to add the following code to the. Cpp file of the corresponding class:
?Pragma execution_ character_ set("utf-8")

Solution:
add the code block as shown above to the database.cpp file:

edit test information:

test output successful:

end! Scatter flowers! Record it!

Refused to apply style from <URL> because its MIME type (‘text/html‘) is not a supported stylesheet

Example: insert lb.html into index.html, and lb.html has a lb.css.

Problem: at this time, index.html may report an error: refuse to apply styles from lb.css. But it’s all normal. No problem.

Attempt failed: Online modifications…/modifications, etc. are invalid here. If we start with index.html and introduce the address of lb.css into lb.html, index.html will not report an error, but lb.html will report an error and so on.

Current method: put lb.css and index.css in the same CSS folder and reference them normally. Index.html and lb.html will not report errors.