问:
Blur background image in bootstrap modal
I am building a simple blog app and I have implemented the bootstrap modal in my react app and I am trying to add background image to the modal and blur it a little But when I add filter: blur(10)px in inline style in react then content, form in modal and text is also blurring in modal.

But I am just trying to blur the background image only not the modal form or content.

App.js

```<code>function App() {
    const [modalShow, setModalShow] = useState(false);

    return(
    <>
       <b onClick={() => setModalShow(true)}>Open modal</b>

        <Modal show={modalShow} size="lg">

        <Modal.Body
          style={{
          backgroundImage:  "url(" + "https://cdn.techinasia.com/wp-content/uploads/2011/09/Doodle4Google-2010-Group-1-Winner.jpg" + ")",
          backgroundPosition: 'center',
          backgroundSize: 'cover',
          backgroundRepeat: 'no-repeat',
          filter : "blur(10px)"
          }}
        >

         <form>
           <input type="text" />

           <input type="text" />

           {/* ...other data */}
         <form/>

         <b onClick={onClick={() => setModalShow(false)}}>Close modal</b>

         <Modal.Body/>
        <Modal/>
    </>
    )
}
</code>```

When I open the modal then content, form and text are also showing blur effect with image. But I want blur effect in image only.

You can see live demo codesandbox Here.

Any help would be much Appreciated. Thank You.

Body:
I am building a simple blog app and I have implemented the bootstrap modal in my react app and I am trying to add background image to the modal and blur it a little But when I add filter: blur(10)px in inline style in react then content, form in modal and text is also blurring in modal.

But I am just trying to blur the background image only not the modal form or content.

App.js

function App() {
    const [modalShow, setModalShow] = useState(false);

    return(
    <>
        setModalShow(true)}>Open modal

        <Modal show={modalShow} size="lg">

        <Modal.Body
          style={{
          backgroundImage:  "url(" + "https://cdn.techinasia.com/wp-content/uploads/2011/09/Doodle4Google-2010-Group-1-Winner.jpg" + ")",
          backgroundPosition: 'center',
          backgroundSize: 'cover',
          backgroundRepeat: 'no-repeat',
          filter : "blur(10px)"
          }}
        >

         <form>
           <input type="text" />

           <input type="text" />

           {/* ...other data */}
         <form/>

          setModalShow(false)}}>Close modal

         <Modal.Body/>
        <Modal/>
    </>
    )
}

When I open the modal then content, form and text are also showing blur effect with image. But I want blur effect in image only.

You can see live demo codesandbox Here.

Any help would be much Appreciated. Thank You.


来源: stackexchange

问:
PayPal Sandbox notify_url not called ngrok/domain
Sandbox stopped working since 04.12,2022.

stopped when using ngrok link like that: https://650e-86-104-141-246.eu.ngrok.io/

stopped when using HTTPS://** (private domain with Cloudflare flexible SSL)

I'm not getting any callback from PayPal sandbox even if I'm using IPN.
https://**/checks/verify-paypal.php

part of my code

```<code>$return_url = $site_url."index.php";
$cancel_url = $site_url."index.php";
$notify_url = $site_url."checks/verify-paypal.php";
</code>```
```<code>if($paypal_mode == null){
  $url = 'https://www.paypal.com/cgi-bin/webscr'.$querystring;
}else{
$url = 'https://www.sandbox.paypal.com/cgi-bin/webscr'.$querystring;
}
</code>```

I tried:

Added new email address (confirmed).

Changed $notify_url = $site_url."checks/verify-paypal.php"; to $notify_url = "https://**.com/checks/verify-paypal.php";

Added IPN, no IPN history. (only on the developer, in notifications)

*I have no errors in PHP

ContentLicense: CC BY-SA 4.0

Body:
Sandbox stopped working since 04.12,2022.

stopped when using ngrok link like that: https://650e-86-104-141-246.eu.ngrok.io/

stopped when using HTTPS://** (private domain with Cloudflare flexible SSL)

I'm not getting any callback from PayPal sandbox even if I'm using IPN.
https://**/checks/verify-paypal.php

part of my code

$return_url = $site_url."index.php";
$cancel_url = $site_url."index.php";
$notify_url = $site_url."checks/verify-paypal.php";

if($paypal_mode == null){
  $url = 'https://www.paypal.com/cgi-bin/webscr'.$querystring;
}else{
$url = 'https://www.sandbox.paypal.com/cgi-bin/webscr'.$querystring;
}

I tried:

Added new email address (confirmed).

Changed $notify_url = $site_url."checks/verify-paypal.php"; to $notify_url = "https://**.com/checks/verify-paypal.php";

Added IPN, no IPN history. (only on the developer, in notifications)

*I have no errors in PHP


问:
Is it possible to use ts-morph in eslint?
I want to use ts-morph in eslint.

I ask that because I see when I create a plugin for eslint, eslint runs through all my files in my project each time. I mean when I have a Program selector then it invokes many times per my files.

So when I want to use ts-morph it just happens once. load the project and I have many functions and type-checking through all my project files.

Is it possible to pass the ts-morph project object to all eslint plugins? so I can have the project variable in my eslint function?


问:
Python Convert JSON payload to string
Apologies if the question is basic. I am working on to convert json payload to pure string for signature purpose to make API POST
request.

I have define the json payload below:

```<code>def create_dca_trading_bot(bot_type, instrument_name, first_investment_time, investment_frequency_mode,
                           investment_frequency, investment_monthly_frequency, investment_currency,
                           max_no, total_investment, investment_duration, display_name, side, order_type, price,
                           quantity, stop_price,
                           take_profit_price, uuid, api_key, secret_key):

    method = 'private/create-trading-bot'

    payload = {
        "id": 1,
        "method": method,
        "params": {
            "bot_type": bot_type,
            "settings": {
                "instrument_name": str(instrument_name),
                "first_investment_time": str(first_investment_time),
                "investment_frequency_mode": str(investment_frequency_mode),
                "investment_frequency": str(investment_frequency),
                "investment_monthly_frequency": investment_monthly_frequency,
                "investment_currency": investment_currency,
                "side": str(side).upper(),
                "type": order_type,
                "max_no": max_no,
                "total_investment": total_investment,
                "investment_duration": investment_duration,
            },
            "display_name": display_name
        }
    }

    if price != '':
        payload['params']['settings']['price'] = price
    if quantity != '':
        payload['params']['settings']['quantity'] = quantity
    if stop_price != '':
        payload['params']['settings']['stop_price'] = stop_price
    if take_profit_price != '':
        payload['params']['settings']['take_profit_price'] = take_profit_price

    response = send_post_request_to_component_endpoint(payload, method, ip, port, uuid, api_key, secret_key)
    write_to_console(f"{method} response: {json.loads(response.text)}")
    return json.loads(response.text)
</code>```

send post requset to component endpoint:

```<code>def send_post_request_to_component_endpoint(payload, method, ip, port, uuid, api_key=None, secret_key=None,
                                            account_uuid=None):
        payload = generate_sig(req=payload, component_api=False, api_key=api_key, secret_key=secret_key)
        write_to_console(f"{method} payload: {payload}")
        protocol = 'http'
        api_endpoint = f'{protocol}://{ip}:{port}/api/v2/{method}'
        headers = {
            'Accept': '*/*',
            'content-type': 'application/json',
            'gw-accountUuid': uuid
        }
        response = requests.post(url=api_endpoint, json=payload, headers=headers)
        write_to_console(f'{method} response: {response.text}')
        return response
</code>```

Then to send out the request properly i will need to apply a siging logic , code as below.

```<code>def generate_sig(req, component_api, api_key=None, secret_key=None):
    param_str = ""
    max_level = 3

    if component_api:
        secret_key = 'SECRET_KEY'
        req["api_key"] = 'API_KEY'
    else:
        secret_key = secret_key
        req["api_key"] = api_key

    req['nonce'] = int(time.time() * 1000)

    def params_to_str(obj, level):
        if level >= max_level:
            return str(obj)

        return_str = ""
        for key in sorted(obj):
            return_str += key
            if isinstance(obj[key], list):
                for subObj in obj[key]:
                    return_str += params_to_str(subObj, ++level)
            else:
                return_str += str(obj[key])
        return return_str

    if "params" in req:
        param_str = params_to_str(req['params'], 0)
        write_to_console(f'param string: {param_str}')

    payload_str = req['method'] + str(req['id']) + req['api_key'] + param_str + str(req['nonce'])
    write_to_console(f'payload to string: {payload_str}')
    # write_to_console(f'payload_str: {payload_str}')
    req['sig'] = hmac.new(
        bytes(str(secret_key), 'utf-8'),
        msg=bytes(payload_str, 'utf-8'),
        digestmod=hashlib.sha256
    ).hexdigest()

    write_to_console(f'request: {req}')
    return req
</code>```

However the param string now i get is sth like this below:

param string: bot_typeDCAdisplay_nameDCA Trading botsettings{'instrument_name': 'ETH_USDT-dpre', 'first_investment_time': '1670670003000', 'investment_frequency_mode': 'FIXED_DURATION', 'investment_frequency': '5000', 'investment_monthly_frequency': '', 'investment_currency': 'ETH', 'side': 'SELL', 'type': 'MARKET', 'max_no': '1', 'total_investment': '', 'investment_duration': '', 'quantity': '1'}

In order to sign a message correctly, the param str i parse need to be like the format below...

param string: bot_typeDCAdisplay_nameDCA Trading botsettingsinstrument_nameETH_USDT-dprefirst_investment_time1670670003000investment_frequency_modeFIXED_DURATION'investment_frequencyinvestment_monthly_frequencyinvestment_currencyETHsideSELLtypeMARKET'max_no1 total_investmentinvestment_durationquantity

Appreciate if you can kindly advise how i could resolve the issue.

Title: Python Convert JSON payload to string

Body:
Apologies if the question is basic. I am working on to convert json payload to pure string for signature purpose to make API POST
request.

I have define the json payload below:

def create_dca_trading_bot(bot_type, instrument_name, first_investment_time, investment_frequency_mode,
                           investment_frequency, investment_monthly_frequency, investment_currency,
                           max_no, total_investment, investment_duration, display_name, side, order_type, price,
                           quantity, stop_price,
                           take_profit_price, uuid, api_key, secret_key):

    method = 'private/create-trading-bot'

    payload = {
        "id": 1,
        "method": method,
        "params": {
            "bot_type": bot_type,
            "settings": {
                "instrument_name": str(instrument_name),
                "first_investment_time": str(first_investment_time),
                "investment_frequency_mode": str(investment_frequency_mode),
                "investment_frequency": str(investment_frequency),
                "investment_monthly_frequency": investment_monthly_frequency,
                "investment_currency": investment_currency,
                "side": str(side).upper(),
                "type": order_type,
                "max_no": max_no,
                "total_investment": total_investment,
                "investment_duration": investment_duration,
            },
            "display_name": display_name
        }
    }

    if price != '':
        payload['params']['settings']['price'] = price
    if quantity != '':
        payload['params']['settings']['quantity'] = quantity
    if stop_price != '':
        payload['params']['settings']['stop_price'] = stop_price
    if take_profit_price != '':
        payload['params']['settings']['take_profit_price'] = take_profit_price

    response = send_post_request_to_component_endpoint(payload, method, ip, port, uuid, api_key, secret_key)
    write_to_console(f"{method} response: {json.loads(response.text)}")
    return json.loads(response.text)

send post requset to component endpoint:

def send_post_request_to_component_endpoint(payload, method, ip, port, uuid, api_key=None, secret_key=None,
                                            account_uuid=None):
        payload = generate_sig(req=payload, component_api=False, api_key=api_key, secret_key=secret_key)
        write_to_console(f"{method} payload: {payload}")
        protocol = 'http'
        api_endpoint = f'{protocol}://{ip}:{port}/api/v2/{method}'
        headers = {
            'Accept': '*/*',
            'content-type': 'application/json',
            'gw-accountUuid': uuid
        }
        response = requests.post(url=api_endpoint, json=payload, headers=headers)
        write_to_console(f'{method} response: {response.text}')
        return response

Then to send out the request properly i will need to apply a siging logic , code as below.

def generate_sig(req, component_api, api_key=None, secret_key=None):
    param_str = ""
    max_level = 3

    if component_api:
        secret_key = 'SECRET_KEY'
        req["api_key"] = 'API_KEY'
    else:
        secret_key = secret_key
        req["api_key"] = api_key

    req['nonce'] = int(time.time() * 1000)

    def params_to_str(obj, level):
        if level >= max_level:
            return str(obj)

        return_str = ""
        for key in sorted(obj):
            return_str += key
            if isinstance(obj[key], list):
                for subObj in obj[key]:
                    return_str += params_to_str(subObj, ++level)
            else:
                return_str += str(obj[key])
        return return_str

    if "params" in req:
        param_str = params_to_str(req['params'], 0)
        write_to_console(f'param string: {param_str}')

    payload_str = req['method'] + str(req['id']) + req['api_key'] + param_str + str(req['nonce'])
    write_to_console(f'payload to string: {payload_str}')
    # write_to_console(f'payload_str: {payload_str}')
    req['sig'] = hmac.new(
        bytes(str(secret_key), 'utf-8'),
        msg=bytes(payload_str, 'utf-8'),
        digestmod=hashlib.sha256
    ).hexdigest()

    write_to_console(f'request: {req}')
    return req

However the param string now i get is sth like this below:

param string: bot_typeDCAdisplay_nameDCA Trading botsettings{'instrument_name': 'ETH_USDT-dpre', 'first_investment_time': '1670670003000', 'investment_frequency_mode': 'FIXED_DURATION', 'investment_frequency': '5000', 'investment_monthly_frequency': '', 'investment_currency': 'ETH', 'side': 'SELL', 'type': 'MARKET', 'max_no': '1', 'total_investment': '', 'investment_duration': '', 'quantity': '1'}

In order to sign a message correctly, the param str i parse need to be like the format below...

param string: bot_typeDCAdisplay_nameDCA Trading botsettingsinstrument_nameETH_USDT-dprefirst_investment_time1670670003000investment_frequency_modeFIXED_DURATION'investment_frequencyinvestment_monthly_frequencyinvestment_currencyETHsideSELLtypeMARKET'max_no1 total_investmentinvestment_durationquantity

Appreciate if you can kindly advise how i could resolve the issue.


问:
Use Cypress to automatically record a screencast
We use Cypress a lot. Now we want to use Cypress to record some screencasts for tutorial videos. I have the following problems:

The mouse cursor is not visible. It should be visible and trigger hover effects

The video needs to be cropped to remove the cypress part on the left. I think this can be solved with some video cropping tool.

The video resolution is too low, but this is fixible with cypress-high-resolution

It would be nice to use cypress to automate screencasts as we can add some test data with Cypress and we are used to this tool.

Are there better tools to automate the process of recording a screencast? Or is there a way to fix ny problem no. 1?


问:
Node.JS: process.arg doesn't contain all arguments passed when running a globally installed package's bin file
I am working on a package (wikisearch) and faced a problem and I can't even find anything similar to it online. I use commander package to be able to make a good looking interface for the package's bin file (./bin/wikisearch-cli.js). Everything was fine until I decided to replace a package I used with my own code, but after I did that and used npm install -g . to install wikisearch and test it, I found out that commander didn't read the '-s' argument passed while I ran the package bin. It is a required argument, that's how I knew it wasn't passed. I tried some stuff like using a shebang line (#! usr/bin/env node) but it didn't change much. I wanted to make sure that the problem isn't in the code so I used node to manually run the bin file, and it ran fine, it just doesn't work when its installed.

I did some digging and found out that process.argv is not correct; It only includes 2 arguments, even though I used some extra arguments when I ran the package.

process.argv when I run it using wikisearch -s test:

```<code>[
  'C:\\Program Files\\nodejs\\node.exe',
  'E:\\Development\\Projects\\wikisearch\\bin\\wikisearch-cli.js'
]
</code>```

process.argv when I run the bin file directly with node (node wikisearch-cli.js -s test):

```<code>[
  'C:\\Program Files\\nodejs\\node.exe',
  'E:\\Development\\Projects\\wikisearch\\bin\\wikisearch-cli.js',
  '-s',
  'test'
]
</code>```

my package.json file roughly looks like this:

{
  "name": "wikisearch",
  "type": "module",
  "version": "1.1.3",
  "main": "index.js",
  "homepage": "https://github.com/recleun/wikisearch#readme",
  "repository": {
    "type": "git",
    "url": "https://github.com/recleun/wikisearch.git"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "recleun#1770",
  "license": "MIT",
  "dependencies": {
    "chalk": "^5.2.0",
    "clipboardy": "^3.0.0",
    "commander": "^9.4.1",
    "node-fetch": "^3.3.0"
  },
  "bin": {
    "wikisearch": "./bin/wikisearch-cli.js"
  }
}
```
<h4>What I need</h4>
<p>I need to know why this happens, why process.argv is not correct after I installed the package globally, and how to prevent it. It didn't happen before, it happened after I tried to add multiple files to the package.</p>
<h3>Edit:</h3>
<p>%USER%/AppData/Roaming/npm/<strong>wikisearch.ps1</strong>:</p>
```#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent

$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
  # Fix case when both the Windows and Linux builds of Node
  # are installed in the same directory
  $exe=".exe"
}
$ret=0
if (Test-Path "$basedir/usr/bin/env$exe") {
  # Support pipeline input
  if ($MyInvocation.ExpectingInput) {
    $input | & "$basedir/usr/bin/env$exe" node "$basedir/node_modules/wikisearch/bin/wikisearch-cli.js" $args
  } else {
    & "$basedir/usr/bin/env$exe" node "$basedir/node_modules/wikisearch/bin/wikisearch-cli.js" $args
  }
  $ret=$LASTEXITCODE
} else {
  # Support pipeline input
  if ($MyInvocation.ExpectingInput) {
    $input | & "usr/bin/env$exe" node "$basedir/node_modules/wikisearch/bin/wikisearch-cli.js" $args
  } else {
    & "usr/bin/env$exe" node "$basedir/node_modules/wikisearch/bin/wikisearch-cli.js" $args
  }
  $ret=$LASTEXITCODE
}
exit $ret
```
<p>%USER%/AppData/Roaming/npm/<strong>wikisearch</strong>:</p>
```#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")

case `uname` in
    *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac

if [ -x "$basedir/usr/bin/env" ]; then
  exec "$basedir/usr/bin/env" node "$basedir/node_modules/wikisearch/bin/wikisearch-cli.js" "$@"
else
  exec usr/bin/env node "$basedir/node_modules/wikisearch/bin/wikisearch-cli.js" "$@"
fi
```
<p>%USER%/AppData/Roaming/npm/<strong>wikisearch.cmd</strong>:</p>
```@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0

IF EXIST "%dp0%\usr/bin/env.exe" (
  SET "_prog=%dp0%\usr/bin/env.exe"
) ELSE (
  SET "_prog=usr/bin/env"
  SET PATHEXT=%PATHEXT:;.JS;=;%
)

endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" node "%dp0%\node_modules\wikisearch\bin\wikisearch-cli.js" %*
```

Body:
I am working on a package (wikisearch) and faced a problem and I can't even find anything similar to it online. I use commander package to be able to make a good looking interface for the package's bin file (./bin/wikisearch-cli.js). Everything was fine until I decided to replace a package I used with my own code, but after I did that and used npm install -g . to install wikisearch and test it, I found out that commander didn't read the '-s' argument passed while I ran the package bin. It is a required argument, that's how I knew it wasn't passed. I tried some stuff like using a shebang line (#! usr/bin/env node) but it didn't change much. I wanted to make sure that the problem isn't in the code so I used node to manually run the bin file, and it ran fine, it just doesn't work when its installed.

I did some digging and found out that process.argv is not correct; It only includes 2 arguments, even though I used some extra arguments when I ran the package.

process.argv when I run it using wikisearch -s test:

[
  'C:\\Program Files\\nodejs\\node.exe',
  'E:\\Development\\Projects\\wikisearch\\bin\\wikisearch-cli.js'
]

process.argv when I run the bin file directly with node (node wikisearch-cli.js -s test):

[
  'C:\\Program Files\\nodejs\\node.exe',
  'E:\\Development\\Projects\\wikisearch\\bin\\wikisearch-cli.js',
  '-s',
  'test'
]

my package.json file roughly looks like this:

{
  "name": "wikisearch",
  "type": "module",
  "version": "1.1.3",
  "main": "index.js",
  "homepage": "https://github.com/recleun/wikisearch#readme",
  "repository": {
    "type": "git",
    "url": "https://github.com/recleun/wikisearch.git"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "recleun#1770",
  "license": "MIT",
  "dependencies": {
    "chalk": "^5.2.0",
    "clipboardy": "^3.0.0",
    "commander": "^9.4.1",
    "node-fetch": "^3.3.0"
  },
  "bin": {
    "wikisearch": "./bin/wikisearch-cli.js"
  }
}

What I need

I need to know why this happens, why process.argv is not correct after I installed the package globally, and how to prevent it. It didn't happen before, it happened after I tried to add multiple files to the package.

Edit:

%USER%/AppData/Roaming/npm/wikisearch.ps1:

#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent

$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
  # Fix case when both the Windows and Linux builds of Node
  # are installed in the same directory
  $exe=".exe"
}
$ret=0
if (Test-Path "$basedir/usr/bin/env$exe") {
  # Support pipeline input
  if ($MyInvocation.ExpectingInput) {
    $input | & "$basedir/usr/bin/env$exe" node "$basedir/node_modules/wikisearch/bin/wikisearch-cli.js" $args
  } else {
    & "$basedir/usr/bin/env$exe" node "$basedir/node_modules/wikisearch/bin/wikisearch-cli.js" $args
  }
  $ret=$LASTEXITCODE
} else {
  # Support pipeline input
  if ($MyInvocation.ExpectingInput) {
    $input | & "usr/bin/env$exe" node "$basedir/node_modules/wikisearch/bin/wikisearch-cli.js" $args
  } else {
    & "usr/bin/env$exe" node "$basedir/node_modules/wikisearch/bin/wikisearch-cli.js" $args
  }
  $ret=$LASTEXITCODE
}
exit $ret

%USER%/AppData/Roaming/npm/wikisearch:

#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")

case `uname` in
    *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac

if [ -x "$basedir/usr/bin/env" ]; then
  exec "$basedir/usr/bin/env" node "$basedir/node_modules/wikisearch/bin/wikisearch-cli.js" "$@"
else
  exec usr/bin/env node "$basedir/node_modules/wikisearch/bin/wikisearch-cli.js" "$@"
fi

%USER%/AppData/Roaming/npm/wikisearch.cmd:

@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0

IF EXIST "%dp0%\usr/bin/env.exe" (
  SET "_prog=%dp0%\usr/bin/env.exe"
) ELSE (
  SET "_prog=usr/bin/env"
  SET PATHEXT=%PATHEXT:;.JS;=;%
)

endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" node "%dp0%\node_modules\wikisearch\bin\wikisearch-cli.js" %*


问:
Implementing regularization Pytorch vs Keras
Do you know what would be the analog of doing something like this in Keras?

```<code>alpha = 5

pearson_corr = correlation.calculate_correlation(train)
pearson_index = [x for x in range(len(pearson_corr)) if abs(pearson_corr[x])<0.3]
self.corr_l1_penalty = torch.sum(torch.sum(torch.abs(self.fc1.weight), dim = 0)[pearson_index]) #corr lasso (l1) penality
self.loss_fn = nn.MSELoss()
penalty = alpha * self.model.corr_l1_penalty
loss = self.loss_fn(y_pred, y_labels)+penalty
</code>```

calculate_correlation is a custom function which computes the correlation coefficient between X and y within train.

Body:
Do you know what would be the analog of doing something like this in Keras?

alpha = 5

pearson_corr = correlation.calculate_correlation(train)
pearson_index = [x for x in range(len(pearson_corr)) if abs(pearson_corr[x])<0.3]
self.corr_l1_penalty = torch.sum(torch.sum(torch.abs(self.fc1.weight), dim = 0)[pearson_index]) #corr lasso (l1) penality
self.loss_fn = nn.MSELoss()
penalty = alpha * self.model.corr_l1_penalty
loss = self.loss_fn(y_pred, y_labels)+penalty

calculate_correlation is a custom function which computes the correlation coefficient between X and y within train.


问:
Issue with NSTreeController moveNode:toIndexPath:?
I'm using an NSTreeController set in entity mode, to manage a hierarchy of folders (a core data entity I call Folder). The "Children" key path is set to an NSArray readwrite property of Folder, which I call subfoldersArray. (I use NSArray because NSOrderedSet doesn't work with a tree controller).

When the user moves a folder to another folder (via an NSOutlineView) or at a different position of the same parent folder, the app calls  moveNode:toIndexPath: on the tree controller. I use this method as it preserves the selection (while changing the underlying model tends to deselect the selected folder, even though the controller has preserveSelection set to YES.

Problem: every Folder instance that is moved by moveNode:toIndexPath: is placed at the end of the subfoldersArray, regardless of the index path specified.
This happens only when the NSTreeController controls an NSManagedObject subclass (in either class or entity mode).

The exact same moveNode:toIndexPath: instruction on the same NSTreeController controlling an equivalent NSObject subclass (with an identical subfoldersArray property) works as expected.

I'd like a solution that doesn't involve setting the underlying model myself, as this tends to deselect the selected folder (which may not be the one that is moved).


问:
Custom method loginUser returning false
I have following method inside Fragment:

```<code>private boolean userLogin(final String username,
    final String password)
{
    AtomicBoolean isLoginSuccessful=new AtomicBoolean(false);

    FirebaseAuth fa=FirebaseAuth.getInstance();
    AtomicReference<FirebaseUser> fu=new AtomicReference<>();

    fa.signInWithEmailAndPassword(username,
            password).addOnCompleteListener(requireActivity(),
            (OnCompleteListener<AuthResult>)task->
            {
                    fu.set(fa.getCurrentUser());
            }).addOnCompleteListener(task->
            {
                if(task.isSuccessful())
                {
                    if(fu.get()!=null)
                    {
                        CurrentLoggedUser.setUserId(fu.get()
                            .getUid());
                        CurrentLoggedUser.setUsername(username);
                        CurrentLoggedUser.setSuccessfulLoginFlag(true);

                        isLoginSuccessful.set(true);
                    }
                }
            }).addOnFailureListener(e->
            {
                CurrentLoggedUser.clearCredentials();

                Log.e(TAG,
                    e.toString());
            });

    return isLoginSuccessful.get();
}
</code>```

This method worked fine until I changed it from void to boolean, because I need it to return login success flag. Therefore I've introduced AtomicBoolean isLoginSuccessful=new AtomicBoolean(false); variable, which is returned at the end of method. However, I succesfully get data from Firebase and in line 25, which is isLoginSuccessful.set(true); gets executed - I've checked several times and debugger shows it has value true. However, at the end of method, in line return isLoginSuccessful.get(); returns false. Why and how do I fix this?

Title: Custom method loginUser returning false

Body:
I have following method inside Fragment:

private boolean userLogin(final String username,
    final String password)
{
    AtomicBoolean isLoginSuccessful=new AtomicBoolean(false);

    FirebaseAuth fa=FirebaseAuth.getInstance();
    AtomicReference<FirebaseUser> fu=new AtomicReference<>();

    fa.signInWithEmailAndPassword(username,
            password).addOnCompleteListener(requireActivity(),
            (OnCompleteListener<AuthResult>)task->
            {
                    fu.set(fa.getCurrentUser());
            }).addOnCompleteListener(task->
            {
                if(task.isSuccessful())
                {
                    if(fu.get()!=null)
                    {
                        CurrentLoggedUser.setUserId(fu.get()
                            .getUid());
                        CurrentLoggedUser.setUsername(username);
                        CurrentLoggedUser.setSuccessfulLoginFlag(true);

                        isLoginSuccessful.set(true);
                    }
                }
            }).addOnFailureListener(e->
            {
                CurrentLoggedUser.clearCredentials();

                Log.e(TAG,
                    e.toString());
            });

    return isLoginSuccessful.get();
}

This method worked fine until I changed it from void to boolean, because I need it to return login success flag. Therefore I've introduced AtomicBoolean isLoginSuccessful=new AtomicBoolean(false); variable, which is returned at the end of method. However, I succesfully get data from Firebase and in line 25, which is isLoginSuccessful.set(true); gets executed - I've checked several times and debugger shows it has value true. However, at the end of method, in line return isLoginSuccessful.get(); returns false. Why and how do I fix this?


问:
What Sensor Fusion algo is google AOSP using? See the source code here
I'm looking into Googles code here:

https://cs.android.com/android/platform/superproject/+/master:frameworks/native/services/sensorservice/Fusion.cpp;bpv=0;bpt=0

For the experts: what algorithm is used here? It looks like a Kalman filter to me. Or is it a Madgwick implementation?

I'm currently trying to decide / choose a sensor fusion algo for my application. Basially looking for the best one around. I compiled and tested Googles one, gives decent results but far from perfect.


问:
Controlling Jack(2) audio rack/patchbay via keyboard, CLI-Commands or API
I think I am very well versed in Linux in general and have recently been dabbling a bit deeper into Linux audio, especially using jack2.

I've managed to create a nice patchbay configuration where I can dynamically add certain effects to my outgoing microphone sink allowing me to use those effects with eg. discord.

I have set up multiple connections from my microphone source via different filters/effects to the microphone sink.
When I want to activate an effect, currently I have to lower the volume on the plain microphone path (aka a simple bypass plugin) and increase the volume on the microphone effect path (eg. some reverb-effect plugin).

This is of course rather tedious and I'm wondering if there is a way to script this operation somehow. I'm currently controlling my patch bay and rack using KXStudio-Carla as Plugin-Host, although I'd be open to using something else instead. (eg. Ardor)

TL;DR - Question:
Is there a way to control the jack or my plugin-host using my normal keyboard or to script vst-hsettings or patch bay-connections using CLI-command, midhi (eg. using middlings) or is there some jack or plugin-host API I can use?

Also:
Since this is my first introdhuction to audio-mixing, is that even the correct way to do this kind of "switching of audio paths" or am I going at this the completehly wrong way?

Done a lot of googling, wihthout many answers.


问:
How to upload React build in CPanel under public_html/dev/projectName
When i upload in Cpanel under public_html/dev/projectName, Navigation url not adding dev/projectName - after refresh 404 error coming..

i have also add homepage in package.json with full url.. but still not success


问:
Sort a list of file paths without using memory or array in C?
I Use ELM Chan fatfs library for file system. This application reads a USB memory MSC. I want to read all the MP3 files in root directory in a sorted manner but I can not use an array to save all the file paths, Number of files exceeds ram memory of my microcontroller.
I have the bellow idea.

function that save the index of
the MP3 files in an (array of indexes)

A function that gets file name based on the f_readdir index that was saved in (array of indexes)

Sort (array of indexes) based on the bubble sort.

read file based on this sorted indexes array

Is This a viable solution? I think this method is really slow


问:
New Promise is not catching up the error can we use reject and catch all together?
I am trying to fetch an api, in error case errors are not catching up.

All the time error is getting undefined even though there is an error with api

```<code>export default {
    setRecordList({
        commit
    }) {
        return new Promise(async (resolve, reject) => {
            try {
                const resp = await axios('getRecord');
                const data = resp.data
                commit('setRecordList', data);
                resolve()
            } catch (err) {
                console.log("Nothing coming", err); // Error is undefined
                reject(err);
            }
        })
    }
}
</code>```

It should catch the error what is best way how can we resolve it ?

Body:
I am trying to fetch an api, in error case errors are not catching up.

All the time error is getting undefined even though there is an error with api

export default {
    setRecordList({
        commit
    }) {
        return new Promise(async (resolve, reject) => {
            try {
                const resp = await axios('getRecord');
                const data = resp.data
                commit('setRecordList', data);
                resolve()
            } catch (err) {
                console.log("Nothing coming", err); // Error is undefined
                reject(err);
            }
        })
    }
}

It should catch the error what is best way how can we resolve it ?


问:
Changing the Legend Title in Ggplot2
I am currently programming in R and trying to produce an interaction chart. However, at the moment, the legend title is "sSkills". I would like to change that into "Social Skills", but by specifying "color = "Social Skills"", only a second legend is created. Help would be really appreciated.

```<code>intPlot <- ggplot(IntPoints2Plot, aes(sComplex, sPerform, color = sSkills, shape = sSkills, group = sSkills))

intPlot <- intPlot + geom_line(aes(linetype = sSkills))

intPlot <- intPlot + geom_point(size=5) + ylim(12,15) + theme(axis.text=element_text(size=11), axis.title=element_text(size=11),legend.title=element_text(size=11),legend.text=element_text(size=11))

intPlot <- intPlot + labs(x = "Social Complexity", y = "Social Performance", color = "Social Skills")

intPlot <- intPlot + theme_apa(x.font.size = 11, y.font.size = 11, legend.use.title = T)

intPlot
</code>```

I tried multiple answers provided in this forum, but none of these changed the "sSkills" title.

Title: Changing the Legend Title in Ggplot2

Body:
I am currently programming in R and trying to produce an interaction chart. However, at the moment, the legend title is "sSkills". I would like to change that into "Social Skills", but by specifying "color = "Social Skills"", only a second legend is created. Help would be really appreciated.

intPlot <- ggplot(IntPoints2Plot, aes(sComplex, sPerform, color = sSkills, shape = sSkills, group = sSkills))

intPlot <- intPlot + geom_line(aes(linetype = sSkills))

intPlot <- intPlot + geom_point(size=5) + ylim(12,15) + theme(axis.text=element_text(size=11), axis.title=element_text(size=11),legend.title=element_text(size=11),legend.text=element_text(size=11))

intPlot <- intPlot + labs(x = "Social Complexity", y = "Social Performance", color = "Social Skills")

intPlot <- intPlot + theme_apa(x.font.size = 11, y.font.size = 11, legend.use.title = T)

intPlot

I tried multiple answers provided in this forum, but none of these changed the "sSkills" title.


问:
JPA Modifying Object attribute in database with custom Query
The code below worked for an older version of SpringBoot (2.6.7). Now that I've upgraded to a newer version (3.0.0) this piece of code is not working anymore.

Basically I have an enumeration that states the role of an user and I want to have a method to promote the user.

User.java

@NoArgsConstructor
@AllArgsConstructor
@Entity
@Getter
@Setter
public class User implements UserDetails {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    private String firstName;
    private String lastName;
    private String email;
    private String password;
    @Enumerated(EnumType.STRING)
    private UserRole userRole; // This is where the problem is
    private Boolean locked = false;
    private Boolean enabled = false;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "user")
    private List<Token> tokenList;

    public User(String firstName, String lastName, String email, String password, UserRole userRole) {
        this.firstName = firstName;
        this.lastName = lastName;
        this.email = email;
        this.password = password;
        this.userRole = userRole;
    }

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        SimpleGrantedAuthority authority = new SimpleGrantedAuthority(userRole.name());
        return Collections.singletonList(authority);
    }

    @Override
    public String getPassword() {
        return password;
    }

    @Override
    public String getUsername() {
        return email;
    }

    public String getFirstName() {
        return firstName;
    }

    public String getLastName() {
        return lastName;
    }

    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return !locked;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return enabled;
    }

    public boolean isAdmin() {
        return userRole.equals(UserRole.ADMIN);
    }
}
```
<p>UserRole.java</p>
<pre class="lang-java prettyprint-override"><code>public enum UserRole {
    USER, ADMIN
}
</code>```

UserRepository.java

import com.freshair.models.User;
import jakarta.transaction.Transactional;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.Optional;

@Repository
public interface AppUserRepository extends JpaRepository<User, Long> {

    Optional<User> findByEmail(String email);

    @Transactional
    @Modifying(clearAutomatically = true)
    @Query("UPDATE User a " +
           "SET a.enabled = FALSE where a.email = ?1")
    int disableAppUser(String email);

    @Transactional
    @Modifying(clearAutomatically = true)
    @Query("UPDATE User a " +
           "SET a.userRole = 'ADMIN' where a.email = :email")
    int promoteUserToAdmin(@Param("email") String email);

    // Other methods ...
}

```
<p>Error:</p>
```org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'webSecurityConfig' defined in file [D:\[Coding]\Java\FreshAir\api\target\classes\com\freshair\config\security\WebSecurityConfig.class]: Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'userService' defined in file [D:\[Coding]\Java\FreshAir\api\target\classes\com\freshair\services\UserService.class]: Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'appUserRepository' defined in com.freshair.repositories.AppUserRepository defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Could not create query for public abstract int com.freshair.repositories.AppUserRepository.promoteUserToAdmin(java.lang.String); Reason: Validation failed for query for method public abstract int com.freshair.repositories.AppUserRepository.promoteUserToAdmin(java.lang.String)
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:793)
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:242)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1344)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1188)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:561)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:961)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:915)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:584)
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:432)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:308)
    at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:150)
    at com.freshair.App.main(App.java:20)
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userService' defined in file [D:\[Coding]\Java\FreshAir\api\target\classes\com\freshair\services\UserService.class]: Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'appUserRepository' defined in com.freshair.repositories.AppUserRepository defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Could not create query for public abstract int com.freshair.repositories.AppUserRepository.promoteUserToAdmin(java.lang.String); Reason: Validation failed for query for method public abstract int com.freshair.repositories.AppUserRepository.promoteUserToAdmin(java.lang.String)
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:793)
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:242)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1344)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1188)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:561)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:254)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1405)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1325)
    at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:880)
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:784)
    ... 18 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'appUserRepository' defined in com.freshair.repositories.AppUserRepository defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Could not create query for public abstract int com.freshair.repositories.AppUserRepository.promoteUserToAdmin(java.lang.String); Reason: Validation failed for query for method public abstract int com.freshair.repositories.AppUserRepository.promoteUserToAdmin(java.lang.String)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1751)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:599)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:254)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1405)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1325)
    at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:880)
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:784)
    ... 32 common frames omitted
Caused by: org.springframework.data.repository.query.QueryCreationException: Could not create query for public abstract int com.freshair.repositories.AppUserRepository.promoteUserToAdmin(java.lang.String); Reason: Validation failed for query for method public abstract int com.freshair.repositories.AppUserRepository.promoteUserToAdmin(java.lang.String)
    at org.springframework.data.repository.query.QueryCreationException.create(QueryCreationException.java:101)
    at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.lookupQuery(QueryExecutorMethodInterceptor.java:115)
    at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.mapMethodsToQuery(QueryExecutorMethodInterceptor.java:99)
    at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.lambda$new$0(QueryExecutorMethodInterceptor.java:88)
    at java.base/java.util.Optional.map(Optional.java:260)
    at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.<init>(QueryExecutorMethodInterceptor.java:88)
    at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:357)
    at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.lambda$afterPropertiesSet$5(RepositoryFactoryBeanSupport.java:279)
    at org.springframework.data.util.Lazy.getNullable(Lazy.java:229)
    at org.springframework.data.util.Lazy.get(Lazy.java:113)
    at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:285)
    at org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.afterPropertiesSet(JpaRepositoryFactoryBean.java:132)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1797)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1747)
    ... 43 common frames omitted
Caused by: java.lang.IllegalArgumentException: Validation failed for query for method public abstract int com.freshair.repositories.AppUserRepository.promoteUserToAdmin(java.lang.String)
    at org.springframework.data.jpa.repository.query.SimpleJpaQuery.validateQuery(SimpleJpaQuery.java:100)
    at org.springframework.data.jpa.repository.query.SimpleJpaQuery.<init>(SimpleJpaQuery.java:70)
    at org.springframework.data.jpa.repository.query.JpaQueryFactory.fromMethodWithQueryString(JpaQueryFactory.java:55)
    at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$DeclaredQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:170)
    at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateIfNotFoundQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:252)
    at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$AbstractQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:95)
    at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.lookupQuery(QueryExecutorMethodInterceptor.java:111)
    ... 55 common frames omitted
Caused by: java.lang.IllegalArgumentException: org.hibernate.query.SemanticException: The assignment expression type [java.lang.String] did not match the assignment path type [com.freshair.models.UserRole] for the path [a.userRole] [UPDATE User a SET a.userRole = 'ADMIN' where a.email = :email]
    at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:138)
    at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:175)
    at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:182)
    at org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:761)
    at org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:663)
    at org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:127)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:360)
    at jdk.proxy2/jdk.proxy2.$Proxy118.createQuery(Unknown Source)
    at org.springframework.data.jpa.repository.query.SimpleJpaQuery.validateQuery(SimpleJpaQuery.java:94)
    ... 61 common frames omitted
Caused by: org.hibernate.query.SemanticException: The assignment expression type [java.lang.String] did not match the assignment path type [com.freshair.models.UserRole] for the path [a.userRole] [UPDATE User a SET a.userRole = 'ADMIN' where a.email = :email]
    at org.hibernate.query.sqm.internal.QuerySqmImpl.verifyUpdateTypesMatch(QuerySqmImpl.java:361)
    at org.hibernate.query.sqm.internal.QuerySqmImpl.validateStatement(QuerySqmImpl.java:310)
    at org.hibernate.query.sqm.internal.QuerySqmImpl.<init>(QuerySqmImpl.java:210)
    at org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:745)
    ... 70 common frames omitted

Process finished with exit code 1

```
<p>pom.xml</p>
```<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>3.0.0</version>
        <relativePath/>
    </parent>

    <properties>
        <java.version>17</java.version>
        <swagger.version>3.0.0</swagger.version>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                        </exclude>
                    </excludes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <dependencies>

        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>${swagger.version}</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>${swagger.version}</version>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-mail</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>2.0.1.Final</version>
        </dependency>
        <dependency>
            <groupId>commons-validator</groupId>
            <artifactId>commons-validator</artifactId>
            <version>1.7</version>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>4.0.1</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.datatype</groupId>
            <version>2.14.0</version>
            <artifactId>jackson-datatype-jsr310</artifactId>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
        </dependency>

        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-inline</artifactId>
            <version>4.8.0</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.11.0</version>
        </dependency>
    </dependencies>
</project>

```

What I understand from that error is that it cannot set a string to an object of type UserRole, but that is why is annotated with @Enumerated(EnumType.STRING). This code worked fine before I updated the version, maybe now I have to add something more to treat it as a string instead of an object

Body:
The code below worked for an older version of SpringBoot (2.6.7). Now that I've upgraded to a newer version (3.0.0) this piece of code is not working anymore.

Basically I have an enumeration that states the role of an user and I want to have a method to promote the user.

User.java

@NoArgsConstructor
@AllArgsConstructor
@Entity
@Getter
@Setter
public class User implements UserDetails {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    private String firstName;
    private String lastName;
    private String email;
    private String password;
    @Enumerated(EnumType.STRING)
    private UserRole userRole; // This is where the problem is
    private Boolean locked = false;
    private Boolean enabled = false;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "user")
    private List<Token> tokenList;

    public User(String firstName, String lastName, String email, String password, UserRole userRole) {
        this.firstName = firstName;
        this.lastName = lastName;
        this.email = email;
        this.password = password;
        this.userRole = userRole;
    }

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        SimpleGrantedAuthority authority = new SimpleGrantedAuthority(userRole.name());
        return Collections.singletonList(authority);
    }

    @Override
    public String getPassword() {
        return password;
    }

    @Override
    public String getUsername() {
        return email;
    }

    public String getFirstName() {
        return firstName;
    }

    public String getLastName() {
        return lastName;
    }

    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return !locked;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return enabled;
    }

    public boolean isAdmin() {
        return userRole.equals(UserRole.ADMIN);
    }
}

UserRole.java

public enum UserRole {
    USER, ADMIN
}

UserRepository.java

import com.freshair.models.User;
import jakarta.transaction.Transactional;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.Optional;

@Repository
public interface AppUserRepository extends JpaRepository<User, Long> {

    Optional<User> findByEmail(String email);

    @Transactional
    @Modifying(clearAutomatically = true)
    @Query("UPDATE User a " +
           "SET a.enabled = FALSE where a.email = ?1")
    int disableAppUser(String email);

    @Transactional
    @Modifying(clearAutomatically = true)
    @Query("UPDATE User a " +
           "SET a.userRole = 'ADMIN' where a.email = :email")
    int promoteUserToAdmin(@Param("email") String email);

    // Other methods ...
}

Error:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'webSecurityConfig' defined in file [D:\[Coding]\Java\FreshAir\api\target\classes\com\freshair\config\security\WebSecurityConfig.class]: Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'userService' defined in file [D:\[Coding]\Java\FreshAir\api\target\classes\com\freshair\services\UserService.class]: Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'appUserRepository' defined in com.freshair.repositories.AppUserRepository defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Could not create query for public abstract int com.freshair.repositories.AppUserRepository.promoteUserToAdmin(java.lang.String); Reason: Validation failed for query for method public abstract int com.freshair.repositories.AppUserRepository.promoteUserToAdmin(java.lang.String)
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:793)
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:242)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1344)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1188)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:561)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:961)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:915)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:584)
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:432)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:308)
    at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:150)
    at com.freshair.App.main(App.java:20)
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userService' defined in file [D:\[Coding]\Java\FreshAir\api\target\classes\com\freshair\services\UserService.class]: Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'appUserRepository' defined in com.freshair.repositories.AppUserRepository defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Could not create query for public abstract int com.freshair.repositories.AppUserRepository.promoteUserToAdmin(java.lang.String); Reason: Validation failed for query for method public abstract int com.freshair.repositories.AppUserRepository.promoteUserToAdmin(java.lang.String)
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:793)
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:242)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1344)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1188)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:561)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:254)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1405)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1325)
    at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:880)
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:784)
    ... 18 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'appUserRepository' defined in com.freshair.repositories.AppUserRepository defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Could not create query for public abstract int com.freshair.repositories.AppUserRepository.promoteUserToAdmin(java.lang.String); Reason: Validation failed for query for method public abstract int com.freshair.repositories.AppUserRepository.promoteUserToAdmin(java.lang.String)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1751)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:599)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:254)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1405)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1325)
    at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:880)
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:784)
    ... 32 common frames omitted
Caused by: org.springframework.data.repository.query.QueryCreationException: Could not create query for public abstract int com.freshair.repositories.AppUserRepository.promoteUserToAdmin(java.lang.String); Reason: Validation failed for query for method public abstract int com.freshair.repositories.AppUserRepository.promoteUserToAdmin(java.lang.String)
    at org.springframework.data.repository.query.QueryCreationException.create(QueryCreationException.java:101)
    at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.lookupQuery(QueryExecutorMethodInterceptor.java:115)
    at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.mapMethodsToQuery(QueryExecutorMethodInterceptor.java:99)
    at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.lambda$new$0(QueryExecutorMethodInterceptor.java:88)
    at java.base/java.util.Optional.map(Optional.java:260)
    at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.<init>(QueryExecutorMethodInterceptor.java:88)
    at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:357)
    at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.lambda$afterPropertiesSet$5(RepositoryFactoryBeanSupport.java:279)
    at org.springframework.data.util.Lazy.getNullable(Lazy.java:229)
    at org.springframework.data.util.Lazy.get(Lazy.java:113)
    at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:285)
    at org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.afterPropertiesSet(JpaRepositoryFactoryBean.java:132)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1797)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1747)
    ... 43 common frames omitted
Caused by: java.lang.IllegalArgumentException: Validation failed for query for method public abstract int com.freshair.repositories.AppUserRepository.promoteUserToAdmin(java.lang.String)
    at org.springframework.data.jpa.repository.query.SimpleJpaQuery.validateQuery(SimpleJpaQuery.java:100)
    at org.springframework.data.jpa.repository.query.SimpleJpaQuery.<init>(SimpleJpaQuery.java:70)
    at org.springframework.data.jpa.repository.query.JpaQueryFactory.fromMethodWithQueryString(JpaQueryFactory.java:55)
    at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$DeclaredQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:170)
    at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateIfNotFoundQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:252)
    at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$AbstractQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:95)
    at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.lookupQuery(QueryExecutorMethodInterceptor.java:111)
    ... 55 common frames omitted
Caused by: java.lang.IllegalArgumentException: org.hibernate.query.SemanticException: The assignment expression type [java.lang.String] did not match the assignment path type [com.freshair.models.UserRole] for the path [a.userRole] [UPDATE User a SET a.userRole = 'ADMIN' where a.email = :email]
    at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:138)
    at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:175)
    at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:182)
    at org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:761)
    at org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:663)
    at org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:127)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:360)
    at jdk.proxy2/jdk.proxy2.$Proxy118.createQuery(Unknown Source)
    at org.springframework.data.jpa.repository.query.SimpleJpaQuery.validateQuery(SimpleJpaQuery.java:94)
    ... 61 common frames omitted
Caused by: org.hibernate.query.SemanticException: The assignment expression type [java.lang.String] did not match the assignment path type [com.freshair.models.UserRole] for the path [a.userRole] [UPDATE User a SET a.userRole = 'ADMIN' where a.email = :email]
    at org.hibernate.query.sqm.internal.QuerySqmImpl.verifyUpdateTypesMatch(QuerySqmImpl.java:361)
    at org.hibernate.query.sqm.internal.QuerySqmImpl.validateStatement(QuerySqmImpl.java:310)
    at org.hibernate.query.sqm.internal.QuerySqmImpl.<init>(QuerySqmImpl.java:210)
    at org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:745)
    ... 70 common frames omitted

Process finished with exit code 1

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>3.0.0</version>
        <relativePath/>
    </parent>

    <properties>
        <java.version>17</java.version>
        <swagger.version>3.0.0</swagger.version>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                        </exclude>
                    </excludes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <dependencies>

        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>${swagger.version}</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>${swagger.version}</version>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-mail</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>2.0.1.Final</version>
        </dependency>
        <dependency>
            <groupId>commons-validator</groupId>
            <artifactId>commons-validator</artifactId>
            <version>1.7</version>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>4.0.1</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.datatype</groupId>
            <version>2.14.0</version>
            <artifactId>jackson-datatype-jsr310</artifactId>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
        </dependency>

        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-inline</artifactId>
            <version>4.8.0</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.11.0</version>
        </dependency>
    </dependencies>
</project>

What I understand from that error is that it cannot set a string to an object of type UserRole, but that is why is annotated with @Enumerated(EnumType.STRING). This code worked fine before I updated the version, maybe now I have to add something more to treat it as a string instead of an object


问:
Bootstrap card group with same size cards
I'm using a card group of bootstrap, however at 576px there is a switch in the layout that I don't like (because all the nine cards are on the same line and are too little) thus I inserted min-width:250px to each card, but in this way the odd cards (the last cards) span all the row, instead I would that cards was all the same size.  In the code below the problem (resize the browser to see the problem at some browser sizes). This behavior is due to the flex property of bootstrap (flex-grow exactly)

<!DOCTYPE html>

      <meta charset="utf-8" />
      <meta http-equiv="X-UA-Compatible" content="IE=edge" />
      <meta
         name="viewport"
         content="width=device-width, initial-scale=1, shrink-to-fit=no"
      />
      <link
         rel="stylesheet"
         href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
         integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T"
         crossorigin="anonymous"
      />
      <title></title>

Card title

                  This is a wider card with supporting text below as a natural
                  lead-in to additional content. This content is a little bit
                  longer.

               Last updated 3 mins ago

Card title

                  This card has supporting text below as a natural lead-in to
                  additional content.

               Last updated 3 mins ago

Card title

                  This is a wider card with supporting text below as a natural
                  lead-in to additional content. This card has even longer
                  content than the first to show that equal height action.

               Last updated 3 mins ago

Card title

                  This is a wider card with supporting text below as a natural
                  lead-in to additional content. This card has even longer
                  content than the first to show that equal height action.

               Last updated 3 mins ago

Card title

                  This is a wider card with supporting text below as a natural
                  lead-in to additional content. This content is a little bit
                  longer.

               Last updated 3 mins ago

Card title

                  This card has supporting text below as a natural lead-in to
                  additional content.

               Last updated 3 mins ago

Card title

                  This is a wider card with supporting text below as a natural
                  lead-in to additional content. This card has even longer
                  content than the first to show that equal height action.

               Last updated 3 mins ago

Card title

                  This is a wider card with supporting text below as a natural
                  lead-in to additional content. This card has even longer
                  content than the first to show that equal height action.

               Last updated 3 mins ago

Card title

                  This is a wider card with supporting text below as a natural
                  lead-in to additional content. This card has even longer
                  content than the first to show that equal height action.

               Last updated 3 mins ago

```
</div>
</div>
</p>
<p>To fix this problem I customized my card like this:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code><!DOCTYPE html>
<html lang="en">
   <head>
      <meta charset="utf-8" />
      <meta http-equiv="X-UA-Compatible" content="IE=edge" />
      <meta
         name="viewport"
         content="width=device-width, initial-scale=1, shrink-to-fit=no"
      />
      <link
         rel="stylesheet"
         href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
         integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T"
         crossorigin="anonymous"
      />
      <title></title>
      <style>
         @media (min-width: 450px) {
            .card-group > .card {
               flex: 0 0 calc(50% - 16px);
            }

            .card-group {
               flex-direction: row;
               flex-wrap: wrap;
            }
         }

         @media (min-width: 800px) {
            .card-group > .card {
               flex: 0 0 calc(25% - 16px);
            }
         }

         /*   .card {
            min-width: 250px;
         } */
      </style>
   </head>

   <body>
      <div class="card-group m-sm-2">
         <div class="card m-2">
            <img
               src="https://picsum.photos/400/400"
               class="card-img-top"
               alt="..."
            />
            <div class="card-body">
               <h5 class="card-title">Card title</h5>
               <p class="card-text">
                  This is a wider card with supporting text below as a natural
                  lead-in to additional content. This content is a little bit
                  longer.
               </p>
            </div>
            <div class="card-footer">
               <small class="text-muted">Last updated 3 mins ago</small>
            </div>
         </div>
         <div class="card m-2 border-left">
            <img
               src="https://picsum.photos/400/400"
               class="card-img-top"
               alt="..."
            />
            <div class="card-body">
               <h5 class="card-title">Card title</h5>
               <p class="card-text">
                  This card has supporting text below as a natural lead-in to
                  additional content.
               </p>
            </div>
            <div class="card-footer">
               <small class="text-muted">Last updated 3 mins ago</small>
            </div>
         </div>
         <div class="card m-2 border-left">
            <img
               src="https://picsum.photos/400/400"
               class="card-img-top"
               alt="..."
            />
            <div class="card-body">
               <h5 class="card-title">Card title</h5>
               <p class="card-text">
                  This is a wider card with supporting text below as a natural
                  lead-in to additional content. This card has even longer
                  content than the first to show that equal height action.
               </p>
            </div>
            <div class="card-footer">
               <small class="text-muted">Last updated 3 mins ago</small>
            </div>
         </div>

         <div class="card m-2 border-left">
            <img
               src="https://picsum.photos/400/400"
               class="card-img-top"
               alt="..."
            />
            <div class="card-body">
               <h5 class="card-title">Card title</h5>
               <p class="card-text">
                  This is a wider card with supporting text below as a natural
                  lead-in to additional content. This card has even longer
                  content than the first to show that equal height action.
               </p>
            </div>
            <div class="card-footer">
               <small class="text-muted">Last updated 3 mins ago</small>
            </div>
         </div>
         <div class="card m-2">
            <img
               src="https://picsum.photos/400/400"
               class="card-img-top"
               alt="..."
            />
            <div class="card-body">
               <h5 class="card-title">Card title</h5>
               <p class="card-text">
                  This is a wider card with supporting text below as a natural
                  lead-in to additional content. This content is a little bit
                  longer.
               </p>
            </div>
            <div class="card-footer">
               <small class="text-muted">Last updated 3 mins ago</small>
            </div>
         </div>
         <div class="card m-2 border-left">
            <img
               src="https://picsum.photos/400/400"
               class="card-img-top"
               alt="..."
            />
            <div class="card-body">
               <h5 class="card-title">Card title</h5>
               <p class="card-text">
                  This card has supporting text below as a natural lead-in to
                  additional content.
               </p>
            </div>
            <div class="card-footer">
               <small class="text-muted">Last updated 3 mins ago</small>
            </div>
         </div>
         <div class="card m-2 border-left">
            <img
               src="https://picsum.photos/400/400"
               class="card-img-top"
               alt="..."
            />
            <div class="card-body">
               <h5 class="card-title">Card title</h5>
               <p class="card-text">
                  This is a wider card with supporting text below as a natural
                  lead-in to additional content. This card has even longer
                  content than the first to show that equal height action.
               </p>
            </div>
            <div class="card-footer">
               <small class="text-muted">Last updated 3 mins ago</small>
            </div>
         </div>

         <div class="card m-2 border-left">
            <img
               src="https://picsum.photos/400/400"
               class="card-img-top"
               alt="..."
            />
            <div class="card-body">
               <h5 class="card-title">Card title</h5>
               <p class="card-text">
                  This is a wider card with supporting text below as a natural
                  lead-in to additional content. This card has even longer
                  content than the first to show that equal height action.
               </p>
            </div>
            <div class="card-footer">
               <small class="text-muted">Last updated 3 mins ago</small>
            </div>
         </div>

         <div class="card m-2 border-left">
            <img
               src="https://picsum.photos/400/400"
               class="card-img-top"
               alt="..."
            />
            <div class="card-body">
               <h5 class="card-title">Card title</h5>
               <p class="card-text">
                  This is a wider card with supporting text below as a natural
                  lead-in to additional content. This card has even longer
                  content than the first to show that equal height action.
               </p>
            </div>
            <div class="card-footer">
               <small class="text-muted">Last updated 3 mins ago</small>
            </div>
         </div>
      </div>

      <!-- Optional JavaScript -->
      <!-- jQuery first, then Popper.js, then Bootstrap JS -->
      <script
         src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
         integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
         crossorigin="anonymous"
      ></script>
      <script
         src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"
         integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1"
         crossorigin="anonymous"
      ></script>
      <script
         src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"
         integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM"
         crossorigin="anonymous"
      ></script>
   </body>
</html></code>```

But my solution seems too much convoluted and not in bootstrap style. Is there a more smart way?

Body:
I'm using a card group of bootstrap, however at 576px there is a switch in the layout that I don't like (because all the nine cards are on the same line and are too little) thus I inserted min-width:250px to each card, but in this way the odd cards (the last cards) span all the row, instead I would that cards was all the same size.  In the code below the problem (resize the browser to see the problem at some browser sizes). This behavior is due to the flex property of bootstrap (flex-grow exactly)

<!DOCTYPE html>

      <meta charset="utf-8" />
      <meta http-equiv="X-UA-Compatible" content="IE=edge" />
      <meta
         name="viewport"
         content="width=device-width, initial-scale=1, shrink-to-fit=no"
      />
      <link
         rel="stylesheet"
         href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
         integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T"
         crossorigin="anonymous"
      />
      <title></title>

Card title

                  This is a wider card with supporting text below as a natural
                  lead-in to additional content. This content is a little bit
                  longer.

               Last updated 3 mins ago

Card title

                  This card has supporting text below as a natural lead-in to
                  additional content.

               Last updated 3 mins ago

Card title

                  This is a wider card with supporting text below as a natural
                  lead-in to additional content. This card has even longer
                  content than the first to show that equal height action.

               Last updated 3 mins ago

Card title

                  This is a wider card with supporting text below as a natural
                  lead-in to additional content. This card has even longer
                  content than the first to show that equal height action.

               Last updated 3 mins ago

Card title

                  This is a wider card with supporting text below as a natural
                  lead-in to additional content. This content is a little bit
                  longer.

               Last updated 3 mins ago

Card title

                  This card has supporting text below as a natural lead-in to
                  additional content.

               Last updated 3 mins ago

Card title

                  This is a wider card with supporting text below as a natural
                  lead-in to additional content. This card has even longer
                  content than the first to show that equal height action.

               Last updated 3 mins ago

Card title

                  This is a wider card with supporting text below as a natural
                  lead-in to additional content. This card has even longer
                  content than the first to show that equal height action.

               Last updated 3 mins ago

Card title

                  This is a wider card with supporting text below as a natural
                  lead-in to additional content. This card has even longer
                  content than the first to show that equal height action.

               Last updated 3 mins ago

To fix this problem I customized my card like this:

<!DOCTYPE html>

      <meta charset="utf-8" />
      <meta http-equiv="X-UA-Compatible" content="IE=edge" />
      <meta
         name="viewport"
         content="width=device-width, initial-scale=1, shrink-to-fit=no"
      />
      <link
         rel="stylesheet"
         href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
         integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T"
         crossorigin="anonymous"
      />
      <title></title>

Card title

                  This is a wider card with supporting text below as a natural
                  lead-in to additional content. This content is a little bit
                  longer.

               Last updated 3 mins ago

Card title

                  This card has supporting text below as a natural lead-in to
                  additional content.

               Last updated 3 mins ago

Card title

                  This is a wider card with supporting text below as a natural
                  lead-in to additional content. This card has even longer
                  content than the first to show that equal height action.

               Last updated 3 mins ago

Card title

                  This is a wider card with supporting text below as a natural
                  lead-in to additional content. This card has even longer
                  content than the first to show that equal height action.

               Last updated 3 mins ago

Card title

                  This is a wider card with supporting text below as a natural
                  lead-in to additional content. This content is a little bit
                  longer.

               Last updated 3 mins ago

Card title

                  This card has supporting text below as a natural lead-in to
                  additional content.

               Last updated 3 mins ago

Card title

                  This is a wider card with supporting text below as a natural
                  lead-in to additional content. This card has even longer
                  content than the first to show that equal height action.

               Last updated 3 mins ago

Card title

                  This is a wider card with supporting text below as a natural
                  lead-in to additional content. This card has even longer
                  content than the first to show that equal height action.

               Last updated 3 mins ago

Card title

                  This is a wider card with supporting text below as a natural
                  lead-in to additional content. This card has even longer
                  content than the first to show that equal height action.

               Last updated 3 mins ago

But my solution seems too much convoluted and not in bootstrap style. Is there a more smart way?