问:
Error: Cannot create styled-component for component: undefined
```<code>j
X:/rstfrontend/packages/src/constants.js:4
  1 | // @flow
  2 |
  3 | declare var SC_DISABLE_SPEEDY: ?boolean;
> 4 | declare var __VERSION__: string;
  5 |
  6 | export const SC_ATTR: string =
  7 |   (typeof process !== 'undefined' && (process.env.REACT_APP_SC_ATTR || process.env.SC_ATTR)) ||
</code>```

Another problem is that it refers to a path that doesn't exist.

When clicked on View Compiled it links to main.chunk.
Maybe a bug with webpack?

```<code>j
http://localhost:3000/static/js/vendors~main.chunk.js:187248:30
  187245 |     n[r - 1] = arguments[r];
  187246 |   }
  187247 |
> 187248 |   throw  false ? undefined : new Error(D.apply(void 0, [R[e]].concat(n)).trim());
         |                              ^  187249 | }
  187250 |
  187251 | var T = function () {
</code>```

Body:
j
X:/rstfrontend/packages/src/constants.js:4
  1 | // @flow
  2 |
  3 | declare var SC_DISABLE_SPEEDY: ?boolean;
> 4 | declare var __VERSION__: string;
  5 |
  6 | export const SC_ATTR: string =
  7 |   (typeof process !== 'undefined' && (process.env.REACT_APP_SC_ATTR || process.env.SC_ATTR)) ||

Another problem is that it refers to a path that doesn't exist.

When clicked on View Compiled it links to main.chunk.
Maybe a bug with webpack?

j
http://localhost:3000/static/js/vendors~main.chunk.js:187248:30
  187245 |     n[r - 1] = arguments[r];
  187246 |   }
  187247 |
> 187248 |   throw  false ? undefined : new Error(D.apply(void 0, [R[e]].concat(n)).trim());
         |                              ^  187249 | }
  187250 |
  187251 | var T = function () {


来源: stackexchange

问:
How I can add a drawing function in SwiftUI?
I can't draw. Unfortunately I don't know where the problem is, colour selection works and the canva is also created, only the drawing doesn't work. I have also checked that the size of the canva is correct and that the path is defined correctly. here is my code:

//

```<code>import SwiftUI

struct ContentView: View {
    @State private var lines: [Line] = []
    @State private var strokeColor: Color = Color.black

    var body: some View {
        ZStack {
            Color.white
                .edgesIgnoringSafeArea(.all)

            VStack {
                Canvas(lines: $lines, strokeColor: $strokeColor)

                HStack {
                    Button(action: clearDrawing) {
                        Text("Clear")
                    }

                    ColorPicker("Stroke Color", selection: $strokeColor)
                }
                .padding()
            }
        }
    }

    func clearDrawing() {
        lines.removeAll()
    }
}
</code>```

//

Here I have created the Canva and the button to delete the drawing

//

```<code>struct Canvas: View {
    @Binding var lines: [Line]
    @Binding var strokeColor: Color

    var body: some View {
        GeometryReader { geometry in
            Path { path in
                for line in self.lines {
                    path.move(to: line.points[0])
                    path.addLines(line.points)
                }
            }
            .stroke(self.strokeColor, lineWidth: 3)
            .frame(width: geometry.size.width, height: geometry.size.height)
            .gesture(
                DragGesture(minimumDistance: 0.1)
                    .onChanged({ value in
                        var lastLine = self.lines.last!
                        let currentPoint = value.location
                        lastLine.points.append(currentPoint)
                    })
                    .onEnded({ value in
                        self.lines.append(Line())
                    })
            )
        }
    }
}

struct Line: Identifiable {
    var id: UUID = UUID()
    var points: [CGPoint] = []
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}
</code>```

//

And here I have made it so that you should actually draw by touch, and that there is a colour selection

ContentLicense: CC BY-SA 4.0

Body:
I can't draw. Unfortunately I don't know where the problem is, colour selection works and the canva is also created, only the drawing doesn't work. I have also checked that the size of the canva is correct and that the path is defined correctly. here is my code:

//

import SwiftUI

struct ContentView: View {
    @State private var lines: [Line] = []
    @State private var strokeColor: Color = Color.black

    var body: some View {
        ZStack {
            Color.white
                .edgesIgnoringSafeArea(.all)

            VStack {
                Canvas(lines: $lines, strokeColor: $strokeColor)

                HStack {
                    Button(action: clearDrawing) {
                        Text("Clear")
                    }

                    ColorPicker("Stroke Color", selection: $strokeColor)
                }
                .padding()
            }
        }
    }

    func clearDrawing() {
        lines.removeAll()
    }
}

//

Here I have created the Canva and the button to delete the drawing

//

struct Canvas: View {
    @Binding var lines: [Line]
    @Binding var strokeColor: Color

    var body: some View {
        GeometryReader { geometry in
            Path { path in
                for line in self.lines {
                    path.move(to: line.points[0])
                    path.addLines(line.points)
                }
            }
            .stroke(self.strokeColor, lineWidth: 3)
            .frame(width: geometry.size.width, height: geometry.size.height)
            .gesture(
                DragGesture(minimumDistance: 0.1)
                    .onChanged({ value in
                        var lastLine = self.lines.last!
                        let currentPoint = value.location
                        lastLine.points.append(currentPoint)
                    })
                    .onEnded({ value in
                        self.lines.append(Line())
                    })
            )
        }
    }
}

struct Line: Identifiable {
    var id: UUID = UUID()
    var points: [CGPoint] = []
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}

//

And here I have made it so that you should actually draw by touch, and that there is a colour selection


问:
Use cakephp 4's i18nExtract command for ctp files
I have recently updated an existing application to Cakephp 4. Although this Cakephp version uses php as the extension for templates, I have modified the web/src/View/AppView.php file to set ctp as the extension in order to not change all views' extension. The problem is that the i18n command extracts translations from php files, and the only way I found to extract the translations was to manually change the web/vendor/cakephp/cakephp/src/Command/I18nExtractCommand.php, but I would like to have a more orthodox solution that does not require to change vendor files so that I can reproduce it with the current cakephp fileset.


问:
I'm trying to configure my enterpriseSearch.host with docker, but it isn't working (not having errors in log)
I'm new at kibana / elasticsearch / docker and I'm having some issues configurating the environment.

I have been following this guide https://www.elastic.co/guide/en/kibana/current/docker.html and I' able to connect to localhost:5601. Inside localhost:5601, when I try to create my first index (enterprise search) It is asked to me for changes in the configuration.
enter image description here
To do so I created this docker-compose.yml

```<code>version: '2'
services:
  kibana:
    image: docker.elastic.co/kibana/kibana:8.5.3
    environment:
      enterpriseSearch.host: 'https://localhost:3002'
</code>```

And I executed in my cmd (I'm working on windows) a docker compose up.
As I was expecting this haven't worked.

I would like to know what I'm misunderstanding. I think that docker-compose.yml it's just a connection with my kibana to be able to configure the settings, but when I take a look to docker, it's creating a new container when I do so.

I'm pretty sure that I'm not understanding well how this is supposed to work.

Thanks in advance.

Body:
I'm new at kibana / elasticsearch / docker and I'm having some issues configurating the environment.

I have been following this guide https://www.elastic.co/guide/en/kibana/current/docker.html and I' able to connect to localhost:5601. Inside localhost:5601, when I try to create my first index (enterprise search) It is asked to me for changes in the configuration.
enter image description here
To do so I created this docker-compose.yml

version: '2'
services:
  kibana:
    image: docker.elastic.co/kibana/kibana:8.5.3
    environment:
      enterpriseSearch.host: 'https://localhost:3002'

And I executed in my cmd (I'm working on windows) a docker compose up.
As I was expecting this haven't worked.

I would like to know what I'm misunderstanding. I think that docker-compose.yml it's just a connection with my kibana to be able to configure the settings, but when I take a look to docker, it's creating a new container when I do so.

I'm pretty sure that I'm not understanding well how this is supposed to work.

Thanks in advance.


问:
Need REST access to WooCommerce information available in XML dump of website
We have a WordPress eXtended RSS file generated by WordPress as an export of your site. It list all kind of things that I cannot find using REST queries. Most notable is an item which says, in part,

        <item>
            <title><![CDATA[MKT Products [NEW]]]></title>
            <wp:post_id>14146</wp:post_id>
            <wp:post_type><![CDATA[dtwpb_product_tpl]]></wp:post_type>
            <wp:postmeta>
```
<p>after which come a host of useful keys and values which describe the fields in the tpl.</p>
<p>When I do a REST call to the WooCommerce endpoint, I can get a list of products. In the meta_data for these product there is an entry describing the template that has been assigned to the product, e.g.</p>
<pre class="lang-json prettyprint-override"><code>                }, {
                    "id": 161714,
                    "key": "dtwpb_single_product_page",
                    "value": "14146"
                }, {
</code>```

My problem is that while I can work out how to get the definitive list of all the dtwpb_single_product_page values being used for the products, I can't figure out to take the 14146 and use it to get the post that defines its name and attributes.

Does such an endpoint exist and if so, where? One might think that /wp/v2/templates would be the go, but it just gives me an empty array.

Body:
We have a WordPress eXtended RSS file generated by WordPress as an export of your site. It list all kind of things that I cannot find using REST queries. Most notable is an item which says, in part,

        <item>
            <title><![CDATA[MKT Products [NEW]]]></title>
            <wp:post_id>14146</wp:post_id>
            <wp:post_type><![CDATA[dtwpb_product_tpl]]></wp:post_type>
            <wp:postmeta>

after which come a host of useful keys and values which describe the fields in the tpl.

When I do a REST call to the WooCommerce endpoint, I can get a list of products. In the meta_data for these product there is an entry describing the template that has been assigned to the product, e.g.

                }, {
                    "id": 161714,
                    "key": "dtwpb_single_product_page",
                    "value": "14146"
                }, {

My problem is that while I can work out how to get the definitive list of all the dtwpb_single_product_page values being used for the products, I can't figure out to take the 14146 and use it to get the post that defines its name and attributes.

Does such an endpoint exist and if so, where? One might think that /wp/v2/templates would be the go, but it just gives me an empty array.


问:
Convert image pixels and display in a Word document
I'm trying the following code conversion to fit images in a table frame defined in a Word document.

The calculation is working fine and generates fitting images. But still I want to understand what is the ratio or measurement units behind this logic.

img.Width is the pixel size. I am looking for a proper conversion calculation (or) units to match with below width & height values to simplify the code.

```<code>if (img.Width <= 300)
    imageWidthHeight = new Tuple<double, double>(img.Width * 6000, img.Height * 6000);
else if (img.Width <= 600)
    imageWidthHeight = new Tuple<double, double>(img.Width * 5200, img.Height * 5200);
else if (img.Width <= 900)
    imageWidthHeight = new Tuple<double, double>(img.Width * 4500, img.Height * 4500);
else if (img.Width <= 1200)
    imageWidthHeight = new Tuple<double, double>(img.Width * 3800, img.Height * 3800);
else if (img.Width <= 1500)
    imageWidthHeight = new Tuple<double, double>(img.Width * 3100, img.Height * 3100);
else if (img.Width <= 1800)
    imageWidthHeight = new Tuple<double, double>(img.Width * 2400, img.Height * 2400);
else if (img.Width <= 3600)
    imageWidthHeight = new Tuple<double, double>(img.Width * 1500, img.Height * 1500);
else if (img.Width <= 7200)
    imageWidthHeight = new Tuple<double, double>(img.Width * 750, img.Height * 750);
else
    imageWidthHeight = new Tuple<double, double>(img.Width, img.Height);
</code>```

Could anybody explain what kind of unit of measurement or conversion is behind this, so I can simplify this code?

Body:
I'm trying the following code conversion to fit images in a table frame defined in a Word document.

The calculation is working fine and generates fitting images. But still I want to understand what is the ratio or measurement units behind this logic.

img.Width is the pixel size. I am looking for a proper conversion calculation (or) units to match with below width & height values to simplify the code.

if (img.Width <= 300)
    imageWidthHeight = new Tuple<double, double>(img.Width * 6000, img.Height * 6000);
else if (img.Width <= 600)
    imageWidthHeight = new Tuple<double, double>(img.Width * 5200, img.Height * 5200);
else if (img.Width <= 900)
    imageWidthHeight = new Tuple<double, double>(img.Width * 4500, img.Height * 4500);
else if (img.Width <= 1200)
    imageWidthHeight = new Tuple<double, double>(img.Width * 3800, img.Height * 3800);
else if (img.Width <= 1500)
    imageWidthHeight = new Tuple<double, double>(img.Width * 3100, img.Height * 3100);
else if (img.Width <= 1800)
    imageWidthHeight = new Tuple<double, double>(img.Width * 2400, img.Height * 2400);
else if (img.Width <= 3600)
    imageWidthHeight = new Tuple<double, double>(img.Width * 1500, img.Height * 1500);
else if (img.Width <= 7200)
    imageWidthHeight = new Tuple<double, double>(img.Width * 750, img.Height * 750);
else
    imageWidthHeight = new Tuple<double, double>(img.Width, img.Height);

Could anybody explain what kind of unit of measurement or conversion is behind this, so I can simplify this code?


问:
Autodesk Forge Viewer Version7, properties are not showing in 2D views
When Loading an AutoCAD model into Forge, when I open the 3D view of the model it works normal, but when switching to the 2D view, when I select an a 2D object from the scene and open the property window, it is empty. I am using version 7.77 of the viewer.

PS: same model when open in ACC, the property in 2D views act normal and shows content.


问:
I Get PING FAILED Error Loading on My Server
When uploading videos to AWS on localhost, I can upload regardless of the size and it does not give an error.

But when I take these codes to the AWS server and try to upload a file over 100 MB, it gives this error (failed)net::ERR_HTTP2_PING_FAILED

Am I making a mistake somewhere, am I missing something or is there something I need to check?

```<code>return Plupload::file('file', function ($file) {
    try {
        $path = Storage::disk('s3')->putFile('medias', $file);
        $cmd = Storage::disk('s3')
            ->getDriver()
            ->getAdapter()
            ->getClient()
            ->getCommand('GetObject', [
                'Bucket' => config("filesystems.disks.s3.bucket"),
                'Key'    => $path,
            ]);
        $link = Storage::disk('s3')
            ->getDriver()
            ->getAdapter()
            ->getClient()
            ->createPresignedRequest($cmd, '+12 hours')
            ->getUri();

         $linkSave=(string) $link;

        $token = config('services.cloudflare.token');
        $accountId = config('services.cloudflare.acountId');
        $client = new Client();
        //file upload
        /*
                        $response = $client->request('POST', 'https://api.cloudflare.com/client/v4/accounts/' . $accountId . '/stream', [
                            'headers' => [
                                'Authorization' => 'Bearer ' . $token,
                            ],
                            'multipart' => [
                                [
                                    'name' => 'file',
                                    'contents' => fopen($file, 'r+'),
                                    'filename' => $file->getClientOriginalName(),
                                ],
                            ]
                        ]);*/
        //link upload
        $response = $client->request('POST', 'https://api.cloudflare.com/client/v4/accounts/' . $accountId . '/stream/copy', [
            'headers' => [
                'Authorization' => 'Bearer ' . $token,
                'Content-Type' => 'application/json',
            ],
            'json' => [
                "url" => $linkSave,
                "meta" => [
                    "name" => $file->getClientOriginalName()
                ]
            ]

        ]);

        $data = json_decode($response->getBody(), true); // returns an array
        $path = null;

        foreach ($data as $key => $dat) {
            if (is_array($dat) && array_key_exists('preview', $dat)) {
                $path = $dat['preview'];
            }
        }
        $videoUrl = str_replace('watch', 'iframe', $path);
        $videoPath = '<iframe src="' . $videoUrl . '" style="border: none; position: absolute; top: 0; left: 0; height: 100%; width: 100%;" allow="accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture;" allowfullscreen="true" id="stream-player"></iframe>';

        $media = Media::create([
            'name' => $file->getClientOriginalName(),
            'path' => $videoPath,
            'extension' => $file->getClientOriginalExtension(),
            'user_id' => auth()->user()->id,
        ]);
        return [
            'success' => true,
            'message' => 'Upload successful.',
        ];
    } catch (\Exception $exception) {
        return [
            'success' => false,
            'message' => 'Upload error.',
        ];
    }
</code>```

I increased all the video upload and waiting limits in the PHP.ini file. but I still keep getting this error. I don't know how to get rid of this error.

Body:
When uploading videos to AWS on localhost, I can upload regardless of the size and it does not give an error.

But when I take these codes to the AWS server and try to upload a file over 100 MB, it gives this error (failed)net::ERR_HTTP2_PING_FAILED

Am I making a mistake somewhere, am I missing something or is there something I need to check?

return Plupload::file('file', function ($file) {
    try {
        $path = Storage::disk('s3')->putFile('medias', $file);
        $cmd = Storage::disk('s3')
            ->getDriver()
            ->getAdapter()
            ->getClient()
            ->getCommand('GetObject', [
                'Bucket' => config("filesystems.disks.s3.bucket"),
                'Key'    => $path,
            ]);
        $link = Storage::disk('s3')
            ->getDriver()
            ->getAdapter()
            ->getClient()
            ->createPresignedRequest($cmd, '+12 hours')
            ->getUri();

         $linkSave=(string) $link;

        $token = config('services.cloudflare.token');
        $accountId = config('services.cloudflare.acountId');
        $client = new Client();
        //file upload
        /*
                        $response = $client->request('POST', 'https://api.cloudflare.com/client/v4/accounts/' . $accountId . '/stream', [
                            'headers' => [
                                'Authorization' => 'Bearer ' . $token,
                            ],
                            'multipart' => [
                                [
                                    'name' => 'file',
                                    'contents' => fopen($file, 'r+'),
                                    'filename' => $file->getClientOriginalName(),
                                ],
                            ]
                        ]);*/
        //link upload
        $response = $client->request('POST', 'https://api.cloudflare.com/client/v4/accounts/' . $accountId . '/stream/copy', [
            'headers' => [
                'Authorization' => 'Bearer ' . $token,
                'Content-Type' => 'application/json',
            ],
            'json' => [
                "url" => $linkSave,
                "meta" => [
                    "name" => $file->getClientOriginalName()
                ]
            ]

        ]);

        $data = json_decode($response->getBody(), true); // returns an array
        $path = null;

        foreach ($data as $key => $dat) {
            if (is_array($dat) && array_key_exists('preview', $dat)) {
                $path = $dat['preview'];
            }
        }
        $videoUrl = str_replace('watch', 'iframe', $path);
        $videoPath = '';

        $media = Media::create([
            'name' => $file->getClientOriginalName(),
            'path' => $videoPath,
            'extension' => $file->getClientOriginalExtension(),
            'user_id' => auth()->user()->id,
        ]);
        return [
            'success' => true,
            'message' => 'Upload successful.',
        ];
    } catch (\Exception $exception) {
        return [
            'success' => false,
            'message' => 'Upload error.',
        ];
    }

I increased all the video upload and waiting limits in the PHP.ini file. but I still keep getting this error. I don't know how to get rid of this error.


问:
What is the MIPS assembly that would be generated for the following sequence of code: f = g + 2*h - A[3]
I have to write  the MIPS assembly that would be generated for the following sequence of code: f = g + 2*h - A[3]

I wrote the following sequence.

```<code>lw   $t0, 12($s6)       # Load the address of A[3] into $t0, which is $s6 + 12 (3*4 bytes).

lw   $t1, 0($t0)          # Load the value stored at the address of A[3] into $t1.

add  $t2, $s2, $s2     # Multiply h by 2 and store the result in $t2.

add  $t3, $s1, $t2     # Add g and the result of h*2 and store the result in $t3.

sub  $s0, $t3, $t1     # Subtract the result of g + 2*h from A[3] and store into f.
</code>```

I want to know if Is it ok?

Thank you for your help

Body:
I have to write  the MIPS assembly that would be generated for the following sequence of code: f = g + 2*h - A[3]

I wrote the following sequence.

lw   $t0, 12($s6)       # Load the address of A[3] into $t0, which is $s6 + 12 (3*4 bytes).

lw   $t1, 0($t0)          # Load the value stored at the address of A[3] into $t1.

add  $t2, $s2, $s2     # Multiply h by 2 and store the result in $t2.

add  $t3, $s1, $t2     # Add g and the result of h*2 and store the result in $t3.

sub  $s0, $t3, $t1     # Subtract the result of g + 2*h from A[3] and store into f.

I want to know if Is it ok?

Thank you for your help


问:
Invalid timeline function when using derivative function in TDengine
I'm executing a derivative function in TDengine database, and it reports an error.

My sql statement is:

```<code>select derivative(errors, 1s, 1) as errors from (select sum(errors) as errors from log.dnodes_info where ts>="2022-12-06 14:08:42" and ts < "2022-12-06 15:00:00" interval(1s));
</code>```

The error information is:

DB error: Invalid timeline function (0.002248s)

If I execute the following sql directly, it is ok.

```<code>select sum(errors) as errors from log.dnodes_info where ts>="2022-12-06 14:08:42" and ts < "2022-12-06 15:00:00" interval(1s) limit 10;
</code>```

error information

Do I use it in a wrong way?

Body:
I'm executing a derivative function in TDengine database, and it reports an error.

My sql statement is:

select derivative(errors, 1s, 1) as errors from (select sum(errors) as errors from log.dnodes_info where ts>="2022-12-06 14:08:42" and ts < "2022-12-06 15:00:00" interval(1s));

The error information is:

DB error: Invalid timeline function (0.002248s)

If I execute the following sql directly, it is ok.

select sum(errors) as errors from log.dnodes_info where ts>="2022-12-06 14:08:42" and ts < "2022-12-06 15:00:00" interval(1s) limit 10;

error information

Do I use it in a wrong way?


问:
I got this error (#132000) Number of parameters does not match the expected number of params
enter image description here
Here this is my custom template which I have created. Using this template am
trying to send what's app msg but i got 132000 error</p>
```<code>{
    "messaging_product": "whatsapp",
     "recipient_type": "individual",
    "to": "917760569250",
    "type": "template",
    "template": {
        "name": "media_messages",
        "language": {
            "code": "en_US"
        },
        "components": [
          {
            "type":"header",
            "parameters":[
              {
                "type":"document",
                "document":{
                    "id": "1195808994372455"
}
            }
      ]
    },
       {
        "type": "body",
        "parameters": [
          {
            "type": "text",
            "text": "Document"
          }
]
    }
      ]
}
}

</code>```

Body:
enter image description here
Here this is my custom template which I have created. Using this template am
trying to send what's app msg but i got 132000 error

{
    "messaging_product": "whatsapp",
     "recipient_type": "individual",
    "to": "917760569250",
    "type": "template",
    "template": {
        "name": "media_messages",
        "language": {
            "code": "en_US"
        },
        "components": [
          {
            "type":"header",
            "parameters":[
              {
                "type":"document",
                "document":{
                    "id": "1195808994372455"
}
            }
      ]
    },
       {
        "type": "body",
        "parameters": [
          {
            "type": "text",
            "text": "Document"
          }
]
    }
      ]
}
}


问:
Is there any way to get meta data from hive in hue?
I tried to get meta data in hue from hive but all failed.

Im looking for the way not using metastore in mysql.. etc or shell.

Information_schema is also not implemented in hive…

If i can get meta data, i wanna make a table about all meta data like table name, columns and type.


问:
How to show Hijri Calendar in DatepickerDialog view in Android using jetpack compose?
I want to display Hijri dates in DatePickerDialog in jetpack compose without using any 3rd party libraries.</p>
```<code>val calendar = Calendar.getInstance() //this opens up gregorian calendar I need to show Hijri dates
</code>```

Body:
I want to display Hijri dates in DatePickerDialog in jetpack compose without using any 3rd party libraries.

val calendar = Calendar.getInstance() //this opens up gregorian calendar I need to show Hijri dates


问:
How to list all extensions with command in codespaces?
I installed the extension in the codespaces, and the extension is shown in the browser installed section. But when I use the command code --list-extensions, it didn't show the installed extension. I want to know why and how to show the extensions with commands. Thanks.


问:
Third party "remembering" application configuration values even after creating a new instance of WebApplicationFactory
We are writing integration tests for our application ( a minimal api made with .net 6). We are working with xUnit and we have defined a fixture for the collection of tests (all tests belong to the same collection) and not a class fixture. This way, the fixture is created only once and not for every class. The fixture contains a property that we call SUT that contains the WebApplicationFactory instance used to get a client and make requests to our API. We want to test how the application behaves according to the variation of certain config values. In order to do this, we wrote a test that we will refer to as "ProblematicTest" from now on. ProblematicTest should not run in parallel with the rest (should be in the same collection). As part of that ProblematicTest code and only in that test code we ask the fixture to recreate the WebApplicationFactory instance with new config values in order to test the application behavior with these new config values (we implemented a method in the Fixture class to replace the value of the WebApplicationFactory instance with the new one and in the creation of this new instance we use AddJsonFile to modify the relevant config values). And here comes the problem, described by the following facts:

When the ProblematicTest is run alone (with no previous or posterior
execution of any other test), it works well, even when by default,
previous to the test execution, the fixture contains a
WebApplicationFactory instance created with the original config
values. This means that the new instance of WebApplicationFactory is
successfully created with the new relevant config values and
everything works ok.

If one test is run previous to this
ProblematicTest (this means, a request to the tested API using the
original WebApplicationFactory instance is done) then, when accessing the
configuration during the execution of ProblematicTest, we can see
that the application does has the new values in the config as
expected. But there is a third-party component that, somehow, still
"remembers" the previous config values of the original
WebApplicationFactory and works with them, causing the test to fail.
We think that even if the third-party component reads the config at
the beginning of the application execution and never again, the new in-memory application
should work with the new config values from the beginning since we are working with a new
instance of WebApplicationFactory. This way, this capacity to "remember" the
original config values is utterly unexpected for us unless we have a
wrong understanding of how WebApplicationFactory works internally.

If we run ProblematicTest previous to a second test, the execution
of the former affects the execution of the latter also in relation
to the third-party component because it also remembers the first
values it used (the ones defined for ProblematicTest) and the second
test starts failing.

And here come my questions:

Are we missing something in regarding the expected behavior of a WebApplicationFactory instance when recreated? Shouldn't the creation of a new instance of this class cause a total reset of the application? What could explain this weird and unexpected behavior of a component of the application remembering old config values even when the application is supposedly completely recreated, including that third-party component, in between the execution of the two tests?


问:
Adding a progress bar when Uploading local files using API
API Documentation: https://doodstream.co/api-docs#local-upload

My code seems working but there's no indicator how many time left before download is finished

HTML

```<code>             <form enctype="multipart/form-data" action="upload.php" id="form" method="post" align="center">
            <div>
                <label>Custom File Name: </label><br>
                <input type="text" placeholder="File Name" name="fname" minlength="3" required/>
            </div>
            <br><br>
            <div>
                <label>Select video: </label><br>
                <input type="file" name="file" accept="video/*" required/><br>
            </div>
            <br>
            <input name="submit" type="submit" value="Upload"/>
        </form>
</code>```

upload.php

```<code><?php
  if(!empty($_FILES)){

  $tempfile = $_FILES["file"]["tmp_name"];                          //Temporary file location on server
  $fname = $_POST["fname"];                                        //Custom File name input
  $type = pathinfo($_FILES['file']['name'], PATHINFO_EXTENSION);  //File extention
  $name = $fname . '.' . $type;                                  //Complete file name with extention to be used in API

  require('doodstream.php');  //Unofficial Library from GitHub
  $ds = new DoodstreamAPI();
  $key = "MY-API-KEY";      //Insert API key here
  $ds->Setup($key);
  $result = $ds->Upload($tempfile, $type, $name);
  print_r($result);
  }
  else{
    die('No file uploaded');
  }

?>
</code>```

Is there any method to make this possible? I just read the documentation and there's only an "After upload response"

Body:
API Documentation: https://doodstream.co/api-docs#local-upload

My code seems working but there's no indicator how many time left before download is finished

HTML

             <form enctype="multipart/form-data" action="upload.php" id="form" method="post" align="center">

                Custom File Name:

                <input type="text" placeholder="File Name" name="fname" minlength="3" required/>

                Select video:

                <input type="file" name="file" accept="video/*" required/>

            <input name="submit" type="submit" value="Upload"/>
        </form>

upload.php

<?php
  if(!empty($_FILES)){

  $tempfile = $_FILES["file"]["tmp_name"];                          //Temporary file location on server
  $fname = $_POST["fname"];                                        //Custom File name input
  $type = pathinfo($_FILES['file']['name'], PATHINFO_EXTENSION);  //File extention
  $name = $fname . '.' . $type;                                  //Complete file name with extention to be used in API

  require('doodstream.php');  //Unofficial Library from GitHub
  $ds = new DoodstreamAPI();
  $key = "MY-API-KEY";      //Insert API key here
  $ds->Setup($key);
  $result = $ds->Upload($tempfile, $type, $name);
  print_r($result);
  }
  else{
    die('No file uploaded');
  }

?>

Is there any method to make this possible? I just read the documentation and there's only an "After upload response"


问:
Ag-Grid( JS) : Need to show total of each column at the top/bottom in tree grid and the respective value of each node in every node's column in a row
Location Tree

We have a location tree where each location(parent/child) contains some data for that particular node, refer to the screenshot for the same. We need to show the total of the whole tree at the top/bottom. Note: don't want children's data sum in the parent node, parent node needs to show only the parent node's data.

I tried with row pinning which seems a costly operation if i need to sum up all the data for all the columns at frontend and if i need to get the data for total from the backend  when all the data for Aggrid comes up, it will increase the server response time( calculating total is time consuming at backend)

Is there a way to manipulate the data at frontend through pivot or any other functionality.

P.S : i tried with pivot as well with footer. All the data of children sums up on parent node , it doesn't consider parent data.Tried to customise pivot's aggFunc: sum method, there i was able to add parent data and children data at parent node,total in footer came out correct as well

Customised parent+children data sum at parent node

but this didn't solve my problem as i need only respective node's data( not children's summed data) on every node and the total .

Needs this


问:
In sveltekit, How can I get "load's fetch" from client side code?(like *.svelte)
I'm making private homepage working only for login user.
When user login success, API server return token and save it to cookie.

After that, token was added to all fetch's request header at server-side "handleFetch" hooks.

All works fine with server-side rendering. But At client-side rendering needed position, I can't use "load's fetch" and also can't get token from cookies by default sveltekit functionality.

How can I solve this?


问:
Mongoose update document created with base model to model derived from base model with discriminator function
I have a  base model name as userModel and i have inherited that base model and created another model name as adminModel with some extra fields with discriminator.
User Model

```<code>const { Schema } = require("mongoose");
const mongoose = require("../../db/connection");

const baseOptions = {
  discriminatorKey: "role",
  collection: "users",
  timestamps: true,
};

const baseUserSchema = new Schema(
  {
    name: {
      type: String,
    },
    email: {
      type: String,
    },
  },
  baseOptions
);

module.exports = mongoose.model("baseUserSchema", baseUserSchema);

</code>```

Admin Model

```<code>const { Schema } = require("mongoose");
const baseUserModel = require("./baseUser.model");

const Admin = new Schema({
  adminInfo: {
   id: String
  }
});

const adminSignUp = baseUserModel.discriminator("admin", Admin);

module.exports = { adminSignUp };

</code>```

Now i have created a document with base model now i want to update its values with respect to adminModel how should i do it.
because if i try.

```<code>    const updatedInfo = { adminInfo: { id: "1222122" } }
    const user = await baseUserModel.findByIdAndUpdate(userId, updatedInfo).exec();
</code>```

it won't work because adminInfo is not a part of baseUserModel Schema.
and if i do

```<code>    const updatedInfo = { adminInfo: { id: "1222122" } }
    const user = await adminModel.findByIdAndUpdate(userId, updatedInfo).exec();
</code>```

it won't work as well because it will not find the document because it was created with baseModel and have discriminator __t of userModel

Body:
I have a  base model name as userModel and i have inherited that base model and created another model name as adminModel with some extra fields with discriminator.
User Model

const { Schema } = require("mongoose");
const mongoose = require("../../db/connection");

const baseOptions = {
  discriminatorKey: "role",
  collection: "users",
  timestamps: true,
};

const baseUserSchema = new Schema(
  {
    name: {
      type: String,
    },
    email: {
      type: String,
    },
  },
  baseOptions
);

module.exports = mongoose.model("baseUserSchema", baseUserSchema);

Admin Model

const { Schema } = require("mongoose");
const baseUserModel = require("./baseUser.model");

const Admin = new Schema({
  adminInfo: {
   id: String
  }
});

const adminSignUp = baseUserModel.discriminator("admin", Admin);

module.exports = { adminSignUp };

Now i have created a document with base model now i want to update its values with respect to adminModel how should i do it.
because if i try.

    const updatedInfo = { adminInfo: { id: "1222122" } }
    const user = await baseUserModel.findByIdAndUpdate(userId, updatedInfo).exec();

it won't work because adminInfo is not a part of baseUserModel Schema.
and if i do

    const updatedInfo = { adminInfo: { id: "1222122" } }
    const user = await adminModel.findByIdAndUpdate(userId, updatedInfo).exec();

it won't work as well because it will not find the document because it was created with baseModel and have discriminator __t of userModel


问:
Changing Discord Avatar Of Another Bot For Which I Have Token For
How to change the avatar of another discord bot for which I have a token for it?

@client.event
async def on_ready():
    pfp_path = "images.jpg"
    with open(pfp_path, 'rb') as fp:
        pfp = fp.read()
    await client.user.edit(avatar=pfp)
```


问:
AtomicUpdateDocumentMerger Unknown operation for the an atomic update, operation ignored
I am getting a warning on Solr logging as

```<code>AtomicUpdateDocumentMerger Unknown operation for the an atomic update, operation ignored: order_id
</code>```

I am using Spring Data Solr to update my document. My document is:

```<code>"orders":{
      "placed_orders_count":2,
      "0":{
         "order_id":"000000001",
         "order_date":"2019-03-27 14:25:03"
      },
      "1":{
         "order_id":"000000002",
         "order_date":"2019-03-27 14:25:03"
      }
   }
</code>```

I am sure that there is a problem with Nested Document. Following is my code:

```<code>String solrUrl = solrServerUrl.concat(coreName)
                                     .concat("/update/json?wt=json&commit=true");

String customerOrders = gson.toJson(customerFeed.getOrders());

String ListData = Arrays.asList(customerOrders).toString();

HttpEntity<String> requestEntity = new HttpEntity<String>(ListData);

restTemplate.exchange(solrUrl, HttpMethod.POST, requestEntity, String.class);
</code>```

The Data that I am trying to send as a List is converted to Json and becomes:

```<code>[{"placed_orders_count":2.0,"0":{"order_id":"000000001","order_date":"2019-03-27 14:25:03"},"1":{"order_id":"000000002","order_date":"2019-03-27 14:25:03"}}]
</code>```

On Solr, I am only getting "placed_orders_count":[2.0]

How can I index this nested Document

Body:
I am getting a warning on Solr logging as

AtomicUpdateDocumentMerger Unknown operation for the an atomic update, operation ignored: order_id

I am using Spring Data Solr to update my document. My document is:

"orders":{
      "placed_orders_count":2,
      "0":{
         "order_id":"000000001",
         "order_date":"2019-03-27 14:25:03"
      },
      "1":{
         "order_id":"000000002",
         "order_date":"2019-03-27 14:25:03"
      }
   }

I am sure that there is a problem with Nested Document. Following is my code:

String solrUrl = solrServerUrl.concat(coreName)
                                     .concat("/update/json?wt=json&commit=true");

String customerOrders = gson.toJson(customerFeed.getOrders());

String ListData = Arrays.asList(customerOrders).toString();

HttpEntity<String> requestEntity = new HttpEntity<String>(ListData);

restTemplate.exchange(solrUrl, HttpMethod.POST, requestEntity, String.class);

The Data that I am trying to send as a List is converted to Json and becomes:

[{"placed_orders_count":2.0,"0":{"order_id":"000000001","order_date":"2019-03-27 14:25:03"},"1":{"order_id":"000000002","order_date":"2019-03-27 14:25:03"}}]

On Solr, I am only getting "placed_orders_count":[2.0]

How can I index this nested Document


问:
ElasticSearch, C# NEST 7.17 highlevel API - how to exclude filter from aggregations?
ElasticSearch - how to exclude filter from aggregations? discribes "our problem" and also provides the low level (json query) solution.

We'd like to formulate this query ( i.e. filtered aggregations ) using C# NEST high level client. Preferably not the fluent, but the initializer API.

As of know we are using NEST 7.17.x Client

We have tried many combinations of Aggregations Global Terms and Filters, but didn't achieve the expexcted results...


问:
just installed dotnet, dot new console and dotnet --version are working but dotnet run gives error. I'm trying to edit unity scripts from vscode
I'm following this guide to connect unity with VScode.
This guide led me to here

After installing dotnet i run the following commands according to guide and got a long list of errors.

```<code>PS C:\Users\SMME>   dotnet new console --force

Processing post-creation actions...
Running 'dotnet restore' on C:\Users\SMME\SMME.csproj...
  Determining projects to restore...
  Restored C:\Users\SMME\SMME.csproj (in 92 ms).
Restore succeeded.

PS C:\Users\SMME> dotnet --version
6.0.404
PS C:\Users\SMME> dotnet run
C:\Users\SMME\AppData\Local\Programs\Python\Python311\tcl\tix8.4.3\pref\Blue.cs(1,1): error CS1024: Preprocessor directive expected [C:\Users\SMM
E\SMME.csproj]
C:\Users\SMME\AppData\Local\Programs\Python\Python311\tcl\tix8.4.3\pref\Bisque.cs(1,1): error CS1024: Preprocessor directive expected [C:\Users\S
MME\SMME.csproj]
C:\Users\SMME\AppData\Local\Programs\Python\Python311\tcl\tix8.4.3\pref\Blue.cs(2,1): error CS1024: Preprocessor directive expected [C:\Users\SMM
E\SMME.csproj]
C:\Users\SMME\AppData\Local\Programs\Python\Python311\tcl\tix8.4.3\pref\Bisque.cs(2,1): error CS1024: Preprocessor directive expected [C:\Users\S
MME\SMME.csproj]
C:\Users\SMME\AppData\Local\Programs\Python\Python311\tcl\tix8.4.3\pref\Bisque.cs(3,1): error CS1024: Preprocessor directive expected [C:\Users\S
MME\SMME.csproj]
C:\Users\SMME\AppData\Local\Programs\Python\Python311\tcl\tix8.4.3\pref\Blue.cs(3,1): error CS1024: Preprocessor directive expected [C:\Users\SMM
E\SMME.csproj]

Many line of similar errors

C:\Users\SMME\AppData\Local\Programs\Python\Python311\tcl\tix8.4.3\pref\WmDefault.cs(43,42): error CS7000: Unexpected use of an aliased name [C:\
Users\SMME\SMME.csproj]
C:\Users\SMME\AppData\Local\Programs\Python\Python311\tcl\tix8.4.3\pref\WmDefault.cs(43,55): error CS1002: ; expected [C:\Users\SMME\SMME.csproj]

The build failed. Fix the build errors and run again.
</code>```

Contents of SMME.csproj are

```<code><Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net6.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>

</Project>
</code>```

Please help if you have any idea why my original code was not working or this new dotnet installation is not working.

Actually I was using unity and scripting with vscode.
I got stuck here following the pathway from unity learn.

Create a new DetectCollisions.cs script, add it to each animal prefab, then open it

Before the final } add OnTriggerEnter function using autocomplete

In OnTriggerEnter, put Destroy(gameObject);, then test

In OnTriggerEnter, put Destroy(other.gameObject);

My vscode was not autocompleting OnTriggerEnter function, so i manually typed it but didn't work too. I searched for a solution in unity forums, reddit and stack exchange, some suggested to change unity editor settings while other VScode settings but nothing worked.

After trying everyth i deleted VScode completely with extensions and all .NET sdk's that i had installed.

Now i'm trying to install everyth from scratch but I got stuck at very first step.

Body:
I'm following this guide to connect unity with VScode.
This guide led me to here

After installing dotnet i run the following commands according to guide and got a long list of errors.

PS C:\Users\SMME>   dotnet new console --force

Processing post-creation actions...
Running 'dotnet restore' on C:\Users\SMME\SMME.csproj...
  Determining projects to restore...
  Restored C:\Users\SMME\SMME.csproj (in 92 ms).
Restore succeeded.

PS C:\Users\SMME> dotnet --version
6.0.404
PS C:\Users\SMME> dotnet run
C:\Users\SMME\AppData\Local\Programs\Python\Python311\tcl\tix8.4.3\pref\Blue.cs(1,1): error CS1024: Preprocessor directive expected [C:\Users\SMM
E\SMME.csproj]
C:\Users\SMME\AppData\Local\Programs\Python\Python311\tcl\tix8.4.3\pref\Bisque.cs(1,1): error CS1024: Preprocessor directive expected [C:\Users\S
MME\SMME.csproj]
C:\Users\SMME\AppData\Local\Programs\Python\Python311\tcl\tix8.4.3\pref\Blue.cs(2,1): error CS1024: Preprocessor directive expected [C:\Users\SMM
E\SMME.csproj]
C:\Users\SMME\AppData\Local\Programs\Python\Python311\tcl\tix8.4.3\pref\Bisque.cs(2,1): error CS1024: Preprocessor directive expected [C:\Users\S
MME\SMME.csproj]
C:\Users\SMME\AppData\Local\Programs\Python\Python311\tcl\tix8.4.3\pref\Bisque.cs(3,1): error CS1024: Preprocessor directive expected [C:\Users\S
MME\SMME.csproj]
C:\Users\SMME\AppData\Local\Programs\Python\Python311\tcl\tix8.4.3\pref\Blue.cs(3,1): error CS1024: Preprocessor directive expected [C:\Users\SMM
E\SMME.csproj]

Many line of similar errors

C:\Users\SMME\AppData\Local\Programs\Python\Python311\tcl\tix8.4.3\pref\WmDefault.cs(43,42): error CS7000: Unexpected use of an aliased name [C:\
Users\SMME\SMME.csproj]
C:\Users\SMME\AppData\Local\Programs\Python\Python311\tcl\tix8.4.3\pref\WmDefault.cs(43,55): error CS1002: ; expected [C:\Users\SMME\SMME.csproj]

The build failed. Fix the build errors and run again.

Contents of SMME.csproj are

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net6.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>

</Project>

Please help if you have any idea why my original code was not working or this new dotnet installation is not working.

Actually I was using unity and scripting with vscode.
I got stuck here following the pathway from unity learn.

Create a new DetectCollisions.cs script, add it to each animal prefab, then open it

Before the final } add OnTriggerEnter function using autocomplete

In OnTriggerEnter, put Destroy(gameObject);, then test

In OnTriggerEnter, put Destroy(other.gameObject);

My vscode was not autocompleting OnTriggerEnter function, so i manually typed it but didn't work too. I searched for a solution in unity forums, reddit and stack exchange, some suggested to change unity editor settings while other VScode settings but nothing worked.

After trying everyth i deleted VScode completely with extensions and all .NET sdk's that i had installed.

Now i'm trying to install everyth from scratch but I got stuck at very first step.


问:
Android devices handling 'long press' differently
I have created my first website (a Wordle variant) using basic javascript. I want the users to be able to 'long press' keys on the on-screen keyboard to turn them dark (which signifies that the letter has been 'ruled out').  A further 'long press' (e.g. if the user has made a mistake) will cancel the keyboard effect. I initially used a library I found to handle the long press / long click events but the issue apparently also occurs with a radically simpler bit of code.

The problem is that this shows unexpected behaviour on android devices.  However I'm just a hobbyist and don't have access to my own android device to do proper testing.

The expected behaviour on a touchscreen device is:

user presses the object

if the user holds on the object for 1 second it fires a single long-press event (regardless of when they release their finger).  It's important that only a single event is fired because the same long-press interaction is used to cancel the effect on the keyboard

if the user doesn't hold on the object for long enough, a press event is fired (although I am also listening for other events which may fire instead)

It works fine on my iOS devices and mac and windows desktop.

However some Android users (I'm not sure if it's all Android users, but I've only had this from Android users) report that in order to make the long-press event fire they have to hold for just long enough and then release.  If they hold for too long then it appears that multiple events fire (often multiple 'long press' events).  This makes no sense to me.

I've searched for other questions that might give a clue as to how / why android handles touch events differently but not found anything that seems to reflect the problem some of my users are having.

var node = document.getElementsByTagName("p")[0];
var longpress = false;
var presstimer = null;
var longtarget = null;

var cancel = function(e) {
    if (presstimer !== null) {
        clearTimeout(presstimer);
        presstimer = null;
    }

    this.classList.remove("longpress");
};

var click = function(e) {
    if (presstimer !== null) {
        clearTimeout(presstimer);
        presstimer = null;
    }

    this.classList.remove("longpress");

    if (longpress) {
        return false;
    }

    alert("press");
};

var start = function(e) {

    if (e.type === "click" && e.button !== 0) {
        return;
    }

    longpress = false;

    this.classList.add("longpress");

    presstimer = setTimeout(function() {
        alert("long press");
        longpress = true;
    }, 1000);

    return false;
};

node.addEventListener("mousedown", start);

node.addEventListener("touchstart", start);
node.addEventListener("click", click);
node.addEventListener("mouseout", cancel);
node.addEventListener("touchend", cancel);
node.addEventListener("touchleave", cancel);
node.addEventListener("touchcancel", cancel);```
<pre class="snippet-code-css lang-css prettyprint-override"><code>p {
    background: red;
    padding: 100px;
}

.longpress {
    -webkit-animation: 1s longpress;
            animation: 1s longpress;
}

@-webkit-keyframes longpress {
    0%, 20% { background: red; }
    100% { background: yellow; }
}

@keyframes longpress {
    0%, 20% { background: red; }
    100% { background: yellow; }
}</code>```

```

Body:
I have created my first website (a Wordle variant) using basic javascript. I want the users to be able to 'long press' keys on the on-screen keyboard to turn them dark (which signifies that the letter has been 'ruled out').  A further 'long press' (e.g. if the user has made a mistake) will cancel the keyboard effect. I initially used a library I found to handle the long press / long click events but the issue apparently also occurs with a radically simpler bit of code.

The problem is that this shows unexpected behaviour on android devices.  However I'm just a hobbyist and don't have access to my own android device to do proper testing.

The expected behaviour on a touchscreen device is:

user presses the object

if the user holds on the object for 1 second it fires a single long-press event (regardless of when they release their finger).  It's important that only a single event is fired because the same long-press interaction is used to cancel the effect on the keyboard

if the user doesn't hold on the object for long enough, a press event is fired (although I am also listening for other events which may fire instead)

It works fine on my iOS devices and mac and windows desktop.

However some Android users (I'm not sure if it's all Android users, but I've only had this from Android users) report that in order to make the long-press event fire they have to hold for just long enough and then release.  If they hold for too long then it appears that multiple events fire (often multiple 'long press' events).  This makes no sense to me.

I've searched for other questions that might give a clue as to how / why android handles touch events differently but not found anything that seems to reflect the problem some of my users are having.

var node = document.getElementsByTagName("p")[0];
var longpress = false;
var presstimer = null;
var longtarget = null;

var cancel = function(e) {
    if (presstimer !== null) {
        clearTimeout(presstimer);
        presstimer = null;
    }

    this.classList.remove("longpress");
};

var click = function(e) {
    if (presstimer !== null) {
        clearTimeout(presstimer);
        presstimer = null;
    }

    this.classList.remove("longpress");

    if (longpress) {
        return false;
    }

    alert("press");
};

var start = function(e) {

    if (e.type === "click" && e.button !== 0) {
        return;
    }

    longpress = false;

    this.classList.add("longpress");

    presstimer = setTimeout(function() {
        alert("long press");
        longpress = true;
    }, 1000);

    return false;
};

node.addEventListener("mousedown", start);

node.addEventListener("touchstart", start);
node.addEventListener("click", click);
node.addEventListener("mouseout", cancel);
node.addEventListener("touchend", cancel);
node.addEventListener("touchleave", cancel);
node.addEventListener("touchcancel", cancel);

p {
    background: red;
    padding: 100px;
}

.longpress {
    -webkit-animation: 1s longpress;
            animation: 1s longpress;
}

@-webkit-keyframes longpress {
    0%, 20% { background: red; }
    100% { background: yellow; }
}

@keyframes longpress {
    0%, 20% { background: red; }
    100% { background: yellow; }
}


问:
Cython: C function definition not allowed here
I tried to build pyqt app with cython static typing,
and when I set type of parameter I'll give me error !</p>
```<code>def Ui_MainWindow(object):
    cpdef object setupUi(object self, object MainWindow):
</code>```
```<code>def Ui_MainWindow(object):
    cpdef object setupUi(object self, object MainWindow):
                                                       ^
------------------------------------------------------------

test.pyx:8:56: C function definition not allowed here
</code>```

Body:
I tried to build pyqt app with cython static typing,
and when I set type of parameter I'll give me error !

def Ui_MainWindow(object):
    cpdef object setupUi(object self, object MainWindow):

def Ui_MainWindow(object):
    cpdef object setupUi(object self, object MainWindow):
                                                       ^
------------------------------------------------------------

test.pyx:8:56: C function definition not allowed here


问:
Is there any extension for checking json object key present or not in VS code
Hi I am working on JS files, I have imported the JSON file which contains JSON objects,
If there is some typing mistake while using the key of an object it does not give any (error)red squiggly.
So is there any vs code extension present for it which can check it and show me an error?

I searched a lot on google but couldn't find anything, help is appreciated.


问:
I want to find out the data for 1st of a month till 8th of a month. How do I do it using SQL
I want to find out the data for 1st of a month till 8th of a month. How do I do it using SQL

used extract function in where clause

```<code>EXTRACT(month FROM order_date) in (03,04,05,06,07,08,09,10,11,12) and EXTRACT(day FROM order_date) in (01,02,03,04,05,06,07,08) and EXTRACT(year FROM order_date) = 2022
</code>```

Body:
I want to find out the data for 1st of a month till 8th of a month. How do I do it using SQL

used extract function in where clause

EXTRACT(month FROM order_date) in (03,04,05,06,07,08,09,10,11,12) and EXTRACT(day FROM order_date) in (01,02,03,04,05,06,07,08) and EXTRACT(year FROM order_date) = 2022


问:
VBA - chart with same scale
I want to create a chart with same x and y scale. The following code works when I plot a square, not when I plot a rectangle.
For example, if the ratio of the side Y and side Z is 2, the ratio of PlotAreaInsideWidth and PlotAreaInsideHeight is computed as 2, and yet, the chart is plotted with a different ratio.
I cannot figure out why. Any Idea to help me?</p>
```<code>maxSide = WorksheetFunction.Max(Yside, Zside)
PlotAreaTop = 0
PlotAreaLeft = 0
PlotAreaInsideWidth = Yside / maxSide * ChartWidth * 0.75
PlotAreaInsideHeight = Zside / maxSide * ChartWidth * 0.75
With cht.Axes(xlCategory) ' horizontal axis
    .HasTitle = False
    .HasMajorGridlines = False
    .HasMinorGridlines = False
    .MinimumScale = -Yside / 2
    .MaximumScale = Yside / 2
    .TickLabelPosition = xlNone
End With
With cht.Axes(xlValue) ' vertical axis
    .HasTitle = False
    .HasMajorGridlines = False
    .HasMinorGridlines = False
    .MinimumScale = -Zside / 2
    .MaximumScale = Zside / 2
    .TickLabelPosition = xlNone
End With
With cht.PlotArea ' plot area
    .Select
    With Selection
        .Top = PlotAreaTop
        .Left = PlotAreaLeft
        .InsideWidth = PlotAreaInsideWidth
        .InsideHeight = PlotAreaInsideHeight
    End With
End With
</code>```

Title: VBA - chart with same scale

Body:
I want to create a chart with same x and y scale. The following code works when I plot a square, not when I plot a rectangle.
For example, if the ratio of the side Y and side Z is 2, the ratio of PlotAreaInsideWidth and PlotAreaInsideHeight is computed as 2, and yet, the chart is plotted with a different ratio.
I cannot figure out why. Any Idea to help me?

maxSide = WorksheetFunction.Max(Yside, Zside)
PlotAreaTop = 0
PlotAreaLeft = 0
PlotAreaInsideWidth = Yside / maxSide * ChartWidth * 0.75
PlotAreaInsideHeight = Zside / maxSide * ChartWidth * 0.75
With cht.Axes(xlCategory) ' horizontal axis
    .HasTitle = False
    .HasMajorGridlines = False
    .HasMinorGridlines = False
    .MinimumScale = -Yside / 2
    .MaximumScale = Yside / 2
    .TickLabelPosition = xlNone
End With
With cht.Axes(xlValue) ' vertical axis
    .HasTitle = False
    .HasMajorGridlines = False
    .HasMinorGridlines = False
    .MinimumScale = -Zside / 2
    .MaximumScale = Zside / 2
    .TickLabelPosition = xlNone
End With
With cht.PlotArea ' plot area
    .Select
    With Selection
        .Top = PlotAreaTop
        .Left = PlotAreaLeft
        .InsideWidth = PlotAreaInsideWidth
        .InsideHeight = PlotAreaInsideHeight
    End With
End With


Title: How to set a specific column of the last row of a dataframe

Body:
I have a dataframe where the last row has a Nan

something like

   A,B,C
94,35.8621497534,139.8811398413,23.075931722607212
95,35.8621915301,139.8811617064,23.013675634522304
96,35.8622333249,139.8811835151,22.93392191824463
97,35.8622751476,139.881205254,22.98818503390619
98,35.8623169559,139.8812270428,23.12554949571689
99,35.8623587254,139.8812489567,23.269025725355807
100,35.8624004417,139.8812709946,23.080210277956407
101,35.8624422121,139.881292861,Nan

I am trying to change that Nan to the previous row value (23.080210277956407) but I cannot do it
I get an error

SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

I have tried several methods like

rowi=df.shape[0]
df.iloc[row-1]['C']=df.tail(2)['C'].iloc[0]

but this does not modify anything

How can I set the last value of column 'C' to be the same as the previous value?


问:
Object detection of untrained Class
I have a dataset of only cat images. After training for object detection using fasterRCNN . I have to detect objects which are not cats let's say dogs. How do I do it ?

I have trained on cats using faster RCNN and I put a threshold of 0.95. so which ever region there isn't a bounding box I am assuming there is a non cat . But I am not getting good results.

Title: Object detection of untrained Class


问:
Next-Auth SIGNIN_OAUTH_ERROR on google provider
I implemented login with next-auth. The signin and signout for google provider work on the index page but when I visit to another page the signing attempt gives an error like in below:

```<code>TypeError [ERR_INVALID_ARG_TYPE]: The "listener" argument must be of type function. Received an instance of Object
</code>```

I use signIn and signOut method like in the below:

```<code>await signIn(provider.id, {callbackUrl: "/"})
await signOut({callbackUrl: "/"})
</code>```

Here is how I set google provider in the nextauth setings:

```<code>GoogleProvider({
  clientId: process.env.NEXT_PUBLIC_GOOGLE_CLIENT_ID,
  clientSecret: process.env.NEXT_PUBLIC_GOOGLE_CLIENT_SECRET,
  authorization: {
    params: {
      prompt: 'consent',
      access_type: 'offline',
      response_type: 'code',
    },
  },
}),
</code>```

I also set NEXTAUTH_SECRET parameter in the nextauth settings

```<code>secret: process.env.NEXTAUTH_SECRET
</code>```

How can I solve this problem?

Thanks in advance

Body:
I implemented login with next-auth. The signin and signout for google provider work on the index page but when I visit to another page the signing attempt gives an error like in below:

TypeError [ERR_INVALID_ARG_TYPE]: The "listener" argument must be of type function. Received an instance of Object

I use signIn and signOut method like in the below:

await signIn(provider.id, {callbackUrl: "/"})
await signOut({callbackUrl: "/"})

Here is how I set google provider in the nextauth setings:

GoogleProvider({
  clientId: process.env.NEXT_PUBLIC_GOOGLE_CLIENT_ID,
  clientSecret: process.env.NEXT_PUBLIC_GOOGLE_CLIENT_SECRET,
  authorization: {
    params: {
      prompt: 'consent',
      access_type: 'offline',
      response_type: 'code',
    },
  },
}),

I also set NEXTAUTH_SECRET parameter in the nextauth settings

secret: process.env.NEXTAUTH_SECRET

How can I solve this problem?

Thanks in advance


问:
Greedy Graph coloring based on reinforcement learning
Can anyone please let me know if there are any graph based reinforcement learning environments (like networkx for normal graph problems). My aim is to develop a reinforcement learning environment for solving graph based problems like greedy graph coloring.</p>


问:
Python Unittest: How to unittest a decorator in python?
Here's my sample code which I want to test.

decorator.py

```<code>def token_required(f):
    @wraps(f)
    def decorated(*args, **kwargs):
        data_header = request.headers['Authorization']
        token = str.replace(str(data_header), 'Bearer ', '')
        if not token:
            return jsonify({'Message':'Token is missing'}), 401
        try:
            data = jwt.decode(token, "mysecret", algorithms=['HS256'])
        except jwt.InvalidTokenError:
            return make_response({'Message':'Invalid Token!'}, 403)
        return f(data, *args, **kwargs)

    return decorated

</code>```

get_user_uid.py

```<code>@getuid_bp.route('/users/<uid>', methods=['GET'])
@token_required
def profile_view(data, uid):
    profile_data = service_profile(data, uid)
    return profile_data

</code>```

data in profile_view(data, uid) is jwt decode value.

I need to test functionalities present in the decorator such as "Token is missing" & "invalid token".

This is what I've tried.

```<code>
    def test_service_user_profile(self):

        data = {
            "address": "Ahmedabad",
            "dob": "2022-06-07T23:16:20",
            "email_address": "testuser58@example.com",
            "password": "sha256$WbLrMDWEUHKvLDSC$2a051f8689222fc9815cd00da2c3260e114c313ba20edebf8df17e6d409721ac",
            "uid": "75f9d2c5570f4c7bb5e28c5807f92c48",
            "user_name": "testuser58"
             }

        encoded_jwt = jwt.encode(data, "mysecret", algorithm="HS256")
        decoded_jwt = jwt.decode(encoded_jwt, "mysecret", algorithms="HS256")

        data_header = f'Bearer {encoded_jwt}'

        m1 = mock.MagicMock()
        m1.headers.return_value = data_header
        print("m", m1)

        response = profile_view(data,"75f9d2c5570f4c7bb5e28c5807f92c48")
        # mock_profile.assert_called_once()

</code>```

But I'm confused about how to set data in profile_view(data, uid): and how to test the decorator. I've tried to mock the request in decorator but I don't know whether it is right or wrong.

Body:
Here's my sample code which I want to test.

decorator.py

def token_required(f):
    @wraps(f)
    def decorated(*args, **kwargs):
        data_header = request.headers['Authorization']
        token = str.replace(str(data_header), 'Bearer ', '')
        if not token:
            return jsonify({'Message':'Token is missing'}), 401
        try:
            data = jwt.decode(token, "mysecret", algorithms=['HS256'])
        except jwt.InvalidTokenError:
            return make_response({'Message':'Invalid Token!'}, 403)
        return f(data, *args, **kwargs)

    return decorated

get_user_uid.py

@getuid_bp.route('/users/<uid>', methods=['GET'])
@token_required
def profile_view(data, uid):
    profile_data = service_profile(data, uid)
    return profile_data

data in profile_view(data, uid) is jwt decode value.

I need to test functionalities present in the decorator such as "Token is missing" & "invalid token".

This is what I've tried.

    def test_service_user_profile(self):

        data = {
            "address": "Ahmedabad",
            "dob": "2022-06-07T23:16:20",
            "email_address": "testuser58@example.com",
            "password": "sha256$WbLrMDWEUHKvLDSC$2a051f8689222fc9815cd00da2c3260e114c313ba20edebf8df17e6d409721ac",
            "uid": "75f9d2c5570f4c7bb5e28c5807f92c48",
            "user_name": "testuser58"
             }

        encoded_jwt = jwt.encode(data, "mysecret", algorithm="HS256")
        decoded_jwt = jwt.decode(encoded_jwt, "mysecret", algorithms="HS256")

        data_header = f'Bearer {encoded_jwt}'

        m1 = mock.MagicMock()
        m1.headers.return_value = data_header
        print("m", m1)

        response = profile_view(data,"75f9d2c5570f4c7bb5e28c5807f92c48")
        # mock_profile.assert_called_once()

But I'm confused about how to set data in profile_view(data, uid): and how to test the decorator. I've tried to mock the request in decorator but I don't know whether it is right or wrong.


问:
difflib.get_close_matches is not giving any output when I compared 2 columns in pandas dataframe
I have 2 pandas dataframes, one with clean city names(df2) and another with unclean city names(df1).

sample values:

df2.city_name: bangalore

df1.city_name: bongolor

I tried to use the below code to get the close match for the city name

city_names=df2.city_name.to_list()

for i in df1.city_name:
difflib.get_close_matches(i,city_names)

This is running for a very long time (more than an hour, so I stopped it).

I had tried fuzzywuzzy process as well. PFB:

list1=df1.city_name.to_list()
list2=df2.city_name.to_list()

mat1=[]

for i in list1:
mat1.append(process.extract(i, list2, limit=10))

df1['match']=mat1

This was also taking a very long time so I killed it.

Is there an optimized way to compare the column values and get the closer state name?

Note: my df1.city_names are 3.3M and df2.city_names are 2.7k


问:
prisma connectOrCreate create duplicates or return error
I'm trying to seed a bunch of records, on a table that has a many-to-many relationships with another table.

```<code>model Resume {
  id          Int       @id @default(autoincrement())
  name        String
  company     String?
  logo        String?
  description String?
  startDate   DateTime?
  endDate     DateTime?
  createdAt   DateTime? @default(now()) @map("created_at")
  updatedAt   DateTime? @map("updated_at")
  deletedAt   DateTime? @map("deleted_at")
  tags        ResumeTag[]

  @@map("resume")
}

model ResumeTag {
  id          Int       @id @default(autoincrement())
  name        String    @unique
  resume      Resume[]

  @@map("resume_tags")
}

</code>```

on script this is what i use using connectOrCreate ( removed other parts, but this is the gist of it):

```<code>const resumeSingle = {
    id: 1,
    company: 'Company A',
    name: 'Software Developer',
    logo: 'Logo.svg',
    description: '',
    startDate: moment('2016-06-01').toISOString(),
    endDate: null,
    tags: ['Node.JS', 'GraphQL', 'PostgreSQL']
  };
const { tags, ...resumeData} = resumeSingle;

await prisma.resume.create({
 data: {
  ...resumeData,
   tags: {
    connectOrCreate: tags.map(tag => ({
      where: { name: tag }, create:  { name: tag }
    }))
   },
  },
 });
</code>```

I have several records to insert, some with same repeated tags. However the code only stops with error when a new records has a tag already in the db.

```<code>Unique constraint failed on the constraint: `name`.
</code>```

If I remove the unique on name column in ResumeTag it just add duplicated in the db table (with the same name).

I'm using connectOrCreate wrong here?

Body:
I'm trying to seed a bunch of records, on a table that has a many-to-many relationships with another table.

model Resume {
  id          Int       @id @default(autoincrement())
  name        String
  company     String?
  logo        String?
  description String?
  startDate   DateTime?
  endDate     DateTime?
  createdAt   DateTime? @default(now()) @map("created_at")
  updatedAt   DateTime? @map("updated_at")
  deletedAt   DateTime? @map("deleted_at")
  tags        ResumeTag[]

  @@map("resume")
}

model ResumeTag {
  id          Int       @id @default(autoincrement())
  name        String    @unique
  resume      Resume[]

  @@map("resume_tags")
}

on script this is what i use using connectOrCreate ( removed other parts, but this is the gist of it):

const resumeSingle = {
    id: 1,
    company: 'Company A',
    name: 'Software Developer',
    logo: 'Logo.svg',
    description: '',
    startDate: moment('2016-06-01').toISOString(),
    endDate: null,
    tags: ['Node.JS', 'GraphQL', 'PostgreSQL']
  };
const { tags, ...resumeData} = resumeSingle;

await prisma.resume.create({
 data: {
  ...resumeData,
   tags: {
    connectOrCreate: tags.map(tag => ({
      where: { name: tag }, create:  { name: tag }
    }))
   },
  },
 });

I have several records to insert, some with same repeated tags. However the code only stops with error when a new records has a tag already in the db.

Unique constraint failed on the constraint: `name`.

If I remove the unique on name column in ResumeTag it just add duplicated in the db table (with the same name).

I'm using connectOrCreate wrong here?


问:
" error: metrics not available yet " even metrics-server is running
I am new to kubernetes and was trying to create horizontal auto scaler. For this I deployed metrics server. I used the official gitHub repository for metrics-server. I can see the process running as below

```<code>NAME                                 READY   STATUS    RESTARTS   AGE
pod/metrics-server-766c9b8df-dltgd   1/1     Running   0          13m

NAME                     TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)                  AGE
service/metrics-server   ClusterIP   10.106.14.34   <none>        443/TCP                  37m

NAME                             READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/metrics-server   1/1     1            1           37m
</code>```

I deployed a pod which is running on the worker nodes and hence I can see below metrics

```<code>ubuntu@master:~/metrics-server$ kubectl top pods
NAME                          CPU(cores)   MEMORY(bytes)
demo-deploy-d86b8cfcc-2jg9w   2m           289Mi
demo-deploy-d86b8cfcc-5xtww   1m           284Mi
demo-deploy-d86b8cfcc-hk2bq   1m           278Mi
demo-deploy-d86b8cfcc-jkdmc   1m           286Mi
</code>```

But issue is

```<code>ubuntu@master:~/metrics-server$ kubectl top nodes
error: metrics not available yet
</code>```

I searched a lot but my bad I couldn't get answer for this. Can someone help me why it is so?

```<code>ubuntu@master:~/metrics-server$ kubectl top nodes
</code>```

this should show the metrics for the worker nodes. But to my bad I am not getting it. Not even blank status.

Body:
I am new to kubernetes and was trying to create horizontal auto scaler. For this I deployed metrics server. I used the official gitHub repository for metrics-server. I can see the process running as below

NAME                                 READY   STATUS    RESTARTS   AGE
pod/metrics-server-766c9b8df-dltgd   1/1     Running   0          13m

NAME                     TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)                  AGE
service/metrics-server   ClusterIP   10.106.14.34   <none>        443/TCP                  37m

NAME                             READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/metrics-server   1/1     1            1           37m

I deployed a pod which is running on the worker nodes and hence I can see below metrics

ubuntu@master:~/metrics-server$ kubectl top pods
NAME                          CPU(cores)   MEMORY(bytes)
demo-deploy-d86b8cfcc-2jg9w   2m           289Mi
demo-deploy-d86b8cfcc-5xtww   1m           284Mi
demo-deploy-d86b8cfcc-hk2bq   1m           278Mi
demo-deploy-d86b8cfcc-jkdmc   1m           286Mi

But issue is

ubuntu@master:~/metrics-server$ kubectl top nodes
error: metrics not available yet

I searched a lot but my bad I couldn't get answer for this. Can someone help me why it is so?

ubuntu@master:~/metrics-server$ kubectl top nodes

this should show the metrics for the worker nodes. But to my bad I am not getting it. Not even blank status.


问:
React-app can not go live on Github pages
I am having a difficulity with react-app in getting it to go live on github pages.

I created react-app and pushed it to remote repository on github.

Then, I set up gh-pages by having modified package.json like so:

"homepage":"my-github-username/github.io/my-projectName",

then, scroll down to script property and add:

"predeploy" : "npm run build",
"deploy" : "gh-pages -d build",

then, I put the commit for the changes and push it again.

After that, in hyper terminal I typed:

npm run deploy

and
hit enter.

then, I check it on github in pages section. I found 2 brances which are "main" and "gh-pages"

Then, I choosed gh-pages and save it like so:

by doing so, it showing that my site is going live at below link like so:

but when I click on the link , it is not working and doesn't show the web page.

so, I have no idea how to fix this to get web app to go live on github pages.

Thank you

Aung


问:
Gradle dependency fallback
Is there a way to use fallback dependency in gradle.

For example, there is dependency com.example.module:artifact:version.

How can I "ask" gradle do not crash building if no this artifact found on any of specified repositories, but try to use com.example.fallback_module:vallback_artifact:fallback_version instead?

Title: Gradle dependency fallback


问:
How to create report template jspdf in html
i want to create report use jspdf with template like this

This is image i want

How to create template like above, i never seen in google


问:
Display message in cart if cart items count is less than 5 in Shopify
I have a bulk discount offer when buying at least 5 products. I'd like to display a message on the cart page if the items count would be less than 5.

How could I get the cart item information in javascript and thereafter display a message?

This is what I have now, but it isn't working:

$.ajax({
    type: 'GET',
    url: 'https://myshop.myshopify.com/cart.js',
    dataType: 'jsonp',
    success: function(data) {
        var item_count = data['item_count'];

        if (item_count > 5) {
          document.getElementById("cart-discount-message").innerHTML = "Add more products to get 25% discount";
        }
    }
});
```


问:
Data link issue-Grafana
i have a grafana link eg::http://10.14.116.3:3000/d/3DswEOcVz/single-transaction?orgId=13&viewPanel=2, what do i need add to link above in another dashboard table to filter based on the txn ID value i clicked. The two tables have similar columns.
enter image description here

if I click 7054890 in one table, in the linked table, it should only show record for 7054890

Title: Data link issue-Grafana


问:
Github Manual Workflow syntax
I got this problem with GitHub's manual workflow .yml file: It just keeps on failing due to the .yml syntax. What am I doing wrong?screenshot

Im trying to make it syntax-correct

Title: Github Manual Workflow syntax


问:
Using SignalR.Client in Unity - The method or operation is not implemented
I want to use SignalR in a UWP project on the HoloLens 2 and my application is partially running (one way works, one not).

The way it doesn't work

It does not run, when I have HTTPS-Redirection on my .Net-6-Web-API Server enabled and try to ignore it via the ServerCertificateCustomValidationCallback line on unity side.

.Net 6-Project:

app.UseHttpsRedirection(); is active

Unity:

```<code>private void Start()
{
    _hubConnection = new HubConnectionBuilder()
    .WithUrl("http://192.168.178.41:5266/Signaler", (opts) =>
    {
        opts.HttpMessageHandlerFactory = (message) =>
        {
             // bypass SSL certificate
             if (message is HttpClientHandler clientHandler)
             {
                  clientHandler.ServerCertificateCustomValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true;
             }
            return message;
     };})
     .WithAutomaticReconnect()
     .Build();

     Connect();
}

private async Task Connect()
{
   _hubConnection.On<string>("SomeKey", (key) =>
   {
       Debug.Log($"New Key: {key}");
   });

   try
   {
       await _hubConnection.StartAsync(tokenSource.Token);
   }
   catch (Exception ex)
   { ... }
}
</code>```

The error (shorted text) I get:

```<code>System.NotImplementedException: The method or operation is not implemented.
  at XXXXX.Network.MySignalRClient+<>c.<Start>b__1_1 (System.Net.Http.HttpMessageHandler message) [0x0000a] in D:\Repositories\XXXXX\Unity\XXXXX\Assets\Scripts\NetworkClients\MySignalRClient.cs:31
  at Microsoft.AspNetCore.Http.Connections.Client.HttpConnection.CreateHttpClient () [0x00118] in <d4f814eb48994df3870fe7c8338cc73a>:0
  at Microsoft.AspNetCore.Http.Connections.Client.HttpConnection..ctor (Microsoft.AspNetCore.Http.Connections.Client.HttpConnectionOptions httpConnectionOptions, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory) [0x0009f] in <d4f814eb48994df3870fe7c8338cc73a>:0
</code>```

The mentioned line 31 is the line with the ServerCertificateCustomValidationCallback.

How does the application work?

If I  disable the HTTPS-Redirection and remove the lines with the callback:

```<code>_hubConnection = new HubConnectionBuilder()
    .WithUrl("http://192.168.178.41:5266/Signaler")
    .WithAutomaticReconnect()
    .Build();
</code>```

Expected Behavior

HTTPS redirection should not be disabled extra on the server side, but the line with the callback on unity side should be enough.

SignalR Version

Microsoft.AspNetCore.SignalR.Client.7.0.0 and all needed referenced Libraries for .Net Standard 2.0

Anything else?

Typical Setup:

Some DLLs are missing in the screenshot, because they are already included by other plugins that I use in Unity. The following packages are not shown: System.Buffers, System.Memory, System.Numerics.Vectors, System.Runtime.CompilerServices.Unsafe

Another project:

I also created another empty .Net-6-Project in Visual Studio  with  Microsoft.AspNetCore.SignalR.Client.7.0.0 to check if I can connect, trigger the hub and get notified by the hub. There I use exactly the same lines to bypass the ssl certification and it works. So I guess there is something wrong with the .Net Standard 2.0 DLLs?

Body:
I want to use SignalR in a UWP project on the HoloLens 2 and my application is partially running (one way works, one not).

The way it doesn't work

It does not run, when I have HTTPS-Redirection on my .Net-6-Web-API Server enabled and try to ignore it via the ServerCertificateCustomValidationCallback line on unity side.

.Net 6-Project:

app.UseHttpsRedirection(); is active

Unity:

private void Start()
{
    _hubConnection = new HubConnectionBuilder()
    .WithUrl("http://192.168.178.41:5266/Signaler", (opts) =>
    {
        opts.HttpMessageHandlerFactory = (message) =>
        {
             // bypass SSL certificate
             if (message is HttpClientHandler clientHandler)
             {
                  clientHandler.ServerCertificateCustomValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true;
             }
            return message;
     };})
     .WithAutomaticReconnect()
     .Build();

     Connect();
}

private async Task Connect()
{
   _hubConnection.On<string>("SomeKey", (key) =>
   {
       Debug.Log($"New Key: {key}");
   });

   try
   {
       await _hubConnection.StartAsync(tokenSource.Token);
   }
   catch (Exception ex)
   { ... }
}

The error (shorted text) I get:

System.NotImplementedException: The method or operation is not implemented.
  at XXXXX.Network.MySignalRClient+<>c.<Start>b__1_1 (System.Net.Http.HttpMessageHandler message) [0x0000a] in D:\Repositories\XXXXX\Unity\XXXXX\Assets\Scripts\NetworkClients\MySignalRClient.cs:31
  at Microsoft.AspNetCore.Http.Connections.Client.HttpConnection.CreateHttpClient () [0x00118] in <d4f814eb48994df3870fe7c8338cc73a>:0
  at Microsoft.AspNetCore.Http.Connections.Client.HttpConnection..ctor (Microsoft.AspNetCore.Http.Connections.Client.HttpConnectionOptions httpConnectionOptions, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory) [0x0009f] in <d4f814eb48994df3870fe7c8338cc73a>:0

The mentioned line 31 is the line with the ServerCertificateCustomValidationCallback.

How does the application work?

If I  disable the HTTPS-Redirection and remove the lines with the callback:

_hubConnection = new HubConnectionBuilder()
    .WithUrl("http://192.168.178.41:5266/Signaler")
    .WithAutomaticReconnect()
    .Build();

Expected Behavior

HTTPS redirection should not be disabled extra on the server side, but the line with the callback on unity side should be enough.

SignalR Version

Microsoft.AspNetCore.SignalR.Client.7.0.0 and all needed referenced Libraries for .Net Standard 2.0

Anything else?

Typical Setup:

Some DLLs are missing in the screenshot, because they are already included by other plugins that I use in Unity. The following packages are not shown: System.Buffers, System.Memory, System.Numerics.Vectors, System.Runtime.CompilerServices.Unsafe

Another project:

I also created another empty .Net-6-Project in Visual Studio  with  Microsoft.AspNetCore.SignalR.Client.7.0.0 to check if I can connect, trigger the hub and get notified by the hub. There I use exactly the same lines to bypass the ssl certification and it works. So I guess there is something wrong with the .Net Standard 2.0 DLLs?


问:
Windows 10 Backup - Delete old data backups automatically
Good morning,

we have some computers that create a backup by week, in a external drive (since 2-3 months).

The problem is that Windows 10 isn't deleting old backups and drive is being full so fast. I want to know if it exists some way to do this task automatically, because now I am deleting old backups manually and I think that this task should be done in some easier way.

In the following example, I have backups from July 31, and all of the backups are 352,51 GB:
image

Kind regards, Iggy.


问:
How to do conditional color formatting of horizontal lines (constant lines) in the clustered column chart in Power BI
Basically, I have 2 lines placed horizontally on the chart, that are line 1 and line 2.
Now based on line1's value, I want to change the line2's color either red or green (like line1>line2=greed else red)

I am struggling as Power BI desktop does not provide property currently where I can add DAX formula for color coding for constant lines.
I am using clustered column chart.

But i am sure that there would be some solution there via workaround.
Please see the attached screen shot.


问:
How do I create a new WordPress user that can create other users with specific roles?
I use the User Role Editor plugin. I have created a new user type that can create new users. However, I would like this user not to have the ability to create administrators.

Here are the capabilities of my new user type if it helps.

My new user capabilities


问:
What are the names of the graphs used in the NAPLAN? Anyone know how to plot them?
In Australia we have a test for students called NAPLAN.
The results are provided in a sort of band graph mixed with a box and whisker.
Does anyone know what they are called?

They are good because they show total range, Where the student falls in the band. What the national average is and what the students class average is.
essentially 4 data points on 1 graph.


问:
How to display data from Mysql to EJS template with WHERE clause? such as ID
how can i display the data from Node JS and Mysql db to EJS template with WHERE clause such as id, username or email.

i try this code from Node server.js with hard coded id no. 2 and i want to display this select from mysql to EJS template with where Clause id

```<code>router.get("/users", (req, res) => {

    db.query('SELECT * FROM users WHERE id = 2', function (err, result) {
        if (err) throw err;

        ///res.render() function
        res.render('users', {data: result});
      });
    // res.render("users")
})

I want this to be display in input type values like this

<input type="text" value="<%= data.id %>">

</code>```

Body:
how can i display the data from Node JS and Mysql db to EJS template with WHERE clause such as id, username or email.

i try this code from Node server.js with hard coded id no. 2 and i want to display this select from mysql to EJS template with where Clause id

router.get("/users", (req, res) => {

    db.query('SELECT * FROM users WHERE id = 2', function (err, result) {
        if (err) throw err;

        ///res.render() function
        res.render('users', {data: result});
      });
    // res.render("users")
})

I want this to be display in input type values like this

<input type="text" value="<%= data.id %>">


问:
Async loop running in another process; tasks and loop are closed but the process is hanging
I'm running an async function(download files) in a separate process. The data between processes is
passed using multiprocessing queues.

in main file/module:

```<code>to_download_mpq = Queue()
downloaded_mpq = Queue()

...................

pd = Process(target=async_download_items,
                 args=(to_download_mpq, downloaded_mpq))

pd.start()
pd.join()
print("end_process")
</code>```

in a separate file:

```<code># transfer data between async queues and multiprocessing queues when is ready
   async def download_piping(to_download_q, downloaded_q, to_download_mpq, downloaded_mpq, sentinel):

    to_download_sentinel = False
    downloaded_sentinel = False

    while not (to_download_sentinel and downloaded_sentinel):
        if not to_download_sentinel:
            to_download_item = to_download_mpq.get()
            await to_download_q.put(to_download_item)
            await asyncio.sleep(0.1)
            if to_download_item == sentinel:
                to_download_sentinel = True

        if not downloaded_sentinel:
            if downloaded_q.empty():
                await asyncio.sleep(2)
            else:
                downloaded_item = await downloaded_q.get()
                downloaded_mpq.put(downloaded_item)
                await asyncio.sleep(0)
                if downloaded_item == sentinel:
                    downloaded_sentinel = True
</code>```
```<code>async def download_tasks(to_download_mpq, downloaded_mpq, workers, sentinel=END_QUEUE_SENTINEL, queue_size=50):

    downloader = download.AsyncDownloader() # async downloader class using aiohttp
    to_download_lq = asyncio.Queue(queue_size)
    downloaded_lq = asyncio.Queue(queue_size)

    task_download = asyncio.create_task(downloader.download_files(to_download_q=to_download_lq,
                                                                  downloaded_q=downloaded_lq,
                                                                  download_workers=workers,
                                                                  sentinel=sentinel))

    task_piping = asyncio.create_task(download_piping(to_download_lq, downloaded_lq,
                                                      to_download_mpq, downloaded_mpq,
                                                      sentinel=sentinel))
    await asyncio.gather(task_download, task_piping)
</code>```
```<code>def async_download_items(to_download_mpq, downloaded_mpq, workers=50):
    loop = asyncio.get_event_loop()
    print(loop)
    loop.run_until_complete(download_tasks(to_download_mpq, downloaded_mpq, workers=workers))
    loop.close()
    print("end async")
</code>```

The async tasks, loop finishes, "end async" is printed but the process hangs. The data form "downloaded_mpq" is used in another process.

Are the queues keeping doesn't allow the process to close or can be something else?

Body:
I'm running an async function(download files) in a separate process. The data between processes is
passed using multiprocessing queues.

in main file/module:

to_download_mpq = Queue()
downloaded_mpq = Queue()

...................

pd = Process(target=async_download_items,
                 args=(to_download_mpq, downloaded_mpq))

pd.start()
pd.join()
print("end_process")

in a separate file:

# transfer data between async queues and multiprocessing queues when is ready
   async def download_piping(to_download_q, downloaded_q, to_download_mpq, downloaded_mpq, sentinel):

    to_download_sentinel = False
    downloaded_sentinel = False

    while not (to_download_sentinel and downloaded_sentinel):
        if not to_download_sentinel:
            to_download_item = to_download_mpq.get()
            await to_download_q.put(to_download_item)
            await asyncio.sleep(0.1)
            if to_download_item == sentinel:
                to_download_sentinel = True

        if not downloaded_sentinel:
            if downloaded_q.empty():
                await asyncio.sleep(2)
            else:
                downloaded_item = await downloaded_q.get()
                downloaded_mpq.put(downloaded_item)
                await asyncio.sleep(0)
                if downloaded_item == sentinel:
                    downloaded_sentinel = True

async def download_tasks(to_download_mpq, downloaded_mpq, workers, sentinel=END_QUEUE_SENTINEL, queue_size=50):

    downloader = download.AsyncDownloader() # async downloader class using aiohttp
    to_download_lq = asyncio.Queue(queue_size)
    downloaded_lq = asyncio.Queue(queue_size)

    task_download = asyncio.create_task(downloader.download_files(to_download_q=to_download_lq,
                                                                  downloaded_q=downloaded_lq,
                                                                  download_workers=workers,
                                                                  sentinel=sentinel))

    task_piping = asyncio.create_task(download_piping(to_download_lq, downloaded_lq,
                                                      to_download_mpq, downloaded_mpq,
                                                      sentinel=sentinel))
    await asyncio.gather(task_download, task_piping)

def async_download_items(to_download_mpq, downloaded_mpq, workers=50):
    loop = asyncio.get_event_loop()
    print(loop)
    loop.run_until_complete(download_tasks(to_download_mpq, downloaded_mpq, workers=workers))
    loop.close()
    print("end async")

The async tasks, loop finishes, "end async" is printed but the process hangs. The data form "downloaded_mpq" is used in another process.

Are the queues keeping doesn't allow the process to close or can be something else?