[Solved] RSA encryption request error: javax.crypto.badpaddingexception: decryption error

📖 Abstract


Share today — RSA encryption request error: javax. Crypto. Badpaddingexception: decryption error , welcome to pay attention!

Read related articles: spring boot + security based on the separation of the front and back RSA password encryption login process


🌂 resolvent

In the login method, the space can be replaced by a + sign, just ask if you want to be coquettish

String inputDecryptData = "";
        try {
            Object privateKey = redisUtil.get(Constant.RSA_PRIVATE_KEY);

            inputDecryptData =  RSAUtils.decrypt(password.replaceAll(" ","+"), RSAUtils.getPrivateKey(privateKey.toString()));
        } catch (Exception e) {
            log.error("RSA encryption and decryption exceptions occurred ======>", e);
            throw new BizException("RSA encryption and decryption exception occurred");
        }

Finally, thank you for watching patiently, leaving a like collection is your greatest encouragement to me!

Solve git upload file error [rejected] master -> master (fetch first) error: failed to push some refs to ‘

When push is executed, an error will be reported. The error code is as follows:

$ git push -u origin master
To gitee.com:backspacegit/aafdajs.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'gitee.com:backspacegit/aafdajs.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

This problem occurs because the readme.md file in GitHub is not in the local code directory. You can merge the code with the following command

git pull --rebase origin master

Then execute the statement

git push -u origin master

Done!

To customize the aggregate function of Flink (Step-by-Step Tutorial)

In Flink computing, some common operations are map or flatmap. After some data, keyby opens a window to calculate. So what are the operators in these calculations?

There are two types of operators.

Incremental aggregation includes reduce and aggregate operators, and total aggregation includes apply and process operators. So today we will mainly explain the commonly used incremental aggregation operator, aggregate operator
three types of aggregate method signature & lt; Data source type, accumulator type, output type & gt
the four types of window function method signature are < IN, OUT, KEY, W extends Window>

Step 1: convert datastream to windowedstream


        // Reading data from kafka
        val inputStream = env.addSource(new FlinkKafkaConsumer[String]("hotitems", new SimpleStringSchema(), properties))
            .map(data => {
                val dataArray = data.split(",")
                UserBehavior(dataArray(0).toLong, dataArray(1).toLong, dataArray(2).toInt, dataArray(3), dataArray(4).toLong)
            })
            .assignAscendingTimestamps(_.timestamp * 1000L)
        
        // Performing window aggregation on data
        val aggStream: DataStream[ItemViewCount] = inputStream
            .filter(_.behavior == "pv") // filter out the pv data
            .keyBy(_.itemId)
            .timeWindow(Time.hours(1), Time.minutes(5)) // open window for statistics
            .aggregate(new CountAgg(), new WindowCountResult()) // Aggregate the count of the current item in the time window

Step 2: user defined aggregate function

// A custom pre-aggregation function that adds one to the data
class CountAgg() extends AggregateFunction[UserBehavior, Long, Long] {
    // The add method is an accumulator method, here is the simplest +1 operation
    override def add(value: UserBehavior, accumulator: Long): Long = accumulator + 1
    //initialize the accumulator value
    override def createAccumulator(): Long = 0L
    // finally return the value, here is the accumulator
    override def getResult(accumulator: Long): Long = accumulator
    // partition processing of the summation operation, here all the results of the summation process are added together
    override def merge(a: Long, b: Long): Long = a + b
}

Part 3: custom window function

// Custom window function
class WindowCountResult() extends WindowFunction[Long, ItemViewCount, Long, TimeWindow] {
    //Long type Key is the return value of the custom accumulator in the previous step
    //Window is the difference to your button type, no window type in the first step, TimeWindow
    //input is the type of data received, in this case the Long type iterator
    //out is the type returned by this method, here is the set of ItemViewCount sample class objects
    override def apply(key: Long, window: TimeWindow, input: Iterable[Long], out: Collector[ItemViewCount]): Unit = {
        // Call the constructor of the ItemViewCount sample class object to construct the ItemViewCount sample class in turn and return
        out.collect(ItemViewCount(key, window.getEnd, input.iterator.next()))
    }
}

Solution of Vue router loading components on demand

Now you can see the official website to explain how to load components on demand as follows:

// The combination of vue asynchronous components and webpack's [code chunking point] feature enables on-demand loading
const App = () => import('../component/Login.vue');

We usually report this error when using it:

Module build failed: SyntaxError: Unexpected token

It can be found that Import reported an error because Babel couldn’t resolve the error and needed to download the plug-in

cnpm install babel-plugin-syntax-dynamic-import --save-dev

Modify . Babelrc after downloading

{
  "presets": [
    ["env", { "modules": false }],
    "stage-3"
  ],
  "plugins": ["syntax-dynamic-import"]
}

In this way, it can be introduced on demand

[Solved] MYSQLD: Can‘t create directory ‘/usr/local/mysql/data/’(Errcode:2 -No such file or directory)

Detailed error information of MySQL version 5.7.31 startup

MySQL version   Mysql-5.7.31 initialization error information is shown in the figure below

The configuration file is correct   There’s no problem with the permissions of my.cnf configuration file. How can the default initialization still go to the/usr/local/MySQL directory

A complete solution   Specify basedir and dataDir again during initialization

mysqld –initialize –console –basedir=/usr/local/develop/mysql-5.7.31 –datadir=/usr/local/develop/mysql-5.7.31/data

So far, the problem has been solved   Successfully initialized

I’m sending you a question   But there will be problems when starting, as shown in the figure

This is a very special problem
A complete solution

./mysqld –user=root –basedir=/usr/local/develop/mysql-5.7.31 –datadir=/usr/local/develop/mysql-5.7.31/data

Be careful not to add start after the start command   Otherwise, it will prompt another error
As shown in the picture

After the start command is executed successfully, check whether MySQL exists

ps -ef |grep mysql

end

CentOS 7 composer install error: phpunit/phpunit 4.8.35 requires ext-dom *

Problem:
[[email protected] laravel_demo]# composer install Loading composer repositories with package information

Installing dependencies (including require-dev) from lock file

Your requirements could not be resolved to an installable set of packages.

Problem 1

– phpunit/phpunit 4.8.35 requires ext-dom * -> the requested PHP extension dom is missing from your system.

– phpunit/phpunit 4.8.35 requires ext-dom * -> the requested PHP extension dom is missing from your system.

– Installation request for phpunit/phpunit 4.8.35 -> satisfiable by phpunit/phpunit[4.8.35].

To enable extensions, verify that they are enabled in your .ini files:

– /etc/php.ini

– /etc/php.d/bz2.ini

– /etc/php.d/calendar.ini

– /etc/php.d/ctype.ini

– /etc/php.d/curl.ini

– /etc/php.d/exif.ini

– /etc/php.d/fileinfo.ini

– /etc/php.d/ftp.ini

– /etc/php.d/gd.ini

– /etc/php.d/gettext.ini

– /etc/php.d/gmp.ini

– /etc/php.d/iconv.ini

– /etc/php.d/json.ini

– /etc/php.d/ldap.ini

– /etc/php.d/mbstring.ini

– /etc/php.d/mcrypt.ini

– /etc/php.d/mysqli.ini

– /etc/php.d/pdo.ini

– /etc/php.d/pdo_mysql.ini

– /etc/php.d/pdo_sqlite.ini

– /etc/php.d/phar.ini

– /etc/php.d/shmop.ini

– /etc/php.d/simplexml.ini

– /etc/php.d/sockets.ini

– /etc/php.d/sqlite3.ini

– /etc/php.d/tokenizer.ini

– /etc/php.d/xml.ini

– /etc/php.d/zip.ini

You can also run `php –ini` inside terminal to see which files are used by PHP in CLI mode.

Solution:
[[email protected] ~]# yum search php70w    Check the packages available for installation
[[email protected] ~]# yum -y install php70w-xml.x86_64
[[email protected] ~]# systemctl restart httpd.service restart apache
Test:
[[email protected] ~]# systemctl restart httpd.service
[[email protected] ~]# cd /home/www/laravel_demo/
[[email protected] laravel_demo]# composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 0 installs, 2 updates, 0 removals
– Updating symfony/event-dispatcher (v3.2.4 => v3.2.3): Downloading (100%)
– Updating symfony/yaml (v3.2.4 => v3.2.3): Downloading (100%)
Generating autoload files
> Illuminate\Foundation\ComposerScripts::postInstall
> php artisan optimize
Generating optimized class loader

In the laravel project of GitHub clone, whoops, looks like something went wrong

When configuring laravel project:

First of all, there is no vendor directory for the clone project from GitHub,

Run composer install to get composer dependencies from composer.json

Error running project:

1.Whoops, looks like something went wrong.

Create a new. Env file, refer to. Env. Example

Modification: app_ DEBUG=true

2.APP_ The value of key

No supported encrypter found. The cipher and/or key length are invalid.

Run in the project directory to get the new app_ KEY:

php artisan key:generate



OK !

Re installing Android studio always fails to install SDK when installing software (solution)

**

Android studio cannot install the SDK when the software is installed

**
I don’t know what’s going on. Android’s AVD can’t be started. It’s stuck in the loading place all the time, indicating that it can’t respond. No matter it’s forced to shut down AVD or recreate one, it can’t be solved, so I decided to reload Android studio. However, when I uninstall Android and delete all the files and then install Android studio again, it always shows that the SDK has been installed and the project cannot be started because there is no SDK. As shown in the figure

finally, with the help of the teacher, I can use the new Android studio again!! Tearful eyes
specific operation:

    uninstall the current Android studio and delete the SDK, gradle, AVD and other folders in the installation directory. Find the. Android studioxxxx and. Gradle folder in the computer user directory, and then delete them. Go to the hidden appdata folder, go to the roaming folder, and then go to the Google folder to delete Android studio XXX. Everyone’s catalog may be different. The last and most important step: restart the computer( I just didn’t restart, so every time I reload, I will display SDK installed Installing Android studio is the same as installing it for the first time. Ha ha

After Android studio creates a new bottomnavigationactivity, there is a blank solution in the upper area of fragment

Problem description

For example, the screenshot is as follows, which is often empty above and incomplete below (recyclerview list) (blocked by the navigation bar at the bottom)

Problem solving ideas

After switching to another fragment, it is found that it is also lower than the whole, so it should be the whole setting problem, so the problem is located to activity_ Main.xml or mobile_ In navigation. XML, which is used to specify the newly created fragment, it turns out to be an activity_ Main.xml specifies mobile_ There’s a problem with navigation’s fragment.

Problem solving

At activity_ In main.xml

    deleting the paddingtop attribute of the outermost constraintlayout will @ + ID/NAV_ host_ Layout of fragment_ Height is set to 0dp

    result


The solution of eclipse code automatic prompt function

Eclipse IDE for Java developers version: 2019-03 (4.11.0), there is no automatic prompt function, that is, when an object can’t point out its related methods. Later, I searched the Internet, and the summary method is.

1. My window – & gt; Preferences-> Java-> Editor-> content assist  
put   Enable auto activation   Check the options: (as shown in the figure below)

And add. Abcdefghijklmnopqrstuvwxyz after the point

At this point, the restart of eclipse is not successful, and then the second step

 
 
2. Tick the bucket that should be checked

My own eclipse was successful without a restart.

To sum up, the role of the first step is that when you enter a letter, eclipse will immediately associate the relevant words and display them, and those associated words will always follow. If you feel bored, change to the default dot. The second step is the key, the role is when you use Alt +/shortcut key will associate.

Image input data check: Nan inf and do not exist

import os
import cv2
import numpy as np
from tqdm import tqdm

# read txt file content to list
def ReadTxt_to_list(rootdir):
    lines = []
    with open(rootdir, 'r') as file_to_read:
        while True:
            line = file_to_read.readline()
            if not line:
                break
            line = line.rstrip('\n')
            lines.append(line)
    return lines

def check_exist_nan(lstFile):
    rt = os.path.split(lstFile)[0]
    notExist = open(os.path.join(rt,'Lst_notExist.txt'),'w')
    bad = open(os.path.join(rt,'Lst_bad.txt'),'w')

    lines = ReadTxt_to_list(lstFile)
    notNum = 0
    badNum = 0
    newLines = []
    for line in tqdm(lines):
        info_ = line.split('\t')
        assert len(info_) == 3
        _, filePth, idNum = info_
        if not os.path.exists(filePth):
            print('Not exist:', line)
            notExist.write(line+'\n')
            notNum += 1
        else:
            img = cv2.imread(filePth)
            try:
                if np.any(np.isnan(img)) or not np.all(np.isfinite(img)):
                    print('Nan/Inf:', line)
                    badNum += 1
                    bad.write(line + '\n')
                else:
                    newLines.append(line)
            except:
                print('Error:', line)
                badNum += 1
                bad.write(line + '\terror\n')

    print('Not exist', notNum)
    print('Bad', badNum)
    if len(lines) != len(newLines):
        newLst = open(os.path.join(rt,'Lst_new.txt'), 'w')
        for line in newLines:
            newLst.write(line+'\n')
        newLst.close()

    notExist.close()
    bad.close()

if __name__ == '__main__':
    imgLst = '/home/img.lst'
    check_exist_nan(imgLst)