问:
Problem exporting/importing and modifying a certificate template in C# using Certificate Template API
I am working on the import and export of certificate templates using Certificate Template API (see this link (https://techcommunity.microsoft.com/t5/core-infrastructure-and-security/introducing-certificate-template-api/ba-p/1128560). The code I am using is pretty much the same as in the link.

For many methods I get a Non Implemented error while others work. More specifically the export method gives me that error while the import is fine(I exported my manually created template using Powershell to an xml file to have something to import!). I would like to be able to use the export method as well. And all the rest!
Moreover, in the export method if I try to edit more properties, again, I get a non implemented error. See below:

```<code>IX509CertificateTemplateWritable writableTempl = new CX509CertificateTemplateADWritable(); //OK
writableTempl.Initialize(template); //OK
writableTempl.set_Property(EnrollmentTemplateProperty.TemplatePropSecurityDescriptor, SDDL); //OK
writableTempl.set_Property(EnrollmentTemplateProperty.TemplatePropFriendlyName, "Hello"); //NOT OK!
writableTempl .Commit(CommitTemplateFlags.CommitFlagSaveTemplateGenerateOID, null);

</code>```

I am truly at a loss.
More info: I am running on windows Server 2016. I added to my C# project (Visual Studio 2022) as reference "Interop.CERTENROLLLib" downloaded from here: https://www.nuget.org/packages/Interop.CERTENROLLLib

I have tried to see if maybe I was using a wrong version of Interop.CERTENROLLLib. Since I could not do the Export with the API, I exported the certificate in Powershell using Vadims Podans method (https://www.sysadmins.lv/blog-en/export-and-import-certificate-templates-with-powershell.aspx) then embedded as a resource the resulting xml file in my c# application and used the Import API.

I really don't know what I could try to make the Export, and all the other "not implemented" methods work.

All I could find searching was the following discussion, my same problem but no solution offered. https://social.msdn.microsoft.com/forums/en-US/b507ccb8-1f72-4477-83e7-d0b221b3662c/enrolling-certificate-from-certificate-enrollment-web-services-using-c?forum=wcf

Body:
I am working on the import and export of certificate templates using Certificate Template API (see this link (https://techcommunity.microsoft.com/t5/core-infrastructure-and-security/introducing-certificate-template-api/ba-p/1128560). The code I am using is pretty much the same as in the link.

For many methods I get a Non Implemented error while others work. More specifically the export method gives me that error while the import is fine(I exported my manually created template using Powershell to an xml file to have something to import!). I would like to be able to use the export method as well. And all the rest!
Moreover, in the export method if I try to edit more properties, again, I get a non implemented error. See below:

IX509CertificateTemplateWritable writableTempl = new CX509CertificateTemplateADWritable(); //OK
writableTempl.Initialize(template); //OK
writableTempl.set_Property(EnrollmentTemplateProperty.TemplatePropSecurityDescriptor, SDDL); //OK
writableTempl.set_Property(EnrollmentTemplateProperty.TemplatePropFriendlyName, "Hello"); //NOT OK!
writableTempl .Commit(CommitTemplateFlags.CommitFlagSaveTemplateGenerateOID, null);

I am truly at a loss.
More info: I am running on windows Server 2016. I added to my C# project (Visual Studio 2022) as reference "Interop.CERTENROLLLib" downloaded from here: https://www.nuget.org/packages/Interop.CERTENROLLLib

I have tried to see if maybe I was using a wrong version of Interop.CERTENROLLLib. Since I could not do the Export with the API, I exported the certificate in Powershell using Vadims Podans method (https://www.sysadmins.lv/blog-en/export-and-import-certificate-templates-with-powershell.aspx) then embedded as a resource the resulting xml file in my c# application and used the Import API.

I really don't know what I could try to make the Export, and all the other "not implemented" methods work.

All I could find searching was the following discussion, my same problem but no solution offered. https://social.msdn.microsoft.com/forums/en-US/b507ccb8-1f72-4477-83e7-d0b221b3662c/enrolling-certificate-from-certificate-enrollment-web-services-using-c?forum=wcf


来源: stackexchange

问:
Terminal resize issue with Intellij and Git for Windows SDK
I am on Windows running Intellij and Git for Windows SDK for a feature rich terminal on Windows (pacman, oh my zsh, etc...)

I looked up previously on which command to use to make it the default Intellij Terminal and SO delivered:

How can I launch git-for-windows SDK's git-bash in Windows Terminal?

I am using the cmd from above's 2nd post:

```<code>C:\git-sdk-64\msys2_shell.cmd -defterm -here -no-start -mingw64
</code>```

Everything works fine except for a stubborn resizing issue :

Every time I resize the Intellij Terminal, the MSYS terminal stops receiving key strokes and I have to reopen a new one:

( can't type after the resize under the echo hello )

Trying to avoid WSL for now as I noticed maven builds through wsl were noticeably slower than directly on powershell or via git terminal.

Workaround

Not exactly a solution but if you run with MinGW32, the resize no longer causes the problem

To be seen if I will suffer from other 32/64 bit incompatibilities

using for now:

```<code>C:\git-sdk-64\msys2_shell.cmd -defterm -here -no-start -mingw32
</code>```

ContentLicense: CC BY-SA 4.0

Body:
I am on Windows running Intellij and Git for Windows SDK for a feature rich terminal on Windows (pacman, oh my zsh, etc...)

I looked up previously on which command to use to make it the default Intellij Terminal and SO delivered:

How can I launch git-for-windows SDK's git-bash in Windows Terminal?

I am using the cmd from above's 2nd post:

C:\git-sdk-64\msys2_shell.cmd -defterm -here -no-start -mingw64

Everything works fine except for a stubborn resizing issue :

Every time I resize the Intellij Terminal, the MSYS terminal stops receiving key strokes and I have to reopen a new one:

( can't type after the resize under the echo hello )

Trying to avoid WSL for now as I noticed maven builds through wsl were noticeably slower than directly on powershell or via git terminal.

Workaround

Not exactly a solution but if you run with MinGW32, the resize no longer causes the problem

To be seen if I will suffer from other 32/64 bit incompatibilities

using for now:

C:\git-sdk-64\msys2_shell.cmd -defterm -here -no-start -mingw32


问:
msgraph-python-sdk getting DriveItems from folder off root of Drive
I'm using the latest msgraph-sdk for python (https://github.com/microsoftgraph/msgraph-sdk-python) and am trying to get to DriveItems located in folders under the root of a Drive.  I am able to get the DriveItems in the root by calling

```<code>children = await self.app_client.drives_by_id(drive.id).root().children().get()
</code>```

but when I try to get children of one of the folders from root using the following

```<code>children = await self.app_client.drives_by_id(drive.id).bundles_by_id(driveItem.id).children().get()
</code>```

I get the error AttributeError: 'DriveItemItemRequestBuilder' object has no attribute 'children'.  Turns out its using the DriveItemItemRequestBuilder from msgraph.generated.drives.item.special.item.drive_item_item_request_builder.py since that is the last lazy_loader call in msgraph.generated.drives.item.drive_item_request_builder.py which indeed doesn't have a children() property like the version in msgraph.generated.drives.item.items.item.drive_item_item_request_builder.py (which is lazy loaded into the same variable before the special version).

So my questions are:

Am I using the right sequence of calls to get to the children of the folder off the root of the DriveItem?

If so how can I get it to use the right DriveItemItemRequestBuilder or is it a bug in the generated code?

Body:
I'm using the latest msgraph-sdk for python (https://github.com/microsoftgraph/msgraph-sdk-python) and am trying to get to DriveItems located in folders under the root of a Drive.  I am able to get the DriveItems in the root by calling

children = await self.app_client.drives_by_id(drive.id).root().children().get()

but when I try to get children of one of the folders from root using the following

children = await self.app_client.drives_by_id(drive.id).bundles_by_id(driveItem.id).children().get()

I get the error AttributeError: 'DriveItemItemRequestBuilder' object has no attribute 'children'.  Turns out its using the DriveItemItemRequestBuilder from msgraph.generated.drives.item.special.item.drive_item_item_request_builder.py since that is the last lazy_loader call in msgraph.generated.drives.item.drive_item_request_builder.py which indeed doesn't have a children() property like the version in msgraph.generated.drives.item.items.item.drive_item_item_request_builder.py (which is lazy loaded into the same variable before the special version).

So my questions are:

Am I using the right sequence of calls to get to the children of the folder off the root of the DriveItem?

If so how can I get it to use the right DriveItemItemRequestBuilder or is it a bug in the generated code?


问:
Open Chakra menu from top right origin
I'd like to open the chakra menu popper from top right origin but now I can only open it from top left origin, so I can not put the menu to the right top corner of any div component.
I can only to this when I put the menu on the top right of the page, but I want to open it anywhere in the browser. Is it possible?</p>

Title: Open Chakra menu from top right origin


问:
Overflows to right
I'm using the framer motion library I'm trying give a text animation which it will come from right.When I use x: '-100%' it just dissapears but when I use x: '100%' it goes to the far right of the page instead of dissapearing. I want it to dissapear what can I do?</p>

Title: Overflows to right


问:
Material UI DataGrid params only passing last value in the table
I have a Data Grid table of users, the last column of the table is meant to be a sub-menu of options that each open up a modal. However, when I try to pass the data of a given row to a modal, it will only pass the final row of the data set (i.e. if I have 10 users, it passes rowId:10).

```<code>export default function Users() {
  const [userData, setUserData] = React.useState([]);
  React.useEffect(() => {
    let apiClient = new APIClient();
    apiClient.getUser().then((response) => {
        setUserData(response);
        console.log(response);
    });
  }, []);
  const [anchorEl, setAnchorEl] = React.useState<null | HTMLElement>(null);

  const [showEditModal, setShowEditModal] = React.useState<boolean>(false);
  const [showDeleteModal, setShowDeleteModal] = React.useState<boolean>(false);
  //for each modal

    const open = Boolean(anchorEl);
    const moreOptions = (event: React.MouseEvent<HTMLButtonElement>) => {
      setAnchorEl(event.currentTarget);

    };
    const handleClose = () => {
      setAnchorEl(null);
    };

  const columns: GridColDef[] = [
    { headerName: 'Name', field: 'name', flex: 1 },
    { headerName: 'Email', field: 'email', flex: 1 },
    { headerName: 'Date Added', field: 'added', flex: 0.7 },
    { headerName: 'Reports To', field: 'reports_to', flex: 1 },
    {
    field: ' ',
    flex: 0.2,
    renderCell: (params) => {
      return (
        <>
        <IconButton
          id="basic-button"
          aria-controls={open ? 'basic-menu' : undefined}
          aria-haspopup="true"
          aria-expanded={open ? 'true' : undefined}
          onClick={moreOptions}>
          <MoreIcon />
        </IconButton><Menu
          id="basic-menu"
          anchorEl={anchorEl}
          open={open}
          onClose={handleClose}
          MenuListProps={{
            'aria-labelledby': 'basic-button',
          }}
        >
            <MenuItem>
              <UserNotification />
            </MenuItem>
            <MenuItem onClick={() => { setShowEditModal(true); handleClose(); } }>
              <UserEdit />
            </MenuItem>
            <MenuItem onClick={() => { setShowDeleteModal(true); handleClose(); } }>
              <UserDelete />
            </MenuItem>
          </Menu>
          <EditUserModal userData={params.row} show={showEditModal} toggleModal={(value) => { setShowEditModal(value); } } />
          <DeleteUserModal userData={params.row} show={showDeleteModal} toggleModal={(value) => { setShowDeleteModal(value); } } />
          </>
      );
    }
  },
  ];

return (
    <div style={{ height: 'auto', width: "100%" }}>
    <StripedDataGrid rows={userData} columns={columns}
    getRowClassName={(params) =>
        params.indexRelativeToCurrentPage % 2 === 0 ? 'even' : 'odd'
      }
    hideFooter={true}
    autoHeight={true}
    components={{ Toolbar: GridToolbar }}
    />
    </div>
);
}
</code>```

The Data Grid documentation does not have a clear guide on how to pass props of the grid forward. Attempting to populate userData instead of params gives me an overload error. What is the proper way to handle this?

Body:
I have a Data Grid table of users, the last column of the table is meant to be a sub-menu of options that each open up a modal. However, when I try to pass the data of a given row to a modal, it will only pass the final row of the data set (i.e. if I have 10 users, it passes rowId:10).

export default function Users() {
  const [userData, setUserData] = React.useState([]);
  React.useEffect(() => {
    let apiClient = new APIClient();
    apiClient.getUser().then((response) => {
        setUserData(response);
        console.log(response);
    });
  }, []);
  const [anchorEl, setAnchorEl] = React.useState<null | HTMLElement>(null);

  const [showEditModal, setShowEditModal] = React.useState<boolean>(false);
  const [showDeleteModal, setShowDeleteModal] = React.useState<boolean>(false);
  //for each modal

    const open = Boolean(anchorEl);
    const moreOptions = (event: React.MouseEvent<HTMLButtonElement>) => {
      setAnchorEl(event.currentTarget);

    };
    const handleClose = () => {
      setAnchorEl(null);
    };

  const columns: GridColDef[] = [
    { headerName: 'Name', field: 'name', flex: 1 },
    { headerName: 'Email', field: 'email', flex: 1 },
    { headerName: 'Date Added', field: 'added', flex: 0.7 },
    { headerName: 'Reports To', field: 'reports_to', flex: 1 },
    {
    field: ' ',
    flex: 0.2,
    renderCell: (params) => {
      return (
        <>
        <IconButton
          id="basic-button"
          aria-controls={open ? 'basic-menu' : undefined}
          aria-haspopup="true"
          aria-expanded={open ? 'true' : undefined}
          onClick={moreOptions}>
          <MoreIcon />
        </IconButton><Menu
          id="basic-menu"
          anchorEl={anchorEl}
          open={open}
          onClose={handleClose}
          MenuListProps={{
            'aria-labelledby': 'basic-button',
          }}
        >
            <MenuItem>
              <UserNotification />
            </MenuItem>
            <MenuItem onClick={() => { setShowEditModal(true); handleClose(); } }>
              <UserEdit />
            </MenuItem>
            <MenuItem onClick={() => { setShowDeleteModal(true); handleClose(); } }>
              <UserDelete />
            </MenuItem>
          </Menu>
          <EditUserModal userData={params.row} show={showEditModal} toggleModal={(value) => { setShowEditModal(value); } } />
          <DeleteUserModal userData={params.row} show={showDeleteModal} toggleModal={(value) => { setShowDeleteModal(value); } } />
          </>
      );
    }
  },
  ];

return (

    <StripedDataGrid rows={userData} columns={columns}
    getRowClassName={(params) =>
        params.indexRelativeToCurrentPage % 2 === 0 ? 'even' : 'odd'
      }
    hideFooter={true}
    autoHeight={true}
    components={{ Toolbar: GridToolbar }}
    />

);
}

The Data Grid documentation does not have a clear guide on how to pass props of the grid forward. Attempting to populate userData instead of params gives me an overload error. What is the proper way to handle this?


问:
Routing WSE 3.0 SOAP request through NAT
I'm trying to send a soap request to a WSE 3.0 service but can't get the request to work.
It's working great when there is a direct connection between computer A and B. When there is a NAT device between them (A -> NAT -> B), I get an error in the event log on computer B:

```<code>Message Dispatch Failure:
<soap:Envelope
xmlns:xop="http://www.w3.org/2004/08/xop/include"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<soap:Header>
    <wsa:Action>http://tempuri.org/GetMachineQueue</wsa:Action
    <wsa:MessageID>urn:uuid:b8acf70a-74e8-4352-8d65-b5ba40ecf446</wsa:MessageID>
    <wsa:ReplyTo
        <wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address>
    </wsa:ReplyTo>
    <wsa:To>soap.tcp://192.168.56.1:6040/EquipmentService</wsa:To>
    <wsse:Security>
        <wsu:Timestamp wsu:Id="Timestamp-a1bc6b7d-6dea-4bac-97c2-6750f68699e1">
            <wsu:Created>2022-12-22T09:50:21Z</wsu:Created>
            <wsu:Expires>2022-12-22T09:55:21Z</wsu:Expires>
        </wsu:Timestamp>
    </wsse:Security>
</soap:Header>
<soap:Body>
    <GetMachineQueue
        xmlns="http://tempuri.org/">
        <sMachine>Virtualbox</sMachine>
    </GetMachineQueue>
</soap:Body>
</soap:Envelope>
</code>```

I also get a exception from the service proxy class in C#:

```<code>GetMachineQueue Exception: System.Web.Services.Protocols.SoapHeaderException: Destination Unreachable
</code>```

From what I understand the problem is that the "wsa:To" tag is pointing at the NAT device and not the final destination. But I have to point the request to the NAT to come to computer B.
The NAT device uses port forwarding to forward the request to computer B. When we have a A -> B setup this code works fine:

```<code>EquipmentService client = new EquipmentService();
var machineAddress = GetUri(sMachine);
client.Url = machineAddress;
client.GetMachineQueue(sMachine);
</code>```

But that doesn't work when doing A -> NAT -> B. I have temporarily solved this by adding this code:

```<code>EquipmentService client = new EquipmentService();
var (machineAddress, natAddress) = GetUri(sMachine);
client.Url = machineAddress;
client.Destination.Via = new Microsoft.Web.Services3.Referral.Via(new Uri(natAddress));
client.Destination.Address = new Microsoft.Web.Services3.Addressing.Address(new Uri(machineAddress));
client.GetMachineQueue(sMachine);
</code>```

I feel this is a bad way of solving the problem tho since what happens if there are more nodes that is has to pass before reaching its destination? Is there any way I can configure the request to automatically "redirect" or something?..

Body:
I'm trying to send a soap request to a WSE 3.0 service but can't get the request to work.
It's working great when there is a direct connection between computer A and B. When there is a NAT device between them (A -> NAT -> B), I get an error in the event log on computer B:

Message Dispatch Failure:
<soap:Envelope
xmlns:xop="http://www.w3.org/2004/08/xop/include"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<soap:Header>
    <wsa:Action>http://tempuri.org/GetMachineQueue</wsa:Action
    <wsa:MessageID>urn:uuid:b8acf70a-74e8-4352-8d65-b5ba40ecf446</wsa:MessageID>
    <wsa:ReplyTo
        <wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address>
    </wsa:ReplyTo>
    <wsa:To>soap.tcp://192.168.56.1:6040/EquipmentService</wsa:To>
    <wsse:Security>
        <wsu:Timestamp wsu:Id="Timestamp-a1bc6b7d-6dea-4bac-97c2-6750f68699e1">
            <wsu:Created>2022-12-22T09:50:21Z</wsu:Created>
            <wsu:Expires>2022-12-22T09:55:21Z</wsu:Expires>
        </wsu:Timestamp>
    </wsse:Security>
</soap:Header>
<soap:Body>
    <GetMachineQueue
        xmlns="http://tempuri.org/">
        <sMachine>Virtualbox</sMachine>
    </GetMachineQueue>
</soap:Body>
</soap:Envelope>

I also get a exception from the service proxy class in C#:

GetMachineQueue Exception: System.Web.Services.Protocols.SoapHeaderException: Destination Unreachable

From what I understand the problem is that the "wsa:To" tag is pointing at the NAT device and not the final destination. But I have to point the request to the NAT to come to computer B.
The NAT device uses port forwarding to forward the request to computer B. When we have a A -> B setup this code works fine:

EquipmentService client = new EquipmentService();
var machineAddress = GetUri(sMachine);
client.Url = machineAddress;
client.GetMachineQueue(sMachine);

But that doesn't work when doing A -> NAT -> B. I have temporarily solved this by adding this code:

EquipmentService client = new EquipmentService();
var (machineAddress, natAddress) = GetUri(sMachine);
client.Url = machineAddress;
client.Destination.Via = new Microsoft.Web.Services3.Referral.Via(new Uri(natAddress));
client.Destination.Address = new Microsoft.Web.Services3.Addressing.Address(new Uri(machineAddress));
client.GetMachineQueue(sMachine);

I feel this is a bad way of solving the problem tho since what happens if there are more nodes that is has to pass before reaching its destination? Is there any way I can configure the request to automatically "redirect" or something?..


问:
Unexpected mutation in pinia prop when change local component reactive()
When the value of an reactive object is changed, a prop in my Pinia store is mutated. I tried different ways of attributing new value to this store to avoid this problem, but so far I dont't really understand what is happenning. This is my code:

Component

```<code>const form = reactive({
  name: "",
  exercises: [{ exercise: "", method: "", series: "" }],
});

const handleChange = ({ value, name }: any, eventIndex: any) => {
  const newEx = form.exercises.map((ex, index) => ({
    ...ex,
    ...(index === eventIndex ? { [name]: value } : null),
  }));

  const newForm = { name: form.name, exercises: newEx };
  Object.assign(form, newForm)
};

const onSubmit = async () => {
  const { valid } = await formRef.value.validate();
  if (!valid) return;
  const storeTraining = workoutStore.newWorkout.training || [];
  const workout = {
    ...workoutStore.newWorkout,
    training: [...storeTraining, form],
  };
  workoutStore.setNewWorkout(workout);
  isOpen.value = false;
};

</code>```

Store

```<code>import { ref, computed } from "vue";
import { defineStore } from "pinia";
import type { IUser } from "@/domain/users/type";
import type { ITraining, IWorkout } from "@/domain/workouts/types";

export const useWorkoutStore = defineStore("workouts", () => {
  const creatingWorkoutStudent = ref<IUser | null>(null);
  const newWorkout = ref<Partial<IWorkout>>({});

  const setCreatingWorkoutStudent = (newUser: IUser) => {
    creatingWorkoutStudent.value = newUser;
  };

  const setNewWorkout = (workout: Partial<IWorkout>) => {
    newWorkout.value = { ...workout };
    return newWorkout.value;
  };

  const addNewTraining = (training: ITraining) => {
    newWorkout.value.training
      ? newWorkout.value.training.push(training)
      : (newWorkout.value.training = [training]);
  };

  const reset = () => {
    newWorkout.value = {};
    creatingWorkoutStudent.value = null;
  };

  return {
    creatingWorkoutStudent,
    setCreatingWorkoutStudent,
    newWorkout,
    setNewWorkout,
    reset,
    addNewTraining,
  };
});

</code>```

And this is a example of an input that mutates reactive values

```<code><text-field
  label="Exercício"
  @input="
    handleChange(
      { value: $event.target.value, name: 'exercise' },
      index
    )
  "
  :value="exercise.exercise"
  :rules="[validationRules.required]"
/>
</code>```

Every time that a input changes a value in const form = reactive(), the same property in Pinia store is changed too.

I've created a fiddle to exemplify my issue here

Body:
When the value of an reactive object is changed, a prop in my Pinia store is mutated. I tried different ways of attributing new value to this store to avoid this problem, but so far I dont't really understand what is happenning. This is my code:

Component

const form = reactive({
  name: "",
  exercises: [{ exercise: "", method: "", series: "" }],
});

const handleChange = ({ value, name }: any, eventIndex: any) => {
  const newEx = form.exercises.map((ex, index) => ({
    ...ex,
    ...(index === eventIndex ? { [name]: value } : null),
  }));

  const newForm = { name: form.name, exercises: newEx };
  Object.assign(form, newForm)
};

const onSubmit = async () => {
  const { valid } = await formRef.value.validate();
  if (!valid) return;
  const storeTraining = workoutStore.newWorkout.training || [];
  const workout = {
    ...workoutStore.newWorkout,
    training: [...storeTraining, form],
  };
  workoutStore.setNewWorkout(workout);
  isOpen.value = false;
};

Store

import { ref, computed } from "vue";
import { defineStore } from "pinia";
import type { IUser } from "@/domain/users/type";
import type { ITraining, IWorkout } from "@/domain/workouts/types";

export const useWorkoutStore = defineStore("workouts", () => {
  const creatingWorkoutStudent = ref<IUser | null>(null);
  const newWorkout = ref<Partial<IWorkout>>({});

  const setCreatingWorkoutStudent = (newUser: IUser) => {
    creatingWorkoutStudent.value = newUser;
  };

  const setNewWorkout = (workout: Partial<IWorkout>) => {
    newWorkout.value = { ...workout };
    return newWorkout.value;
  };

  const addNewTraining = (training: ITraining) => {
    newWorkout.value.training
      ? newWorkout.value.training.push(training)
      : (newWorkout.value.training = [training]);
  };

  const reset = () => {
    newWorkout.value = {};
    creatingWorkoutStudent.value = null;
  };

  return {
    creatingWorkoutStudent,
    setCreatingWorkoutStudent,
    newWorkout,
    setNewWorkout,
    reset,
    addNewTraining,
  };
});

And this is a example of an input that mutates reactive values

<text-field
  label="Exercício"
  @input="
    handleChange(
      { value: $event.target.value, name: 'exercise' },
      index
    )
  "
  :value="exercise.exercise"
  :rules="[validationRules.required]"
/>

Every time that a input changes a value in const form = reactive(), the same property in Pinia store is changed too.

I've created a fiddle to exemplify my issue here


问:
org.springframework.security.web.firewall.RequestRejectedException: The request was rejected because the parameter name
I'm trying to send a request from one service to another using FeignClient but I'm facing this error :

```<code>org.springframework.security.web.firewall.RequestRejectedException: The request was rejected because the parameter name "{
  "cpaymentId" : 4,
  "trnId" : "pi_3MHnxhJPH93PAwz91jxM5ADF",
  "total" : 50.0,
  "discount" : 0.0,
  "netTotal" : 50.0,
  "customerId" : 7,
  "stripeCustomer" : "cus_MwjijUIFfEfxzn",
  "userId" : 55,
  "stripePaymentInitId" : "pi_3MHnxhJPH93PAwz91jxM5ADF",
  "stripeClientSec" : "pi_3MHnxhJPH93PAwz91jxM5ADF_secret_6BtswHBCqrrDr7uVQEgEWW85D",
  "channel" : "APP",
  "tranStatus" : "SUCCESS",
  "createdAt" : 1671712410000,
  "updatedAt" : 1671712439000
}" is not allowed.
    at org.springframework.security.web.firewall.StrictHttpFirewall$StrictFirewalledRequest.validateAllowedParameterName(StrictHttpFirewall.java:840)
    at org.springframework.security.web.firewall.StrictHttpFirewall$StrictFirewalledRequest.getParameterMap(StrictHttpFirewall.java:782)
    at javax.servlet.ServletRequestWrapper.getParameterMap(ServletRequestWrapper.java:169)
    at javax.servlet.ServletRequestWrapper.getParameterMap(ServletRequestWrapper.java:169)
    at javax.servlet.ServletRequestWrapper.getParameterMap(ServletRequestWrapper.java:169)
    at org.springframework.http.server.ServletServerHttpRequest.getBodyFromServletRequestParameters(ServletServerHttpRequest.java:248)
    at org.springframework.http.server.ServletServerHttpRequest.getBody(ServletServerHttpRequest.java:211)
    at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodArgumentResolver$EmptyBodyCheckingHttpInputMessage.<init>(AbstractMessageConverterMethodArgumentResolver.java:325)
    at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodArgumentResolver.readWithMessageConverters(AbstractMessageConverterMethodArgumentResolver.java:174)
    at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.readWithMessageConverters(RequestResponseBodyMethodProcessor.java:160)
    at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.resolveArgument(RequestResponseBodyMethodProcessor.java:133)
    at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:122)
    at org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:179)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:146)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1070)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:963)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:681)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:764)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:327)
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:122)
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:116)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:126)
    at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:81)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:109)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:149)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:103)
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:89)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:91)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90)
    at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:112)
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:82)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:55)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    at org.springframework.security.web.session.DisableEncodeUrlFilter.doFilterInternal(DisableEncodeUrlFilter.java:42)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:211)
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:183)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:354)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:267)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at org.springframework.cloud.sleuth.instrument.web.servlet.TracingFilter.doFilter(TracingFilter.java:68)
    at org.springframework.cloud.sleuth.autoconfig.instrument.web.TraceWebServletConfiguration$LazyTracingFilter.doFilter(TraceWebServletConfiguration.java:131)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:96)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
    at org.springframework.cloud.sleuth.instrument.web.tomcat.TraceValve.invoke(TraceValve.java:103)
</code>```

My code :

```<code>@PostMapping("/add-user-credit")
public UserCreditEntity addUserCredit(@RequestBody CustomerPaymentDto dto) {
    log.info("{} add User credit CustomerPaymentDto {} ", serviceName, dto);
    UserCreditEntity userCreditEntity = this.creditServiceImp.chargeCustomer(dto);
    return userCreditEntity;
}
</code>```

and my FiegnClient interface

```<code>@RequestMapping(method = RequestMethod.POST, path = "/catalytic/api/v1/payment/add-user-credit")
UserCreditDto addUserCredit(@RequestBody CustomerPaymentDto dto);
</code>```

I'm using Spring boot 2.7.5.

Body:
I'm trying to send a request from one service to another using FeignClient but I'm facing this error :

org.springframework.security.web.firewall.RequestRejectedException: The request was rejected because the parameter name "{
  "cpaymentId" : 4,
  "trnId" : "pi_3MHnxhJPH93PAwz91jxM5ADF",
  "total" : 50.0,
  "discount" : 0.0,
  "netTotal" : 50.0,
  "customerId" : 7,
  "stripeCustomer" : "cus_MwjijUIFfEfxzn",
  "userId" : 55,
  "stripePaymentInitId" : "pi_3MHnxhJPH93PAwz91jxM5ADF",
  "stripeClientSec" : "pi_3MHnxhJPH93PAwz91jxM5ADF_secret_6BtswHBCqrrDr7uVQEgEWW85D",
  "channel" : "APP",
  "tranStatus" : "SUCCESS",
  "createdAt" : 1671712410000,
  "updatedAt" : 1671712439000
}" is not allowed.
    at org.springframework.security.web.firewall.StrictHttpFirewall$StrictFirewalledRequest.validateAllowedParameterName(StrictHttpFirewall.java:840)
    at org.springframework.security.web.firewall.StrictHttpFirewall$StrictFirewalledRequest.getParameterMap(StrictHttpFirewall.java:782)
    at javax.servlet.ServletRequestWrapper.getParameterMap(ServletRequestWrapper.java:169)
    at javax.servlet.ServletRequestWrapper.getParameterMap(ServletRequestWrapper.java:169)
    at javax.servlet.ServletRequestWrapper.getParameterMap(ServletRequestWrapper.java:169)
    at org.springframework.http.server.ServletServerHttpRequest.getBodyFromServletRequestParameters(ServletServerHttpRequest.java:248)
    at org.springframework.http.server.ServletServerHttpRequest.getBody(ServletServerHttpRequest.java:211)
    at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodArgumentResolver$EmptyBodyCheckingHttpInputMessage.<init>(AbstractMessageConverterMethodArgumentResolver.java:325)
    at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodArgumentResolver.readWithMessageConverters(AbstractMessageConverterMethodArgumentResolver.java:174)
    at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.readWithMessageConverters(RequestResponseBodyMethodProcessor.java:160)
    at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.resolveArgument(RequestResponseBodyMethodProcessor.java:133)
    at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:122)
    at org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:179)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:146)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1070)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:963)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:681)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:764)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:327)
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:122)
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:116)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:126)
    at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:81)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:109)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:149)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:103)
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:89)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:91)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    at org.springframework.security.web.header.HeaderWriterFilter.doHeadersAfter(HeaderWriterFilter.java:90)
    at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:75)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:112)
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:82)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:55)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    at org.springframework.security.web.session.DisableEncodeUrlFilter.doFilterInternal(DisableEncodeUrlFilter.java:42)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:211)
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:183)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:354)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:267)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at org.springframework.cloud.sleuth.instrument.web.servlet.TracingFilter.doFilter(TracingFilter.java:68)
    at org.springframework.cloud.sleuth.autoconfig.instrument.web.TraceWebServletConfiguration$LazyTracingFilter.doFilter(TraceWebServletConfiguration.java:131)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:96)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
    at org.springframework.cloud.sleuth.instrument.web.tomcat.TraceValve.invoke(TraceValve.java:103)

My code :

@PostMapping("/add-user-credit")
public UserCreditEntity addUserCredit(@RequestBody CustomerPaymentDto dto) {
    log.info("{} add User credit CustomerPaymentDto {} ", serviceName, dto);
    UserCreditEntity userCreditEntity = this.creditServiceImp.chargeCustomer(dto);
    return userCreditEntity;
}

and my FiegnClient interface

@RequestMapping(method = RequestMethod.POST, path = "/catalytic/api/v1/payment/add-user-credit")
UserCreditDto addUserCredit(@RequestBody CustomerPaymentDto dto);

I'm using Spring boot 2.7.5.


问:
How do I connect my discord bot with websites so I can make it search up something (ex: connect with Google so it search on google)
I want my bot to make search up something in websites. I want it to be connected with kitsu.io, youtube and google. I don't know how to connect them and I don't know to make the codes please help me.... discord.js version 14, node.js, slash command (JAVASCRIPT)

I tried to find out how connect them and how to code them. But I could not figure them out.... (I'm not really smart) please anyone help me


问:
Is it possible to pass an xcom into a python variable?
I am simply trying to get the return value from an xcom into a python variable, something like this:

```<code>datasets = S3ListPrefixesOperator(
    task_id='list_s3_prefixes',
    bucket = get_bucket(),
    prefix = 'my_key/',
    delimiter = '/'
)

bucket_keys = task_instance.xcom_pull(task_ids='list_s3_prefixes')
</code>```

what id like to do then is to loop through each bucket key and create a S3Copy based on each bucket.

How do i get this accomplished?

Body:
I am simply trying to get the return value from an xcom into a python variable, something like this:

datasets = S3ListPrefixesOperator(
    task_id='list_s3_prefixes',
    bucket = get_bucket(),
    prefix = 'my_key/',
    delimiter = '/'
)

bucket_keys = task_instance.xcom_pull(task_ids='list_s3_prefixes')

what id like to do then is to loop through each bucket key and create a S3Copy based on each bucket.

How do i get this accomplished?


问:
Mediatr IActionResult Best Practices
There seems to be an endless amount of articles on Mediatr usage for ASP.NET that shows controllers simply firing mediatr commands/queries and returning Ok regardless of results
(one, two, three, these are the top results on google for asp.net mediatr)

Take the following example.

```<code>var result = await _mediator.Send(new GetCustomerByIdQuery
{
   Id = id
});
return Ok(result);
</code>```

For another example, Lets take a Create User endpoint for a simple system, The only requirement is the system needs to check for duplicates before it creates.

You could do something like this with returning IActionResult directly, Letting the handler do the duplicate search and return a full result.

```<code>public async Task<IActionResult> CreateUser([FromBody] CreateUserEntryRequest user)
{
    return await Mediator.Send(new CreateUserCommand(user));
}
</code>```

Or something more like this, Where the controller does the work

```<code>public async Task<IActionResult> CreateUser([FromBody] CreateUserEntryRequest user)
{
   var duplicatesExist = await Mediator.Send(new SearchForDuplicatesQuery(user));
   if (duplicatesExist)
      return BadRequest("Username already exists");
   return await Mediator.Send(new CreateUserCommand(user));
}
</code>```

Or if we do something similar to whats shown in the articles we would do the first one but wrap it in an Ok(); But that makes it fairly difficult for the client to know why a request failed. It cant know if an issue is a ValidationError, A downstream dependency issue, or if there was a duplicate user and so the request failed.

Title: Mediatr IActionResult Best Practices

Body:
There seems to be an endless amount of articles on Mediatr usage for ASP.NET that shows controllers simply firing mediatr commands/queries and returning Ok regardless of results
(one, two, three, these are the top results on google for asp.net mediatr)

Take the following example.

var result = await _mediator.Send(new GetCustomerByIdQuery
{
   Id = id
});
return Ok(result);

For another example, Lets take a Create User endpoint for a simple system, The only requirement is the system needs to check for duplicates before it creates.

You could do something like this with returning IActionResult directly, Letting the handler do the duplicate search and return a full result.

public async Task<IActionResult> CreateUser([FromBody] CreateUserEntryRequest user)
{
    return await Mediator.Send(new CreateUserCommand(user));
}

Or something more like this, Where the controller does the work

public async Task<IActionResult> CreateUser([FromBody] CreateUserEntryRequest user)
{
   var duplicatesExist = await Mediator.Send(new SearchForDuplicatesQuery(user));
   if (duplicatesExist)
      return BadRequest("Username already exists");
   return await Mediator.Send(new CreateUserCommand(user));
}

Or if we do something similar to whats shown in the articles we would do the first one but wrap it in an Ok(); But that makes it fairly difficult for the client to know why a request failed. It cant know if an issue is a ValidationError, A downstream dependency issue, or if there was a duplicate user and so the request failed.


问:
Traceback error while uploading file to dropbox in python
I am building a test upload api to check dropbox to build final project but I am getting this error when i run python file in cmd:

```<code>Traceback (most recent call last):
  File "C:\Users\sufiy\Desktop\test.py", line 7, in <module>
    dbx.files_upload(file_contents, '/testdropbox.txt', mode=dropbox.files.WriteMode.overwrite)
  File "C:\Users\sufiy\AppData\Local\Programs\Python\Python311\Lib\site-packages\dropbox\base.py", line 3210, in files_upload
    r = self.request(
        ^^^^^^^^^^^^^
  File "C:\Users\sufiy\AppData\Local\Programs\Python\Python311\Lib\site-packages\dropbox\dropbox_client.py", line 326, in request
    res = self.request_json_string_with_retry(host,
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\sufiy\AppData\Local\Programs\Python\Python311\Lib\site-packages\dropbox\dropbox_client.py", line 476, in request_json_string_with_retry
    return self.request_json_string(host,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\sufiy\AppData\Local\Programs\Python\Python311\Lib\site-packages\dropbox\dropbox_client.py", line 538, in request_json_string
    raise TypeError('expected request_binary as binary type, got %s' %
TypeError: expected request_binary as binary type, got <class 'str'>

</code>```

here is my code:

```<code>import dropbox

dbx = dropbox.Dropbox('my api key')
with open('testdropbox.txt', 'r') as f:
     file_contents = f.read()
dbx.files_upload(file_contents, '/testdropbox.txt', mode=dropbox.files.WriteMode('overwrite'))
</code>```

I tried to build a program that overwrite txt file every minute and I want it to work so I can schedule this by using windows task schedule

Body:
I am building a test upload api to check dropbox to build final project but I am getting this error when i run python file in cmd:

Traceback (most recent call last):
  File "C:\Users\sufiy\Desktop\test.py", line 7, in <module>
    dbx.files_upload(file_contents, '/testdropbox.txt', mode=dropbox.files.WriteMode.overwrite)
  File "C:\Users\sufiy\AppData\Local\Programs\Python\Python311\Lib\site-packages\dropbox\base.py", line 3210, in files_upload
    r = self.request(
        ^^^^^^^^^^^^^
  File "C:\Users\sufiy\AppData\Local\Programs\Python\Python311\Lib\site-packages\dropbox\dropbox_client.py", line 326, in request
    res = self.request_json_string_with_retry(host,
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\sufiy\AppData\Local\Programs\Python\Python311\Lib\site-packages\dropbox\dropbox_client.py", line 476, in request_json_string_with_retry
    return self.request_json_string(host,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\sufiy\AppData\Local\Programs\Python\Python311\Lib\site-packages\dropbox\dropbox_client.py", line 538, in request_json_string
    raise TypeError('expected request_binary as binary type, got %s' %
TypeError: expected request_binary as binary type, got <class 'str'>

here is my code:

import dropbox

dbx = dropbox.Dropbox('my api key')
with open('testdropbox.txt', 'r') as f:
     file_contents = f.read()
dbx.files_upload(file_contents, '/testdropbox.txt', mode=dropbox.files.WriteMode('overwrite'))

I tried to build a program that overwrite txt file every minute and I want it to work so I can schedule this by using windows task schedule


问:
How to send Google form with "form in mail" not just the form's link using Python
Hi i was asking if google form's api or drive's api settings have any way to send mail with form include form in mail using python i can send it from form's setting
and the content in the mail will be like that
Thanks in advance

I tried service account with console google application he just create a form and give me it's link and i just send the link


问:
Java code is not printing from start to end
I have this Junit class to do some test, what I've noticed that the test are not started from top to bottom

```<code>package test;
import org.junit.Assert;
import org.junit.Test;

import monprojet.SommeArgent;

public class test {
    SommeArgent m12CHF= new SommeArgent(12, "CHF");
    SommeArgent m14CHF= new SommeArgent(14, "CHF");
    @Test
    public void FirstTest() throws UniteDistincteException {
        System.out.println("1ere passage avant execution d'une methode de test");
        SommeArgent expected = new SommeArgent(26, "CHF");
        SommeArgent result = m12CHF.add(m14CHF);
        Assert.assertTrue(expected.equals(result));
        System.out.println("1ere passage apres execution d'une methode de test");
    }

    @Test
    public void SecondTest() {
        System.out.println("2eme passage avant execution d'une methode de test");
        SommeArgent m14USD= new SommeArgent(14, "USD");
        Assert.assertTrue(!m12CHF.equals(null));
        Assert.assertEquals(m12CHF, m12CHF);
        Assert.assertEquals(m12CHF, new SommeArgent(12, "CHF"));
        Assert.assertTrue(!m12CHF.equals(m14CHF));
        Assert.assertTrue(!m14USD.equals(m14CHF));
        System.out.println("2eme passage apres execution d'une methode de test");
    }

    @Test
    public void ThirdTest() throws UniteDistincteException {
        System.out.println("3eme passage avant execution d'une methode de test");
        SommeArgent m15USD= new SommeArgent(15, "USD");
        SommeArgent m15TND= new SommeArgent(15, "TND");
        try{
            SommeArgent Moannaie = m15USD.add(m15TND);
        }catch(Exception e){
            System.out.println(e);
        }
        System.out.println("3eme passage apres execution d'une methode de test");

    }
}
</code>```

when I run the test this is the output

```<code>2eme passage avant execution d'une methode de test
2eme passage apres execution d'une methode de test
3eme passage avant execution d'une methode de test
unite distincte : USD != TND
3eme passage apres execution d'une methode de test
1ere passage avant execution d'une methode de test
1ere passage apres execution d'une methode de test

</code>```

as you can see it's not going in the order that the code was written

Blockquote

Body:
I have this Junit class to do some test, what I've noticed that the test are not started from top to bottom

package test;
import org.junit.Assert;
import org.junit.Test;

import monprojet.SommeArgent;

public class test {
    SommeArgent m12CHF= new SommeArgent(12, "CHF");
    SommeArgent m14CHF= new SommeArgent(14, "CHF");
    @Test
    public void FirstTest() throws UniteDistincteException {
        System.out.println("1ere passage avant execution d'une methode de test");
        SommeArgent expected = new SommeArgent(26, "CHF");
        SommeArgent result = m12CHF.add(m14CHF);
        Assert.assertTrue(expected.equals(result));
        System.out.println("1ere passage apres execution d'une methode de test");
    }

    @Test
    public void SecondTest() {
        System.out.println("2eme passage avant execution d'une methode de test");
        SommeArgent m14USD= new SommeArgent(14, "USD");
        Assert.assertTrue(!m12CHF.equals(null));
        Assert.assertEquals(m12CHF, m12CHF);
        Assert.assertEquals(m12CHF, new SommeArgent(12, "CHF"));
        Assert.assertTrue(!m12CHF.equals(m14CHF));
        Assert.assertTrue(!m14USD.equals(m14CHF));
        System.out.println("2eme passage apres execution d'une methode de test");
    }

    @Test
    public void ThirdTest() throws UniteDistincteException {
        System.out.println("3eme passage avant execution d'une methode de test");
        SommeArgent m15USD= new SommeArgent(15, "USD");
        SommeArgent m15TND= new SommeArgent(15, "TND");
        try{
            SommeArgent Moannaie = m15USD.add(m15TND);
        }catch(Exception e){
            System.out.println(e);
        }
        System.out.println("3eme passage apres execution d'une methode de test");

    }
}

when I run the test this is the output

2eme passage avant execution d'une methode de test
2eme passage apres execution d'une methode de test
3eme passage avant execution d'une methode de test
unite distincte : USD != TND
3eme passage apres execution d'une methode de test
1ere passage avant execution d'une methode de test
1ere passage apres execution d'une methode de test

as you can see it's not going in the order that the code was written

Blockquote


问:
Why does all the text disappear when I try to make a login component in react.js?
So first of all this is my code

App.js

```<code>import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
import './App.css';
import Login from "./components/Login";

function App() {
  return (
    <div className="App">
      <Router>
        <Routes>
          <Route exact path = "/">
            <Login />
          </Route>
        </Routes>
      </Router>

      <h2> Testar </h2>

    </div>
  );
}

export default App;
</code>```

and this is for Login.js

```<code>import styled from "styled-components"

const Login = (props) => {
    return <div> Login </div>
};

export default Login;
</code>```

I expected "Login" to be written out but it doesn't. In addition to that, my text where it says "test" also disappears. Do anyone know what's wrong?

Body:
So first of all this is my code

App.js

import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
import './App.css';
import Login from "./components/Login";

function App() {
  return (

      <Router>
        <Routes>
          <Route exact path = "/">
            <Login />
          </Route>
        </Routes>
      </Router>

 Testar

  );
}

export default App;

and this is for Login.js

import styled from "styled-components"

const Login = (props) => {
    return
 Login

};

export default Login;

I expected "Login" to be written out but it doesn't. In addition to that, my text where it says "test" also disappears. Do anyone know what's wrong?


问:
Installing libcurl for Visual Studio 2019 for x64 package
I've attempted the following to get the lib curl installed for Visual Studio 2019 but it is not working. The libcurl.lib file is 20 KB which is incorrect.

```<code>vcpkg install curl:x64-windows
</code>```

I also do not find the VS2019 directory under curl-7.87.0\projects\Windows directory.

What is the correct approach to build X64 version of libcurl for VS2019?

Body:
I've attempted the following to get the lib curl installed for Visual Studio 2019 but it is not working. The libcurl.lib file is 20 KB which is incorrect.

vcpkg install curl:x64-windows

I also do not find the VS2019 directory under curl-7.87.0\projects\Windows directory.

What is the correct approach to build X64 version of libcurl for VS2019?


问:
Regex expression that locates a null value
I need a regex that locates a null value.

I'm working with an application that has a bug in its query generator:

I'm not able to design a query to test value IS NULL

select * from table where column is null

Instead, I have to design a query using value MATCHES [regex]

select * from table where column matches ^

Is there a regex that resolves/locates a null value?

Here's a screenshot of the GUI query editor; the text box accepts regex expressions

Note: The example below doesn't work (ignore the cursor next to the caret)


问:
Can you use aggregate functions with Snowflake's connect by?
I basically want to replicate this (from oracle):

https://databaseline.tech/how-to-multiply-across-a-hierarchy-in-oracle-part-1/

In Snowflake using connect by. First of all, I haven't found any documentation that tells me if I can (or how to) use aggregate functions with connect by.

Second, I've tried to replicate the code from the post above in Snowflake:

```<code>SELECT LEVEL
    ,o.id
    ,o.yield
    ,(
       SELECT ROUND( EXP(SUM(LN(i.yield))), 2 ) -- only two significant digits
       FROM hierarchy_example i
       START WITH i.id = o.id -- start with the row from the outer query
       CONNECT BY i.id = PRIOR i.prior_id -- reverse direction of PRIOR to go back up
    ) AS yield_to_step
    ,connect_by_root o.id AS root_id
    ,sys_connect_by_path(o.id, '->') as path
FROM hierarchy_example o
START WITH o.prior_id IS NULL -- start with anchor rows
CONNECT BY o.prior_id = PRIOR o.ID -- go down hierarchy
</code>```

But when I run it I get this error:

```<code>000603 (XX000): SQL execution internal error:
Processing aborted due to error 370001:416518821; incident 8391142.
</code>```

So does anyone how to do this in Snowflake or if it is even possible?

Body:
I basically want to replicate this (from oracle):

https://databaseline.tech/how-to-multiply-across-a-hierarchy-in-oracle-part-1/

In Snowflake using connect by. First of all, I haven't found any documentation that tells me if I can (or how to) use aggregate functions with connect by.

Second, I've tried to replicate the code from the post above in Snowflake:

SELECT LEVEL
    ,o.id
    ,o.yield
    ,(
       SELECT ROUND( EXP(SUM(LN(i.yield))), 2 ) -- only two significant digits
       FROM hierarchy_example i
       START WITH i.id = o.id -- start with the row from the outer query
       CONNECT BY i.id = PRIOR i.prior_id -- reverse direction of PRIOR to go back up
    ) AS yield_to_step
    ,connect_by_root o.id AS root_id
    ,sys_connect_by_path(o.id, '->') as path
FROM hierarchy_example o
START WITH o.prior_id IS NULL -- start with anchor rows
CONNECT BY o.prior_id = PRIOR o.ID -- go down hierarchy

But when I run it I get this error:

000603 (XX000): SQL execution internal error:
Processing aborted due to error 370001:416518821; incident 8391142.

So does anyone how to do this in Snowflake or if it is even possible?


问:
AWS sam local start api with lambda written in java and packaged as docker image
I have implemented the lambda function using java (taken from the docs actually).

```<code>package trial;

import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.RequestHandler;
import com.amazonaws.services.lambda.runtime.LambdaLogger;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

import java.util.Map;

public class Handler implements RequestHandler<Map<String,Object>, String>{
    Gson gson = new GsonBuilder().setPrettyPrinting().create();
    @Override
    public String handleRequest(Map<String,Object> event, Context context)
    {
        LambdaLogger logger = context.getLogger();
        String response = "200 OK";
        // log execution details
        logger.log("ENVIRONMENT VARIABLES: " + gson.toJson(System.getenv()));
        logger.log("CONTEXT: " + gson.toJson(context));
        // process event
        logger.log("EVENT: " + gson.toJson(event));
        logger.log("EVENT TYPE: " + event.getClass().toString());
        return response;
    }
}
</code>```

Then I packed it in a docker image:

```<code>FROM public.ecr.aws/lambda/java:11

COPY lib/* ${LAMBDA_TASK_ROOT}/lib/

CMD [ "trial.Handler::handleRequest" ]
</code>```

Then, using AWS CDK I want to use this image as lambda handler:

```<code>  const repo = aws.aws_ecr.Repository.fromRepositoryArn(
    construct, "repoId", "arn:aws:ecr:eu-west-1:***ACCOUNTID***:repository/repo"
  )

  const lambda1 = new aws.aws_lambda.DockerImageFunction(construct, "HelloFunction", {
    code: aws.aws_lambda.DockerImageCode.fromEcr(repo),
  })

  const api = new aws.aws_apigateway.LambdaRestApi(construct, 'sample-api', {
    handler: lambda1
  })
</code>```

I can deploy this lambda to AWS and everything works as expected.

But it doesn't work when I want to test it using AWS SAM local.

```<code>sam local start-api -t cdk.out/HelloCdkStack.template.json --warm-containers EAGER
</code>```

I get an error:

```<code>    "resourceId": "123456",
    "resourcePath": "/{proxy+}",
    "stage": "prod"
  },
  "resource": "/{proxy+}",
  "version": "1.0"
}EVENT TYPE: class java.util.LinkedHashMapEND RequestId: 9a7201d8-7b4b-486e-9208-2da9a8972347
REPORT RequestId: 9a7201d8-7b4b-486e-9208-2da9a8972347  Duration: 9.99 ms       Billed Duration: 10 ms  Memory Size: 128 MB     Max Memory Used: 128 MB
Invalid lambda response received: Lambda returned <class 'str'> instead of dict
2022-12-23 01:30:24 127.0.0.1 - - [23/Dec/2022 01:30:24] "GET /favicon.ico HTTP/1.1" 502 -
</code>```

** UPDATE, solved

The Handler must return Object for unknown reason.

```<code>    return Map.of(
        "statusCode", 200,
        "body", "test response",
        "headers", Map.of(
        "Content-Type", "application/json"
        )
    );
</code>```

Body:
I have implemented the lambda function using java (taken from the docs actually).

package trial;

import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.RequestHandler;
import com.amazonaws.services.lambda.runtime.LambdaLogger;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

import java.util.Map;

public class Handler implements RequestHandler<Map<String,Object>, String>{
    Gson gson = new GsonBuilder().setPrettyPrinting().create();
    @Override
    public String handleRequest(Map<String,Object> event, Context context)
    {
        LambdaLogger logger = context.getLogger();
        String response = "200 OK";
        // log execution details
        logger.log("ENVIRONMENT VARIABLES: " + gson.toJson(System.getenv()));
        logger.log("CONTEXT: " + gson.toJson(context));
        // process event
        logger.log("EVENT: " + gson.toJson(event));
        logger.log("EVENT TYPE: " + event.getClass().toString());
        return response;
    }
}

Then I packed it in a docker image:

FROM public.ecr.aws/lambda/java:11

COPY lib/* ${LAMBDA_TASK_ROOT}/lib/

CMD [ "trial.Handler::handleRequest" ]

Then, using AWS CDK I want to use this image as lambda handler:

  const repo = aws.aws_ecr.Repository.fromRepositoryArn(
    construct, "repoId", "arn:aws:ecr:eu-west-1:***ACCOUNTID***:repository/repo"
  )

  const lambda1 = new aws.aws_lambda.DockerImageFunction(construct, "HelloFunction", {
    code: aws.aws_lambda.DockerImageCode.fromEcr(repo),
  })

  const api = new aws.aws_apigateway.LambdaRestApi(construct, 'sample-api', {
    handler: lambda1
  })

I can deploy this lambda to AWS and everything works as expected.

But it doesn't work when I want to test it using AWS SAM local.

sam local start-api -t cdk.out/HelloCdkStack.template.json --warm-containers EAGER

I get an error:

    "resourceId": "123456",
    "resourcePath": "/{proxy+}",
    "stage": "prod"
  },
  "resource": "/{proxy+}",
  "version": "1.0"
}EVENT TYPE: class java.util.LinkedHashMapEND RequestId: 9a7201d8-7b4b-486e-9208-2da9a8972347
REPORT RequestId: 9a7201d8-7b4b-486e-9208-2da9a8972347  Duration: 9.99 ms       Billed Duration: 10 ms  Memory Size: 128 MB     Max Memory Used: 128 MB
Invalid lambda response received: Lambda returned <class 'str'> instead of dict
2022-12-23 01:30:24 127.0.0.1 - - [23/Dec/2022 01:30:24] "GET /favicon.ico HTTP/1.1" 502 -

** UPDATE, solved

The Handler must return Object for unknown reason.

    return Map.of(
        "statusCode", 200,
        "body", "test response",
        "headers", Map.of(
        "Content-Type", "application/json"
        )
    );


问:
How to make a custom font load faster on website instead of downloading whole font every time?
I use a custom font on my website, Hestia.market, and because the browser has to download the whole font every time it takes a very long time to load. I normally just use google fonts api and so speed hasn't been a problem for me before. How would I make the font load faster?</p>


问:
Dagger Hilt : cannot be provided without an @Provides-annotated method. public abstract static class SingletonC implements HybridEntryPoint,
I have a feature that I am migrating to Hilt. At the present moment after adding
@AndroidEntryPoint for the fragment and @HiltViewModel for the ViewModel.

The classes are below :

Interface

```<code>interface MyInterface {

    fun throwValidation(errorMessage: String, @IdRes viewResId: Int)
}
</code>```

Fragment

```<code>@AndroidEntryPoint
class OrderReplacementFragment : Fragment(), MyInterface {

    override fun throwValidation(errorMessage: String, viewResId: Int) {
    }
}
</code>```

Viewmodel

```<code>@HiltViewModel
class OrderReplacementViewModel @Inject constructor(application: Application, private val validation: MyInterface,
  @Named("io") private val ioContext: CoroutineContext) : AndroidViewModel(application) {
   }

@Module
@InstallIn(SingletonComponent::class)
abstract class OrderReplaceCardModule {

    @Module
    abstract class OrderReplaceCardFragmentModule {

        @Binds
        abstract fun bindHandDeliveryDetailsValidationListener(impl: OrderReplacementFragment): MyInterface

    }
}
</code>```

However, when trying to do the build. I get the following error below :

```<code>/phone/PhoneApp_HiltComponents.java:1064: error: [Dagger/MissingBinding] com.cat.mobile.android.card.interfaces.MyInterface cannot be provided without an @Provides-annotated method.
  public abstract static class SingletonC implements HybridEntryPoint,
                         ^
      com.cat.mobile.android.card.interfaces.MyInterface is injected at
          com.cat.mobile.android.card.orderreplacementcard.viewmodel.OrderReplacementViewModel(…, validation, …)
      com.cat.mobile.android.card.orderreplacementcard.viewmodel.OrderReplacementViewModel is injected at
          com.cat.mobile.android.card.orderreplacementcard.viewmodel.OrderReplacementViewModel_HiltModules.BindsModule.binds(vm)
      @dagger.hilt.android.internal.lifecycle.HiltViewModelMap java.util.Map<java.lang.String,javax.inject.Provider<androidx.lifecycle.ViewModel>> is requested at
          dagger.hilt.android.internal.lifecycle.HiltViewModelFactory.ViewModelFactoriesEntryPoint.getHiltViewModelMap() [com.cat.mobile.phone]
</code>```

How best can I go in resolving this issue ?

Body:
I have a feature that I am migrating to Hilt. At the present moment after adding
@AndroidEntryPoint for the fragment and @HiltViewModel for the ViewModel.

The classes are below :

Interface

interface MyInterface {

    fun throwValidation(errorMessage: String, @IdRes viewResId: Int)
}

Fragment

@AndroidEntryPoint
class OrderReplacementFragment : Fragment(), MyInterface {

    override fun throwValidation(errorMessage: String, viewResId: Int) {
    }
}

Viewmodel

@HiltViewModel
class OrderReplacementViewModel @Inject constructor(application: Application, private val validation: MyInterface,
  @Named("io") private val ioContext: CoroutineContext) : AndroidViewModel(application) {
   }

@Module
@InstallIn(SingletonComponent::class)
abstract class OrderReplaceCardModule {

    @Module
    abstract class OrderReplaceCardFragmentModule {

        @Binds
        abstract fun bindHandDeliveryDetailsValidationListener(impl: OrderReplacementFragment): MyInterface

    }
}

However, when trying to do the build. I get the following error below :

/phone/PhoneApp_HiltComponents.java:1064: error: [Dagger/MissingBinding] com.cat.mobile.android.card.interfaces.MyInterface cannot be provided without an @Provides-annotated method.
  public abstract static class SingletonC implements HybridEntryPoint,
                         ^
      com.cat.mobile.android.card.interfaces.MyInterface is injected at
          com.cat.mobile.android.card.orderreplacementcard.viewmodel.OrderReplacementViewModel(…, validation, …)
      com.cat.mobile.android.card.orderreplacementcard.viewmodel.OrderReplacementViewModel is injected at
          com.cat.mobile.android.card.orderreplacementcard.viewmodel.OrderReplacementViewModel_HiltModules.BindsModule.binds(vm)
      @dagger.hilt.android.internal.lifecycle.HiltViewModelMap java.util.Map<java.lang.String,javax.inject.Provider<androidx.lifecycle.ViewModel>> is requested at
          dagger.hilt.android.internal.lifecycle.HiltViewModelFactory.ViewModelFactoriesEntryPoint.getHiltViewModelMap() [com.cat.mobile.phone]

How best can I go in resolving this issue ?


问:
Syntax PHP/Laravel
Hi guys I am new to PHP and Laravel, I came across this syntax:

```<code> return ($this->someObject)($param1, $param2);
</code>```

but I can't understand it, would someone be so kind as to explain it to a newbie in php? consider that:
I understand the OOP and I understand that someObject is part of a dependency injection and its class contains a single method called __invoke, but I don't understand why parentheses are used like that when trying to use a method, I also understand (if I'm wrong please correct me) that the methods called __invoke work as a kind of single method and are executed automatically when using the instance of your class (I think I read about it in the laravel documentation), is that why the parentheses are used in such a strange way?, thank you very much in advance!

Title: Syntax PHP/Laravel

Body:
Hi guys I am new to PHP and Laravel, I came across this syntax:

 return ($this->someObject)($param1, $param2);

but I can't understand it, would someone be so kind as to explain it to a newbie in php? consider that:
I understand the OOP and I understand that someObject is part of a dependency injection and its class contains a single method called __invoke, but I don't understand why parentheses are used like that when trying to use a method, I also understand (if I'm wrong please correct me) that the methods called __invoke work as a kind of single method and are executed automatically when using the instance of your class (I think I read about it in the laravel documentation), is that why the parentheses are used in such a strange way?, thank you very much in advance!


问:
Json object to return the result of total and name(JavaScript)
I have this Json Object, The idea is to match the id in the totalById and the nameById and return the value in this form

```<code>{
  name: Beginning,
  total: 20
}, {
  name: Automation,
  total: 0
}
attrs: {
  daily: {
    "totalById": {
      "6137ad545fc0c40785920e48": 0,
      "612e64f65fc0c4078569bacf": 0,
      "614231535fc0c40785bf0907": 20
    }
  },
  "nameById": {
    "6137ad545fc0c40785920e48": "Automation",
    "612e64f65fc0c4078569bacf": "Excellent Idea",
    "614231535fc0c40785bf0907": "Beginning ",
  }
}
</code>```

I have tried ensuring that both of the object literals are in order and then use the object. Values () on each of the Object literals,

But I just cannot seem to get it to return in this form

{name: Beginning, total: 20}, {name: Automation, total: 0}

Body:
I have this Json Object, The idea is to match the id in the totalById and the nameById and return the value in this form

{
  name: Beginning,
  total: 20
}, {
  name: Automation,
  total: 0
}
attrs: {
  daily: {
    "totalById": {
      "6137ad545fc0c40785920e48": 0,
      "612e64f65fc0c4078569bacf": 0,
      "614231535fc0c40785bf0907": 20
    }
  },
  "nameById": {
    "6137ad545fc0c40785920e48": "Automation",
    "612e64f65fc0c4078569bacf": "Excellent Idea",
    "614231535fc0c40785bf0907": "Beginning ",
  }
}

I have tried ensuring that both of the object literals are in order and then use the object. Values () on each of the Object literals,

But I just cannot seem to get it to return in this form

{name: Beginning, total: 20}, {name: Automation, total: 0}


问:
Create overflow in one div with height in percentages
I'm creating a card header with an image as a background, but I want it to have overflow, I tried setting the height at 100 and max height at 70 percent, but didn't work, this is what I have, and I want it to make it in the same div, and if it is possible just to work with percentage

.cartaCus {
    width: 92% !important;
    height: 90% !important;
}

.h90 {
    height: 90%;
}

.mapHeader {
    overflow: auto;
    height: 100%;
    max-height: 70%;
    width: 100%;
    background-image: url(./../../../assets/images/backgrounds/map.png);
    background-color:red;
}
.w100 {
    width: 100%;
}
.alic {
    display: flex;
    justify-content: center;
    align-items: center;
}
.carta {
    background-color: white;
    border-radius: 10px;
    width: 100%;
    box-shadow: 0px 0px 4px 0px rgb(0 0 0 / 22%);
}
html,
body {
    height: 100%;
}

body {
    margin: 0;
    font-family: Roboto, "Helvetica Neue", sans-serif;
    background-color: #dedede;
}
.h100 {
    height: 100%;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><div class="w100 h90">
    <div class="alic h100">
        <div class="carta cartaCus">
            <div class="mapHeader">

            </div>
        </div>
    </div>
</div></code>```


问:
reactjs: Tooltip hides in react-select component
I am using React-JS to work on a project and I need to use tooltips on a react-select element.

As you can see in the picture above, the tooltip hides and cannot be fully visible.

I have tried solving this by adjusting the css code to include the z-index and the overflow options, like this:

```<code>.tooltip {
  position: relative;
  display: inline-block;
  border-bottom: 1px dotted black;
  overflow: visible !important;
  z-index: 101;
}

.tooltip .tooltiptext {
  visibility: hidden;
  width: 320px;
  bottom: 100%;
  left: 50%;
  margin-left: -160px;
  background-color: rgb(0, 0, 0);
  opacity: 0.8;
  color: #fff;
  text-align: center;
  padding: 5px 0;
  border-radius: 6px;
  overflow: visible !important;
  z-index: 101;

  position: absolute;
}

.tooltip:hover .tooltiptext {
  visibility: visible !important;
  overflow: visible ;
  z-index: 101;
}
</code>```

Similarly, I have also adjusted the Select component, to set it to a lower zIndex:

```<code>
<Select
              instanceId={obj._id}
              options={answers}
              onChange={(inputValue) =>
                handleAnswers(inputValue, quest[0])
              }
              defaultValue={ans[0]}
              loadingMessage={() => "Loading..."}
              noOptionsMessage={() => "No options"}
              placeholder="Choose your answer"
              isSearchable={false}
              styles={{
                zIndex: 100,
              }}
              isMulti
            />
</code>```

No option has worked so far, what could solve the issue? Thank you in advance.

Body:
I am using React-JS to work on a project and I need to use tooltips on a react-select element.

As you can see in the picture above, the tooltip hides and cannot be fully visible.

I have tried solving this by adjusting the css code to include the z-index and the overflow options, like this:

.tooltip {
  position: relative;
  display: inline-block;
  border-bottom: 1px dotted black;
  overflow: visible !important;
  z-index: 101;
}

.tooltip .tooltiptext {
  visibility: hidden;
  width: 320px;
  bottom: 100%;
  left: 50%;
  margin-left: -160px;
  background-color: rgb(0, 0, 0);
  opacity: 0.8;
  color: #fff;
  text-align: center;
  padding: 5px 0;
  border-radius: 6px;
  overflow: visible !important;
  z-index: 101;

  position: absolute;
}

.tooltip:hover .tooltiptext {
  visibility: visible !important;
  overflow: visible ;
  z-index: 101;
}

Similarly, I have also adjusted the Select component, to set it to a lower zIndex:

<Select
              instanceId={obj._id}
              options={answers}
              onChange={(inputValue) =>
                handleAnswers(inputValue, quest[0])
              }
              defaultValue={ans[0]}
              loadingMessage={() => "Loading..."}
              noOptionsMessage={() => "No options"}
              placeholder="Choose your answer"
              isSearchable={false}
              styles={{
                zIndex: 100,
              }}
              isMulti
            />

No option has worked so far, what could solve the issue? Thank you in advance.


问:
Use custom parameter annotations with RESTEasy
I want to be able to do something like this:

```<code>@Path("/test")
@GET
public Response get(@Pageable(minSize = 5, maxSize = 10) Pageable pageable)
</code>```

In Jersey, this can be achieved by implementing and registering a custom ValueParamProvider. How can this be done with RESTEasy?

RESTEasy's parameter injectors for the default @*Param annotations are defined by implementing the ValueInjector interface. This looks suitable for my usecase, but I am not sure how to register a new instance.

The default @*Param injectors are registered in the InjectorFactoryImpl class, but this does not look like something I can do.

Body:
I want to be able to do something like this:

@Path("/test")
@GET
public Response get(@Pageable(minSize = 5, maxSize = 10) Pageable pageable)

In Jersey, this can be achieved by implementing and registering a custom ValueParamProvider. How can this be done with RESTEasy?

RESTEasy's parameter injectors for the default @*Param annotations are defined by implementing the ValueInjector interface. This looks suitable for my usecase, but I am not sure how to register a new instance.

The default @*Param injectors are registered in the InjectorFactoryImpl class, but this does not look like something I can do.


问:
Heroku Express / Nextjs client cookie not being set
So I'm having a bit of an issue where I have two apps hosted on Heroku the first being an Express application with the following cookie settings

```<code>const cookieSettings = {
    maxAge: expiryTime,
    ...cookieOptions || {},

    // For security these properties should always remain below the spread
    httpOnly: true,
    secure: process.env.NODE_ENV !== "development",
    sameSite: "none",
    path: "/",
  }
</code>```

And a Nextjs app which has some middleware that uses the cookie for login control to protect routes.

Locally I have no issues with the following login logic within the login route which sets the cookie browser side

```<code>    const cookie = getCookie({ tokenOptions: { id: user._id } });
    res.setHeader("Set-Cookie", cookie);
    return res.sendStatus(200);
</code>```

I have read there is issues with Heroku as it's on the public list of domains so the browser wont set if it comes from this but the issue I'm having is on a custom domain. My domain is https://www.mydomain.co.uk but for some reason I can't get it to set when I'm on this domain.

When using Postman I do get the cookie back but the domain comes from my API domain ie api.reviewcircle.co.uk which I think is why the browser isn't setting the cookie as the domains don't match but I can't find any info on how to fix this so would be great if anyone has any ideas.

You can see the cookie is included in the response but isn't set:

Body:
So I'm having a bit of an issue where I have two apps hosted on Heroku the first being an Express application with the following cookie settings

const cookieSettings = {
    maxAge: expiryTime,
    ...cookieOptions || {},

    // For security these properties should always remain below the spread
    httpOnly: true,
    secure: process.env.NODE_ENV !== "development",
    sameSite: "none",
    path: "/",
  }

And a Nextjs app which has some middleware that uses the cookie for login control to protect routes.

Locally I have no issues with the following login logic within the login route which sets the cookie browser side

    const cookie = getCookie({ tokenOptions: { id: user._id } });
    res.setHeader("Set-Cookie", cookie);
    return res.sendStatus(200);

I have read there is issues with Heroku as it's on the public list of domains so the browser wont set if it comes from this but the issue I'm having is on a custom domain. My domain is https://www.mydomain.co.uk but for some reason I can't get it to set when I'm on this domain.

When using Postman I do get the cookie back but the domain comes from my API domain ie api.reviewcircle.co.uk which I think is why the browser isn't setting the cookie as the domains don't match but I can't find any info on how to fix this so would be great if anyone has any ideas.

You can see the cookie is included in the response but isn't set:


问:
Pytorch model performing worse than tensorflow
I have the following tensorflow model, that tries to predict a time series, based on lagging values.

I then tried to translate it to pytorch and it works fine but performs significantly worse. Is there any obvious difference between the two models that could contribute to pytorch performing worse? Any suggestions are greatly apprecaited.

tensorflow model:

early_stop = EarlyStopping(monitor='val_loss',
min_delta=1e-3,
patience=3,
verbose=2, mode='auto')
tbCallBack = PlotLossesKeras()

```<code>model = Sequential()
model.add(LSTM(50, input_shape=(look_back, 1)))
model.add(Dropout(0.2))
model.add(Dense(1))
model.compile(loss='mean_squared_error', optimizer='adam')
model.fit(train_x, train_y,
          epochs=2000,
          batch_size=20, verbose=1)
</code>```

Pytorch Model:

```<code>class LSTMForecaster(nn.Module):
    def __init__(self, input_size, hidden_size, num_layers, output_size):
        super().__init__()

        self.lstm = nn.LSTM(input_size, hidden_size, num_layers)
        self.dropout = nn.Dropout(0.2)
        self.linear = nn.Linear(hidden_size, output_size)

    def forward(self, input_seq):
        lstm_out, _ = self.lstm(input_seq)
        dropout = self.dropout(lstm_out)
        predictions = self.linear(dropout)
        return predictions

loss_fn = nn.MSELoss()
optimizer = torch.optim.Adam(model_1.parameters())
model_1 = LSTMForecaster(input_size=3, hidden_size=50, num_layers=1, output_size=1)

torch.manual_seed(45)
epochs = 2000
batch_size = 20
num_batches = len(train_x) // batch_size
train_x = train_x.to(device)
test_x = test_x.to(device)
train_y = train_y.to(device)
test_y = test_y.to(device)

for epoch in range(epochs):
    for i in range(num_batches):
        # Get the current batch of data
        start = i * batch_size
        end = start + batch_size
        x_batch = train_x[start:end]
        y_batch = train_y[start:end]

        pred_y = model_1(x_batch)
        loss = loss_fn(pred_y, y_batch)
        optimizer.zero_grad()
        loss.backward()
        optimizer.step()

    model_1.eval()
</code>```

Body:
I have the following tensorflow model, that tries to predict a time series, based on lagging values.

I then tried to translate it to pytorch and it works fine but performs significantly worse. Is there any obvious difference between the two models that could contribute to pytorch performing worse? Any suggestions are greatly apprecaited.

tensorflow model:

early_stop = EarlyStopping(monitor='val_loss',
min_delta=1e-3,
patience=3,
verbose=2, mode='auto')
tbCallBack = PlotLossesKeras()

model = Sequential()
model.add(LSTM(50, input_shape=(look_back, 1)))
model.add(Dropout(0.2))
model.add(Dense(1))
model.compile(loss='mean_squared_error', optimizer='adam')
model.fit(train_x, train_y,
          epochs=2000,
          batch_size=20, verbose=1)

Pytorch Model:

class LSTMForecaster(nn.Module):
    def __init__(self, input_size, hidden_size, num_layers, output_size):
        super().__init__()

        self.lstm = nn.LSTM(input_size, hidden_size, num_layers)
        self.dropout = nn.Dropout(0.2)
        self.linear = nn.Linear(hidden_size, output_size)

    def forward(self, input_seq):
        lstm_out, _ = self.lstm(input_seq)
        dropout = self.dropout(lstm_out)
        predictions = self.linear(dropout)
        return predictions

loss_fn = nn.MSELoss()
optimizer = torch.optim.Adam(model_1.parameters())
model_1 = LSTMForecaster(input_size=3, hidden_size=50, num_layers=1, output_size=1)

torch.manual_seed(45)
epochs = 2000
batch_size = 20
num_batches = len(train_x) // batch_size
train_x = train_x.to(device)
test_x = test_x.to(device)
train_y = train_y.to(device)
test_y = test_y.to(device)

for epoch in range(epochs):
    for i in range(num_batches):
        # Get the current batch of data
        start = i * batch_size
        end = start + batch_size
        x_batch = train_x[start:end]
        y_batch = train_y[start:end]

        pred_y = model_1(x_batch)
        loss = loss_fn(pred_y, y_batch)
        optimizer.zero_grad()
        loss.backward()
        optimizer.step()

    model_1.eval()


问:
How to don't show/exclude a attribute in AWS Cognito?
I'm making a game and i don't want to show some "areas" in SignUp screen from Cognito??

Example, like these unchecked

I read the documentation and i find nothing!
I read StackOverflow and i can't find the solution!