问:
Unable to construct React.useState on a .json within a Typescript type in a Material UI Dialog
I am looking to create a dialog modal that can edit the permissions of a given organization, but I think I'm missing a key point of logic or something else. I'm using Material UI Checkbox to toggle permissions as a Boolean on and off.
My types are defined as follows:

```<code>export type Organization = {
    name: String,
    email: String,
    added: Date,
    admin: String,
    permissions: AdminPermissions
}

export type AdminPermissions = {
    permission_a: Boolean,
    permission_b: Boolean,
    permission_c: Boolean
}
</code>```

And here is how the dialog modal is set up at the moment

```<code>interface EditOrganizationDialogProps {
    open: boolean,
    closeHandler: () => void,
    organization: Organization,
}

export default function EditOrganizationDialog(props: EditOrganizationDialogProps) {
    const permissionsList = props.organization.permissions;

    const { open, closeHandler, organization } = props;

    const [permissions, setPermissions] = React.useState([]);

    const permissionChangeHandler = (event: React.ChangeEvent<HTMLInputElement>) => {

        setPermissions(event.currentTarget);

    };

    return (
        <Dialog open={open} onClose={closeHandler}>

            <DialogTitle>
                {'Edit organization permissions'}
            </DialogTitle>

            <DialogContent dividers>
                <FormGroup>
                    {permissionsList.map(()=> (
                    <FormControlLabel control={<Checkbox/>}
                        onChange={permissionChangeHandler}
                        value={permissions}label="Permission A">
                    </FormControlLabel>
                    ))}
                </FormGroup>
            </DialogContent>

            <DialogActions>
                <Button
                onClick={closeHandler}
                type='submit'>
                    {'Save'}
                </Button>
                <Button onClick={closeHandler}>
                    {'Cancel'}
                </Button>
            </DialogActions>

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

The map and useState I know are wrong, but even the change handler isn't liking the typing. I tend to overdevelop my code when something isn't working, so what steps might I be forgetting that would resolve this?

I have tried the useState as both a json object and an array, with differing errors. I want to be able to map the permissions so that when they change in the future, I won't have to adjust this modal. I have seen other questions similar to this, but none involving Checkbox(Boolean) logic.

Body:
I am looking to create a dialog modal that can edit the permissions of a given organization, but I think I'm missing a key point of logic or something else. I'm using Material UI Checkbox to toggle permissions as a Boolean on and off.
My types are defined as follows:

export type Organization = {
    name: String,
    email: String,
    added: Date,
    admin: String,
    permissions: AdminPermissions
}

export type AdminPermissions = {
    permission_a: Boolean,
    permission_b: Boolean,
    permission_c: Boolean
}

And here is how the dialog modal is set up at the moment

interface EditOrganizationDialogProps {
    open: boolean,
    closeHandler: () => void,
    organization: Organization,
}

export default function EditOrganizationDialog(props: EditOrganizationDialogProps) {
    const permissionsList = props.organization.permissions;

    const { open, closeHandler, organization } = props;

    const [permissions, setPermissions] = React.useState([]);

    const permissionChangeHandler = (event: React.ChangeEvent<HTMLInputElement>) => {

        setPermissions(event.currentTarget);

    };

    return (
        <Dialog open={open} onClose={closeHandler}>

            <DialogTitle>
                {'Edit organization permissions'}
            </DialogTitle>

            <DialogContent dividers>
                <FormGroup>
                    {permissionsList.map(()=> (
                    <FormControlLabel control={<Checkbox/>}
                        onChange={permissionChangeHandler}
                        value={permissions}label="Permission A">
                    </FormControlLabel>
                    ))}
                </FormGroup>
            </DialogContent>

            <DialogActions>
                <Button
                onClick={closeHandler}
                type='submit'>
                    {'Save'}
                </Button>
                <Button onClick={closeHandler}>
                    {'Cancel'}
                </Button>
            </DialogActions>

        </Dialog>
    );
}

The map and useState I know are wrong, but even the change handler isn't liking the typing. I tend to overdevelop my code when something isn't working, so what steps might I be forgetting that would resolve this?

I have tried the useState as both a json object and an array, with differing errors. I want to be able to map the permissions so that when they change in the future, I won't have to adjust this modal. I have seen other questions similar to this, but none involving Checkbox(Boolean) logic.


来源: stackexchange

问:
Traefik. Embedding plugins beforehand to avoid on-startup compiling
I like the idea of Traefik plugins, but I'm not sure that downloading dependencies and compiling plugins on every Traefik startup is a good idea.

Are there any way to embed plugins beforehand, so Traefik will download and compile nothing on startup.

I know there is always a way to fork traefik repo and add whatever you want but I want to avoid it if possible.

ContentLicense: CC BY-SA 4.0


问:
Object import in Next.JS /api folder is undefined
I am trying to import an object from a separate file in the Next.JS pages/api folder.
Importing the schema object works perfectly fine inside any of .tsx files for the client.
However, importing the schema using the same import statement in the /api folder results in a TypeError.

```<code>TypeError: Cannot read properties of undefined (reading 'safeParse')
</code>```

./types/message.ts

import { z } from 'zod';

export default interface Message {
  name: string;
  email: string;
  subject: string;
  message: string;
}

export const schema = z.object({
  name: z.string(),
  email: z.string().email(),
  subject: z.string(),
  message: z.string(),
});
```
<p><code>/pages/form.tsx</code></p>
```...
import Message, { schema } from '@/types/message';
const { register, handleSubmit} = useForm({
    resolver: zodResolver(schema),
  });
...
```
<p><code>./pages/api/sendMessage.ts</code></p>
<pre class="lang-js prettyprint-override"><code>...
import Message, { schema } from '@/types/message';

...
// The TypeError is thrown when this line is executed.
const response = schema.safeParse(req.body);
...
</code>```

I have also tried importing the schema object using require without any success.

Copying the schema definition into the sendMessage file fixes the error. To avoid code duplication, I would, however, prefer to keep the schema definition in a separate file.

./pages/api/sendMessage.ts

import { z } from 'zod';
...
const schema = z.object({
  name: z.string(),
  email: z.string().email(),
  subject: z.string(),
  message: z.string(),
});
...
```

Body:
I am trying to import an object from a separate file in the Next.JS pages/api folder.
Importing the schema object works perfectly fine inside any of .tsx files for the client.
However, importing the schema using the same import statement in the /api folder results in a TypeError.

TypeError: Cannot read properties of undefined (reading 'safeParse')

./types/message.ts

import { z } from 'zod';

export default interface Message {
  name: string;
  email: string;
  subject: string;
  message: string;
}

export const schema = z.object({
  name: z.string(),
  email: z.string().email(),
  subject: z.string(),
  message: z.string(),
});

/pages/form.tsx

...
import Message, { schema } from '@/types/message';
const { register, handleSubmit} = useForm({
    resolver: zodResolver(schema),
  });
...

./pages/api/sendMessage.ts

...
import Message, { schema } from '@/types/message';

...
// The TypeError is thrown when this line is executed.
const response = schema.safeParse(req.body);
...

I have also tried importing the schema object using require without any success.

Copying the schema definition into the sendMessage file fixes the error. To avoid code duplication, I would, however, prefer to keep the schema definition in a separate file.

./pages/api/sendMessage.ts

import { z } from 'zod';
...
const schema = z.object({
  name: z.string(),
  email: z.string().email(),
  subject: z.string(),
  message: z.string(),
});
...


问:
IAM Identity of AWS glue job - AccessDenied Exception
I have a glue job that reads data from glue catalog table, and writes it back into s3 in Delta format.

IAM role of the glue job has s3:PutObject, List, Describe and all other permissions needed to interact with s3 (read and write). However, I keep running into the error -

2022-12-14 13:48:09,274 ERROR [Thread-9] output.FileOutputCommitter (FileOutputCommitter.java:setupJob(360)): Mkdirs failed to create glue-d-xxx-data-catalog-t--m-w:///_temporary/0

2022-12-14 13:48:13,875 WARN [task-result-getter-2] scheduler.TaskSetManager (Logging.scala:logWarning(73)): Lost task 5.0 in stage 1.0 (TID 6) (172.34.113.239 executor 2): java.io.IOException: com.amazon.ws.emr.hadoop.fs.shaded.com.amazonaws.services.s3.model.AmazonS3Exception: >
Access Denied (Service: Amazon S3; Status Code: 403; Error Code: AccessDenied; Request ID: HG7ST1B44A6G30JC; S3 Extended Request ID: tR1CgoC1RcXZHEEZZ1DuDOvwIAmqC0+flXRd1ccdsY3C8PyjkEpS4wHDaosFoKpRskfH1Del/NA=; Proxy: null)

This error does not appear when I open up s3 bucket access with wildcard(principal:*) in the s3 bucket permissions section. Job fails even if I change the principal section to the same role as Glue jobs are associated with.

Now, my question is - is there a different identify that AWS Glue assumes to run the job. The IAM role associated with the job has all the permissions to interact with s3 but it throws above AccessDenied exception ( failed to create directory). However, job succeeds with wildcard(*) on s3 permissions.

Just to add some more context - this error does not happen when I am using native glue constructs like dynamic frame, spark data frame to read, process and persist data into s3. It only happens with delta format.

Below is the samplec code

```<code>src_dyf = glueContext.create_dynamic_frame.from_catalog(database="<db_name>", table_name="<>table_name_glue_catalog")
dset_df = src_dyf.toDF() # dynamic frame to dta frame conversion

# write data frame into s3 prefix in delta format.
glueContext.write_data_frame_from_catalog(
    frame=dset_df,
    database="xxx_data_catalog",
    table_name="<tbale_name>",
    additional_options=additional_options  #contains key-value pair of s3 path with key, path
)
</code>```

Body:
I have a glue job that reads data from glue catalog table, and writes it back into s3 in Delta format.

IAM role of the glue job has s3:PutObject, List, Describe and all other permissions needed to interact with s3 (read and write). However, I keep running into the error -

2022-12-14 13:48:09,274 ERROR [Thread-9] output.FileOutputCommitter (FileOutputCommitter.java:setupJob(360)): Mkdirs failed to create glue-d-xxx-data-catalog-t--m-w:///_temporary/0

2022-12-14 13:48:13,875 WARN [task-result-getter-2] scheduler.TaskSetManager (Logging.scala:logWarning(73)): Lost task 5.0 in stage 1.0 (TID 6) (172.34.113.239 executor 2): java.io.IOException: com.amazon.ws.emr.hadoop.fs.shaded.com.amazonaws.services.s3.model.AmazonS3Exception: >
Access Denied (Service: Amazon S3; Status Code: 403; Error Code: AccessDenied; Request ID: HG7ST1B44A6G30JC; S3 Extended Request ID: tR1CgoC1RcXZHEEZZ1DuDOvwIAmqC0+flXRd1ccdsY3C8PyjkEpS4wHDaosFoKpRskfH1Del/NA=; Proxy: null)

This error does not appear when I open up s3 bucket access with wildcard(principal:*) in the s3 bucket permissions section. Job fails even if I change the principal section to the same role as Glue jobs are associated with.

Now, my question is - is there a different identify that AWS Glue assumes to run the job. The IAM role associated with the job has all the permissions to interact with s3 but it throws above AccessDenied exception ( failed to create directory). However, job succeeds with wildcard(*) on s3 permissions.

Just to add some more context - this error does not happen when I am using native glue constructs like dynamic frame, spark data frame to read, process and persist data into s3. It only happens with delta format.

Below is the samplec code

src_dyf = glueContext.create_dynamic_frame.from_catalog(database="<db_name>", table_name="<>table_name_glue_catalog")
dset_df = src_dyf.toDF() # dynamic frame to dta frame conversion

# write data frame into s3 prefix in delta format.
glueContext.write_data_frame_from_catalog(
    frame=dset_df,
    database="xxx_data_catalog",
    table_name="<tbale_name>",
    additional_options=additional_options  #contains key-value pair of s3 path with key, path
)


问:
$elemMatch with $in SpringData Mongo Query
I am in the process of attempting to create a method that will compose a query using Spring Data and I have a couple of questions. I am trying to perform a query using top level attributes of a document (i.e. the id field) as well as attributes of an subarray.

To do so I am using a query similar to this:

db.getCollection("journeys").find({ "_id._id": "0104", "journeyDates": { $elemMatch: { "period": { $in: [ 1,2 ] } } } })
```
<p>As you can see I would also like to filter using <code>$in</code> for the values of the subarray. Running the above query though result in wrong results, as if the <code>$elemMatch</code> is ignored completely.</p>
<p>Running a similiar but slightly different query like this:</p>
<pre class="lang-java prettyprint-override"><code>db.getCollection("journeys").find({ "_id._id": { $in: [ "0104" ] } }, { journeyDates: { $elemMatch: { period: { $in: [ 1, 2 ] } } } })
</code>```

does seem to yield better results but it returns the only first found element matching the $in of the subarray filter.

Now my question is, how can I query using both top level attributes as well subarrays using $in. Preferably I would like to avoid aggregations. Secondly, how can I translate this native Mongo query to a Spring data Query object?

Body:
I am in the process of attempting to create a method that will compose a query using Spring Data and I have a couple of questions. I am trying to perform a query using top level attributes of a document (i.e. the id field) as well as attributes of an subarray.

To do so I am using a query similar to this:

db.getCollection("journeys").find({ "_id._id": "0104", "journeyDates": { $elemMatch: { "period": { $in: [ 1,2 ] } } } })

As you can see I would also like to filter using $in for the values of the subarray. Running the above query though result in wrong results, as if the $elemMatch is ignored completely.

Running a similiar but slightly different query like this:

db.getCollection("journeys").find({ "_id._id": { $in: [ "0104" ] } }, { journeyDates: { $elemMatch: { period: { $in: [ 1, 2 ] } } } })

does seem to yield better results but it returns the only first found element matching the $in of the subarray filter.

Now my question is, how can I query using both top level attributes as well subarrays using $in. Preferably I would like to avoid aggregations. Secondly, how can I translate this native Mongo query to a Spring data Query object?


问:
Error Occuring when using LEFT / MID Functions to Isolate Numbers
I am using the LEFT and MID functions on the following Cells to isolate the number for comparison.

"3 Month" -> LEFT(A1,1) -> 3

"R2S: 10 Month" -> MID(A2,6,2) -> 10

The problem is, when I compare these two resulting numbers it does not work. A simple IF(A1<A2,,) is returning as false. What am I doing wrong here?


问:
moving nav on sides in owl carousel 2 angular 14
I created a slideshow with Angular 14. This is what it currently looks like.

I want to accomplish two things:

How can I place the arrows on the right and left instead of at the bottom?

How can I reduce the gap between the elements, while still showing the same amount of elements?

I managed to reduce the spacing between elements, but this resulted in a larger number of elements being displayed at the same time. How can I specify the number of displayed elements while still maintaining the desired spacing?

I tried to decrease the width of each item and then also the width of the container. Sadly, it didn't work, the images were streched. I also copied some css classes that I found on stackoverflow, but it didn't work either.

My HTML-code:

```<code><owl-carousel-o [options]="customOptions">
  <ng-container *ngFor="let slide of cards">
    <ng-template carouselSlide [id]="slide.id">
      <button>
        <img [src]="slide.icon" />
      </button>
    </ng-template>
  </ng-container>
</owl-carousel-o>

</code>```

My TS-code:

```<code>customOptions: OwlOptions = {
   loop: false,
   autoWidth:true,
   items:16,
   slideBy:16,
   fluidSpeed:true,
   mouseDrag: false,
   touchDrag: false,
   pullDrag: false,
   dots: false,
   navSpeed: 100,
   navText: ['&#8249', '›'],
   nav: true
 }
</code>```

Body:
I created a slideshow with Angular 14. This is what it currently looks like.

I want to accomplish two things:

How can I place the arrows on the right and left instead of at the bottom?

How can I reduce the gap between the elements, while still showing the same amount of elements?

I managed to reduce the spacing between elements, but this resulted in a larger number of elements being displayed at the same time. How can I specify the number of displayed elements while still maintaining the desired spacing?

I tried to decrease the width of each item and then also the width of the container. Sadly, it didn't work, the images were streched. I also copied some css classes that I found on stackoverflow, but it didn't work either.

My HTML-code:

<owl-carousel-o [options]="customOptions">
  <ng-container *ngFor="let slide of cards">
    <ng-template carouselSlide [id]="slide.id">
      <button>

      </button>
    </ng-template>
  </ng-container>
</owl-carousel-o>

My TS-code:

customOptions: OwlOptions = {
   loop: false,
   autoWidth:true,
   items:16,
   slideBy:16,
   fluidSpeed:true,
   mouseDrag: false,
   touchDrag: false,
   pullDrag: false,
   dots: false,
   navSpeed: 100,
   navText: ['&#8249', '›'],
   nav: true
 }


问:
?How can I mock a manual redirect using python requests_mock?
I have a function where I'm doing a http request to a site that should do an automatic redirect but I'm doing this manually using allow_redirects=False. I have the function itself working something like this:

```<code>def make_redirect_request(self):
    url = https://some.url.com
    response = requests.get(url, headers={"header": "some header"}, status_code=302, allow_redirects=False)
    redirected_response = requests.get(response.next.url, headers={"header": "some other header"}, status_code=200)
    self.publish(redirected_response.content) # some publishing function for publishing content on page
</code>```

This works as I would like it to, but I'm struggling to make a unittest that checks this correctly. I have tried something like this:

```<code>@unittest.mock.patch("publish")
@unittest.mock.patch("url", "mock_url")
    def test_redirect_url(self, mock_publish):
        with patch('requests.get', self.session.get) #predefined session with parameters I don't use in this function
           mock_response = b"some byte response"
           next_url = "mock_redirected_url"
           self.adapter.register_uri("GET", "mock_url", status_code=302, allow_redirects=False, next=next_url)
#I want the next parameter to give me the url that I'm being redirected to, which is given by response.next.url in the actual function, but this doesn't work here and it also doesn't understand the allow_redirects parameter
           self.adapter.register_uri("GET", next_url, content=mock_response, status_code=200)
           self.session.mount("mock", self.adapter)
           self.make_redirect_request()
           mock_publish.assert_called_once()
</code>```

I'm not sure how to get the first request to pass the url given by response.next.url to the second request, as the adapter doesn't seem to take the next and allows_redirects arguments.

Body:
I have a function where I'm doing a http request to a site that should do an automatic redirect but I'm doing this manually using allow_redirects=False. I have the function itself working something like this:

def make_redirect_request(self):
    url = https://some.url.com
    response = requests.get(url, headers={"header": "some header"}, status_code=302, allow_redirects=False)
    redirected_response = requests.get(response.next.url, headers={"header": "some other header"}, status_code=200)
    self.publish(redirected_response.content) # some publishing function for publishing content on page

This works as I would like it to, but I'm struggling to make a unittest that checks this correctly. I have tried something like this:

@unittest.mock.patch("publish")
@unittest.mock.patch("url", "mock_url")
    def test_redirect_url(self, mock_publish):
        with patch('requests.get', self.session.get) #predefined session with parameters I don't use in this function
           mock_response = b"some byte response"
           next_url = "mock_redirected_url"
           self.adapter.register_uri("GET", "mock_url", status_code=302, allow_redirects=False, next=next_url)
#I want the next parameter to give me the url that I'm being redirected to, which is given by response.next.url in the actual function, but this doesn't work here and it also doesn't understand the allow_redirects parameter
           self.adapter.register_uri("GET", next_url, content=mock_response, status_code=200)
           self.session.mount("mock", self.adapter)
           self.make_redirect_request()
           mock_publish.assert_called_once()

I'm not sure how to get the first request to pass the url given by response.next.url to the second request, as the adapter doesn't seem to take the next and allows_redirects arguments.


问:
Decimals on x axis in data breaks chart.js scatter
I have a chart made with chart.js, it works perfectly except when I pass data with decimals on x, for example:
0:
{x: 9.8, y: 746.0236183946838}
1:
{x: 10.8, y: 787.3400989688439}
2:
{x: 11.8, y: 826.9850534238384}

the same example but with, 10, 11 and 12, works fine, so I dont know where the problem may be as I assumed it should work as long as the data is passed, this is the code I have:

```<code>          var ctx = document.getElementById("myChart").getContext("2d");

          var myChart = new Chart(ctx, {
            type: 'scatter',
            data: {
              datasets: [{
                label: 'Points',
                borderColor: window.chartColors.purple,
                borderWidth: 2,
                fill: false,
                data: storage,
                backgroundColor: window.chartColors.purple,
              }
            ]
            },

              title: {
                display: false,
                text: 'Despressuration Chart',
                fontSize: 18
              },
              events: ['click'],
              tooltips: {
                mode: 'index',
                intersect: true
              },
              hover: {
                mode: 'index',
                intersect: true
              },
              elements: {
                line: {
                    tension: 0 // disables bezier curves
                }
              },
                scales: {
                    yAxes: [{
                        display: true,
                        scaleLabel: {
                            display: true,
                            labelString: 'Flow (Ft3/Min)'
                        },
                        ticks: {
                            suggestedMin: 0,    // minimum will be 0, unless there is a lower value.
                            suggestedMax: yPoints[length] + 80,
                            beginAtZero: true   // minimum value will be 0.
                        }
                    }],
                    xAxes: [{
                        display: true,
                        scaleLabel: {
                            display: true,
                            labelString: 'Induced Pressure (Pa)'
                        },
                        ticks: {
                            suggestedMin: 0,    // minimum will be 0, unless there is a lower value.
                            suggestedMax: xPoints[xLength] + 10,//Math.round(xPoints[xLength]) + 10,
                            beginAtZero: true   // minimum value will be 0.
                        }
                    }]
                }
            }
          });
        }
</code>```

storage comes from an array I calculated previously, and it works fine, the problem here its only with showing the data, but the data itself is correct

I have tried giving it stepSize: 5, precision: 0,but neither of those worked, I also dont want to round the numbers from storage. Thanks in advice.

Body:
I have a chart made with chart.js, it works perfectly except when I pass data with decimals on x, for example:
0:
{x: 9.8, y: 746.0236183946838}
1:
{x: 10.8, y: 787.3400989688439}
2:
{x: 11.8, y: 826.9850534238384}

the same example but with, 10, 11 and 12, works fine, so I dont know where the problem may be as I assumed it should work as long as the data is passed, this is the code I have:

          var ctx = document.getElementById("myChart").getContext("2d");

          var myChart = new Chart(ctx, {
            type: 'scatter',
            data: {
              datasets: [{
                label: 'Points',
                borderColor: window.chartColors.purple,
                borderWidth: 2,
                fill: false,
                data: storage,
                backgroundColor: window.chartColors.purple,
              }
            ]
            },

              title: {
                display: false,
                text: 'Despressuration Chart',
                fontSize: 18
              },
              events: ['click'],
              tooltips: {
                mode: 'index',
                intersect: true
              },
              hover: {
                mode: 'index',
                intersect: true
              },
              elements: {
                line: {
                    tension: 0 // disables bezier curves
                }
              },
                scales: {
                    yAxes: [{
                        display: true,
                        scaleLabel: {
                            display: true,
                            labelString: 'Flow (Ft3/Min)'
                        },
                        ticks: {
                            suggestedMin: 0,    // minimum will be 0, unless there is a lower value.
                            suggestedMax: yPoints[length] + 80,
                            beginAtZero: true   // minimum value will be 0.
                        }
                    }],
                    xAxes: [{
                        display: true,
                        scaleLabel: {
                            display: true,
                            labelString: 'Induced Pressure (Pa)'
                        },
                        ticks: {
                            suggestedMin: 0,    // minimum will be 0, unless there is a lower value.
                            suggestedMax: xPoints[xLength] + 10,//Math.round(xPoints[xLength]) + 10,
                            beginAtZero: true   // minimum value will be 0.
                        }
                    }]
                }
            }
          });
        }

storage comes from an array I calculated previously, and it works fine, the problem here its only with showing the data, but the data itself is correct

I have tried giving it stepSize: 5, precision: 0,but neither of those worked, I also dont want to round the numbers from storage. Thanks in advice.


问:
Spotipy can't see a previously set environment variable
Whenever i'm trying to run a code using spotipy package an error "No client_id. Pass it or set a SPOTIPY_CLIENT_ID environment variable." appears. I've set this variable to desired value and can call it using an echo function. I've tried to set it using an administrator command prompt and nothing changed.

I've set the variable using a self standing cmd, as well as in PyCharm, same results. When i run my program "No client id" error pops up but when i call echo function right after that i can see that the variable is set. I've tried passing it in powershell using $env:SPOTIFY_CLIENT_ID="XXXX", but still nothing.


问:
HybridWebView EvaluateJS not working for Android Xamarin
I am trying to load a web url in my app which is a login page. On entering the details and after authentication it is supposed to return a token . I have used EvaluateJavascript property in HybridWebView . This is working completely fine in iOS , whereas in Android , after the login process it throws 404 error suddenly for the past few days. All the code is same except for the renderers.I do not have a custom control instead have created the ContentViews for hybridwebview as it is prism Template.

Does anyone know/have any solution for this?

Android HybridWebViewRenderer.cs file

```<code>public class HybridWebViewRenderer : WebViewRenderer //ViewRenderer<HybridWebView, Android.Webkit.WebView>
{
    protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.WebView> e)
    {
        base.OnElementChanged(e);

        var webView = e.NewElement as HybridWebView;
        if (webView != null)
        {
            webView.EvaluateJavascript = async (js) =>
            {
                var reset = new ManualResetEvent(false);
                var response = string.Empty;
                Device.BeginInvokeOnMainThread(() =>
                {
                    Control?.EvaluateJavascript(js, new JavascriptCallback((r) => { response = r; reset.Set(); }));
                });
                await Task.Run(() => { reset.WaitOne(); });
                return response;
            };
        }
    }
}

internal class JavascriptCallback : Java.Lang.Object, IValueCallback
{
    public JavascriptCallback(Action<string> callback)
    {
        _callback = callback;
    }

    private Action<string> _callback;
    public void OnReceiveValue(Java.Lang.Object value)
    {
        _callback?.Invoke(Convert.ToString(value));
    }
}
</code>```

In VM :
I have declared EvaluateJavascript

```<code>String innerHtml = await EvaluateJavascript("document.body.innerHTML");
</code>```

HybridWebView Content View :

```<code>public static readonly BindableProperty EvaluateJavascriptProperty =
            BindableProperty.Create(nameof(EvaluateJavascript),
                typeof(Func<string, Task<string>>),
                typeof(HybridWebView),
                null,
                BindingMode.OneWayToSource);

        public Func<string, Task<string>> EvaluateJavascript
        {
            get { return (Func<string, Task<string>>)GetValue(EvaluateJavascriptProperty); }
            set { SetValue(EvaluateJavascriptProperty, value); }
        }
</code>```

Body:
I am trying to load a web url in my app which is a login page. On entering the details and after authentication it is supposed to return a token . I have used EvaluateJavascript property in HybridWebView . This is working completely fine in iOS , whereas in Android , after the login process it throws 404 error suddenly for the past few days. All the code is same except for the renderers.I do not have a custom control instead have created the ContentViews for hybridwebview as it is prism Template.

Does anyone know/have any solution for this?

Android HybridWebViewRenderer.cs file

public class HybridWebViewRenderer : WebViewRenderer //ViewRenderer<HybridWebView, Android.Webkit.WebView>
{
    protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.WebView> e)
    {
        base.OnElementChanged(e);

        var webView = e.NewElement as HybridWebView;
        if (webView != null)
        {
            webView.EvaluateJavascript = async (js) =>
            {
                var reset = new ManualResetEvent(false);
                var response = string.Empty;
                Device.BeginInvokeOnMainThread(() =>
                {
                    Control?.EvaluateJavascript(js, new JavascriptCallback((r) => { response = r; reset.Set(); }));
                });
                await Task.Run(() => { reset.WaitOne(); });
                return response;
            };
        }
    }
}

internal class JavascriptCallback : Java.Lang.Object, IValueCallback
{
    public JavascriptCallback(Action<string> callback)
    {
        _callback = callback;
    }

    private Action<string> _callback;
    public void OnReceiveValue(Java.Lang.Object value)
    {
        _callback?.Invoke(Convert.ToString(value));
    }
}

In VM :
I have declared EvaluateJavascript

String innerHtml = await EvaluateJavascript("document.body.innerHTML");

HybridWebView Content View :

public static readonly BindableProperty EvaluateJavascriptProperty =
            BindableProperty.Create(nameof(EvaluateJavascript),
                typeof(Func<string, Task<string>>),
                typeof(HybridWebView),
                null,
                BindingMode.OneWayToSource);

        public Func<string, Task<string>> EvaluateJavascript
        {
            get { return (Func<string, Task<string>>)GetValue(EvaluateJavascriptProperty); }
            set { SetValue(EvaluateJavascriptProperty, value); }
        }


问:
eas-cli: how to build with releaseChannel?
I have an environment with API_URL changed depend on releaseChannel

for example in production I want to build with API_URL="https:prod.APPNAME.com".
and for staging : API_URL="https:staging.APPNAME.com".

how can I do that using eas.json

my environment.js:

```<code>import Constants from "expo-constants";
// import {API_URL} from '@env';
import { commonProperties } from "./environments.common";

const dev_URL = "http://10.30.157.214:8080/";

const staging_URL = "https:staging.APPNAME.com";
const production_URL = "https:prod.APPNAME.com";

const environment = {
  production: false,
  dev: {
    apiUrl: dev_URL,
    ...commonProperties,
  },
  staging: {
    apiUrl: staging_URL,
    ...commonProperties,
  },
  prod: {
    apiUrl: production_URL,
    ...commonProperties,
  },
};

const getEnvVars = (env = Constants.manifest!.releaseChannel) => {
  // What is __DEV__ ?
  // This variable is set to true when react-native is running in Dev mode.
  // __DEV__ is true when run locally, but false when published.
  if (__DEV__) {
    return environment.dev;
  } else if (env === "staging") {
    return environment.staging;
  } else if (env === "prod") {
    return environment.prod;
  }
  // return environment.prod;
};

export default getEnvVars;

</code>```

my eas.json:

```<code>{
  "build": {
    "preview": {
      "android": {
        "buildType": "apk"
      }
    },
    "staging": {
      "android": {
        "gradleCommand": ":app:assembleRelease"
      },
      "releaseChannel": "staging"
    },
    "productionTest": {
      "android": {
        "gradleCommand": ":app:assembleRelease"
      },
      "releaseChannel": "prod"
    },
    "production": {
      "autoIncrement": true,
      "releaseChannel": "prod"
    }
  }
}

</code>```

when i use the command: eas build -p android --profile productionTest the build done with Constants.manifest!.releaseChannel undefined.

is there's any solution to this problem?

Body:
I have an environment with API_URL changed depend on releaseChannel

for example in production I want to build with API_URL="https:prod.APPNAME.com".
and for staging : API_URL="https:staging.APPNAME.com".

how can I do that using eas.json

my environment.js:

import Constants from "expo-constants";
// import {API_URL} from '@env';
import { commonProperties } from "./environments.common";

const dev_URL = "http://10.30.157.214:8080/";

const staging_URL = "https:staging.APPNAME.com";
const production_URL = "https:prod.APPNAME.com";

const environment = {
  production: false,
  dev: {
    apiUrl: dev_URL,
    ...commonProperties,
  },
  staging: {
    apiUrl: staging_URL,
    ...commonProperties,
  },
  prod: {
    apiUrl: production_URL,
    ...commonProperties,
  },
};

const getEnvVars = (env = Constants.manifest!.releaseChannel) => {
  // What is __DEV__ ?
  // This variable is set to true when react-native is running in Dev mode.
  // __DEV__ is true when run locally, but false when published.
  if (__DEV__) {
    return environment.dev;
  } else if (env === "staging") {
    return environment.staging;
  } else if (env === "prod") {
    return environment.prod;
  }
  // return environment.prod;
};

export default getEnvVars;

my eas.json:

{
  "build": {
    "preview": {
      "android": {
        "buildType": "apk"
      }
    },
    "staging": {
      "android": {
        "gradleCommand": ":app:assembleRelease"
      },
      "releaseChannel": "staging"
    },
    "productionTest": {
      "android": {
        "gradleCommand": ":app:assembleRelease"
      },
      "releaseChannel": "prod"
    },
    "production": {
      "autoIncrement": true,
      "releaseChannel": "prod"
    }
  }
}

when i use the command: eas build -p android --profile productionTest the build done with Constants.manifest!.releaseChannel undefined.

is there's any solution to this problem?


问:
Not able keep time permanent once i send it into the fields in selenium python
ok so im automating a a couple of fields in the image added. i have everything done but the start time and end time revert back to zero after i put them in.

here is my current code for automating this

`

```<code>def add_meeting_track(self):
    Waiter().wait_timer(3)
    self.driver.find_element(*SummitPage.add_meeting).click()
    Waiter().wait_timer(3)
    self.driver.find_element(*SummitPage.display_name).send_keys("Test01")
    self.driver.find_element(*SummitPage.zoom_webinar_id).send_keys("91516169900")
    s_time = self.driver.find_element(*SummitPage.evt_start_time)
    self.driver.execute_script("arguments[0].value = '09:40:00';", s_time)
    e_time = self.driver.find_element(*SummitPage.evt_end_time)
    self.driver.find_element(*SummitPage.stream_link).send_keys("https://www.youtube.com/watch?v=oqk65aqfJBo")
    self.driver.execute_script("arguments[0].value = '13:00:00';", e_time)
    self.driver.find_element(*SummitPage.track_day).send_keys(1)
    self.driver.find_element(*SummitPage.track).send_keys(1)
</code>```

`

Body:
ok so im automating a a couple of fields in the image added. i have everything done but the start time and end time revert back to zero after i put them in.

here is my current code for automating this

`

def add_meeting_track(self):
    Waiter().wait_timer(3)
    self.driver.find_element(*SummitPage.add_meeting).click()
    Waiter().wait_timer(3)
    self.driver.find_element(*SummitPage.display_name).send_keys("Test01")
    self.driver.find_element(*SummitPage.zoom_webinar_id).send_keys("91516169900")
    s_time = self.driver.find_element(*SummitPage.evt_start_time)
    self.driver.execute_script("arguments[0].value = '09:40:00';", s_time)
    e_time = self.driver.find_element(*SummitPage.evt_end_time)
    self.driver.find_element(*SummitPage.stream_link).send_keys("https://www.youtube.com/watch?v=oqk65aqfJBo")
    self.driver.execute_script("arguments[0].value = '13:00:00';", e_time)
    self.driver.find_element(*SummitPage.track_day).send_keys(1)
    self.driver.find_element(*SummitPage.track).send_keys(1)

`


问:
How to display a model in Swagger-UI that isn't used as an endpoint?
I created a simple API spring boot just with 1 entity, controller and repository, configured swagger-ui then is everything working as expected, then I create just a new entity, and this isn't displayed in swagger-ui. Is there any way to add this to swagger?

```<code>    @Entity
    @Table(name = "Address")
    public class Address {
        @Id
        @GeneratedValue(strategy = GenerationType.IDENTITY)
        @Column(name = "emp_id")
        private Long id;

        @Column(name = "first_name")
        private String firstName;

        @Column(name = "last_name")
        private String lastName;

        @Column(name = "email_id")
        private String emailId;

        public Long getId() {
            return id;
        }
...
</code>```

I would like to add this new entity to Models without a controller.

Body:
I created a simple API spring boot just with 1 entity, controller and repository, configured swagger-ui then is everything working as expected, then I create just a new entity, and this isn't displayed in swagger-ui. Is there any way to add this to swagger?

    @Entity
    @Table(name = "Address")
    public class Address {
        @Id
        @GeneratedValue(strategy = GenerationType.IDENTITY)
        @Column(name = "emp_id")
        private Long id;

        @Column(name = "first_name")
        private String firstName;

        @Column(name = "last_name")
        private String lastName;

        @Column(name = "email_id")
        private String emailId;

        public Long getId() {
            return id;
        }
...

I would like to add this new entity to Models without a controller.


问:
Prevent Nuxt from routing to http on 301 redirect
I work on a Nuxt application that we are trying to optimize for SEO. The old site that we replaced had a root of /home, so we are needing to account for that on this new site, which does not share that root.

When hitting https://website.com/home there are two redirects - the first one of which is a 301 redirect to append a slash, but in this case, it redirects to http://website.com/home/ and then there is a second redirect to that exact same url, except it is https again. I am completely unsure of why this is happening.

I have created a folder "home" in pages with an index.vue file that just has the router direct to /.

We are using nuxt generate, so serverMiddleware is off the table. I've tried to use router Middleware but that doesn't work either. Not sure what to do.


问:
How to know if a user is logged in via Oauth
I added authorization through social networks to my site. How can I find out that the user used exactly this authorization?
In the process of authorizing a user through a social network, I need to change the verified value in the database table, as well as add his photo to this table.

Note: I didn't rewrite the default user model, but extended it by creating a ForeignKey in the Profile table. This table stores information about the user (phone number, gender, etc.)
Note2: I'm using social-auth-app-django

It seems to me that I should implement a separate View for authorization on social networks in order to catch all the data I need. But what should it look like? I am new to this matter.


问:
Does Scala .flatMap( ) .flatten( ) Disintegrate the top level collection or the bottom level collection
In the case of List(List(1, List(2)), List(List(3), 4)).flatten:

I assumed in the order of operations, we go to:
List(1, List(2)) List(List(3), 4)

And combine the two loose elements into:
List(1, List(2), List(3), 4)

In other words, the outermost wrapping is disintegrated first. This appears to contradict the assertion here, which says "the inner grouping of an item is removed and a sequence is generated".

Which, if either, is technically correct?


问:
Vuejs2 draggable component with localStorage?
I am working with some dashboard statistics and need to make divs draggable, so users can drag any chart where they want, for example: replace right or left. And I have done this and work fine, I think. But I want to store this on local storage and I does not know how?

Dashboard cards

```<code><template>
  <div class="col-12">
    <d-board id="border-7">
      <d-card id="card-7" draggable="true">
        <p>Card 1</p>
      </d-card>
    </d-board>
  </div>

  <div class="col-12">
    <d-board id="border-8">
      <d-card id="card-8" draggable="true">
        <p>Card 2</p>
      </d-card>
    </d-board>
  </div>
</template>
</code>```

Border

```<code><template>
  <div v-if="id" :id="id" class="board" @dragover.prevent @drop.prevent="drop">
    <slot />
  </div>
</template>

<script>
export default {
  props: ["id"],

  methods: {
    drop: (e) => {
      const card_id = e.dataTransfer.getData("card_id");
      const card = document.getElementById(card_id);

      // card.style.display = "block";
      card.style.opacity = "1";
      e.target.appendChild(card);
      // localStorage.setItem("chart-reorder", e.target.appendChild(card));
    },
  },
};
</script>

</code>```

and Cards

```<code><template>
    <div :id="id"
        class="draggable-card"
        :draggable="draggable"
        @dragstart="dragStart"
        @dragover.stop
    >
        <slot />
    </div>
</template>

<script>
    export default {
        props: ['id', 'draggable'],

        methods: {
            dragStart: e => {
                const target = e.target;

                e.dataTransfer.setData('card_id', target.id);

                setTimeout(() => {
                    // target.style.display = "none";
                    target.style.opacity = "0.3";
                }, 0);
            }
        }
    }
</script>
</code>```

If I use this on drop method on bordercomponent it stores data on local storage but not the right way I think

```<code>localStorage.setItem("chart-reorder", e.target.appendChild(card));

//data stored
chart-reorder   [object HTMLDivElement]
</code>```

ERROR I GOT

```<code>card.style.opacity = "1";
      e.target.appendChild(card);
localStorage.setItem("chart-reorder", JSON.stringify(e.target.appendChild(card)));

//ER
app.js:64487 [Vue warn]: Error in v-on handler: "TypeError: Converting circular structure to JSON
    --> starting at object with constructor 'VueComponent'
    |     property '_scope' -> object with constructor 'EffectScope'
    |     property 'effects' -> object with constructor 'Array'
    |     index 0 -> object with constructor 'Watcher'
    --- property 'vm' closes the circle"

TypeError: Converting circular structure to JSON
    --> starting at object with constructor 'VueComponent'
    |     property '_scope' -> object with constructor 'EffectScope'
    |     property 'effects' -> object with constructor 'Array'
    |     index 0 -> object with constructor 'Watcher'
    --- property 'vm' closes the circle
</code>```

sandbox
https://codesandbox.io/s/practical-artem-v9xqk3?file=/src/components/draggable/Card.vue

Body:
I am working with some dashboard statistics and need to make divs draggable, so users can drag any chart where they want, for example: replace right or left. And I have done this and work fine, I think. But I want to store this on local storage and I does not know how?

Dashboard cards

<template>

    <d-board id="border-7">
      <d-card id="card-7" draggable="true">

Card 1

      </d-card>
    </d-board>

    <d-board id="border-8">
      <d-card id="card-8" draggable="true">

Card 2

      </d-card>
    </d-board>

</template>

Border

<template>

    <slot />

</template>

and Cards

<template>

        <slot />

</template>

If I use this on drop method on bordercomponent it stores data on local storage but not the right way I think

localStorage.setItem("chart-reorder", e.target.appendChild(card));

//data stored
chart-reorder   [object HTMLDivElement]

ERROR I GOT

card.style.opacity = "1";
      e.target.appendChild(card);
localStorage.setItem("chart-reorder", JSON.stringify(e.target.appendChild(card)));

//ER
app.js:64487 [Vue warn]: Error in v-on handler: "TypeError: Converting circular structure to JSON
    --> starting at object with constructor 'VueComponent'
    |     property '_scope' -> object with constructor 'EffectScope'
    |     property 'effects' -> object with constructor 'Array'
    |     index 0 -> object with constructor 'Watcher'
    --- property 'vm' closes the circle"

TypeError: Converting circular structure to JSON
    --> starting at object with constructor 'VueComponent'
    |     property '_scope' -> object with constructor 'EffectScope'
    |     property 'effects' -> object with constructor 'Array'
    |     index 0 -> object with constructor 'Watcher'
    --- property 'vm' closes the circle

sandbox
https://codesandbox.io/s/practical-artem-v9xqk3?file=/src/components/draggable/Card.vue


问:
How to authenticate with Simple JWT using only password
After implementing Simple JWT I can login using username and password but User needs to authenticate only with password. I tried to override the TokenObtainPairSerializer like this

```<code>class CustomTokenPairSerializer(TokenObtainPairSerializer):
    username = serializers.SerializerMethodField(required=False)

    def validate(self, data):
        try:
            user = User.objects.filter(password=data.get("password"))
        except User.DoesNotExist:
            raise serializers.ValidationError("No such user exists")

        credentials = {
            "password": data.get("password")
        }

        if user:
            user = user.first()
            credentials["password"] = user.username

        return super().validate(credentials)
</code>```

and this is the view.

```<code>class CutomObtainPairView(TokenObtainPairView):
    serializer_class = CustomTokenPairSerializer
</code>```

but it still requires username. Can anyone help with this?

This is the User model

```<code>class User(AbstractBaseUser):
    password = models.CharField('password', max_length=4, validators=[MinLengthValidator(4)], unique=True)
    name = models.CharField(max_length=50, blank=True)
    surname = models.CharField(max_length=100, blank=True)
    shift = models.CharField(max_length=50, choices=SHIFTS)
    role = models.CharField(max_length=50, choices=ROLES)
    work_start_time = models.DateTimeField()
    work_end_time = models.DateTimeField()
</code>```

Body:
After implementing Simple JWT I can login using username and password but User needs to authenticate only with password. I tried to override the TokenObtainPairSerializer like this

class CustomTokenPairSerializer(TokenObtainPairSerializer):
    username = serializers.SerializerMethodField(required=False)

    def validate(self, data):
        try:
            user = User.objects.filter(password=data.get("password"))
        except User.DoesNotExist:
            raise serializers.ValidationError("No such user exists")

        credentials = {
            "password": data.get("password")
        }

        if user:
            user = user.first()
            credentials["password"] = user.username

        return super().validate(credentials)

and this is the view.

class CutomObtainPairView(TokenObtainPairView):
    serializer_class = CustomTokenPairSerializer

but it still requires username. Can anyone help with this?

This is the User model

class User(AbstractBaseUser):
    password = models.CharField('password', max_length=4, validators=[MinLengthValidator(4)], unique=True)
    name = models.CharField(max_length=50, blank=True)
    surname = models.CharField(max_length=100, blank=True)
    shift = models.CharField(max_length=50, choices=SHIFTS)
    role = models.CharField(max_length=50, choices=ROLES)
    work_start_time = models.DateTimeField()
    work_end_time = models.DateTimeField()


问:
Why am Getting a "ValueError: Your API ID or Hash cannot be empty or None" when using Telethon inside a Docker Container
I am getting a ValueError: Your API ID or Hash cannot be empty or None when i try to run a python script that send files to a chat using telethon inside a docker container. I scheduled it with cron.

This is part of my docker_compose file...

```<code>...
name_xyz:
  env_file: .env
  environment:
    PYTHONUNBUFFERED: 1
    TELEGRAM_POSTING_API_HASH: ${TELEGRAM_POSTING_API_HASH}
    TELEGRAM_POSTING_API_ID: ${TELEGRAM_POSTING_API_ID}
  build:
    context: ./xyz/
    dockerfile: Dockerfile
  volumes:
    - ./xyz:/app
  working_dir: /app/xyz/
  restart: always
  command: ./entrypoint.sh
...
</code>```

So... in my python script i have:

```<code>import os
import asyncio
import requests
from telethon import TelegramClient

TELEGRAM_POSTING_API_HASH = os.getenv('TELEGRAM_POSTING_API_HASH')
TELEGRAM_POSTING_API_ID = os.getenv('TELEGRAM_POSTING_API_ID')

client = TelegramClient('session_name', TELEGRAM_POSTING_API_ID, TELEGRAM_POSTING_API_HASH)
...
</code>```

and in my .env file i have:

```<code>TELEGRAM_POSTING_API_ID=11111111111
TELEGRAM_POSTING_API_HASH=11111111111
</code>```

i actually dont know what am i doing wrong maybe i am missing something. Please help!

I tried hardcoding the api id and api hash in the python script and it works perfect.
But when i put the os.getenv() function it gives me a ValueError: Your API ID or Hash cannot be empty or None

When i change the docker compose file to this:

```<code>name_xyz:
  env_file: .env
  environment:
    PYTHONUNBUFFERED: 1
    TELEGRAM_POSTING_API_HASH: ${TELEGRAM_POSTING_API_HASH}
    TELEGRAM_POSTING_API_ID: ${TELEGRAM_POSTING_API_ID}
  build:
    context: ./xyz/
    dockerfile: Dockerfile
  volumes:
    - ./xyz:/app
  working_dir: /app/xyz/telegram
  restart: always
  command: python3 my_python_script.py
</code>```

it also work... so i think maybe its cron.

here is my entrypoint.sh

```<code>#!/bin/bash

# Start the run once job.
echo "Docker container has been started"

# shellcheck disable=SC2046

# Setup a cron schedule
echo "SHELL=/bin/bash

*/2 * * * *  cd /app/xyz/telegram/ && python3 my_python_script.py  >> /var/log/cron.log 2>&1
# This extra line makes it a valid cron" > scheduler.txt

crontab scheduler.txt
cron -f
</code>```

Body:
I am getting a ValueError: Your API ID or Hash cannot be empty or None when i try to run a python script that send files to a chat using telethon inside a docker container. I scheduled it with cron.

This is part of my docker_compose file...

...
name_xyz:
  env_file: .env
  environment:
    PYTHONUNBUFFERED: 1
    TELEGRAM_POSTING_API_HASH: ${TELEGRAM_POSTING_API_HASH}
    TELEGRAM_POSTING_API_ID: ${TELEGRAM_POSTING_API_ID}
  build:
    context: ./xyz/
    dockerfile: Dockerfile
  volumes:
    - ./xyz:/app
  working_dir: /app/xyz/
  restart: always
  command: ./entrypoint.sh
...

So... in my python script i have:

import os
import asyncio
import requests
from telethon import TelegramClient

TELEGRAM_POSTING_API_HASH = os.getenv('TELEGRAM_POSTING_API_HASH')
TELEGRAM_POSTING_API_ID = os.getenv('TELEGRAM_POSTING_API_ID')

client = TelegramClient('session_name', TELEGRAM_POSTING_API_ID, TELEGRAM_POSTING_API_HASH)
...

and in my .env file i have:

TELEGRAM_POSTING_API_ID=11111111111
TELEGRAM_POSTING_API_HASH=11111111111

i actually dont know what am i doing wrong maybe i am missing something. Please help!

I tried hardcoding the api id and api hash in the python script and it works perfect.
But when i put the os.getenv() function it gives me a ValueError: Your API ID or Hash cannot be empty or None

When i change the docker compose file to this:

name_xyz:
  env_file: .env
  environment:
    PYTHONUNBUFFERED: 1
    TELEGRAM_POSTING_API_HASH: ${TELEGRAM_POSTING_API_HASH}
    TELEGRAM_POSTING_API_ID: ${TELEGRAM_POSTING_API_ID}
  build:
    context: ./xyz/
    dockerfile: Dockerfile
  volumes:
    - ./xyz:/app
  working_dir: /app/xyz/telegram
  restart: always
  command: python3 my_python_script.py

it also work... so i think maybe its cron.

here is my entrypoint.sh

#!/bin/bash

# Start the run once job.
echo "Docker container has been started"

# shellcheck disable=SC2046

# Setup a cron schedule
echo "SHELL=/bin/bash

*/2 * * * *  cd /app/xyz/telegram/ && python3 my_python_script.py  >> /var/log/cron.log 2>&1
# This extra line makes it a valid cron" > scheduler.txt

crontab scheduler.txt
cron -f


问:
How to open specific screen on intent-filter in compose?

What am I trying to achieve?

I am adding an intent filter in my manifest, allowing users to share any file with my app. On sharing, I want to open a specific screen in my app.

What I tried?

In my main activity before setContent, I added logic to find if the app is opened with another app or not. And based on that App navigates to the intended screen.

What's the problem?

I want to know if this is how should I do it or if should I create new compose activity. I don't know but I think that what I am doing might result in bad performance as it loads all the unnecessary compostables too.


问:
Pine Script volume profile calculation
I don't understand how the Session Volume Profile works. The bull (up) volume should be 930 according to my calculations, but is 568. What am I getting wrong and how should I calculate the price volume? The timeframe used is 1 minute and the Volume Profile should be calculated on the same timeframe (https://www.tradingview.com/support/solutions/43000502040-volume-profile/).

See the video for more information https://photos.app.goo.gl/fnoJy7Mbs6gfPcDw6

Title: Pine Script volume profile calculation


问:
How can I get elfinder to work in angular project
I would like elfinder to work with a angular project. I am unsure where to start. My backend is asp.net core So far I have create a stackbliz projet here whre I have added jquery.
Any help would be appricieded. Also I have tried to use the solution here but it did not work.</p>


问:
how to receive argument in COLLADA (.dae) file?
I am working with ROS and GAZEBO and I need to change the individual objects in the environment with help of .xacro and .dae files.

For my requirement, I need to change a .dae file as per the parameter received from the other .xacro file. But there is no such tag defined in the documentation to receive arguments or store arguments in the .dae file.

for instance, in a .xacro file, I can drive my logic with below line of code --

```<code><xacro:arg name ="name" default="cylinder">
</code>```

or in a .xsl file, we use below code--

```<code><xsl:param name="new_title" />
</code>```

A .dae file is also an XML format and I want to know how we can get store the argument in this?

Body:
I am working with ROS and GAZEBO and I need to change the individual objects in the environment with help of .xacro and .dae files.

For my requirement, I need to change a .dae file as per the parameter received from the other .xacro file. But there is no such tag defined in the documentation to receive arguments or store arguments in the .dae file.

for instance, in a .xacro file, I can drive my logic with below line of code --

<xacro:arg name ="name" default="cylinder">

or in a .xsl file, we use below code--

<xsl:param name="new_title" />

A .dae file is also an XML format and I want to know how we can get store the argument in this?


问:
Redirected cu output doesn't produce output in longer pipe
I have some usb device (connected to my mac) that produces text output. I use cu with tee to redirect the output to some file:

```<code>sudo cu --speed 57600 --line /dev/cu.usbmodem54240287031 | tee cu.log
</code>```

cu.log looks like:

```<code>Sensor data reading ...
SCD30 CO2:  1121
SCD30 Temp: 24.30
SCD30 Humi: 32.59
SGP40 VOC: 30570
SPS30 PM25: 3.91
</code>```

...

Now I want to put that through a pipe using tail, like this

```<code>tail -f cu.log | grep CO2
</code>```

This works fine. But if I append another step to the pipe it just stops to produce output:

```<code>tail -f cu.log | grep CO2| awk '{print $3}'
</code>```

And I don't know why and how to solve the problem.
Can anyone help?

Body:
I have some usb device (connected to my mac) that produces text output. I use cu with tee to redirect the output to some file:

sudo cu --speed 57600 --line /dev/cu.usbmodem54240287031 | tee cu.log

cu.log looks like:

Sensor data reading ...
SCD30 CO2:  1121
SCD30 Temp: 24.30
SCD30 Humi: 32.59
SGP40 VOC: 30570
SPS30 PM25: 3.91

...

Now I want to put that through a pipe using tail, like this

tail -f cu.log | grep CO2

This works fine. But if I append another step to the pipe it just stops to produce output:

tail -f cu.log | grep CO2| awk '{print $3}'

And I don't know why and how to solve the problem.
Can anyone help?


问:
Add validation to the patch request body in service class- Nestjs, Node.js, Javascript
I have a patch endpoint to update the ticket status.

Status can be updated from
Open - closed ,
Reopen - closed,
Closed - reopen.

How can I add validation on the ticket status to send only desired status in request body.

Ex: if the current status in DB is Open -> we can update the status to closed.

If the status sent from request body is valid then only update the ticket status in DB.

I have logic something like below. Please help me to add validation in service class.

```<code>status.enum class:
export enum StatusEnum {
  open = 1,
  closed = 2,
  reopen = 3,
}
</code>```
```<code>dto class:
export class PatchTicketDTO {
  @IsEnum(StatusEnum)
  ticketStatus: number;
}
</code>```
```<code>controller class:
  @Patch(`:${ID}`)
  async patchTicket(
    @Param(ID) id: number,
    @Body() patchTicketDTO: PatchTicketDTO
  ) {
    return this.service.patchTicket(id, patchTicketDTO);
  }
</code>```
```<code>
    async patchTicket(id: number, patchTicketDTO: PatchTicketDTO) {
    try {
    let ticketDetails = await this.ticketRepository.findOneBy({ id });
    if (ticketDetails.ticketStatus !== patchTicketDTO.ticketStatus) {
    //add validation for patch request body ticket status

    //Ex: if the current status in DB is Open/reopen -> we can update the status to closed
   // if the current status in DB is closed -> we can update the status to reopen
   //other cases like from reopen/closed to open status should not be allowed.
     }
    ticketDetails.ticketStatus = patchTicketDTO.ticketStatus;
    await this.ticketRepository.update({ id: ticketDetails.id }, patchTicketDTO);
    const result = { ...ticketDetails, ...patchTicketDTO };
    return result;
    } catch (ex) {
    throw ex;
    }
    }

</code>```

Body:
I have a patch endpoint to update the ticket status.

Status can be updated from
Open - closed ,
Reopen - closed,
Closed - reopen.

How can I add validation on the ticket status to send only desired status in request body.

Ex: if the current status in DB is Open -> we can update the status to closed.

If the status sent from request body is valid then only update the ticket status in DB.

I have logic something like below. Please help me to add validation in service class.

status.enum class:
export enum StatusEnum {
  open = 1,
  closed = 2,
  reopen = 3,
}

dto class:
export class PatchTicketDTO {
  @IsEnum(StatusEnum)
  ticketStatus: number;
}

controller class:
  @Patch(`:${ID}`)
  async patchTicket(
    @Param(ID) id: number,
    @Body() patchTicketDTO: PatchTicketDTO
  ) {
    return this.service.patchTicket(id, patchTicketDTO);
  }

    async patchTicket(id: number, patchTicketDTO: PatchTicketDTO) {
    try {
    let ticketDetails = await this.ticketRepository.findOneBy({ id });
    if (ticketDetails.ticketStatus !== patchTicketDTO.ticketStatus) {
    //add validation for patch request body ticket status

    //Ex: if the current status in DB is Open/reopen -> we can update the status to closed
   // if the current status in DB is closed -> we can update the status to reopen
   //other cases like from reopen/closed to open status should not be allowed.
     }
    ticketDetails.ticketStatus = patchTicketDTO.ticketStatus;
    await this.ticketRepository.update({ id: ticketDetails.id }, patchTicketDTO);
    const result = { ...ticketDetails, ...patchTicketDTO };
    return result;
    } catch (ex) {
    throw ex;
    }
    }


问:
react native styled components: (tag.text || "").trim is not a function
I just started a simple react-native app and tried to start an styled component container like so:

```<code> import styled from "styled-components/native";

export const Container = styled.View`
    margin-top: 200px;
`;
</code>```

But whatever I type inside Container or any other const, any other react native tag (Button, Pressable, TouchableOpacity, etc) it shows this error:

On my component there's:

```<code>import { View, Text, Button, StyleSheet, TouchableOpacity } from 'react-native'
import React from 'react'
import { Container } from './container/ButtonContainer'

interface Btn {
    text: string,
    click: () => void,
}

export default function ButtonComponent({text, click}: Btn ) {
  return (
    <Container>
      <TouchableOpacity
      onPress={click}
      >
       <Text>
       {text}
       </Text>
      </TouchableOpacity>
    </Container>
  )
}
</code>```

And I already have @types/styled-components-react-native and @types/styled-components installed. What should I do?

Body:
I just started a simple react-native app and tried to start an styled component container like so:

 import styled from "styled-components/native";

export const Container = styled.View`
    margin-top: 200px;
`;

But whatever I type inside Container or any other const, any other react native tag (Button, Pressable, TouchableOpacity, etc) it shows this error:

On my component there's:

import { View, Text, Button, StyleSheet, TouchableOpacity } from 'react-native'
import React from 'react'
import { Container } from './container/ButtonContainer'

interface Btn {
    text: string,
    click: () => void,
}

export default function ButtonComponent({text, click}: Btn ) {
  return (
    <Container>
      <TouchableOpacity
      onPress={click}
      >
       <Text>
       {text}
       </Text>
      </TouchableOpacity>
    </Container>
  )
}

And I already have @types/styled-components-react-native and @types/styled-components installed. What should I do?


问:
Getting this error when running a CI/CD pipeline with npm
We updated the PHP version from 7 to 8.
This is the Console Output in GitLab when trying to deploy on dev branch:

```<code>[..]
$ npm install
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated source-map-url@0.4.0: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated json-schema-to-openapi-schema@0.3.0: This package is no longer maintained. Use @openapi-contrib/json-schema-to-openapi-schema instead.
npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
npm WARN deprecated @npmcli/move-file@1.1.2: This functionality has been moved to @npmcli/fs
npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm WARN deprecated json-schema-ref-parser@6.1.0: Please switch to @apidevtools/json-schema-ref-parser
npm WARN deprecated popper.js@1.16.1: You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1
npm WARN deprecated redoc@2.0.0-rc.8-1: internal release
npm WARN deprecated core-js@2.6.11: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
npm WARN deprecated core-js@3.9.1: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
npm ERR! code 1
npm ERR! path /builds/se/uniapp/laravel-backend/node_modules/gifsicle
npm ERR! command failed
npm ERR! command sh -c node lib/install.js
npm ERR! compiling from source
npm ERR! spawn /builds/se/uniapp/laravel-backend/node_modules/gifsicle/vendor/gifsicle ENOENT
npm ERR! gifsicle pre-build test failed
npm ERR! Error: Command failed: /bin/sh -c autoreconf -ivf
npm ERR! /bin/sh: autoreconf: not found
npm ERR!
npm ERR!
npm ERR!     at /builds/se/uniapp/laravel-backend/node_modules/bin-build/node_modules/execa/index.js:231:11
npm ERR!     at processTicksAndRejections (node:internal/process/task_queues:96:5)
npm ERR!     at async Promise.all (index 0)

[...]
</code>```

Tried all solutions online, new errors keep showing up. Trying to deploy the update on dev.

Body:
We updated the PHP version from 7 to 8.
This is the Console Output in GitLab when trying to deploy on dev branch:

[..]
$ npm install
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated source-map-url@0.4.0: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated json-schema-to-openapi-schema@0.3.0: This package is no longer maintained. Use @openapi-contrib/json-schema-to-openapi-schema instead.
npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
npm WARN deprecated @npmcli/move-file@1.1.2: This functionality has been moved to @npmcli/fs
npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm WARN deprecated json-schema-ref-parser@6.1.0: Please switch to @apidevtools/json-schema-ref-parser
npm WARN deprecated popper.js@1.16.1: You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1
npm WARN deprecated redoc@2.0.0-rc.8-1: internal release
npm WARN deprecated core-js@2.6.11: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
npm WARN deprecated core-js@3.9.1: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
npm ERR! code 1
npm ERR! path /builds/se/uniapp/laravel-backend/node_modules/gifsicle
npm ERR! command failed
npm ERR! command sh -c node lib/install.js
npm ERR! compiling from source
npm ERR! spawn /builds/se/uniapp/laravel-backend/node_modules/gifsicle/vendor/gifsicle ENOENT
npm ERR! gifsicle pre-build test failed
npm ERR! Error: Command failed: /bin/sh -c autoreconf -ivf
npm ERR! /bin/sh: autoreconf: not found
npm ERR!
npm ERR!
npm ERR!     at /builds/se/uniapp/laravel-backend/node_modules/bin-build/node_modules/execa/index.js:231:11
npm ERR!     at processTicksAndRejections (node:internal/process/task_queues:96:5)
npm ERR!     at async Promise.all (index 0)

[...]

Tried all solutions online, new errors keep showing up. Trying to deploy the update on dev.


问:
Activate Code Once Form is Fully Activated
I am trying to have some code run once a form has been opened.  I am calling the code that is in a module and has "Screen.ActiveForm" during the On_Current event for the form, but I am getting an error saying:

```<code>Run-time error '2475':

You entered an expression that requires a form to be the active window.
</code>```

The main question is, how do make the code wait until the form is completely opened before it checks for the "ActiveForm"?

I've tried multiple different trigger events including On_Load, On_Activate, etc. to try and get the code to trigger once the form is fully opened but have been unsuccessful.  I could simply ignore the code and get the form to open without the error, but then I have to refresh the form to get the code to run properly.  Below is an example of what is causing the error.

Form Code:

```<code>Private Sub Form_Current()
Call testFunction()
End Sub
</code>```

Module Code:

```<code>Public Function testFuction()
frmName = Screen.ActiveForm.Name
MsgBox frmName
End Function
</code>```

Body:
I am trying to have some code run once a form has been opened.  I am calling the code that is in a module and has "Screen.ActiveForm" during the On_Current event for the form, but I am getting an error saying:

Run-time error '2475':

You entered an expression that requires a form to be the active window.

The main question is, how do make the code wait until the form is completely opened before it checks for the "ActiveForm"?

I've tried multiple different trigger events including On_Load, On_Activate, etc. to try and get the code to trigger once the form is fully opened but have been unsuccessful.  I could simply ignore the code and get the form to open without the error, but then I have to refresh the form to get the code to run properly.  Below is an example of what is causing the error.

Form Code:

Private Sub Form_Current()
Call testFunction()
End Sub

Module Code:

Public Function testFuction()
frmName = Screen.ActiveForm.Name
MsgBox frmName
End Function


问:
Is there any way to detect if a website is using any cookie consent tool?
Actually, I need to determine if a site is using a cookie consent tool for managing its cookies or not. I would like to check this via running a script on any site via puppeteer js and so, is there any way with which I could check if a site is indeed using any cookie consent tool? Also, is there any way to check it via cookies only?

I tried to find if there's any cookie that might indicate that but so, far I couldn't.


问:
Multiple saas apps on appstore from one developers account, possible?
i have a simple query. I am planning on making a saas product. 3 apps(customer, admin, employee) for different clients. Each client will have different branding, different billing accounts and different firebase project.

From what I have heard apple will mark these apps as spam. I cant upload more than one from one developers account. These are custom personalised apps so i dont want to nor can I make them bundle into one single app.

Whats the solution to the apples spam rule? Should I make a different developers account for each client and upload the apps? Or is it possible to have a single developers account and upload all the apps from that account?

Any help is appreciated. I just need guidance.

I am in the planning/research phase so I have not tried anything.


问:
Trying to run a published Uno Hosted WASM app gives a 404 when running it
I just tried out the Uno platform and I have come across a roadblock: When I create a project with a Hosted head, i.e., hosting the Wasm app in Asp.net Core, when I run the Server application and open the URL, I just get a 404.

Is this our company firewall blocking something or am I missing a thing here?


问:
Cypress, stub multiple window popups in multiple "it" tests within one "describe" (version 8 only)
Section of the test, after this is my define then the test where it clicks on the target button to create the popup at the end of the it test.

```<code>beforeEach(() => {
  cy.windowListen('open');
});
afterEach(() => {
  cy.popupResponse('open');
})

</code>```

Here is the first custom command to create the stub to be called later, it takes the alias defined by the user.

```<code>export default function windowListen (alias: string) {
  cy.window().then((win) => {
    cy.stub(win, 'open').as(alias);
  });
}
</code>```

Here is the second custom command to respond to the stub (it takes the alias of the stub assigned)

```<code>export default function popupResponse(alias: string) {
    cy.get('@' + alias).should('have.been.called')
}
</code>```

These responses result in the first it test being skipped or not being able to locate the alias "@open" and therefore it is called 0 times. While subsequent tests will have no issue with the stub.

I have also tried for each button click (2 different button clicks in 3 tests total).

```<code>cy.windowListen('open');
cy.get('btn').click().then(function () {
      cy.popupResponse('open');
    });

</code>```

I have also tried per each set of button clicks (there are a total of 2 per tests (3 tests total) I need to get the popups for):

```<code>cy.windowListen('open');
cy.get('btn').click();
cy.popupResponse('open');
</code>```

These responses result in the first it test being skipped or not being able to locate the alias "@open" and therefore it is called 0 times. While subsequent tests will have no issue with the stub set up identically confirming that the stub was called (2) times.

Body:
Section of the test, after this is my define then the test where it clicks on the target button to create the popup at the end of the it test.

beforeEach(() => {
  cy.windowListen('open');
});
afterEach(() => {
  cy.popupResponse('open');
})

Here is the first custom command to create the stub to be called later, it takes the alias defined by the user.

export default function windowListen (alias: string) {
  cy.window().then((win) => {
    cy.stub(win, 'open').as(alias);
  });
}

Here is the second custom command to respond to the stub (it takes the alias of the stub assigned)

export default function popupResponse(alias: string) {
    cy.get('@' + alias).should('have.been.called')
}

These responses result in the first it test being skipped or not being able to locate the alias "@open" and therefore it is called 0 times. While subsequent tests will have no issue with the stub.

I have also tried for each button click (2 different button clicks in 3 tests total).

cy.windowListen('open');
cy.get('btn').click().then(function () {
      cy.popupResponse('open');
    });

I have also tried per each set of button clicks (there are a total of 2 per tests (3 tests total) I need to get the popups for):

cy.windowListen('open');
cy.get('btn').click();
cy.popupResponse('open');

These responses result in the first it test being skipped or not being able to locate the alias "@open" and therefore it is called 0 times. While subsequent tests will have no issue with the stub set up identically confirming that the stub was called (2) times.


问:
Cannot invoke Endpoint.stop because endpoint is null
i am trying to write some tests for some webservices based on soap protocol using junit 5 on a spring boot project , but each time it gives me this error

```<code>Cannot invoke "javax.xml.ws.Endpoint.stop()" because "endpoint" is null
java.lang.NullPointerException: Cannot invoke "javax.xml.ws.Endpoint.stop()" because "endpoint" is null
</code>```

this is my test class

```<code>@RunWith(SpringRunner.class)
@ContextConfiguration({ "classpath:/beans-test-ws.xml" })
public class WebServiceTest {
    @Inject
    private IParametragePersonnes parametragePersonnes;
    @Inject
    private IGestionPersonnes gestionPersonnes;
    @Inject
    private IReferentielStructures referentielStructures;
    @Inject
    private ISynchronisationReferentielExterne synchronisationReferentielExterne;
    @Test
    public void testGestionPersonnesService() throws MalformedURLException {
        Endpoint endpoint = null;
        try {
            final String address = "http://localhost:9090/GestionPersonnes";
            endpoint = Endpoint.publish(address, this.gestionPersonnes);
            System.out.println("Server ready...");

            final GestionPersonnesService service = new GestionPersonnesService(
                            new URL("http://localhost:9090/GestionPersonnes?wsdl"));
            final IGestionPersonnes client = service.getGestionPersonnesPort();
            assertTrue(true);
        } finally {
            endpoint.stop();
        }
    }
}

</code>```

i have tried to change dependecies  versions like jaxb-api and jaxb-impl but nothing changed

Body:
i am trying to write some tests for some webservices based on soap protocol using junit 5 on a spring boot project , but each time it gives me this error

Cannot invoke "javax.xml.ws.Endpoint.stop()" because "endpoint" is null
java.lang.NullPointerException: Cannot invoke "javax.xml.ws.Endpoint.stop()" because "endpoint" is null

this is my test class

@RunWith(SpringRunner.class)
@ContextConfiguration({ "classpath:/beans-test-ws.xml" })
public class WebServiceTest {
    @Inject
    private IParametragePersonnes parametragePersonnes;
    @Inject
    private IGestionPersonnes gestionPersonnes;
    @Inject
    private IReferentielStructures referentielStructures;
    @Inject
    private ISynchronisationReferentielExterne synchronisationReferentielExterne;
    @Test
    public void testGestionPersonnesService() throws MalformedURLException {
        Endpoint endpoint = null;
        try {
            final String address = "http://localhost:9090/GestionPersonnes";
            endpoint = Endpoint.publish(address, this.gestionPersonnes);
            System.out.println("Server ready...");

            final GestionPersonnesService service = new GestionPersonnesService(
                            new URL("http://localhost:9090/GestionPersonnes?wsdl"));
            final IGestionPersonnes client = service.getGestionPersonnesPort();
            assertTrue(true);
        } finally {
            endpoint.stop();
        }
    }
}

i have tried to change dependecies  versions like jaxb-api and jaxb-impl but nothing changed


问:
How can I use precompiled headers from a header file?
distilled.cpp

#include "distilled.hpp"

int main() {

}
```
<p>distilled.hpp</p>
<pre class="lang-cpp prettyprint-override"><code>#include "stdafx.h"
</code>```

batch

```<code>cl distilled.cpp /Yustdafx.h /Fpstdafx.pch /I include /std:c++20 /EHsc -DDEBUGMODE=true /c
</code>```

This is the ideal setup but generates compiler errors.

#include "stdafx.h"
#include "distilled.hpp"

int main() {

}
```

This works fine. When the stdafx is included in the cpp file, it compiles blazing fast, which is very cool, but ideally, I would want to put that inclusion in another file. This approach also creates include errors in nested files(only in VSCode, not an actual compilation), where the compiler only works if I have #include "stdafx.h" exactly, but IntelliSense wants #include "../stdafx.h". Am I doing something wrong to get this result?

Body:
distilled.cpp

#include "distilled.hpp"

int main() {

}

distilled.hpp

#include "stdafx.h"

batch

cl distilled.cpp /Yustdafx.h /Fpstdafx.pch /I include /std:c++20 /EHsc -DDEBUGMODE=true /c

This is the ideal setup but generates compiler errors.

#include "stdafx.h"
#include "distilled.hpp"

int main() {

}

This works fine. When the stdafx is included in the cpp file, it compiles blazing fast, which is very cool, but ideally, I would want to put that inclusion in another file. This approach also creates include errors in nested files(only in VSCode, not an actual compilation), where the compiler only works if I have #include "stdafx.h" exactly, but IntelliSense wants #include "../stdafx.h". Am I doing something wrong to get this result?


问:
Auto Assign Case in SalesForce using Power Automate
Due to my user permission, I can not create any flow automation in SFDC neither create rules nor workflows - and the dedicated team in my company in charge of that is busy with other department queries.

Alternative option is Power Automation :
Attached is the flow I created, could you please support on how to assign a case from a queue (I have the correct SF object) to a user with a specific condition ?

As you can see, I blurred my queue name and the user name but here's what I'd like to automate :
_"OwnerID" is/contains : "xxxxxx" (which is a queue) AND "Country" contains/or equals : Finland

After this first step, I'm not sure how to create the flow to assign or change the OwnerID from the specific queue to a specific user "First name, last name"(blurred too).

Thanks for your support


问:
Unable to install Nuxt 2 CLI
I am trying to install Nuxt 2 CLI which does not seem to work for some days now, I have cleared my cache and i have tried installing other versions of node but for some reasons it does not work.
Below are the errors from then terminal:

```<code>PS C:\Users\Madesoft\Desktop\list app> npm init nuxt-app todo
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
'create-nuxt-app' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code 1
npm ERR! path C:\Users\Madesoft\Desktop\list app
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c create-nuxt-app "todo"

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Madesoft\AppData\Local\npm-cache\_logs\2022-12-14T14_46_00_433Z-debug-0.log
</code>```

Nuxt 3 installs without any problem though

Title: Unable to install Nuxt 2 CLI

Body:
I am trying to install Nuxt 2 CLI which does not seem to work for some days now, I have cleared my cache and i have tried installing other versions of node but for some reasons it does not work.
Below are the errors from then terminal:

PS C:\Users\Madesoft\Desktop\list app> npm init nuxt-app todo
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
'create-nuxt-app' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code 1
npm ERR! path C:\Users\Madesoft\Desktop\list app
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c create-nuxt-app "todo"

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Madesoft\AppData\Local\npm-cache\_logs\2022-12-14T14_46_00_433Z-debug-0.log

Nuxt 3 installs without any problem though


问:
Unable to properly deploy my NestJS API with my Angular Azure Static Web App pipeline
I'm running an NX Monorepo for two apps. One Angular App and one NestJS API. I'm trying to deploy an Azure Static Web app using a GitHub Action.

My pipeline runs smoothly with no errors (yml below). My Angular App builds and deploys smoothly. The NestJS API builds and deploys smoothly. No errors.

When I visit my deployed app, all calls that go to /api just 404 error.

How do I troubleshoot this? I can't find any useful Nodejs logs in the Azure metrics | logs section of their UI.

Here is my Github Action yml:

```<code>name: Azure Static Web Apps CI/CD

on:
  push:
    branches:
      - develop
  pull_request:
    types: [opened, synchronize, reopened, closed]
    branches:
      - develop

env:
  NPM_CONFIG_LEGACY_PEER_DEPS: true

jobs:
  build_and_deploy_job:
    if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
    runs-on: ubuntu-latest
    name: Build and Deploy Job
    steps:
      - uses: actions/checkout@v2
        with:
          submodules: true
      - name: Build And Deploy
        id: builddeploy
        uses: Azure/static-web-apps-deploy@v1
        with:
          azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_FOO_BAR_123 }}
          repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
          action: 'upload'
          ###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
          # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
          app_location: '/' # App source code path
          api_location: 'dist/apps/api' # Api source code path - optional
          output_location: 'dist/apps/myApp/en' # Built app content directory - optional
          ###### End of Repository/Build Configurations ######

  close_pull_request_job:
    if: github.event_name == 'pull_request' && github.event.action == 'closed'
    runs-on: ubuntu-latest
    name: Close Pull Request Job
    steps:
      - name: Close Pull Request
        id: closepullrequest
        uses: Azure/static-web-apps-deploy@v1
        with:
          azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_FOO_BAR_123 }}
          action: 'close'
</code>```

I see both sections for App and API end in success.

```<code>...
---End of Oryx build logs---
Finished building app with Oryx
Api Directory Location: 'dist/apps/api' was found.
Warning: If the application is exporting static html files, i.e., 'next export', consider setting 'IS_STATIC_EXPORT' flag!
Using 'staticwebapp.config.json' file for configuration information, 'routes.json' will be ignored.
Copying 'staticwebapp.config.json' to build output
Starting to build function app with Oryx
---Oryx build logs---
...
---End of Oryx build logs---
Function Runtime Information. OS: linux, Functions Runtime: ~4, node version: 16
Finished building function app with Oryx
Zipping Api Artifacts
Done Zipping Api Artifacts
Zipping App Artifacts
Done Zipping App Artifacts
Uploading build artifacts.
Finished Upload. Polling on deployment.
Status: InProgress. Time: 0.0288762(s)
Status: Succeeded. Time: 15.0509071(s)
Deployment Complete :)
Visit your site at: https://foo-bar-123.azurestaticapps.net
Thanks for using Azure Static Web Apps!
Exiting
##[debug]Docker Action run completed with exit code 0
##[debug]Set output static_web_app_url = https://foo-bar-123.azurestaticapps.net
##[debug]Finishing: Build And Deploy
</code>```

So in the case above ... I head to https://foo-bar-123.azurestaticapps.net and view my perfectly working Angular application, but all calls to https://foo-bar-123.azurestaticapps.net/api will 404.

Any insight? I can't deploy my app.

EDIT: Interestingly enough, if i deploy my same code directly to an Azure Function it will throw the following exception. The exception can then be found in Azure Logs under 'AppExceptions'.

```<code>Result: Failure
Exception: Worker was unable to load function main: 'Unable to determine function entry point. If multiple functions are exported, you must indicate the entry point, either by naming it 'run' or 'index', or by naming it explicitly via the 'entryPoint' metadata property.'
Stack: Error: Worker was unable to load function main: 'Unable to determine function entry point. If multiple functions are exported, you must indicate the entry point, either by naming it 'run' or 'index', or by naming it explicitly via the 'entryPoint' metadata property.'
at /azure-functions-host/workers/node/dist/src/worker-bundle.js:2:13853
at t.LegacyFunctionLoader.<anonymous> (/azure-functions-host/workers/node/dist/src/worker-bundle.js:2:14092)
at Generator.next (<anonymous>)
at o (/azure-functions-host/workers/node/dist/src/worker-bundle.js:2:12538)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
</code>```

So now maybe I can figure this error out, and then somehow link my static web app to an Azure Function manually.

Body:
I'm running an NX Monorepo for two apps. One Angular App and one NestJS API. I'm trying to deploy an Azure Static Web app using a GitHub Action.

My pipeline runs smoothly with no errors (yml below). My Angular App builds and deploys smoothly. The NestJS API builds and deploys smoothly. No errors.

When I visit my deployed app, all calls that go to /api just 404 error.

How do I troubleshoot this? I can't find any useful Nodejs logs in the Azure metrics | logs section of their UI.

Here is my Github Action yml:

name: Azure Static Web Apps CI/CD

on:
  push:
    branches:
      - develop
  pull_request:
    types: [opened, synchronize, reopened, closed]
    branches:
      - develop

env:
  NPM_CONFIG_LEGACY_PEER_DEPS: true

jobs:
  build_and_deploy_job:
    if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
    runs-on: ubuntu-latest
    name: Build and Deploy Job
    steps:
      - uses: actions/checkout@v2
        with:
          submodules: true
      - name: Build And Deploy
        id: builddeploy
        uses: Azure/static-web-apps-deploy@v1
        with:
          azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_FOO_BAR_123 }}
          repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
          action: 'upload'
          ###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
          # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
          app_location: '/' # App source code path
          api_location: 'dist/apps/api' # Api source code path - optional
          output_location: 'dist/apps/myApp/en' # Built app content directory - optional
          ###### End of Repository/Build Configurations ######

  close_pull_request_job:
    if: github.event_name == 'pull_request' && github.event.action == 'closed'
    runs-on: ubuntu-latest
    name: Close Pull Request Job
    steps:
      - name: Close Pull Request
        id: closepullrequest
        uses: Azure/static-web-apps-deploy@v1
        with:
          azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_FOO_BAR_123 }}
          action: 'close'

I see both sections for App and API end in success.

...
---End of Oryx build logs---
Finished building app with Oryx
Api Directory Location: 'dist/apps/api' was found.
Warning: If the application is exporting static html files, i.e., 'next export', consider setting 'IS_STATIC_EXPORT' flag!
Using 'staticwebapp.config.json' file for configuration information, 'routes.json' will be ignored.
Copying 'staticwebapp.config.json' to build output
Starting to build function app with Oryx
---Oryx build logs---
...
---End of Oryx build logs---
Function Runtime Information. OS: linux, Functions Runtime: ~4, node version: 16
Finished building function app with Oryx
Zipping Api Artifacts
Done Zipping Api Artifacts
Zipping App Artifacts
Done Zipping App Artifacts
Uploading build artifacts.
Finished Upload. Polling on deployment.
Status: InProgress. Time: 0.0288762(s)
Status: Succeeded. Time: 15.0509071(s)
Deployment Complete :)
Visit your site at: https://foo-bar-123.azurestaticapps.net
Thanks for using Azure Static Web Apps!
Exiting
##[debug]Docker Action run completed with exit code 0
##[debug]Set output static_web_app_url = https://foo-bar-123.azurestaticapps.net
##[debug]Finishing: Build And Deploy

So in the case above ... I head to https://foo-bar-123.azurestaticapps.net and view my perfectly working Angular application, but all calls to https://foo-bar-123.azurestaticapps.net/api will 404.

Any insight? I can't deploy my app.

EDIT: Interestingly enough, if i deploy my same code directly to an Azure Function it will throw the following exception. The exception can then be found in Azure Logs under 'AppExceptions'.

Result: Failure
Exception: Worker was unable to load function main: 'Unable to determine function entry point. If multiple functions are exported, you must indicate the entry point, either by naming it 'run' or 'index', or by naming it explicitly via the 'entryPoint' metadata property.'
Stack: Error: Worker was unable to load function main: 'Unable to determine function entry point. If multiple functions are exported, you must indicate the entry point, either by naming it 'run' or 'index', or by naming it explicitly via the 'entryPoint' metadata property.'
at /azure-functions-host/workers/node/dist/src/worker-bundle.js:2:13853
at t.LegacyFunctionLoader.<anonymous> (/azure-functions-host/workers/node/dist/src/worker-bundle.js:2:14092)
at Generator.next (<anonymous>)
at o (/azure-functions-host/workers/node/dist/src/worker-bundle.js:2:12538)
at processTicksAndRejections (node:internal/process/task_queues:96:5)

So now maybe I can figure this error out, and then somehow link my static web app to an Azure Function manually.