问:
How to make the functions region switch to another when it becomes down using Angular Fire Module?
When calling Firebase Functions from Angular using Angular Fire, default region is set to us-central1. A couple of months ago the whole region was down, and as a result all functions were inaccessible.

What I'm trying to do now is figure out a way to dynamically change the functions location to another at the time of calling.

The functions will be deployed to multiple regions obviously.

But how to handle that on the client side?

Is there a documented way to implement this using Firebase/Google Cloud?

Here's the code I currently have to switch functions region manually(which requires a new build and deployment):

```<code>import { REGION } from '@angular/fire/functions';

@NgModule({
  providers: [
    { provide: REGION, useValue: 'asia-northeast1' }
  ]
})
</code>```

Body:
When calling Firebase Functions from Angular using Angular Fire, default region is set to us-central1. A couple of months ago the whole region was down, and as a result all functions were inaccessible.

What I'm trying to do now is figure out a way to dynamically change the functions location to another at the time of calling.

The functions will be deployed to multiple regions obviously.

But how to handle that on the client side?

Is there a documented way to implement this using Firebase/Google Cloud?

Here's the code I currently have to switch functions region manually(which requires a new build and deployment):

import { REGION } from '@angular/fire/functions';

@NgModule({
  providers: [
    { provide: REGION, useValue: 'asia-northeast1' }
  ]
})


来源: stackexchange

问:
JavaScript RegEx: How do I utilise named capture groups?
I am currently working at a Plugin for RPG Maker MZ and for that, i learned how to use RegEx for analyzing the Content of a Notetag. While my first try with them was actually pretty good, i assume it didn't used the full potential of RegEx and because i need to expand the my RegEx anyway so the user has more options, i wanted to try out named capture groups for better readability and easier access for me as a developer.
Unfortionatly, i wasnt able to find out how to get the "group" object of the objects i got from the Iterator from matchAll(). So my question would be how to analyse the content of a named capture group in javascript.

Important: as far as i saw, the other questions didnt answer the question why i wasnt be able to find the right group object. also, most of the answers are with the exec function instead of the matchAll function.

The for this part relevant Code is:

```<code>const regex1new = /(?<ItemCategory>Item|Armor|Weapon)\s*:\s*(?<ID>\d+)\s*(?<Weight>w:(?<WeightFactor>\d+))?/gm;

let foundTagEntrysList = Array.from(this.enemy().meta.HellsCommonDropList.matchAll(regex1new), entry => entry[0]); //If you wanna reproduce this, just replace this.enemy().meta.HellsCommonDropList with a string

newTagsAnalyser();

function newTagsAnalyser() {
        foundTagEntrysList.forEach(matchedElement => {

                let Item;
                let Weight;
                let ID = matchedElement.groups.ID;
                    switch (matchedElement.groups.ItemCategory) {
                        case "Item":
                            Item = $dataItems[ID];
                            break;

                        case "Weapon":
                            Item = $dataWeapon[ID];
                            break;

                        case "Armor":
                            Item = $dataArmor[ID];
                            break;
                        default:
                            break;
                    }
                    if (typeof matchedElement.groups.Weight !== 'undefined'){
                        Weight = matchedElement.groups.WeightFactor;
                    }
                commonItemDataMap.set(Item, Weight);

        });
    }

</code>```

What did i expected?
That the matechedElement.group.xxx returnes the content of the group that is named xxx.

What was the result?
rmmz_managers.js:2032 TypeError: Cannot read property 'ID' of undefined

ContentLicense: CC BY-SA 4.0

Body:
I am currently working at a Plugin for RPG Maker MZ and for that, i learned how to use RegEx for analyzing the Content of a Notetag. While my first try with them was actually pretty good, i assume it didn't used the full potential of RegEx and because i need to expand the my RegEx anyway so the user has more options, i wanted to try out named capture groups for better readability and easier access for me as a developer.
Unfortionatly, i wasnt able to find out how to get the "group" object of the objects i got from the Iterator from matchAll(). So my question would be how to analyse the content of a named capture group in javascript.

Important: as far as i saw, the other questions didnt answer the question why i wasnt be able to find the right group object. also, most of the answers are with the exec function instead of the matchAll function.

The for this part relevant Code is:

const regex1new = /(?<ItemCategory>Item|Armor|Weapon)\s*:\s*(?<ID>\d+)\s*(?<Weight>w:(?<WeightFactor>\d+))?/gm;

let foundTagEntrysList = Array.from(this.enemy().meta.HellsCommonDropList.matchAll(regex1new), entry => entry[0]); //If you wanna reproduce this, just replace this.enemy().meta.HellsCommonDropList with a string

newTagsAnalyser();

function newTagsAnalyser() {
        foundTagEntrysList.forEach(matchedElement => {

                let Item;
                let Weight;
                let ID = matchedElement.groups.ID;
                    switch (matchedElement.groups.ItemCategory) {
                        case "Item":
                            Item = $dataItems[ID];
                            break;

                        case "Weapon":
                            Item = $dataWeapon[ID];
                            break;

                        case "Armor":
                            Item = $dataArmor[ID];
                            break;
                        default:
                            break;
                    }
                    if (typeof matchedElement.groups.Weight !== 'undefined'){
                        Weight = matchedElement.groups.WeightFactor;
                    }
                commonItemDataMap.set(Item, Weight);

        });
    }

What did i expected?
That the matechedElement.group.xxx returnes the content of the group that is named xxx.

What was the result?
rmmz_managers.js:2032 TypeError: Cannot read property 'ID' of undefined


问:
My subreport is not detected in Visual Studio
I am currently attempting to create a report using rdlc in Visual Studio 2022. I ran into a problem where every time I run the program

The subreport 'foo' could not be found at the specified location bar. Please verify that the subreport has been published and that the name is correct

Everywhere I've looked no one mention anything about publishing the subreport beforehand, they all just enter the subreport name in the subreport properties panel

Update:
I found this warning after running a few test, not sure if this is helpful

```<code>Warning: An error occurred while executing the subreport 'RunDetailsSubReport' (Instance: 0): The report definition for report 'RunDetails' has not been specified (rsErrorExecutingSubreport)
</code>```

Body:
I am currently attempting to create a report using rdlc in Visual Studio 2022. I ran into a problem where every time I run the program

The subreport 'foo' could not be found at the specified location bar. Please verify that the subreport has been published and that the name is correct

Everywhere I've looked no one mention anything about publishing the subreport beforehand, they all just enter the subreport name in the subreport properties panel

Update:
I found this warning after running a few test, not sure if this is helpful

Warning: An error occurred while executing the subreport 'RunDetailsSubReport' (Instance: 0): The report definition for report 'RunDetails' has not been specified (rsErrorExecutingSubreport)


问:
Bootstrap video modal doesn't stop playing when the modal is closed
0

I have built a modal pop-up using Bootstrap to display a video that autoplays when opened, this functionality is working fine.

However when the modal closes the video keeps playing. I'm just using the built in Bootstrap JS as any I've written doesn't output anything, although doesn't cause any errors.

If anyone has any solutions or can point me in the right direction it would be much appreciated.

```<code>if( $linkedVideoContent_link) :
    echo sprintf(
        '<a id="%1$s" class="adg-linked-content-button adg-button-alt mt-3 mx-auto" data-bs-toggle="modal" data-src="%2$s" data-bs-target="#videoModal">%3$s</a>',
         esc_html( $linkedVideoContent_link_id ),
         esc_html( $linkedVideoContent_video ),
         wp_kses_post( $linkedVideoContent_link_title )
     );
endif;
</code>```
```<code><div class="modal fade" id="videoModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog modal-dialog-centered modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-body">
       <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></span>
        </button>
        <!-- 16:9 aspect ratio -->
        <div class="ratio ratio-16x9">
            <iframe src="<?php echo esc_html( $linkedVideoContent_video ); ?>?h=729191087e&autoplay=1&color=AB8D3F&title=0&byline=0&portrait=0" width="640" height="320" frameborder="0" allow="autoplay; fullscreen; picture-in-picture" allowfullscreen></iframe>
        </div>
      </div>
    </div>
  </div>
</div>
</code>```

I've tried targeting the data-src attribute and using it to set the src value in the iframe on modal opening, but nothing loads. The only way that the video will load is if the variable is added directly into the source.

Body:
0

I have built a modal pop-up using Bootstrap to display a video that autoplays when opened, this functionality is working fine.

However when the modal closes the video keeps playing. I'm just using the built in Bootstrap JS as any I've written doesn't output anything, although doesn't cause any errors.

If anyone has any solutions or can point me in the right direction it would be much appreciated.

if( $linkedVideoContent_link) :
    echo sprintf(
        '%3$s',
         esc_html( $linkedVideoContent_link_id ),
         esc_html( $linkedVideoContent_video ),
         wp_kses_post( $linkedVideoContent_link_title )
     );
endif;

       <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close">
        </button>

            <iframe src="<?php echo esc_html( $linkedVideoContent_video ); ?>?h=729191087e&autoplay=1&color=AB8D3F&title=0&byline=0&portrait=0" width="640" height="320" frameborder="0" allow="autoplay; fullscreen; picture-in-picture" allowfullscreen>

I've tried targeting the data-src attribute and using it to set the src value in the iframe on modal opening, but nothing loads. The only way that the video will load is if the variable is added directly into the source.


问:
Permissions for redirect Lambda@Edge
I'm using grrr-amsterdam's redirect microservice on a CloudFront distribution that redirects to an Http Api.

I want to redirect www subdomains to my apex domain.

I can deploy successfully, but I get a 403 error when visiting www.example.com. I think the issue is with the Lambda's permissions, but when I add, in my cloudfront_stack.py

www_redirect.add_to_role_policy(
    iam.PolicyStatement(
        actions=["lambda:GetFunction"],
        resources=[
            f"arn:aws:lambda:us-east-1:{cfg.AWS_ACCOUNT}:function:{www_redirect.function_name}:{www_redirect.current_version}",
        ],
    )
)
```

I get a deploy error based on circular dependencies. (I have attempted extending the permissions as described here.)

There is another problem. If I visit https://www.example.com, I get an SSL_ERROR_NO_CYPHER_OVERLAP from Firefox, or a Can't establish connection from Safari. To me it looks like the edge function is being called before the CloudFront's HTTP to HTTPS redirect.

Could someone offer solutions that are within the aws_cdk flow?

Title: Permissions for redirect Lambda@Edge

Body:
I'm using grrr-amsterdam's redirect microservice on a CloudFront distribution that redirects to an Http Api.

I want to redirect www subdomains to my apex domain.

I can deploy successfully, but I get a 403 error when visiting www.example.com. I think the issue is with the Lambda's permissions, but when I add, in my cloudfront_stack.py

www_redirect.add_to_role_policy(
    iam.PolicyStatement(
        actions=["lambda:GetFunction"],
        resources=[
            f"arn:aws:lambda:us-east-1:{cfg.AWS_ACCOUNT}:function:{www_redirect.function_name}:{www_redirect.current_version}",
        ],
    )
)

I get a deploy error based on circular dependencies. (I have attempted extending the permissions as described here.)

There is another problem. If I visit https://www.example.com, I get an SSL_ERROR_NO_CYPHER_OVERLAP from Firefox, or a Can't establish connection from Safari. To me it looks like the edge function is being called before the CloudFront's HTTP to HTTPS redirect.

Could someone offer solutions that are within the aws_cdk flow?


问:
Catching SIGINT in kernel space
In my kernel module I have a function to start a firmware update via sysfs-attribute. This function blocks until the update returned successfully or after a timeout. The problem now is when I generate an interrupt by pressing Ctlr+c on the keyboard the function returns. This leaves the buffer with my payload for the update in an undefined state generating unwanted behaviour when restarting the update process.

I know from userspace that you can register a singal_handler to catch those specific signals like SIGINT in my case:

signal(SIGINT,my_sig_int_handler)

Is there something similar in the kernelspace? I also read that one should not use signal() at all because of compatibility issues but what would be the alternative?

I already tried to work with the function by registering my signal-handler function in my sysfs-function but it seems that the handler doesn't get executed:

```<code>static void sig_handler(int sig)
{
        printk("SIGINT received\n");
    // set global flag to inform other thread that uupdate was interrupted;
}

static ssize_t update_function(struct device *dev, struct device_attribute *dev_attr, const char *buf, size_t count)
{
__sighandler_t  sa_handler = sig_handler;
kernel_sigaction(SIGINT,sa_handler);
// set flag to start update in other thread ....
}
</code>```

In the linux-kernel sources I can't find examples where kernel_signal is used with a handler_function. Can anyone give me a hint on how to solve my problem?

Title: Catching SIGINT in kernel space

Body:
In my kernel module I have a function to start a firmware update via sysfs-attribute. This function blocks until the update returned successfully or after a timeout. The problem now is when I generate an interrupt by pressing Ctlr+c on the keyboard the function returns. This leaves the buffer with my payload for the update in an undefined state generating unwanted behaviour when restarting the update process.

I know from userspace that you can register a singal_handler to catch those specific signals like SIGINT in my case:

signal(SIGINT,my_sig_int_handler)

Is there something similar in the kernelspace? I also read that one should not use signal() at all because of compatibility issues but what would be the alternative?

I already tried to work with the function by registering my signal-handler function in my sysfs-function but it seems that the handler doesn't get executed:

static void sig_handler(int sig)
{
        printk("SIGINT received\n");
    // set global flag to inform other thread that uupdate was interrupted;
}

static ssize_t update_function(struct device *dev, struct device_attribute *dev_attr, const char *buf, size_t count)
{
__sighandler_t  sa_handler = sig_handler;
kernel_sigaction(SIGINT,sa_handler);
// set flag to start update in other thread ....
}

In the linux-kernel sources I can't find examples where kernel_signal is used with a handler_function. Can anyone give me a hint on how to solve my problem?


问:
issue autolload_file when i execute index.php inside phpmyadmin
I have problem with load index.php. When i start localhost/phpmyadmin everything is correct untill i will run index.php. I get error about File ' . AUTOLOAD_FILE . ' missing or not readable. Below is img how it looks like.

https://imgur.com/a/UhnaBX4

I installed composer and it nothing changed. Tried do all steps from link "Most likely you did not run Composer to ' . '' . 'install library files " and nothing works. I installed newest version php moved to share folder and the result was the same.


问:
Livewire tmp/phpLznimY does not exists
When i try select an image to upload it will thow this error.

```<code>Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException
The file "/tmp/phpLznimY" does not exist
</code>```

It does not matter if i want to preview the image or not. I heave checked the storage/app/livewire-tmp directory and the file is getting uploaded in this directory. It will work on local machine but not on production server.

```<code>"laravel/framework": "^8.0",
"livewire/livewire": "^2.10",
</code>```

I've checked the livewire config and filesystem config file and these look fine.

```<code>'temporary_file_upload' => [
        'disk' => 'local',        // Example: 'local', 's3'              Default: 'default'
        'rules' => null,       // Example: ['file', 'mimes:png,jpg']  Default: ['required', 'file', 'max:12288'] (12MB)
        'directory' => 'livewire-tmp',   // Example: 'tmp'                      Default  'livewire-tmp'
        'middleware' => null,  // Example: 'throttle:5,1'             Default: 'throttle:60,1'
        'preview_mimes' => [   // Supported file types for temporary pre-signed file URLs.
            'png', 'gif', 'bmp', 'svg', 'wav', 'mp4',
            'mov', 'avi', 'wmv', 'mp3', 'm4a',
            'jpg', 'jpeg', 'mpga', 'webp', 'wma',
        ],
        'max_upload_time' => 5, // Max duration (in minutes) before an upload gets invalidated.
    ],
</code>```

filesystems

```<code>'disks' => [

        'local' => [
            'driver' => 'local',
            'root' => storage_path('app'),
        ],

        'public' => [
            'driver' => 'local',
            'root' => storage_path('app/public'),
            'url' => env('APP_URL').'/storage',
            'visibility' => 'public',
        ],
</code>```

I've tried both local and public but the same error still keeps showing up.
the upload_max_filesize is 2GB so that should not be a problem.

```<code><form wire:submit.prevent="saveCustomer" enctype="multipart/form-data">
...........
<div class="form-group row">
  <div class="col-sm-1"></div>
  <label class="col-sm-3 col-form-label" for="logo">Logo:</label>
  <div class="col-sm-3">
    <input wire:model="logo" type="file" name="logo" class="form-control-file btn btn-primary"/>
    @error('logo') <span class="text-danger mt-1">{{ $message }}</span> @enderror
  </div>
  <div class="col-sm-2">
    @if($logo)<img src="{{ $logo->temporaryUrl() }}">@endif
  </div>
</div>
............
</form>
</code>```

this is the validation of the logo

```<code>'logo' => 'nullable|image|mimes:png,png,jpeg,gif|max:10000000',
</code>```

And i'm not uploading it to the server yet. First i wanted to see the preview. But as i said the tmp file is being uploaded to the livewire-tmp folder just fine. When i check the folder i see that it is being uploaded to the folder.

But somehow it seems like it want's to get the file from the tmp folder. And the filename ("/tmp/phpLznimY") does not come close to what it is actually.

Title: Livewire tmp/phpLznimY does not exists

Body:
When i try select an image to upload it will thow this error.

Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException
The file "/tmp/phpLznimY" does not exist

It does not matter if i want to preview the image or not. I heave checked the storage/app/livewire-tmp directory and the file is getting uploaded in this directory. It will work on local machine but not on production server.

"laravel/framework": "^8.0",
"livewire/livewire": "^2.10",

I've checked the livewire config and filesystem config file and these look fine.

'temporary_file_upload' => [
        'disk' => 'local',        // Example: 'local', 's3'              Default: 'default'
        'rules' => null,       // Example: ['file', 'mimes:png,jpg']  Default: ['required', 'file', 'max:12288'] (12MB)
        'directory' => 'livewire-tmp',   // Example: 'tmp'                      Default  'livewire-tmp'
        'middleware' => null,  // Example: 'throttle:5,1'             Default: 'throttle:60,1'
        'preview_mimes' => [   // Supported file types for temporary pre-signed file URLs.
            'png', 'gif', 'bmp', 'svg', 'wav', 'mp4',
            'mov', 'avi', 'wmv', 'mp3', 'm4a',
            'jpg', 'jpeg', 'mpga', 'webp', 'wma',
        ],
        'max_upload_time' => 5, // Max duration (in minutes) before an upload gets invalidated.
    ],

filesystems

'disks' => [

        'local' => [
            'driver' => 'local',
            'root' => storage_path('app'),
        ],

        'public' => [
            'driver' => 'local',
            'root' => storage_path('app/public'),
            'url' => env('APP_URL').'/storage',
            'visibility' => 'public',
        ],

I've tried both local and public but the same error still keeps showing up.
the upload_max_filesize is 2GB so that should not be a problem.

<form wire:submit.prevent="saveCustomer" enctype="multipart/form-data">
...........

  Logo:

    <input wire:model="logo" type="file" name="logo" class="form-control-file btn btn-primary"/>
    @error('logo') {{ $message }} @enderror

    @if($logo)temporaryUrl() }}">@endif

............
</form>

this is the validation of the logo

'logo' => 'nullable|image|mimes:png,png,jpeg,gif|max:10000000',

And i'm not uploading it to the server yet. First i wanted to see the preview. But as i said the tmp file is being uploaded to the livewire-tmp folder just fine. When i check the folder i see that it is being uploaded to the folder.

But somehow it seems like it want's to get the file from the tmp folder. And the filename ("/tmp/phpLznimY") does not come close to what it is actually.


问:
The Android view returned from PlatformView#getView() was already added to a parent view
I am developing a browser application like GoogleChrome in Flutter for mobile native application.

I am using multiple WebViews in GridView to represent multiple windows.

The following error is probably caused by passing the controller of the WebView used in GridView to a new page as an argument during page transition.

```<code>"java.lang.IllegalStateException: The Android view returned from PlatformView#getView() was already added to a parent view.
    at io.flutter.plugin.platform.PlatformViewsController$1.createForTextureLayer(PlatformViewsController.java:238)
    at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.create(PlatformViewsChannel.java:122)
    at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.onMethodCall(PlatformViewsChannel.java:60)
    at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
    at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
    at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger( DartMessenger.java:319)
    at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
    at android.os.Handler.HandleCallback(Handler.java:942)
    Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:201)
    at android.os.Looper.loop(Looper.java:288)
    ActivityThread.main(ActivityThread.java:7872)
    Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
"
</code>```

Does anyone know how to solve this?

Body:
I am developing a browser application like GoogleChrome in Flutter for mobile native application.

I am using multiple WebViews in GridView to represent multiple windows.

The following error is probably caused by passing the controller of the WebView used in GridView to a new page as an argument during page transition.

"java.lang.IllegalStateException: The Android view returned from PlatformView#getView() was already added to a parent view.
    at io.flutter.plugin.platform.PlatformViewsController$1.createForTextureLayer(PlatformViewsController.java:238)
    at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.create(PlatformViewsChannel.java:122)
    at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.onMethodCall(PlatformViewsChannel.java:60)
    at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
    at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
    at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger( DartMessenger.java:319)
    at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
    at android.os.Handler.HandleCallback(Handler.java:942)
    Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:201)
    at android.os.Looper.loop(Looper.java:288)
    ActivityThread.main(ActivityThread.java:7872)
    Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
"

Does anyone know how to solve this?


问:
docker-compose: service "gateway" refers to undefined volume ${PWD}/config/gateway/gateway-configuration.ini: invalid compose project
My goal: generate docker-compose.yaml from docker-compose.yaml and docker-compose.override.yaml and keep the variables as they are now = without interpolate

I've tried to run

```<code>docker compose -f docker-compose.yaml -f docker-compose.override.yaml convert --no-interpolate > new-docker-compose.yaml
</code>```

Here is my docker-compose.yaml:

```<code>version: "3.5"
services:

  redis-db:
    image: redislabs/rejson:2.0.11
    container_name: redis-db
    restart: unless-stopped
    volumes:
      - redis-storage-vol:/data
      - ${PWD}/config/redis/redis.conf:/usr/local/etc/redis/redis.conf:ro
    ports:
      - 6379:6379

  runner:
    image: "${REPO}/runner/${RUNNER_CPU_IMAGE}:${RUNNER_CPU_TAG}"
    container_name: runner
    restart: unless-stopped
    volumes:
      - data-storage-vol:/data
      - ${PWD}/config/runner/runner-configuration.ini:/configuration.ini:ro
      - "${PWD}/solutions/${ALGO}:/home/scripts/algorithmic_solutions_list.txt:ro"
    depends_on:
      - "redis-db"

  gateway:
    image: "${REPO}/gateway/gateway-server:${GATEWAY_TAG}"
    container_name: gateway
    restart: unless-stopped
    volumes:
      - data-storage-vol:/data
      - ${PWD}/config/gateway/gateway-configuration.ini:/configuration.ini:ro
    ports:
      - 8000:8000
    depends_on:
      - "redis-db"

volumes:
  data-storage-vol:
    driver_opts:
      type: "tmpfs"
      device: "tmpfs"
      o: "size=5g,uid=1000"

  redis-storage-vol:
    driver: local
</code>```

docker-compose.override.yaml

```<code>version: "3.5"
services:
  runner:
    image: "${REPO}/runner/${RUNNER_GPU_IMAGE}:${RUNNER_GPU_TAG}"
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              capabilities: [ GPU ]
</code>```

What I've tried:

Run docker compose convert without flag --no-interpolate, it worked well but the variables was populated.

Run like the example - but got this error:
service "gateway" refers to undefined volume ${PWD}/config/gateway/gateway-configuration.ini: invalid compose project

I want to keep using docker compose commands and not edit files after its created.

Body:
My goal: generate docker-compose.yaml from docker-compose.yaml and docker-compose.override.yaml and keep the variables as they are now = without interpolate

I've tried to run

docker compose -f docker-compose.yaml -f docker-compose.override.yaml convert --no-interpolate > new-docker-compose.yaml

Here is my docker-compose.yaml:

version: "3.5"
services:

  redis-db:
    image: redislabs/rejson:2.0.11
    container_name: redis-db
    restart: unless-stopped
    volumes:
      - redis-storage-vol:/data
      - ${PWD}/config/redis/redis.conf:/usr/local/etc/redis/redis.conf:ro
    ports:
      - 6379:6379

  runner:
    image: "${REPO}/runner/${RUNNER_CPU_IMAGE}:${RUNNER_CPU_TAG}"
    container_name: runner
    restart: unless-stopped
    volumes:
      - data-storage-vol:/data
      - ${PWD}/config/runner/runner-configuration.ini:/configuration.ini:ro
      - "${PWD}/solutions/${ALGO}:/home/scripts/algorithmic_solutions_list.txt:ro"
    depends_on:
      - "redis-db"

  gateway:
    image: "${REPO}/gateway/gateway-server:${GATEWAY_TAG}"
    container_name: gateway
    restart: unless-stopped
    volumes:
      - data-storage-vol:/data
      - ${PWD}/config/gateway/gateway-configuration.ini:/configuration.ini:ro
    ports:
      - 8000:8000
    depends_on:
      - "redis-db"

volumes:
  data-storage-vol:
    driver_opts:
      type: "tmpfs"
      device: "tmpfs"
      o: "size=5g,uid=1000"

  redis-storage-vol:
    driver: local

docker-compose.override.yaml

version: "3.5"
services:
  runner:
    image: "${REPO}/runner/${RUNNER_GPU_IMAGE}:${RUNNER_GPU_TAG}"
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              capabilities: [ GPU ]

What I've tried:

Run docker compose convert without flag --no-interpolate, it worked well but the variables was populated.

Run like the example - but got this error:
service "gateway" refers to undefined volume ${PWD}/config/gateway/gateway-configuration.ini: invalid compose project

I want to keep using docker compose commands and not edit files after its created.


问:
Java - How to create a subprocess in a class that is running a method
I'm writing a program that enables UDP communication between a KUKA robot (programmed in java) and a python server running on a PC. The program on the robot needs to run multiple methods concurrently because it needs to listen/receive messages on 3 sockets simultaneously (they all need to be listening for messages at all times).

I first tried this using multi-threading. My main class is DP_UDP_COMM which start running when the robot is started. When starting some initialization between the robot and python server is done to set up the socket connection, after that the communication processes need to be started. An example of 1 of these 'communication' threads is shown below as Thread UDP_COMM:

```<code>//DP_UDP_COMM class is the main class that gets started when the robot starts
public class DP_UDP_COMM extends RoboticsAPITask {

//Some code here

    //One of the communication processes that needs to run while the DP_UDP_COMM instance is active
    public Thread UDP_COMM = new Thread(new Runnable(){
        public void run(){
            while(running){
                 _log.info("Thread Started, Waiting for Action");

                try {
                    ReceiveUDP();
                    _log.info("Buffer received is: "+String.valueOf(receive));
                    _log.info("Type received is: "+String.valueOf(ByteProcess.getType(receive)));
                    if(status==0)
                        processPacket(receive);
                } catch (Exception e) {
                    // TODO Auto-generated catch block
                    send = createPacketResponse("ERROR: "+e.getMessage());
                    try {
                        SendUDP(send);
                    } catch (Exception e1) {
                        // TODO Auto-generated catch block
                        e1.printStackTrace();                   }
                    e.printStackTrace();
                }
            }
        }
    });

    UDP_COMM.start();

//Some code and other methods here

}
</code>```

This thread tries to receive a UDP message from a socket using ReceiveUDP(). This is a blocking method so it keeps waiting here untill it receives a message. This message is then processed using processPacket(), which is a method that sends a command to the robot determined by the message that was received. After sending the command it starts listening again for new messages. This loops indefinitely when the robot is active.

The other threads are very similar but use slightly different methods which are bound to different sockets.(For example ReceiveUDPEmergency() which is the same as ReceiveUDP() but with a different socket)

This is working well with one thread, but when running 3 threads concurrently it doesn't work anymore because the threads will wait for each other to complete before looping because ReceiveUDP() is a blocking method.

The solution for this (I think) is to use multi-processing instead of multi-threading because this truly runs them in parallel instead of sequentially.
However when looking at the java.lang.Process documentation I really don't get how creating a process works. In every example they create/start a process from an external .exe file or something like that.

Is it possible to create multiple processes that run multiple methods in parallel within my DP_UDP_COMM instance? How would I do this?

//What have I tried:
As explained above I tried multi-threading at first. But this isn't good enough.

With multi-processing it is not clear how to start a process which just runs a method in parallel to the main instance.

Body:
I'm writing a program that enables UDP communication between a KUKA robot (programmed in java) and a python server running on a PC. The program on the robot needs to run multiple methods concurrently because it needs to listen/receive messages on 3 sockets simultaneously (they all need to be listening for messages at all times).

I first tried this using multi-threading. My main class is DP_UDP_COMM which start running when the robot is started. When starting some initialization between the robot and python server is done to set up the socket connection, after that the communication processes need to be started. An example of 1 of these 'communication' threads is shown below as Thread UDP_COMM:

//DP_UDP_COMM class is the main class that gets started when the robot starts
public class DP_UDP_COMM extends RoboticsAPITask {

//Some code here

    //One of the communication processes that needs to run while the DP_UDP_COMM instance is active
    public Thread UDP_COMM = new Thread(new Runnable(){
        public void run(){
            while(running){
                 _log.info("Thread Started, Waiting for Action");

                try {
                    ReceiveUDP();
                    _log.info("Buffer received is: "+String.valueOf(receive));
                    _log.info("Type received is: "+String.valueOf(ByteProcess.getType(receive)));
                    if(status==0)
                        processPacket(receive);
                } catch (Exception e) {
                    // TODO Auto-generated catch block
                    send = createPacketResponse("ERROR: "+e.getMessage());
                    try {
                        SendUDP(send);
                    } catch (Exception e1) {
                        // TODO Auto-generated catch block
                        e1.printStackTrace();                   }
                    e.printStackTrace();
                }
            }
        }
    });

    UDP_COMM.start();

//Some code and other methods here

}

This thread tries to receive a UDP message from a socket using ReceiveUDP(). This is a blocking method so it keeps waiting here untill it receives a message. This message is then processed using processPacket(), which is a method that sends a command to the robot determined by the message that was received. After sending the command it starts listening again for new messages. This loops indefinitely when the robot is active.

The other threads are very similar but use slightly different methods which are bound to different sockets.(For example ReceiveUDPEmergency() which is the same as ReceiveUDP() but with a different socket)

This is working well with one thread, but when running 3 threads concurrently it doesn't work anymore because the threads will wait for each other to complete before looping because ReceiveUDP() is a blocking method.

The solution for this (I think) is to use multi-processing instead of multi-threading because this truly runs them in parallel instead of sequentially.
However when looking at the java.lang.Process documentation I really don't get how creating a process works. In every example they create/start a process from an external .exe file or something like that.

Is it possible to create multiple processes that run multiple methods in parallel within my DP_UDP_COMM instance? How would I do this?

//What have I tried:
As explained above I tried multi-threading at first. But this isn't good enough.

With multi-processing it is not clear how to start a process which just runs a method in parallel to the main instance.


问:
Create a Custome Description in Activity Log
How to add a custom description in spatie laravel-activitlog.
I have read the documentation there they mentioned two ways

first way

```<code>activity()
   ->performedOn($someContentModel)
   ->log('Custome Description');
</code>```

the first way only creates a log with a custom description.

the second way is by customizing the description in the model.
Second method

```<code>    public function getActivitylogOptions()
    {
        return LogOptions::defaults()
        ->setDescriptionForEvent(fn(string $eventName) => "This model has been {$eventName}");
    }
</code>```

But I want to add a custom description in the controller while adding, deleting or updating a Model.

Body:
How to add a custom description in spatie laravel-activitlog.
I have read the documentation there they mentioned two ways

first way

activity()
   ->performedOn($someContentModel)
   ->log('Custome Description');

the first way only creates a log with a custom description.

the second way is by customizing the description in the model.
Second method

    public function getActivitylogOptions()
    {
        return LogOptions::defaults()
        ->setDescriptionForEvent(fn(string $eventName) => "This model has been {$eventName}");
    }

But I want to add a custom description in the controller while adding, deleting or updating a Model.


问:
Javascript reports zero array lenght after returning array, items are not accessible
I am collecting the content of a server side directory an store this in an array. After returning the array to the calling function array.length reports zero and the elements are not accessible as array[]. The representation of the array using console.log looks OK however.

```<code>function loadDir(targetDir) {
            var itemCount = 0;
            const directory = targetDir;
            const selector =
                ".icon-js, .icon-directory"; // selector for the relevant links in the directory's index page
            const request = new XMLHttpRequest();
            request.open("GET", directory, true);
            var dirListA = [];
            request.onload = () => {
                // succesful response
                if (request.status >= 200 && request.status < 400) {
                    const doc = new DOMParser().parseFromString(request.responseText,
                        "text/html"); // create DOM from response HTML
                    const links = doc.querySelectorAll(selector); // get all links const
                    // do stuff with the links
                    links.forEach(link => {
                        fileName = link.title;
                        filePath = link.pathname;
                        itemCount = dirListA.push(fileName);
                    });
                    dirListA.unshift(itemCount);
                    console.log(dirListA.length); //here lenght is OK
                }
            };
            request.send();
            console.log(dirListA);  //array content looks ok
            console.log(dirListA.length); //her lenght is reported as 0
            return dirListA;
        }

        function fillDropDown(targetDir) {
            var dropList = "<option> dummy </option>";
            var listArr = loadDir(targetDir);
            console.log(listArr); //array content looks ok
            console.log(listArr.length); // lenght is reported as 0
            console.log(listArr[0]); //undefined
            //both loops are not working not working probably because of zero lenght
            listArr.forEach(function(item){console.log(item)});

            for (var i = 0; i < listArr.length; i++) {
                console.log(listArr[i])
            };
            console.log(dropList);
            document.getElementById("selectFile").innerHTML = dropList;
        }

</code>```

The console log looks like this

Although it should be possible to do the filemanipulations in the links.foreach loop it feels un elegant and i would have to write the same code several times with small differences for each file manipulation.
I would like to know what's going on here and if there is a work around. Declearing the array "dirListA" globally isdoesn't work neighter
p.s. first post over here I hope it looks decend.

Body:
I am collecting the content of a server side directory an store this in an array. After returning the array to the calling function array.length reports zero and the elements are not accessible as array[]. The representation of the array using console.log looks OK however.

function loadDir(targetDir) {
            var itemCount = 0;
            const directory = targetDir;
            const selector =
                ".icon-js, .icon-directory"; // selector for the relevant links in the directory's index page
            const request = new XMLHttpRequest();
            request.open("GET", directory, true);
            var dirListA = [];
            request.onload = () => {
                // succesful response
                if (request.status >= 200 && request.status < 400) {
                    const doc = new DOMParser().parseFromString(request.responseText,
                        "text/html"); // create DOM from response HTML
                    const links = doc.querySelectorAll(selector); // get all links const
                    // do stuff with the links
                    links.forEach(link => {
                        fileName = link.title;
                        filePath = link.pathname;
                        itemCount = dirListA.push(fileName);
                    });
                    dirListA.unshift(itemCount);
                    console.log(dirListA.length); //here lenght is OK
                }
            };
            request.send();
            console.log(dirListA);  //array content looks ok
            console.log(dirListA.length); //her lenght is reported as 0
            return dirListA;
        }

        function fillDropDown(targetDir) {
            var dropList = "<option> dummy </option>";
            var listArr = loadDir(targetDir);
            console.log(listArr); //array content looks ok
            console.log(listArr.length); // lenght is reported as 0
            console.log(listArr[0]); //undefined
            //both loops are not working not working probably because of zero lenght
            listArr.forEach(function(item){console.log(item)});

            for (var i = 0; i < listArr.length; i++) {
                console.log(listArr[i])
            };
            console.log(dropList);
            document.getElementById("selectFile").innerHTML = dropList;
        }

The console log looks like this

Although it should be possible to do the filemanipulations in the links.foreach loop it feels un elegant and i would have to write the same code several times with small differences for each file manipulation.
I would like to know what's going on here and if there is a work around. Declearing the array "dirListA" globally isdoesn't work neighter
p.s. first post over here I hope it looks decend.


问:
Intellij Idea always fails postgresql connection
I cannot connect to postgresql from intellij idea while running app. It failes to connect to all kinds of datababes - to local db, remote dbs and so on. But it can easily connect these dbs using dbeaver and the app works perfectly on server. Also, the connection is okay if I use another machine for this. Do anyone know, how to fix it? Here is the stacktrace from intellij:

```<code>Caused by: org.postgresql.util.PSQLException: ERROR: Auth failed
    at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:659) ~[postgresql-42.5.1.jar:42.5.1]
    at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:180) ~[postgresql-42.5.1.jar:42.5.1]
    at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:235) ~[postgresql-42.5.1.jar:42.5.1]
    at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49) ~[postgresql-42.5.1.jar:42.5.1]
    at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:247) ~[postgresql-42.5.1.jar:42.5.1]
    at org.postgresql.Driver.makeConnection(Driver.java:434) ~[postgresql-42.5.1.jar:42.5.1]
    at org.postgresql.Driver.connect(Driver.java:291) ~[postgresql-42.5.1.jar:42.5.1]
    at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138) ~[HikariCP-4.0.3.jar:na]
    at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:364) ~[HikariCP-4.0.3.jar:na]
    at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:206) ~[HikariCP-4.0.3.jar:na]
    at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:476) ~[HikariCP-4.0.3.jar:na]
    at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:561) ~[HikariCP-4.0.3.jar:na]
    at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:115) ~[HikariCP-4.0.3.jar:na]
    at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112) ~[HikariCP-4.0.3.jar:na]
    at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:266) ~[liquibase-core-4.8.0.jar:na]
</code>```

I tried everything but nothing helped

Body:
I cannot connect to postgresql from intellij idea while running app. It failes to connect to all kinds of datababes - to local db, remote dbs and so on. But it can easily connect these dbs using dbeaver and the app works perfectly on server. Also, the connection is okay if I use another machine for this. Do anyone know, how to fix it? Here is the stacktrace from intellij:

Caused by: org.postgresql.util.PSQLException: ERROR: Auth failed
    at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:659) ~[postgresql-42.5.1.jar:42.5.1]
    at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:180) ~[postgresql-42.5.1.jar:42.5.1]
    at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:235) ~[postgresql-42.5.1.jar:42.5.1]
    at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49) ~[postgresql-42.5.1.jar:42.5.1]
    at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:247) ~[postgresql-42.5.1.jar:42.5.1]
    at org.postgresql.Driver.makeConnection(Driver.java:434) ~[postgresql-42.5.1.jar:42.5.1]
    at org.postgresql.Driver.connect(Driver.java:291) ~[postgresql-42.5.1.jar:42.5.1]
    at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138) ~[HikariCP-4.0.3.jar:na]
    at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:364) ~[HikariCP-4.0.3.jar:na]
    at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:206) ~[HikariCP-4.0.3.jar:na]
    at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:476) ~[HikariCP-4.0.3.jar:na]
    at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:561) ~[HikariCP-4.0.3.jar:na]
    at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:115) ~[HikariCP-4.0.3.jar:na]
    at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112) ~[HikariCP-4.0.3.jar:na]
    at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:266) ~[liquibase-core-4.8.0.jar:na]

I tried everything but nothing helped


问:
SQL - get total for each row GROUP BY
I'm building a quiz application where each quiz can have multiple rounds. The rounds, participants & their answers are all being stored in their own tables and at the end of each round the results are shown. Currently, I'm getting the results using the SQL query below. This is calculating the number of questions answered, the correct answer count and the time taken and i'm grouping by the participants ID and Round Id and then ordering by the correct answer count and the time taken.

This works great for grouping the results by individual rounds but i would also like to get the total for each participant in the same query. I've tried using WITH ROLLUP at the end of GROUP BY but this ended up creating duplicate rows for both the GROUP BY clauses.

Is there another way I could get the total for each participant in the same the query or would this require a separate query?

```<code>SELECT quiz_participants.id,
        MAX(quiz_participants.name) as name,
        TIMESTAMPDIFF(MICROSECOND, MIN(quiz_round_participants.started_at), MAX(quiz_round_participant_answers.created_at)) AS time_taken,
        COUNT(quiz_round_participant_answers.id) as answer_count,
        COUNT(answers.is_correct) as correct_count,
        quiz_round_participant_answers.round_id as round_id
FROM quiz_round_participant_answers
    INNER JOIN quiz_participants ON quiz_participants.id = quiz_round_participant_answers.participant_id
    INNER JOIN quiz_round_participants ON quiz_round_participants.participant_id = quiz_participants.id
    INNER JOIN quizzes ON quizzes.id = quiz_participants.quiz_id
    LEFT JOIN (
        SELECT id, is_correct
        FROM answers
        WHERE is_correct = 1
    ) answers ON answers.id = quiz_round_participant_answers.answer_id
WHERE quizzes.id = X
GROUP BY quiz_participants.id, quiz_round_participant_answers.round_id
ORDER BY correct_count DESC, time_taken ASC;
</code>```

Title: SQL - get total for each row GROUP BY

Body:
I'm building a quiz application where each quiz can have multiple rounds. The rounds, participants & their answers are all being stored in their own tables and at the end of each round the results are shown. Currently, I'm getting the results using the SQL query below. This is calculating the number of questions answered, the correct answer count and the time taken and i'm grouping by the participants ID and Round Id and then ordering by the correct answer count and the time taken.

This works great for grouping the results by individual rounds but i would also like to get the total for each participant in the same query. I've tried using WITH ROLLUP at the end of GROUP BY but this ended up creating duplicate rows for both the GROUP BY clauses.

Is there another way I could get the total for each participant in the same the query or would this require a separate query?

SELECT quiz_participants.id,
        MAX(quiz_participants.name) as name,
        TIMESTAMPDIFF(MICROSECOND, MIN(quiz_round_participants.started_at), MAX(quiz_round_participant_answers.created_at)) AS time_taken,
        COUNT(quiz_round_participant_answers.id) as answer_count,
        COUNT(answers.is_correct) as correct_count,
        quiz_round_participant_answers.round_id as round_id
FROM quiz_round_participant_answers
    INNER JOIN quiz_participants ON quiz_participants.id = quiz_round_participant_answers.participant_id
    INNER JOIN quiz_round_participants ON quiz_round_participants.participant_id = quiz_participants.id
    INNER JOIN quizzes ON quizzes.id = quiz_participants.quiz_id
    LEFT JOIN (
        SELECT id, is_correct
        FROM answers
        WHERE is_correct = 1
    ) answers ON answers.id = quiz_round_participant_answers.answer_id
WHERE quizzes.id = X
GROUP BY quiz_participants.id, quiz_round_participant_answers.round_id
ORDER BY correct_count DESC, time_taken ASC;


问:
Add Google Chat App to a space using REST API
I have a Google Chat App (running an App Script) that needs to add itself to a Google Space.

According to the documentation Docs
a chat app can add itself to a space. (I've already joined the Developer Preview Program).

The problem is that the API's response is always 403 with message 'Caller must be a human user with a Google Workspace account with access to Google Chat.'.
Why the caller has to be a human user if the documentation clearly says that a chat app can add itself to a space?

Currently, my app makes a request to the following endpoint:
POST https://chat.googleapis.com/v1/spaces/XXXXX/members

with the following body:
{ "member": { "name": "users/app", "domainId": "company.it", "type": "BOT" } }

The access token is retrieved using a Service Account (the same as the chat app)


问:
I am trying to download stop words from nltk and NLTK Downloader shows WinError 10060 (Error connecting to server) and says connection attempt failed
I am typing the following in both jupyter notebook and cmd(Adminstrator mode):
import nltk nltk.download()

Both give the same result, which is this:

Next when I clock OK on the dialog box, the NLTK downloader goes to Not Responding.

The same WinError 10060 comes when I try nltk.download('all) or even nltk.download('punkt).

Can somebody please explain why this is happening and what do I have to do for downloading NLTK Stopwords?


问:
how can i debug these rsync errors
I've been trying to get rsync working to keep track of files from a web server (linux) to my windows desktop.

Both the server and my machine has rsync installed. I am trying to pull files from the server down to my local machine, just the ones that have changed or update since I pushed them to the server as it's a file based CMS running.

If I run: rsync -avn -e "ssh -p [port]" [user]@[ip]:~/public_html/ ./ - So I am hoping that this will copy files from the /public_html/ folder so the current directory I am running from the command from.

The errors I get are:

```<code>rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(226) [sender=3.1.3]
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: error in rsync protocol data stream (code 12) at io.c(231) [Receiver=3.2.7]
</code>```

I've read that a server and localhost can have different versions and still run ok, and some people suggest directory issues but the directory exists. How can I debug this more?

Title: how can i debug these rsync errors

Body:
I've been trying to get rsync working to keep track of files from a web server (linux) to my windows desktop.

Both the server and my machine has rsync installed. I am trying to pull files from the server down to my local machine, just the ones that have changed or update since I pushed them to the server as it's a file based CMS running.

If I run: rsync -avn -e "ssh -p [port]" [user]@[ip]:~/public_html/ ./ - So I am hoping that this will copy files from the /public_html/ folder so the current directory I am running from the command from.

The errors I get are:

rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(226) [sender=3.1.3]
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: error in rsync protocol data stream (code 12) at io.c(231) [Receiver=3.2.7]

I've read that a server and localhost can have different versions and still run ok, and some people suggest directory issues but the directory exists. How can I debug this more?


问:
scatter plot with Dash
I am coding a Dash page to plot some data for myself.
I want to have some dynamic features on some of my plots.

On my dash I have one dropdown, one pie chart and one scatter chart.

Here is my code:

```<code>import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import plotly.graph_objs as go

app = dash.Dash()

app.layout = html.Div([
    html.Label(['Select the Type:']),
    dcc.Dropdown(
        id='type_filter',
        options=[{'label': i, 'value': i} for i in df.Type.unique()],
        value='All'
    ),
    dcc.Graph(
        id='allocation_chart'
    ),
    dcc.Graph(
        id='allocation_history_chart'
    ),
])

@app.callback(
    Output('allocation_chart','figure'),
    [
        Input('type_filter', 'value')
    ]
)
def update_allocation(type_):
    if type_ == 'All':
        filtered = df
    else:
        mask = df['Type'] == type_
        filtered = df.loc[mask]

    data = [
        go.Pie(
            labels=filtered['Asset'],
            values=filtered['Total']
        )
    ]
    return {
        'data': data,
        'layout': go.Layout(title='Asset Allocation by Type')
    }

@app.callback(
    Output('allocation_history_chart','figure'),
    [
        Input('type_filter','value')
    ]

)
def update_allocation_history(type_):
    if type_ == 'All':
        filtered = df_index
    else:
        mask = df['Type'] == type_
        filtered = df_index.loc[mask]

    data = go.Figure()
    for ticker in filtered.index:
        data.add_trace(
            go.Scatter(
                x = filtered.loc[ticker].index,
                y = filtered.loc[ticker],
                name = ticker
            )
        )
    return {
        'data': [data],
        'layout': go.Layout(title='History of Asset')
    }

if __name__ == '__main__':
    app.run_server()
</code>```

here is the Dash:

Here is the scatter chart ran in my Notebook:

Everything is working - Dash is running well, i can see the dropdown and the pie chart - except the scatter chart - the second one.
I absolutely don't understand why because when I run the scatter chart in my Notebook it's working pretty well.

If you have any idea, don't hesitate.

Title: scatter plot with Dash

Body:
I am coding a Dash page to plot some data for myself.
I want to have some dynamic features on some of my plots.

On my dash I have one dropdown, one pie chart and one scatter chart.

Here is my code:

import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import plotly.graph_objs as go

app = dash.Dash()

app.layout = html.Div([
    html.Label(['Select the Type:']),
    dcc.Dropdown(
        id='type_filter',
        options=[{'label': i, 'value': i} for i in df.Type.unique()],
        value='All'
    ),
    dcc.Graph(
        id='allocation_chart'
    ),
    dcc.Graph(
        id='allocation_history_chart'
    ),
])

@app.callback(
    Output('allocation_chart','figure'),
    [
        Input('type_filter', 'value')
    ]
)
def update_allocation(type_):
    if type_ == 'All':
        filtered = df
    else:
        mask = df['Type'] == type_
        filtered = df.loc[mask]

    data = [
        go.Pie(
            labels=filtered['Asset'],
            values=filtered['Total']
        )
    ]
    return {
        'data': data,
        'layout': go.Layout(title='Asset Allocation by Type')
    }

@app.callback(
    Output('allocation_history_chart','figure'),
    [
        Input('type_filter','value')
    ]

)
def update_allocation_history(type_):
    if type_ == 'All':
        filtered = df_index
    else:
        mask = df['Type'] == type_
        filtered = df_index.loc[mask]

    data = go.Figure()
    for ticker in filtered.index:
        data.add_trace(
            go.Scatter(
                x = filtered.loc[ticker].index,
                y = filtered.loc[ticker],
                name = ticker
            )
        )
    return {
        'data': [data],
        'layout': go.Layout(title='History of Asset')
    }

if __name__ == '__main__':
    app.run_server()

here is the Dash:

Here is the scatter chart ran in my Notebook:

Everything is working - Dash is running well, i can see the dropdown and the pie chart - except the scatter chart - the second one.
I absolutely don't understand why because when I run the scatter chart in my Notebook it's working pretty well.

If you have any idea, don't hesitate.


问:
How do I do if an id already exists in any position of my array add 1 to the quantity property?If id does not exist add an object with quantity set 1
How do I do if an id already exists in any position of my array add 1 to the quantity property? If id does not exist add an object with quantity set to 1

I am doing an ecommerce, and I want when adding a product to my cart to check if the product to be added already exists, if so, to add the quantity property to 1, of the corresponding object

import Image from 'next/image';
import { useShop } from '../context/ShopContext';

export default function ProductCard({ product }) {
  const { setCart, cart, setCartAnimated } = useShop();

  function CartAnimation() {
    setCartAnimated(true);
    setTimeout(() => setCartAnimated(false), 200);
  }

  function addNewItem(productId) {
    setCart((prevCart) => {
      const productIndex = prevCart.findIndex(
        (product) => product.id === productId
      );
      if (productIndex < 0) {
        return [...prevCart, { ...product, quantity: 1 }];
      } else {
        const newProductArr = prevCart;
        newProductArr[productIndex] = {
          ...product,
          quantity: product.quantity + 1,
        };
        return newProductArr;
      }
    });
    console.log(cart);
    CartAnimation();
  }

  return (

        <Image
          className="rounded-lg w-full h-56 object-cover"
          src="https://api.lorem.space/image?w=640&h=480&r=400"
          // src={product.images[0]}
          alt={product.title}
          width="1000"
          height="1000"
        />

            {product.title}

            {product.category.name}

              ${product.price}

            <button
              onClick={() => addNewItem(product.id)}
              type="button"
              className="py-2 px-3 text-xs font-medium text-center text-white bg-blue-700 rounded-lg hover:bg-blue-800"
            >
              Add to bag
            </button>

  );
}```

in the addNewItem function is where I do everything

but I don't understand why it gives me NaN in the quantity property

setCard, and Carl, are useState, but I have useContext to access throughout the application

Body:
How do I do if an id already exists in any position of my array add 1 to the quantity property? If id does not exist add an object with quantity set to 1

I am doing an ecommerce, and I want when adding a product to my cart to check if the product to be added already exists, if so, to add the quantity property to 1, of the corresponding object

import Image from 'next/image';
import { useShop } from '../context/ShopContext';

export default function ProductCard({ product }) {
  const { setCart, cart, setCartAnimated } = useShop();

  function CartAnimation() {
    setCartAnimated(true);
    setTimeout(() => setCartAnimated(false), 200);
  }

  function addNewItem(productId) {
    setCart((prevCart) => {
      const productIndex = prevCart.findIndex(
        (product) => product.id === productId
      );
      if (productIndex < 0) {
        return [...prevCart, { ...product, quantity: 1 }];
      } else {
        const newProductArr = prevCart;
        newProductArr[productIndex] = {
          ...product,
          quantity: product.quantity + 1,
        };
        return newProductArr;
      }
    });
    console.log(cart);
    CartAnimation();
  }

  return (

        <Image
          className="rounded-lg w-full h-56 object-cover"
          src="https://api.lorem.space/image?w=640&h=480&r=400"
          // src={product.images[0]}
          alt={product.title}
          width="1000"
          height="1000"
        />

            {product.title}

            {product.category.name}

              ${product.price}

            <button
              onClick={() => addNewItem(product.id)}
              type="button"
              className="py-2 px-3 text-xs font-medium text-center text-white bg-blue-700 rounded-lg hover:bg-blue-800"
            >
              Add to bag
            </button>

  );
}

in the addNewItem function is where I do everything

but I don't understand why it gives me NaN in the quantity property

setCard, and Carl, are useState, but I have useContext to access throughout the application


问:
How to copy a field from one model to another model in django
suppose I have two models:

```<code>class ModelA(models.Model):
    ...
    field = models.TextField(max_length=200)

class ModelB(models.Model):
    ...
    field = models.TextField(max_length=200)
</code>```

And I want to copy the values from ModelA to ModelB without raw SQL, In Django's ORM

I've tried many variations and I came up with this:

```<code>from django.db.models import F, Subquery, OuterRef

a_objs = ModelA.objects.filter(pk=OuterRef('pk')).values('pk')
ModelB.objects.filter(pk=Subquery(a_objs)).update(field=F(OuterRef('field')))
</code>```

This code fails in the update clause, how can I reference the another model field?
that generates the following query:

```<code>UPDATE model_b
SET model_b.field = model_a.field
FROM model_a
WHERE model_a.id = model_b.id
</code>```

Body:
suppose I have two models:

class ModelA(models.Model):
    ...
    field = models.TextField(max_length=200)

class ModelB(models.Model):
    ...
    field = models.TextField(max_length=200)

And I want to copy the values from ModelA to ModelB without raw SQL, In Django's ORM

I've tried many variations and I came up with this:

from django.db.models import F, Subquery, OuterRef

a_objs = ModelA.objects.filter(pk=OuterRef('pk')).values('pk')
ModelB.objects.filter(pk=Subquery(a_objs)).update(field=F(OuterRef('field')))

This code fails in the update clause, how can I reference the another model field?
that generates the following query:

UPDATE model_b
SET model_b.field = model_a.field
FROM model_a
WHERE model_a.id = model_b.id


问:
Django: Using Union Operator to Combine Queryset Duplicates Objects
I am attempting to create a simple filter of users in my system that both allows admin users to be selected as well as any user that has an M2M association for associated_properties

I normally use the Union Operator | to combine querysets when needed, but I am running into some strangeness I don't understand where the count of both querysets is much lower separately than the combined queryset. For example:

```<code># show all staff to root and admin
staff = Staff.objects.filter(allowed_properties=request.session['property']).exclude(
    user__group__name__iexact='admin').order_by('user__group', 'user__first_name')
# now get admin
staff_admin = Staff.objects.filter(user__group__name__iexact='admin').order_by('user__first_name')
final_staff = staff_admin | staff
# 9, 26, 80...no way 9+26 should equate to 80, so why?
# also many items are duplicated, but only from a few admins
# that have actually been assigned a property
print(len(staff_admin), len(staff), len(final_staff))
</code>```

So what is going on, why would combining a queryset of 9 and 26 create one with 80 that has duplicated entries?

Note: I realize I can use distinct() as a workaround for the duplicate entry error, but that is just solving something I don't understand as my filter() and exclude() do not grab duplicate entries.

Update

Using union() works as expected, but that doesn't answer what the initial issue was.

```<code>final_staff = staff_admin.union(staff, staff_admin)
# 9 26 35
print(len(staff_admin), len(staff), len(final_staff))
</code>```

Body:
I am attempting to create a simple filter of users in my system that both allows admin users to be selected as well as any user that has an M2M association for associated_properties

I normally use the Union Operator | to combine querysets when needed, but I am running into some strangeness I don't understand where the count of both querysets is much lower separately than the combined queryset. For example:

# show all staff to root and admin
staff = Staff.objects.filter(allowed_properties=request.session['property']).exclude(
    user__group__name__iexact='admin').order_by('user__group', 'user__first_name')
# now get admin
staff_admin = Staff.objects.filter(user__group__name__iexact='admin').order_by('user__first_name')
final_staff = staff_admin | staff
# 9, 26, 80...no way 9+26 should equate to 80, so why?
# also many items are duplicated, but only from a few admins
# that have actually been assigned a property
print(len(staff_admin), len(staff), len(final_staff))

So what is going on, why would combining a queryset of 9 and 26 create one with 80 that has duplicated entries?

Note: I realize I can use distinct() as a workaround for the duplicate entry error, but that is just solving something I don't understand as my filter() and exclude() do not grab duplicate entries.

Update

Using union() works as expected, but that doesn't answer what the initial issue was.

final_staff = staff_admin.union(staff, staff_admin)
# 9 26 35
print(len(staff_admin), len(staff), len(final_staff))


问:
Function not taking keyword arguments even though the signature does not suggest that
I am using Python 3.9.12.

The output of help(math.log) is:

```<code>Help on built-in function log in module math:

log(...)
    log(x, [base=math.e])
    Return the logarithm of x to the given base.

    If the base not specified, returns the natural logarithm (base e) of x.
</code>```

There is no slash in the signature to indicate that math.log does not take keyword arguments. Nonetheless, if I try to specify base by name, I get an error.

To make sure that my expectation to have a slash in the signature (despite being a built-in function) is correct, here is the output of help(math.sqrt):

```<code>Help on built-in function sqrt in module math:

sqrt(x, /)
    Return the square root of x.
</code>```

So, why does math.log not accept keyword arguments despite not having a slash in its signature?

Body:
I am using Python 3.9.12.

The output of help(math.log) is:

Help on built-in function log in module math:

log(...)
    log(x, [base=math.e])
    Return the logarithm of x to the given base.

    If the base not specified, returns the natural logarithm (base e) of x.

There is no slash in the signature to indicate that math.log does not take keyword arguments. Nonetheless, if I try to specify base by name, I get an error.

To make sure that my expectation to have a slash in the signature (despite being a built-in function) is correct, here is the output of help(math.sqrt):

Help on built-in function sqrt in module math:

sqrt(x, /)
    Return the square root of x.

So, why does math.log not accept keyword arguments despite not having a slash in its signature?


问:
Grunt - Minifiying hundreds of JS files in a specific order
My current project is setup into 3 main JS files.

1.js (contains jquery, bootstrap etc) around 15 js files
2.js (contains other addons like recaptcha, SAP stuff etc) around 20 files
3.js (contains over 80 custom JS files for my website)

Until this point these were minified by wro4j in a specific order. Meaning I had an XML file in which all my files were placed in the order they needed to be minified.

I'm switching to grunt for minification and I would like to do something like below

```<code>terser: {
            my_project: {
                files: {
                    'webroot/_ui/minified/file1.js': [
                        'webroot/_ui/responsive/common/js/*.js',
                        'webroot/_ui/responsive/common/owlCarousel/owl.carousel.min.js',
                        'webroot/_ui/responsive/common/swiper/swiper-bundle.js'
                    ],

                    'webroot/_ui/minified/file2.js': [
                        'webroot/_ui/addons/common/js/*.js',
                    ],

                    'webroot/_ui/minified/file3.js': [
                        'webroot/_ui/custom/common/js/*.js',
                    ],
                }
            }
        }
</code>```

Can I get away with something similar or I have to maintain the order used in wro4j (meaning I type out individually all JS files in the order they need to be loaded)

Thank you!

Body:
My current project is setup into 3 main JS files.

1.js (contains jquery, bootstrap etc) around 15 js files
2.js (contains other addons like recaptcha, SAP stuff etc) around 20 files
3.js (contains over 80 custom JS files for my website)

Until this point these were minified by wro4j in a specific order. Meaning I had an XML file in which all my files were placed in the order they needed to be minified.

I'm switching to grunt for minification and I would like to do something like below

terser: {
            my_project: {
                files: {
                    'webroot/_ui/minified/file1.js': [
                        'webroot/_ui/responsive/common/js/*.js',
                        'webroot/_ui/responsive/common/owlCarousel/owl.carousel.min.js',
                        'webroot/_ui/responsive/common/swiper/swiper-bundle.js'
                    ],

                    'webroot/_ui/minified/file2.js': [
                        'webroot/_ui/addons/common/js/*.js',
                    ],

                    'webroot/_ui/minified/file3.js': [
                        'webroot/_ui/custom/common/js/*.js',
                    ],
                }
            }
        }

Can I get away with something similar or I have to maintain the order used in wro4j (meaning I type out individually all JS files in the order they need to be loaded)

Thank you!


问:
vue3.0 + axios + Vite how to solve cors server problem?
On my vite.config.js file:

```<code>import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import path from 'node:path'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue(), vueJsx()],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    }
  },
  server: {
    cors: true,
    proxy: {
      "/api": {
        target: "http://localhost:8088",
        secure: false,
        changeOrigin: true,
        rewrite: (path) => {console.log(path); return path.replace(/^\/api/, '')}
      }
    }
  }
})
</code>```

on my axios.js config:

```<code>import axios from "axios";

let config = {
    baseURL: 'http://localhost:8088/api',
    timeout: 1000,
    withCredentials: true
}

const instance = axios.create(config)

export default instance
</code>```

then in my page send a request like this

```<code> $axios.post('/user/login', {
        u_account: ruleForm.account,
        u_password: ruleForm.password
    }).then((response) => {
        if (response.data.code === 200) {
            let token = response.data.token
            console.log('success!')
            window.localStorage.setItem('token', token)
        } else {
            console.log('failed');
        }
    }).catch((err) => {
        console.log(err.message)
    })
</code>```

and then I got that cors request problem.

I've try to rewrite axios.js -> baseURL to 'api', but still no working, can somebody help?

Body:
On my vite.config.js file:

import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import path from 'node:path'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue(), vueJsx()],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    }
  },
  server: {
    cors: true,
    proxy: {
      "/api": {
        target: "http://localhost:8088",
        secure: false,
        changeOrigin: true,
        rewrite: (path) => {console.log(path); return path.replace(/^\/api/, '')}
      }
    }
  }
})

on my axios.js config:

import axios from "axios";

let config = {
    baseURL: 'http://localhost:8088/api',
    timeout: 1000,
    withCredentials: true
}

const instance = axios.create(config)

export default instance

then in my page send a request like this

 $axios.post('/user/login', {
        u_account: ruleForm.account,
        u_password: ruleForm.password
    }).then((response) => {
        if (response.data.code === 200) {
            let token = response.data.token
            console.log('success!')
            window.localStorage.setItem('token', token)
        } else {
            console.log('failed');
        }
    }).catch((err) => {
        console.log(err.message)
    })

and then I got that cors request problem.

I've try to rewrite axios.js -> baseURL to 'api', but still no working, can somebody help?


问:
Unit testcase is failing : class javax.xml.parsers.FactoryFinder (in unnamed module @0x5d1d965d) cannot access class jdk.xml.internal.SecuritySupport
A unit testcase in springboot project is failing .
The unit test case is using power mock , testing, gradle for building .
All other unit testcase are passing which does not use power mock .
But this single testcase is creating the issue .

I have used below annotation at class level but it is still failing .
https://github.com/mockito/mockito/issues/1562

```<code>@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "javax.management.*"})
</code>```

Please suggest some solution . Thank you .

Software version currently using .

Java

```<code>openjdk version "11.0.11" 2021-04-20
OpenJDK Runtime Environment AdoptOpenJDK-11.0.11+9 (build 11.0.11+9)
OpenJDK 64-Bit Server VM AdoptOpenJDK-11.0.11+9 (build 11.0.11+9, mixed mode)
</code>```
```<code>powermockVersion = "2.0.9"
mockitoVersion = "3.6.28"
testNgVersion = "7.4.0"
springBootVersion = "2.7.1"
</code>```

Error log

```<code>class javax.xml.parsers.FactoryFinder (in unnamed module @0x5d1d965d) cannot access class jdk.xml.internal.SecuritySupport (in module java.xml) because module java.xml does not export jdk.xml.internal to unnamed module @0x5d1d965d
java.lang.IllegalAccessError: class javax.xml.parsers.FactoryFinder (in unnamed module @0x5d1d965d) cannot access class jdk.xml.internal.SecuritySupport (in module java.xml) because module java.xml does not export jdk.xml.internal to unnamed module @0x5d1d965d
    at javax.xml.parsers.FactoryFinder.<clinit>(FactoryFinder.java:69)
    at javax.xml.parsers.SAXParserFactory.newInstance(SAXParserFactory.java:147)
    at ch.qos.logback.core.joran.event.SaxEventRecorder.buildSaxParser(SaxEventRecorder.java:79)
    at ch.qos.logback.core.joran.event.SaxEventRecorder.recordEvents(SaxEventRecorder.java:57)
    at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:151)
    at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:110)
    at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:53)
    at ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:64)
    at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:134)
    at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:84)
    at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:55)
    at org.slf4j.LoggerFactory.bind(LoggerFactory.java:150)
    at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:124)
    at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:417)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:362)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:388)
    at com.xyz.wx2.server.auth.AuthInfo.<clinit>(AuthInfo.java:34)
    at com.xyz.wx2.batch.tests.webapp.util.AuthInfoProviderTest.testGetAuthInfo(AuthInfoProviderTest.java:30)
    at com.xyz.wx2.batch.tests.webapp.util.AuthInfoProviderTest_$$_jvstce8_0._d7testGetAuthInfo(AuthInfoProviderTest_$$_jvstce8_0.java)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.powermock.modules.testng.internal.PowerMockTestNGMethodHandler.invoke(PowerMockTestNGMethodHandler.java:50)
    at com.xyz.wx2.batch.tests.webapp.util.AuthInfoProviderTest_$$_jvstce8_0.testGetAuthInfo(AuthInfoProviderTest_$$_jvstce8_0.java)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:133)
    at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:598)
    at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:173)
    at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:46)
    at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:824)
    at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:146)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
    at org.testng.TestRunner.privateRun(TestRunner.java:794)
    at org.testng.TestRunner.run(TestRunner.java:596)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:377)
    at org.testng.SuiteRunner.access$000(SuiteRunner.java:28)
    at org.testng.SuiteRunner$SuiteWorker.run(SuiteRunner.java:418)
    at org.testng.internal.thread.ThreadUtil.lambda$execute$0(ThreadUtil.java:64)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:829)
</code>```

Body:
A unit testcase in springboot project is failing .
The unit test case is using power mock , testing, gradle for building .
All other unit testcase are passing which does not use power mock .
But this single testcase is creating the issue .

I have used below annotation at class level but it is still failing .
https://github.com/mockito/mockito/issues/1562

@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "javax.management.*"})

Please suggest some solution . Thank you .

Software version currently using .

Java

openjdk version "11.0.11" 2021-04-20
OpenJDK Runtime Environment AdoptOpenJDK-11.0.11+9 (build 11.0.11+9)
OpenJDK 64-Bit Server VM AdoptOpenJDK-11.0.11+9 (build 11.0.11+9, mixed mode)

powermockVersion = "2.0.9"
mockitoVersion = "3.6.28"
testNgVersion = "7.4.0"
springBootVersion = "2.7.1"

Error log

class javax.xml.parsers.FactoryFinder (in unnamed module @0x5d1d965d) cannot access class jdk.xml.internal.SecuritySupport (in module java.xml) because module java.xml does not export jdk.xml.internal to unnamed module @0x5d1d965d
java.lang.IllegalAccessError: class javax.xml.parsers.FactoryFinder (in unnamed module @0x5d1d965d) cannot access class jdk.xml.internal.SecuritySupport (in module java.xml) because module java.xml does not export jdk.xml.internal to unnamed module @0x5d1d965d
    at javax.xml.parsers.FactoryFinder.<clinit>(FactoryFinder.java:69)
    at javax.xml.parsers.SAXParserFactory.newInstance(SAXParserFactory.java:147)
    at ch.qos.logback.core.joran.event.SaxEventRecorder.buildSaxParser(SaxEventRecorder.java:79)
    at ch.qos.logback.core.joran.event.SaxEventRecorder.recordEvents(SaxEventRecorder.java:57)
    at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:151)
    at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:110)
    at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:53)
    at ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:64)
    at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:134)
    at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:84)
    at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:55)
    at org.slf4j.LoggerFactory.bind(LoggerFactory.java:150)
    at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:124)
    at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:417)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:362)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:388)
    at com.xyz.wx2.server.auth.AuthInfo.<clinit>(AuthInfo.java:34)
    at com.xyz.wx2.batch.tests.webapp.util.AuthInfoProviderTest.testGetAuthInfo(AuthInfoProviderTest.java:30)
    at com.xyz.wx2.batch.tests.webapp.util.AuthInfoProviderTest_$$_jvstce8_0._d7testGetAuthInfo(AuthInfoProviderTest_$$_jvstce8_0.java)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.powermock.modules.testng.internal.PowerMockTestNGMethodHandler.invoke(PowerMockTestNGMethodHandler.java:50)
    at com.xyz.wx2.batch.tests.webapp.util.AuthInfoProviderTest_$$_jvstce8_0.testGetAuthInfo(AuthInfoProviderTest_$$_jvstce8_0.java)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:133)
    at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:598)
    at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:173)
    at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:46)
    at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:824)
    at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:146)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
    at org.testng.TestRunner.privateRun(TestRunner.java:794)
    at org.testng.TestRunner.run(TestRunner.java:596)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:377)
    at org.testng.SuiteRunner.access$000(SuiteRunner.java:28)
    at org.testng.SuiteRunner$SuiteWorker.run(SuiteRunner.java:418)
    at org.testng.internal.thread.ThreadUtil.lambda$execute$0(ThreadUtil.java:64)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:829)


问:
How to save csv data as excel file using pyqt5
I have a problem while saving a CSV file to excel in the below function. Like after creating a excel file, when try to open it showing error like file format or file extension is not vaild</p>
```<code>def writeCsv(self):
        # find empty cells
        for row in range(self.model.rowCount()):
            for column in range(self.model.columnCount()):
                myitem = self.model.item(row, column)
                if myitem is None:
                    item = QtGui.QStandardItem("")
                    self.model.setItem(row, column, item)
        fileName, _ = QtWidgets.QFileDialog.getSaveFileName(self, "Save File",
                                                            (
                                                                        QtCore.QDir.homePath() + "/Dokumente/CSV/" + self.fname + ".xlsx"),
                                                            "xlsx files(*.xlsx)")
        if fileName:
            print(fileName)
            f = open(fileName, 'w')
            with f:
                writer = csv.writer(f,dialect= 'excel', delimiter = '/t')
                for rowNumber in range(self.model.rowCount()):
                    fields = [self.model.data(self.model.index(rowNumber, columnNumber),
                                              QtCore.Qt.DisplayRole)
                              for columnNumber in range(self.model.columnCount())]
                    writer.writerow(fields)
                self.fname = os.path.splitext(str(fileName))[0].split("/")[-1]
                self.setWindowTitle(self.fname)
                self.isChanged = False
</code>```

Body:
I have a problem while saving a CSV file to excel in the below function. Like after creating a excel file, when try to open it showing error like file format or file extension is not vaild

def writeCsv(self):
        # find empty cells
        for row in range(self.model.rowCount()):
            for column in range(self.model.columnCount()):
                myitem = self.model.item(row, column)
                if myitem is None:
                    item = QtGui.QStandardItem("")
                    self.model.setItem(row, column, item)
        fileName, _ = QtWidgets.QFileDialog.getSaveFileName(self, "Save File",
                                                            (
                                                                        QtCore.QDir.homePath() + "/Dokumente/CSV/" + self.fname + ".xlsx"),
                                                            "xlsx files(*.xlsx)")
        if fileName:
            print(fileName)
            f = open(fileName, 'w')
            with f:
                writer = csv.writer(f,dialect= 'excel', delimiter = '/t')
                for rowNumber in range(self.model.rowCount()):
                    fields = [self.model.data(self.model.index(rowNumber, columnNumber),
                                              QtCore.Qt.DisplayRole)
                              for columnNumber in range(self.model.columnCount())]
                    writer.writerow(fields)
                self.fname = os.path.splitext(str(fileName))[0].split("/")[-1]
                self.setWindowTitle(self.fname)
                self.isChanged = False


问:
Facebook OAuthException with 500 (error code 8)
I'm working with the Facebook iOS SDK (version 15).

When logging in and returning to the app, the Facebook SDK keeps throwing this error

```<code>▿ Optional<Error>
  - some : Error Domain=com.facebook.sdk.core Code=8 "(null)" UserInfo={NSRecoveryAttempter=<FBSDKTemporaryErrorRecoveryAttempter: 0x28219d100>, com.facebook.sdk:FBSDKGraphRequestErrorKey=1, com.facebook.sdk:FBSDKErrorDeveloperMessageKey=An unknown error has occurred., com.facebook.sdk:FBSDKGraphRequestErrorParsedJSONResponseKey={
    body =     {
        error =         {
            code = 1;
            "fbtrace_id" = AK1LoNJP0ca0quThgMVlELr;
            message = "An unknown error has occurred.";
            type = OAuthException;
        };
    };
    code = 500;
}, NSLocalizedRecoveryOptions=(
    OK
), com.facebook.sdk:FBSDKGraphRequestErrorHTTPStatusCodeKey=500, NSLocalizedRecoverySuggestion=The server is temporarily busy, please try again., com.facebook.sdk:FBSDKGraphRequestErrorGraphErrorCodeKey=1}
</code>```

Because of this, Facebook keeps blocking my app, so users cannot log in using Facebook.

Any ideas on what the cause of this could be?

Body:
I'm working with the Facebook iOS SDK (version 15).

When logging in and returning to the app, the Facebook SDK keeps throwing this error

▿ Optional<Error>
  - some : Error Domain=com.facebook.sdk.core Code=8 "(null)" UserInfo={NSRecoveryAttempter=<FBSDKTemporaryErrorRecoveryAttempter: 0x28219d100>, com.facebook.sdk:FBSDKGraphRequestErrorKey=1, com.facebook.sdk:FBSDKErrorDeveloperMessageKey=An unknown error has occurred., com.facebook.sdk:FBSDKGraphRequestErrorParsedJSONResponseKey={
    body =     {
        error =         {
            code = 1;
            "fbtrace_id" = AK1LoNJP0ca0quThgMVlELr;
            message = "An unknown error has occurred.";
            type = OAuthException;
        };
    };
    code = 500;
}, NSLocalizedRecoveryOptions=(
    OK
), com.facebook.sdk:FBSDKGraphRequestErrorHTTPStatusCodeKey=500, NSLocalizedRecoverySuggestion=The server is temporarily busy, please try again., com.facebook.sdk:FBSDKGraphRequestErrorGraphErrorCodeKey=1}

Because of this, Facebook keeps blocking my app, so users cannot log in using Facebook.

Any ideas on what the cause of this could be?


问:
Laravel symlink 404 on shared hosting with a subdomain. Whilst the file exists
I have an issue creating a symbolic link with Laravel on a shared hosting. Output results in a 404 not found.

Structure is as follows;

```<code>- Root
-- system (containing Laravel)
-- public_html
--- subdomain_folder (being public)
</code>```

I've attempted;

```<code>php artisan storage:link

ln -s /home/full/path/domain.com/system/storage/app/public /home/full/path/domain.com/public_html/subdomain_folder
</code>```

When visiting subdomain_folder.domain.com/storage/test.jpg, however. a 404 is shown (and yes, the file exists.

What should the actual virtual link be?

Body:
I have an issue creating a symbolic link with Laravel on a shared hosting. Output results in a 404 not found.

Structure is as follows;

- Root
-- system (containing Laravel)
-- public_html
--- subdomain_folder (being public)

I've attempted;

php artisan storage:link

ln -s /home/full/path/domain.com/system/storage/app/public /home/full/path/domain.com/public_html/subdomain_folder

When visiting subdomain_folder.domain.com/storage/test.jpg, however. a 404 is shown (and yes, the file exists.

What should the actual virtual link be?