问:
Delete several entities in cascade
```<code>@Entity
@Table(name = "regions")
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class RegionEntity extends BaseEntity {
    @NotNull
    @NotEmpty
    private String regionName;

    @NotNull
    @Min(1)
    @Column(unique = true)
    private Integer yandexSearchRegion;
}

@Entity
@Table(name = "sites")
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class SiteEntity extends BaseEntity {

    @URL
    @Getter
    @Column(unique = true)
    private String url;

    @OneToMany(mappedBy = "site",
               cascade = CascadeType.DETACH,
               orphanRemoval = true)
    @Getter
    @Setter
    private Set<PageEntity> pages;

    @NotNull
    boolean active;

    @NotNull
    @Getter
    @Setter
    @ManyToOne(cascade = CascadeType.DETACH)
    @JoinColumn(name="region_id", nullable=false)
    RegionEntity region;

    @Override
    public String toString() {
        return url;
    }
}

@Entity
@NoArgsConstructor
@Builder
@AllArgsConstructor
@Table(name = "pages")
public class PageEntity extends BaseEntity {

    @Getter
    @Setter
    @ManyToOne
    @JoinColumn(name = "site_id", nullable = false)
    private SiteEntity site;

    @Getter
    @Setter
    @URL
    private String url;

    @OneToMany(mappedBy = "page",
               cascade = CascadeType.DETACH,
               orphanRemoval = true)
    @Getter
    private Set<ClusterEntity> clusters;
}

@Test
void createRegionAndSeveralSitesAndSeveralPagesDeleteRegion() {
    RegionEntity region = createAndSaveRegion();

    SiteEntity site = createAndSaveSite(region);
    SiteEntity site1 = createAndSaveSite(region);
    SiteEntity site2 = createAndSaveSite(region);
    SiteEntity site3 = createAndSaveSite(region);
    SiteEntity site4 = createAndSaveSite(region);

    PageEntity page = createAndSavePage();
    PageEntity page1 = createAndSavePage();
    PageEntity page2 = createAndSavePage();
    PageEntity page3 = createAndSavePage();
    PageEntity page4 = createAndSavePage();

    regionRepository.delete(region); // Breakpoint.
}
</code>```

The debugger stops at the breakpoint. Any further step triggers the exception.

The mistake: https://dpaste.org/vTENN

Well, Referential integrity constraint violation:

"FKNKQMHD3B2AX60LMSS4YD5WUPD: PUBLIC.SITES FOREIGN KEY(REGION_ID) REFERENCES PUBLIC.REGIONS(ID) (1)"

But I have set CascadeType=DETACH. I would like all the descending line of entities connected by ManyToOne to be deleted in a cascade. Namely SiteEntity and then PageEntigy. And that is what this test is about.

Title: Delete several entities in cascade

Body:
@Entity
@Table(name = "regions")
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class RegionEntity extends BaseEntity {
    @NotNull
    @NotEmpty
    private String regionName;

    @NotNull
    @Min(1)
    @Column(unique = true)
    private Integer yandexSearchRegion;
}

@Entity
@Table(name = "sites")
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class SiteEntity extends BaseEntity {

    @URL
    @Getter
    @Column(unique = true)
    private String url;

    @OneToMany(mappedBy = "site",
               cascade = CascadeType.DETACH,
               orphanRemoval = true)
    @Getter
    @Setter
    private Set<PageEntity> pages;

    @NotNull
    boolean active;

    @NotNull
    @Getter
    @Setter
    @ManyToOne(cascade = CascadeType.DETACH)
    @JoinColumn(name="region_id", nullable=false)
    RegionEntity region;

    @Override
    public String toString() {
        return url;
    }
}

@Entity
@NoArgsConstructor
@Builder
@AllArgsConstructor
@Table(name = "pages")
public class PageEntity extends BaseEntity {

    @Getter
    @Setter
    @ManyToOne
    @JoinColumn(name = "site_id", nullable = false)
    private SiteEntity site;

    @Getter
    @Setter
    @URL
    private String url;

    @OneToMany(mappedBy = "page",
               cascade = CascadeType.DETACH,
               orphanRemoval = true)
    @Getter
    private Set<ClusterEntity> clusters;
}

@Test
void createRegionAndSeveralSitesAndSeveralPagesDeleteRegion() {
    RegionEntity region = createAndSaveRegion();

    SiteEntity site = createAndSaveSite(region);
    SiteEntity site1 = createAndSaveSite(region);
    SiteEntity site2 = createAndSaveSite(region);
    SiteEntity site3 = createAndSaveSite(region);
    SiteEntity site4 = createAndSaveSite(region);

    PageEntity page = createAndSavePage();
    PageEntity page1 = createAndSavePage();
    PageEntity page2 = createAndSavePage();
    PageEntity page3 = createAndSavePage();
    PageEntity page4 = createAndSavePage();

    regionRepository.delete(region); // Breakpoint.
}

The debugger stops at the breakpoint. Any further step triggers the exception.

The mistake: https://dpaste.org/vTENN

Well, Referential integrity constraint violation:

"FKNKQMHD3B2AX60LMSS4YD5WUPD: PUBLIC.SITES FOREIGN KEY(REGION_ID) REFERENCES PUBLIC.REGIONS(ID) (1)"

But I have set CascadeType=DETACH. I would like all the descending line of entities connected by ManyToOne to be deleted in a cascade. Namely SiteEntity and then PageEntigy. And that is what this test is about.


来源: stackexchange

问:
How can I rotate an array points obtained from image by a given angle along its axis?
I was doing my assignment, which requires me to translate and rotate my array which is 131072 x 3 (obtained from image) by random values. However, this has been difficult for me since I am just a beginner on Python environment. I used the following code.

```<code>img = cv2.imread(lidar_points)     #lidar_points is my array points I got from the image
rows,cols = img.shape
M = cv2.getRotationMatrix2D(((cols-1)/2.0,(rows-1)/2.0),30,1)
dst = cv2.warpAffine(img,M,(cols,rows))
cv2.imshow('img',dst)
cv2.waitKey(0)
cv2.destroyAllWindows()
</code>```

This will only work to output the rotated image itself, but I wanted to rotate the array (points) by certain degree along Z axis.

ContentLicense: CC BY-SA 4.0

Body:
I was doing my assignment, which requires me to translate and rotate my array which is 131072 x 3 (obtained from image) by random values. However, this has been difficult for me since I am just a beginner on Python environment. I used the following code.

img = cv2.imread(lidar_points)     #lidar_points is my array points I got from the image
rows,cols = img.shape
M = cv2.getRotationMatrix2D(((cols-1)/2.0,(rows-1)/2.0),30,1)
dst = cv2.warpAffine(img,M,(cols,rows))
cv2.imshow('img',dst)
cv2.waitKey(0)
cv2.destroyAllWindows()

This will only work to output the rotated image itself, but I wanted to rotate the array (points) by certain degree along Z axis.


问:
failed to load state with useState
```<code>function ArtikelPage() {
  const [data, setData] = React.useState([]);
  React.useEffect(() => {
    (async () => {
      const result = await getAllData('laporan');

      setData(result);
      console.log(data);
      console.log(result);
    })();
  }, []);

</code>```

why when i try to fill the state "data" by using setData(result) ,but when i console.log(data) the variable "data" array is empty , but when i console.log(result) the array contains

Title: failed to load state with useState

Body:
function ArtikelPage() {
  const [data, setData] = React.useState([]);
  React.useEffect(() => {
    (async () => {
      const result = await getAllData('laporan');

      setData(result);
      console.log(data);
      console.log(result);
    })();
  }, []);

why when i try to fill the state "data" by using setData(result) ,but when i console.log(data) the variable "data" array is empty , but when i console.log(result) the array contains


问:
Runtime error '70' in macro launching .bat after switching to Windows 10
After switching from Windows 7 to Windows 10, the script for extracting data, transforming it and uploading into database has stopped working. It gets stuck at part, which starts a bat file responsible for uploading a text file into the database. Error appears at line:  oShell.Run

```<code>Sub Upload_to_ICW(ScrName As String)
    Dim oShell As Object
    Dim sPathScr
    Set oShell = CreateObject("WScript.Shell")

    sPathScr = "v:\path\"
    oShell.Run Chr(34) & sPathScr & ScrName & ".bat" & Chr(34) & " " & Chr(34) & sPathScr & Chr(34), 2, True

End Sub
</code>```

I've tried messing around in trust center settings to no avail. Some users reported that it might've been related to office 365 privacy settings (but haven't reported what specifically). The path is definitely correct, it works fine on Windows 7 computer. All drive mappings are exactly the same.

Any idea how to go about this or perhaps what to specifically look for in privacy settings or is it just Windows 10 that doesn't allow to run bat files that way anymore ?

Running the .bat file manually works fine.

Body:
After switching from Windows 7 to Windows 10, the script for extracting data, transforming it and uploading into database has stopped working. It gets stuck at part, which starts a bat file responsible for uploading a text file into the database. Error appears at line:  oShell.Run

Sub Upload_to_ICW(ScrName As String)
    Dim oShell As Object
    Dim sPathScr
    Set oShell = CreateObject("WScript.Shell")

    sPathScr = "v:\path\"
    oShell.Run Chr(34) & sPathScr & ScrName & ".bat" & Chr(34) & " " & Chr(34) & sPathScr & Chr(34), 2, True

End Sub

I've tried messing around in trust center settings to no avail. Some users reported that it might've been related to office 365 privacy settings (but haven't reported what specifically). The path is definitely correct, it works fine on Windows 7 computer. All drive mappings are exactly the same.

Any idea how to go about this or perhaps what to specifically look for in privacy settings or is it just Windows 10 that doesn't allow to run bat files that way anymore ?

Running the .bat file manually works fine.


问:
Net::Telnet question about authentication using -a option
I had a perfectly working script using Perl Net::Telnet that connects via telnet to our application and executes commands.  Recently, a new "feature" was added to the application in which the user must connect with "telnet -a ..".  This -a option is for automatic login, and it sends the value of the env variable "User" to the application.  This way, our application can log the username of the user that executed the telnet commands.

This -a requirement broke my script, and I cannot see any way to use Net::Telnet with this requirement.  I have looked at the documentation and the source code. Anyone can help with this?

```<code>my $t = new Net::Telnet (Timeout => 3, Host => $host, Port => $port, Prompt => $prompt, Output_log => $log);
$t->cmd($cmd);
</code>```

How can I use something like the above, but authenticate against the application I am connecting to?

Body:
I had a perfectly working script using Perl Net::Telnet that connects via telnet to our application and executes commands.  Recently, a new "feature" was added to the application in which the user must connect with "telnet -a ..".  This -a option is for automatic login, and it sends the value of the env variable "User" to the application.  This way, our application can log the username of the user that executed the telnet commands.

This -a requirement broke my script, and I cannot see any way to use Net::Telnet with this requirement.  I have looked at the documentation and the source code. Anyone can help with this?

my $t = new Net::Telnet (Timeout => 3, Host => $host, Port => $port, Prompt => $prompt, Output_log => $log);
$t->cmd($cmd);

How can I use something like the above, but authenticate against the application I am connecting to?


问:
Is it possible to use the same piece of code WebRTC use to establish an UDP connection?
I'm aware it's not possible to establish UDP connections with pure javascript.
Even the most popular webapi for establishing connections, Websocket, use TCP and it's not possible to change it.

However i've came across WebRTC and it does use UDP underneath.

Is it possible to use the same code WebRTC is using underneath to establish custom UDP connections?


问:
Subscribing to smart contract events on mainnet
I'm developing a smart contract on the Avalanche network and I do not receive data from subscribed events on the app frontend. During development, I tested everything on Fuji test network and received data from each subscribed event every time. I checked the activity on the Snowtrace and events are normally logged. Do you have any idea why it does not work on the mainnet?
Frontend is a Nuxt3 app and I'm using Web3.js library to subscribe to the contract events.
Subscribing works like this:

```<code>async subscribeToContractEvents() {

      const web3 = useWeb3()
      if (!web3.provider) return
      web3?.testContract?.events.allEvents({}, async (error: any, event: any) => {
        console.log("EVENT", event)
        switch (event.event) {
          case "testStarted":
            await this.gettestState()
            break
          case "testEntered":
            this.participants = editParticipants(
              this.participants,
              event.returnValues.player,
              event.returnValues.friends
            )
            break
</code>```

I've tried different ways of subscribing to contract events but the result was still the same. I've received no data on my app front end.

Body:
I'm developing a smart contract on the Avalanche network and I do not receive data from subscribed events on the app frontend. During development, I tested everything on Fuji test network and received data from each subscribed event every time. I checked the activity on the Snowtrace and events are normally logged. Do you have any idea why it does not work on the mainnet?
Frontend is a Nuxt3 app and I'm using Web3.js library to subscribe to the contract events.
Subscribing works like this:

async subscribeToContractEvents() {

      const web3 = useWeb3()
      if (!web3.provider) return
      web3?.testContract?.events.allEvents({}, async (error: any, event: any) => {
        console.log("EVENT", event)
        switch (event.event) {
          case "testStarted":
            await this.gettestState()
            break
          case "testEntered":
            this.participants = editParticipants(
              this.participants,
              event.returnValues.player,
              event.returnValues.friends
            )
            break

I've tried different ways of subscribing to contract events but the result was still the same. I've received no data on my app front end.


问:
java.lang.NoClassDefFoundError: org/apache/commons/csv/CSVFormat
I am building an app with Spring Boot that reads a CSV file with Apache Commons CSV.

When I try to run the app I receive the error:

java.lang.NoClassDefFoundError: org/apache/commons/csv/CSVFormat

... I have the next dependency in the pom.xml:

<dependency>
    <groupId>org.apache.commons</groupId>
    <artifactId>commons-csv</artifactId>
    <version>1.9.0</version>
</dependency>
```


问:
Architecting cloud application with user dedicated workers
I am trying to get my head around designing a system where the user gets assigned a dedicated worker/container per session (or even keeping the worker available for another time until it expires).

Each user will be doing visualizations and ML simulations on a given set of data files. These can be time consuming to download and process, so my thought was to provision a dedicated container for each user session. The data is then available inside this container and readily available for querying and processing. The container will have its own reverse proxy to allow the front end to communicate with it probably via websocket. When the user closes this session the container will be recycled.

Is there a "best practice" type of design that would best fit this problem. I haven't
come across this kind of pattern and was wondering if I am missing something or a more elegant way to solve this problem


问:
How to achieve no recoil script based on c++ to do additional movements of my mouse
I just picked up scripting and I'm bit confused at scripting and have no idea what I'm doing. Made a script to do basic mousemovements on C++ I want it to make adjustments. So what I'm trying to achieve here is, in this game my gun's recoil goes to up and to the left, but then halfway into spray it goes to the right while increasing the intensity of the recoil. I want the script to initially be able to pull the mouse down and to the right, and then (when the guns recoil starts to go in the other direction) go to the left. Is this achievable with my code? With my current code it just jitters into a square.

```<code>#include <windows.h>
#include <tlhelp32.h>

bool keyDown(int vcode)
{
    return GetAsyncKeyState(vcode) & ~32767;
}

int main(void)
{
    bool isOn = true;
    while (!keyDown(121))
    {
        if (keyDown(120))
        {
            isOn = !isOn;
            Sleep(200);
        }

        if (keyDown(1) && isOn)
        {
            Sleep(25);
            mouse_event(MOUSEEVENTF_MOVE, 0, 10, 0, 0);
            Sleep(25);
            mouse_event(MOUSEEVENTF_MOVE, -10, -0, 0, 0);
            Sleep(25);
            mouse_event(MOUSEEVENTF_MOVE, 10, 0, 0, 0);
        }
        Sleep(1);
    }
    return 0;
}
</code>```

I'm trying to add a timer in to the X and Y cordinates. Possibly to negate a certain type of recoil that has a pattern of zigzag. With the below code it all performs at once creating a square like mouse movement hence I need to add timers in between the cordinates maybe?

I want the script to not only move down and slightly to the left

```<code>            Sleep(25);
            mouse_event(MOUSEEVENTF_MOVE, 0, 10, 0, 0);
            Sleep(25);
            mouse_event(MOUSEEVENTF_MOVE, -10, -0, 0, 0);
</code>```

but I want to be able to specify that after a certain amount of time, I then want the script to move in a different direction that again, I can specify.

How would I achieve this?

Body:
I just picked up scripting and I'm bit confused at scripting and have no idea what I'm doing. Made a script to do basic mousemovements on C++ I want it to make adjustments. So what I'm trying to achieve here is, in this game my gun's recoil goes to up and to the left, but then halfway into spray it goes to the right while increasing the intensity of the recoil. I want the script to initially be able to pull the mouse down and to the right, and then (when the guns recoil starts to go in the other direction) go to the left. Is this achievable with my code? With my current code it just jitters into a square.

#include <windows.h>
#include <tlhelp32.h>

bool keyDown(int vcode)
{
    return GetAsyncKeyState(vcode) & ~32767;
}

int main(void)
{
    bool isOn = true;
    while (!keyDown(121))
    {
        if (keyDown(120))
        {
            isOn = !isOn;
            Sleep(200);
        }

        if (keyDown(1) && isOn)
        {
            Sleep(25);
            mouse_event(MOUSEEVENTF_MOVE, 0, 10, 0, 0);
            Sleep(25);
            mouse_event(MOUSEEVENTF_MOVE, -10, -0, 0, 0);
            Sleep(25);
            mouse_event(MOUSEEVENTF_MOVE, 10, 0, 0, 0);
        }
        Sleep(1);
    }
    return 0;
}

I'm trying to add a timer in to the X and Y cordinates. Possibly to negate a certain type of recoil that has a pattern of zigzag. With the below code it all performs at once creating a square like mouse movement hence I need to add timers in between the cordinates maybe?

I want the script to not only move down and slightly to the left

            Sleep(25);
            mouse_event(MOUSEEVENTF_MOVE, 0, 10, 0, 0);
            Sleep(25);
            mouse_event(MOUSEEVENTF_MOVE, -10, -0, 0, 0);

but I want to be able to specify that after a certain amount of time, I then want the script to move in a different direction that again, I can specify.

How would I achieve this?


问:
Making a App Locker for Windows 11 Desktop
I am trying to build a desktop application using electron, an application which will ask for a password every time I open a particular app. I need to figure out how a way to keep this application running in the background all the time.
Could you please help me out on this, also it would be really kind of you to provide more insights on the same.</p>


问:
How to filter the useFetch function in Nuxt 3?
I want to filter my data to only fetch it when my the date is before the date of today

```<code>const { data: persons } = await useFetch(urlPersons)
const date = new Date();
const fullYear = date.getFullYear()+"-"+(date.getMonth()+1)+"-0"+date.getDate();
</code>```
```<code><h1>Testing api</h1>
<div v-for="data in persons" >

    <div>Name :{{data.name}}</div>
    <div>Startdate : {{data.startdate}}</div>
    <div>date today : {{fullYear}}</div>
    <div v-if="data.funfacts.funFact1">{{ data.funfacts.funFact1 }}</div>

  </div>
</code>```

It works when i put a filter in my template but i wonder if i can filter it in javascript so that it doesnt fetch all the date

```<code><div v-for="data in persons" >
<div v-if="data.startdate>fullYear">
  <div>Name :{{data.name}}</div>
  <div>Startdate : {{data.startdate}}</div>
  <div>date today : {{fullYear}}</div>
  <div v-if="data.funfacts.funFact1">{{ data.funfacts.funFact1 }}</div>

</div>
</code>```

this works

Body:
I want to filter my data to only fetch it when my the date is before the date of today

const { data: persons } = await useFetch(urlPersons)
const date = new Date();
const fullYear = date.getFullYear()+"-"+(date.getMonth()+1)+"-0"+date.getDate();

Testing api

Name :{{data.name}}

Startdate : {{data.startdate}}

date today : {{fullYear}}

{{ data.funfacts.funFact1 }}

It works when i put a filter in my template but i wonder if i can filter it in javascript so that it doesnt fetch all the date

fullYear">

Name :{{data.name}}

Startdate : {{data.startdate}}

date today : {{fullYear}}

{{ data.funfacts.funFact1 }}

this works


问:
Problem with catching Telegram based response/request error 403
I would like to ask is there a way to globally catch all the errors regarding requests/responses that Telegram sends? I have multiple scenes with many answers and dialogue decisions and I can't really think of a better way of catching all the errors than doing it globally. I tried doing this:

```<code>process.on("uncaughtException", (err) => {
  console.log(err);
});

process.on("unhandledRejection", (err) => {
  console.log(err);
});

bot.catch((err, ctx) => {
  console.log(err, ctx);
});
</code>```

But it doesn't seem to work properly, there is a certain type of request/response that I can't catch. This is the error for it:

```<code>Unhandled error while processing {
  update_id: <id>,
  my_chat_member: {
    chat: {
      id: <id>,
      first_name: '<name>',
      username: '<name>',
      type: 'private'
    },
    from: {
      id: <id>,
      is_bot: false,
      first_name: '<name>',
      username: '<name>',
      language_code: 'en'
    },
    date: 1670331646,
    old_chat_member: { user: [Object], status: 'member' },
    new_chat_member: { user: [Object], status: 'kicked', until_date: 0 }
  }
}
TelegramError: 403: Forbidden: bot was blocked by the user
    at Telegram.callApi (/<path>/node_modules/telegraf/lib/core/network/client.js:291:19)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async execute (/<path>/node_modules/telegraf/lib/composer.js:471:17)
    at async /<path>/node_modules/telegraf/lib/composer.js:472:21
    at async execute (/<path>/node_modules/telegraf/lib/composer.js:471:17)
    at async /<path>/node_modules/telegraf/lib/composer.js:472:21
    at async execute (/<path>/node_modules/telegraf/lib/composer.js:471:17)
    at async execute (/<path>/node_modules/telegraf/lib/composer.js:471:17)
    at async /<path>/node_modules/telegraf/lib/composer.js:472:21 {
  response: {
    ok: false,
    error_code: 403,
    description: 'Forbidden: bot was blocked by the user'
  },
  on: {
    method: 'sendMessage',
    payload: { chat_id: <id>, text: 'Choose an option' }
  }
}
</code>```

All the other errors are caught just fine. Also I dont know where old_chat_member and new_chat_member comes from - bot can't be used in the groups so it shouldn't appear.

Body:
I would like to ask is there a way to globally catch all the errors regarding requests/responses that Telegram sends? I have multiple scenes with many answers and dialogue decisions and I can't really think of a better way of catching all the errors than doing it globally. I tried doing this:

process.on("uncaughtException", (err) => {
  console.log(err);
});

process.on("unhandledRejection", (err) => {
  console.log(err);
});

bot.catch((err, ctx) => {
  console.log(err, ctx);
});

But it doesn't seem to work properly, there is a certain type of request/response that I can't catch. This is the error for it:

Unhandled error while processing {
  update_id: <id>,
  my_chat_member: {
    chat: {
      id: <id>,
      first_name: '<name>',
      username: '<name>',
      type: 'private'
    },
    from: {
      id: <id>,
      is_bot: false,
      first_name: '<name>',
      username: '<name>',
      language_code: 'en'
    },
    date: 1670331646,
    old_chat_member: { user: [Object], status: 'member' },
    new_chat_member: { user: [Object], status: 'kicked', until_date: 0 }
  }
}
TelegramError: 403: Forbidden: bot was blocked by the user
    at Telegram.callApi (/<path>/node_modules/telegraf/lib/core/network/client.js:291:19)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async execute (/<path>/node_modules/telegraf/lib/composer.js:471:17)
    at async /<path>/node_modules/telegraf/lib/composer.js:472:21
    at async execute (/<path>/node_modules/telegraf/lib/composer.js:471:17)
    at async /<path>/node_modules/telegraf/lib/composer.js:472:21
    at async execute (/<path>/node_modules/telegraf/lib/composer.js:471:17)
    at async execute (/<path>/node_modules/telegraf/lib/composer.js:471:17)
    at async /<path>/node_modules/telegraf/lib/composer.js:472:21 {
  response: {
    ok: false,
    error_code: 403,
    description: 'Forbidden: bot was blocked by the user'
  },
  on: {
    method: 'sendMessage',
    payload: { chat_id: <id>, text: 'Choose an option' }
  }
}

All the other errors are caught just fine. Also I dont know where old_chat_member and new_chat_member comes from - bot can't be used in the groups so it shouldn't appear.


问:
Omit copying files around for processResources-task in Gradle
The task processResources from the Java plugin somehow "magically" executes other custom Copy-tasks and copies files around.

I would like to know: What does it copy? Why does it copy? How to omit it?


问:
SendGrid event webhook signature verification vs OAuth2
From an implementation standpoint, SendGrid's event webhook signature verification is easier to implement than OAuth2. I'm tempted to just do signature verification, and skip OAuth2.

What is the purpose of both? Why isn't signature verification good enough? It verifies that the sender knows the secret private key. What value does OAuth2 add?


问:
Install driver to OpenNI2 on Ubuntu (WebCam4OpenNI2)
For a project where I was asked to manage videos from RGB and RGBD cameras simultaneously, I'm trying to install the driver WebCam4OpenNI2 https://github.com/KHeresy/WebCam4OpenNI2 for OpenNI2. I'm on Ubuntu 20.04 LTS and my version of OpenNI2 is 2.2.0

The driver seem to have only been tested for Windows, but is supposed to be able to work with other platforms. Still, I'm not sure what changes I'm supposed to do to OpenNI2 to use it.

Currently, I tried to update OpenNI2 Makefile:

```<code>#############################################################################
# OpenNI makefile.
#
# default configuration is Release. for a debug version use:
#   make CFG=Debug
#
# default compiler is g++. for another one use:
#   make CXX=<comp>
#
# By default, CLR projects will only be build if mono is installed.
# To force CLR projects use:
#   make FORCE_BUILD_CLR=1
#
#############################################################################
export ALLOW_WARNINGS = 1

include ThirdParty/PSCommon/BuildSystem/CommonDefs.mak

MAJOR_VERSION = $(shell grep "define ONI_VERSION_MAJOR" Include/OniVersion.h | cut -f 2)
MINOR_VERSION = $(shell grep "define ONI_VERSION_MINOR" Include/OniVersion.h | cut -f 2)
MAINT_VERSION = $(shell grep "define ONI_VERSION_MAINT" Include/OniVersion.h | cut -f 2)

ifeq ("$(OSTYPE)","Darwin")
    OS_NAME = MacOSX
else
    OS_NAME = Linux
endif
PRODUCT_STRING = OpenNI-$(OS_NAME)-$(PLATFORM)-$(shell cd Packaging && python -c "import UpdateVersion; print UpdateVersion.getVersionName()" && cd ..)
FINAL_DIR = Packaging/Final

OPENNI = Source/Core
XNLIB  = ThirdParty/PSCommon/XnLib/Source
DEPTH_UTILS = Source/DepthUtils

# list all drivers
ALL_DRIVERS = \
    Source/Drivers/DummyDevice   \
    Source/Drivers/PS1080 \
    Source/Drivers/PSLink \
    Source/Drivers/OniFile \
    Source/Drivers/WebCam4OpenNI2

# list all wrappers
ALL_WRAPPERS = \
    Wrappers/java/OpenNI.jni \
    Wrappers/java/OpenNI.java

# list all tools
ALL_TOOLS = \
    Source/Drivers/PS1080/PS1080Console \
    Source/Drivers/PSLink/PSLinkConsole

# list all core projects
ALL_CORE_PROJS = \
    $(XNLIB)  \
    $(OPENNI) \
    $(DEPTH_UTILS) \
    $(ALL_DRIVERS) \
    $(ALL_WRAPPERS) \
    $(ALL_TOOLS)

# list all samples
CORE_SAMPLES = \
    Samples/SimpleRead \
    Samples/EventBasedRead \
    Samples/MultipleStreamRead \
    Samples/MWClosestPoint \
    Samples/MWClosestPointApp

# list all java samples
JAVA_SAMPLES = \
    Samples/SimpleViewer.java

ifeq "$(GLUT_SUPPORTED)" "1"
    ALL_TOOLS += \
        Source/Tools/NiViewer

    CORE_SAMPLES += \
        Samples/SimpleViewer \
        Samples/MultiDepthViewer \
        Samples/ClosestPointViewer
else
    ifeq "$(GLES_SUPPORTED)" "1"
        CORE_SAMPLES +=
    endif
endif

ALL_SAMPLES = \
    $(CORE_SAMPLES) \
    $(JAVA_SAMPLES)

# list all projects that are build
ALL_BUILD_PROJS = \
    $(ALL_CORE_PROJS) \
    $(ALL_SAMPLES)

ALL_PROJS = \
    $(ALL_BUILD_PROJS)

ALL_PROJS_CLEAN = $(foreach proj,$(ALL_PROJS),$(proj)-clean)

# define a function which creates a target for each proj
define CREATE_PROJ_TARGET
$1:
    $$(MAKE) -C $1

$1-clean:
    $$(MAKE) -C $1 clean
endef

################ TARGETS ##################

.PHONY: all $(ALL_PROJS) $(ALL_PROJS_CLEAN) install uninstall clean release

# make all makefiles
all: $(ALL_PROJS)

core: $(ALL_CORE_PROJS)

samples: $(ALL_SAMPLES)

# create projects targets
$(foreach proj,$(ALL_PROJS),$(eval $(call CREATE_PROJ_TARGET,$(proj))))

# additional dependencies
$(OPENNI):                            $(XNLIB)
Wrappers/java/OpenNI.jni:   $(OPENNI) $(XNLIB)

Source/Drivers/DummyDevice: $(OPENNI) $(XNLIB)
Source/Drivers/RawDevice:   $(OPENNI) $(XNLIB)
Source/Drivers/PS1080:      $(OPENNI) $(XNLIB) $(DEPTH_UTILS)
Source/Drivers/PS1080/PS1080Console: $(OPENNI) $(XNLIB)
Source/Drivers/PSLink:      $(OPENNI) $(XNLIB)
Source/Drivers/PSLink/PSLinkConsole: $(OPENNI) $(XNLIB)
Source/Drivers/OniFile:     $(OPENNI) $(XNLIB)
Source/Drivers/WebCam4OpenNI2:  $(OPENNI) $(XNLIB) -lopencv_core -lopencv_highgui -lopencv_imgproc

Source/Tools/NiViewer:      $(OPENNI) $(XNLIB)

Samples/SimpleRead:         $(OPENNI)
Samples/EventBasedRead:     $(OPENNI)
Samples/MultipleStreamRead: $(OPENNI)
Samples/MWClosestPoint:     $(OPENNI)
Samples/MWClosestPointApp:  $(OPENNI) Samples/MWClosestPoint

Samples/SimpleViewer:       $(OPENNI)
Samples/MultiDepthViewer:   $(OPENNI)
Samples/ClosestPointViewer: $(OPENNI) Samples/MWClosestPoint
Samples/SimpleViewer.java:            Wrappers/java/OpenNI.java

$(FINAL_DIR):
    mkdir -p $(FINAL_DIR)

doc:
    Source/Documentation/Runme.py
    rm -f Source/Documentation/html/*.md5

release: | all doc $(FINAL_DIR)
    Packaging/Harvest.py Packaging/$(PRODUCT_STRING) $(PLATFORM)
    cd Packaging; tar -cjf Final/$(PRODUCT_STRING).tar.bz2 $(PRODUCT_STRING)

# clean is cleaning all projects
clean: $(ALL_PROJS_CLEAN)
</code>```

The only lines different are the 2 about WebCam4OpenNI2.

And used the model included in OpenNI2 (DummyDevice) to include it in a folder at Source/Drivers/WebCam4OpenNI2 containing the .cpp, .ini and .vcxproj coming from the Github page of WebCam4OpenNI2. The Makefile looks like it:

```<code>include ../../../ThirdParty/PSCommon/BuildSystem/CommonDefs.mak

BIN_DIR = ../../../Bin

INC_DIRS = \
    ../../../Include \
    ../../../ThirdParty/PSCommon/XnLib/Include

INC_DIRS += /usr/include/opencv4
LIB_DIRS += /usr/include/opencv4

SRC_FILES = \
    *.cpp

ifeq ("$(OSTYPE)","Darwin")
    INC_DIRS += /opt/local/include
    LIB_DIRS += /opt/local/lib
    LDFLAGS += -framework CoreFoundation -framework IOKit
endif

LIB_NAME = WebCam4OpenNI2

LIB_DIRS = ../../../ThirdParty/PSCommon/XnLib/Bin/$(PLATFORM)-$(CFG)
USED_LIBS = XnLib dl pthread
ifneq ("$(OSTYPE)","Darwin")
        USED_LIBS += rt
endif

CFLAGS += -Wall

OUT_DIR := $(OUT_DIR)/OpenNI2/Drivers

include ../../../ThirdParty/PSCommon/BuildSystem/CommonCppMakefile
</code>```

The lines different from the DummyDevice Makefile are:

```<code>INC_DIRS += /usr/include/opencv4
LIB_DIRS += /usr/include/opencv4
LIB_NAME = WebCam4OpenNI2
</code>```

When building, the linking of the driver to OpenCV doesn't seem to work and I get the following error:

```<code>...
g++ -o ../../../Bin/x64-Release/OpenNI2/Drivers/libWebCam4OpenNI2.so ./../../../Bin/Intermediate/x64-Release/libWebCam4OpenNI2.so/OpenCVCamera.o -L../../../ThirdParty/PSCommon/XnLib/Bin/x64-Release -L../../../Bin/x64-Release/OpenNI2/Drivers -lXnLib -ldl -lpthread -lrt -Wl,--no-undefined -shared
g++ -MD -MP -MT "./../../../Bin/Intermediate/x64-Release/libOniFile.so/jidctint.d ../../../Bin/Intermediate/x64-Release/libOniFile.so/jidctint.o" -c -msse3 -Wall -O2 -DNDEBUG -I. -I../../../Include -I../../../ThirdParty/PSCommon/XnLib/Include -I../../../ThirdParty/LibJPEG -IFormats  -fPIC -fvisibility=hidden -o ../../../Bin/Intermediate/x64-Release/libOniFile.so/jidctint.o ../../../ThirdParty/LibJPEG/jidctint.c
g++ -MD -MP -MT "./../../../Bin/Intermediate/x64-Release/libPS1080.so/XnUncompressedDepthProcessor.d ../../../Bin/Intermediate/x64-Release/libPS1080.so/XnUncompressedDepthProcessor.o" -c -msse3 -Wall -O2 -DNDEBUG -I. -IInclude -I../../../Include -I../../../ThirdParty/PSCommon/XnLib/Include -I../../../ThirdParty/LibJPEG -I../../DepthUtils  -fPIC -fvisibility=hidden -o ../../../Bin/Intermediate/x64-Release/libPS1080.so/XnUncompressedDepthProcessor.o Sensor/XnUncompressedDepthProcessor.cpp
/usr/bin/ld : ./../../../Bin/Intermediate/x64-Release/libWebCam4OpenNI2.so/OpenCVCamera.o : dans la fonction « oniDriverDeviceDestroyStream » :
OpenCVCamera.cpp:(.text+0x12f5) : référence indéfinie vers « cv::VideoCapture::~VideoCapture() »
/usr/bin/ld : ./../../../Bin/Intermediate/x64-Release/libWebCam4OpenNI2.so/OpenCVCamera.o : dans la fonction « oniDriverStreamStart » :
OpenCVCamera.cpp:(.text+0x136a) : référence indéfinie vers « cv::VideoCapture::isOpened() const »
/usr/bin/ld : ./../../../Bin/Intermediate/x64-Release/libWebCam4OpenNI2.so/OpenCVCamera.o : dans la fonction « oniDriverDeviceCreateStream » :
OpenCVCamera.cpp:(.text+0x14e3) : référence indéfinie vers « cv::VideoCapture::VideoCapture() »
/usr/bin/ld : OpenCVCamera.cpp:(.text+0x1513) : référence indéfinie vers « cv::VideoCapture::open(int, int) »
/usr/bin/ld : OpenCVCamera.cpp:(.text+0x1520) : référence indéfinie vers « cv::VideoCapture::get(int) const »
/usr/bin/ld : OpenCVCamera.cpp:(.text+0x1539) : référence indéfinie vers « cv::VideoCapture::get(int) const »
/usr/bin/ld : OpenCVCamera.cpp:(.text+0x1552) : référence indéfinie vers « cv::VideoCapture::get(int) const »
/usr/bin/ld : ./../../../Bin/Intermediate/x64-Release/libWebCam4OpenNI2.so/OpenCVCamera.o : dans la fonction « oniDriverDeviceOpen » :
OpenCVCamera.cpp:(.text+0x175b) : référence indéfinie vers « cv::VideoCapture::VideoCapture(int, int) »
/usr/bin/ld : OpenCVCamera.cpp:(.text+0x176d) : référence indéfinie vers « cv::VideoCapture::isOpened() const »
/usr/bin/ld : OpenCVCamera.cpp:(.text+0x1794) : référence indéfinie vers « cv::VideoCapture::get(int) const »
/usr/bin/ld : OpenCVCamera.cpp:(.text+0x17b3) : référence indéfinie vers « cv::VideoCapture::get(int) const »
/usr/bin/ld : OpenCVCamera.cpp:(.text+0x17d2) : référence indéfinie vers « cv::VideoCapture::get(int) const »
/usr/bin/ld : OpenCVCamera.cpp:(.text+0x183d) : référence indéfinie vers « cv::VideoCapture::set(int, double) »
/usr/bin/ld : OpenCVCamera.cpp:(.text+0x1858) : référence indéfinie vers « cv::VideoCapture::set(int, double) »
/usr/bin/ld : OpenCVCamera.cpp:(.text+0x1873) : référence indéfinie vers « cv::VideoCapture::set(int, double) »
/usr/bin/ld : OpenCVCamera.cpp:(.text+0x188c) : référence indéfinie vers « cv::VideoCapture::get(int) const »
/usr/bin/ld : OpenCVCamera.cpp:(.text+0x18af) : référence indéfinie vers « cv::VideoCapture::get(int) const »
/usr/bin/ld : OpenCVCamera.cpp:(.text+0x18d2) : référence indéfinie vers « cv::VideoCapture::get(int) const »
/usr/bin/ld : OpenCVCamera.cpp:(.text+0x1934) : référence indéfinie vers « cv::VideoCapture::release() »
/usr/bin/ld : OpenCVCamera.cpp:(.text+0x19ac) : référence indéfinie vers « cv::VideoCapture::~VideoCapture() »
/usr/bin/ld : ./../../../Bin/Intermediate/x64-Release/libWebCam4OpenNI2.so/OpenCVCamera.o : dans la fonction « cv::Mat::~Mat() » :
OpenCVCamera.cpp:(.text._ZN2cv3MatD2Ev[_ZN2cv3MatD5Ev]+0x6e) : référence indéfinie vers « cv::fastFree(void*) »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN2cv3MatD2Ev[_ZN2cv3MatD5Ev]+0x79) : référence indéfinie vers « cv::Mat::deallocate() »
/usr/bin/ld : ./../../../Bin/Intermediate/x64-Release/libWebCam4OpenNI2.so/OpenCVCamera.o : dans la fonction « oniDriverDeviceCreateStream.cold » :
OpenCVCamera.cpp:(.text.unlikely+0x2e4) : référence indéfinie vers « cv::VideoCapture::~VideoCapture() »
/usr/bin/ld : ./../../../Bin/Intermediate/x64-Release/libWebCam4OpenNI2.so/OpenCVCamera.o : dans la fonction « oniDriverDeviceOpen.cold » :
OpenCVCamera.cpp:(.text.unlikely+0x30d) : référence indéfinie vers « cv::VideoCapture::~VideoCapture() »
/usr/bin/ld : ./../../../Bin/Intermediate/x64-Release/libWebCam4OpenNI2.so/OpenCVCamera.o : dans la fonction « OpenCV_Color_Stream::~OpenCV_Color_Stream() » :
OpenCVCamera.cpp:(.text._ZN19OpenCV_Color_StreamD2Ev[_ZN19OpenCV_Color_StreamD5Ev]+0x4b) : référence indéfinie vers « cv::VideoCapture::~VideoCapture() »
/usr/bin/ld : ./../../../Bin/Intermediate/x64-Release/libWebCam4OpenNI2.so/OpenCVCamera.o : dans la fonction « OpenCV_Color_Stream::~OpenCV_Color_Stream() » :
OpenCVCamera.cpp:(.text._ZN19OpenCV_Color_StreamD0Ev[_ZN19OpenCV_Color_StreamD5Ev]+0x4a) : référence indéfinie vers « cv::VideoCapture::~VideoCapture() »
/usr/bin/ld : ./../../../Bin/Intermediate/x64-Release/libWebCam4OpenNI2.so/OpenCVCamera.o : dans la fonction « OpenCV_Camera_Device::destroyStream(oni::driver::StreamBase*) » :
OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Device13destroyStreamEPN3oni6driver10StreamBaseE[_ZN20OpenCV_Camera_Device13destroyStreamEPN3oni6driver10StreamBaseE]+0x62) : référence indéfinie vers « cv::VideoCapture::~VideoCapture() »
/usr/bin/ld : ./../../../Bin/Intermediate/x64-Release/libWebCam4OpenNI2.so/OpenCVCamera.o : dans la fonction « OpenCV_Color_Stream::start() » :
OpenCVCamera.cpp:(.text._ZN19OpenCV_Color_Stream5startEv[_ZN19OpenCV_Color_Stream5startEv]+0x22) : référence indéfinie vers « cv::VideoCapture::isOpened() const »
/usr/bin/ld : ./../../../Bin/Intermediate/x64-Release/libWebCam4OpenNI2.so/OpenCVCamera.o : dans la fonction « OpenCV_Color_Stream::UpdateData() » :
OpenCVCamera.cpp:(.text._ZN19OpenCV_Color_Stream10UpdateDataEv[_ZN19OpenCV_Color_Stream10UpdateDataEv]+0x160) : référence indéfinie vers « cv::VideoCapture::operator>>(cv::Mat&) »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN19OpenCV_Color_Stream10UpdateDataEv[_ZN19OpenCV_Color_Stream10UpdateDataEv]+0x1b0) : référence indéfinie vers « cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int) »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN19OpenCV_Color_Stream10UpdateDataEv[_ZN19OpenCV_Color_Stream10UpdateDataEv]+0x292) : référence indéfinie vers « cv::fastFree(void*) »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN19OpenCV_Color_Stream10UpdateDataEv[_ZN19OpenCV_Color_Stream10UpdateDataEv]+0x311) : référence indéfinie vers « cv::fastFree(void*) »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN19OpenCV_Color_Stream10UpdateDataEv[_ZN19OpenCV_Color_Stream10UpdateDataEv]+0x378) : référence indéfinie vers « cv::flip(cv::_InputArray const&, cv::_OutputArray const&, int) »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN19OpenCV_Color_Stream10UpdateDataEv[_ZN19OpenCV_Color_Stream10UpdateDataEv]+0x40c) : référence indéfinie vers « cv::Mat::deallocate() »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN19OpenCV_Color_Stream10UpdateDataEv[_ZN19OpenCV_Color_Stream10UpdateDataEv]+0x41c) : référence indéfinie vers « cv::Mat::deallocate() »
/usr/bin/ld : ./../../../Bin/Intermediate/x64-Release/libWebCam4OpenNI2.so/OpenCVCamera.o : dans la fonction « OpenCV_Color_Stream::setProperty(int, void const*, int) » :
OpenCVCamera.cpp:(.text._ZN19OpenCV_Color_Stream11setPropertyEiPKvi[_ZN19OpenCV_Color_Stream11setPropertyEiPKvi]+0x57) : référence indéfinie vers « cv::VideoCapture::set(int, double) »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN19OpenCV_Color_Stream11setPropertyEiPKvi[_ZN19OpenCV_Color_Stream11setPropertyEiPKvi]+0x75) : référence indéfinie vers « cv::VideoCapture::set(int, double) »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN19OpenCV_Color_Stream11setPropertyEiPKvi[_ZN19OpenCV_Color_Stream11setPropertyEiPKvi]+0x93) : référence indéfinie vers « cv::VideoCapture::set(int, double) »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN19OpenCV_Color_Stream11setPropertyEiPKvi[_ZN19OpenCV_Color_Stream11setPropertyEiPKvi]+0xa8) : référence indéfinie vers « cv::VideoCapture::get(int) const »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN19OpenCV_Color_Stream11setPropertyEiPKvi[_ZN19OpenCV_Color_Stream11setPropertyEiPKvi]+0xbf) : référence indéfinie vers « cv::VideoCapture::get(int) const »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN19OpenCV_Color_Stream11setPropertyEiPKvi[_ZN19OpenCV_Color_Stream11setPropertyEiPKvi]+0xd6) : référence indéfinie vers « cv::VideoCapture::get(int) const »
/usr/bin/ld : ./../../../Bin/Intermediate/x64-Release/libWebCam4OpenNI2.so/OpenCVCamera.o : dans la fonction « OpenCV_Camera_Device::createStream(OniSensorType) » :
OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Device12createStreamE13OniSensorType[_ZN20OpenCV_Camera_Device12createStreamE13OniSensorType]+0x7b) : référence indéfinie vers « cv::VideoCapture::VideoCapture() »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Device12createStreamE13OniSensorType[_ZN20OpenCV_Camera_Device12createStreamE13OniSensorType]+0xab) : référence indéfinie vers « cv::VideoCapture::open(int, int) »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Device12createStreamE13OniSensorType[_ZN20OpenCV_Camera_Device12createStreamE13OniSensorType]+0xb8) : référence indéfinie vers « cv::VideoCapture::get(int) const »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Device12createStreamE13OniSensorType[_ZN20OpenCV_Camera_Device12createStreamE13OniSensorType]+0xd1) : référence indéfinie vers « cv::VideoCapture::get(int) const »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Device12createStreamE13OniSensorType[_ZN20OpenCV_Camera_Device12createStreamE13OniSensorType]+0xea) : référence indéfinie vers « cv::VideoCapture::get(int) const »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Device12createStreamE13OniSensorType[_ZN20OpenCV_Camera_Device12createStreamE13OniSensorType]+0x14b) : référence indéfinie vers « cv::VideoCapture::~VideoCapture() »
/usr/bin/ld : ./../../../Bin/Intermediate/x64-Release/libWebCam4OpenNI2.so/OpenCVCamera.o : dans la fonction « OpenCV_Camera_Driver::deviceOpen(char const*, char const*) » :
OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_[_ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_]+0x15a) : référence indéfinie vers « cv::VideoCapture::VideoCapture(int, int) »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_[_ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_]+0x16c) : référence indéfinie vers « cv::VideoCapture::isOpened() const »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_[_ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_]+0x193) : référence indéfinie vers « cv::VideoCapture::get(int) const »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_[_ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_]+0x1b2) : référence indéfinie vers « cv::VideoCapture::get(int) const »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_[_ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_]+0x1d1) : référence indéfinie vers « cv::VideoCapture::get(int) const »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_[_ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_]+0x234) : référence indéfinie vers « cv::VideoCapture::set(int, double) »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_[_ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_]+0x24f) : référence indéfinie vers « cv::VideoCapture::set(int, double) »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_[_ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_]+0x26a) : référence indéfinie vers « cv::VideoCapture::set(int, double) »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_[_ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_]+0x283) : référence indéfinie vers « cv::VideoCapture::get(int) const »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_[_ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_]+0x2a6) : référence indéfinie vers « cv::VideoCapture::get(int) const »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_[_ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_]+0x2c9) : référence indéfinie vers « cv::VideoCapture::get(int) const »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_[_ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_]+0x327) : référence indéfinie vers « cv::VideoCapture::~VideoCapture() »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_[_ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_]+0x384) : référence indéfinie vers « cv::VideoCapture::release() »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_[_ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_]+0x460) : référence indéfinie vers « cv::VideoCapture::~VideoCapture() »
/usr/bin/ld : ./../../../Bin/Intermediate/x64-Release/libWebCam4OpenNI2.so/OpenCVCamera.o : dans la fonction « OpenCV_Camera_Driver::initialize(void (*)(OniDeviceInfo const*, void*), void (*)(OniDeviceInfo const*, void*), void (*)(OniDeviceInfo const*, int, void*), void*) » :
OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Driver10initializeEPFvPK13OniDeviceInfoPvES5_PFvS2_iS3_ES3_[_ZN20OpenCV_Camera_Driver10initializeEPFvPK13OniDeviceInfoPvES5_PFvS2_iS3_ES3_]+0x79) : référence indéfinie vers « cv::VideoCapture::VideoCapture(int, int) »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Driver10initializeEPFvPK13OniDeviceInfoPvES5_PFvS2_iS3_ES3_[_ZN20OpenCV_Camera_Driver10initializeEPFvPK13OniDeviceInfoPvES5_PFvS2_iS3_ES3_]+0x81) : référence indéfinie vers « cv::VideoCapture::isOpened() const »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Driver10initializeEPFvPK13OniDeviceInfoPvES5_PFvS2_iS3_ES3_[_ZN20OpenCV_Camera_Driver10initializeEPFvPK13OniDeviceInfoPvES5_PFvS2_iS3_ES3_]+0x91) : référence indéfinie vers « cv::VideoCapture::release() »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Driver10initializeEPFvPK13OniDeviceInfoPvES5_PFvS2_iS3_ES3_[_ZN20OpenCV_Camera_Driver10initializeEPFvPK13OniDeviceInfoPvES5_PFvS2_iS3_ES3_]+0x641) : référence indéfinie vers « cv::VideoCapture::~VideoCapture() »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Driver10initializeEPFvPK13OniDeviceInfoPvES5_PFvS2_iS3_ES3_[_ZN20OpenCV_Camera_Driver10initializeEPFvPK13OniDeviceInfoPvES5_PFvS2_iS3_ES3_]+0x6d1) : référence indéfinie vers « cv::VideoCapture::~VideoCapture() »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Driver10initializeEPFvPK13OniDeviceInfoPvES5_PFvS2_iS3_ES3_[_ZN20OpenCV_Camera_Driver10initializeEPFvPK13OniDeviceInfoPvES5_PFvS2_iS3_ES3_]+0x781) : référence indéfinie vers « cv::VideoCapture::~VideoCapture() »
collect2: error: ld returned 1 exit status
make[1]: *** [../../../ThirdParty/PSCommon/BuildSystem/CommonCppMakefile:136 : ../../../Bin/x64-Release/OpenNI2/Drivers/libWebCam4OpenNI2.so] Erreur 1
...
</code>```

If someone can tell me what I'm doing wrong, it would be very helpful.

Thanks

Body:
For a project where I was asked to manage videos from RGB and RGBD cameras simultaneously, I'm trying to install the driver WebCam4OpenNI2 https://github.com/KHeresy/WebCam4OpenNI2 for OpenNI2. I'm on Ubuntu 20.04 LTS and my version of OpenNI2 is 2.2.0

The driver seem to have only been tested for Windows, but is supposed to be able to work with other platforms. Still, I'm not sure what changes I'm supposed to do to OpenNI2 to use it.

Currently, I tried to update OpenNI2 Makefile:

#############################################################################
# OpenNI makefile.
#
# default configuration is Release. for a debug version use:
#   make CFG=Debug
#
# default compiler is g++. for another one use:
#   make CXX=<comp>
#
# By default, CLR projects will only be build if mono is installed.
# To force CLR projects use:
#   make FORCE_BUILD_CLR=1
#
#############################################################################
export ALLOW_WARNINGS = 1

include ThirdParty/PSCommon/BuildSystem/CommonDefs.mak

MAJOR_VERSION = $(shell grep "define ONI_VERSION_MAJOR" Include/OniVersion.h | cut -f 2)
MINOR_VERSION = $(shell grep "define ONI_VERSION_MINOR" Include/OniVersion.h | cut -f 2)
MAINT_VERSION = $(shell grep "define ONI_VERSION_MAINT" Include/OniVersion.h | cut -f 2)

ifeq ("$(OSTYPE)","Darwin")
    OS_NAME = MacOSX
else
    OS_NAME = Linux
endif
PRODUCT_STRING = OpenNI-$(OS_NAME)-$(PLATFORM)-$(shell cd Packaging && python -c "import UpdateVersion; print UpdateVersion.getVersionName()" && cd ..)
FINAL_DIR = Packaging/Final

OPENNI = Source/Core
XNLIB  = ThirdParty/PSCommon/XnLib/Source
DEPTH_UTILS = Source/DepthUtils

# list all drivers
ALL_DRIVERS = \
    Source/Drivers/DummyDevice   \
    Source/Drivers/PS1080 \
    Source/Drivers/PSLink \
    Source/Drivers/OniFile \
    Source/Drivers/WebCam4OpenNI2

# list all wrappers
ALL_WRAPPERS = \
    Wrappers/java/OpenNI.jni \
    Wrappers/java/OpenNI.java

# list all tools
ALL_TOOLS = \
    Source/Drivers/PS1080/PS1080Console \
    Source/Drivers/PSLink/PSLinkConsole

# list all core projects
ALL_CORE_PROJS = \
    $(XNLIB)  \
    $(OPENNI) \
    $(DEPTH_UTILS) \
    $(ALL_DRIVERS) \
    $(ALL_WRAPPERS) \
    $(ALL_TOOLS)

# list all samples
CORE_SAMPLES = \
    Samples/SimpleRead \
    Samples/EventBasedRead \
    Samples/MultipleStreamRead \
    Samples/MWClosestPoint \
    Samples/MWClosestPointApp

# list all java samples
JAVA_SAMPLES = \
    Samples/SimpleViewer.java

ifeq "$(GLUT_SUPPORTED)" "1"
    ALL_TOOLS += \
        Source/Tools/NiViewer

    CORE_SAMPLES += \
        Samples/SimpleViewer \
        Samples/MultiDepthViewer \
        Samples/ClosestPointViewer
else
    ifeq "$(GLES_SUPPORTED)" "1"
        CORE_SAMPLES +=
    endif
endif

ALL_SAMPLES = \
    $(CORE_SAMPLES) \
    $(JAVA_SAMPLES)

# list all projects that are build
ALL_BUILD_PROJS = \
    $(ALL_CORE_PROJS) \
    $(ALL_SAMPLES)

ALL_PROJS = \
    $(ALL_BUILD_PROJS)

ALL_PROJS_CLEAN = $(foreach proj,$(ALL_PROJS),$(proj)-clean)

# define a function which creates a target for each proj
define CREATE_PROJ_TARGET
$1:
    $$(MAKE) -C $1

$1-clean:
    $$(MAKE) -C $1 clean
endef

################ TARGETS ##################

.PHONY: all $(ALL_PROJS) $(ALL_PROJS_CLEAN) install uninstall clean release

# make all makefiles
all: $(ALL_PROJS)

core: $(ALL_CORE_PROJS)

samples: $(ALL_SAMPLES)

# create projects targets
$(foreach proj,$(ALL_PROJS),$(eval $(call CREATE_PROJ_TARGET,$(proj))))

# additional dependencies
$(OPENNI):                            $(XNLIB)
Wrappers/java/OpenNI.jni:   $(OPENNI) $(XNLIB)

Source/Drivers/DummyDevice: $(OPENNI) $(XNLIB)
Source/Drivers/RawDevice:   $(OPENNI) $(XNLIB)
Source/Drivers/PS1080:      $(OPENNI) $(XNLIB) $(DEPTH_UTILS)
Source/Drivers/PS1080/PS1080Console: $(OPENNI) $(XNLIB)
Source/Drivers/PSLink:      $(OPENNI) $(XNLIB)
Source/Drivers/PSLink/PSLinkConsole: $(OPENNI) $(XNLIB)
Source/Drivers/OniFile:     $(OPENNI) $(XNLIB)
Source/Drivers/WebCam4OpenNI2:  $(OPENNI) $(XNLIB) -lopencv_core -lopencv_highgui -lopencv_imgproc

Source/Tools/NiViewer:      $(OPENNI) $(XNLIB)

Samples/SimpleRead:         $(OPENNI)
Samples/EventBasedRead:     $(OPENNI)
Samples/MultipleStreamRead: $(OPENNI)
Samples/MWClosestPoint:     $(OPENNI)
Samples/MWClosestPointApp:  $(OPENNI) Samples/MWClosestPoint

Samples/SimpleViewer:       $(OPENNI)
Samples/MultiDepthViewer:   $(OPENNI)
Samples/ClosestPointViewer: $(OPENNI) Samples/MWClosestPoint
Samples/SimpleViewer.java:            Wrappers/java/OpenNI.java

$(FINAL_DIR):
    mkdir -p $(FINAL_DIR)

doc:
    Source/Documentation/Runme.py
    rm -f Source/Documentation/html/*.md5

release: | all doc $(FINAL_DIR)
    Packaging/Harvest.py Packaging/$(PRODUCT_STRING) $(PLATFORM)
    cd Packaging; tar -cjf Final/$(PRODUCT_STRING).tar.bz2 $(PRODUCT_STRING)

# clean is cleaning all projects
clean: $(ALL_PROJS_CLEAN)

The only lines different are the 2 about WebCam4OpenNI2.

And used the model included in OpenNI2 (DummyDevice) to include it in a folder at Source/Drivers/WebCam4OpenNI2 containing the .cpp, .ini and .vcxproj coming from the Github page of WebCam4OpenNI2. The Makefile looks like it:

include ../../../ThirdParty/PSCommon/BuildSystem/CommonDefs.mak

BIN_DIR = ../../../Bin

INC_DIRS = \
    ../../../Include \
    ../../../ThirdParty/PSCommon/XnLib/Include

INC_DIRS += /usr/include/opencv4
LIB_DIRS += /usr/include/opencv4

SRC_FILES = \
    *.cpp

ifeq ("$(OSTYPE)","Darwin")
    INC_DIRS += /opt/local/include
    LIB_DIRS += /opt/local/lib
    LDFLAGS += -framework CoreFoundation -framework IOKit
endif

LIB_NAME = WebCam4OpenNI2

LIB_DIRS = ../../../ThirdParty/PSCommon/XnLib/Bin/$(PLATFORM)-$(CFG)
USED_LIBS = XnLib dl pthread
ifneq ("$(OSTYPE)","Darwin")
        USED_LIBS += rt
endif

CFLAGS += -Wall

OUT_DIR := $(OUT_DIR)/OpenNI2/Drivers

include ../../../ThirdParty/PSCommon/BuildSystem/CommonCppMakefile

The lines different from the DummyDevice Makefile are:

INC_DIRS += /usr/include/opencv4
LIB_DIRS += /usr/include/opencv4
LIB_NAME = WebCam4OpenNI2

When building, the linking of the driver to OpenCV doesn't seem to work and I get the following error:

...
g++ -o ../../../Bin/x64-Release/OpenNI2/Drivers/libWebCam4OpenNI2.so ./../../../Bin/Intermediate/x64-Release/libWebCam4OpenNI2.so/OpenCVCamera.o -L../../../ThirdParty/PSCommon/XnLib/Bin/x64-Release -L../../../Bin/x64-Release/OpenNI2/Drivers -lXnLib -ldl -lpthread -lrt -Wl,--no-undefined -shared
g++ -MD -MP -MT "./../../../Bin/Intermediate/x64-Release/libOniFile.so/jidctint.d ../../../Bin/Intermediate/x64-Release/libOniFile.so/jidctint.o" -c -msse3 -Wall -O2 -DNDEBUG -I. -I../../../Include -I../../../ThirdParty/PSCommon/XnLib/Include -I../../../ThirdParty/LibJPEG -IFormats  -fPIC -fvisibility=hidden -o ../../../Bin/Intermediate/x64-Release/libOniFile.so/jidctint.o ../../../ThirdParty/LibJPEG/jidctint.c
g++ -MD -MP -MT "./../../../Bin/Intermediate/x64-Release/libPS1080.so/XnUncompressedDepthProcessor.d ../../../Bin/Intermediate/x64-Release/libPS1080.so/XnUncompressedDepthProcessor.o" -c -msse3 -Wall -O2 -DNDEBUG -I. -IInclude -I../../../Include -I../../../ThirdParty/PSCommon/XnLib/Include -I../../../ThirdParty/LibJPEG -I../../DepthUtils  -fPIC -fvisibility=hidden -o ../../../Bin/Intermediate/x64-Release/libPS1080.so/XnUncompressedDepthProcessor.o Sensor/XnUncompressedDepthProcessor.cpp
/usr/bin/ld : ./../../../Bin/Intermediate/x64-Release/libWebCam4OpenNI2.so/OpenCVCamera.o : dans la fonction « oniDriverDeviceDestroyStream » :
OpenCVCamera.cpp:(.text+0x12f5) : référence indéfinie vers « cv::VideoCapture::~VideoCapture() »
/usr/bin/ld : ./../../../Bin/Intermediate/x64-Release/libWebCam4OpenNI2.so/OpenCVCamera.o : dans la fonction « oniDriverStreamStart » :
OpenCVCamera.cpp:(.text+0x136a) : référence indéfinie vers « cv::VideoCapture::isOpened() const »
/usr/bin/ld : ./../../../Bin/Intermediate/x64-Release/libWebCam4OpenNI2.so/OpenCVCamera.o : dans la fonction « oniDriverDeviceCreateStream » :
OpenCVCamera.cpp:(.text+0x14e3) : référence indéfinie vers « cv::VideoCapture::VideoCapture() »
/usr/bin/ld : OpenCVCamera.cpp:(.text+0x1513) : référence indéfinie vers « cv::VideoCapture::open(int, int) »
/usr/bin/ld : OpenCVCamera.cpp:(.text+0x1520) : référence indéfinie vers « cv::VideoCapture::get(int) const »
/usr/bin/ld : OpenCVCamera.cpp:(.text+0x1539) : référence indéfinie vers « cv::VideoCapture::get(int) const »
/usr/bin/ld : OpenCVCamera.cpp:(.text+0x1552) : référence indéfinie vers « cv::VideoCapture::get(int) const »
/usr/bin/ld : ./../../../Bin/Intermediate/x64-Release/libWebCam4OpenNI2.so/OpenCVCamera.o : dans la fonction « oniDriverDeviceOpen » :
OpenCVCamera.cpp:(.text+0x175b) : référence indéfinie vers « cv::VideoCapture::VideoCapture(int, int) »
/usr/bin/ld : OpenCVCamera.cpp:(.text+0x176d) : référence indéfinie vers « cv::VideoCapture::isOpened() const »
/usr/bin/ld : OpenCVCamera.cpp:(.text+0x1794) : référence indéfinie vers « cv::VideoCapture::get(int) const »
/usr/bin/ld : OpenCVCamera.cpp:(.text+0x17b3) : référence indéfinie vers « cv::VideoCapture::get(int) const »
/usr/bin/ld : OpenCVCamera.cpp:(.text+0x17d2) : référence indéfinie vers « cv::VideoCapture::get(int) const »
/usr/bin/ld : OpenCVCamera.cpp:(.text+0x183d) : référence indéfinie vers « cv::VideoCapture::set(int, double) »
/usr/bin/ld : OpenCVCamera.cpp:(.text+0x1858) : référence indéfinie vers « cv::VideoCapture::set(int, double) »
/usr/bin/ld : OpenCVCamera.cpp:(.text+0x1873) : référence indéfinie vers « cv::VideoCapture::set(int, double) »
/usr/bin/ld : OpenCVCamera.cpp:(.text+0x188c) : référence indéfinie vers « cv::VideoCapture::get(int) const »
/usr/bin/ld : OpenCVCamera.cpp:(.text+0x18af) : référence indéfinie vers « cv::VideoCapture::get(int) const »
/usr/bin/ld : OpenCVCamera.cpp:(.text+0x18d2) : référence indéfinie vers « cv::VideoCapture::get(int) const »
/usr/bin/ld : OpenCVCamera.cpp:(.text+0x1934) : référence indéfinie vers « cv::VideoCapture::release() »
/usr/bin/ld : OpenCVCamera.cpp:(.text+0x19ac) : référence indéfinie vers « cv::VideoCapture::~VideoCapture() »
/usr/bin/ld : ./../../../Bin/Intermediate/x64-Release/libWebCam4OpenNI2.so/OpenCVCamera.o : dans la fonction « cv::Mat::~Mat() » :
OpenCVCamera.cpp:(.text._ZN2cv3MatD2Ev[_ZN2cv3MatD5Ev]+0x6e) : référence indéfinie vers « cv::fastFree(void*) »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN2cv3MatD2Ev[_ZN2cv3MatD5Ev]+0x79) : référence indéfinie vers « cv::Mat::deallocate() »
/usr/bin/ld : ./../../../Bin/Intermediate/x64-Release/libWebCam4OpenNI2.so/OpenCVCamera.o : dans la fonction « oniDriverDeviceCreateStream.cold » :
OpenCVCamera.cpp:(.text.unlikely+0x2e4) : référence indéfinie vers « cv::VideoCapture::~VideoCapture() »
/usr/bin/ld : ./../../../Bin/Intermediate/x64-Release/libWebCam4OpenNI2.so/OpenCVCamera.o : dans la fonction « oniDriverDeviceOpen.cold » :
OpenCVCamera.cpp:(.text.unlikely+0x30d) : référence indéfinie vers « cv::VideoCapture::~VideoCapture() »
/usr/bin/ld : ./../../../Bin/Intermediate/x64-Release/libWebCam4OpenNI2.so/OpenCVCamera.o : dans la fonction « OpenCV_Color_Stream::~OpenCV_Color_Stream() » :
OpenCVCamera.cpp:(.text._ZN19OpenCV_Color_StreamD2Ev[_ZN19OpenCV_Color_StreamD5Ev]+0x4b) : référence indéfinie vers « cv::VideoCapture::~VideoCapture() »
/usr/bin/ld : ./../../../Bin/Intermediate/x64-Release/libWebCam4OpenNI2.so/OpenCVCamera.o : dans la fonction « OpenCV_Color_Stream::~OpenCV_Color_Stream() » :
OpenCVCamera.cpp:(.text._ZN19OpenCV_Color_StreamD0Ev[_ZN19OpenCV_Color_StreamD5Ev]+0x4a) : référence indéfinie vers « cv::VideoCapture::~VideoCapture() »
/usr/bin/ld : ./../../../Bin/Intermediate/x64-Release/libWebCam4OpenNI2.so/OpenCVCamera.o : dans la fonction « OpenCV_Camera_Device::destroyStream(oni::driver::StreamBase*) » :
OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Device13destroyStreamEPN3oni6driver10StreamBaseE[_ZN20OpenCV_Camera_Device13destroyStreamEPN3oni6driver10StreamBaseE]+0x62) : référence indéfinie vers « cv::VideoCapture::~VideoCapture() »
/usr/bin/ld : ./../../../Bin/Intermediate/x64-Release/libWebCam4OpenNI2.so/OpenCVCamera.o : dans la fonction « OpenCV_Color_Stream::start() » :
OpenCVCamera.cpp:(.text._ZN19OpenCV_Color_Stream5startEv[_ZN19OpenCV_Color_Stream5startEv]+0x22) : référence indéfinie vers « cv::VideoCapture::isOpened() const »
/usr/bin/ld : ./../../../Bin/Intermediate/x64-Release/libWebCam4OpenNI2.so/OpenCVCamera.o : dans la fonction « OpenCV_Color_Stream::UpdateData() » :
OpenCVCamera.cpp:(.text._ZN19OpenCV_Color_Stream10UpdateDataEv[_ZN19OpenCV_Color_Stream10UpdateDataEv]+0x160) : référence indéfinie vers « cv::VideoCapture::operator>>(cv::Mat&) »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN19OpenCV_Color_Stream10UpdateDataEv[_ZN19OpenCV_Color_Stream10UpdateDataEv]+0x1b0) : référence indéfinie vers « cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int) »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN19OpenCV_Color_Stream10UpdateDataEv[_ZN19OpenCV_Color_Stream10UpdateDataEv]+0x292) : référence indéfinie vers « cv::fastFree(void*) »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN19OpenCV_Color_Stream10UpdateDataEv[_ZN19OpenCV_Color_Stream10UpdateDataEv]+0x311) : référence indéfinie vers « cv::fastFree(void*) »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN19OpenCV_Color_Stream10UpdateDataEv[_ZN19OpenCV_Color_Stream10UpdateDataEv]+0x378) : référence indéfinie vers « cv::flip(cv::_InputArray const&, cv::_OutputArray const&, int) »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN19OpenCV_Color_Stream10UpdateDataEv[_ZN19OpenCV_Color_Stream10UpdateDataEv]+0x40c) : référence indéfinie vers « cv::Mat::deallocate() »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN19OpenCV_Color_Stream10UpdateDataEv[_ZN19OpenCV_Color_Stream10UpdateDataEv]+0x41c) : référence indéfinie vers « cv::Mat::deallocate() »
/usr/bin/ld : ./../../../Bin/Intermediate/x64-Release/libWebCam4OpenNI2.so/OpenCVCamera.o : dans la fonction « OpenCV_Color_Stream::setProperty(int, void const*, int) » :
OpenCVCamera.cpp:(.text._ZN19OpenCV_Color_Stream11setPropertyEiPKvi[_ZN19OpenCV_Color_Stream11setPropertyEiPKvi]+0x57) : référence indéfinie vers « cv::VideoCapture::set(int, double) »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN19OpenCV_Color_Stream11setPropertyEiPKvi[_ZN19OpenCV_Color_Stream11setPropertyEiPKvi]+0x75) : référence indéfinie vers « cv::VideoCapture::set(int, double) »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN19OpenCV_Color_Stream11setPropertyEiPKvi[_ZN19OpenCV_Color_Stream11setPropertyEiPKvi]+0x93) : référence indéfinie vers « cv::VideoCapture::set(int, double) »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN19OpenCV_Color_Stream11setPropertyEiPKvi[_ZN19OpenCV_Color_Stream11setPropertyEiPKvi]+0xa8) : référence indéfinie vers « cv::VideoCapture::get(int) const »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN19OpenCV_Color_Stream11setPropertyEiPKvi[_ZN19OpenCV_Color_Stream11setPropertyEiPKvi]+0xbf) : référence indéfinie vers « cv::VideoCapture::get(int) const »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN19OpenCV_Color_Stream11setPropertyEiPKvi[_ZN19OpenCV_Color_Stream11setPropertyEiPKvi]+0xd6) : référence indéfinie vers « cv::VideoCapture::get(int) const »
/usr/bin/ld : ./../../../Bin/Intermediate/x64-Release/libWebCam4OpenNI2.so/OpenCVCamera.o : dans la fonction « OpenCV_Camera_Device::createStream(OniSensorType) » :
OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Device12createStreamE13OniSensorType[_ZN20OpenCV_Camera_Device12createStreamE13OniSensorType]+0x7b) : référence indéfinie vers « cv::VideoCapture::VideoCapture() »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Device12createStreamE13OniSensorType[_ZN20OpenCV_Camera_Device12createStreamE13OniSensorType]+0xab) : référence indéfinie vers « cv::VideoCapture::open(int, int) »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Device12createStreamE13OniSensorType[_ZN20OpenCV_Camera_Device12createStreamE13OniSensorType]+0xb8) : référence indéfinie vers « cv::VideoCapture::get(int) const »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Device12createStreamE13OniSensorType[_ZN20OpenCV_Camera_Device12createStreamE13OniSensorType]+0xd1) : référence indéfinie vers « cv::VideoCapture::get(int) const »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Device12createStreamE13OniSensorType[_ZN20OpenCV_Camera_Device12createStreamE13OniSensorType]+0xea) : référence indéfinie vers « cv::VideoCapture::get(int) const »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Device12createStreamE13OniSensorType[_ZN20OpenCV_Camera_Device12createStreamE13OniSensorType]+0x14b) : référence indéfinie vers « cv::VideoCapture::~VideoCapture() »
/usr/bin/ld : ./../../../Bin/Intermediate/x64-Release/libWebCam4OpenNI2.so/OpenCVCamera.o : dans la fonction « OpenCV_Camera_Driver::deviceOpen(char const*, char const*) » :
OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_[_ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_]+0x15a) : référence indéfinie vers « cv::VideoCapture::VideoCapture(int, int) »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_[_ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_]+0x16c) : référence indéfinie vers « cv::VideoCapture::isOpened() const »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_[_ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_]+0x193) : référence indéfinie vers « cv::VideoCapture::get(int) const »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_[_ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_]+0x1b2) : référence indéfinie vers « cv::VideoCapture::get(int) const »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_[_ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_]+0x1d1) : référence indéfinie vers « cv::VideoCapture::get(int) const »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_[_ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_]+0x234) : référence indéfinie vers « cv::VideoCapture::set(int, double) »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_[_ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_]+0x24f) : référence indéfinie vers « cv::VideoCapture::set(int, double) »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_[_ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_]+0x26a) : référence indéfinie vers « cv::VideoCapture::set(int, double) »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_[_ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_]+0x283) : référence indéfinie vers « cv::VideoCapture::get(int) const »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_[_ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_]+0x2a6) : référence indéfinie vers « cv::VideoCapture::get(int) const »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_[_ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_]+0x2c9) : référence indéfinie vers « cv::VideoCapture::get(int) const »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_[_ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_]+0x327) : référence indéfinie vers « cv::VideoCapture::~VideoCapture() »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_[_ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_]+0x384) : référence indéfinie vers « cv::VideoCapture::release() »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_[_ZN20OpenCV_Camera_Driver10deviceOpenEPKcS1_]+0x460) : référence indéfinie vers « cv::VideoCapture::~VideoCapture() »
/usr/bin/ld : ./../../../Bin/Intermediate/x64-Release/libWebCam4OpenNI2.so/OpenCVCamera.o : dans la fonction « OpenCV_Camera_Driver::initialize(void (*)(OniDeviceInfo const*, void*), void (*)(OniDeviceInfo const*, void*), void (*)(OniDeviceInfo const*, int, void*), void*) » :
OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Driver10initializeEPFvPK13OniDeviceInfoPvES5_PFvS2_iS3_ES3_[_ZN20OpenCV_Camera_Driver10initializeEPFvPK13OniDeviceInfoPvES5_PFvS2_iS3_ES3_]+0x79) : référence indéfinie vers « cv::VideoCapture::VideoCapture(int, int) »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Driver10initializeEPFvPK13OniDeviceInfoPvES5_PFvS2_iS3_ES3_[_ZN20OpenCV_Camera_Driver10initializeEPFvPK13OniDeviceInfoPvES5_PFvS2_iS3_ES3_]+0x81) : référence indéfinie vers « cv::VideoCapture::isOpened() const »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Driver10initializeEPFvPK13OniDeviceInfoPvES5_PFvS2_iS3_ES3_[_ZN20OpenCV_Camera_Driver10initializeEPFvPK13OniDeviceInfoPvES5_PFvS2_iS3_ES3_]+0x91) : référence indéfinie vers « cv::VideoCapture::release() »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Driver10initializeEPFvPK13OniDeviceInfoPvES5_PFvS2_iS3_ES3_[_ZN20OpenCV_Camera_Driver10initializeEPFvPK13OniDeviceInfoPvES5_PFvS2_iS3_ES3_]+0x641) : référence indéfinie vers « cv::VideoCapture::~VideoCapture() »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Driver10initializeEPFvPK13OniDeviceInfoPvES5_PFvS2_iS3_ES3_[_ZN20OpenCV_Camera_Driver10initializeEPFvPK13OniDeviceInfoPvES5_PFvS2_iS3_ES3_]+0x6d1) : référence indéfinie vers « cv::VideoCapture::~VideoCapture() »
/usr/bin/ld : OpenCVCamera.cpp:(.text._ZN20OpenCV_Camera_Driver10initializeEPFvPK13OniDeviceInfoPvES5_PFvS2_iS3_ES3_[_ZN20OpenCV_Camera_Driver10initializeEPFvPK13OniDeviceInfoPvES5_PFvS2_iS3_ES3_]+0x781) : référence indéfinie vers « cv::VideoCapture::~VideoCapture() »
collect2: error: ld returned 1 exit status
make[1]: *** [../../../ThirdParty/PSCommon/BuildSystem/CommonCppMakefile:136 : ../../../Bin/x64-Release/OpenNI2/Drivers/libWebCam4OpenNI2.so] Erreur 1
...

If someone can tell me what I'm doing wrong, it would be very helpful.

Thanks


问:
Error from server (NotFound): error when creating rollout.yaml : the server could not find the requested resource (post rollouts.argoproj.io)
Problem with creating argo rollouts CRD. When I try to apply CRD it gives me: error when creating "rollout.yaml": the server could not find the requested resource (post rollouts.argoproj.io)

This is my yaml:

```<code>apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
  name: example-rollout
spec:
  selector:
    matchLabels:
      app: example
  template:
    metadata:
      labels:
        app: example
    spec:
      containers:
        - image: demo/template1:v1
          imagePullPolicy: Always
          name: demo/template1-v1
          ports:
            - containerPort: 8080
  strategy:
    canary:
      stableService: app1
      steps:    # describes the strategy for sending traffic to the canary
      - setWeight: 30   # 30% of the traffic will go to the canary for 30 seconds
      - pause: {duration: 30}
      - setWeight: 60   # 60% of the traffic will go to the canary for 45 seconds
      - pause: {duration: 45}
      - setWeight: 100  # 100% of the traffic will go to the canary for 10 seconds
      - pause: {duration: 10}
</code>```

Maybe the problem is because of image or labels

Body:
Problem with creating argo rollouts CRD. When I try to apply CRD it gives me: error when creating "rollout.yaml": the server could not find the requested resource (post rollouts.argoproj.io)

This is my yaml:

apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
  name: example-rollout
spec:
  selector:
    matchLabels:
      app: example
  template:
    metadata:
      labels:
        app: example
    spec:
      containers:
        - image: demo/template1:v1
          imagePullPolicy: Always
          name: demo/template1-v1
          ports:
            - containerPort: 8080
  strategy:
    canary:
      stableService: app1
      steps:    # describes the strategy for sending traffic to the canary
      - setWeight: 30   # 30% of the traffic will go to the canary for 30 seconds
      - pause: {duration: 30}
      - setWeight: 60   # 60% of the traffic will go to the canary for 45 seconds
      - pause: {duration: 45}
      - setWeight: 100  # 100% of the traffic will go to the canary for 10 seconds
      - pause: {duration: 10}

Maybe the problem is because of image or labels


问:
How to handle more concurrent users on a Flask App that connects to Heroku PostgreSQL?
My Flask API on Heroku has many endpoints that runs queries on my Heroku PostgreSQL database before returning the jsonified results to the client.

My current plan is a Hobby Basic tier, so the database can handle only 20 connections maximum.

If I set the --workers in gunicorn to something like 17, it works fine and I can handle about 1000 users sending two HTTP requests each at the same time.

But if I want to scale my API up to be able to handle a large userbase, how do I do so? 1000 concurrent user requests have a good response time with an average of 2.5s, but if I bump it to 2000 or above, it goes above 7s and such.

Using the current Basic tier, how can I efficiently make use of what I have? I have heard of Connection Pooling, will this help?

If the only way to scale up would be to pay more, how should I do it? Would it be as simple as upgrading the Database tier to Standard, and upping the workers to 100+?


问:
RSelenium with Chrome: how to keep informations?
I have been trying to do a webscraping with RSelenium using Chrome browser.

To acess the page with the information I need, first I need to scan a QRcode.

In a regular browser, I do it just one time and I can close and open the browser as many times I want. With RSelenium, I need to scan the QRcode everytime I open the browser.

Is there a way to keep this information? Cache or cookies?

I have been trying:

```<code>rD <- RSelenium::rsDriver(browser = "chrome",
                          chromever = "108.0.5359.71",
                          port = netstat::free_port(),
                          verbose = FALSE)
remDr <- rD[["client"]]
remDr$navigate("https://google.com/")
remDr$maxWindowSize()

remDr$getAllCookies()
</code>```

But Im̀ getting only an empty list.

Body:
I have been trying to do a webscraping with RSelenium using Chrome browser.

To acess the page with the information I need, first I need to scan a QRcode.

In a regular browser, I do it just one time and I can close and open the browser as many times I want. With RSelenium, I need to scan the QRcode everytime I open the browser.

Is there a way to keep this information? Cache or cookies?

I have been trying:

rD <- RSelenium::rsDriver(browser = "chrome",
                          chromever = "108.0.5359.71",
                          port = netstat::free_port(),
                          verbose = FALSE)
remDr <- rD[["client"]]
remDr$navigate("https://google.com/")
remDr$maxWindowSize()

remDr$getAllCookies()

But Im̀ getting only an empty list.


问:
Non-constant Variables in Gitlab Pipelines
Surely many of you have encountered this and I would like to share my hacky solution. Essentially during the CI / CD process of a Gitlab pipeline most parameters are passed through "Variables". There are two issues that I've encountered with that.

Those parameters cannot be altered in Realtime - Say I'd want to execute jobs based on information from previous jobs it would always need to be saved in the cache as opposed to written to CI / CD variables

The execution of jobs is evaluated before the script, so the "rules" will only ever apply to the original parameters. Trouble arises when those are only available during runtime.

For complex pipelines one would want to pick and choose the tests automatically without having to respecify parameters every time. In my case I delivered a data product and depending on the content different steps had to be taken. How do we deal with those issues?

Changing parameters real-time:
https://docs.gitlab.com/ee/api/project_level_variables.html This API provides users with a way of interacting with the CI / CD variables. This will not work for any variables defined at the head of the YML files under the Variables tag. Rather this is a way to access the "Custom CI/CD Variables" https://docs.gitlab.com/ee/ci/variables/#custom-cicd-variables found under this link. This way custom variables can be created altered and deleted during running a pipeline. The only thing needed is a PRIVATE-TOKEN that has access rights to the API (I believe my token has all the rights).

```<code>job:
  stage: example
  script:
    - 'curl --request PUT --header "PRIVATE-TOKEN: $ACCESS_TOKEN" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/variables/VARIABLE_NAME" --form "value=abc"'

</code>```

Onto the next problem. Altering the variables won't let us actually control downstream jobs like this because of the fact that the "rules" block is executed before the pipeline is actually run. Hence it will use the variable before the curl request is sent.

```<code>job2:
  stage: after_example
  rules:
    - if: $VARIABLE_NAME == "abc"
  script:
    - env

</code>```

The way to avoid that is child pipelines. Child pipelines are initialized inside the parent pipeline and check the environment variables anew. A full example should illustrate my point.

```<code>variables:
  PARAMETER: "Cant be changed"

stages:
  - example
  - after_example
  - finally

job_1:
  # Changing "VARIABLE_NAME" during runtime to "abc", VARIABLE_NAME has to exist
  stage: example
  script:
    - 'curl --request PUT --header "PRIVATE-TOKEN: $ACCESS_TOKEN" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/variables/VARIABLE_NAME" --form "value=abc"'

job_2.1:
  # This wont get triggered as we assume "abc" was not the value in VARIABLE_NAME before job_1
  stage: after_example
  rules:
    - if: $VARIABLE_NAME == "abc"
  script:
    - env

job_3:
  stage: after_example
  trigger:
    include:
      - local: .donwstream.yml
    strategy: depend

job_4:
  stage: finally
  script:
    - echo "Make sure to properly clean up your variables to a default value"
</code>```
```<code># inside downstream.yml

stages:
  - downstream

job_2.2:
  # This will happen because the pipeline is initialized after job_1
  stage: downstream
  rules:
    - if: $VARIABLE_NAME == "abc"
  script:
    - env
</code>```

This coding bit probably won't run, however it exemplifies my point rather nicely. Job 2 should be executed based on an action that happens in Job 1. While the variables will be updated once we reach job 2.1, the rules check happens before so it will never be executed. Child pipelines do the rule check during the runtime of the Parent pipeline, this is why job 2.2 does run.

This variant is quite hacky and probably really inefficient, but for all intents and purposes it gets the job done.

Body:
Surely many of you have encountered this and I would like to share my hacky solution. Essentially during the CI / CD process of a Gitlab pipeline most parameters are passed through "Variables". There are two issues that I've encountered with that.

Those parameters cannot be altered in Realtime - Say I'd want to execute jobs based on information from previous jobs it would always need to be saved in the cache as opposed to written to CI / CD variables

The execution of jobs is evaluated before the script, so the "rules" will only ever apply to the original parameters. Trouble arises when those are only available during runtime.

For complex pipelines one would want to pick and choose the tests automatically without having to respecify parameters every time. In my case I delivered a data product and depending on the content different steps had to be taken. How do we deal with those issues?

Changing parameters real-time:
https://docs.gitlab.com/ee/api/project_level_variables.html This API provides users with a way of interacting with the CI / CD variables. This will not work for any variables defined at the head of the YML files under the Variables tag. Rather this is a way to access the "Custom CI/CD Variables" https://docs.gitlab.com/ee/ci/variables/#custom-cicd-variables found under this link. This way custom variables can be created altered and deleted during running a pipeline. The only thing needed is a PRIVATE-TOKEN that has access rights to the API (I believe my token has all the rights).

job:
  stage: example
  script:
    - 'curl --request PUT --header "PRIVATE-TOKEN: $ACCESS_TOKEN" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/variables/VARIABLE_NAME" --form "value=abc"'

Onto the next problem. Altering the variables won't let us actually control downstream jobs like this because of the fact that the "rules" block is executed before the pipeline is actually run. Hence it will use the variable before the curl request is sent.

job2:
  stage: after_example
  rules:
    - if: $VARIABLE_NAME == "abc"
  script:
    - env

The way to avoid that is child pipelines. Child pipelines are initialized inside the parent pipeline and check the environment variables anew. A full example should illustrate my point.

variables:
  PARAMETER: "Cant be changed"

stages:
  - example
  - after_example
  - finally

job_1:
  # Changing "VARIABLE_NAME" during runtime to "abc", VARIABLE_NAME has to exist
  stage: example
  script:
    - 'curl --request PUT --header "PRIVATE-TOKEN: $ACCESS_TOKEN" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/variables/VARIABLE_NAME" --form "value=abc"'

job_2.1:
  # This wont get triggered as we assume "abc" was not the value in VARIABLE_NAME before job_1
  stage: after_example
  rules:
    - if: $VARIABLE_NAME == "abc"
  script:
    - env

job_3:
  stage: after_example
  trigger:
    include:
      - local: .donwstream.yml
    strategy: depend

job_4:
  stage: finally
  script:
    - echo "Make sure to properly clean up your variables to a default value"

# inside downstream.yml

stages:
  - downstream

job_2.2:
  # This will happen because the pipeline is initialized after job_1
  stage: downstream
  rules:
    - if: $VARIABLE_NAME == "abc"
  script:
    - env

This coding bit probably won't run, however it exemplifies my point rather nicely. Job 2 should be executed based on an action that happens in Job 1. While the variables will be updated once we reach job 2.1, the rules check happens before so it will never be executed. Child pipelines do the rule check during the runtime of the Parent pipeline, this is why job 2.2 does run.

This variant is quite hacky and probably really inefficient, but for all intents and purposes it gets the job done.


问:
Yup custom validation not working in Typescript
I need to validate object when form submit. Because of field value is object, I wrote isObjectEmpty method and added into yup. But I got following error. I am using React + Typescript. May I know what I am missing here?

Property 'isObjectEmpty' does not exist on type 'MixedSchema<any,
AnyObject, any>'.ts(2339)

```<code>import AutoComplete from "./AutoComplete";
import DatePicker from "react-datepicker";
import { Formik, Form, ErrorMessage } from "formik";
import * as Yup from "yup";
import { SearchCriteria } from "../types";
import { useAppDispatch, useAppSelector } from "../store/hooks";
import { fetchJourneys } from "../reducers/journeySlice";
import { useNavigate } from "react-router-dom";
import { Stop } from "../types";
import { useEffect } from "react";

const isObjectEmpty = (message: string) =>{
  return Yup.mixed().test("isObjectEmpty", message, function (value) {
    const { path, createError } = this;

    if (value === null) {
      return createError({ path, message: message ?? "Field is required." });
    }

    return true;
  });
}

Yup.addMethod(Yup.mixed, "isObjectEmpty", isObjectEmpty);

const schema = Yup.object({
  from: Yup.mixed().isObjectEmpty("To is required."),
  to: Yup.mixed().isObjectEmpty("To is required."),
  departure: Yup.date().required("Date is required"),
});

interface FormData {
  from: Stop | null;
  to: Stop | null;
  departure: Date;
}

const initialValues: FormData = { from: null, to: null, departure: new Date() };

export const SearchForm = () => {
  const journey = useAppSelector((state) => state.journey);
  const navigate = useNavigate();
  const dispatch = useAppDispatch();

  useEffect(() => {
    if (journey.criteria) {
      initialValues.from = journey.criteria.from;
      initialValues.to = journey.criteria.to;
      initialValues.departure = journey.criteria.departure;
    }
  }, []);

  const handleSearch = async (criteria: SearchCriteria) => {
    console.log(criteria);
    await dispatch(fetchJourneys(criteria));
    // redirect to result page
    navigate("/journey");
  };

  return (
    <Formik
      initialValues={initialValues}
      validationSchema={schema}
      onSubmit={handleSearch}
    >
      {({
        values,
        errors,
        touched,
        handleChange,
        handleBlur,
        handleSubmit,
        isSubmitting,
        setFieldValue,
        /* and other goodies */
      }) => (
        <Form>
          <div className="grid gap-6 mb-6 md:grid-cols-2">
            <div>
              <label
                htmlFor="first_name"
                className="block mb-2 text-sm font-medium text-gray-900 dark:text-white"
              >
                From
              </label>
              <AutoComplete
                style="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
                placeholder="Station / stop / address"
                name="from"
                value={values.from}
                valueChangeHandler={(from: Stop) => setFieldValue("from", from)}
              />
              <ErrorMessage
                component="span"
                name="from"
                className=" text-xs text-red-400"
              />
            </div>
            <div>
              <label
                htmlFor="last_name"
                className="block mb-2 text-sm font-medium text-gray-900 dark:text-white"
              >
                To
              </label>
              <AutoComplete
                style="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
                placeholder="Station / stop / address"
                name="to"
                value={values.to}
                valueChangeHandler={(to: Stop) => setFieldValue("to", to)}
              />
              <ErrorMessage
                component="span"
                name="to"
                className=" text-xs text-red-400"
              />
            </div>
            <div>
              <label
                htmlFor="company"
                className="block mb-2 text-sm font-medium text-gray-900 dark:text-white"
              >
                Outbound journey
              </label>

              <DatePicker
                className="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
                selected={values.departure}
                onChange={(date) => setFieldValue("departure", date)}
                timeInputLabel="Time:"
                dateFormat="MM/dd/yyyy h:mm aa"
                showTimeInput
                name="departure"
              />
              <ErrorMessage
                component="span"
                name="departure"
                className=" text-xs text-red-400"
              />
            </div>
          </div>
          <div className="flex justify-end">
            <button
              type="submit"
              className="btn btn-primary text-black hover:text-white focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm w-full sm:w-auto px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"
            >
              Search
            </button>
          </div>
        </Form>
      )}
    </Formik>
  );
};
</code>```

Body:
I need to validate object when form submit. Because of field value is object, I wrote isObjectEmpty method and added into yup. But I got following error. I am using React + Typescript. May I know what I am missing here?

Property 'isObjectEmpty' does not exist on type 'MixedSchema<any,
AnyObject, any>'.ts(2339)

import AutoComplete from "./AutoComplete";
import DatePicker from "react-datepicker";
import { Formik, Form, ErrorMessage } from "formik";
import * as Yup from "yup";
import { SearchCriteria } from "../types";
import { useAppDispatch, useAppSelector } from "../store/hooks";
import { fetchJourneys } from "../reducers/journeySlice";
import { useNavigate } from "react-router-dom";
import { Stop } from "../types";
import { useEffect } from "react";

const isObjectEmpty = (message: string) =>{
  return Yup.mixed().test("isObjectEmpty", message, function (value) {
    const { path, createError } = this;

    if (value === null) {
      return createError({ path, message: message ?? "Field is required." });
    }

    return true;
  });
}

Yup.addMethod(Yup.mixed, "isObjectEmpty", isObjectEmpty);

const schema = Yup.object({
  from: Yup.mixed().isObjectEmpty("To is required."),
  to: Yup.mixed().isObjectEmpty("To is required."),
  departure: Yup.date().required("Date is required"),
});

interface FormData {
  from: Stop | null;
  to: Stop | null;
  departure: Date;
}

const initialValues: FormData = { from: null, to: null, departure: new Date() };

export const SearchForm = () => {
  const journey = useAppSelector((state) => state.journey);
  const navigate = useNavigate();
  const dispatch = useAppDispatch();

  useEffect(() => {
    if (journey.criteria) {
      initialValues.from = journey.criteria.from;
      initialValues.to = journey.criteria.to;
      initialValues.departure = journey.criteria.departure;
    }
  }, []);

  const handleSearch = async (criteria: SearchCriteria) => {
    console.log(criteria);
    await dispatch(fetchJourneys(criteria));
    // redirect to result page
    navigate("/journey");
  };

  return (
    <Formik
      initialValues={initialValues}
      validationSchema={schema}
      onSubmit={handleSearch}
    >
      {({
        values,
        errors,
        touched,
        handleChange,
        handleBlur,
        handleSubmit,
        isSubmitting,
        setFieldValue,
        /* and other goodies */
      }) => (
        <Form>

                From

              <AutoComplete
                style="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
                placeholder="Station / stop / address"
                name="from"
                value={values.from}
                valueChangeHandler={(from: Stop) => setFieldValue("from", from)}
              />
              <ErrorMessage
                component="span"
                name="from"
                className=" text-xs text-red-400"
              />

                To

              <AutoComplete
                style="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
                placeholder="Station / stop / address"
                name="to"
                value={values.to}
                valueChangeHandler={(to: Stop) => setFieldValue("to", to)}
              />
              <ErrorMessage
                component="span"
                name="to"
                className=" text-xs text-red-400"
              />

                Outbound journey

              <DatePicker
                className="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
                selected={values.departure}
                onChange={(date) => setFieldValue("departure", date)}
                timeInputLabel="Time:"
                dateFormat="MM/dd/yyyy h:mm aa"
                showTimeInput
                name="departure"
              />
              <ErrorMessage
                component="span"
                name="departure"
                className=" text-xs text-red-400"
              />

            <button
              type="submit"
              className="btn btn-primary text-black hover:text-white focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm w-full sm:w-auto px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"
            >
              Search
            </button>

        </Form>
      )}
    </Formik>
  );
};


问:
PWA Angular 14, Using an iframe go to 404 page in ios(some versions)
I am using an iframe in angular 14 application
the iframe src is application in the site in the IIS (same domain)
its work perfect in android
but in ios the iframe go to 404 page in the application
the application become one inside the other example

I did a lot of searching on Google and couldn't find any solution


问:
github actions: Two application modules using different workflows for version bump on same commit to the main, 1 workflow works, while other doesn't
I have two github actions workflows for different application modules (within the same repository) to bump the version in the respective module's config file. When push the changes to the main branch by creating a pull request and merging it, it triggers both the workflows (I run them one after another using concurrency), however only one of them commits the changes in the config file, while other doesn't. Attaching the images of working Workflow workingand non-working Workflow not working workflows.

Tried using concurrency, so both the workflows run one after another, if they run in-parallel, one of them give errors. After using concurrency, these run successfully, but only one of them commit the version bump, while other doesn't.

Expecting that both the workflows related to different application modules, should commit the bump versions to the respective config files


问:
On click load more changes show more to show less
```<code>
              <b-collapse :id="`news-${news.id}`" visible>
                <span v-html="getNewsExcerpt(news.body).newsText"></span>
              </b-collapse>
              <b-collapse :id="`news-${news.id}`">
                <span v-html="news.body" ></span>
              </b-collapse>
              <a href="javascript:void(0)"  v-if="getNewsExcerpt(news.body).isExcerpt" v-b-toggle="`news-${news.id}`">
                <span class="is-opened">Show more text</span> <span class="is-closed">Show less text</span>
              </a>

  <div class="text-center" v-show="moreExists">
       <button type="button" class="btn btn-primary btn-sm" v-on:click="loadMore">Load more...</button>
     </div>

  methods: {
    getNewsExcerpt (news) {
      let excerpt = (news.length > 100) ? true : false

      return {
        newsText: news.substring(0,100) + "...",
        isExcerpt: excerpt,
      }
    },
      loadMore: async function() {

        await axios.get('/news/get?page='+this.nextPage)
        .then(response => {
    this.moreExists =response.data.meta.current_page < response.data.meta.last_page;
    this.nextPage = response.data.meta.current_page + 1;

            response.data.data.forEach(data => {
              this.allnews.push(data);
            });

        })
        .catch(err => {
          console.error(err)
          this.showErrorNotification()

        })

}
  },

<style scoped>
  .collapsed > .is-opened,
  :not(.collapsed) > .is-closed {
      display: none;
  }
</style>

</code>```

When I click on Load more news, if in text is Show more text it changes in Show less text and I didnt click on that Load more it  affects the buttons below the text..Can anyone help me? I tried to do on so many ways and nothing helped with this code in Vue.

Body:
              <b-collapse :id="`news-${news.id}`" visible>

              <b-collapse :id="`news-${news.id}`">

              <a href="javascript:void(0)"  v-if="getNewsExcerpt(news.body).isExcerpt" v-b-toggle="`news-${news.id}`">
                Show more text Show less text

       <button type="button" class="btn btn-primary btn-sm" v-on:click="loadMore">Load more...</button>

  methods: {
    getNewsExcerpt (news) {
      let excerpt = (news.length > 100) ? true : false

      return {
        newsText: news.substring(0,100) + "...",
        isExcerpt: excerpt,
      }
    },
      loadMore: async function() {

        await axios.get('/news/get?page='+this.nextPage)
        .then(response => {
    this.moreExists =response.data.meta.current_page < response.data.meta.last_page;
    this.nextPage = response.data.meta.current_page + 1;

            response.data.data.forEach(data => {
              this.allnews.push(data);
            });

        })
        .catch(err => {
          console.error(err)
          this.showErrorNotification()

        })

}
  },

When I click on Load more news, if in text is Show more text it changes in Show less text and I didnt click on that Load more it  affects the buttons below the text..Can anyone help me? I tried to do on so many ways and nothing helped with this code in Vue.