问:
Expect: Some long delay at the shell prompt after ssh login
Running my expect script

```<code>  set timeout 15
  spawn ssh -t -q -o StrictHostKeychecking=no "$user\@$host"
  expect {
    -re "closed by remote host" { continue }
    -re "(P|p)assword: " { send "$pass\r"; exp_continue }
  }
  expect -re $prompt
  send -- "sudo passwd\r"
  ...
</code>```

always waits at the shell prompt for 10+ seconds before sending the "sudo passwd" command, no matter what timeout value I use.

$      (<-- always waits here for 10+ seconds)

Any tip would be much appreciated.

Thanks.

Body:
Running my expect script

  set timeout 15
  spawn ssh -t -q -o StrictHostKeychecking=no "$user\@$host"
  expect {
    -re "closed by remote host" { continue }
    -re "(P|p)assword: " { send "$pass\r"; exp_continue }
  }
  expect -re $prompt
  send -- "sudo passwd\r"
  ...

always waits at the shell prompt for 10+ seconds before sending the "sudo passwd" command, no matter what timeout value I use.

$      (<-- always waits here for 10+ seconds)

Any tip would be much appreciated.

Thanks.


来源: stackexchange

问:
What is the name of this macOS UI Control?
What is the name?

Is this an aggregation of controls (buttons and editable list) or a single control?

ContentLicense: CC BY-SA 4.0


问:
How does a callback in an async code get it's stacktrace?
I've going down the event loop hole and I'm at the point where I want to understand how the stacktrace of a callback is restored.

Let's say we have the following code:

```<code>async function q() {
  return Promise.resolve(5);
}
async function x () {
  return new Promise(async function exe(resolve) {
    q().then(function xCallback(r) => {
      resolve(r)
    })
  })
};

function y(index) {
  x().then(function yCallback() => {
  console.log('completed async function', {index});
  });
}

y(1)
</code>```

When Promise.resolve(5) is executed it's put inside the Web Apis to be handled by another thread. q() completes, then x completes and then y completes synchronously. The thread that was handling q()'s promise completed and pushed the xCallback into the microtask. When xCallback is being handled through the execution context the callstack in shows xCallback -> exe -> x -> y -> anonymous.

The question is : Is the callstack for a callback stored in the heap and when the callback is pushed into the execution the callstack is restored from heap or something similar?

When Promise.resolve(5) is executed it's put inside the Web Apis to be handled by another thread. q() completes, then x completes and then y completes synchronously. The thread that was handling q()'s promise completed and pushed the xCallback into the microtask. When xCallback is being handled through the execution context the callstack in shows xCallback -> exe -> x -> y -> anonymous.

The question is: Is the callstack for a callback stored in the heap and when the callback is pushed into the execution the callstack is restored from heap or something similar?

Body:
I've going down the event loop hole and I'm at the point where I want to understand how the stacktrace of a callback is restored.

Let's say we have the following code:

async function q() {
  return Promise.resolve(5);
}
async function x () {
  return new Promise(async function exe(resolve) {
    q().then(function xCallback(r) => {
      resolve(r)
    })
  })
};

function y(index) {
  x().then(function yCallback() => {
  console.log('completed async function', {index});
  });
}

y(1)

When Promise.resolve(5) is executed it's put inside the Web Apis to be handled by another thread. q() completes, then x completes and then y completes synchronously. The thread that was handling q()'s promise completed and pushed the xCallback into the microtask. When xCallback is being handled through the execution context the callstack in shows xCallback -> exe -> x -> y -> anonymous.

The question is : Is the callstack for a callback stored in the heap and when the callback is pushed into the execution the callstack is restored from heap or something similar?

When Promise.resolve(5) is executed it's put inside the Web Apis to be handled by another thread. q() completes, then x completes and then y completes synchronously. The thread that was handling q()'s promise completed and pushed the xCallback into the microtask. When xCallback is being handled through the execution context the callstack in shows xCallback -> exe -> x -> y -> anonymous.

The question is: Is the callstack for a callback stored in the heap and when the callback is pushed into the execution the callstack is restored from heap or something similar?


问:
AWS SAM lambda container: when specifying resolve-image-repos, what should ImageUri be?
I'm trying to deploy a docker image as a lambda function via AWS SAM. My SAM template looks something like:

```<code>Resources:
  StrapiFunction:
    Type: AWS::Serverless::Function
    Properties:
      PackageType: Image
      Events:
        Strapi:
          Type: Api
          Properties:
            Path: /
            Method: ANY
    Metadata:
      DockerTag: latest
      DockerContext: ./
      Dockerfile: Dockerfile
</code>```

Which I'm then trying to deploy (via a CI script) with:

```<code>sam deploy  \
    --resolve-s3 \
    --resolve-image-repos \
    --region ${AWS_REGION} \
    --template-file ${SAM_FILE} \
    --stack-name my-cms-${STAGE}-stack \
    --capabilities CAPABILITY_NAMED_IAM
</code>```

From the docs, --resolve-image-repos tells SAM to "Automatically create Amazon ECR repositories to use for packaging and deploying for non-guided deployments".

If I try to deploy this, I get an error:

Unable to upload artifact None referenced by ImageUri parameter

But if the repository is being created by SAM, I don't know its URI in advance. And from what I can see, it changes each time the deploy is run.

What am I missing?

Body:
I'm trying to deploy a docker image as a lambda function via AWS SAM. My SAM template looks something like:

Resources:
  StrapiFunction:
    Type: AWS::Serverless::Function
    Properties:
      PackageType: Image
      Events:
        Strapi:
          Type: Api
          Properties:
            Path: /
            Method: ANY
    Metadata:
      DockerTag: latest
      DockerContext: ./
      Dockerfile: Dockerfile

Which I'm then trying to deploy (via a CI script) with:

sam deploy  \
    --resolve-s3 \
    --resolve-image-repos \
    --region ${AWS_REGION} \
    --template-file ${SAM_FILE} \
    --stack-name my-cms-${STAGE}-stack \
    --capabilities CAPABILITY_NAMED_IAM

From the docs, --resolve-image-repos tells SAM to "Automatically create Amazon ECR repositories to use for packaging and deploying for non-guided deployments".

If I try to deploy this, I get an error:

Unable to upload artifact None referenced by ImageUri parameter

But if the repository is being created by SAM, I don't know its URI in advance. And from what I can see, it changes each time the deploy is run.

What am I missing?


问:
Solve the initial problem: OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized
I have an error saying

```<code>OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized.
OMP: Hint This means that multiple copies of the OpenMP runtime have been linked into the program. That is dangerous, since it can degrade performance or cause incorrect results. The best thing to do is to ensure that only a single OpenMP runtime is linked into the process, e.g. by avoiding static linking of the OpenMP runtime in any library. As an unsafe, unsupported, undocumented workaround you can set the environment variable KMP_DUPLICATE_LIB_OK=TRUE to allow the program to continue to execute, but that may cause crashes or silently produce incorrect results. For more information, please see http://www.intel.com/software/products/support/.
</code>```

I have searched this error, and many of them use [git#7664]

```<code>import os
os.environ['KMP_DUPLICATE_LIB_OK']='True'
</code>```

Yes, I can solve this problem with these two lines of command.
However, I want to solve the initial problem of this.
Can anyone have a solution to solve this problem from the root?

Thanks

Best,
Jinho

Body:
I have an error saying

OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized.
OMP: Hint This means that multiple copies of the OpenMP runtime have been linked into the program. That is dangerous, since it can degrade performance or cause incorrect results. The best thing to do is to ensure that only a single OpenMP runtime is linked into the process, e.g. by avoiding static linking of the OpenMP runtime in any library. As an unsafe, unsupported, undocumented workaround you can set the environment variable KMP_DUPLICATE_LIB_OK=TRUE to allow the program to continue to execute, but that may cause crashes or silently produce incorrect results. For more information, please see http://www.intel.com/software/products/support/.

I have searched this error, and many of them use [git#7664]

import os
os.environ['KMP_DUPLICATE_LIB_OK']='True'

Yes, I can solve this problem with these two lines of command.
However, I want to solve the initial problem of this.
Can anyone have a solution to solve this problem from the root?

Thanks

Best,
Jinho


问:
Flutter cant't align image to vertical center in ListTile with Stack
What every I try column, row, center, positioned, and aligned widgets, I still can't seem to align the dog image to the vertical center.

Does anyone know how to do this

Here is my widget

```<code>Widget build(BuildContext context) {
final dogTypes = dog.type!.map((type) => type.name).toList();
final teams = dog.teams.map((team) => team.name).toList();
return GestureDetector(
  onTap: () => viewDogProfile(dog, index),
  child: SizedBox(
    width: double.infinity,
    child: Card(
      shape: RoundedRectangleBorder(
        borderRadius: BorderRadius.circular(14),
      ),
      margin: const EdgeInsets.only(top: 25),
      child: Padding(
        padding: const EdgeInsets.only(bottom: 8),
        child: ListTile(
          leading: Container(
            width: 65,
            height: 65,
            decoration: const BoxDecoration(
              shape: BoxShape.circle,
            ),
            child: Stack(
              children: [
                CachedNetworkImage(
                  imageUrl: dog.image.url,
                  imageBuilder: (context, imageProvider) => Container(
                    height: 65,
                    width: 65,
                    decoration: BoxDecoration(
                      shape: BoxShape.circle,
                      image: DecorationImage(
                        image: imageProvider,
                        fit: BoxFit.cover,
                      ),
                      border: Border.all(
                        color: accentColor,
                        width: 2,
                      ),
                      boxShadow: [
                        BoxShadow(
                          color: Colors.black87.withOpacity(0.6),
                          spreadRadius: 0.8,
                          blurRadius: 2,
                          offset: const Offset(1, 1),
                        ),
                      ],
                    ),
                  ),
                  placeholder: (context, url) =>
                      const CircularProgressIndicator(
                    color: primaryColor,
                  ),
                  errorWidget: (context, url, error) =>
                      const Icon(Icons.error),
                ),
                DogStatusIcon(
                  dogStatus: dog.status,
                ),
              ],
            ),
          ),
          title: Row(
            children: [
              Flexible(
                child: Padding(
                  padding: const EdgeInsets.only(top: 8),
                  child: Text(
                    dog.name,
                    style: AppStyles.dogProfileCardHeaderTextStyle,
                    maxLines: 1,
                    softWrap: true,
                    overflow: TextOverflow.ellipsis,
                  ),
                ),
              ),
            ],
          ),
          subtitle: Padding(
            padding: const EdgeInsets.only(bottom: 5),
            child: Column(
              children: [
                Row(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    const Text(
                      'Teams: ',
                      style: AppStyles.dogProfileCardSubHeaderTextStyle,
                    ),
                    Flexible(
                      child: Text(
                        teams
                            .toString()
                            .replaceAll('[', '')
                            .replaceAll(']', ''),
                        style:
                            AppStyles.dogProfileCardSubHeaderDataTextStyle,
                        maxLines: 1,
                        softWrap: false,
                        overflow: TextOverflow.ellipsis,
                      ),
                    ),
                  ],
                ),
                Row(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    const Text(
                      'Breed: ',
                      style: AppStyles.dogProfileCardSubHeaderTextStyle,
                    ),
                    Flexible(
                      child: Text(
                        dog.breed.name,
                        style:
                            AppStyles.dogProfileCardSubHeaderDataTextStyle,
                        maxLines: 1,
                        softWrap: true,
                        overflow: TextOverflow.ellipsis,
                      ),
                    ),
                  ],
                ),
                Row(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    const Text(
                      'Type: ',
                      style: AppStyles.dogProfileCardSubHeaderTextStyle,
                    ),
                    Flexible(
                      child: Text(
                        dogTypes
                            .toString()
                            .replaceAll('[', '')
                            .replaceAll(']', ''),
                        style:
                            AppStyles.dogProfileCardSubHeaderDataTextStyle,
                        maxLines: 1,
                        softWrap: false,
                        overflow: TextOverflow.ellipsis,
                      ),
                    ),
                  ],
                ),
              ],
            ),
          ),
          trailing: Padding(
            padding: const EdgeInsets.only(top: 10),
            child: IconButton(
              icon: const Icon(
                Icons.keyboard_arrow_right_rounded,
                color: accentColor,
                size: 28,
              ),
              onPressed: () {
                viewDogProfile(dog, index);
              },
            ),
          ),
        ),
      ),
    ),
  ),
);
</code>```

}

Body:
What every I try column, row, center, positioned, and aligned widgets, I still can't seem to align the dog image to the vertical center.

Does anyone know how to do this

Here is my widget

Widget build(BuildContext context) {
final dogTypes = dog.type!.map((type) => type.name).toList();
final teams = dog.teams.map((team) => team.name).toList();
return GestureDetector(
  onTap: () => viewDogProfile(dog, index),
  child: SizedBox(
    width: double.infinity,
    child: Card(
      shape: RoundedRectangleBorder(
        borderRadius: BorderRadius.circular(14),
      ),
      margin: const EdgeInsets.only(top: 25),
      child: Padding(
        padding: const EdgeInsets.only(bottom: 8),
        child: ListTile(
          leading: Container(
            width: 65,
            height: 65,
            decoration: const BoxDecoration(
              shape: BoxShape.circle,
            ),
            child: Stack(
              children: [
                CachedNetworkImage(
                  imageUrl: dog.image.url,
                  imageBuilder: (context, imageProvider) => Container(
                    height: 65,
                    width: 65,
                    decoration: BoxDecoration(
                      shape: BoxShape.circle,
                      image: DecorationImage(
                        image: imageProvider,
                        fit: BoxFit.cover,
                      ),
                      border: Border.all(
                        color: accentColor,
                        width: 2,
                      ),
                      boxShadow: [
                        BoxShadow(
                          color: Colors.black87.withOpacity(0.6),
                          spreadRadius: 0.8,
                          blurRadius: 2,
                          offset: const Offset(1, 1),
                        ),
                      ],
                    ),
                  ),
                  placeholder: (context, url) =>
                      const CircularProgressIndicator(
                    color: primaryColor,
                  ),
                  errorWidget: (context, url, error) =>
                      const Icon(Icons.error),
                ),
                DogStatusIcon(
                  dogStatus: dog.status,
                ),
              ],
            ),
          ),
          title: Row(
            children: [
              Flexible(
                child: Padding(
                  padding: const EdgeInsets.only(top: 8),
                  child: Text(
                    dog.name,
                    style: AppStyles.dogProfileCardHeaderTextStyle,
                    maxLines: 1,
                    softWrap: true,
                    overflow: TextOverflow.ellipsis,
                  ),
                ),
              ),
            ],
          ),
          subtitle: Padding(
            padding: const EdgeInsets.only(bottom: 5),
            child: Column(
              children: [
                Row(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    const Text(
                      'Teams: ',
                      style: AppStyles.dogProfileCardSubHeaderTextStyle,
                    ),
                    Flexible(
                      child: Text(
                        teams
                            .toString()
                            .replaceAll('[', '')
                            .replaceAll(']', ''),
                        style:
                            AppStyles.dogProfileCardSubHeaderDataTextStyle,
                        maxLines: 1,
                        softWrap: false,
                        overflow: TextOverflow.ellipsis,
                      ),
                    ),
                  ],
                ),
                Row(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    const Text(
                      'Breed: ',
                      style: AppStyles.dogProfileCardSubHeaderTextStyle,
                    ),
                    Flexible(
                      child: Text(
                        dog.breed.name,
                        style:
                            AppStyles.dogProfileCardSubHeaderDataTextStyle,
                        maxLines: 1,
                        softWrap: true,
                        overflow: TextOverflow.ellipsis,
                      ),
                    ),
                  ],
                ),
                Row(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    const Text(
                      'Type: ',
                      style: AppStyles.dogProfileCardSubHeaderTextStyle,
                    ),
                    Flexible(
                      child: Text(
                        dogTypes
                            .toString()
                            .replaceAll('[', '')
                            .replaceAll(']', ''),
                        style:
                            AppStyles.dogProfileCardSubHeaderDataTextStyle,
                        maxLines: 1,
                        softWrap: false,
                        overflow: TextOverflow.ellipsis,
                      ),
                    ),
                  ],
                ),
              ],
            ),
          ),
          trailing: Padding(
            padding: const EdgeInsets.only(top: 10),
            child: IconButton(
              icon: const Icon(
                Icons.keyboard_arrow_right_rounded,
                color: accentColor,
                size: 28,
              ),
              onPressed: () {
                viewDogProfile(dog, index);
              },
            ),
          ),
        ),
      ),
    ),
  ),
);

}


问:
IIS Redirect in Localhost
I have 2 localhost sites with dummy index page in each site.
URL's are : www.testsite1.com:5005 and www.testsite2.com:5006
I am trying to redirect when I hit www.testsite1.com:5005 to "www.testsite2.com:5006" in IIS

Following is my testsite1 web.config for this.

```<code><?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<rewrite>
    <rules>
        <rule name="Redirect" stopProcessing="true">
            <match url="(.*)" ignoreCase="true" />
            <conditions logicalGrouping="MatchAny" trackAllCaptures="true">
                    <add input="{HTTP_HOST}" pattern="(.*)" />
            </conditions>
            <action type="Redirect" url="http://www.testsite2.com:5006" appendQueryString="true" redirectType="Permanent" />
        </rule>
    </rules>
</rewrite>
</code>```

</system.webServer>

When I hit the www.testsite1.com:5005 it is redirecting to "https://www.testsite2.com/" but I am expecting redirect to "www.testsite2.com:5006"

How to avoid http to https? and include the port 5006 in the redirect?

Title: IIS Redirect in Localhost

Body:
I have 2 localhost sites with dummy index page in each site.
URL's are : www.testsite1.com:5005 and www.testsite2.com:5006
I am trying to redirect when I hit www.testsite1.com:5005 to "www.testsite2.com:5006" in IIS

Following is my testsite1 web.config for this.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<rewrite>
    <rules>
        <rule name="Redirect" stopProcessing="true">
            <match url="(.*)" ignoreCase="true" />
            <conditions logicalGrouping="MatchAny" trackAllCaptures="true">
                    <add input="{HTTP_HOST}" pattern="(.*)" />
            </conditions>
            <action type="Redirect" url="http://www.testsite2.com:5006" appendQueryString="true" redirectType="Permanent" />
        </rule>
    </rules>
</rewrite>

</system.webServer>

When I hit the www.testsite1.com:5005 it is redirecting to "https://www.testsite2.com/" but I am expecting redirect to "www.testsite2.com:5006"

How to avoid http to https? and include the port 5006 in the redirect?


问:
How to uninstall eSpeak NG
I installed eSpeak NG by building it locally. I would like to uninstall it. I ran:

sudo apt-get remove espeak-ng-espeak
```
<p>and</p>
<pre class="lang-bash prettyprint-override"><code>apt-get remove -y --purge espeak-ng
</code>```

...but these are not effective in removing the binary from my system:

espeak-ng --version
```

Returns: eSpeak NG text-to-speech: 1.51-dev  Data at: /usr/share/espeak-ng-data

I am not familiar with building packages from source, and I suspect I have to take additional measures to remove packages installed by this method. What are these measures?

Title: How to uninstall eSpeak NG

Body:
I installed eSpeak NG by building it locally. I would like to uninstall it. I ran:

sudo apt-get remove espeak-ng-espeak

and

apt-get remove -y --purge espeak-ng

...but these are not effective in removing the binary from my system:

espeak-ng --version

Returns: eSpeak NG text-to-speech: 1.51-dev  Data at: /usr/share/espeak-ng-data

I am not familiar with building packages from source, and I suspect I have to take additional measures to remove packages installed by this method. What are these measures?


问:
TYPO3 Extension Development - Where should JavaScript modules be placed in the optimal case?
I have stored a JavaScript file in a TYPO3 extension (under Resources/Public/Css/JavaScript/Backend/Iconpack.js), which is used as a JavaScript module in the backend.

However, when developing the extension, I packed the file full of console.log() to allow debugging, and also to better document certain things.

Of course I want that in the final extension as well as when downloading via composer, only a minimized version of this JavaScript is loaded, but not the original source file.

On the other hand, of course, I want the original source file to be stored somewhere in the git repository, so that you can actually continue working on it.

In the frontend, I would normally just store Iconpack.js, for example, in the same folder, create a minimized version from it, i.e. Iconpack.min.js, and use this minimized file.

But unfortunately that doesn't work in this case, because the file path for JavaScript modules is also the namespace.

What would be the best way to solve this?

To summarize:

The minimized version should be able to be used directly in the backend via Iconpack.js.

The namespace should be TYPO3/CMS/Iconpack/Backend/Iconpack and not TYPO3/CMS/Iconpack/Backend/Iconpack.min or similar.

The source file should not end up in TER or be loaded via composer.

But the source file should be accessible via Github.

I was able to find out that I can at least prevent a certain file from being loaded via composer with .gitattributes.

Unfortunately, that doesn't solve the question of where I should best place it so that other developers have it easier and it's clear that it's the source file.

Currently I only have the minimized version stored in git for this reason, but that makes little sense for an open source repository: https://github.com/quellenform/t3x-iconpack/tree/main/Resources/Public/JavaScript/Backend

Ideas?


问:
Error preparing registered callable parameter; Error preparing registered callable parameter
Error preparing registered callable parameter; nested exception is org.hibernate.exception.GenericJDBCException: Error preparing registered callable parameter

Error preparing registered callable parameter; nested exception is org.hibernate.exception.GenericJDBCException: Error preparing registered callable parameter


问:
Can't pass header in Python client generated by OpenAPI Generator
With the help of OpenAPI Generator I generated a Python client for the Amadeus Travel Restrictions API spec.

According to the README generated, I understand that I can pass headers with the header_params parameter but I receive the following error:

TypeError: g_et_covid_report() got an unexpected keyword argument 'header_params'
```
<p>Below you can check my code:</p>
<pre class="lang-py prettyprint-override"><code>import openapi_client
from openapi_client.apis.tags import covid19_area_report_api
from openapi_client.model.disease_area_report import DiseaseAreaReport
from openapi_client.model.error import Error
from openapi_client.model.meta import Meta
from openapi_client.model.warning import Warning
from pprint import pprint

configuration = openapi_client.Configuration(
    host = "https://test.api.amadeus.com/v2"
)

with openapi_client.ApiClient(configuration) as api_client:
    api_instance = covid19_area_report_api.Covid19AreaReportApi(api_client)

    query_params = {
        'countryCode': "US",
    }

    header_params = {
    'Authorization': "Bearer MY_ACCESS_TOKEN",
    }
    try:
        api_response = api_instance.g_et_covid_report(
            query_params=query_params,
            header_params=header_params
        )
        pprint(api_response)
    except openapi_client.ApiException as e:
        print("Exception when calling Covid19AreaReportApi->g_et_covid_report: %s\n" % e)
</code>```

I've been checking the library and also OpenAPI Generator project on GitHub but I still can't find a way to pass header parameters which I need in order to authorise my API call.

Body:
With the help of OpenAPI Generator I generated a Python client for the Amadeus Travel Restrictions API spec.

According to the README generated, I understand that I can pass headers with the header_params parameter but I receive the following error:

TypeError: g_et_covid_report() got an unexpected keyword argument 'header_params'

Below you can check my code:

import openapi_client
from openapi_client.apis.tags import covid19_area_report_api
from openapi_client.model.disease_area_report import DiseaseAreaReport
from openapi_client.model.error import Error
from openapi_client.model.meta import Meta
from openapi_client.model.warning import Warning
from pprint import pprint

configuration = openapi_client.Configuration(
    host = "https://test.api.amadeus.com/v2"
)

with openapi_client.ApiClient(configuration) as api_client:
    api_instance = covid19_area_report_api.Covid19AreaReportApi(api_client)

    query_params = {
        'countryCode': "US",
    }

    header_params = {
    'Authorization': "Bearer MY_ACCESS_TOKEN",
    }
    try:
        api_response = api_instance.g_et_covid_report(
            query_params=query_params,
            header_params=header_params
        )
        pprint(api_response)
    except openapi_client.ApiException as e:
        print("Exception when calling Covid19AreaReportApi->g_et_covid_report: %s\n" % e)

I've been checking the library and also OpenAPI Generator project on GitHub but I still can't find a way to pass header parameters which I need in order to authorise my API call.


问:
No Webhook recieved (Sandbox)
No Webhook recieved (Sandbox)
when i trying to hit webhook using ngrok created server paypal is firing the webhook

but when i set the webhook url to dev or live , the webhook is not firing

Title: No Webhook recieved (Sandbox)


问:
rvest - Error in curl::curl_fetch_memory(url, handle = handle): Failure when receiving data from the peer
I am trying to download several csv files from this website https://www.marketinout.com/ for a series of stock backtest strategies. For some reason I am getting the above error from the rvest package when trying to navigate to the webpage with the backtest results.

My only thought is that backtest results page can take some time to load and not sure if there is some sort of setting that I need to change to allow for more time for the webpage to load? I am able to navigate to other pages on the website just fine.

I have also attempted a solution with RSelenium with no success. RSelenium will navigate to the webpage just fine, but for some reason I cannot get it to download the csv file.

Here is my code I am using. It fails when trying to navigate to https://www.marketinout.com/stock-screener/backtest/backtest_strategy.php?va=1&strategy_id=75158

library(rvest)
library(readr)
library(tidyverse)

# log in to website
link <- "https://www.marketinout.com/home/login.php"

open_session <- session(link)

pg_form <- html_form(open_session)[[1]]
filled_form <- html_form_set(pg_form,
                             "l" = "USERNAME")
new_session <- session_submit(open_session, filled_form)

pg_form <- html_form(new_session)[[1]]
filled_form <- html_form_set(pg_form,
                             "l" = "USERNAME",
                             "d" = "PASSWORD")
new_session <- session_submit(new_session, filled_form)

# trying to get trade history from backtest into csv
file <- new_session %>%
  session_jump_to("https://www.marketinout.com/stock-screener/backtest/backtest_strategy.php?va=1&strategy_id=75158") %>% # <--- this is where the error occurs trying to navigate to this link
  session_jump_to("https://www.marketinout.com/stock-screener/backtest/csv_stocks.csv")

backtest_hist <- httr::content(file$response, as="text") %>%
  read_csv(col_names = T)
```
<p>As I mentioned, I am able to navigate to other webpages just fine. The below code works beautifully (which navigates to a specific stock portfolio and downloads the portfolio to a csv file).</p>
<pre class="lang-r prettyprint-override"><code>library(rvest)
library(readr)
library(tidyverse)

# log in to website
link <- "https://www.marketinout.com/home/login.php"

open_session <- session(link)

pg_form <- html_form(open_session)[[1]]
filled_form <- html_form_set(pg_form,
                             "l" = "USERNAME")
new_session <- session_submit(open_session, filled_form)

pg_form <- html_form(new_session)[[1]]
filled_form <- html_form_set(pg_form,
                             "l" = "USERNAME",
                             "d" = "PASSWORD")
new_session <- session_submit(new_session, filled_form)

# download stock portfolio
file <- new_session %>%
  session_jump_to("https://www.marketinout.com/tools/portfolio.php?pid=10257") %>%
  session_jump_to("https://www.marketinout.com/tools/csv.csv?pid=10257&view=ov")

port_hist <- httr::content(file$response, as="text") %>%
  read_csv(col_names = T) # <-- WORKS PERFECTLY
</code>```

Further I have attempted a solution with RSelenium but it fails at the download csv step:

library(RSelenium)
library(readr)
library(tidyverse)

# run after opening selenium image on Docker
rem_driver <- remoteDriver(remoteServerAddr = "localhost", port = 4445L, browserName = "firefox")
rem_driver$open()
rem_driver$navigate("https://www.marketinout.com/home/login.php")

# login to website
username <- rem_driver$findElement(using = "css", value = "#l")
username$sendKeysToElement(list("USERNAME"))
rem_driver$findElement("css", ".button")$clickElement()

password <- rem_driver$findElement(using = "css", value = "tr~ tr+ tr .text")
password$sendKeysToElement(list("PASSWORD"))
rem_driver$findElement("css", ".button")$clickElement()

# navigate to backtest results page and download csv file of trade history
rem_driver$navigate("https://www.marketinout.com/stock-screener/backtest/backtest_strategy.php?va=1&strategy_id=75158")
file <- rem_driver$navigate("https://www.marketinout.com/stock-screener/backtest/csv_stocks.csv") # <-- this produces an empty file with no contents

httr::content(file$response, as="text") %>% write_lines("test.csv") # <-- empty csv file
```

Any help would be appreciated! I've been working on this for a week with no luck.

Body:
I am trying to download several csv files from this website https://www.marketinout.com/ for a series of stock backtest strategies. For some reason I am getting the above error from the rvest package when trying to navigate to the webpage with the backtest results.

My only thought is that backtest results page can take some time to load and not sure if there is some sort of setting that I need to change to allow for more time for the webpage to load? I am able to navigate to other pages on the website just fine.

I have also attempted a solution with RSelenium with no success. RSelenium will navigate to the webpage just fine, but for some reason I cannot get it to download the csv file.

Here is my code I am using. It fails when trying to navigate to https://www.marketinout.com/stock-screener/backtest/backtest_strategy.php?va=1&strategy_id=75158

library(rvest)
library(readr)
library(tidyverse)

# log in to website
link <- "https://www.marketinout.com/home/login.php"

open_session <- session(link)

pg_form <- html_form(open_session)[[1]]
filled_form <- html_form_set(pg_form,
                             "l" = "USERNAME")
new_session <- session_submit(open_session, filled_form)

pg_form <- html_form(new_session)[[1]]
filled_form <- html_form_set(pg_form,
                             "l" = "USERNAME",
                             "d" = "PASSWORD")
new_session <- session_submit(new_session, filled_form)

# trying to get trade history from backtest into csv
file <- new_session %>%
  session_jump_to("https://www.marketinout.com/stock-screener/backtest/backtest_strategy.php?va=1&strategy_id=75158") %>% # <--- this is where the error occurs trying to navigate to this link
  session_jump_to("https://www.marketinout.com/stock-screener/backtest/csv_stocks.csv")

backtest_hist <- httr::content(file$response, as="text") %>%
  read_csv(col_names = T)

As I mentioned, I am able to navigate to other webpages just fine. The below code works beautifully (which navigates to a specific stock portfolio and downloads the portfolio to a csv file).

library(rvest)
library(readr)
library(tidyverse)

# log in to website
link <- "https://www.marketinout.com/home/login.php"

open_session <- session(link)

pg_form <- html_form(open_session)[[1]]
filled_form <- html_form_set(pg_form,
                             "l" = "USERNAME")
new_session <- session_submit(open_session, filled_form)

pg_form <- html_form(new_session)[[1]]
filled_form <- html_form_set(pg_form,
                             "l" = "USERNAME",
                             "d" = "PASSWORD")
new_session <- session_submit(new_session, filled_form)

# download stock portfolio
file <- new_session %>%
  session_jump_to("https://www.marketinout.com/tools/portfolio.php?pid=10257") %>%
  session_jump_to("https://www.marketinout.com/tools/csv.csv?pid=10257&view=ov")

port_hist <- httr::content(file$response, as="text") %>%
  read_csv(col_names = T) # <-- WORKS PERFECTLY

Further I have attempted a solution with RSelenium but it fails at the download csv step:

library(RSelenium)
library(readr)
library(tidyverse)

# run after opening selenium image on Docker
rem_driver <- remoteDriver(remoteServerAddr = "localhost", port = 4445L, browserName = "firefox")
rem_driver$open()
rem_driver$navigate("https://www.marketinout.com/home/login.php")

# login to website
username <- rem_driver$findElement(using = "css", value = "#l")
username$sendKeysToElement(list("USERNAME"))
rem_driver$findElement("css", ".button")$clickElement()

password <- rem_driver$findElement(using = "css", value = "tr~ tr+ tr .text")
password$sendKeysToElement(list("PASSWORD"))
rem_driver$findElement("css", ".button")$clickElement()

# navigate to backtest results page and download csv file of trade history
rem_driver$navigate("https://www.marketinout.com/stock-screener/backtest/backtest_strategy.php?va=1&strategy_id=75158")
file <- rem_driver$navigate("https://www.marketinout.com/stock-screener/backtest/csv_stocks.csv") # <-- this produces an empty file with no contents

httr::content(file$response, as="text") %>% write_lines("test.csv") # <-- empty csv file

Any help would be appreciated! I've been working on this for a week with no luck.


问:
Value in decorator depending on generic type
I'm not sure if it's possible or not but i would like to set a value in a decorator of an abstract class depending on the generic type provided.</p>
```<code>export abstract class Actionable<T> {

  @prop({
    match: {
      type: *string depending on T*,
    },
  })
  public updated: Ref<Action>;

}
</code>```

Body:
I'm not sure if it's possible or not but i would like to set a value in a decorator of an abstract class depending on the generic type provided.

export abstract class Actionable<T> {

  @prop({
    match: {
      type: *string depending on T*,
    },
  })
  public updated: Ref<Action>;

}


问:
Creating Code-Collaborator review, add participants and materials in single command
For a work relevant project, we create reviews in Code-collaborator through command line interface commands, I already used the commands

```<code>ccollab admin review create
</code>```

to create the review then I added the participants through

```<code>ccollab admin review set-participants
</code>```

in a last command I add the materials using

```<code>ccollab addsvndiff
</code>```

My supervisor insists, that it is possible to create a review with participants and the materials that have to be added, all in one single command.
I am still a university student, so instead of telling me how to do it, he tasked me to acquire the information myself.

I couldn´t find the awnser here https://support.smartbear.com/collaborator/docs/reference/command-line/ccollab-admin-review-create.html
so I am asking on here.

How do I create a Code-collaborator Review, add the participants and the materials in one single command line interface command?

The commands I tried function as expected, I just cannot summarize them into one.
I tried to read the documentation but couldn´t find the specific command I am searching for.

Body:
For a work relevant project, we create reviews in Code-collaborator through command line interface commands, I already used the commands

ccollab admin review create

to create the review then I added the participants through

ccollab admin review set-participants

in a last command I add the materials using

ccollab addsvndiff

My supervisor insists, that it is possible to create a review with participants and the materials that have to be added, all in one single command.
I am still a university student, so instead of telling me how to do it, he tasked me to acquire the information myself.

I couldn´t find the awnser here https://support.smartbear.com/collaborator/docs/reference/command-line/ccollab-admin-review-create.html
so I am asking on here.

How do I create a Code-collaborator Review, add the participants and the materials in one single command line interface command?

The commands I tried function as expected, I just cannot summarize them into one.
I tried to read the documentation but couldn´t find the specific command I am searching for.


问:
doctrine manager tries to update my User entity even without me making any modifications to it
I have a controller method where I'm making a insert method for my entity Order, it has a relation with the User entity, a user can have many orders, now when I'm creating my order and set a user to it, doctrine tries to update the user when I did no modifications to it, I want to know what I'm doing wrong
my Controller method

```<code>    #[Route('/new', name: 'new', methods: ['POST'])]
    public function order(
        Request $request,
        ServiceRepository $serviceRepository,
        EntityManagerInterface $manager
    ): JsonResponse
    {
        $data = json_decode(json: $request->getContent());

        //get service
        if (!property_exists($data, 'service'))
            return $this->json(['status' => false, 'message' => 'service is required']);
        $service = $serviceRepository->find($data->service);

        $order = new Order();

        $order->setUser($this->getUser());
                $order->setCreatedAt(new \DateTimeImmutable());
        $order->setTotal(0);
        $order->setStatus(Order::STATUS_OPEN);
        $order->setService($service);

        $manager->persist($order);
        $manager->flush();

        return $this->json(['status' => true]);
    }
</code>```

my User entity

```<code><?php

namespace App\Entity;

use App\Repository\UserRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Validator\Constraints as Assert;

#[ORM\Entity(repositoryClass: UserRepository::class)]
#[UniqueEntity('email', message: 'This Email Is Taken')]
#[ORM\Table(name: '`user`')]
class User implements UserInterface, PasswordAuthenticatedUserInterface
{
    #[ORM\Id]
    #[ORM\GeneratedValue]
    #[ORM\Column]
    private ?int $id = null;

    #[ORM\Column(length: 180, unique: true)]
    #[Assert\NotBlank, Assert\Email]
    private ?string $email = null;

    #[ORM\Column]
    private array $roles = [];

    /**
     * @var ?string The hashed password
     */
    #[ORM\Column]
    #[Assert\NotBlank]
    private ?string $password = null;

    #[ORM\Column(length: 255)]
    #[Assert\NotBlank]
    private ?string $name = null;

    #[ORM\Column(length: 255, nullable: true)]
    private ?string $password_token = null;

    #[ORM\Column(nullable: true)]
    private ?\DateTimeImmutable $password_time = null;

    #[ORM\Column]
    private ?\DateTimeImmutable $created_at = null;

    #[ORM\Column(nullable: true)]
    private ?\DateTimeImmutable $updated_at = null;

    #[ORM\OneToMany(mappedBy: 'user', targetEntity: Order::class, orphanRemoval: true)]
    private Collection $total;

    public function __construct()
    {
        $this->total = new ArrayCollection();
    }

    public function getId(): ?int
    {
        return $this->id;
    }

    public function getEmail(): ?string
    {
        return $this->email;
    }

    public function setEmail(string $email): self
    {
        $this->email = $email;

        return $this;
    }

    /**
     * A visual identifier that represents this user.
     *
     * @see UserInterface
     */
    public function getUserIdentifier(): string
    {
        return (string) $this->email;
    }

    /**
     * @deprecated since Symfony 5.3, use getUserIdentifier instead
     */
    public function getUsername(): string
    {
        return (string) $this->email;
    }

    /**
     * @see UserInterface
     */
    public function getRoles(): array
    {
        $roles = $this->roles;
        // guarantee every user at least has ROLE_USER
        $roles[] = 'ROLE_USER';

        return array_unique($roles);
    }

    public function setRoles(array $roles): self
    {
        $this->roles = $roles;

        return $this;
    }

    /**
     * @see PasswordAuthenticatedUserInterface
     */
    public function getPassword(): ?string
    {
        return $this->password;
    }

    public function setPassword(string $password): self
    {
        $this->password = $password;

        return $this;
    }

    /**
     * Returning a salt is only needed, if you are not using a modern
     * hashing algorithm (e.g. bcrypt or sodium) in your security.yaml.
     *
     * @see UserInterface
     */
    public function getSalt(): ?string
    {
        return null;
    }

    /**
     * @see UserInterface
     */
    public function eraseCredentials()
    {
        unset($this->password, $this->roles, $this->access_token, $this->refresh_token, $this->updated_at);
    }

    public function getName(): ?string
    {
        return $this->name;
    }

    public function setName(string $name): self
    {
        $this->name = $name;

        return $this;
    }

    public function getCreatedAt(): ?\DateTimeImmutable
    {
        return $this->created_at;
    }

    public function setCreatedAt(\DateTimeImmutable $created_at): self
    {
        $this->created_at = $created_at;

        return $this;
    }

    public function getUpdatedAt(): ?\DateTimeImmutable
    {
        return $this->updated_at;
    }

    public function setUpdatedAt(?\DateTimeImmutable $updated_at): self
    {
        $this->updated_at = $updated_at;

        return $this;
    }

   /**
    * @return string|null
    */
   public function getPasswordToken(): ?string
   {
       return $this->password_token;
   }

   /**
    * @param string|null $password_token
    */
   public function setPasswordToken(?string $password_token): void
   {
       $this->password_token = $password_token;
   }

   /**
    * @return \DateTimeImmutable|null
    */
   public function getPasswordTime(): ?\DateTimeImmutable
   {
       return $this->password_time;
   }

   /**
    * @param \DateTimeImmutable|null $password_time
    */
   public function setPasswordTime(?\DateTimeImmutable $password_time): void
   {
       $this->password_time = $password_time;
   }

    /**
     * @return Collection<int, Order>
     */
    public function getTotal(): Collection
    {
        return $this->total;
    }

    public function addTotal(Order $total): self
    {
        if (!$this->total->contains($total)) {
            $this->total->add($total);
            $total->setUser($this);
        }

        return $this;
    }

    public function removeTotal(Order $total): self
    {
        if ($this->total->removeElement($total)) {
            // set the owning side to null (unless already changed)
            if ($total->getUser() === $this) {
                $total->setUser(null);
            }
        }

        return $this;
    }
}

</code>```

and my Order Entity

```<code><?php

namespace App\Entity;

use App\Repository\OrderRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;

#[ORM\Entity(repositoryClass: OrderRepository::class)]
#[ORM\Table(name: '`order`')]
class Order
{
   public const STATUS_OPEN = 'open';
   public const STATUS_AWAITING_PAYMENT  = 'awaiting_payment';
   public const STATUS_PAYMENT_VALIDATED = 'payment_validated';
   public const STATUS_PAYMENT_CANCELLED = 'payment_cancelled';
   public const STATUS_COMPLETED = 'completed';

    #[ORM\Id]
    #[ORM\GeneratedValue]
    #[ORM\Column]
    private ?int $id = null;

    #[ORM\ManyToOne(inversedBy: 'total')]
    #[ORM\JoinColumn(nullable: false)]
    private ?User $user = null;

    #[ORM\Column]
    private ?float $total = null;

    #[ORM\Column(length: 255)]
    private ?string $status = null;

    #[ORM\Column]
    private ?\DateTimeImmutable $created_at = null;

    #[ORM\Column(nullable: true)]
    private ?\DateTimeImmutable $updated_at = null;

    #[ORM\OneToMany(mappedBy: 'parent', targetEntity: OrderItem::class, orphanRemoval: true)]
    private Collection $activity;

    #[ORM\ManyToOne(inversedBy: 'orders')]
    #[ORM\JoinColumn(nullable: false)]
    private ?Service $service = null;

    public function __construct()
    {
        $this->activity = new ArrayCollection();
    }

    public function getId(): ?int
    {
        return $this->id;
    }

    public function getUser(): ?User
    {
        return $this->user;
    }

    public function setUser(?User $user): self
    {
        $this->user = $user;

        return $this;
    }

    public function getTotal(): ?float
    {
        return $this->total;
    }

    public function setTotal(float $total): self
    {
        $this->total = $total;

        return $this;
    }

    public function getStatus(): ?string
    {
        return $this->status;
    }

    public function setStatus(string $status): self
    {
        $this->status = $status;

        return $this;
    }

    public function getCreatedAt(): ?\DateTimeImmutable
    {
        return $this->created_at;
    }

    public function setCreatedAt(\DateTimeImmutable $created_at): self
    {
        $this->created_at = $created_at;

        return $this;
    }

    public function getUpdatedAt(): ?\DateTimeImmutable
    {
        return $this->updated_at;
    }

    public function setUpdatedAt(?\DateTimeImmutable $updated_at): self
    {
        $this->updated_at = $updated_at;

        return $this;
    }

    /**
     * @return Collection<int, OrderItem>
     */
    public function getActivity(): Collection
    {
        return $this->activity;
    }

    public function addActivity(OrderItem $activity): self
    {
        if (!$this->activity->contains($activity)) {
            $this->activity->add($activity);
            $activity->setParent($this);
        }

        return $this;
    }

    public function removeActivity(OrderItem $activity): self
    {
        if ($this->activity->removeElement($activity)) {
            // set the owning side to null (unless already changed)
            if ($activity->getParent() === $this) {
                $activity->setParent(null);
            }
        }

        return $this;
    }

    public function getService(): ?Service
    {
        return $this->service;
    }

    public function setService(?Service $service): self
    {
        $this->service = $service;

        return $this;
    }
}

</code>```

so I tried to save the order, after that I save order items with the order id is the order saved above except it fails and gives me the contstrain error An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'roles' cannot be null
after debuging I found that doctrine is tryig to update my user here, but I made 0 modifications to the user so why would it be updated?

Body:
I have a controller method where I'm making a insert method for my entity Order, it has a relation with the User entity, a user can have many orders, now when I'm creating my order and set a user to it, doctrine tries to update the user when I did no modifications to it, I want to know what I'm doing wrong
my Controller method

    #[Route('/new', name: 'new', methods: ['POST'])]
    public function order(
        Request $request,
        ServiceRepository $serviceRepository,
        EntityManagerInterface $manager
    ): JsonResponse
    {
        $data = json_decode(json: $request->getContent());

        //get service
        if (!property_exists($data, 'service'))
            return $this->json(['status' => false, 'message' => 'service is required']);
        $service = $serviceRepository->find($data->service);

        $order = new Order();

        $order->setUser($this->getUser());
                $order->setCreatedAt(new \DateTimeImmutable());
        $order->setTotal(0);
        $order->setStatus(Order::STATUS_OPEN);
        $order->setService($service);

        $manager->persist($order);
        $manager->flush();

        return $this->json(['status' => true]);
    }

my User entity

<?php

namespace App\Entity;

use App\Repository\UserRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Validator\Constraints as Assert;

#[ORM\Entity(repositoryClass: UserRepository::class)]
#[UniqueEntity('email', message: 'This Email Is Taken')]
#[ORM\Table(name: '`user`')]
class User implements UserInterface, PasswordAuthenticatedUserInterface
{
    #[ORM\Id]
    #[ORM\GeneratedValue]
    #[ORM\Column]
    private ?int $id = null;

    #[ORM\Column(length: 180, unique: true)]
    #[Assert\NotBlank, Assert\Email]
    private ?string $email = null;

    #[ORM\Column]
    private array $roles = [];

    /**
     * @var ?string The hashed password
     */
    #[ORM\Column]
    #[Assert\NotBlank]
    private ?string $password = null;

    #[ORM\Column(length: 255)]
    #[Assert\NotBlank]
    private ?string $name = null;

    #[ORM\Column(length: 255, nullable: true)]
    private ?string $password_token = null;

    #[ORM\Column(nullable: true)]
    private ?\DateTimeImmutable $password_time = null;

    #[ORM\Column]
    private ?\DateTimeImmutable $created_at = null;

    #[ORM\Column(nullable: true)]
    private ?\DateTimeImmutable $updated_at = null;

    #[ORM\OneToMany(mappedBy: 'user', targetEntity: Order::class, orphanRemoval: true)]
    private Collection $total;

    public function __construct()
    {
        $this->total = new ArrayCollection();
    }

    public function getId(): ?int
    {
        return $this->id;
    }

    public function getEmail(): ?string
    {
        return $this->email;
    }

    public function setEmail(string $email): self
    {
        $this->email = $email;

        return $this;
    }

    /**
     * A visual identifier that represents this user.
     *
     * @see UserInterface
     */
    public function getUserIdentifier(): string
    {
        return (string) $this->email;
    }

    /**
     * @deprecated since Symfony 5.3, use getUserIdentifier instead
     */
    public function getUsername(): string
    {
        return (string) $this->email;
    }

    /**
     * @see UserInterface
     */
    public function getRoles(): array
    {
        $roles = $this->roles;
        // guarantee every user at least has ROLE_USER
        $roles[] = 'ROLE_USER';

        return array_unique($roles);
    }

    public function setRoles(array $roles): self
    {
        $this->roles = $roles;

        return $this;
    }

    /**
     * @see PasswordAuthenticatedUserInterface
     */
    public function getPassword(): ?string
    {
        return $this->password;
    }

    public function setPassword(string $password): self
    {
        $this->password = $password;

        return $this;
    }

    /**
     * Returning a salt is only needed, if you are not using a modern
     * hashing algorithm (e.g. bcrypt or sodium) in your security.yaml.
     *
     * @see UserInterface
     */
    public function getSalt(): ?string
    {
        return null;
    }

    /**
     * @see UserInterface
     */
    public function eraseCredentials()
    {
        unset($this->password, $this->roles, $this->access_token, $this->refresh_token, $this->updated_at);
    }

    public function getName(): ?string
    {
        return $this->name;
    }

    public function setName(string $name): self
    {
        $this->name = $name;

        return $this;
    }

    public function getCreatedAt(): ?\DateTimeImmutable
    {
        return $this->created_at;
    }

    public function setCreatedAt(\DateTimeImmutable $created_at): self
    {
        $this->created_at = $created_at;

        return $this;
    }

    public function getUpdatedAt(): ?\DateTimeImmutable
    {
        return $this->updated_at;
    }

    public function setUpdatedAt(?\DateTimeImmutable $updated_at): self
    {
        $this->updated_at = $updated_at;

        return $this;
    }

   /**
    * @return string|null
    */
   public function getPasswordToken(): ?string
   {
       return $this->password_token;
   }

   /**
    * @param string|null $password_token
    */
   public function setPasswordToken(?string $password_token): void
   {
       $this->password_token = $password_token;
   }

   /**
    * @return \DateTimeImmutable|null
    */
   public function getPasswordTime(): ?\DateTimeImmutable
   {
       return $this->password_time;
   }

   /**
    * @param \DateTimeImmutable|null $password_time
    */
   public function setPasswordTime(?\DateTimeImmutable $password_time): void
   {
       $this->password_time = $password_time;
   }

    /**
     * @return Collection<int, Order>
     */
    public function getTotal(): Collection
    {
        return $this->total;
    }

    public function addTotal(Order $total): self
    {
        if (!$this->total->contains($total)) {
            $this->total->add($total);
            $total->setUser($this);
        }

        return $this;
    }

    public function removeTotal(Order $total): self
    {
        if ($this->total->removeElement($total)) {
            // set the owning side to null (unless already changed)
            if ($total->getUser() === $this) {
                $total->setUser(null);
            }
        }

        return $this;
    }
}

and my Order Entity

<?php

namespace App\Entity;

use App\Repository\OrderRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;

#[ORM\Entity(repositoryClass: OrderRepository::class)]
#[ORM\Table(name: '`order`')]
class Order
{
   public const STATUS_OPEN = 'open';
   public const STATUS_AWAITING_PAYMENT  = 'awaiting_payment';
   public const STATUS_PAYMENT_VALIDATED = 'payment_validated';
   public const STATUS_PAYMENT_CANCELLED = 'payment_cancelled';
   public const STATUS_COMPLETED = 'completed';

    #[ORM\Id]
    #[ORM\GeneratedValue]
    #[ORM\Column]
    private ?int $id = null;

    #[ORM\ManyToOne(inversedBy: 'total')]
    #[ORM\JoinColumn(nullable: false)]
    private ?User $user = null;

    #[ORM\Column]
    private ?float $total = null;

    #[ORM\Column(length: 255)]
    private ?string $status = null;

    #[ORM\Column]
    private ?\DateTimeImmutable $created_at = null;

    #[ORM\Column(nullable: true)]
    private ?\DateTimeImmutable $updated_at = null;

    #[ORM\OneToMany(mappedBy: 'parent', targetEntity: OrderItem::class, orphanRemoval: true)]
    private Collection $activity;

    #[ORM\ManyToOne(inversedBy: 'orders')]
    #[ORM\JoinColumn(nullable: false)]
    private ?Service $service = null;

    public function __construct()
    {
        $this->activity = new ArrayCollection();
    }

    public function getId(): ?int
    {
        return $this->id;
    }

    public function getUser(): ?User
    {
        return $this->user;
    }

    public function setUser(?User $user): self
    {
        $this->user = $user;

        return $this;
    }

    public function getTotal(): ?float
    {
        return $this->total;
    }

    public function setTotal(float $total): self
    {
        $this->total = $total;

        return $this;
    }

    public function getStatus(): ?string
    {
        return $this->status;
    }

    public function setStatus(string $status): self
    {
        $this->status = $status;

        return $this;
    }

    public function getCreatedAt(): ?\DateTimeImmutable
    {
        return $this->created_at;
    }

    public function setCreatedAt(\DateTimeImmutable $created_at): self
    {
        $this->created_at = $created_at;

        return $this;
    }

    public function getUpdatedAt(): ?\DateTimeImmutable
    {
        return $this->updated_at;
    }

    public function setUpdatedAt(?\DateTimeImmutable $updated_at): self
    {
        $this->updated_at = $updated_at;

        return $this;
    }

    /**
     * @return Collection<int, OrderItem>
     */
    public function getActivity(): Collection
    {
        return $this->activity;
    }

    public function addActivity(OrderItem $activity): self
    {
        if (!$this->activity->contains($activity)) {
            $this->activity->add($activity);
            $activity->setParent($this);
        }

        return $this;
    }

    public function removeActivity(OrderItem $activity): self
    {
        if ($this->activity->removeElement($activity)) {
            // set the owning side to null (unless already changed)
            if ($activity->getParent() === $this) {
                $activity->setParent(null);
            }
        }

        return $this;
    }

    public function getService(): ?Service
    {
        return $this->service;
    }

    public function setService(?Service $service): self
    {
        $this->service = $service;

        return $this;
    }
}

so I tried to save the order, after that I save order items with the order id is the order saved above except it fails and gives me the contstrain error An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'roles' cannot be null
after debuging I found that doctrine is tryig to update my user here, but I made 0 modifications to the user so why would it be updated?


问:
change colors for each kind of python variable in VS Code
How can I override my VS Code Appearance configuration to change the color of each type of python variable ? For example:


问:
404 error on requests to peerjs server on port 443 in an ec2 instance
I made a simple WebRTC app using socket.io and peerjs, it works fine when I tested it locally using port 3001. After i hosted it on an https ec2 instance, with only changing the peerjs port from 3001 to 443, the website and camera open but the connection to the peerjs server returns 404

The server side code:
`

```<code>const express = require("express")
const app = express()
const server = require("http").Server(app)
const io = require("socket.io")(server)
const {v4: uuidv4} = require('uuid')

app.set('view engine', 'ejs')
app.use(express.static("public"))

app.get("/", (req,res)=>{
    res.redirect(`/${uuidv4()}`)
})

app.get("/:room", (req,res)=>{
    res.render('room', {roomId: req.params.room})
})

//run everytime someone connects
io.on("connection", socket=>{
    //the events you want to listen to
    socket.on('join-room', (roomId, userId)=> {
        //console.log(roomId,userId)

        //join room
        socket.join(roomId)
        //send msg to room to everyone
        socket.to(roomId).emit('user-connected', userId);

        socket.on('disconnect', ()=>{
            socket.to(roomId).emit('user-disconnected', userId)
        })
    })
})

server.listen(8080)
</code>```

`

The client side code:

`

```<code>//the socket is connecting to the root path
const socket = io("/")

const peers={}

const videoGrid = document.getElementById("video-grid")

//Create a peer
const myPeer = new Peer(undefined, {
    host: "/",
    port: "443"
})

//create the video element
const myVideo = document.createElement('video')
//mute your own video
myVideo.muted = true

let myVideoStream;
navigator.mediaDevices.getUserMedia({
    video: true,
    audio: true
}).then(stream=>{
    myVideoStream = stream
    addVideoStream(myVideo, stream)

    //give the stream back to the caller
    myPeer.on("call", call=>{
        call.answer(stream)

        const video = document.createElement('video')
        call.on("stream", userVideoStream=>{
            addVideoStream(video, userVideoStream)
        })
    })

    //listen to userconnected event
    socket.on("user-connected", userId=>{
        console.log("user connected "+ userId)
        connectToNewUser(userId, stream)
    })
})

socket.on('user-disconnected', userId=>{
    if (peers[userId]) peers[userId].close()
})

//this will be ran after a successful connection to the peer server
myPeer.on("open", id=>{
    //send the event to the server
    socket.emit('join-room', ROOMID,id)
})

function connectToNewUser(userId, stream){
    //calling and sending userId and stream
    const call = myPeer.call(userId, stream)
    const video = document.createElement('video')

    //when this event runs, the new user's stream will be sent
    call.on('stream', userVideoStream=>{
        addVideoStream(video, userVideoStream)
    })

    call.on('close', ()=>{
        video.remove()
    })

    peers[userId] = call
}

function addVideoStream(video, stream){
    video.srcObject = stream
    video.addEventListener('loadedmetadata', ()=>{
        video.play()
        console.log("hi")
        videoGrid.append(video)
    })
}

//______________Mute,Stop,Invite buttons
const inviteButton = document.querySelector("#inviteButton");
const muteButton = document.querySelector("#muteButton");
const stopVideo = document.querySelector("#stopVideo");
muteButton.addEventListener("click", () => {
  const enabled = myVideoStream.getAudioTracks()[0].enabled;
  if (enabled) {
    myVideoStream.getAudioTracks()[0].enabled = false;
    html = `<i class="fas fa-microphone-slash"></i>`;
    muteButton.classList.toggle("background__red");
    muteButton.innerHTML = html;
  } else {
    myVideoStream.getAudioTracks()[0].enabled = true;
    html = `<i class="fas fa-microphone"></i>`;
    muteButton.classList.toggle("background__red");
    muteButton.innerHTML = html;
  }
});

stopVideo.addEventListener("click", () => {
  const enabled = myVideoStream.getVideoTracks()[0].enabled;
  if (enabled) {
    myVideoStream.getVideoTracks()[0].enabled = false;
    html = `<i class="fas fa-video-slash"></i>`;
    stopVideo.classList.toggle("background__red");
    stopVideo.innerHTML = html;
  } else {
    myVideoStream.getVideoTracks()[0].enabled = true;
    html = `<i class="fas fa-video"></i>`;
    stopVideo.classList.toggle("background__red");
    stopVideo.innerHTML = html;
  }
});

inviteButton.addEventListener("click", (e) => {
  prompt(
    "Copy this link and send it to people you want to meet with",
    window.location.href
  );
});

socket.on("createMessage", (message, userName) => {
  messages.innerHTML =
    messages.innerHTML +
    `<div class="message">
        <b><i class="far fa-user-circle"></i> <span> ${
          userName === user ? "me" : userName
        }</span> </b>
        <span>${message}</span>
    </div>`;
});
</code>```

`

I tried changing the port and updating the peerjs module.

Body:
I made a simple WebRTC app using socket.io and peerjs, it works fine when I tested it locally using port 3001. After i hosted it on an https ec2 instance, with only changing the peerjs port from 3001 to 443, the website and camera open but the connection to the peerjs server returns 404

The server side code:
`

const express = require("express")
const app = express()
const server = require("http").Server(app)
const io = require("socket.io")(server)
const {v4: uuidv4} = require('uuid')

app.set('view engine', 'ejs')
app.use(express.static("public"))

app.get("/", (req,res)=>{
    res.redirect(`/${uuidv4()}`)
})

app.get("/:room", (req,res)=>{
    res.render('room', {roomId: req.params.room})
})

//run everytime someone connects
io.on("connection", socket=>{
    //the events you want to listen to
    socket.on('join-room', (roomId, userId)=> {
        //console.log(roomId,userId)

        //join room
        socket.join(roomId)
        //send msg to room to everyone
        socket.to(roomId).emit('user-connected', userId);

        socket.on('disconnect', ()=>{
            socket.to(roomId).emit('user-disconnected', userId)
        })
    })
})

server.listen(8080)

`

The client side code:

`

//the socket is connecting to the root path
const socket = io("/")

const peers={}

const videoGrid = document.getElementById("video-grid")

//Create a peer
const myPeer = new Peer(undefined, {
    host: "/",
    port: "443"
})

//create the video element
const myVideo = document.createElement('video')
//mute your own video
myVideo.muted = true

let myVideoStream;
navigator.mediaDevices.getUserMedia({
    video: true,
    audio: true
}).then(stream=>{
    myVideoStream = stream
    addVideoStream(myVideo, stream)

    //give the stream back to the caller
    myPeer.on("call", call=>{
        call.answer(stream)

        const video = document.createElement('video')
        call.on("stream", userVideoStream=>{
            addVideoStream(video, userVideoStream)
        })
    })

    //listen to userconnected event
    socket.on("user-connected", userId=>{
        console.log("user connected "+ userId)
        connectToNewUser(userId, stream)
    })
})

socket.on('user-disconnected', userId=>{
    if (peers[userId]) peers[userId].close()
})

//this will be ran after a successful connection to the peer server
myPeer.on("open", id=>{
    //send the event to the server
    socket.emit('join-room', ROOMID,id)
})

function connectToNewUser(userId, stream){
    //calling and sending userId and stream
    const call = myPeer.call(userId, stream)
    const video = document.createElement('video')

    //when this event runs, the new user's stream will be sent
    call.on('stream', userVideoStream=>{
        addVideoStream(video, userVideoStream)
    })

    call.on('close', ()=>{
        video.remove()
    })

    peers[userId] = call
}

function addVideoStream(video, stream){
    video.srcObject = stream
    video.addEventListener('loadedmetadata', ()=>{
        video.play()
        console.log("hi")
        videoGrid.append(video)
    })
}

//______________Mute,Stop,Invite buttons
const inviteButton = document.querySelector("#inviteButton");
const muteButton = document.querySelector("#muteButton");
const stopVideo = document.querySelector("#stopVideo");
muteButton.addEventListener("click", () => {
  const enabled = myVideoStream.getAudioTracks()[0].enabled;
  if (enabled) {
    myVideoStream.getAudioTracks()[0].enabled = false;
    html = `<i class="fas fa-microphone-slash"></i>`;
    muteButton.classList.toggle("background__red");
    muteButton.innerHTML = html;
  } else {
    myVideoStream.getAudioTracks()[0].enabled = true;
    html = `<i class="fas fa-microphone"></i>`;
    muteButton.classList.toggle("background__red");
    muteButton.innerHTML = html;
  }
});

stopVideo.addEventListener("click", () => {
  const enabled = myVideoStream.getVideoTracks()[0].enabled;
  if (enabled) {
    myVideoStream.getVideoTracks()[0].enabled = false;
    html = `<i class="fas fa-video-slash"></i>`;
    stopVideo.classList.toggle("background__red");
    stopVideo.innerHTML = html;
  } else {
    myVideoStream.getVideoTracks()[0].enabled = true;
    html = `<i class="fas fa-video"></i>`;
    stopVideo.classList.toggle("background__red");
    stopVideo.innerHTML = html;
  }
});

inviteButton.addEventListener("click", (e) => {
  prompt(
    "Copy this link and send it to people you want to meet with",
    window.location.href
  );
});

socket.on("createMessage", (message, userName) => {
  messages.innerHTML =
    messages.innerHTML +
    `

          ${
          userName === user ? "me" : userName
        }
        ${message}

`;
});

`

I tried changing the port and updating the peerjs module.


问:
How to get Spyder import the version of the module that is being shown in Anaconda navigator?
I have just installed Anaconda on my Windows PC to write Python code with Spyder, and I want to use type annotation TypeAlias from module typing. Since TypeAlias was introduced in version 3.10 of typing, I have installed that version from Anaconda, and the Anaconda navigator confirms that I have 3.10.0 installed:

This I can also check by printing the list of packages with conda list in the Terminal. Fine.
Going back to Spyder console, doing import typing and checking the module location, I get this:

The file typing.py that is being referred to is some pre-3.10 version of typing that does not define TypeAlias, so it cannot be the file that was copied when I installed typing from the Anaconda navigator.

I have searched around, but I cannot figure out how to get Spyder use another file for that module. What am I supposed to do to have Spyder use the version of the module that is shown in the Anaconda navigator instead of the outdated version that came with Anaconda on installation?


问:
In my bot I'm using my command bot info or my bot joins new guild it getting errors to send the message
When ever I'm using my bot info command it showing this error and i don't know how to solve it

Error

TypeError: Cannot read properties of null (reading 'broadcastEval')

    at module.exports (/home/container/src/commands/bot/info.js:7:22)

    at Client.client.loadSubcommands (/home/container/src/handlers/functions/functions.js:87:130)

    at processTicksAndRejections (node:internal/process/task_queues:96:5)```

</code>```


问:
Why is my javascript displaying only the first row from the table on Highcharts and not all?
Why does my javascript just show the first row from the table on Highcharts and not the other rows?
Everything works fine except highcharts only shows data of the first row on the graph and not all rows.What am I missing?
http://live.datatables.net/febayaxa/10/edit

Please see the code below. Thanks in advance.

$(document).ready(function() {

  var tableData = [];
  var tableCategories = [];

  var table = $("#example1").DataTable({
    initComplete: function(settings, json) {
      let api = new $.fn.dataTable.Api(settings);

      // get the seris data as an array of numbers from the table row data:
      api.rows().data().toArray()[0].forEach(function(element, index) {
        if (index > 0) {
          tableData.push(parseFloat(element.replace(/,/g, '')));
        }
      });

      // get the x-axis caregories from the table headings:
      api.columns().header().toArray().forEach(function(element, index) {
        if (index > 0) {
          tableCategories.push($(element).html());
        }
      });

    }
  });

  var myChart = Highcharts.chart("container", {
    chart: {
      type: "column"
    },
    title: {
      text: "Test Data"
    },
    xAxis: {
      categories: tableCategories
    },
    series: [{
      data: tableData
    }]
  });

});```
<pre class="snippet-code-html lang-html prettyprint-override"><code><!DOCTYPE html>
<html>
  <head>
    <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>

    <link href="https://nightly.datatables.net/css/jquery.dataTables.css" rel="stylesheet" type="text/css" />
    <script src="https://nightly.datatables.net/js/jquery.dataTables.js"></script>
 <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>

    <link href="https://nightly.datatables.net/css/jquery.dataTables.css" rel="stylesheet" type="text/css" />
    <script src="https://nightly.datatables.net/js/jquery.dataTables.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
    <meta charset=utf-8 />

  </head>
  <body>

<div id="container" style=" width: 100%; height: 400px;"></div>

<div class="container">
<table id="example1" class="display nowrap" width="100%"><thead>
<tr><th>Year</th><th>2012</th><th>2013</th><th>2014</th><th>2015</th><th>2016</th><th>2017</th><th>2018</th><th>2019</th><th>2020</th><th>2021</th></tr></thead>

 <tr ><td> Data</td><td>3,823</td><td>3,823</td><td>3,954</td><td>3,959</td><td>3,955</td><td>3,956</td><td>3,843</td><td>3,699</td><td>3,472</td><td>3,551</td></tr></tbody>
   <tr ><td> Data</td><td>8,000</td><td>3,823</td><td>3,954</td><td>3,959</td><td>3,955</td><td>3,956</td><td>3,843</td><td>3,699</td><td>3,472</td><td>3,551</td></tr></tbody>
  </tbody></table></code>```

Body:
Why does my javascript just show the first row from the table on Highcharts and not the other rows?
Everything works fine except highcharts only shows data of the first row on the graph and not all rows.What am I missing?
http://live.datatables.net/febayaxa/10/edit

Please see the code below. Thanks in advance.

$(document).ready(function() {

  var tableData = [];
  var tableCategories = [];

  var table = $("#example1").DataTable({
    initComplete: function(settings, json) {
      let api = new $.fn.dataTable.Api(settings);

      // get the seris data as an array of numbers from the table row data:
      api.rows().data().toArray()[0].forEach(function(element, index) {
        if (index > 0) {
          tableData.push(parseFloat(element.replace(/,/g, '')));
        }
      });

      // get the x-axis caregories from the table headings:
      api.columns().header().toArray().forEach(function(element, index) {
        if (index > 0) {
          tableCategories.push($(element).html());
        }
      });

    }
  });

  var myChart = Highcharts.chart("container", {
    chart: {
      type: "column"
    },
    title: {
      text: "Test Data"
    },
    xAxis: {
      categories: tableCategories
    },
    series: [{
      data: tableData
    }]
  });

});

<!DOCTYPE html>

    <link href="https://nightly.datatables.net/css/jquery.dataTables.css" rel="stylesheet" type="text/css" />

    <link href="https://nightly.datatables.net/css/jquery.dataTables.css" rel="stylesheet" type="text/css" />

    <meta charset=utf-8 />

Year	2012	2013	2014	2015	2016	2017	2018	2019	2020	2021

 Data	3,823	3,823	3,954	3,959	3,955	3,956	3,843	3,699	3,472	3,551

 Data	8,000	3,823	3,954	3,959	3,955	3,956	3,843	3,699	3,472	3,551


问:
AS3 and HTTPS - opening a raw socket, loading assets via HTTP?
in the light of facebook's imminent switch to HTTPS (yes, i'm late to the party),
i have some questions around AS3 and HTTPS / HTTP.

so my understanding is that facebook is going to serve up html from an https address,
and in the html is an iframe with the URL of our .swf file.

i assume that we'll have to be able to server that .swf file via https, and that seems reasonable.

my questions are more around what happens within flash once the .swf is running.
we have many requests to our backend via HTTP, and we also periodically open up a raw socket also into our backend.

is flash/the browser going to give us grief about that socket or those http requests ?

thanks in advance,
orion

ContentLicense: CC BY-SA 3.0


问:
Cakephp 4 giving 403 error while using ajax
I am trying to implement cascading drop down box in cakephp 4 using ajax.

I'm getting an 403 error has tried many solutions from google and stack overflow from htaccess till syntax error and logical error can anyone please help trying since long.

Here is my code:

Add.php

```<code> <?php  echo $this->Form->control('groups',['options' => $groups],array('id'=>'GroupId'));
                        echo $this->Form->input('user_id',array('id'=>'UsersId'));
    ?>

    <?= $this->Form->button(__('Submit'),array('id'=>'post')) ?>
    <?= $this->Form->end() ?>

<?php echo $this->Html->script('//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js');?>
<script type="text/javascript" >
        $(document).ready(function(){

            $("#groups").change(function(){
                var deptid = $(this).val();
                //var path="<?php echo $this->Url->webroot ?>/Users/getbygroup";
                $.ajax({
                    url: '../Users/getbygroup',
                    type: 'POST',
                    data: deptid,
                    dataType: 'json',
                    cache: false,
                    contentType: false,

                    success:function(response){

                        var len = response.length;

                        $("#UserId").empty();
                        for( var i = 0; i<len; i++){
                            var id = response[i]['id'];
                            var name = response[i]['name'];

                            $("#UserId").append("<option value='"+id+"'>"+name+"</option>");

                        }
                    }
                });
            });

        });
    </script>
</code>```

Add action in files controller:

```<code>public function add()

    {
        $this->loadModel('Users');
        $this->loadModel('Groups');
        $this->set('groups', $this->Groups->find('list'));

        $result = $this->Users->find('all');  // returns query object
        $data = $result->toArray();  // converts query object to key value array

        $file = $this->Files->newEmptyEntity();
        if ($this->request->is('post')) {
            $file = $this->Files->patchEntity($file, $this->request->getData());
            if ($this->Files->save($file)) {
                $this->Flash->success(__('The file has been saved.'));

                return $this->redirect(['action' => 'index']);
            }
            $this->Flash->error(__('The file could not be saved. Please, try again.'));
        }
        $this->set(compact('file'));
    }
</code>```

getbygroup function in users controller:

```<code>public function getbygroup() {
      $fname= $this->request->getData('deptid');

       $this->viewbuilder()->layout = 'ajax';

     $users = $this->Users->find('list', array(
          'conditions' => array('Users.group_id' => $fname),
          'recursive' => -1));
     $this->set('users', $users);

}
</code>```

Body:
I am trying to implement cascading drop down box in cakephp 4 using ajax.

I'm getting an 403 error has tried many solutions from google and stack overflow from htaccess till syntax error and logical error can anyone please help trying since long.

Here is my code:

Add.php

 <?php  echo $this->Form->control('groups',['options' => $groups],array('id'=>'GroupId'));
                        echo $this->Form->input('user_id',array('id'=>'UsersId'));
    ?>

    <?= $this->Form->button(__('Submit'),array('id'=>'post')) ?>
    <?= $this->Form->end() ?>

<?php echo $this->Html->script('//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js');?>

Add action in files controller:

public function add()

    {
        $this->loadModel('Users');
        $this->loadModel('Groups');
        $this->set('groups', $this->Groups->find('list'));

        $result = $this->Users->find('all');  // returns query object
        $data = $result->toArray();  // converts query object to key value array

        $file = $this->Files->newEmptyEntity();
        if ($this->request->is('post')) {
            $file = $this->Files->patchEntity($file, $this->request->getData());
            if ($this->Files->save($file)) {
                $this->Flash->success(__('The file has been saved.'));

                return $this->redirect(['action' => 'index']);
            }
            $this->Flash->error(__('The file could not be saved. Please, try again.'));
        }
        $this->set(compact('file'));
    }

getbygroup function in users controller:

public function getbygroup() {
      $fname= $this->request->getData('deptid');

       $this->viewbuilder()->layout = 'ajax';

     $users = $this->Users->find('list', array(
          'conditions' => array('Users.group_id' => $fname),
          'recursive' => -1));
     $this->set('users', $users);

}


问:
Create an Endless Item picker with PageView in Flutter
please i'm creating an Item picker with PageView the always put the selected item on center. it seems to be correct withpageSnapping: true but the probleme is, when i reach the end, there's space on the screen.
remove the space on right when the end is reached.

i can user padEnds: true, to remove that space but the selected item will not longer be on the middle.

imagine i have 15 items, what i want is when the PageView Shows the 15th item (selected), continue by showing from the first item (Make it infinit scroll)

```<code>class _MyAppState extends State<MyApp> {
  late PageController _pageController;
  late int _currentPage;

  @override
  void initState() {
    _currentPage = 3;
    _pageController = PageController(
      initialPage: 3,
      viewportFraction: 1/4
    );
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Center(child: FractionallySizedBox(
          heightFactor: 0.2,
          child: PageView.builder(
            itemCount: 16,
            pageSnapping: true,
            controller: _pageController,
            onPageChanged: (page) {
              setState(() => _currentPage=page);
            },
            itemBuilder: (_, index)
            {
              return InkWell(
                onTap: () {
                  setState(() {
                    _pageController.animateToPage(
                      index,
                      curve: Curves.linear,
                      duration: const Duration(milliseconds: 320)
                    );
                  });
                },

                child: Container(
                  margin: EdgeInsets.only(
                    left: index==0 ? 0 : 10,
                    right: index==15 ? 0 : 10,
                  ),
                  child: PhysicalModel(
                    elevation: 4,
                    color: (index==_currentPage) ? Colors.blue : Colors.red,
                    borderRadius: BorderRadius.circular(12),
                    child: Center(child: Text(index.toString()))
                  )
                )
              );
            }
          )
        ))
      )
    );
  }
}
</code>```

i need to end up with something like this.
the final result i need

thank you so much.

Body:
please i'm creating an Item picker with PageView the always put the selected item on center. it seems to be correct withpageSnapping: true but the probleme is, when i reach the end, there's space on the screen.
remove the space on right when the end is reached.

i can user padEnds: true, to remove that space but the selected item will not longer be on the middle.

imagine i have 15 items, what i want is when the PageView Shows the 15th item (selected), continue by showing from the first item (Make it infinit scroll)

class _MyAppState extends State<MyApp> {
  late PageController _pageController;
  late int _currentPage;

  @override
  void initState() {
    _currentPage = 3;
    _pageController = PageController(
      initialPage: 3,
      viewportFraction: 1/4
    );
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Center(child: FractionallySizedBox(
          heightFactor: 0.2,
          child: PageView.builder(
            itemCount: 16,
            pageSnapping: true,
            controller: _pageController,
            onPageChanged: (page) {
              setState(() => _currentPage=page);
            },
            itemBuilder: (_, index)
            {
              return InkWell(
                onTap: () {
                  setState(() {
                    _pageController.animateToPage(
                      index,
                      curve: Curves.linear,
                      duration: const Duration(milliseconds: 320)
                    );
                  });
                },

                child: Container(
                  margin: EdgeInsets.only(
                    left: index==0 ? 0 : 10,
                    right: index==15 ? 0 : 10,
                  ),
                  child: PhysicalModel(
                    elevation: 4,
                    color: (index==_currentPage) ? Colors.blue : Colors.red,
                    borderRadius: BorderRadius.circular(12),
                    child: Center(child: Text(index.toString()))
                  )
                )
              );
            }
          )
        ))
      )
    );
  }
}

i need to end up with something like this.
the final result i need

thank you so much.


问:
Why I am getting the wrong location after computing sift for a manually selected point?
My python code below computes the keypoint for an input point using sift, but I'm not getting the correct location of the point after computing the key point. Could you help me figure out what's wrong?

point = [2337.07139369, 1132.20814732]
key_point = np.floor(point.astype(int)
sift = cv2.SIFT_create(1)
#images shape : (4096, 3008)
kp, des = sift.detectAndCompute(image, None, key_point)
```
<p>I am trying to plot this below code, but the wrong coordinate I am taking while I am expecting it to be the exact same location as the input point.</p>
```coord =kp.pt
plt.imshow(image)
plt.scatter(coord[0],coord[1], s=2, c="r")
```

Body:
My python code below computes the keypoint for an input point using sift, but I'm not getting the correct location of the point after computing the key point. Could you help me figure out what's wrong?

point = [2337.07139369, 1132.20814732]
key_point = np.floor(point.astype(int)
sift = cv2.SIFT_create(1)
#images shape : (4096, 3008)
kp, des = sift.detectAndCompute(image, None, key_point)

I am trying to plot this below code, but the wrong coordinate I am taking while I am expecting it to be the exact same location as the input point.

coord =kp.pt
plt.imshow(image)
plt.scatter(coord[0],coord[1], s=2, c="r")


问:
print nothing after cursor of mysqldb
```<code>import pymysql
import MySQLdb
import MySQLdb.cursors
host="localhost"
user="nicola"
password="xxxxxx"
db="dbjud2"

conn = pymysql.connect(host=host,
            user=user,
            password=password,
            db=db,
            cursorclass=MySQLdb.cursors.DictCursor)

cursor = conn.cursor()
print(cursor)
cursor.execute("select * from annotation_web_server")
print("after cursor")
annotations = cursor.fetchall()
print("le annotazioni sono ",annotations)
</code>```

This script simply execute a select.

My problem is that cursor seems not excute select query. It print nothing! In other words "after cursor" isn't print. Why?

Title: print nothing after cursor of mysqldb

Body:
import pymysql
import MySQLdb
import MySQLdb.cursors
host="localhost"
user="nicola"
password="xxxxxx"
db="dbjud2"

conn = pymysql.connect(host=host,
            user=user,
            password=password,
            db=db,
            cursorclass=MySQLdb.cursors.DictCursor)

cursor = conn.cursor()
print(cursor)
cursor.execute("select * from annotation_web_server")
print("after cursor")
annotations = cursor.fetchall()
print("le annotazioni sono ",annotations)

This script simply execute a select.

My problem is that cursor seems not excute select query. It print nothing! In other words "after cursor" isn't print. Why?


问:
Unamed columns in excel imported file
I imported a file ising QA= pd.read_excel("/.../.../QA.xlsx",sheet_name='data',engine='openpyxl')
Yet I am getting an output in python with unnamed columns (Unnamed 0, Unnamed 1,...) and values where there should not be. I would note that the format of the file is very special including filters and column structure. For that you may find a screenshot of it:

Title: Unamed columns in excel imported file


问:
Bubble Sort Average Case performane takes longer than Worst Case?
BUBBLE SORT METHOD

```<code>public String bubbleSortCalc (float[] arr) {
 float[] b = deepCopy(arr);
 long start = System.nanoTime();
 boolean turnOn = false;
 do {
  turnOn = false;
  for (int i = 0; i < b.length - 1; i++) {
    if (b[i] > b[i + 1]) {
     swap(b, i, i + 1);
     turnOn = true;
    }
   }
  } while (turnOn);
 long end = System.nanoTime();

 return end - start + "ns";
}
</code>```

INPUT ARRAY
Element: Random float values | Length = 100 | Try: 3 times

BEST CASE
AVERAGE
WORST CASE

9300ns
316900ns
830800ns

6000ns
477300ns
684800ns

21000ns
1252800ns
1079600ns

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

I just don't understand how average case sometimes takes longer time than worst case.  Thank you for answering my question!

I've tried with length 1000, 10000, 100000 also. I expected average case to be faster than worst case. Maybe something got in the way. And I tried to search for the answer but didn't find any hint.

Body:
BUBBLE SORT METHOD

public String bubbleSortCalc (float[] arr) {
 float[] b = deepCopy(arr);
 long start = System.nanoTime();
 boolean turnOn = false;
 do {
  turnOn = false;
  for (int i = 0; i  b[i + 1]) {
     swap(b, i, i + 1);
     turnOn = true;
    }
   }
  } while (turnOn);
 long end = System.nanoTime();

 return end - start + "ns";
}

INPUT ARRAY
Element: Random float values | Length = 100 | Try: 3 times

BEST CASE
AVERAGE
WORST CASE

9300ns
316900ns
830800ns

6000ns
477300ns
684800ns

21000ns
1252800ns
1079600ns

I just don't understand how average case sometimes takes longer time than worst case.  Thank you for answering my question!

I've tried with length 1000, 10000, 100000 also. I expected average case to be faster than worst case. Maybe something got in the way. And I tried to search for the answer but didn't find any hint.


问:
Objects passed to React Native via native module callback parameters in Swift are null
I am successfully calling a JavaScript callback in a Swift native module in React Native. I need to pass data from the Native side back to React Native, but when the data is anything other than strings or numbers, the data parameter in the callback is null. I need to pass back an array of objects as a parameter but for testing purposes I have created an instance of a Swift class:

    func displayProviderDialog(_ mvpds: [Any]) {

        class City: NSObject {
            var name: String = "TEST STRING"
        }

        var city = City();

        rNCallbacks.displayProviderDialogCallback([mvpds, city])
    }
```
<p>The in Typescript on the React Native side:</p>
```export function displayProviderDialog(MVPDs: unknown[], city: any) {
    console.log(`${JSON.stringify(MVPDs)} >>>>>>>>>>>>> ${JSON.stringify(city)}}`
    );
}
```

Both MVPDs and city are null in React Native, but are not null in Swift / Xcode.

How can I pass back arrays and objects from Swift native modules to React Native?

Body:
I am successfully calling a JavaScript callback in a Swift native module in React Native. I need to pass data from the Native side back to React Native, but when the data is anything other than strings or numbers, the data parameter in the callback is null. I need to pass back an array of objects as a parameter but for testing purposes I have created an instance of a Swift class:

    func displayProviderDialog(_ mvpds: [Any]) {

        class City: NSObject {
            var name: String = "TEST STRING"
        }

        var city = City();

        rNCallbacks.displayProviderDialogCallback([mvpds, city])
    }

The in Typescript on the React Native side:

export function displayProviderDialog(MVPDs: unknown[], city: any) {
    console.log(`${JSON.stringify(MVPDs)} >>>>>>>>>>>>> ${JSON.stringify(city)}}`
    );
}

Both MVPDs and city are null in React Native, but are not null in Swift / Xcode.

How can I pass back arrays and objects from Swift native modules to React Native?


问:
VBA: dynamic value, last row, first col
I don’t know the correct syntax to dynamically extract a value from the first column in the last row of a table’s .

I need to add a new row at the end of my table and have that new row’s cell’s first column = to +1 from the previous row’s first cell in the first column.

Sub Add_NextNumber

Dim LRow As Long
Dim FirstColumn As Long
Dim No As Variant

LRow = Range(“A3”).End(xlDown).Row + 1

FirstColumn = Range(“A3”).End(xlToLeft).Column

No = Range(“A1231”) + 1 ‘here is my problem of selecting this last cell dynamically

Cells(LRow, FirstColumn).Value = No

End Sub
```

Title: VBA: dynamic value, last row, first col


问:
GraphQL dynamic page API call
So I am building a dynamic lesson page with GraphQl and React.

I built a custom hook, and I do not know how to pass the ID up to the config data.

This is my hook that I made.

This is my first time working with GraphQL

```<code>import axios from 'axios'
import { useState, useEffect } from 'react'

const { REACT_APP_SPACE_ID, REACT_APP_CDA_TOKEN } = process.env

var data = JSON.stringify({
  query: `{
    lesson(id: ${id}){
      shortTitle
      shortDescription
    }
  }`,
  variables: {},
})

var config = {
  method: 'post',
  url: `https://graphql.contentful.com/content/v1/spaces/${REACT_APP_SPACE_ID}`,
  headers: {
    Authorization: `Bearer ${REACT_APP_CDA_TOKEN}`,
    'Content-Type': 'application/json',
  },
  data: data,
}

export default function GetLesson(id) {
  let [data, setData] = useState()

  useEffect(() => {
    getContent()
  }, [])

  const getContent = async () => {
    await axios(config)
      .then(function (response) {
        setData(response.data.data.lesson)
      })
      .catch(function (error) {
        console.log(error)
      })
  }
  return { data }
}
</code>```

Title: GraphQL dynamic page API call

Body:
So I am building a dynamic lesson page with GraphQl and React.

I built a custom hook, and I do not know how to pass the ID up to the config data.

This is my hook that I made.

This is my first time working with GraphQL

import axios from 'axios'
import { useState, useEffect } from 'react'

const { REACT_APP_SPACE_ID, REACT_APP_CDA_TOKEN } = process.env

var data = JSON.stringify({
  query: `{
    lesson(id: ${id}){
      shortTitle
      shortDescription
    }
  }`,
  variables: {},
})

var config = {
  method: 'post',
  url: `https://graphql.contentful.com/content/v1/spaces/${REACT_APP_SPACE_ID}`,
  headers: {
    Authorization: `Bearer ${REACT_APP_CDA_TOKEN}`,
    'Content-Type': 'application/json',
  },
  data: data,
}

export default function GetLesson(id) {
  let [data, setData] = useState()

  useEffect(() => {
    getContent()
  }, [])

  const getContent = async () => {
    await axios(config)
      .then(function (response) {
        setData(response.data.data.lesson)
      })
      .catch(function (error) {
        console.log(error)
      })
  }
  return { data }
}