问:
React : Why is my localStorage clear on redirect (url change)?
I am trying to persist data between pages, a variable that I collect in my url. So my user will enter a url like : https://my-solution/event/:identifier
I want to keep that identifier but I need to go through authentification first. I store my identifier in the local storage or Session storage before the redirection and when I redirect to https://my-solution/auth, this entry disappear from local storage.

Once the auth succeed and I store my user jwt token in this very same local storage, it persists ! My identifier is been deleted but my token persist (and every variable stored after that btw); After my token is being stored I can redirect all I want, and my data persist. I don't understand what's happening...
It is a create-react-app solution. Working with react-router and redux.
Is this linked to the way I redirect ? I use <Redirect> from react-router but also windows.location.href sometimes (inside useEffect callbacks).

I did tried to store a non-dynamic variable like a basic string :

```<code>localStorage.setItem("test", "mytestValue")
</code>```

And this entry does persists. Is this behavior related to dynamic values ?

I do have a complicated workaround : passing the data through location.search in every url and trying in every component to store it until the data persists in the local storage... But I want to know if I am doing something wrong here.
Thank you !
Here is my architecture flow :

Index.tsx

```<code>import React from 'react';
import ReactDOM from 'react-dom';
import './index.scss';

import App from './App';
import * as serviceWorker from './serviceWorker';
import { BrowserRouter } from 'react-router-dom';
import { createStore, applyMiddleware } from 'redux';
import { Provider } from 'react-redux';
import reducer from './reducers';
import thunk from 'redux-thunk';
import { signalRMiddleware } from './middlewares/signalRMiddleware';

import 'bootstrap/dist/css/bootstrap.css';
import 'primereact/resources/themes/nova/theme.css';
import 'primereact/resources/primereact.min.css';
import 'primeicons/primeicons.css';

const store = process.env.REACT_APP_WITHOUT_SIGNALR == "true" ? createStore(reducer, applyMiddleware(thunk)) : createStore(reducer, applyMiddleware(thunk, signalRMiddleware()))
ReactDOM.render(
    <Provider store={store}>
        <BrowserRouter basename={process.env.PUBLIC_URL}>
            <App />
        </BrowserRouter>
    </Provider>,
    document.getElementById('root')
);
</code>```

App.tsx

```<code>import React from 'react';
import './App.css';
import Router from './components/Router';
import moment from 'moment';
import 'moment/locale/fr';
moment().locale('fr');

function App() {
  return (
      <Router />
  );
}

export default App;
</code>```

Router.index

```<code>import React from 'react';
import { Route, Switch } from 'react-router-dom';
import ProtectedRoute from './ProtectedRoute';
import UtilsService from '../../services/utils.service';

function Router() {
    const AuthRouters = UtilsService.getRoute('/auth').component;
    const BackofficeRouters = UtilsService.getRoute('/backoffice').component;
    const EventLayout = UtilsService.getRoute('/').component;
    const MultiEventLayout = UtilsService.getRoute('/multiEvents').component;
    const ChatLayout = UtilsService.getRoute('/chat').component;
    const ChatOtoLayout = UtilsService.getRoute('/chat_oto').component;
    const QuestionsLayout = UtilsService.getRoute('/questions').component;
    const PlanningLayout = UtilsService.getRoute('/planning').component;
    const AccueilMobileLayout = UtilsService.getRoute('/accueil_mobile').component;

    return (
        <Switch>
            <Route path="/auth" render={(props: any) => <AuthRouters {...props} />} />
            <ProtectedRoute path="/backoffice" isBackoffice={true} render={(props: any) => <BackofficeRouters {...props} exact />} />
            <ProtectedRoute path="/multiEvents" isBackoffice={false} render={(props: any) => <MultiEventLayout {...props} />} />
            <ProtectedRoute path="/room/:id" isBackoffice={false} render={(props: any) => <EventLayout {...props} />} />
            <ProtectedRoute path="/event/:identifier" isBackoffice={false} render={(props: any) => <EventLayout {...props} />} />
            <ProtectedRoute path="/questions/:idButton" isBackoffice={false} render={(props: any) => <QuestionsLayout {...props} />} />
            <ProtectedRoute path="/chat_oto" isBackoffice={false} render={(props: any) => <ChatOtoLayout {...props} />} />
            <ProtectedRoute path="/chat/:id" isBackoffice={false} render={(props: any) => <ChatLayout {...props} />} />
            <ProtectedRoute path="/planning/:idEvent" isBackoffice={false} render={(props: any) => <PlanningLayout {...props} />} />
            <ProtectedRoute path="/accueil_mobile/:idEvent" isBackoffice={false} render={(props: any) => <AccueilMobileLayout {...props} />} />
            <ProtectedRoute path="/" isBackoffice={false} render={(props: any) => <EventLayout {...props} />} />
        </Switch>
    );
}

export default Router;
</code>```

ProtectedRoute.tsx

```<code>return (
        <Route
            {...rest}
            render={props => {
                let eventUrlIdentifier = "";
                if(props.match.path === "/event/:identifier"){
                    let url = props.match.url;
                    let s = url.split("/");
                    eventUrlIdentifier = s[2];
                }
                if (!fetchAllConfLoading && isClientSettingsLoaded) {
                    //process auth anonymous
                    if (user == null) {
                        if (clientSettings.monoEventId != undefined && clientSettings.allowAnonymous != undefined) {
                            if (!clientSettings.allowAnonymous) {
                                // Redirection vers /Auth si la connexion anonyme n'est pas autorisé pour un mono-event
                                return (
                                    <Redirect to={{ pathname: '/Auth', state: { from: props.location }, search: eventUrlIdentifier }} />
                                );
                            }
                            else {
                                return (
                                    <Redirect to={{ pathname: '/auth/anonyme', state: { from: props.location }, search: eventUrlIdentifier }} />
                                );
                            }
                        }
</code>```

Body:
I am trying to persist data between pages, a variable that I collect in my url. So my user will enter a url like : https://my-solution/event/:identifier
I want to keep that identifier but I need to go through authentification first. I store my identifier in the local storage or Session storage before the redirection and when I redirect to https://my-solution/auth, this entry disappear from local storage.

Once the auth succeed and I store my user jwt token in this very same local storage, it persists ! My identifier is been deleted but my token persist (and every variable stored after that btw); After my token is being stored I can redirect all I want, and my data persist. I don't understand what's happening...
It is a create-react-app solution. Working with react-router and redux.
Is this linked to the way I redirect ? I use <Redirect> from react-router but also windows.location.href sometimes (inside useEffect callbacks).

I did tried to store a non-dynamic variable like a basic string :

localStorage.setItem("test", "mytestValue")

And this entry does persists. Is this behavior related to dynamic values ?

I do have a complicated workaround : passing the data through location.search in every url and trying in every component to store it until the data persists in the local storage... But I want to know if I am doing something wrong here.
Thank you !
Here is my architecture flow :

Index.tsx

import React from 'react';
import ReactDOM from 'react-dom';
import './index.scss';

import App from './App';
import * as serviceWorker from './serviceWorker';
import { BrowserRouter } from 'react-router-dom';
import { createStore, applyMiddleware } from 'redux';
import { Provider } from 'react-redux';
import reducer from './reducers';
import thunk from 'redux-thunk';
import { signalRMiddleware } from './middlewares/signalRMiddleware';

import 'bootstrap/dist/css/bootstrap.css';
import 'primereact/resources/themes/nova/theme.css';
import 'primereact/resources/primereact.min.css';
import 'primeicons/primeicons.css';

const store = process.env.REACT_APP_WITHOUT_SIGNALR == "true" ? createStore(reducer, applyMiddleware(thunk)) : createStore(reducer, applyMiddleware(thunk, signalRMiddleware()))
ReactDOM.render(
    <Provider store={store}>
        <BrowserRouter basename={process.env.PUBLIC_URL}>
            <App />
        </BrowserRouter>
    </Provider>,
    document.getElementById('root')
);

App.tsx

import React from 'react';
import './App.css';
import Router from './components/Router';
import moment from 'moment';
import 'moment/locale/fr';
moment().locale('fr');

function App() {
  return (
      <Router />
  );
}

export default App;

Router.index

import React from 'react';
import { Route, Switch } from 'react-router-dom';
import ProtectedRoute from './ProtectedRoute';
import UtilsService from '../../services/utils.service';

function Router() {
    const AuthRouters = UtilsService.getRoute('/auth').component;
    const BackofficeRouters = UtilsService.getRoute('/backoffice').component;
    const EventLayout = UtilsService.getRoute('/').component;
    const MultiEventLayout = UtilsService.getRoute('/multiEvents').component;
    const ChatLayout = UtilsService.getRoute('/chat').component;
    const ChatOtoLayout = UtilsService.getRoute('/chat_oto').component;
    const QuestionsLayout = UtilsService.getRoute('/questions').component;
    const PlanningLayout = UtilsService.getRoute('/planning').component;
    const AccueilMobileLayout = UtilsService.getRoute('/accueil_mobile').component;

    return (
        <Switch>
            <Route path="/auth" render={(props: any) => <AuthRouters {...props} />} />
            <ProtectedRoute path="/backoffice" isBackoffice={true} render={(props: any) => <BackofficeRouters {...props} exact />} />
            <ProtectedRoute path="/multiEvents" isBackoffice={false} render={(props: any) => <MultiEventLayout {...props} />} />
            <ProtectedRoute path="/room/:id" isBackoffice={false} render={(props: any) => <EventLayout {...props} />} />
            <ProtectedRoute path="/event/:identifier" isBackoffice={false} render={(props: any) => <EventLayout {...props} />} />
            <ProtectedRoute path="/questions/:idButton" isBackoffice={false} render={(props: any) => <QuestionsLayout {...props} />} />
            <ProtectedRoute path="/chat_oto" isBackoffice={false} render={(props: any) => <ChatOtoLayout {...props} />} />
            <ProtectedRoute path="/chat/:id" isBackoffice={false} render={(props: any) => <ChatLayout {...props} />} />
            <ProtectedRoute path="/planning/:idEvent" isBackoffice={false} render={(props: any) => <PlanningLayout {...props} />} />
            <ProtectedRoute path="/accueil_mobile/:idEvent" isBackoffice={false} render={(props: any) => <AccueilMobileLayout {...props} />} />
            <ProtectedRoute path="/" isBackoffice={false} render={(props: any) => <EventLayout {...props} />} />
        </Switch>
    );
}

export default Router;

ProtectedRoute.tsx

return (
        <Route
            {...rest}
            render={props => {
                let eventUrlIdentifier = "";
                if(props.match.path === "/event/:identifier"){
                    let url = props.match.url;
                    let s = url.split("/");
                    eventUrlIdentifier = s[2];
                }
                if (!fetchAllConfLoading && isClientSettingsLoaded) {
                    //process auth anonymous
                    if (user == null) {
                        if (clientSettings.monoEventId != undefined && clientSettings.allowAnonymous != undefined) {
                            if (!clientSettings.allowAnonymous) {
                                // Redirection vers /Auth si la connexion anonyme n'est pas autorisé pour un mono-event
                                return (
                                    <Redirect to={{ pathname: '/Auth', state: { from: props.location }, search: eventUrlIdentifier }} />
                                );
                            }
                            else {
                                return (
                                    <Redirect to={{ pathname: '/auth/anonyme', state: { from: props.location }, search: eventUrlIdentifier }} />
                                );
                            }
                        }


来源: stackexchange

问:
Sticky UTM parameters
Currently researching this and wondered if anyone had utilised this approach before.

At the moment, we capture initial UTM parameters for the first visit in a cookie. When they complete the form, their cookie value is output into a hidden form field.

The challenge we have is that when cookies are not accepted, we lose the UTM parameters when they move from page to page.

Would it be reasonable, and legal to use Javascript to append the initial UTM parameters from the landing page, to all links that the person clicks?

For example, they land on example.com?utm_medium=email&utm_source=pardot&utm_campaign=em123, and the UTM parameters get appended to any other links that are on the page. So when they click the link, the UTM parameter is passed through.

Any input would be greatly appreciated.

Thank you

Greg

ContentLicense: CC BY-SA 4.0

Title: Sticky UTM parameters


问:
safari compatibility issue - crowd signal polls results not showing up
I have a poll from crowd signal previously known as poll daddy. the default behavior is that once you submit a response it should automatically show the results from all the responses like the normal polls such as LinkedIn polls.

But what happens here is that it does not show the results after submission on safari. The only possible reason I suspect is that we are rendering it inside iframe but not sure why.

I am attaching a sandbox example for the reference.
sandbox example

I tried it without iframe and it works but I want it inside iframe this is how it is implemented on production.


问:
How webpack override html body/head tags
I am new at webpack functionality. I read tons of official docs, checked official webpack-html-plugin docs, but I can't find answer.

The question is: is it possible to override html script/link tags using:

```<code>npm run build
</code>```

Or if not, how can I do it?

I have build of vue-cli module at another repository. This build is generated as bundled dist folder with app.[hash].js, chunk-vendors.[hash].js and app.[hash].css

My mission is to create a build with some technology, what can find new hashes, and override html file with new files ( with new hash ). It is possible to use number of paths. I build some webpack config file, but I don't understand options.

First, I will show my structure:

node_modules

webpack-test-module / a module that has generated bundled js/vendors/css.
for claryfication, at this moment here is full repository download from
git. Webpack module has a dist folder, where are build files mentioned
above

vue-cli files

dist

css

app.[hash].css // path to this file has to be changed in html

js

app.[hash].js  // path to this file has to be changed in html

chunk-vendors.[hash].js // path to this file has to be changed in html

index.html // it is possible to generate this html file, where hashes changes
easly, so it is posible to override new html with this html file?

dist / where is generated build of second project

webpack.config.js

template.html / this is example html file

index.html / this is target html, that has to be changed, or
generated new at dist/index.html. Doesn't matter

other vue-vite files

The most important thing is, that when someone do a patch with fixes, hashes will change. So when I have a php/html files when I am links a path to this files, With every patch ( new generation ) I have new hashes ( for avoiding cache errors ). If I have new hashes, I have to change all destinations in all files that uses this updated files.

Important thing is that, I made a npm module from my package. It helps to download new version, without copy/pasting.

So, here is my webpack.config.js ( but it is not last version, I am testing it, but nothing works like expected):

```<code>const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {
  entry: './node_modules/[module_name]/src/main.js', / I don't understand this option
  output: {

    filename: '[name].[contenthash].js', / this create a file in dist destination?
    path: path.resolve(__dirname, 'dist'),
    clean: true,
  },
  plugins: [
    // here is a true problem. This plugin is doing, what i wants, but how to
    configure this to get expected html changes.
    new HtmlWebpackPlugin({
      template: 'testTemplate.html',
      filename: 'index.html',
      publicPath: './node_modules/[module_name]/testPackage/'
    }),
  ],
};
</code>```

I know that my question is large, and maybe not easy to understand, but this is what I need to do. Hard task, but really impressive.

If I am asking, I want to ask is it possible to override php file too at the same time?

P.S
HTML Template:

```<code><!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <link rel="icon" type="image/svg+xml" href="/vite.svg" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Vite + Vue</title>
    <%= htmlWebpackPlugin.tags.headTags %>
  </head>
  <body>
    <div>
      <div id="[module_div_id]"></div>
      <button type="button" onclick="vueSidebar.open()">Hello</button>
    </div>
      <script type="module" src="/src/main.js"></script>
      <%= htmlWebpackPlugin.tags.bodyTags %>
  </body>
</html>
</code>```

Body:
I am new at webpack functionality. I read tons of official docs, checked official webpack-html-plugin docs, but I can't find answer.

The question is: is it possible to override html script/link tags using:

npm run build

Or if not, how can I do it?

I have build of vue-cli module at another repository. This build is generated as bundled dist folder with app.[hash].js, chunk-vendors.[hash].js and app.[hash].css

My mission is to create a build with some technology, what can find new hashes, and override html file with new files ( with new hash ). It is possible to use number of paths. I build some webpack config file, but I don't understand options.

First, I will show my structure:

node_modules

webpack-test-module / a module that has generated bundled js/vendors/css.
for claryfication, at this moment here is full repository download from
git. Webpack module has a dist folder, where are build files mentioned
above

vue-cli files

dist

css

app.[hash].css // path to this file has to be changed in html

js

app.[hash].js  // path to this file has to be changed in html

chunk-vendors.[hash].js // path to this file has to be changed in html

index.html // it is possible to generate this html file, where hashes changes
easly, so it is posible to override new html with this html file?

dist / where is generated build of second project

webpack.config.js

template.html / this is example html file

index.html / this is target html, that has to be changed, or
generated new at dist/index.html. Doesn't matter

other vue-vite files

The most important thing is, that when someone do a patch with fixes, hashes will change. So when I have a php/html files when I am links a path to this files, With every patch ( new generation ) I have new hashes ( for avoiding cache errors ). If I have new hashes, I have to change all destinations in all files that uses this updated files.

Important thing is that, I made a npm module from my package. It helps to download new version, without copy/pasting.

So, here is my webpack.config.js ( but it is not last version, I am testing it, but nothing works like expected):

const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {
  entry: './node_modules/[module_name]/src/main.js', / I don't understand this option
  output: {

    filename: '[name].[contenthash].js', / this create a file in dist destination?
    path: path.resolve(__dirname, 'dist'),
    clean: true,
  },
  plugins: [
    // here is a true problem. This plugin is doing, what i wants, but how to
    configure this to get expected html changes.
    new HtmlWebpackPlugin({
      template: 'testTemplate.html',
      filename: 'index.html',
      publicPath: './node_modules/[module_name]/testPackage/'
    }),
  ],
};

I know that my question is large, and maybe not easy to understand, but this is what I need to do. Hard task, but really impressive.

If I am asking, I want to ask is it possible to override php file too at the same time?

P.S
HTML Template:

<!DOCTYPE html>

    <meta charset="UTF-8" />
    <link rel="icon" type="image/svg+xml" href="/vite.svg" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Vite + Vue</title>
    <%= htmlWebpackPlugin.tags.headTags %>

      <button type="button" onclick="vueSidebar.open()">Hello</button>

      <%= htmlWebpackPlugin.tags.bodyTags %>


问:
React - framer-motion / hook inside loop
I'm using framer-motion and I have a list of animations (coming from Sanity CMS - I guess it actually doesn't matter).
I have to convert those style into some Motion value, but my problem is that I have to use the 'useTransform' hook inside a loop. And this breaks the app. Any idea how I could convert this hook?

```<code>import { SanityAnimation } from '@sonos-inc/web-lib-types'
import { MotionProps, useTransform, useViewportScroll } from 'framer-motion'

export const useSanityScrollAnimations = (
  scrollStart: number,
  scrollEnd: number,
  animations?: Array<SanityAnimation & { startOffset?: number }>
): MotionProps['style'] => {
  try {
    if (animations?.length) {
      return Object.fromEntries(
        animations.map((a) => {
          const { animation, direction, value } = a

          // eslint-disable-next-line react-hooks/rules-of-hooks
          const { scrollYProgress } = useViewportScroll()

          // eslint-disable-next-line react-hooks/rules-of-hooks
          const rawValue = useTransform(
            scrollYProgress,
            [scrollStart, scrollEnd],
            [direction === 'from' ? value : 0, direction === 'to' ? value : 0]
          )

          // eslint-disable-next-line react-hooks/rules-of-hooks
          const percent = useTransform(rawValue, (val) => `${val ?? 0}%`)

          return [animation, percent]
        })
      )
    }
  } catch (e) {
    console.error('Error in useSanityScrollAnimations:\n', e)
  }

  return {}
}

</code>```

I would like to convert this code to work without breaking the rules of hook.

Body:
I'm using framer-motion and I have a list of animations (coming from Sanity CMS - I guess it actually doesn't matter).
I have to convert those style into some Motion value, but my problem is that I have to use the 'useTransform' hook inside a loop. And this breaks the app. Any idea how I could convert this hook?

import { SanityAnimation } from '@sonos-inc/web-lib-types'
import { MotionProps, useTransform, useViewportScroll } from 'framer-motion'

export const useSanityScrollAnimations = (
  scrollStart: number,
  scrollEnd: number,
  animations?: Array<SanityAnimation & { startOffset?: number }>
): MotionProps['style'] => {
  try {
    if (animations?.length) {
      return Object.fromEntries(
        animations.map((a) => {
          const { animation, direction, value } = a

          // eslint-disable-next-line react-hooks/rules-of-hooks
          const { scrollYProgress } = useViewportScroll()

          // eslint-disable-next-line react-hooks/rules-of-hooks
          const rawValue = useTransform(
            scrollYProgress,
            [scrollStart, scrollEnd],
            [direction === 'from' ? value : 0, direction === 'to' ? value : 0]
          )

          // eslint-disable-next-line react-hooks/rules-of-hooks
          const percent = useTransform(rawValue, (val) => `${val ?? 0}%`)

          return [animation, percent]
        })
      )
    }
  } catch (e) {
    console.error('Error in useSanityScrollAnimations:\n', e)
  }

  return {}
}

I would like to convert this code to work without breaking the rules of hook.


问:
BlazorStrap page responsiveness is snappy
I am new to BlazorStrap, I have just set up the whole stuff in my VS Code environment, following the instructions in https://blazorstrap.io/V5/, then I have written a simple page, as a sanity check. The dotnet runtime is 6.0.404.

I am checking the result by typing "dotnet watch run", and it seems to be working, but the responsiveness is really snappy. When I widen or narrow the browser window, text position jumps left or right, presumably when the various breakpoints are reached. I would expect a smooth transition instead. My previous projects (PHP + BootStrap) work smoothly.

Any suggestion would be appreciated.

Here is my index.html file:

```<code><!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <title>BlazorStrapTest</title>
    <base href="/" />
    <link href="css/bootstrap/bootstrap.min.css" rel="stylesheet" integrity="if_needed" />
    <link href="css/app.css" rel="stylesheet" />
    <link href="BlazorStrapTest.styles.css" rel="stylesheet" />
</head>

<body>
    <div id="app">Loading...</div>

    <div id="blazor-error-ui">
        An unhandled error has occurred.
        <a href="" class="reload">Reload</a>
        <a class="dismiss"></a>
    </div>
    <script src="_framework/blazor.webassembly.js"></script>
    <script src="_content/BlazorStrap/popper.min.js"></script>
    <script src="_content/BlazorStrap/blazorstrap.js"></script>
</body>

</html>
</code>```

All links and references are valid.

Here is the MainLayout.razor:

```<code>@inherits LayoutComponentBase

<BSContainer>
    @Body
</BSContainer>
</code>```

And this is the Index.razor:

```<code>@page "/"

<PageTitle>Index</PageTitle>

<h1>Hello, BlazorStrap!</h1>
</code>```

Body:
I am new to BlazorStrap, I have just set up the whole stuff in my VS Code environment, following the instructions in https://blazorstrap.io/V5/, then I have written a simple page, as a sanity check. The dotnet runtime is 6.0.404.

I am checking the result by typing "dotnet watch run", and it seems to be working, but the responsiveness is really snappy. When I widen or narrow the browser window, text position jumps left or right, presumably when the various breakpoints are reached. I would expect a smooth transition instead. My previous projects (PHP + BootStrap) work smoothly.

Any suggestion would be appreciated.

Here is my index.html file:

<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <title>BlazorStrapTest</title>
    <base href="/" />
    <link href="css/bootstrap/bootstrap.min.css" rel="stylesheet" integrity="if_needed" />
    <link href="css/app.css" rel="stylesheet" />
    <link href="BlazorStrapTest.styles.css" rel="stylesheet" />

Loading...

        An unhandled error has occurred.
        Reload

All links and references are valid.

Here is the MainLayout.razor:

@inherits LayoutComponentBase

<BSContainer>
    @Body
</BSContainer>

And this is the Index.razor:

@page "/"

<PageTitle>Index</PageTitle>

Hello, BlazorStrap!


问:
What is Github copilot scanning on the computer?
I use Github copilot with my visual studio instance.
While I was developping, I wanted to test a SQL request. I opened a terminal, launched psql and did my tests in it. That was garbage tests with table named like "dfoinacfqx"

Back in vscode, I begin to write my results, then I saw that github copilot autocompleted my line with the full result I had in my psql terminal. I know that copilot has scanned it because it was keeping my tables "dfoinacfqx" in the suggestions...

So my question if the following: is it normal that copilot is not limited to vscode instance, and what is it scanning on the computer? I find it weird that he can scan everything on the computer. Is there a page where the scope of Copilot is clearly defined? I can't find anyone


问:
how to convert postgres query looking for records where value appears only once to knex
I am trying to convert a postgres valid query that returns what I require to a knex query...
I keep getting various errors and can't write the knex query properly.
I have several versions of the query in postgres to find records in a table that appear only once and that have a specific user_id.
here are the different variants:

```<code>select * from project_authors t1
where (select count(*) from project_authors t2
  where t1.project_id = t2.project_id) = 1
  AND t1.user_id=2
</code>```

OR

```<code>select * from project_authors t1
where NOT exists
      (select 1 from project_authors t2
       where t1.project_id = t2.project_id and t1.user_id <> t2.user_id) AND t1.user_id=2
</code>```

OR

```<code>select * from project_authors t1
INNER JOIN (SELECT t3.project_id FROM project_authors t3 GROUP BY t3.project_id
            HAVING COUNT (t3.project_id)=1) t2
            ON t1.project_id=t2.project_id Where t1.user_id=2
</code>```

the way I write the knex query is using parameters supplied in the request (for example):

```<code>const _readDbSingleAuthor = (table1, column1, criteria) => {
  return db(`${table1} as t1`)
    .select("*")
    .where(
      db(`${table1} as t2`)
        .select("*")
        .count("*")
        .where(`t1.${column1}`, "=", `t2.${column1}`),
      "=",
      1
    )
    .andWhere(criteria);
</code>```

I would appreciate any help...

the version above gave me a "maximum call stack exceeded" - so I hit the stackoverflow literally.

a version using join was the closest thing but gave me a result saying that the project_id column was ambiguous:

```<code>const _readDbSingleAuthor = (table1, data, column1, criteria) => {
  return db
    .select(data)
    .from(`${table1} as t1`)
    .join(
      db
        .select(column1)
        .from(`${table1} as t3`)
        .count(`${column1} as count`)
        .groupBy(column1)
        .having("t3.count", "=", 1)
        .as("t2"),
      `t2.${column1}`,
      "=",
      `t1.${column1}`
    )
    .where(criteria);
};
</code>```

Body:
I am trying to convert a postgres valid query that returns what I require to a knex query...
I keep getting various errors and can't write the knex query properly.
I have several versions of the query in postgres to find records in a table that appear only once and that have a specific user_id.
here are the different variants:

select * from project_authors t1
where (select count(*) from project_authors t2
  where t1.project_id = t2.project_id) = 1
  AND t1.user_id=2

OR

select * from project_authors t1
where NOT exists
      (select 1 from project_authors t2
       where t1.project_id = t2.project_id and t1.user_id <> t2.user_id) AND t1.user_id=2

OR

select * from project_authors t1
INNER JOIN (SELECT t3.project_id FROM project_authors t3 GROUP BY t3.project_id
            HAVING COUNT (t3.project_id)=1) t2
            ON t1.project_id=t2.project_id Where t1.user_id=2

the way I write the knex query is using parameters supplied in the request (for example):

const _readDbSingleAuthor = (table1, column1, criteria) => {
  return db(`${table1} as t1`)
    .select("*")
    .where(
      db(`${table1} as t2`)
        .select("*")
        .count("*")
        .where(`t1.${column1}`, "=", `t2.${column1}`),
      "=",
      1
    )
    .andWhere(criteria);

I would appreciate any help...

the version above gave me a "maximum call stack exceeded" - so I hit the stackoverflow literally.

a version using join was the closest thing but gave me a result saying that the project_id column was ambiguous:

const _readDbSingleAuthor = (table1, data, column1, criteria) => {
  return db
    .select(data)
    .from(`${table1} as t1`)
    .join(
      db
        .select(column1)
        .from(`${table1} as t3`)
        .count(`${column1} as count`)
        .groupBy(column1)
        .having("t3.count", "=", 1)
        .as("t2"),
      `t2.${column1}`,
      "=",
      `t1.${column1}`
    )
    .where(criteria);
};


问:
How do I avoid CORS error with VueJS with Nginx and Flask
I've got a backend (flask) and a frontend (vuejs) project for my work. I've dockerized them both, I also use nginx docker image for frontend build, and I run these to containers on a google cloud machine. My problem is, when I make a request to backend with postman it works. However when I do that same request with vuejs (axios) it gets CORS error. I've check some posts and I've added Flask-Cors package to backend

```<code>from flask import Flask
from flask_cors import CORS

app = Flask(__name__)
CORS(app)

@app.route("/login", methods=["post"])
def login():
  ...
</code>```

On the other hand, when I build this project in another server in my office, it works. It gets no CORS error. But in google machine it does. I've also added Access-Control-Allow-Origin: * to nginx.conf and it did not work

```<code>events {
  worker_connections  4096;  ## Default: 1024
}

http {
  include /etc/nginx/mime.types;

  server {

    listen 80;

    add_header Access-Control-Allow-Origin *;

    location / {
      root   /usr/share/nginx/html;
      index  index.html index.htm;
      try_files $uri $uri/ /index.html;
    }

    location ~ ^/(images|javascript|js|css|flash|media|static)/  {
      root    /usr/share/nginx/html;
    }

    error_page   500 502 503 504  /50x.html;

    location = /50x.html {
      root   /usr/share/nginx/html;
    }

  }
}
</code>```

Finally, I've added Access-Control-Allow-Origin: * to axios config in VueJs like this in main.js:

```<code>import Vue from 'vue'
import App from './App.vue'
import axios from 'axios'

axios.defaults.headers.common['Access-Control-Allow-Origin'] = '*'

new Vue({
  render: h => h(App)
}).$mount('#app')
</code>```

Like I said in a different server, it works fine. But when I run these containers on google machine. It gets cors error.

Body:
I've got a backend (flask) and a frontend (vuejs) project for my work. I've dockerized them both, I also use nginx docker image for frontend build, and I run these to containers on a google cloud machine. My problem is, when I make a request to backend with postman it works. However when I do that same request with vuejs (axios) it gets CORS error. I've check some posts and I've added Flask-Cors package to backend

from flask import Flask
from flask_cors import CORS

app = Flask(__name__)
CORS(app)

@app.route("/login", methods=["post"])
def login():
  ...

On the other hand, when I build this project in another server in my office, it works. It gets no CORS error. But in google machine it does. I've also added Access-Control-Allow-Origin: * to nginx.conf and it did not work

events {
  worker_connections  4096;  ## Default: 1024
}

http {
  include /etc/nginx/mime.types;

  server {

    listen 80;

    add_header Access-Control-Allow-Origin *;

    location / {
      root   /usr/share/nginx/html;
      index  index.html index.htm;
      try_files $uri $uri/ /index.html;
    }

    location ~ ^/(images|javascript|js|css|flash|media|static)/  {
      root    /usr/share/nginx/html;
    }

    error_page   500 502 503 504  /50x.html;

    location = /50x.html {
      root   /usr/share/nginx/html;
    }

  }
}

Finally, I've added Access-Control-Allow-Origin: * to axios config in VueJs like this in main.js:

import Vue from 'vue'
import App from './App.vue'
import axios from 'axios'

axios.defaults.headers.common['Access-Control-Allow-Origin'] = '*'

new Vue({
  render: h => h(App)
}).$mount('#app')

Like I said in a different server, it works fine. But when I run these containers on google machine. It gets cors error.


问:
i'm creating a api in nest js with mongoose. i'm want to pass my state id in the city so what is the type of validation of state_id?
here is my citydto.ts

```<code>export class CityDto{

    @IsString()
    @IsNotEmpty()
    name:string

    @IsNotEmpty()
    @Validate(Unique, [state_id])
     state_id:string

}

</code>```

how can i apply the validation on stat_id. the state_id store directly with the name of city in my database but i want to validate my state_id???
here is my city.schema.ts file

```<code>

export const CitySchema = new mongoose.Schema({
    id:{type:mongoose.Types.ObjectId},
    name:{type:String,required:true},
    state_id:{type:mongoose.Types.ObjectId,unique:true}
  })
</code>```

Body:
here is my citydto.ts

export class CityDto{

    @IsString()
    @IsNotEmpty()
    name:string

    @IsNotEmpty()
    @Validate(Unique, [state_id])
     state_id:string

}

how can i apply the validation on stat_id. the state_id store directly with the name of city in my database but i want to validate my state_id???
here is my city.schema.ts file

export const CitySchema = new mongoose.Schema({
    id:{type:mongoose.Types.ObjectId},
    name:{type:String,required:true},
    state_id:{type:mongoose.Types.ObjectId,unique:true}
  })


问:
Why Does pd.DataFrame.to_sql() Return a Negative Number?
I assumed the to_sql method on dataframes return the number of records inserted into a table. But I am inserting into an MSSQL server hosted in azure cloud with the following stacks

```<code>sqlalchemy==1.4.44
pandas==1.5.2
</code>```

python 3.10 and ubuntu 22.04. The insert is working alright, but it seems the above method is returning either 1 or -1. The 1 is usually correct, when I do insert a single record, but how can it be -1 if I insert more records?

Added the entire function I am using for this.

```<code>def push_to_database(frame: pd.DataFrame, tab_name: str) -> None:
    """Push a dataframe to Production MSSQL database."""
    with create_engine(url=URI).connect() as client:
        logging.debug(msg=f'Attempting to insert {len(frame)} rows.')
        rows: int = cast(typ=int,
                         val=frame.to_sql(name=tab_name, con=client,
                                          if_exists='append',
                                          index=False))
        logging.info(msg=f'Inserted {rows} records into table {tab_name}.')
        logging.debug(msg=frame.head(n=1))
</code>```

Body:
I assumed the to_sql method on dataframes return the number of records inserted into a table. But I am inserting into an MSSQL server hosted in azure cloud with the following stacks

sqlalchemy==1.4.44
pandas==1.5.2

python 3.10 and ubuntu 22.04. The insert is working alright, but it seems the above method is returning either 1 or -1. The 1 is usually correct, when I do insert a single record, but how can it be -1 if I insert more records?

Added the entire function I am using for this.

def push_to_database(frame: pd.DataFrame, tab_name: str) -> None:
    """Push a dataframe to Production MSSQL database."""
    with create_engine(url=URI).connect() as client:
        logging.debug(msg=f'Attempting to insert {len(frame)} rows.')
        rows: int = cast(typ=int,
                         val=frame.to_sql(name=tab_name, con=client,
                                          if_exists='append',
                                          index=False))
        logging.info(msg=f'Inserted {rows} records into table {tab_name}.')
        logging.debug(msg=frame.head(n=1))


问:
To write code for long and short for back testing
```<code>strategy(title="ORB 30 Min By GEOS DEVELOPERS", shorttitle="ORB 30 BTCUSDT Future", overlay=true)
up15on = input(true, title="15 Minute Opening Range High")
down15on = input(true, title="15 Minute Opening Range Low")

is_newbar(res) => change(time(res)) != 0

adopt(r, s) => security(tickerid, r, s)

high_range = valuewhen(is_newbar('D'),high,0)
low_range = valuewhen(is_newbar('D'),low,0)

high_rangeL = valuewhen(is_newbar('D'),high,0)
low_rangeL = valuewhen(is_newbar('D'),low,0)

up15 = plot(up15on ? adopt('30', high_rangeL): na, color = #009900, linewidth=2)
down15 = plot(down15on ? adopt('30', low_rangeL): na, color = #ff0000, linewidth=2)

trans15 = up15on ?  97 : 100
fill(up15, down15, color = white, transp=trans15)
</code>```

Can anybody let me know how to add long and short line of code.. please support

Body:
strategy(title="ORB 30 Min By GEOS DEVELOPERS", shorttitle="ORB 30 BTCUSDT Future", overlay=true)
up15on = input(true, title="15 Minute Opening Range High")
down15on = input(true, title="15 Minute Opening Range Low")

is_newbar(res) => change(time(res)) != 0

adopt(r, s) => security(tickerid, r, s)

high_range = valuewhen(is_newbar('D'),high,0)
low_range = valuewhen(is_newbar('D'),low,0)

high_rangeL = valuewhen(is_newbar('D'),high,0)
low_rangeL = valuewhen(is_newbar('D'),low,0)

up15 = plot(up15on ? adopt('30', high_rangeL): na, color = #009900, linewidth=2)
down15 = plot(down15on ? adopt('30', low_rangeL): na, color = #ff0000, linewidth=2)

trans15 = up15on ?  97 : 100
fill(up15, down15, color = white, transp=trans15)

Can anybody let me know how to add long and short line of code.. please support


问:
run gulp command show hundreds of errors
I have a client side project written in aurelia and when im run the command "gulp watch"
i get alot of errors maybe a few hundreds and then it finish build and everitihng working fine, the rebuild after save changes show no error and finish at once

a few error for example:

gulp-notify: [Error running Gulp]  node_modules/aurelia-dependency-injection/dist/aurelia-dependency-injection.d.ts(173,69): error TS2304: Cannot find name 'TArgs'.

gulp-notify: [Error running Gulp]  node_modules/aurelia-dependency-injection/dist/aurelia-dependency-injection.d.ts(173,77): error TS2304: Cannot find name 'TBase'.

gulp-notify: [Error running Gulp] Error: src\app\people\peopleView.ts(8,2): error TS2346: Supplied parameters do not match any signature of call target.

I assume it's somthing with tsconfig.json or some package that dont mmatch the node version

win 10 64bit

node: 11.15.0

npm: 6.7.0

How to avoid all these errors?


问:
Creating a multi-level survey online
I'm searching for a way to reproduce the type of survey below.

Form that I want

With Google Forms I'm not able to do so because I can't create a multi-level question.

Title: Creating a multi-level survey online


问:
ModuleNotFoundError: No module named 'LS.settings'
ModuleNotFoundError: No module named 'LS.settings'
LS is my project name

```<code>File "C:\Users\user\Desktop\LS\venv\Lib\site-packages\django\conf\__init__.py", line 190, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1142, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'LS.settings'

</code>```

I tried to change my settings.py file and wsgi.py too.. but nothing worked
In settings.py

```<code>import os

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = os.Path.dirname(os.Path.dirname(os.Path.dirname(__file__)))

#settings
from pathlib import Path

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-4o%nqtij3bmt!v)74+p@7d!t8w&u98&l&5%55fc81pw$$$tjx&'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []

</code>```

Body:
ModuleNotFoundError: No module named 'LS.settings'
LS is my project name

File "C:\Users\user\Desktop\LS\venv\Lib\site-packages\django\conf\__init__.py", line 190, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1142, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'LS.settings'

I tried to change my settings.py file and wsgi.py too.. but nothing worked
In settings.py

import os

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = os.Path.dirname(os.Path.dirname(os.Path.dirname(__file__)))

#settings
from pathlib import Path

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-4o%nqtij3bmt!v)74+p@7d!t8w&u98&l&5%55fc81pw$$$tjx&'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []


问:
How to wait for child components being bound in Svelte?
I have a component (SomeComponent) which creates other child components (ChildComponent). I wonder how i can wait for the child components getting bound to a reference array. I would like to call methods in SomeComponent and its ChildComponents but get an empty array (childs). I tried waiting via onMount and await tick() in the parent before calling calledFromParent() but nothing works. How do i wait for the childs array being filled? (Note: my code is working if i delay the calls via setInterval in the parent)

{#each data.childs as child, index}
    <ChildComponent bind:this={childs[index]}/>
{/each}```

Edit: data gets loaded async in parent and then injected via calledFromParent(pData) into SomeComponent

Body:
I have a component (SomeComponent) which creates other child components (ChildComponent). I wonder how i can wait for the child components getting bound to a reference array. I would like to call methods in SomeComponent and its ChildComponents but get an empty array (childs). I tried waiting via onMount and await tick() in the parent before calling calledFromParent() but nothing works. How do i wait for the childs array being filled? (Note: my code is working if i delay the calls via setInterval in the parent)

{#each data.childs as child, index}
    <ChildComponent bind:this={childs[index]}/>
{/each}

Edit: data gets loaded async in parent and then injected via calledFromParent(pData) into SomeComponent


问:
Passing Props (NOT FROM URL) with vue-router to a component - VUEJS3
I am trying to pass props (not params from URL) to a component by using vue-router, as I have researched it was possible with vuejs2 but haven't found solutions for vuejs3 and vue-router</p>


问:
mysql workbench does not announce warnings
As it is clear in the following code, at first I activated the session and global modes, which also includes division by zero. In the next line, I count 13/0, but the mysql workbench does not show any warnings in the output . But the mysql command line client announces this warning. What is the cause? Is this a bug?

```<code>select @@global.sql_mode;
select @@session.sql_mode;
set global sql_mode='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';
set session sql_mode='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';
select 1/0;
show warnings;
</code>```

mysql workbench output:

mysql command line client output:

Body:
As it is clear in the following code, at first I activated the session and global modes, which also includes division by zero. In the next line, I count 13/0, but the mysql workbench does not show any warnings in the output . But the mysql command line client announces this warning. What is the cause? Is this a bug?

select @@global.sql_mode;
select @@session.sql_mode;
set global sql_mode='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';
set session sql_mode='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';
select 1/0;
show warnings;

mysql workbench output:

mysql command line client output:


问:
RazorPay : jitpack maven-metadata.xml error 521
I am using razorpay in already developed react native app, but got error .
Could not GET 'https://www.jitpack.io/com/razorpay/checkout/maven-metadata.xml'. Received status code 521 from server: . does anyone has any idea about this that will be very appreciable.


问:
Why can't the subset be both simultaneously when generating the dataset?
When I'm generating the dataset through tf.keras.preprocessing.image_dataset_from_directory, I'm getting the error. I'm following this source for learning Image classification from scratch](https://www.stackoverflow.com/) computer vision.

```<code>image_size = (180, 180)
batch_size = 128

train_ds, val_ds = tf.keras.preprocessing.image_dataset_from_directory(
    "PetImages",
    validation_split=0.2,
    subset="both",
    seed=1337,
    image_size=image_size,
    batch_size=batch_size,
)
</code>```

Error:

```<code>ValueError: `subset` must be either "training" or "validation", received: both
</code>```

Source

Body:
When I'm generating the dataset through tf.keras.preprocessing.image_dataset_from_directory, I'm getting the error. I'm following this source for learning Image classification from scratch](https://www.stackoverflow.com/) computer vision.

image_size = (180, 180)
batch_size = 128

train_ds, val_ds = tf.keras.preprocessing.image_dataset_from_directory(
    "PetImages",
    validation_split=0.2,
    subset="both",
    seed=1337,
    image_size=image_size,
    batch_size=batch_size,
)

Error:

ValueError: `subset` must be either "training" or "validation", received: both

Source


问:
Not saving to database, Spring Boot, Hibernate, PostgreSQL
Spring Boot 3.0.0 application, after filling out the form and submitting it, the input field is cleared, but saving to the corresponding database table does not occur. There are no errors in the log.

Model

```<code>import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;

@Entity
public class Message {
    @Id
    @GeneratedValue(strategy= GenerationType.AUTO)
    private Integer id;
    private String text;

    public Message() {
    }

    public Message(String text) {
        this.text = text;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }
}

</code>```

Repository

```<code>import kz.onlineshelter.helppet.model.Message;
import org.springframework.data.repository.CrudRepository;

public interface MessageRepository extends CrudRepository<Message, Long> {}
</code>```

Controller

```<code>import kz.onlineshelter.helppet.model.Message;
import kz.onlineshelter.helppet.repository.MessageRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@Controller
@RequestMapping(method={RequestMethod.POST,RequestMethod.GET})
public class AppController {
    private final MessageRepository messageRepository;

    @Autowired
    public AppController(MessageRepository messageRepository) {
        this.messageRepository = messageRepository;
    }

    @GetMapping("/message")
    public String message(Map<String, Object> model) {
        Iterable<Message> messages = messageRepository.findAll();

        model.put("messages", messages);

        return "message";
    }

    @PostMapping
    public String add(@RequestParam String text, Map<String, Object> model) {
        Message message = new Message(text);

        messageRepository.save(message);

        Iterable<Message> messages = messageRepository.findAll();

        model.put("messages", messages);

        return "message";
    }
}
</code>```

Application

```<code>import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class HelppetApplication {
   public static void main(String[] args) {
      SpringApplication.run(HelppetApplication.class, args);
   }
}
</code>```

resources/templates/message.mustache

```<code><html>

<body>
<div>
    <form method="post">
        <input type="text" name="text" placeholder="Enter your text" /><br>
        <button type="submit">Add</button>
    </form>
</div>
<div>List of messages</div>
{{#messages}}
    <div>
        <span>{{text}}</span>
    </div>
{{/messages}}
</body>
</html>
</code>```

application.properties

```<code>spring.datasource.url=jdbc:postgresql://localhost:5432/***
spring.datasource.username=***
spring.datasource.password=***
spring.jpa.generate-ddl=true
</code>```

pom.xml

```<code><?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/> <!-- lookup parent from repository -->
   </parent>
   <groupId>***</groupId>
   <artifactId>helppet</artifactId>
   <version>0.0.1-SNAPSHOT</version>
   <packaging>war</packaging>
   <name>***</name>
   <description>***</description>
   <properties>
      <java.version>17</java.version>
   </properties>
   <dependencies>
      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-data-jpa</artifactId>
      </dependency>
      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-mustache</artifactId>
      </dependency>
      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-web</artifactId>
      </dependency>
      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-devtools</artifactId>
         <scope>runtime</scope>
         <optional>true</optional>
      </dependency>
      <dependency>
         <groupId>org.postgresql</groupId>
         <artifactId>postgresql</artifactId>
         <scope>runtime</scope>
      </dependency>
      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-tomcat</artifactId>
         <scope>provided</scope>
      </dependency>
      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-test</artifactId>
         <scope>test</scope>
      </dependency>
   </dependencies>

   <build>
      <plugins>
         <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
         </plugin>
      </plugins>
   </build>

</project>
</code>```

log file

```<code>"C:\Program Files\BellSoft\LibericaJDK-17\bin\java.exe" -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2021.2.2\lib\idea_rt.jar=63010:C:\Program Files\JetBrains\IntelliJ IDEA 2021.2.2\bin" -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true -Dfile.encoding=UTF-8 -classpath "C:\java projects\helppet\target\classes;C:\Users\Admin\.m2\repository\org\springframework\boot\spring-boot-starter-data-jpa\3.0.0\spring-boot-starter-data-jpa-3.0.0.jar;C:\Users\Admin\.m2\repository\org\springframework\boot\spring-boot-starter-aop\3.0.0\spring-boot-starter-aop-3.0.0.jar;C:\Users\Admin\.m2\repository\org\springframework\spring-aop\6.0.2\spring-aop-6.0.2.jar;C:\Users\Admin\.m2\repository\org\aspectj\aspectjweaver\1.9.9.1\aspectjweaver-1.9.9.1.jar;C:\Users\Admin\.m2\repository\org\springframework\boot\spring-boot-starter-jdbc\3.0.0\spring-boot-starter-jdbc-3.0.0.jar;C:\Users\Admin\.m2\repository\com\zaxxer\HikariCP\5.0.1\HikariCP-5.0.1.jar;C:\Users\Admin\.m2\repository\org\springframework\spring-jdbc\6.0.2\spring-jdbc-6.0.2.jar;C:\Users\Admin\.m2\repository\org\hibernate\orm\hibernate-core\6.1.5.Final\hibernate-core-6.1.5.Final.jar;C:\Users\Admin\.m2\repository\jakarta\persistence\jakarta.persistence-api\3.1.0\jakarta.persistence-api-3.1.0.jar;C:\Users\Admin\.m2\repository\jakarta\transaction\jakarta.transaction-api\2.0.1\jakarta.transaction-api-2.0.1.jar;C:\Users\Admin\.m2\repository\org\jboss\logging\jboss-logging\3.5.0.Final\jboss-logging-3.5.0.Final.jar;C:\Users\Admin\.m2\repository\org\hibernate\common\hibernate-commons-annotations\6.0.2.Final\hibernate-commons-annotations-6.0.2.Final.jar;C:\Users\Admin\.m2\repository\org\jboss\jandex\2.4.2.Final\jandex-2.4.2.Final.jar;C:\Users\Admin\.m2\repository\com\fasterxml\classmate\1.5.1\classmate-1.5.1.jar;C:\Users\Admin\.m2\repository\net\bytebuddy\byte-buddy\1.12.19\byte-buddy-1.12.19.jar;C:\Users\Admin\.m2\repository\org\glassfish\jaxb\jaxb-runtime\4.0.1\jaxb-runtime-4.0.1.jar;C:\Users\Admin\.m2\repository\org\glassfish\jaxb\jaxb-core\4.0.1\jaxb-core-4.0.1.jar;C:\Users\Admin\.m2\repository\org\eclipse\angus\angus-activation\1.0.0\angus-activation-1.0.0.jar;C:\Users\Admin\.m2\repository\org\glassfish\jaxb\txw2\4.0.1\txw2-4.0.1.jar;C:\Users\Admin\.m2\repository\com\sun\istack\istack-commons-runtime\4.1.1\istack-commons-runtime-4.1.1.jar;C:\Users\Admin\.m2\repository\jakarta\inject\jakarta.inject-api\2.0.0\jakarta.inject-api-2.0.0.jar;C:\Users\Admin\.m2\repository\org\antlr\antlr4-runtime\4.10.1\antlr4-runtime-4.10.1.jar;C:\Users\Admin\.m2\repository\org\springframework\data\spring-data-jpa\3.0.0\spring-data-jpa-3.0.0.jar;C:\Users\Admin\.m2\repository\org\springframework\data\spring-data-commons\3.0.0\spring-data-commons-3.0.0.jar;C:\Users\Admin\.m2\repository\org\springframework\spring-orm\6.0.2\spring-orm-6.0.2.jar;C:\Users\Admin\.m2\repository\org\springframework\spring-context\6.0.2\spring-context-6.0.2.jar;C:\Users\Admin\.m2\repository\org\springframework\spring-tx\6.0.2\spring-tx-6.0.2.jar;C:\Users\Admin\.m2\repository\org\springframework\spring-beans\6.0.2\spring-beans-6.0.2.jar;C:\Users\Admin\.m2\repository\org\slf4j\slf4j-api\2.0.4\slf4j-api-2.0.4.jar;C:\Users\Admin\.m2\repository\org\springframework\spring-aspects\6.0.2\spring-aspects-6.0.2.jar;C:\Users\Admin\.m2\repository\org\springframework\boot\spring-boot-starter-mustache\3.0.0\spring-boot-starter-mustache-3.0.0.jar;C:\Users\Admin\.m2\repository\org\springframework\boot\spring-boot-starter\3.0.0\spring-boot-starter-3.0.0.jar;C:\Users\Admin\.m2\repository\org\springframework\boot\spring-boot-starter-logging\3.0.0\spring-boot-starter-logging-3.0.0.jar;C:\Users\Admin\.m2\repository\ch\qos\logback\logback-classic\1.4.5\logback-classic-1.4.5.jar;C:\Users\Admin\.m2\repository\ch\qos\logback\logback-core\1.4.5\logback-core-1.4.5.jar;C:\Users\Admin\.m2\repository\org\apache\logging\log4j\log4j-to-slf4j\2.19.0\log4j-to-slf4j-2.19.0.jar;C:\Users\Admin\.m2\repository\org\apache\logging\log4j\log4j-api\2.19.0\log4j-api-2.19.0.jar;C:\Users\Admin\.m2\repository\org\slf4j\jul-to-slf4j\2.0.4\jul-to-slf4j-2.0.4.jar;C:\Users\Admin\.m2\repository\org\yaml\snakeyaml\1.33\snakeyaml-1.33.jar;C:\Users\Admin\.m2\repository\com\samskivert\jmustache\1.15\jmustache-1.15.jar;C:\Users\Admin\.m2\repository\org\springframework\boot\spring-boot-starter-web\3.0.0\spring-boot-starter-web-3.0.0.jar;C:\Users\Admin\.m2\repository\org\springframework\boot\spring-boot-starter-json\3.0.0\spring-boot-starter-json-3.0.0.jar;C:\Users\Admin\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.14.1\jackson-databind-2.14.1.jar;C:\Users\Admin\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.14.1\jackson-annotations-2.14.1.jar;C:\Users\Admin\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.14.1\jackson-core-2.14.1.jar;C:\Users\Admin\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.14.1\jackson-datatype-jdk8-2.14.1.jar;C:\Users\Admin\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.14.1\jackson-datatype-jsr310-2.14.1.jar;C:\Users\Admin\.m2\repository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.14.1\jackson-module-parameter-names-2.14.1.jar;C:\Users\Admin\.m2\repository\org\springframework\spring-web\6.0.2\spring-web-6.0.2.jar;C:\Users\Admin\.m2\repository\io\micrometer\micrometer-observation\1.10.2\micrometer-observation-1.10.2.jar;C:\Users\Admin\.m2\repository\io\micrometer\micrometer-commons\1.10.2\micrometer-commons-1.10.2.jar;C:\Users\Admin\.m2\repository\org\springframework\spring-webmvc\6.0.2\spring-webmvc-6.0.2.jar;C:\Users\Admin\.m2\repository\org\springframework\spring-expression\6.0.2\spring-expression-6.0.2.jar;C:\Users\Admin\.m2\repository\org\springframework\boot\spring-boot-devtools\3.0.0\spring-boot-devtools-3.0.0.jar;C:\Users\Admin\.m2\repository\org\springframework\boot\spring-boot\3.0.0\spring-boot-3.0.0.jar;C:\Users\Admin\.m2\repository\org\springframework\boot\spring-boot-autoconfigure\3.0.0\spring-boot-autoconfigure-3.0.0.jar;C:\Users\Admin\.m2\repository\org\postgresql\postgresql\42.5.1\postgresql-42.5.1.jar;C:\Users\Admin\.m2\repository\org\checkerframework\checker-qual\3.5.0\checker-qual-3.5.0.jar;C:\Users\Admin\.m2\repository\org\springframework\boot\spring-boot-starter-tomcat\3.0.0\spring-boot-starter-tomcat-3.0.0.jar;C:\Users\Admin\.m2\repository\jakarta\annotation\jakarta.annotation-api\2.1.1\jakarta.annotation-api-2.1.1.jar;C:\Users\Admin\.m2\repository\org\apache\tomcat\embed\tomcat-embed-core\10.1.1\tomcat-embed-core-10.1.1.jar;C:\Users\Admin\.m2\repository\org\apache\tomcat\embed\tomcat-embed-el\10.1.1\tomcat-embed-el-10.1.1.jar;C:\Users\Admin\.m2\repository\org\apache\tomcat\embed\tomcat-embed-websocket\10.1.1\tomcat-embed-websocket-10.1.1.jar;C:\Users\Admin\.m2\repository\jakarta\xml\bind\jakarta.xml.bind-api\4.0.0\jakarta.xml.bind-api-4.0.0.jar;C:\Users\Admin\.m2\repository\jakarta\activation\jakarta.activation-api\2.1.0\jakarta.activation-api-2.1.0.jar;C:\Users\Admin\.m2\repository\org\springframework\spring-core\6.0.2\spring-core-6.0.2.jar;C:\Users\Admin\.m2\repository\org\springframework\spring-jcl\6.0.2\spring-jcl-6.0.2.jar" kz.onlineshelter.helppet.HelppetApplication
OpenJDK 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v3.0.0)

2022-12-22T10:18:07.901+03:00  INFO 8316 --- [  restartedMain] k.o.***.***Application                   : Starting ***Application using Java 17.0.4.1 with PID 8316 (*:\***\***\target\classes started by Admin in *:\***\***)
2022-12-22T10:18:07.903+03:00  INFO 8316 --- [  restartedMain] k.o.***.***Application                   : No active profile set, falling back to 1 default profile: "default"
2022-12-22T10:18:07.944+03:00  INFO 8316 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2022-12-22T10:18:07.944+03:00  INFO 8316 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2022-12-22T10:18:08.400+03:00  INFO 8316 --- [  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2022-12-22T10:18:08.435+03:00  INFO 8316 --- [  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 30 ms. Found 1 JPA repository interfaces.
2022-12-22T10:18:08.807+03:00  INFO 8316 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2022-12-22T10:18:08.815+03:00  INFO 8316 --- [  restartedMain] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2022-12-22T10:18:08.815+03:00  INFO 8316 --- [  restartedMain] o.apache.catalina.core.StandardEngine    : Starting Servlet engine: [Apache Tomcat/10.1.1]
2022-12-22T10:18:08.861+03:00  INFO 8316 --- [  restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2022-12-22T10:18:08.861+03:00  INFO 8316 --- [  restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 917 ms
2022-12-22T10:18:08.950+03:00  INFO 8316 --- [  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
2022-12-22T10:18:09.038+03:00  INFO 8316 --- [  restartedMain] com.zaxxer.hikari.pool.HikariPool        : HikariPool-1 - Added connection org.postgresql.jdbc.PgConnection@54ef2cef
2022-12-22T10:18:09.039+03:00  INFO 8316 --- [  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.
2022-12-22T10:18:09.070+03:00  INFO 8316 --- [  restartedMain] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [name: default]
2022-12-22T10:18:09.110+03:00  INFO 8316 --- [  restartedMain] org.hibernate.Version                    : HHH000412: Hibernate ORM core version 6.1.5.Final
2022-12-22T10:18:09.232+03:00  WARN 8316 --- [  restartedMain] org.hibernate.orm.deprecation            : HHH90000021: Encountered deprecated setting [javax.persistence.sharedCache.mode], use [jakarta.persistence.sharedCache.mode] instead
2022-12-22T10:18:09.344+03:00  INFO 8316 --- [  restartedMain] SQL dialect                              : HHH000400: Using dialect: org.hibernate.dialect.PostgreSQLDialect
2022-12-22T10:18:09.824+03:00  INFO 8316 --- [  restartedMain] o.h.e.t.j.p.i.JtaPlatformInitiator       : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2022-12-22T10:18:09.830+03:00  INFO 8316 --- [  restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2022-12-22T10:18:10.004+03:00  WARN 8316 --- [  restartedMain] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2022-12-22T10:18:10.234+03:00  INFO 8316 --- [  restartedMain] o.s.b.d.a.OptionalLiveReloadServer       : LiveReload server is running on port 35729
2022-12-22T10:18:10.256+03:00  INFO 8316 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2022-12-22T10:18:10.265+03:00  INFO 8316 --- [  restartedMain] k.o.helppet.HelppetApplication           : Started HelppetApplication in 2.768 seconds (process running for 4.113)
2022-12-22T10:18:13.951+03:00  INFO 8316 --- [nio-8080-exec-5] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
2022-12-22T10:18:13.952+03:00  INFO 8316 --- [nio-8080-exec-5] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2022-12-22T10:18:13.954+03:00  INFO 8316 --- [nio-8080-exec-5] o.s.web.servlet.DispatcherServlet        : Completed initialization in 1 ms
</code>```

After starting the application, the corresponding table in the database is successfully created

I added an annotation @Repository into Repository, added an annotation @Transactional into Controller in add method, into the signature of the same method added an anotation @ResponseBody but that didn't solve the issue.

Body:
Spring Boot 3.0.0 application, after filling out the form and submitting it, the input field is cleared, but saving to the corresponding database table does not occur. There are no errors in the log.

Model

import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;

@Entity
public class Message {
    @Id
    @GeneratedValue(strategy= GenerationType.AUTO)
    private Integer id;
    private String text;

    public Message() {
    }

    public Message(String text) {
        this.text = text;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }
}

Repository

import kz.onlineshelter.helppet.model.Message;
import org.springframework.data.repository.CrudRepository;

public interface MessageRepository extends CrudRepository<Message, Long> {}

Controller

import kz.onlineshelter.helppet.model.Message;
import kz.onlineshelter.helppet.repository.MessageRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@Controller
@RequestMapping(method={RequestMethod.POST,RequestMethod.GET})
public class AppController {
    private final MessageRepository messageRepository;

    @Autowired
    public AppController(MessageRepository messageRepository) {
        this.messageRepository = messageRepository;
    }

    @GetMapping("/message")
    public String message(Map<String, Object> model) {
        Iterable<Message> messages = messageRepository.findAll();

        model.put("messages", messages);

        return "message";
    }

    @PostMapping
    public String add(@RequestParam String text, Map<String, Object> model) {
        Message message = new Message(text);

        messageRepository.save(message);

        Iterable<Message> messages = messageRepository.findAll();

        model.put("messages", messages);

        return "message";
    }
}

Application

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class HelppetApplication {
   public static void main(String[] args) {
      SpringApplication.run(HelppetApplication.class, args);
   }
}

resources/templates/message.mustache

    <form method="post">
        <input type="text" name="text" placeholder="Enter your text" />

        <button type="submit">Add</button>
    </form>

List of messages

{{#messages}}

        {{text}}

{{/messages}}

application.properties

spring.datasource.url=jdbc:postgresql://localhost:5432/***
spring.datasource.username=***
spring.datasource.password=***
spring.jpa.generate-ddl=true

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>
   <groupId>***</groupId>
   <artifactId>helppet</artifactId>
   <version>0.0.1-SNAPSHOT</version>
   <packaging>war</packaging>
   <name>***</name>
   <description>***</description>
   <properties>
      <java.version>17</java.version>
   </properties>
   <dependencies>
      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-data-jpa</artifactId>
      </dependency>
      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-mustache</artifactId>
      </dependency>
      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-web</artifactId>
      </dependency>
      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-devtools</artifactId>
         <scope>runtime</scope>
         <optional>true</optional>
      </dependency>
      <dependency>
         <groupId>org.postgresql</groupId>
         <artifactId>postgresql</artifactId>
         <scope>runtime</scope>
      </dependency>
      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-tomcat</artifactId>
         <scope>provided</scope>
      </dependency>
      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-test</artifactId>
         <scope>test</scope>
      </dependency>
   </dependencies>

   <build>
      <plugins>
         <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
         </plugin>
      </plugins>
   </build>

</project>

log file

"C:\Program Files\BellSoft\LibericaJDK-17\bin\java.exe" -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2021.2.2\lib\idea_rt.jar=63010:C:\Program Files\JetBrains\IntelliJ IDEA 2021.2.2\bin" -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true -Dfile.encoding=UTF-8 -classpath "C:\java projects\helppet\target\classes;C:\Users\Admin\.m2\repository\org\springframework\boot\spring-boot-starter-data-jpa\3.0.0\spring-boot-starter-data-jpa-3.0.0.jar;C:\Users\Admin\.m2\repository\org\springframework\boot\spring-boot-starter-aop\3.0.0\spring-boot-starter-aop-3.0.0.jar;C:\Users\Admin\.m2\repository\org\springframework\spring-aop\6.0.2\spring-aop-6.0.2.jar;C:\Users\Admin\.m2\repository\org\aspectj\aspectjweaver\1.9.9.1\aspectjweaver-1.9.9.1.jar;C:\Users\Admin\.m2\repository\org\springframework\boot\spring-boot-starter-jdbc\3.0.0\spring-boot-starter-jdbc-3.0.0.jar;C:\Users\Admin\.m2\repository\com\zaxxer\HikariCP\5.0.1\HikariCP-5.0.1.jar;C:\Users\Admin\.m2\repository\org\springframework\spring-jdbc\6.0.2\spring-jdbc-6.0.2.jar;C:\Users\Admin\.m2\repository\org\hibernate\orm\hibernate-core\6.1.5.Final\hibernate-core-6.1.5.Final.jar;C:\Users\Admin\.m2\repository\jakarta\persistence\jakarta.persistence-api\3.1.0\jakarta.persistence-api-3.1.0.jar;C:\Users\Admin\.m2\repository\jakarta\transaction\jakarta.transaction-api\2.0.1\jakarta.transaction-api-2.0.1.jar;C:\Users\Admin\.m2\repository\org\jboss\logging\jboss-logging\3.5.0.Final\jboss-logging-3.5.0.Final.jar;C:\Users\Admin\.m2\repository\org\hibernate\common\hibernate-commons-annotations\6.0.2.Final\hibernate-commons-annotations-6.0.2.Final.jar;C:\Users\Admin\.m2\repository\org\jboss\jandex\2.4.2.Final\jandex-2.4.2.Final.jar;C:\Users\Admin\.m2\repository\com\fasterxml\classmate\1.5.1\classmate-1.5.1.jar;C:\Users\Admin\.m2\repository\net\bytebuddy\byte-buddy\1.12.19\byte-buddy-1.12.19.jar;C:\Users\Admin\.m2\repository\org\glassfish\jaxb\jaxb-runtime\4.0.1\jaxb-runtime-4.0.1.jar;C:\Users\Admin\.m2\repository\org\glassfish\jaxb\jaxb-core\4.0.1\jaxb-core-4.0.1.jar;C:\Users\Admin\.m2\repository\org\eclipse\angus\angus-activation\1.0.0\angus-activation-1.0.0.jar;C:\Users\Admin\.m2\repository\org\glassfish\jaxb\txw2\4.0.1\txw2-4.0.1.jar;C:\Users\Admin\.m2\repository\com\sun\istack\istack-commons-runtime\4.1.1\istack-commons-runtime-4.1.1.jar;C:\Users\Admin\.m2\repository\jakarta\inject\jakarta.inject-api\2.0.0\jakarta.inject-api-2.0.0.jar;C:\Users\Admin\.m2\repository\org\antlr\antlr4-runtime\4.10.1\antlr4-runtime-4.10.1.jar;C:\Users\Admin\.m2\repository\org\springframework\data\spring-data-jpa\3.0.0\spring-data-jpa-3.0.0.jar;C:\Users\Admin\.m2\repository\org\springframework\data\spring-data-commons\3.0.0\spring-data-commons-3.0.0.jar;C:\Users\Admin\.m2\repository\org\springframework\spring-orm\6.0.2\spring-orm-6.0.2.jar;C:\Users\Admin\.m2\repository\org\springframework\spring-context\6.0.2\spring-context-6.0.2.jar;C:\Users\Admin\.m2\repository\org\springframework\spring-tx\6.0.2\spring-tx-6.0.2.jar;C:\Users\Admin\.m2\repository\org\springframework\spring-beans\6.0.2\spring-beans-6.0.2.jar;C:\Users\Admin\.m2\repository\org\slf4j\slf4j-api\2.0.4\slf4j-api-2.0.4.jar;C:\Users\Admin\.m2\repository\org\springframework\spring-aspects\6.0.2\spring-aspects-6.0.2.jar;C:\Users\Admin\.m2\repository\org\springframework\boot\spring-boot-starter-mustache\3.0.0\spring-boot-starter-mustache-3.0.0.jar;C:\Users\Admin\.m2\repository\org\springframework\boot\spring-boot-starter\3.0.0\spring-boot-starter-3.0.0.jar;C:\Users\Admin\.m2\repository\org\springframework\boot\spring-boot-starter-logging\3.0.0\spring-boot-starter-logging-3.0.0.jar;C:\Users\Admin\.m2\repository\ch\qos\logback\logback-classic\1.4.5\logback-classic-1.4.5.jar;C:\Users\Admin\.m2\repository\ch\qos\logback\logback-core\1.4.5\logback-core-1.4.5.jar;C:\Users\Admin\.m2\repository\org\apache\logging\log4j\log4j-to-slf4j\2.19.0\log4j-to-slf4j-2.19.0.jar;C:\Users\Admin\.m2\repository\org\apache\logging\log4j\log4j-api\2.19.0\log4j-api-2.19.0.jar;C:\Users\Admin\.m2\repository\org\slf4j\jul-to-slf4j\2.0.4\jul-to-slf4j-2.0.4.jar;C:\Users\Admin\.m2\repository\org\yaml\snakeyaml\1.33\snakeyaml-1.33.jar;C:\Users\Admin\.m2\repository\com\samskivert\jmustache\1.15\jmustache-1.15.jar;C:\Users\Admin\.m2\repository\org\springframework\boot\spring-boot-starter-web\3.0.0\spring-boot-starter-web-3.0.0.jar;C:\Users\Admin\.m2\repository\org\springframework\boot\spring-boot-starter-json\3.0.0\spring-boot-starter-json-3.0.0.jar;C:\Users\Admin\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.14.1\jackson-databind-2.14.1.jar;C:\Users\Admin\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.14.1\jackson-annotations-2.14.1.jar;C:\Users\Admin\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.14.1\jackson-core-2.14.1.jar;C:\Users\Admin\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.14.1\jackson-datatype-jdk8-2.14.1.jar;C:\Users\Admin\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.14.1\jackson-datatype-jsr310-2.14.1.jar;C:\Users\Admin\.m2\repository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.14.1\jackson-module-parameter-names-2.14.1.jar;C:\Users\Admin\.m2\repository\org\springframework\spring-web\6.0.2\spring-web-6.0.2.jar;C:\Users\Admin\.m2\repository\io\micrometer\micrometer-observation\1.10.2\micrometer-observation-1.10.2.jar;C:\Users\Admin\.m2\repository\io\micrometer\micrometer-commons\1.10.2\micrometer-commons-1.10.2.jar;C:\Users\Admin\.m2\repository\org\springframework\spring-webmvc\6.0.2\spring-webmvc-6.0.2.jar;C:\Users\Admin\.m2\repository\org\springframework\spring-expression\6.0.2\spring-expression-6.0.2.jar;C:\Users\Admin\.m2\repository\org\springframework\boot\spring-boot-devtools\3.0.0\spring-boot-devtools-3.0.0.jar;C:\Users\Admin\.m2\repository\org\springframework\boot\spring-boot\3.0.0\spring-boot-3.0.0.jar;C:\Users\Admin\.m2\repository\org\springframework\boot\spring-boot-autoconfigure\3.0.0\spring-boot-autoconfigure-3.0.0.jar;C:\Users\Admin\.m2\repository\org\postgresql\postgresql\42.5.1\postgresql-42.5.1.jar;C:\Users\Admin\.m2\repository\org\checkerframework\checker-qual\3.5.0\checker-qual-3.5.0.jar;C:\Users\Admin\.m2\repository\org\springframework\boot\spring-boot-starter-tomcat\3.0.0\spring-boot-starter-tomcat-3.0.0.jar;C:\Users\Admin\.m2\repository\jakarta\annotation\jakarta.annotation-api\2.1.1\jakarta.annotation-api-2.1.1.jar;C:\Users\Admin\.m2\repository\org\apache\tomcat\embed\tomcat-embed-core\10.1.1\tomcat-embed-core-10.1.1.jar;C:\Users\Admin\.m2\repository\org\apache\tomcat\embed\tomcat-embed-el\10.1.1\tomcat-embed-el-10.1.1.jar;C:\Users\Admin\.m2\repository\org\apache\tomcat\embed\tomcat-embed-websocket\10.1.1\tomcat-embed-websocket-10.1.1.jar;C:\Users\Admin\.m2\repository\jakarta\xml\bind\jakarta.xml.bind-api\4.0.0\jakarta.xml.bind-api-4.0.0.jar;C:\Users\Admin\.m2\repository\jakarta\activation\jakarta.activation-api\2.1.0\jakarta.activation-api-2.1.0.jar;C:\Users\Admin\.m2\repository\org\springframework\spring-core\6.0.2\spring-core-6.0.2.jar;C:\Users\Admin\.m2\repository\org\springframework\spring-jcl\6.0.2\spring-jcl-6.0.2.jar" kz.onlineshelter.helppet.HelppetApplication
OpenJDK 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v3.0.0)

2022-12-22T10:18:07.901+03:00  INFO 8316 --- [  restartedMain] k.o.***.***Application                   : Starting ***Application using Java 17.0.4.1 with PID 8316 (*:\***\***\target\classes started by Admin in *:\***\***)
2022-12-22T10:18:07.903+03:00  INFO 8316 --- [  restartedMain] k.o.***.***Application                   : No active profile set, falling back to 1 default profile: "default"
2022-12-22T10:18:07.944+03:00  INFO 8316 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2022-12-22T10:18:07.944+03:00  INFO 8316 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2022-12-22T10:18:08.400+03:00  INFO 8316 --- [  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2022-12-22T10:18:08.435+03:00  INFO 8316 --- [  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 30 ms. Found 1 JPA repository interfaces.
2022-12-22T10:18:08.807+03:00  INFO 8316 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2022-12-22T10:18:08.815+03:00  INFO 8316 --- [  restartedMain] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2022-12-22T10:18:08.815+03:00  INFO 8316 --- [  restartedMain] o.apache.catalina.core.StandardEngine    : Starting Servlet engine: [Apache Tomcat/10.1.1]
2022-12-22T10:18:08.861+03:00  INFO 8316 --- [  restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2022-12-22T10:18:08.861+03:00  INFO 8316 --- [  restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 917 ms
2022-12-22T10:18:08.950+03:00  INFO 8316 --- [  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
2022-12-22T10:18:09.038+03:00  INFO 8316 --- [  restartedMain] com.zaxxer.hikari.pool.HikariPool        : HikariPool-1 - Added connection org.postgresql.jdbc.PgConnection@54ef2cef
2022-12-22T10:18:09.039+03:00  INFO 8316 --- [  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.
2022-12-22T10:18:09.070+03:00  INFO 8316 --- [  restartedMain] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [name: default]
2022-12-22T10:18:09.110+03:00  INFO 8316 --- [  restartedMain] org.hibernate.Version                    : HHH000412: Hibernate ORM core version 6.1.5.Final
2022-12-22T10:18:09.232+03:00  WARN 8316 --- [  restartedMain] org.hibernate.orm.deprecation            : HHH90000021: Encountered deprecated setting [javax.persistence.sharedCache.mode], use [jakarta.persistence.sharedCache.mode] instead
2022-12-22T10:18:09.344+03:00  INFO 8316 --- [  restartedMain] SQL dialect                              : HHH000400: Using dialect: org.hibernate.dialect.PostgreSQLDialect
2022-12-22T10:18:09.824+03:00  INFO 8316 --- [  restartedMain] o.h.e.t.j.p.i.JtaPlatformInitiator       : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2022-12-22T10:18:09.830+03:00  INFO 8316 --- [  restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2022-12-22T10:18:10.004+03:00  WARN 8316 --- [  restartedMain] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2022-12-22T10:18:10.234+03:00  INFO 8316 --- [  restartedMain] o.s.b.d.a.OptionalLiveReloadServer       : LiveReload server is running on port 35729
2022-12-22T10:18:10.256+03:00  INFO 8316 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2022-12-22T10:18:10.265+03:00  INFO 8316 --- [  restartedMain] k.o.helppet.HelppetApplication           : Started HelppetApplication in 2.768 seconds (process running for 4.113)
2022-12-22T10:18:13.951+03:00  INFO 8316 --- [nio-8080-exec-5] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
2022-12-22T10:18:13.952+03:00  INFO 8316 --- [nio-8080-exec-5] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2022-12-22T10:18:13.954+03:00  INFO 8316 --- [nio-8080-exec-5] o.s.web.servlet.DispatcherServlet        : Completed initialization in 1 ms

After starting the application, the corresponding table in the database is successfully created

I added an annotation @Repository into Repository, added an annotation @Transactional into Controller in add method, into the signature of the same method added an anotation @ResponseBody but that didn't solve the issue.


问:
File upload and download using selenium with java and bamboo
I have one problem for which i am seeking help.
Can someone guide me on this.

Problem: How to do file handling using selenium, grid4 and bamboo.

Steps for the Issue/problem:

1.I have to run one test case where i am downloading a file with some extension from website "x"
2. I need to change the extension to .txt. and add the file to zip.
3. In 2nd test, i need to open website "y" and upload the zip file created in step 2.

Can someone suggest some solution or pointers here.


问:
Create reusable blazor component to edit an object
So I'm trying to create a component that I can reuse to edit an object. Basically, it's a form that can show different inputs based on the type of the object's elements. For the moment I can display my component on another one I have access to the data, but I can't pass this data to another page. So here's what I've done so far:

So this is the component:

```<code>@using System.Reflection;
@typeparam TItem

@if (Test != null)
{
    @foreach (PropertyInfo info in typeof(TItem).GetProperties())
    {
        <div class="container">
            @info.Name :
            @info.GetValue(Test)
            <br />
            <EditForm Model="Test">
                <div >
                   @if (info.PropertyType == typeof(string))
                   {
                     <input class="col " type="text" @onchange="(a) => UpdateObj(a.Value!,info)">
                   }
                </div>
            </EditForm>
        </div>
    }
}

@code {
    public object? test { get; set; }

    [Parameter]
    public TItem? Test { get; set; }

    [Parameter]
    public Func<TItem, Task>? NewValue { get; set; }

    async Task UpdateObj(object value, PropertyInfo type)
    {
        if (NewValue != null && Test != null)
        {
            test = value;
            await NewValue(Test);
        }
        StateHasChanged();
    }
}
</code>```

And this is where I used it in the previous example:

```<code>@page "/test"
@using Component;

@if( test != null)
{
    <Component.ObjectEditor Test="test" TItem="testRecord"
       NewValue="(a) => {
       json = a.JsonSerializeTo();
       StateHasChanged();
       return Task.CompletedTask;}"/>
}
    @json
@code
{
    public string? json = null;

    public record testRecord
    {
        public string? Text { get; set; }
    }

    public testRecord test = new testRecord() ;
}
</code>```

Body:
So I'm trying to create a component that I can reuse to edit an object. Basically, it's a form that can show different inputs based on the type of the object's elements. For the moment I can display my component on another one I have access to the data, but I can't pass this data to another page. So here's what I've done so far:

So this is the component:

@using System.Reflection;
@typeparam TItem

@if (Test != null)
{
    @foreach (PropertyInfo info in typeof(TItem).GetProperties())
    {

            @info.Name :
            @info.GetValue(Test)

            <EditForm Model="Test">

                   @if (info.PropertyType == typeof(string))
                   {
                     <input class="col " type="text" @onchange="(a) => UpdateObj(a.Value!,info)">
                   }

            </EditForm>

    }
}

@code {
    public object? test { get; set; }

    [Parameter]
    public TItem? Test { get; set; }

    [Parameter]
    public Func<TItem, Task>? NewValue { get; set; }

    async Task UpdateObj(object value, PropertyInfo type)
    {
        if (NewValue != null && Test != null)
        {
            test = value;
            await NewValue(Test);
        }
        StateHasChanged();
    }
}

And this is where I used it in the previous example:

@page "/test"
@using Component;

@if( test != null)
{
    <Component.ObjectEditor Test="test" TItem="testRecord"
       NewValue="(a) => {
       json = a.JsonSerializeTo();
       StateHasChanged();
       return Task.CompletedTask;}"/>
}
    @json
@code
{
    public string? json = null;

    public record testRecord
    {
        public string? Text { get; set; }
    }

    public testRecord test = new testRecord() ;
}


问:
Fluent bit - kubernetes and cloudwatch - issue with multiplied timestamps
Could you tell me what is wrong in my fluent bit configuration? I want to remove the section in multiplied timestamps in cloudwatch. I think the problem is in the PARSER section. Look  below

```<code>parsers.conf: |
[PARSER]
  Name        docker
  Format      regex
  Regex       (?<tag>[^.]+)?\.?(?<pod_name>[a-z0-9](?:[-a-z0-9]*[a-z0-9])?(?:\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)_(?<namespace_name>[^_]+)_(?<container_name>.+)-(?<docker_id>[a-z0-9]{64})\.log$

input-kubernetes.conf: |
[INPUT]
    Name              tail
    Tag               kube.*
    Path              /var/log/containers/*.log
    Parser            docker
    DB                /var/log/flb_kube.db
    Mem_Buf_Limit     5MB
    Skip_Long_Lines   On
    Refresh_Interval  10
</code>```

Body:
Could you tell me what is wrong in my fluent bit configuration? I want to remove the section in multiplied timestamps in cloudwatch. I think the problem is in the PARSER section. Look  below

parsers.conf: |
[PARSER]
  Name        docker
  Format      regex
  Regex       (?<tag>[^.]+)?\.?(?<pod_name>[a-z0-9](?:[-a-z0-9]*[a-z0-9])?(?:\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)_(?<namespace_name>[^_]+)_(?<container_name>.+)-(?<docker_id>[a-z0-9]{64})\.log$

input-kubernetes.conf: |
[INPUT]
    Name              tail
    Tag               kube.*
    Path              /var/log/containers/*.log
    Parser            docker
    DB                /var/log/flb_kube.db
    Mem_Buf_Limit     5MB
    Skip_Long_Lines   On
    Refresh_Interval  10