Author Archives: Robins

How to Solve MYSQL Error: No module named MySQLdb

How to Solve MYSQL Error: No module named MySQLdb?

Solution

easy_install mysql-python (mix os)
pip install mysql-python (mix os/ python 2)
pip install mysqlclient (mix os/ python 3)
apt-get install python-mysqldb (Linux Ubuntu, ...)
cd /usr/ports/databases/py-MySQLdb && make install clean (FreeBSD)
yum install MySQL-python (Linux Fedora, CentOS ...)

[Solved] pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available

How to Solve this error?

Solution:

brew update && brew upgrade
brew uninstall --ignore-dependencies openssl; brew install https://github.com/tebelorg/Tump/releases/download/v1.0.0/openssl.rb

Caused by: com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 281; The content of element type “sqlMapConfig” is incomplete

It can be clearly seen from the error message that this is a problem on sql

Well, in general, there are many reasons for this problem:

1. Maybe the code call method in your service is wrong (this is the lowest level error, and it is not easy to find…), directly above

Originally it was written as MMIC01.delete, which was my careless (no flash, haha)

 

2. It is also possible that one of your SQL statements is wrong (this is easier to find)

 

Compared with the previous question, this error is already executing the SQL statement, so you can put the executed SQL statement in the tool and run it, and you will know where the problem is.

[Go] Provide http service with two requests and process favicon.ico

When the http package is used, the mode processing of /this root path is registered, and the browser will automatically request favicon.ico. Be careful to handle it, otherwise there will be two requests

func main() {
    log.Println( " listen on 8080...\r\ nAccess : http://127.0.0.1:8080 " )
     // root path 
    http.HandleFunc( " / " , index)
        http.ListenAndServe( " :8080 " , nil)
}

// Home page jump 
func index(w http.ResponseWriter, r * http.Request) {
     if r.URL.RequestURI() == " /favicon.ico " {
         return
    }
}    

[PHP] Array to string conversion error when sending data in post

When using curl to pass post data, if the data field is an array, an error will be reported Array to string conversion

When calling curl_setopt_array($curl, $options);

Call curl_setopt($ch, CURLOPT_POSTFIELDS, $data)

Errors may be reported in these two places, the solution is to process the data array

http_build_query($data)

How to Solve PHP Error: no package’oniguruma’ found

When compiling and installing php, if –enable-mbstring, the mbstring extension is enabled, this regular processing library is required

 

centos

yum install http: // rpms.remirepo.net/enterprise/7/remi/x86_64 // oniguruma5-6.9.4-1.el7.remi.x86_64.rpm 
yum install http: // rpms.remirepo.net/enterprise/ 7/remi/x86_64 // oniguruma5-devel-6.9.4-1.el7.remi.x86_64.rpm

ubuntu

apt install libonig-dev

[PHP] php8 jit does not support 32-bit systems WARNING: JIT not supported by host architecture

The jit of php8 needs to be manually turned on when compiling the opcache extension

For example, my php8 source code directory is here:

/home/ubuntu/myphp/php-8.0.0alpha1/ext/opcache

carried out

./configure –enable-opcache-jit –with-php-config=/usr/local/php8/bin/php-config

There will be a warning

WARNING: JIT not supported by host architecture

 

View configuer script

 

 x86_64 only works, the others will be detected but

[GO]Solve request origin not allowed by Upgrader.CheckOrigin websocket cross-domain

Using websocket under the gin framework, this error will be reported if it is a cross-domain request

request origin not allowed by Upgrader.CheckOrigin

 

The websocket library used is “github.com/gorilla/websocket”

Need to add the following code:

    upgrader = websocket.Upgrader{
        ReadBufferSize:   1024 ,
        WriteBufferSize: 1024 ,
         // Resolve cross-domain problems 
        CheckOrigin: func(r *http.Request) bool {
             return  true
        },
    }