Author Archives: Robins

Node connects to MySQL error “Er”_ NOT_ SUPPORTED_ AUTH_ Mode “solution

Perform the following query in MYSQL Workbench
ALTER USER ‘root’ @’ localhost ‘IDENTIFIED WITH mysql_native_password BY’ password ‘
when root is USER localhost of your url, and password is your password
, then run the following query to flush privileges:
flush privileges;
try using node connections after completion.
if that doesn’t work, try @’ localhost ‘

Use of HQL query.list () is a null pointer exception, but the database can find out the result

HQL uses query.List () as a null pointer exception, but the database can detect the result
Solutions:
Check that the database dialect is configured correctly in hibernate configuration
org.hibernate.dialect.OracleDialect

<property name="hibernateProperties">
	<props>
		<prop key="hibernate.dialect">org.hibernate.dialect.OracleDialect</prop>
		<prop key="hibernate.show_sql">true</prop>
		<prop key="dynamic-update">true</prop>
		<prop key="hibernate.jdbc.batch_size">0</prop>
	</props>
</property>

Give common database dialects

RDBMS

dialect

DB2

org. Hibernate. The dialect. DB2Dialect

DB2 AS/400 org.hibernate.dialect.DB2400Dialect
DB2 OS390 org.hibernate.dialect.DB2390Dialect
PostgreSQL org.hibernate.dialect.PostgreSQLDialect
MySQL org.hibernate.dialect.MySQLDialect
MySQL with InnoDB org.hibernate.dialect.MySQLInnoDBDialect
MySQL with MyISAM org.hibernate.dialect.MySQLMyISAMDialect
Oracle (any version) org.hibernate.dialect.OracleDialect
Oracle 9i/10g org.hibernate.dialect.Oracle9Dialect
Sybase org.hibernate.dialect.SybaseDialect
Sybase Anywhere org.hibernate.dialect.SybaseAnywhereDialect
Microsoft SQL Server org.hibernate.dialect.SQLServerDialect
SAP DB org.hibernate.dialect.SAPDBDialect
Informix org.hibernate.dialect.InformixDialect
HypersonicSQL org.hibernate.dialect.HSQLDialect
Ingres org.hibernate.dialect.IngresDialect
Progress org.hibernate.dialect.ProgressDialect
Mckoi SQL org.hibernate.dialect.MckoiDialect
Interbase org.hibernate.dialect.InterbaseDialect
Pointbase org.hibernate.dialect.PointbaseDialect
FrontBase org.hibernate.dialect.FrontbaseDialect
Firebird org.hibernate.dialect.FirebirdDialect

Solving the problem of Chinese garbled code in qtring

Qt solves the problem of Chinese gibberish

qt generally set in the designer interface Chinese title what can be displayed normally.

but in QString, for example, when QPainter is painting Text, if the char* passed in contains Chinese, it will usually show a garbled code. At this time, two places need to be set:

    in main. CPP set QTextCodecQString using static method fromLocal8Bit(char*)
    for the first place, set in main. CPP as follows:
#include "MainWindow.h"

#include <QApplication>
#include <QTextCodec>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    QTextCodec* codec = QTextCodec::codecForName("GB2312");
    QTextCodec::setCodecForLocale(codec);
    MainWindow w;
    w.show();
    return a.exec();
}

For the second place, use the following method in a char* containing Chinese characters:

QString::fromLocal8Bit(char*)

Where you want to pass in a QString, if Chinese is included, you need to do the above two Settings.

If the iframe in IE refers to the cross domain site page, the session fails

Problem scenario:

Personal confidence page through the IFrame nested third party page, domain name is different, call the third party interface, in Chrome test normal, in Internet Explorer is embedded in the page Session invalidation. (Session is based on cookie implementation, reference page is not allowed to use cookie)

Problem analysis:

The IE-supported P3P(Platform for Privacy Preferences Project (P3P) Specification) protocol by default prevents third party cookies without Privacy security claims, and Firefox does not currently support P3P security features, nor does it naturally exist in Firefox.

Solutions:

1. Modify the setting of the Client
so that the Client can accept cookies from any website (specifically set in the privacy page of IE option to add B site to the trusted site)
or set both domains to the trusted site

2. The domain of the application modifies the
simple scheme: two applications use the same domain
Complex solution: you can force changes to

through setdomain in pages loaded by the iframe. 3. P3P
first: output the host header declaration of P3P in the content to be embedded (the site the iframe points to) as follows:
Open IIS Manager InetMgr to be embedded in the iFrame source site or directory, right-click to open the Properties box and toggle to HTTP headers Add custom HTTP headers P3P Custom HTTP headers CP=”CAO PSA OUR” Close the properties box and exit, effective immediately
Response.addheader (“P3P”,”CP=CAO PSA OUR”);

Transfer: https://www.cnblogs.com/weibozeng/archive/2013/11/06/3410904.html

Running error of dbeaver installed by deepin

After installing DBeaver, double-click the DBeaver icon to launch an error:
A Java Runtime Environment or Java Development Kit(dkmust be available in order to run eclipse. no java virtual machinewas found after searching the following locations:……
To the/usr/share/dbeaver/dbeaver ini
add JDK path
 
in
-vmargs
-Xms64m
-Xmx1024m
Before the increase

/home/vm gusen huanjin/jdk1.8.0 _111/bin
 

Python failed to read TIF file exported by envi.

Python failed to read files saved directly as TIF or TIF in ENVI.
error is reported as follows:

Traceback (most recent call last):
  File "/data/wdh/.conda/envs/AI_studywdh/lib/python3.6/site-packages/tifffile/tifffile.py", line 2296, in __init__
    byteorder = {b'II': '<', b'MM': '>', b'EP': '<'}[header[:2]]
KeyError: b'\x00\x00'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "beijing_landsat.py", line 19, in <module>
    band1 = imageio.imread(path+img_path[:-1]+'1.tif')
  File "/data/wdh/.conda/envs/AI_studywdh/lib/python3.6/site-packages/imageio/core/functions.py", line 265, in imread
    reader = read(uri, format, "i", **kwargs)
  File "/data/wdh/.conda/envs/AI_studywdh/lib/python3.6/site-packages/imageio/core/functions.py", line 186, in get_reader
    return format.get_reader(request)
  File "/data/wdh/.conda/envs/AI_studywdh/lib/python3.6/site-packages/imageio/core/format.py", line 170, in get_reader
    return self.Reader(self, request)
  File "/data/wdh/.conda/envs/AI_studywdh/lib/python3.6/site-packages/imageio/core/format.py", line 221, in __init__
    self._open(**self.request.kwargs.copy())
  File "/data/wdh/.conda/envs/AI_studywdh/lib/python3.6/site-packages/imageio/plugins/tifffile.py", line 226, in _open
    self._tf = _tifffile.TiffFile(f, **kwargs)
  File "/data/wdh/.conda/envs/AI_studywdh/lib/python3.6/site-packages/tifffile/tifffile.py", line 2298, in __init__
    raise TiffFileError('not a TIFF file')
tifffile.tifffile.TiffFileError: not a TIFF file

Solution:
please use save as option
file — > save as

Cannot find module ‘webpack cli / bin / config yargs‘

Webpack dev – server issue official link:
https://github.com/webpack/webpack-dev-server/issues/2759

webpack-dev-server update version, the command line changed from
webpack dev serve to webpack serve
, so the package.json needs to be changed to:

"scripts": {
    "dev": "webpack serve --mode development"
  }

See the dead simple Readme:
https://github.com/webpack/webpack-dev-server

How to Fix Error Caused by: java.util.MissingResourceException: Can‘t find bundle for base name xxx, locale zh_CN

Error reading propertied configuration file appears as follows:
may have a problem:

    uses resourcebundle.getbundle () with a file suffix, such as resourcebundle.getbundle (” jedis.properties “). The path to the.properties configuration file is incorrect.

How to Fix this error:

    drop the suffix, such as resourcebund.getbundle (” jedis “). The JavaSE project configuration files (such as Jedis.properties) need to be placed in the SRC directory, and the JavaWeb project needs to be placed in the Resource directory.

Vue: How to Fix “not displaying the holder in IE9 and below”

For.html projects, add placeholder.js after introducing jquery to the page you need
Since I’m a vue+elementUI project, I don’t refresh the browser every time I switch menus, so I’ve cleaned up the usage in vUE
Jquery file also needs to be introduced here, otherwise the error may be reported. Just introduce jquery in index.html

Here’s how to use it in a Vue
First create placeholder.js file in the public JS file and output a PlaceholderInit function

//Solve the problem that the placeholder of input is not displayed under ie.

export function PlaceholderInit() {
  return jQuery(function() {
    var placeholderfriend = {
      focus: function(s) {
        s = $(s)
          .hide()
          .prev()
          .show()
          .focus();
        var idValue = s.attr("id");
        if (idValue) {
          s.attr("id", idValue.replace("placeholderfriend", ""));
        }
        var clsValue = s.attr("class");
        if (clsValue) {
          s.attr("class", clsValue.replace("placeholderfriend", ""));
        }
      }
    };

    //Determine if placeholder support is available.
    function isPlaceholer() {
      var input = document.createElement("input");
      return "placeholder" in input;
    }
    //Unsupported Codes
    if (!isPlaceholer()) {
      $(function() {
        var form = $(this);
        var elements = form.find("input[type='text'][placeholder]");
        elements.each(function() {
          var s = $(this);
          var pValue = s.attr("placeholder");
          var sValue = s.val();
          if (pValue) {
            if (sValue == "") {
              s.val(pValue);
            }
          }
        });

        elements.focus(function() {
          var s = $(this);
          var pValue = s.attr("placeholder");
          var sValue = s.val();
          if (sValue && pValue) {
            if (sValue == pValue) {
              s.val("");
            }
          }
        });

        elements.blur(function() {
          var s = $(this);
          var pValue = s.attr("placeholder");
          var sValue = s.val();
          if (!sValue) {
            s.val(pValue);
          }
        });

        var elementsPass = form.find("input[type='password'][placeholder]");
        elementsPass.each(function(i) {
          var s = $(this);
          var pValue = s.attr("placeholder");
          var sValue = s.val();
          if (pValue) {
            if (sValue == "") {
              var html = this.outerHTML || "";
              html = html
                .replace(
                  /\s*type=(['"])?password\1/gi,
                  " type=text placeholderfriend"
                )
                .replace(/\s*(?:value|on1[a-z]+|name)(=(['"])?\S*\1)?/gi, " ")
                .replace(
                  /\s*placeholderfriend/,
                  " placeholderfriend value='" +
                    pValue +
                    "' " +
                    "οnfοcus='placeholderfriendfocus(this);' "
                );
              var idValue = s.attr("id");
              if (idValue) {
                s.attr("id", idValue + "placeholderfriend");
              }
              var clsValue = s.attr("class");
              if (clsValue) {
                s.attr("class", clsValue + "placeholderfriend");
              }
              s.hide();
              s.after(html);
            }
          }
        });

        elementsPass.blur(function() {
          var s = $(this);
          var sValue = s.val();
          if (sValue == "") {
            var idValue = s.attr("id");
            if (idValue) {
              s.attr("id", idValue + "placeholderfriend");
            }
            var clsValue = s.attr("class");
            if (clsValue) {
              s.attr("class", clsValue + "placeholderfriend");
            }
            s.hide()
              .next()
              .show();
          }
        });
      });
    }
    window.placeholderfriendfocus = placeholderfriend.focus;
  });
}

Deconstruct PlaceholderInit function
on pages that need to display placeholders

import { PlaceholderInit } from '@/utils/placeholder'

Call this function before the page is displayed, so that the place where the current page needs to display placeholders will display
when the page comes in

PlaceholderInit();

If the input page of a new pop-up box needs to display placeholders, the function

will also be called when the new pop-up box is opened

Perl application – delete “. SVN” folder in current directory and subdirectory

Use the File::Find module
The File::Find module in Perl is used for searching and finding files. Can be used to search for filenames across the file system, using regex to match filenames and looping through any directory structure.
Two methods of the File::Find module
The find method traverses from top to bottom.
The findDepth method iterates from the bottom up.

Function Prototypes
 use File::Find;
 find(\&wanted, @directories_to_search);
 sub wanted { ... }

where the first argument wanted is a subfunction, a callback function, which you define yourself.
This parameter must be there, even if its content is empty. The second argument is a list of directories, which can also be
is a common string scalar for directory names. Note that the &wanted subroutine needs to be preceded by a backslash escape. 

both call in the same format, such as finddepth(\& Del_svn, “.”) , the first argument is the called subfunction, the second argument is the directory, “.”) , the first argument is the called subfunction, the second argument is the directory, “.” represents the current directory. represents the current directory.

#!/usr/bin/perl /usr/bin/perl -w
#Function: The script deletes all .svn files from the current directory and its subdirectories.
# Use: command line type: perl delete_svn.pl
# Save the following code in the file named delete_svn.pl
use strict;
use File::Find;

sub del_svn {
    if ($_ eq ".svn") {
       system("rm -rf $_");
    }
}

finddepth(\&del_svn, ".");
print "finished.\n";

The system function is used to invoke the system command, and RM-RF is used to delete the command under Linux

If the request parameter is formdata, use the Ajax operation

If the request parameter supplied when requesting the interface is of type FormData, we can divide the operation into two ways.
The method in FormData()
0, append() append value
1, set() modify value
2, getAll() get all check box values
3, get() get radio box values
1. Ajax encapsulated by jQuery
If the request parameter is formdata, must set two configuration items
processData: false
contentType: false

  $.ajax({
            url: 'Interface Address',
            type: "POST",
            data: fd,
            success: function(res){

            },
            processData: false, //do not convert data request data (the object format is automatically converted to string format on request)
            contentType: false // do not set request header (FormData comes with request header)
        })

2. Native Ajax manipulation
If the request parameter is FormData, then post-style Ajax requests no longer need to set the request header


FormData:
	var form = $("form")[0];	//Converting jq objects to DOM objects (must be DOM objects)
	var fd = new FormData(form);
	
	
Native ajax:
 		var xhr = new XMLHttpRequest();
        xhr.open('POST', '/common/post'). xhr.onload = function () { var xhr.open('POST', '/common/post');
        xhr.open('POST', '/common/post'); xhr.onload = function () {
            console.log(this.response); // output the result
        }
        xhr.send(fd); //pass the data from the form to the backend