问:
Should I create core classes for better quality Flutter code?
I'm trying to improve myself to write better quality code. However, I have a question. For example, does it make sense to create an appbar class like the one below and call that code where I need it? Will it benefit me? Does it provide a performance advantage? Or should I call and use the appbar widget wherever I want instead?</p>
```<code>import 'package:flutter/material.dart';

class MyAppBar extends StatelessWidget with PreferredSizeWidget {
  final Widget? leading;
  final Widget? title;
  final List<Widget>? actions;
  final bool? centerTitle;
  final PreferredSizeWidget? bottom;
  final Color? backgroundColor;
  final TextStyle? titleTextStyle;
  const MyAppBar(
      {super.key,
      this.leading,
      this.title,
      this.actions,
      this.centerTitle,
      this.bottom,
      this.backgroundColor,
      this.titleTextStyle});

  @override
  AppBar build(BuildContext context) {
    return AppBar(
        leading: leading,
        title: title,
        actions: actions,
        centerTitle: centerTitle,
        bottom: bottom,
        backgroundColor: backgroundColor,
        titleTextStyle: titleTextStyle);
  }

  @override
  Size get preferredSize => const Size.fromHeight(kToolbarHeight);
}
</code>```

Body:
I'm trying to improve myself to write better quality code. However, I have a question. For example, does it make sense to create an appbar class like the one below and call that code where I need it? Will it benefit me? Does it provide a performance advantage? Or should I call and use the appbar widget wherever I want instead?

import 'package:flutter/material.dart';

class MyAppBar extends StatelessWidget with PreferredSizeWidget {
  final Widget? leading;
  final Widget? title;
  final List<Widget>? actions;
  final bool? centerTitle;
  final PreferredSizeWidget? bottom;
  final Color? backgroundColor;
  final TextStyle? titleTextStyle;
  const MyAppBar(
      {super.key,
      this.leading,
      this.title,
      this.actions,
      this.centerTitle,
      this.bottom,
      this.backgroundColor,
      this.titleTextStyle});

  @override
  AppBar build(BuildContext context) {
    return AppBar(
        leading: leading,
        title: title,
        actions: actions,
        centerTitle: centerTitle,
        bottom: bottom,
        backgroundColor: backgroundColor,
        titleTextStyle: titleTextStyle);
  }

  @override
  Size get preferredSize => const Size.fromHeight(kToolbarHeight);
}


来源: stackexchange

问:
401 - Unauthorized when fetching data from Django REST framework
I need to fetch a list of emails from Django REST Framework, I'm working with such requests for the first time so I have a little clue how to do this. I'm running the following code:

```<code>fetch("http://68.183.74.14:4005/api/emails/")
.then((response) => console.log(response))
.catch((error) => console.log(error));
</code>```

And I get an error 401 - Unauthorized:

I have login, email and password and the following URLs:

```<code>Endpoints: http://68.183.74.14:4005/swagger/
Base request URL: http://68.183.74.14:4005/api/
</code>```

What am I doing wrong?

ContentLicense: CC BY-SA 4.0

Body:
I need to fetch a list of emails from Django REST Framework, I'm working with such requests for the first time so I have a little clue how to do this. I'm running the following code:

fetch("http://68.183.74.14:4005/api/emails/")
.then((response) => console.log(response))
.catch((error) => console.log(error));

And I get an error 401 - Unauthorized:

I have login, email and password and the following URLs:

Endpoints: http://68.183.74.14:4005/swagger/
Base request URL: http://68.183.74.14:4005/api/

What am I doing wrong?


问:
How to get instagram media metrics ? Cannot get any media info using ig media id, Instagram graph api
I have created different API queries on searching hashtags and searching recent media with that. This all works fine. but when I grab the ID from media objects from the recent_media query and try to query them separately since then I'm able to query more data. It won't work.

https://graph.facebook.com/v7.0/ig_hashtag_search?access_token={token}&user_id={user_id}&q=hashtag_name

This returns

```<code>"data": [
    {
        "id": "17843780662045901"
    }
]
</code>```

Then I query

https://graph.facebook.com/v7.0/17843780662045901/recent_media?access_token={token}&user_id={user_id}&fields=id,media_url

with result

```<code>"data": [
    {
        "id": "17939405797365335"
    },
    {
        "id": "17868693508835640"
    },
</code>```

and then I try to access media with
"get graph.facebook.com/{graph-api-version}/ig_media_id?fields=id,username" endpoint

I get

```<code>{'error':
        {'message': "Unsupported get request. Object with ID '17930129249499764' does not
         exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at
         https://developers.facebook.com/docs/graph-api", 'type': 'GraphMethodException',
        'code': 100, 'error_subcode': 33, 'fbtrace_id': 'A0mF0lmOv0VzfO-dN6NTTFA'}}
</code>```

Following permissions granted at standard access level to my facebook ap:

```<code>    'instagram_basic',
    'pages_show_list',
    'pages_read_engagement'
</code>```

What is the source of problem?

And Is there an alternative wethod to get owner username of an media from media id or media_url using graph api?

Thanks in advance,

Body:
I have created different API queries on searching hashtags and searching recent media with that. This all works fine. but when I grab the ID from media objects from the recent_media query and try to query them separately since then I'm able to query more data. It won't work.

https://graph.facebook.com/v7.0/ig_hashtag_search?access_token={token}&user_id={user_id}&q=hashtag_name

This returns

"data": [
    {
        "id": "17843780662045901"
    }
]

Then I query

https://graph.facebook.com/v7.0/17843780662045901/recent_media?access_token={token}&user_id={user_id}&fields=id,media_url

with result

"data": [
    {
        "id": "17939405797365335"
    },
    {
        "id": "17868693508835640"
    },

and then I try to access media with
"get graph.facebook.com/{graph-api-version}/ig_media_id?fields=id,username" endpoint

I get

{'error':
        {'message': "Unsupported get request. Object with ID '17930129249499764' does not
         exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at
         https://developers.facebook.com/docs/graph-api", 'type': 'GraphMethodException',
        'code': 100, 'error_subcode': 33, 'fbtrace_id': 'A0mF0lmOv0VzfO-dN6NTTFA'}}

Following permissions granted at standard access level to my facebook ap:

    'instagram_basic',
    'pages_show_list',
    'pages_read_engagement'

What is the source of problem?

And Is there an alternative wethod to get owner username of an media from media id or media_url using graph api?

Thanks in advance,


问:
The node package manager (npm) throws error on trying any command
I installed Node.js, but whenever I run npm -v, it throws this output:-

node:internal/modules/cjs/loader:998
  throw err;
  ^

Error: Cannot find module '../lib/cli.js'
Require stack:
- C:\Users\<username>\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:995:15)
    at Module._load (node:internal/modules/cjs/loader:841:27)
    at Module.require (node:internal/modules/cjs/loader:1061:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at Object.<anonymous> (C:\Users\devsa\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js:2:1)
    at Module._compile (node:internal/modules/cjs/loader:1159:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
    at Module.load (node:internal/modules/cjs/loader:1037:32)
    at Module._load (node:internal/modules/cjs/loader:878:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\<username>\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js'
  ]
}

Node.js v18.12.1
```
<p>Whenever I run <code>$node -v</code> it works fine and shows the current version number.</p>
<p>I have also tried reinstalling, but it didn't work.</p>
<p>Output for <code>$ where node</code> :</p>
```C:\Program Files\nodejs\node.exe
```
<p>Output for <code>$ where npm</code> :</p>
```C:\Program Files\nodejs\npm
C:\Program Files\nodejs\npm.cmd
C:\Users\devsa\AppData\Roaming\npm\npm
C:\Users\devsa\AppData\Roaming\npm\npm.cmd
```

Body:
I installed Node.js, but whenever I run npm -v, it throws this output:-

node:internal/modules/cjs/loader:998
  throw err;
  ^

Error: Cannot find module '../lib/cli.js'
Require stack:
- C:\Users\<username>\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:995:15)
    at Module._load (node:internal/modules/cjs/loader:841:27)
    at Module.require (node:internal/modules/cjs/loader:1061:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at Object.<anonymous> (C:\Users\devsa\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js:2:1)
    at Module._compile (node:internal/modules/cjs/loader:1159:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
    at Module.load (node:internal/modules/cjs/loader:1037:32)
    at Module._load (node:internal/modules/cjs/loader:878:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\<username>\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js'
  ]
}

Node.js v18.12.1

Whenever I run $node -v it works fine and shows the current version number.

I have also tried reinstalling, but it didn't work.

Output for $ where node :

C:\Program Files\nodejs\node.exe

Output for $ where npm :

C:\Program Files\nodejs\npm
C:\Program Files\nodejs\npm.cmd
C:\Users\devsa\AppData\Roaming\npm\npm
C:\Users\devsa\AppData\Roaming\npm\npm.cmd


问:
Docker: How to ADD a service via ENV variables?
I have built a Docker Cron Environment to run Cronjobs based on alseambusher/crontab-ui using alpine:3.15.3 & it works great.

For it to work I have had to install a number of things via the Dockerfile, editing it & adding python so it could run a python script, perl for another service, openssl so I could use a Self-signed certificate, etc.

As it stands the Container is a lot bigger, which is fine, but if I am to share the container others won't necessarily want or need the services I have added & will likely need other that I haven't.

I would like to be able to add a command in the ENV of a Docker Compose to add services at startup without having to do a full build each time. I'm sure it would be simpler to add build:>args: & have it rebuild the container each startup, but my goal is to have it add to an image only the services that each user needs & declares in the Docker-Compose with no need to have the files for the build on the system.

I know this will mean a longer startup depending on the services, I'm okay with that.

I know it's normal to run cron on the host & have it call into containers, but cron on Windows WSL has to be manually started every time the WSL starts & is easy to forget about & can't really be automated aside from on startup, & I'd like to do this entirely inside Docker.

How can I add an ENV like SERVICE_INSTALL to have it run in BASH (which is already added in the Dockerfile & present at /bin/bash) at container startup?
Ideally I'd like to be able to add multiple SERVICE_INSTALL lines if at all possible.

Example:

SERVICE_INSTALL1='apk add --update --no-cache python3 && ln -sf python3 /usr/bin/python'

SERVICE_INSTALL2='python3 -m ensurepip'

SERVICE_INSTALL3='apk add --no-cache perl perl-html-parser perl-http-cookies perl-lwp-useragent-determined perl-json perl-json-xs'

Or, if nothing else:

SERVICE_INSTALL=apk add --update --no-cache python3 && ln -sf python3 /usr/bin/python && perl perl-html-parser perl-http-cookies perl-lwp-useragent-determined perl-json perl-json-xs && && wget && curl && nodejs && npm

but then that leaves the problem of installing things through pip or npm.

I have tried adding a command: to the Docker-Compose but every variation I have tried does not work. I'm also concerned with this method as from my understanding a command: replaces the startup script in the container, not adds to it, so that is not ideal, regardless, it doesn't seem like an install command: is possible anyway

I have tried: (Each as a single command: not together)

```<code>    command:
      - BASH apk --update add openssl
      - /bin/bash apk --update add openssl
      - BASH RUN apk --update add openssl
      - /bin/bash RUN apk --update add openssl
      - sh apk --update add openssl
      - /bin/sh apk --update add openssl
      - apk --update add openssl
</code>```

Each ends with a message along the lines of Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "/bin/bash run apk --update add openssl": stat /bin/bash run apk --update add openssl: no such file or directory: unknown

UPDATE: I discovered a few things trying to get this to work

for command: to work there needs to not be any - before it

anything, even on multiple lines, is considered a single command essentially as though they were all on the same line & have to be separated with an &&

it will repeat the command or show the error of it failing to execute the command & not continue to next until it is completed.

for example the command mkdir -p /test leaves no logs, but the container never actually starts. While portainer says it's running trying to bash into it gives a is restarting, wait until the container is running message

mkdir "-p /test" repeats this message

```<code>mkdir: unrecognized option:
BusyBox v1.34.1 (2022-02-02 18:21:20 UTC) multi-call binary.
Usage: mkdir [-m MODE] [-p] DIRECTORY...
Create DIRECTORY
    -m MODE Mode
    -p  No error if exists; make parent directories as needed
</code>```

3 times 3-4 seconds apart, them 7 seconds, then 8 seconds, then 15 seconds, 27 seconds, 53 seconds, then hits a minute & continues to grow a few seconds each try.
It also returns the same wait for the container to be running message when trying to bash in

mkdir -p "/test" seems to be the correct formatting, it appears to work but leaves no logs & when attempting to bash in it connects, shows the terminal, then exits, attempting to reconnect shows the same container is restarting message, likely because the container stopped once the command was finished & is set to restart: always. commenting out the restart command the container exits.

mkdir -p "/test" followed by a new line with supervisord -c /etc/supervisord.conf (the default start command) has mkdir reporting mkdir: unrecognized option: c

adding "supervisord -c /etc/supervisord.conf" leaves no logs & a restarting container.

reversing the order, with supervisord -c /etc/supervisord.conf 1st has supervisord reporting the error Error: positional arguments are not supported: ['mkdir', '-p', '/test'] For help, use /usr/bin/supervisord -h

bash -c "supervisord -c /etc/supervisord.conf with a new line & && mkdir -p /test with a new line & && mkdir -p /test2" runs with a working container, but no directories created

reversing the order seems to work & creates the directories, with a running container

```<code>    command:
      bash -c "mkdir -p /test
      && mkdir -p /test2
      && supervisord -c /etc/supervisord.conf"
</code>```

Which indicates that it will run them in order, but only proceeds to the next after the one finishes.

a test confirmed that the same can be done with other dependencies so long as the initial startup is last. I'd rather have the container start 1st, then install the dependencies while it is running as they are not required for the container itself to run, but rather are added for use in the cronjobs that will be running on a schedule, so if the container starts & the dependencies cannot be used for the 1st 2, 3, even 5 or 10 minutes that might only affect their 1st attempt if it happens to be in that time.

This is alright, I now understand better how the command: option works, but it still requires users to know & properly include the default start command. The command: options are also a lot more particular & easy to get wrong, while ENV variables are something every docker user knows, has experience with, & is simpler to implement

Body:
I have built a Docker Cron Environment to run Cronjobs based on alseambusher/crontab-ui using alpine:3.15.3 & it works great.

For it to work I have had to install a number of things via the Dockerfile, editing it & adding python so it could run a python script, perl for another service, openssl so I could use a Self-signed certificate, etc.

As it stands the Container is a lot bigger, which is fine, but if I am to share the container others won't necessarily want or need the services I have added & will likely need other that I haven't.

I would like to be able to add a command in the ENV of a Docker Compose to add services at startup without having to do a full build each time. I'm sure it would be simpler to add build:>args: & have it rebuild the container each startup, but my goal is to have it add to an image only the services that each user needs & declares in the Docker-Compose with no need to have the files for the build on the system.

I know this will mean a longer startup depending on the services, I'm okay with that.

I know it's normal to run cron on the host & have it call into containers, but cron on Windows WSL has to be manually started every time the WSL starts & is easy to forget about & can't really be automated aside from on startup, & I'd like to do this entirely inside Docker.

How can I add an ENV like SERVICE_INSTALL to have it run in BASH (which is already added in the Dockerfile & present at /bin/bash) at container startup?
Ideally I'd like to be able to add multiple SERVICE_INSTALL lines if at all possible.

Example:

SERVICE_INSTALL1='apk add --update --no-cache python3 && ln -sf python3 /usr/bin/python'

SERVICE_INSTALL2='python3 -m ensurepip'

SERVICE_INSTALL3='apk add --no-cache perl perl-html-parser perl-http-cookies perl-lwp-useragent-determined perl-json perl-json-xs'

Or, if nothing else:

SERVICE_INSTALL=apk add --update --no-cache python3 && ln -sf python3 /usr/bin/python && perl perl-html-parser perl-http-cookies perl-lwp-useragent-determined perl-json perl-json-xs && && wget && curl && nodejs && npm

but then that leaves the problem of installing things through pip or npm.

I have tried adding a command: to the Docker-Compose but every variation I have tried does not work. I'm also concerned with this method as from my understanding a command: replaces the startup script in the container, not adds to it, so that is not ideal, regardless, it doesn't seem like an install command: is possible anyway

I have tried: (Each as a single command: not together)

    command:
      - BASH apk --update add openssl
      - /bin/bash apk --update add openssl
      - BASH RUN apk --update add openssl
      - /bin/bash RUN apk --update add openssl
      - sh apk --update add openssl
      - /bin/sh apk --update add openssl
      - apk --update add openssl

Each ends with a message along the lines of Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "/bin/bash run apk --update add openssl": stat /bin/bash run apk --update add openssl: no such file or directory: unknown

UPDATE: I discovered a few things trying to get this to work

for command: to work there needs to not be any - before it

anything, even on multiple lines, is considered a single command essentially as though they were all on the same line & have to be separated with an &&

it will repeat the command or show the error of it failing to execute the command & not continue to next until it is completed.

for example the command mkdir -p /test leaves no logs, but the container never actually starts. While portainer says it's running trying to bash into it gives a is restarting, wait until the container is running message

mkdir "-p /test" repeats this message

mkdir: unrecognized option:
BusyBox v1.34.1 (2022-02-02 18:21:20 UTC) multi-call binary.
Usage: mkdir [-m MODE] [-p] DIRECTORY...
Create DIRECTORY
    -m MODE Mode
    -p  No error if exists; make parent directories as needed

3 times 3-4 seconds apart, them 7 seconds, then 8 seconds, then 15 seconds, 27 seconds, 53 seconds, then hits a minute & continues to grow a few seconds each try.
It also returns the same wait for the container to be running message when trying to bash in

mkdir -p "/test" seems to be the correct formatting, it appears to work but leaves no logs & when attempting to bash in it connects, shows the terminal, then exits, attempting to reconnect shows the same container is restarting message, likely because the container stopped once the command was finished & is set to restart: always. commenting out the restart command the container exits.

mkdir -p "/test" followed by a new line with supervisord -c /etc/supervisord.conf (the default start command) has mkdir reporting mkdir: unrecognized option: c

adding "supervisord -c /etc/supervisord.conf" leaves no logs & a restarting container.

reversing the order, with supervisord -c /etc/supervisord.conf 1st has supervisord reporting the error Error: positional arguments are not supported: ['mkdir', '-p', '/test'] For help, use /usr/bin/supervisord -h

bash -c "supervisord -c /etc/supervisord.conf with a new line & && mkdir -p /test with a new line & && mkdir -p /test2" runs with a working container, but no directories created

reversing the order seems to work & creates the directories, with a running container

    command:
      bash -c "mkdir -p /test
      && mkdir -p /test2
      && supervisord -c /etc/supervisord.conf"

Which indicates that it will run them in order, but only proceeds to the next after the one finishes.

a test confirmed that the same can be done with other dependencies so long as the initial startup is last. I'd rather have the container start 1st, then install the dependencies while it is running as they are not required for the container itself to run, but rather are added for use in the cronjobs that will be running on a schedule, so if the container starts & the dependencies cannot be used for the 1st 2, 3, even 5 or 10 minutes that might only affect their 1st attempt if it happens to be in that time.

This is alright, I now understand better how the command: option works, but it still requires users to know & properly include the default start command. The command: options are also a lot more particular & easy to get wrong, while ENV variables are something every docker user knows, has experience with, & is simpler to implement


问:
How convert this command to okhttp in java?
I want to convert the following command to okhttp commands, but I fail. I will mention that I work in IntelliJ in java in a Linux environment.

This command that I try to convert:

```<code>$ curl --silent -XPOST --unix-socket /run/docker.sock -d '{"Image":"redis:latest"}' -H 'Content-Type: application/json' http://localhost/containers/create?name=redis
</code>```

This command picks up an docker image called redis.

And this is the code I'm trying to do it with:

```<code>public boolean createContainer(String dockerImage) {

        String data = "{\"Image\":\"redis:latest\"}";
        RequestBody body = RequestBody.create(
                MediaType.parse("application/json"),data);
        Request request = new Request.Builder().url("http://localhost:2375/containers/create/" +dockerImage)
                .post(body).build();

        Response response = null;
        try {
            response = client.newCall(request).execute();
        } catch (IOException e) {
            e.printStackTrace();
            return false;
        }

        response.close();
        return true;
    }
</code>```

But when I run this code and then check in the terminal with the same command, I expect to get an error that this image already exists, but I get an Id. What this means is that the command is not working.

Below is a command that I was able to convert to okhttp with some kind of ID:

```<code> curl --silent -XPOST --unix-socket /run/docker.sock -H 'Content-Type: application/json' http://localhost/containers/1c022ba8c88382b1bad03c5d32146f66b698b5211ea37057cb56f76537228b0e/start
</code>```

the conversion:

```<code>public boolean doContainer(String containerId, String action) {
        MediaType textPlainMT = MediaType.parse("application/json");
        String helloMsg = "Hello OkHttp";

        Request request = new Request.Builder().url("http://localhost:2375/containers/" + containerId +"/" + action)
                .post(RequestBody.create(textPlainMT, "{}")).build();

        Response response = null;
        try {
            response = client.newCall(request).execute();
        } catch (IOException e) {
            e.printStackTrace();
            return false;
        }

        response.close();
        return true;
    }
</code>```

It works fine, but the first command doesn't work well.
I hope I explained myself well, and I would be happy to answer.

Body:
I want to convert the following command to okhttp commands, but I fail. I will mention that I work in IntelliJ in java in a Linux environment.

This command that I try to convert:

$ curl --silent -XPOST --unix-socket /run/docker.sock -d '{"Image":"redis:latest"}' -H 'Content-Type: application/json' http://localhost/containers/create?name=redis

This command picks up an docker image called redis.

And this is the code I'm trying to do it with:

public boolean createContainer(String dockerImage) {

        String data = "{\"Image\":\"redis:latest\"}";
        RequestBody body = RequestBody.create(
                MediaType.parse("application/json"),data);
        Request request = new Request.Builder().url("http://localhost:2375/containers/create/" +dockerImage)
                .post(body).build();

        Response response = null;
        try {
            response = client.newCall(request).execute();
        } catch (IOException e) {
            e.printStackTrace();
            return false;
        }

        response.close();
        return true;
    }

But when I run this code and then check in the terminal with the same command, I expect to get an error that this image already exists, but I get an Id. What this means is that the command is not working.

Below is a command that I was able to convert to okhttp with some kind of ID:

 curl --silent -XPOST --unix-socket /run/docker.sock -H 'Content-Type: application/json' http://localhost/containers/1c022ba8c88382b1bad03c5d32146f66b698b5211ea37057cb56f76537228b0e/start

the conversion:

public boolean doContainer(String containerId, String action) {
        MediaType textPlainMT = MediaType.parse("application/json");
        String helloMsg = "Hello OkHttp";

        Request request = new Request.Builder().url("http://localhost:2375/containers/" + containerId +"/" + action)
                .post(RequestBody.create(textPlainMT, "{}")).build();

        Response response = null;
        try {
            response = client.newCall(request).execute();
        } catch (IOException e) {
            e.printStackTrace();
            return false;
        }

        response.close();
        return true;
    }

It works fine, but the first command doesn't work well.
I hope I explained myself well, and I would be happy to answer.


问:
Why can't I get the id value from this anchor tag?
I'm using JavaScript to create an anchor tag for a popover. The code works perfectly. But then I need to get the anchor tag's id in a different function, but it's not working for some reason. I'm just learning JavaScript / JQuery so I think it may be some fundamental scope issue I don't know yet.

The code where I create the anchor tag:

```<code>$(document).ready(function(){
    $('.image-options').each(function() {
        var icon_id = $(this).attr('id');
        a_tag_id = icon_id + "a";

        var popString1 = "";
        popString1 = popString1 + "<a href=“” class='options collect-modal' id='" + a_tag_id + "'>Add to collection <span class='icon-pop'><i class='fa-solid fa-plus'></i></span></a>";
        $(icon_id).attr('data-bs-title', popString1);
    });
});
</code>```

This is the other code:

```<code>$(document).ready(function() {
    $(".collect-modal").click(function(e) {
        e.preventDefault();
        var buttonId = $(this).attr('id');
        alert(buttonId);
    });
});
</code>```

Please let me know if any additional info/code is needed.

EDIT: As suggested, I suspect it's an issue of direct vs delegated event handlers. Also, as requested I'm sharing an MRE:

$(document).ready(function(){
    $('.image-options').each(function() {
        var icon_id = $(this).attr('id');
        a_tag_id = icon_id + "a";

        var popString1 = "";
        popString1 = popString1 + "Add to collection ";
        $(icon_id).attr('data-bs-title', popString1);
    });
});

$(document).click(".collect-modal", function(e) {
    e.preventDefault();
    var buttonId = $(this).attr('id');
    alert(buttonId);
});```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<div class="card border-0 overflow-hidden">
   <div class="position-relative">
      <img class="card-img-top card-img-bottom" data-bs-toggle="modal" data-bs-target="#myModal" src="https://picsum.photos/200" id="125img">
   </div>
   <i class="fa-solid fa-ellipsis"></i>
</div></code>```

I changed the second code as suggested by @disinfor and at least it does something now, but now I get an undefined error.

Body:
I'm using JavaScript to create an anchor tag for a popover. The code works perfectly. But then I need to get the anchor tag's id in a different function, but it's not working for some reason. I'm just learning JavaScript / JQuery so I think it may be some fundamental scope issue I don't know yet.

The code where I create the anchor tag:

$(document).ready(function(){
    $('.image-options').each(function() {
        var icon_id = $(this).attr('id');
        a_tag_id = icon_id + "a";

        var popString1 = "";
        popString1 = popString1 + "Add to collection ";
        $(icon_id).attr('data-bs-title', popString1);
    });
});

This is the other code:

$(document).ready(function() {
    $(".collect-modal").click(function(e) {
        e.preventDefault();
        var buttonId = $(this).attr('id');
        alert(buttonId);
    });
});

Please let me know if any additional info/code is needed.

EDIT: As suggested, I suspect it's an issue of direct vs delegated event handlers. Also, as requested I'm sharing an MRE:

$(document).ready(function(){
    $('.image-options').each(function() {
        var icon_id = $(this).attr('id');
        a_tag_id = icon_id + "a";

        var popString1 = "";
        popString1 = popString1 + "Add to collection ";
        $(icon_id).attr('data-bs-title', popString1);
    });
});

$(document).click(".collect-modal", function(e) {
    e.preventDefault();
    var buttonId = $(this).attr('id');
    alert(buttonId);
});

I changed the second code as suggested by @disinfor and at least it does something now, but now I get an undefined error.


问:
Laravel/ui auth custom parameters
How can i set custom Auth::user()->***?
I have 2 tables, table 'users' and table 'roles',
When it executes the SQL it returns the parameters, but i want to add custom parameters with INNER JOIN from the table 'roles' so i can have Auth::user()->role, Auth::user()->prefix, etc...

So, more simply:

I have table 'users' and table 'roles'
Laravel auth only takes parameters from the users table
I want that it uses a INNER JOIN so it takes parameters from roles table too

I tried a SQL like this (SELECT users.*, roles.prefix, roles.color FROM users INNER JOIN roles ON users.roleId = roles.roleId WHERE users.id = 1;) and works, but how can i do the same thing with laravel auth?

Title: Laravel/ui auth custom parameters


问:
TypeError for correlation matrix for stocks during given period - Python
I am currently trying to get a program in Python that helps me to calculate the correlation in movement between equities.

The idea is to input multiple equities and have the program complete a matrix correlation.

I copied the code off of a YouTube tutorial, the idea was to adapt to my needs afterwards since I am a beginner and no expert in coding. In the video the code works fine, on my end I keep getting the same error messages.

Here is the code:

```<code>import numpy as np
import pandas as pd
# Used to grab the stock prices, with yahoo
import pandas_datareader as web
from datetime import datetime
# To visualize the results
import matplotlib.pyplot as plt
import seaborn

start = datetime(2021, 1, 1)
symbols_list = ['A',    'AAPL']
#array to store prices
symbols=[]

#array to store prices
symbols=[]
for ticker in symbols_list:
    r = web.DataReader(ticker, 'yahoo', start)
    # add a symbol column
    r['Symbol'] = ticker
    symbols.append(r)
# concatenate into df
df = pd.concat(symbols)
df = df.reset_index()
df = df[['Date', 'Close', 'Symbol']]
df.head()
df_pivot=df.pivot('Date','Symbol','Close').reset_index()
df_pivot.head()

corr_df = df_pivot.corr(method='pearson')
#reset symbol as index (rather than 0-X)
corr_df.head().reset_index()
#del corr_df.index.name
corr_df.head(10)

#plt.figure(figsize=(13,8)
#seaborn.heatmap(corr_df, annot=True, cmap='coolwarm')
#plt.figure()
</code>```

Here is the error I am getting:

Body:
I am currently trying to get a program in Python that helps me to calculate the correlation in movement between equities.

The idea is to input multiple equities and have the program complete a matrix correlation.

I copied the code off of a YouTube tutorial, the idea was to adapt to my needs afterwards since I am a beginner and no expert in coding. In the video the code works fine, on my end I keep getting the same error messages.

Here is the code:

import numpy as np
import pandas as pd
# Used to grab the stock prices, with yahoo
import pandas_datareader as web
from datetime import datetime
# To visualize the results
import matplotlib.pyplot as plt
import seaborn

start = datetime(2021, 1, 1)
symbols_list = ['A',    'AAPL']
#array to store prices
symbols=[]

#array to store prices
symbols=[]
for ticker in symbols_list:
    r = web.DataReader(ticker, 'yahoo', start)
    # add a symbol column
    r['Symbol'] = ticker
    symbols.append(r)
# concatenate into df
df = pd.concat(symbols)
df = df.reset_index()
df = df[['Date', 'Close', 'Symbol']]
df.head()
df_pivot=df.pivot('Date','Symbol','Close').reset_index()
df_pivot.head()

corr_df = df_pivot.corr(method='pearson')
#reset symbol as index (rather than 0-X)
corr_df.head().reset_index()
#del corr_df.index.name
corr_df.head(10)

#plt.figure(figsize=(13,8)
#seaborn.heatmap(corr_df, annot=True, cmap='coolwarm')
#plt.figure()

Here is the error I am getting:


问:
Getting 500 | Internal Server Error when using getServerSideProps only on host (not local)
I know it's an old question but I couldn't resolve this issue. I have a dynamic page using ssr (getServerSidePros). It is working perfectly on my localhost (both of development and production mode), but when I publish it ,I see 500|Internal Server Error. In my console window I see this:
main-50de763069eba4b2.js:1 A client-side exception has occurred, see here for more info: https://nextjs.org/docs/messages/client-side-exception-occurred  and I don't get any details.

This is my code

```<code>export async function getServerSideProps(context:any) {
  var id:number=context.params.id
 console.log(context.params.id)
    var data:any={}

  const getData=async()=>{
    const response:any= await axios.get(`http://localhost:99/api/v1/Blog/${id}`)
    data=response.data
    return data
  }

  data=await getData();
  data=JSON.parse(JSON.stringify(data))

return {
    props: {data}, // will be passed to the page component as props
  }
}
</code>```

Some solutions I've tried:

1-adding "main":"index.js"

2-adding axios.defaults.httpsAgent=new https.Agent({rejectUnauthorized:false,})

3-using .json() instead of JSON.stringify()

Body:
I know it's an old question but I couldn't resolve this issue. I have a dynamic page using ssr (getServerSidePros). It is working perfectly on my localhost (both of development and production mode), but when I publish it ,I see 500|Internal Server Error. In my console window I see this:
main-50de763069eba4b2.js:1 A client-side exception has occurred, see here for more info: https://nextjs.org/docs/messages/client-side-exception-occurred  and I don't get any details.

This is my code

export async function getServerSideProps(context:any) {
  var id:number=context.params.id
 console.log(context.params.id)
    var data:any={}

  const getData=async()=>{
    const response:any= await axios.get(`http://localhost:99/api/v1/Blog/${id}`)
    data=response.data
    return data
  }

  data=await getData();
  data=JSON.parse(JSON.stringify(data))

return {
    props: {data}, // will be passed to the page component as props
  }
}

Some solutions I've tried:

1-adding "main":"index.js"

2-adding axios.defaults.httpsAgent=new https.Agent({rejectUnauthorized:false,})

3-using .json() instead of JSON.stringify()


问:
nextjs cann't run in localhost
i have a project with nextjs , i have install dependency yet , and run but it 's appreared message "Error: A page's revalidate option must be seconds expressed as a natural number for /. Mixed numbers, such as 'NaN', cannot be used.
Try changing the value to 'NaN' or using Math.ceil() if you're computing the value"

what shoud i do ?
thank anyone , i'm a newbie

i try to install package by yarn install and run yarn run dev but that 's not working in localhost ?

Title: nextjs cann't run in localhost


问:
How to Detect Shapes in Images in Python using OpenCV?
I'm trying to read the shapes in the image and print them to my array, but I can't succeed. It doesn't form exactly correctly.

import numpy as np
import cv2

shapes=[]
img = cv2.imread('objects.png')
img = cv2.resize(img,(500,500), fx=0,fy=0)
imgGry = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

ret , thrash = cv2.threshold(imgGry, 240 , 255, cv2.CHAIN_APPROX_NONE)
contours , hierarchy = cv2.findContours(thrash, cv2.RETR_TREE, cv2.CHAIN_APPROX_NONE)

for contour in contours:
    approx = cv2.approxPolyDP(contour, 0.01* cv2.arcLength(contour, True), True)
    cv2.drawContours(img, [approx], 0, (0, 0, 0), 5)
    x = approx.ravel()[0]
    y = approx.ravel()[1] - 5
    if len(approx) == 3:
        shapes.append("Triangle")

    elif len(approx) == 4 :
        x, y , w, h = cv2.boundingRect(approx)
        aspectRatio = float(w)/h
        print(aspectRatio)
        if aspectRatio >= 0.95 and aspectRatio < 3.05:
            shapes.append("Square")

cv2.imshow('shapes', img)
cv2.waitKey(0)
cv2.destroyAllWindows()

print(shapes)
```

It should give the number of pictures as output [Square,Triangle,Square,Triangle,Square,Triangle]

Body:
I'm trying to read the shapes in the image and print them to my array, but I can't succeed. It doesn't form exactly correctly.

import numpy as np
import cv2

shapes=[]
img = cv2.imread('objects.png')
img = cv2.resize(img,(500,500), fx=0,fy=0)
imgGry = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

ret , thrash = cv2.threshold(imgGry, 240 , 255, cv2.CHAIN_APPROX_NONE)
contours , hierarchy = cv2.findContours(thrash, cv2.RETR_TREE, cv2.CHAIN_APPROX_NONE)

for contour in contours:
    approx = cv2.approxPolyDP(contour, 0.01* cv2.arcLength(contour, True), True)
    cv2.drawContours(img, [approx], 0, (0, 0, 0), 5)
    x = approx.ravel()[0]
    y = approx.ravel()[1] - 5
    if len(approx) == 3:
        shapes.append("Triangle")

    elif len(approx) == 4 :
        x, y , w, h = cv2.boundingRect(approx)
        aspectRatio = float(w)/h
        print(aspectRatio)
        if aspectRatio >= 0.95 and aspectRatio < 3.05:
            shapes.append("Square")

cv2.imshow('shapes', img)
cv2.waitKey(0)
cv2.destroyAllWindows()

print(shapes)

It should give the number of pictures as output [Square,Triangle,Square,Triangle,Square,Triangle]


问:
I got "Unresolved variable" using Svelte with WebStorm
WebStorm works really bad with Svelte. I'm new in Svelte though may be I didn't miss smth?

I have a store:

import { writable } from 'svelte/store'
import type { IQuestion } from 'src/utils/db'

interface IQuestionStore {
  activeQuestion: null | IQuestion
  isQuestionShowing: boolean
  isAnswered: boolean
}

const createStore = () => {
  const { subscribe, update } = writable<IQuestionStore>({
    activeQuestion: null,
    isQuestionShowing: false,
    isAnswered: false
  })

  return {
    subscribe,
    answer: () => update((state) => ({ ...state, isAnswered: true })),
    show: (activeQuestion: IQuestion) =>
      update((state) => ({ ...state, activeQuestion, isQuestionShowing: true })),
    close: () =>
      setTimeout(() => {
        update((state) => ({ ...state, isQuestionShowing: false, isAnswered: false }))
      }, 1000)
  }
}

export const questionStore = createStore()
```
<p>And then in component, when I try to get <code>isAnswered</code> I get an error in WebStorm "Unresolved variable isAnswered". By the way VSCode doesn't highlight it like an error.</p>
<pre class="lang-js prettyprint-override"><code><script lang="ts">
  import { questionStore } from '../store/questionStore'

  console.log($questionStore.isAnswered)
</script>
</code>```

If I convert store to this it works well:

interface IQuestionStore {
  activeQuestion: null | IQuestion
  isQuestionShowing: boolean
  isAnswered: boolean
}

export const questionStore = writable<IQuestionStore>({
    activeQuestion: null,
    isQuestionShowing: false,
    isAnswered: false
  })
```

And! I also have an another store which looks the same in general, just other names. And it works well too! WTF? May be I'm missing something? Or may be I need to make some fixes in WebStorm to force it work well with Svelte?

Body:
WebStorm works really bad with Svelte. I'm new in Svelte though may be I didn't miss smth?

I have a store:

import { writable } from 'svelte/store'
import type { IQuestion } from 'src/utils/db'

interface IQuestionStore {
  activeQuestion: null | IQuestion
  isQuestionShowing: boolean
  isAnswered: boolean
}

const createStore = () => {
  const { subscribe, update } = writable<IQuestionStore>({
    activeQuestion: null,
    isQuestionShowing: false,
    isAnswered: false
  })

  return {
    subscribe,
    answer: () => update((state) => ({ ...state, isAnswered: true })),
    show: (activeQuestion: IQuestion) =>
      update((state) => ({ ...state, activeQuestion, isQuestionShowing: true })),
    close: () =>
      setTimeout(() => {
        update((state) => ({ ...state, isQuestionShowing: false, isAnswered: false }))
      }, 1000)
  }
}

export const questionStore = createStore()

And then in component, when I try to get isAnswered I get an error in WebStorm "Unresolved variable isAnswered". By the way VSCode doesn't highlight it like an error.

If I convert store to this it works well:

interface IQuestionStore {
  activeQuestion: null | IQuestion
  isQuestionShowing: boolean
  isAnswered: boolean
}

export const questionStore = writable<IQuestionStore>({
    activeQuestion: null,
    isQuestionShowing: false,
    isAnswered: false
  })

And! I also have an another store which looks the same in general, just other names. And it works well too! WTF? May be I'm missing something? Or may be I need to make some fixes in WebStorm to force it work well with Svelte?


问:
Failed to import dump into existing remote DBMS (using Neo4j desktop terminal)
I got this error "Archive does not exist".  Please see attached screenshot of the Neo4j desktop structure.

Here is what I did:

```<code>bash-3.2$ bin/neo4j-admin load --from=data/dumps/dbms-neo4j-Dec-13-2022-10-12-01.dump --database=Remote --force
Selecting JVM - Version:11.0.14.1+1-LTS, Name:OpenJDK 64-Bit Server VM, Vendor:Azul Systems, Inc.
Archive does not exist: data/dumps/dbms-neo4j-Dec-13-2022-10-12-01.dump
</code>```

Body:
I got this error "Archive does not exist".  Please see attached screenshot of the Neo4j desktop structure.

Here is what I did:

bash-3.2$ bin/neo4j-admin load --from=data/dumps/dbms-neo4j-Dec-13-2022-10-12-01.dump --database=Remote --force
Selecting JVM - Version:11.0.14.1+1-LTS, Name:OpenJDK 64-Bit Server VM, Vendor:Azul Systems, Inc.
Archive does not exist: data/dumps/dbms-neo4j-Dec-13-2022-10-12-01.dump


问:
how to link schema with another schema in mongoose
Here is my problem i have a itemSchema and i am using this itemSchema as data type of listShecma Second Key value the listSchema has two propery first name and second items whose data type is [itemSchema] but when i create h new document and save it to lists collection it don't show up on console.log it shows undefinde i have added defailtItem(Sorry its a typo but leave it because i am using same name everywhere and it does not conatin any errors) on console.log defailtItem it show my array with javacript objhe itemSchema Here is Some code

```<code>const express = require("express");

const bodyparser = require("body-parser");
const { default: mongoose } = require("mongoose");

// const date = require(__dirname + "/date.js");
// console.log(date);
const app = express();

// const items = ["Code", "Sleep", "Repeat"];

// const workitems =[];

app.set("view engine", "ejs");
app.use(bodyparser.urlencoded({
  extended: true
}));
app.use(express.static('public'));
//Mongoose connection
mongoose.set('strictQuery', true); mongoose.connect('mongodb://127.0.0.1/todolistDB');
const db = mongoose.connection;

//mongoose item schema

const itemsSchema = {
     name: String
}

//mongoose model

const Item = mongoose.model("Item", itemsSchema);

//creating items

const item1 = new Item ({
  name: "welcome to do the todolist"
});

const item2 = new Item ({
  name: "hit the + button to add the item"
});

const item3 = new Item ({
  name: "hit this to delete an item"
});

const defaultItems = [item1, item2, item3];

const listSchema = {
  name: String,
  item: [itemsSchema]
};

const List = mongoose.model("List", listSchema);

app.get("/", function(req, res) {
  // const day = date.getDate();

  Item.find({}, function(err, foundItems){
    if (foundItems.length === 0){
      Item.insertMany(defaultItems, function(err){
        if(err){
          console.log(err);
        }else{
          console.log("sucessfully saved default items to the db");
        }
      });
      res.redirect("/");
    }else{
      res.render('list', {
        listTitle: "today",
        newListItems: foundItems
      });
    }

  });

});

app.get("/:customListName", function(req, res){
  const customListName = req.params.customListName;

const list =  new List({
  name: customListName,
  items: defaultItems
});

console.log(list.items);
list.save();

});
</code>```

i want the customListName along with items

Body:
Here is my problem i have a itemSchema and i am using this itemSchema as data type of listShecma Second Key value the listSchema has two propery first name and second items whose data type is [itemSchema] but when i create h new document and save it to lists collection it don't show up on console.log it shows undefinde i have added defailtItem(Sorry its a typo but leave it because i am using same name everywhere and it does not conatin any errors) on console.log defailtItem it show my array with javacript objhe itemSchema Here is Some code

const express = require("express");

const bodyparser = require("body-parser");
const { default: mongoose } = require("mongoose");

// const date = require(__dirname + "/date.js");
// console.log(date);
const app = express();

// const items = ["Code", "Sleep", "Repeat"];

// const workitems =[];

app.set("view engine", "ejs");
app.use(bodyparser.urlencoded({
  extended: true
}));
app.use(express.static('public'));
//Mongoose connection
mongoose.set('strictQuery', true); mongoose.connect('mongodb://127.0.0.1/todolistDB');
const db = mongoose.connection;

//mongoose item schema

const itemsSchema = {
     name: String
}

//mongoose model

const Item = mongoose.model("Item", itemsSchema);

//creating items

const item1 = new Item ({
  name: "welcome to do the todolist"
});

const item2 = new Item ({
  name: "hit the + button to add the item"
});

const item3 = new Item ({
  name: "hit this to delete an item"
});

const defaultItems = [item1, item2, item3];

const listSchema = {
  name: String,
  item: [itemsSchema]
};

const List = mongoose.model("List", listSchema);

app.get("/", function(req, res) {
  // const day = date.getDate();

  Item.find({}, function(err, foundItems){
    if (foundItems.length === 0){
      Item.insertMany(defaultItems, function(err){
        if(err){
          console.log(err);
        }else{
          console.log("sucessfully saved default items to the db");
        }
      });
      res.redirect("/");
    }else{
      res.render('list', {
        listTitle: "today",
        newListItems: foundItems
      });
    }

  });

});

app.get("/:customListName", function(req, res){
  const customListName = req.params.customListName;

const list =  new List({
  name: customListName,
  items: defaultItems
});

console.log(list.items);
list.save();

});

i want the customListName along with items


问:
SonarCould Error: org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar

I have a project managed with maven, and after successful mvn test I was running the analysis with sonarcloud.

I ran the mvn verify sonar:sonar command, but as you can see in the image the build failed.
the plugin in the pom file:

```<code><build>
        <plugins>
            <!-- Maven Release Plugin -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>${maven.release.version}</version>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.maven.release</groupId>
                        <artifactId>maven-release-oddeven-policy</artifactId>
                        <version>${maven.release.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.apache.maven.scm</groupId>
                        <artifactId>maven-scm-provider-gitexe</artifactId>
                        <version>1.9.4</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <goals>deploy</goals>
                    <localCheckout>true</localCheckout>
                    <releaseProfiles>release</releaseProfiles>
                    <useReleaseProfile>false</useReleaseProfile>
                    <projectVersionPolicyId>OddEvenVersionPolicy</projectVersionPolicyId>
                </configuration>
            </plugin>
            <!-- Maven Source Plugin -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>3.0.1</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!-- Maven Enforcer Plugin -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <executions>
                    <execution>
                        <id>enforce-maven</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireMavenVersion>
                                    <version>[3.3.9,)</version>
                                </requireMavenVersion>
                                <requireJavaVersion>
                                    <message>Project must be compiled
                                        with Java 8 or higher
                                    </message>
                                    <version>1.8.0</version>
                                </requireJavaVersion>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!-- Maven Compiler Plugin -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>com.github.eirslett</groupId>
                    <artifactId>frontend-maven-plugin</artifactId>
                    <version>1.7.6</version>
                    <configuration>
                        <nodeVersion>v10.13.0</nodeVersion>
                        <npmVersion>6.9.0</npmVersion>
                    </configuration>
                    <executions>
                        <execution>
                            <id>install node and npm</id>
                            <goals>
                                <goal>install-node-and-npm</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>npm install</id>
                            <goals>
                                <goal>npm</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <!-- Maven Jar Plugin -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>3.1.2</version>
                </plugin>
                <!-- Maven Clean Plugin -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-clean-plugin</artifactId>
                    <version>3.0.0</version>
                </plugin>
                <!-- BND Maven Plugin -->
                <plugin>
                    <groupId>biz.aQute.bnd</groupId>
                    <artifactId>bnd-maven-plugin</artifactId>
                    <version>${bnd.version}</version>
                </plugin>
                <plugin>
                    <groupId>biz.aQute.bnd</groupId>
                    <artifactId>bnd-baseline-maven-plugin</artifactId>
                    <version>${bnd.version}</version>
                </plugin>
                <!-- Maven Resources Plugin -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>3.0.2</version>
                </plugin>
                <!-- Maven Compiler Plugin -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.6.1</version>
                </plugin>
                <!-- Maven Installer Plugin -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-install-plugin</artifactId>
                    <version>2.5.2</version>
                </plugin>
                <!-- Maven Surefire Plugin -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.22.1</version>
                    <configuration>
                        <useSystemClassLoader>false</useSystemClassLoader>
                    </configuration>
                </plugin>
                <!-- Maven Failsafe Plugin -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>2.22.1</version>
                </plugin>
                <!-- Maven Deploy Plugin -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>2.8.2</version>
                </plugin>
                <!-- Apache Sling Plugin -->
                <plugin>
                    <groupId>org.apache.sling</groupId>
                    <artifactId>sling-maven-plugin</artifactId>
                    <version>2.4.0</version>
                    <configuration>
                        <slingUrl>http://${aem.host}:${aem.port}/system/console</slingUrl>
                        <deploymentMethod>WebConsole</deploymentMethod>
                    </configuration>
                </plugin>
                <!-- HTL Maven Plugin -->
                <plugin>
                    <groupId>org.apache.sling</groupId>
                    <artifactId>htl-maven-plugin</artifactId>
                    <version>1.0.6</version>
                    <configuration>
                        <failOnWarnings>true</failOnWarnings>
                    </configuration>
                    <executions>
                        <execution>
                            <goals>
                                <goal>validate</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <!-- Jackrabbit FileVault Package Plugin -->
                <plugin>
                    <groupId>org.apache.jackrabbit</groupId>
                    <artifactId>filevault-package-maven-plugin</artifactId>
                    <version>1.0.3</version>
                    <configuration>
                        <filterSource>src/main/content/META-INF/vault/filter.xml</filterSource>
                    </configuration>
                </plugin>
                <!-- Content Package Plugin -->
                <plugin>
                    <groupId>com.day.jcr.vault</groupId>
                    <artifactId>content-package-maven-plugin</artifactId>
                    <version>1.0.2</version>
                    <configuration>
                        <targetURL>http://${aem.host}:${aem.port}/crx/packmgr/service.jsp</targetURL>
                        <failOnError>true</failOnError>
                        <userId>${vault.user}</userId>
                        <password>${vault.password}</password>
                    </configuration>
                </plugin>
                <!-- Maven Enforcer Plugin -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-enforcer-plugin</artifactId>
                    <version>1.4.1</version>
                </plugin>
                <!-- Maven Dependency Plugin -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <version>3.0.0</version>
                </plugin>
                <!-- Build Helper Maven Plugin -->
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>build-helper-maven-plugin</artifactId>
                    <version>3.0.0</version>
                </plugin>
                <!--This plugin's configuration is used to store Eclipse
                    m2e settings only. It has no influence on the Maven build itself. -->
                <plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>org.apache.maven.plugins</groupId>
                                        <artifactId>maven-enforcer-plugin</artifactId>
                                        <versionRange>[1.0.0,)</versionRange>
                                        <goals>
                                            <goal>enforce</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore />
                                    </action>
                                </pluginExecution>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>
                                            org.apache.maven.plugins
                                        </groupId>
                                        <artifactId>
                                            maven-dependency-plugin
                                        </artifactId>
                                        <versionRange>
                                            [2.2,)
                                        </versionRange>
                                        <goals>
                                            <goal>copy-dependencies</goal>
                                            <goal>unpack</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore />
                                    </action>
                                </pluginExecution>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>
                                            org.codehaus.mojo
                                        </groupId>
                                        <artifactId>
                                            build-helper-maven-plugin
                                        </artifactId>
                                        <versionRange>
                                            [1.5,)
                                        </versionRange>
                                        <goals>
                                            <goal>
                                                reserve-network-port
                                            </goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore />
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
</code>```

Can anyone tell me how to fix this?

Body:
I have a project managed with maven, and after successful mvn test I was running the analysis with sonarcloud.

I ran the mvn verify sonar:sonar command, but as you can see in the image the build failed.
the plugin in the pom file:

<build>
        <plugins>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>${maven.release.version}</version>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.maven.release</groupId>
                        <artifactId>maven-release-oddeven-policy</artifactId>
                        <version>${maven.release.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.apache.maven.scm</groupId>
                        <artifactId>maven-scm-provider-gitexe</artifactId>
                        <version>1.9.4</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <goals>deploy</goals>
                    <localCheckout>true</localCheckout>
                    <releaseProfiles>release</releaseProfiles>
                    <useReleaseProfile>false</useReleaseProfile>
                    <projectVersionPolicyId>OddEvenVersionPolicy</projectVersionPolicyId>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>3.0.1</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <executions>
                    <execution>
                        <id>enforce-maven</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireMavenVersion>
                                    <version>[3.3.9,)</version>
                                </requireMavenVersion>
                                <requireJavaVersion>
                                    <message>Project must be compiled
                                        with Java 8 or higher
                                    </message>
                                    <version>1.8.0</version>
                                </requireJavaVersion>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>com.github.eirslett</groupId>
                    <artifactId>frontend-maven-plugin</artifactId>
                    <version>1.7.6</version>
                    <configuration>
                        <nodeVersion>v10.13.0</nodeVersion>
                        <npmVersion>6.9.0</npmVersion>
                    </configuration>
                    <executions>
                        <execution>
                            <id>install node and npm</id>
                            <goals>
                                <goal>install-node-and-npm</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>npm install</id>
                            <goals>
                                <goal>npm</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>3.1.2</version>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-clean-plugin</artifactId>
                    <version>3.0.0</version>
                </plugin>

                <plugin>
                    <groupId>biz.aQute.bnd</groupId>
                    <artifactId>bnd-maven-plugin</artifactId>
                    <version>${bnd.version}</version>
                </plugin>
                <plugin>
                    <groupId>biz.aQute.bnd</groupId>
                    <artifactId>bnd-baseline-maven-plugin</artifactId>
                    <version>${bnd.version}</version>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>3.0.2</version>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.6.1</version>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-install-plugin</artifactId>
                    <version>2.5.2</version>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.22.1</version>
                    <configuration>
                        <useSystemClassLoader>false</useSystemClassLoader>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>2.22.1</version>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>2.8.2</version>
                </plugin>

                <plugin>
                    <groupId>org.apache.sling</groupId>
                    <artifactId>sling-maven-plugin</artifactId>
                    <version>2.4.0</version>
                    <configuration>
                        <slingUrl>http://${aem.host}:${aem.port}/system/console</slingUrl>
                        <deploymentMethod>WebConsole</deploymentMethod>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.apache.sling</groupId>
                    <artifactId>htl-maven-plugin</artifactId>
                    <version>1.0.6</version>
                    <configuration>
                        <failOnWarnings>true</failOnWarnings>
                    </configuration>
                    <executions>
                        <execution>
                            <goals>
                                <goal>validate</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>org.apache.jackrabbit</groupId>
                    <artifactId>filevault-package-maven-plugin</artifactId>
                    <version>1.0.3</version>
                    <configuration>
                        <filterSource>src/main/content/META-INF/vault/filter.xml</filterSource>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>com.day.jcr.vault</groupId>
                    <artifactId>content-package-maven-plugin</artifactId>
                    <version>1.0.2</version>
                    <configuration>
                        <targetURL>http://${aem.host}:${aem.port}/crx/packmgr/service.jsp</targetURL>
                        <failOnError>true</failOnError>
                        <userId>${vault.user}</userId>
                        <password>${vault.password}</password>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-enforcer-plugin</artifactId>
                    <version>1.4.1</version>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <version>3.0.0</version>
                </plugin>

                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>build-helper-maven-plugin</artifactId>
                    <version>3.0.0</version>
                </plugin>

                <plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>org.apache.maven.plugins</groupId>
                                        <artifactId>maven-enforcer-plugin</artifactId>
                                        <versionRange>[1.0.0,)</versionRange>
                                        <goals>
                                            <goal>enforce</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore />
                                    </action>
                                </pluginExecution>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>
                                            org.apache.maven.plugins
                                        </groupId>
                                        <artifactId>
                                            maven-dependency-plugin
                                        </artifactId>
                                        <versionRange>
                                            [2.2,)
                                        </versionRange>
                                        <goals>
                                            <goal>copy-dependencies</goal>
                                            <goal>unpack</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore />
                                    </action>
                                </pluginExecution>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>
                                            org.codehaus.mojo
                                        </groupId>
                                        <artifactId>
                                            build-helper-maven-plugin
                                        </artifactId>
                                        <versionRange>
                                            [1.5,)
                                        </versionRange>
                                        <goals>
                                            <goal>
                                                reserve-network-port
                                            </goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore />
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

Can anyone tell me how to fix this?


问:
Django channels + HTMX -> notification messages framework
I'd like to implement a notification framework for Django that uses channels/websockets and HTMX. But I don't get how to do that. Some things work, some are extremely complicated n my mind at least.
Here's the code:

from asgiref.sync import async_to_sync
from channels.generic.websocket import WebsocketConsumer
from channels.layers import get_channel_layer
from django.contrib import messages
from django.template.loader import get_template
from medux.common.models import User

class NotificationConsumer(WebsocketConsumer):
    def connect(self):
        self.user = self.scope["user"]
        if not self.user.is_authenticated:
            self.close()
            return

        # create a group "user-<username>"
        async_to_sync(self.channel_layer.group_add)(
            f"user-{self.user.username}",
            self.channel_name,
        )
        self.accept()

    def disconnect(self, close_code):
        async_to_sync(self.channel_layer.group_discard)(
            f"user-{self.user.username}",
            self.channel_name,
        )

    def notify(self, event: dict):
        html = get_template("common/toast.html").render(
            context={"message": event["message"]}
        )
        self.send(text_data=html)
```
```

    {% for message in messages %}

          {# header here #}

{{ message }}

          <button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>

    {% endfor %}

```
<p>The client connects to the consumer, and if I write a small `self.send(text_data="foo")</p>
<p>AFAIK, I have to send an "high level" event to the consumer with the type "notify", so the <code>notify()</code> method is called. So this would be a code called anywhere in a view e.g.:</p>
<pre class="lang-py prettyprint-override"><code>from asgiref.sync import async_to_sync
from channels.layers import get_channel_layer
channel_layer = get_channel_layer()

async_to_sync(channel_layer.group_send)(
    "user-christian",
    {"type": "notify", "message": "<div id='toasts' hx-swap-oob='beforeend'>blah</div>"}
)
</code>```

I don't step through the internals of channels, no matter how often I read the docs..
The docs how to use group_add and group_send are sparse, and I am sure I am using them wrong.

Could anyone give me some hints here?
In the next step, I would replace Django's messaging framework with this solution in my application.

I got that things to work with Turbo Django, which is quite convenient to work with, but lacks triggers like HTMX that let me iniciate AJAX calls like hx-post or hx-get.

Body:
I'd like to implement a notification framework for Django that uses channels/websockets and HTMX. But I don't get how to do that. Some things work, some are extremely complicated n my mind at least.
Here's the code:

from asgiref.sync import async_to_sync
from channels.generic.websocket import WebsocketConsumer
from channels.layers import get_channel_layer
from django.contrib import messages
from django.template.loader import get_template
from medux.common.models import User

class NotificationConsumer(WebsocketConsumer):
    def connect(self):
        self.user = self.scope["user"]
        if not self.user.is_authenticated:
            self.close()
            return

        # create a group "user-<username>"
        async_to_sync(self.channel_layer.group_add)(
            f"user-{self.user.username}",
            self.channel_name,
        )
        self.accept()

    def disconnect(self, close_code):
        async_to_sync(self.channel_layer.group_discard)(
            f"user-{self.user.username}",
            self.channel_name,
        )

    def notify(self, event: dict):
        html = get_template("common/toast.html").render(
            context={"message": event["message"]}
        )
        self.send(text_data=html)

    {% for message in messages %}

          {# header here #}

{{ message }}

          <button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>

    {% endfor %}

The client connects to the consumer, and if I write a small `self.send(text_data="foo")

AFAIK, I have to send an "high level" event to the consumer with the type "notify", so the notify() method is called. So this would be a code called anywhere in a view e.g.:

from asgiref.sync import async_to_sync
from channels.layers import get_channel_layer
channel_layer = get_channel_layer()

async_to_sync(channel_layer.group_send)(
    "user-christian",
    {"type": "notify", "message": "
blah
"}
)

I don't step through the internals of channels, no matter how often I read the docs..
The docs how to use group_add and group_send are sparse, and I am sure I am using them wrong.

Could anyone give me some hints here?
In the next step, I would replace Django's messaging framework with this solution in my application.

I got that things to work with Turbo Django, which is quite convenient to work with, but lacks triggers like HTMX that let me iniciate AJAX calls like hx-post or hx-get.


问:
Cyrrilic text bad encoding in Java application in Docker-container
I've faced next problem - after start of my Docker container all Cyrillic symbols have incorrect encoding.

Content of my DockerFile

```<code>FROM openjdk:8-jdk-alpine

ENV MUSL_LOCALE_DEPS cmake make musl-dev gcc gettext-dev libintl
ENV MUSL_LOCPATH /usr/share/i18n/locales/musl

RUN apk add tzdata
RUN apk add --no-cache \
    $MUSL_LOCALE_DEPS \
    && wget https://gitlab.com/rilian-la-te/musl-locales/-/archive/master/musl-locales-master.zip \
    && unzip musl-locales-master.zip \
      && cd musl-locales-master \
      && cmake -DLOCALE_PROFILE=OFF -D CMAKE_INSTALL_PREFIX:PATH=/usr . && make && make install \
      && cd .. && rm -r musl-locales-master

ENV LANG ru_RU.UTF-8
ENV LANGUAGE ru_RU.UTF-8
ENV LC_ALL ru_RU.UTF-8
ENV TZ Europe/Moscow

ADD target/FootballBot-1.0-SNAPSHOT.jar application.jar
ENTRYPOINT ["java","-Xmx330m", "-Dfile.encoding=UTF-8", "-Dconsole.encoding=UTF-8" ,"-Xss512k", "-Xdebug", "-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n", "-jar", "application.jar"]
</code>```

Content of my Docker-compose file:

```<code>version: '3.3'

services:
  app:
    image: 'football_bot'
    ports:
      - "8787:8787"
    depends_on:
      - db
    environment:
      - SPRING_DATASOURCE_URL=jdbc:postgresql://db:5432/football_bot_db
      - SPRING_DATASOURCE_USERNAME=postgres
      - SPRING_DATASOURCE_PASSWORD=postgres
      - SPRING_JPA_HIBERNATE_DDL_AUTO=validate
      #  PUT YOUR SETTINGS DOWN BELLOW
      - DOMAIN_BOT_NAME=GongeliniBot
      - DOMAIN_BOT_TOKEN=5095369262:AAH3X0MmvI0kMly9W83JqPeW28aqCdPiGGk
      - DOMAIN_CHAT_NAME='testgroup bot'

  db:
    image: 'postgres'
    ports:
      - "5432:5432"
    environment:
      - POSTGRES_DB=football_bot_db
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
    healthcheck:
      test: "PGPASSWORD=postgres pg_isready -h 127.0.0.1 -U postgres -d football_bot_db"
      interval: 5s
      timeout: 5s
      retries: 5
</code>```

When i execute date command inside of my container, i got cyrrilic result:

Also, my container's system env properties contains ru_RU language setup:

All goes nice and well, but when i trigger my telegram-bot, it replies with non-cyrrilic symbols:

Also, when I debug my java application in container, i got same result(of course it's totaly fine, when i run app localy)

Please, give me any idea if you can. Is it problem with java or is it some kind of docker issue?

Body:
I've faced next problem - after start of my Docker container all Cyrillic symbols have incorrect encoding.

Content of my DockerFile

FROM openjdk:8-jdk-alpine

ENV MUSL_LOCALE_DEPS cmake make musl-dev gcc gettext-dev libintl
ENV MUSL_LOCPATH /usr/share/i18n/locales/musl

RUN apk add tzdata
RUN apk add --no-cache \
    $MUSL_LOCALE_DEPS \
    && wget https://gitlab.com/rilian-la-te/musl-locales/-/archive/master/musl-locales-master.zip \
    && unzip musl-locales-master.zip \
      && cd musl-locales-master \
      && cmake -DLOCALE_PROFILE=OFF -D CMAKE_INSTALL_PREFIX:PATH=/usr . && make && make install \
      && cd .. && rm -r musl-locales-master

ENV LANG ru_RU.UTF-8
ENV LANGUAGE ru_RU.UTF-8
ENV LC_ALL ru_RU.UTF-8
ENV TZ Europe/Moscow

ADD target/FootballBot-1.0-SNAPSHOT.jar application.jar
ENTRYPOINT ["java","-Xmx330m", "-Dfile.encoding=UTF-8", "-Dconsole.encoding=UTF-8" ,"-Xss512k", "-Xdebug", "-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n", "-jar", "application.jar"]

Content of my Docker-compose file:

version: '3.3'

services:
  app:
    image: 'football_bot'
    ports:
      - "8787:8787"
    depends_on:
      - db
    environment:
      - SPRING_DATASOURCE_URL=jdbc:postgresql://db:5432/football_bot_db
      - SPRING_DATASOURCE_USERNAME=postgres
      - SPRING_DATASOURCE_PASSWORD=postgres
      - SPRING_JPA_HIBERNATE_DDL_AUTO=validate
      #  PUT YOUR SETTINGS DOWN BELLOW
      - DOMAIN_BOT_NAME=GongeliniBot
      - DOMAIN_BOT_TOKEN=5095369262:AAH3X0MmvI0kMly9W83JqPeW28aqCdPiGGk
      - DOMAIN_CHAT_NAME='testgroup bot'

  db:
    image: 'postgres'
    ports:
      - "5432:5432"
    environment:
      - POSTGRES_DB=football_bot_db
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
    healthcheck:
      test: "PGPASSWORD=postgres pg_isready -h 127.0.0.1 -U postgres -d football_bot_db"
      interval: 5s
      timeout: 5s
      retries: 5

When i execute date command inside of my container, i got cyrrilic result:

Also, my container's system env properties contains ru_RU language setup:

All goes nice and well, but when i trigger my telegram-bot, it replies with non-cyrrilic symbols:

Also, when I debug my java application in container, i got same result(of course it's totaly fine, when i run app localy)

Please, give me any idea if you can. Is it problem with java or is it some kind of docker issue?


问:
Why my kivy app is automatically close when open?
I'm trying to run a kivy app I made on windows. But when I launch the app the following message appear for half a second and close. Can someone help ?

Here is the original code that perfectly work.

```<code>import os, sys
from kivy.resources import resource_add_path, resource_find
import kivy
from kivy.uix.button import Button
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.label import Label
from kivy.app import App
kivy.require("2.1.0")

class Test(App):
    def build(self):

        def Button_Click(instance):
            lbl.text = "You clicked the button !"

        bx = BoxLayout(orientation = "vertical")
        btn = Button(text = "Click Me !")
        btn.bind(on_press = Button_Click)
        lbl = Label(color = "red")
        bx.add_widget(btn)
        bx.add_widget(lbl)

        return bx

if __name__ == '__main__':
    if hasattr(sys, '_MEIPASS'):
        resource_add_path(os.path.join(sys._MEIPASS))
    Test().run()
</code>```

With another method, I also get an error :
Failed to execute script 'main' due to unhandled exception maximum recursion depth exceeded

I am sure that kivy is well installed.
I have also done it in a virtual environment.

Here is my .spec file:

```<code>from kivy_deps import sdl2, glew

# -*- mode: python ; coding: utf-8 -*-

block_cipher = None

a = Analysis(
    ['main.py'],
    pathex=[],
    binaries=[],
    datas=[],
    hiddenimports=[],
    hookspath=[],
    hooksconfig={},
    runtime_hooks=[],
    excludes=[],
    win_no_prefer_redirects=False,
    win_private_assemblies=False,
    cipher=block_cipher,
    noarchive=False,
)
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)

exe = EXE(
    pyz,
    a.scripts,
    [],
    exclude_binaries=True,
    name='main',
    debug=False,
    bootloader_ignore_signals=False,
    strip=False,
    upx=True,
    console=False,
    disable_windowed_traceback=False,
    argv_emulation=False,
    target_arch=None,
    codesign_identity=None,
    entitlements_file=None,
)
coll = COLLECT(
    exe, Tree('C:\\Users\\loddo\\PycharmProjects\\TEST\\'),
    a.binaries,
    a.zipfiles,
    a.datas,
    *[Tree(p) for p in (sdl2.dep_bins + glew.dep_bins)],
    strip=False,
    upx=True,
    upx_exclude=[],
    name='main',
</code>```

My installed package :

Body:
I'm trying to run a kivy app I made on windows. But when I launch the app the following message appear for half a second and close. Can someone help ?

Here is the original code that perfectly work.

import os, sys
from kivy.resources import resource_add_path, resource_find
import kivy
from kivy.uix.button import Button
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.label import Label
from kivy.app import App
kivy.require("2.1.0")

class Test(App):
    def build(self):

        def Button_Click(instance):
            lbl.text = "You clicked the button !"

        bx = BoxLayout(orientation = "vertical")
        btn = Button(text = "Click Me !")
        btn.bind(on_press = Button_Click)
        lbl = Label(color = "red")
        bx.add_widget(btn)
        bx.add_widget(lbl)

        return bx

if __name__ == '__main__':
    if hasattr(sys, '_MEIPASS'):
        resource_add_path(os.path.join(sys._MEIPASS))
    Test().run()

With another method, I also get an error :
Failed to execute script 'main' due to unhandled exception maximum recursion depth exceeded

I am sure that kivy is well installed.
I have also done it in a virtual environment.

Here is my .spec file:

from kivy_deps import sdl2, glew

# -*- mode: python ; coding: utf-8 -*-

block_cipher = None

a = Analysis(
    ['main.py'],
    pathex=[],
    binaries=[],
    datas=[],
    hiddenimports=[],
    hookspath=[],
    hooksconfig={},
    runtime_hooks=[],
    excludes=[],
    win_no_prefer_redirects=False,
    win_private_assemblies=False,
    cipher=block_cipher,
    noarchive=False,
)
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)

exe = EXE(
    pyz,
    a.scripts,
    [],
    exclude_binaries=True,
    name='main',
    debug=False,
    bootloader_ignore_signals=False,
    strip=False,
    upx=True,
    console=False,
    disable_windowed_traceback=False,
    argv_emulation=False,
    target_arch=None,
    codesign_identity=None,
    entitlements_file=None,
)
coll = COLLECT(
    exe, Tree('C:\\Users\\loddo\\PycharmProjects\\TEST\\'),
    a.binaries,
    a.zipfiles,
    a.datas,
    *[Tree(p) for p in (sdl2.dep_bins + glew.dep_bins)],
    strip=False,
    upx=True,
    upx_exclude=[],
    name='main',

My installed package :


问:
How to do a lookup against another record in a different SP list
I am trying to set up a function that filters one of my SP lists called 'Staff Certifications' that contains the active certs of a user. The certification names are in this SP list but are in a lookup column because they are stored in a separate list named 'Certifications'. I want to be able to get the details of the certification from the 'Certification' SP list, but powerapps doesn't like my formula because: "Incompatible types for comparison. These types cannot be compared: Text, Record." So then I tried leaving it as Certification instead of Certification.Value, but it gave me an error saying:  "Incompatible types for comparison. These types cannot be compared: Record, Record.". How can I perform this lookup properly? Thank you!

My current formula:

Set(myCertCollection,
    Filter('Staff Certifications', User().Email = Person.Email && Status.Value = "Certification Active"
).Certification);

//Foundation-----------------------------
UpdateContext({uDS1: Concatenate(CountIf(myCertCollection, Certification = LookUp(Certifications,  'Practice Area'.Value = "Digital Services" && 'Practitioner Level'.Value = "1 - Foundation")),
" Certifications", Char(13), Char(13))});

   //Intermediate

   //Expert

   //Elite

);```


问:
InfluxDB CLI does not return when called from Python
I'm trying to invoke the influx CLI from Python to upload some csvs, however the process never returns. I tried the following and variations on it:

```<code>p = subprocess.run(["influx write --bucket Tutorial -f data_hist.csv"]    , shell=True)
q = subprocess.run(["influx write --bucket Tutorial -f data_forecast.csv"], shell=True)
</code>```

This shell script works fine and returns:

influx write --bucket Tutorial -f data_hist.csv
influx write --bucket Tutorial -f data_forecast.csv
```

Body:
I'm trying to invoke the influx CLI from Python to upload some csvs, however the process never returns. I tried the following and variations on it:

p = subprocess.run(["influx write --bucket Tutorial -f data_hist.csv"]    , shell=True)
q = subprocess.run(["influx write --bucket Tutorial -f data_forecast.csv"], shell=True)

This shell script works fine and returns:

influx write --bucket Tutorial -f data_hist.csv
influx write --bucket Tutorial -f data_forecast.csv


问:
Unable to upload build-storybook web app to sharepoint, as it contains special characters
I exported storybook into a static web app by running 'npm run build-storybook' in visual studio.

I uploaded the output files to sharepoint, however the exports file names contain special characters '~ " # % & * : < > ? / \ { | }' which is not allowed and cannot be displayed in sharepoint.

How do i run the storybook build with exclusion of special characters?