问:
Failed to unlink socket file: Operation not permitted
I am facing this issue where I am unable to get my mongod started successfully:

This is the error:

{"t":{"$date":"2023-01-13T12:33:59.922+05:00"},"s":"I",
"c":"NETWORK",  "id":4915701, "ctx":"-","msg":"Initialized wire
specification","attr":{"spec":{"incomingExternalClient":{"minWireVersion":0,"maxWireVersion":17},"incomingInternalClient":{"minWireVersion":0,"maxWireVersion":17},"outgoing":{"minWireVersion":6,"maxWireVersion":17},"isInternalClient":true}}}
{"t":{"$date":"2023-01-13T12:33:59.922+05:00"},"s":"I",
"c":"CONTROL",  "id":23285,   "ctx":"-","msg":"Automatically disabling
TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols
'none'"} {"t":{"$date":"2023-01-13T12:33:59.924+05:00"},"s":"I",
"c":"NETWORK",  "id":4648601, "ctx":"main","msg":"Implicit TCP
FastOpen unavailable. If TCP FastOpen is required, set
tcpFastOpenServer, tcpFastOpenClient, and tcpFastOpenQueueSize."}
{"t":{"$date":"2023-01-13T12:33:59.925+05:00"},"s":"I",  "c":"REPL",

"id":5123008, "ctx":"main","msg":"Successfully registered
PrimaryOnlyService","attr":{"service":"TenantMigrationDonorService","namespace":"config.tenantMigrationDonors"}}
{"t":{"$date":"2023-01-13T12:33:59.925+05:00"},"s":"I",  "c":"REPL",

"id":5123008, "ctx":"main","msg":"Successfully registered
PrimaryOnlyService","attr":{"service":"TenantMigrationRecipientService","namespace":"config.tenantMigrationRecipients"}}
{"t":{"$date":"2023-01-13T12:33:59.925+05:00"},"s":"I",  "c":"REPL",

"id":5123008, "ctx":"main","msg":"Successfully registered
PrimaryOnlyService","attr":{"service":"ShardSplitDonorService","namespace":"config.tenantSplitDonors"}}
{"t":{"$date":"2023-01-13T12:33:59.925+05:00"},"s":"I",
"c":"CONTROL",  "id":5945603, "ctx":"main","msg":"Multi threading
initialized"} {"t":{"$date":"2023-01-13T12:33:59.925+05:00"},"s":"I",
"c":"CONTROL",  "id":4615611, "ctx":"initandlisten","msg":"MongoDB
starting","attr":{"pid":24280,"port":27017,"dbPath":"/data/db","architecture":"64-bit","host":"ehsan-HP"}}
{"t":{"$date":"2023-01-13T12:33:59.925+05:00"},"s":"I",
"c":"CONTROL",  "id":23403,   "ctx":"initandlisten","msg":"Build
Info","attr":{"buildInfo":{"version":"6.0.3","gitVersion":"f803681c3ae19817d31958965850193de067c516","openSSLVersion":"OpenSSL
1.1.1  11 Sep 2018","modules":[],"allocator":"tcmalloc","environment":{"distmod":"ubuntu1804","distarch":"x86_64","target_arch":"x86_64"}}}}
{"t":{"$date":"2023-01-13T12:33:59.925+05:00"},"s":"I",
"c":"CONTROL",  "id":51765,   "ctx":"initandlisten","msg":"Operating
System","attr":{"os":{"name":"Ubuntu","version":"18.04"}}}
{"t":{"$date":"2023-01-13T12:33:59.925+05:00"},"s":"I",
"c":"CONTROL",  "id":21951,   "ctx":"initandlisten","msg":"Options set
by command line","attr":{"options":{}}}
{"t":{"$date":"2023-01-13T12:33:59.926+05:00"},"s":"E",
"c":"NETWORK",  "id":23024,   "ctx":"initandlisten","msg":"Failed to
unlink socket
file","attr":{"path":"/tmp/mongodb-27017.sock","error":"Operation not
permitted"}} {"t":{"$date":"2023-01-13T12:33:59.926+05:00"},"s":"F",
"c":"ASSERT",   "id":23091,   "ctx":"initandlisten","msg":"Fatal
assertion","attr":{"msgid":40486,"file":"src/mongo/transport/transport_layer_asio.cpp","line":1125}}
{"t":{"$date":"2023-01-13T12:33:59.926+05:00"},"s":"F",  "c":"ASSERT",
"id":23092,   "ctx":"initandlisten","msg":"\n\n***aborting after
fassert() failure\n\n"}

What I have tried so far:

Delete /tmp/mongodb-27017.sock file and then start mongod by doing sudo service mongod start. It didn't work. The file mongodb-27017.sock created after running this comand has the following permissions:

```<code>srwx------ 1 mongodb mongodb 0 January 13 12:49 /tmp/mongodb-27017.sock
</code>```

These are the permissions of /data/db:

```<code>$ ls -la /data/db
total 8
drwxr-xr-x 2 mongodb mongodb 4096 January 13 11:35 .
drwxr-xr-x 3 root    root    4096 January 13 11:35 ..
</code>```

What is going wrong here? This is my mongod version:

```<code>$ mongod --version
db version v6.0.3
Build Info: {
    "version": "6.0.3",
    "gitVersion": "f803681c3ae19817d31958965850193de067c516",
    "openSSLVersion": "OpenSSL 1.1.1  11 Sep 2018",
    "modules": [],
    "allocator": "tcmalloc",
    "environment": {
        "distmod": "ubuntu1804",
        "distarch": "x86_64",
        "target_arch": "x86_64"
    }
}
</code>```

I am on Ubuntu 18.

EDIT:
Here are the contents of /var/log/auth.log:

```<code>Jan 13 13:40:24 ehsan-HP sudo:    ehsan : TTY=pts/7 ; PWD=/home/ehsan ; USER=root ; COMMAND=/usr/sbin/service mongod restart
Jan 13 13:40:24 ehsan-HP sudo: pam_unix(sudo:session): session opened for user root by (uid=0)
Jan 13 13:40:24 ehsan-HP sudo: pam_unix(sudo:session): session closed for user root
</code>```

Body:
I am facing this issue where I am unable to get my mongod started successfully:

This is the error:

{"t":{"$date":"2023-01-13T12:33:59.922+05:00"},"s":"I",
"c":"NETWORK",  "id":4915701, "ctx":"-","msg":"Initialized wire
specification","attr":{"spec":{"incomingExternalClient":{"minWireVersion":0,"maxWireVersion":17},"incomingInternalClient":{"minWireVersion":0,"maxWireVersion":17},"outgoing":{"minWireVersion":6,"maxWireVersion":17},"isInternalClient":true}}}
{"t":{"$date":"2023-01-13T12:33:59.922+05:00"},"s":"I",
"c":"CONTROL",  "id":23285,   "ctx":"-","msg":"Automatically disabling
TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols
'none'"} {"t":{"$date":"2023-01-13T12:33:59.924+05:00"},"s":"I",
"c":"NETWORK",  "id":4648601, "ctx":"main","msg":"Implicit TCP
FastOpen unavailable. If TCP FastOpen is required, set
tcpFastOpenServer, tcpFastOpenClient, and tcpFastOpenQueueSize."}
{"t":{"$date":"2023-01-13T12:33:59.925+05:00"},"s":"I",  "c":"REPL",

"id":5123008, "ctx":"main","msg":"Successfully registered
PrimaryOnlyService","attr":{"service":"TenantMigrationDonorService","namespace":"config.tenantMigrationDonors"}}
{"t":{"$date":"2023-01-13T12:33:59.925+05:00"},"s":"I",  "c":"REPL",

"id":5123008, "ctx":"main","msg":"Successfully registered
PrimaryOnlyService","attr":{"service":"TenantMigrationRecipientService","namespace":"config.tenantMigrationRecipients"}}
{"t":{"$date":"2023-01-13T12:33:59.925+05:00"},"s":"I",  "c":"REPL",

"id":5123008, "ctx":"main","msg":"Successfully registered
PrimaryOnlyService","attr":{"service":"ShardSplitDonorService","namespace":"config.tenantSplitDonors"}}
{"t":{"$date":"2023-01-13T12:33:59.925+05:00"},"s":"I",
"c":"CONTROL",  "id":5945603, "ctx":"main","msg":"Multi threading
initialized"} {"t":{"$date":"2023-01-13T12:33:59.925+05:00"},"s":"I",
"c":"CONTROL",  "id":4615611, "ctx":"initandlisten","msg":"MongoDB
starting","attr":{"pid":24280,"port":27017,"dbPath":"/data/db","architecture":"64-bit","host":"ehsan-HP"}}
{"t":{"$date":"2023-01-13T12:33:59.925+05:00"},"s":"I",
"c":"CONTROL",  "id":23403,   "ctx":"initandlisten","msg":"Build
Info","attr":{"buildInfo":{"version":"6.0.3","gitVersion":"f803681c3ae19817d31958965850193de067c516","openSSLVersion":"OpenSSL
1.1.1  11 Sep 2018","modules":[],"allocator":"tcmalloc","environment":{"distmod":"ubuntu1804","distarch":"x86_64","target_arch":"x86_64"}}}}
{"t":{"$date":"2023-01-13T12:33:59.925+05:00"},"s":"I",
"c":"CONTROL",  "id":51765,   "ctx":"initandlisten","msg":"Operating
System","attr":{"os":{"name":"Ubuntu","version":"18.04"}}}
{"t":{"$date":"2023-01-13T12:33:59.925+05:00"},"s":"I",
"c":"CONTROL",  "id":21951,   "ctx":"initandlisten","msg":"Options set
by command line","attr":{"options":{}}}
{"t":{"$date":"2023-01-13T12:33:59.926+05:00"},"s":"E",
"c":"NETWORK",  "id":23024,   "ctx":"initandlisten","msg":"Failed to
unlink socket
file","attr":{"path":"/tmp/mongodb-27017.sock","error":"Operation not
permitted"}} {"t":{"$date":"2023-01-13T12:33:59.926+05:00"},"s":"F",
"c":"ASSERT",   "id":23091,   "ctx":"initandlisten","msg":"Fatal
assertion","attr":{"msgid":40486,"file":"src/mongo/transport/transport_layer_asio.cpp","line":1125}}
{"t":{"$date":"2023-01-13T12:33:59.926+05:00"},"s":"F",  "c":"ASSERT",
"id":23092,   "ctx":"initandlisten","msg":"\n\n***aborting after
fassert() failure\n\n"}

What I have tried so far:

Delete /tmp/mongodb-27017.sock file and then start mongod by doing sudo service mongod start. It didn't work. The file mongodb-27017.sock created after running this comand has the following permissions:

srwx------ 1 mongodb mongodb 0 January 13 12:49 /tmp/mongodb-27017.sock

These are the permissions of /data/db:

$ ls -la /data/db
total 8
drwxr-xr-x 2 mongodb mongodb 4096 January 13 11:35 .
drwxr-xr-x 3 root    root    4096 January 13 11:35 ..

What is going wrong here? This is my mongod version:

$ mongod --version
db version v6.0.3
Build Info: {
    "version": "6.0.3",
    "gitVersion": "f803681c3ae19817d31958965850193de067c516",
    "openSSLVersion": "OpenSSL 1.1.1  11 Sep 2018",
    "modules": [],
    "allocator": "tcmalloc",
    "environment": {
        "distmod": "ubuntu1804",
        "distarch": "x86_64",
        "target_arch": "x86_64"
    }
}

I am on Ubuntu 18.

EDIT:
Here are the contents of /var/log/auth.log:

Jan 13 13:40:24 ehsan-HP sudo:    ehsan : TTY=pts/7 ; PWD=/home/ehsan ; USER=root ; COMMAND=/usr/sbin/service mongod restart
Jan 13 13:40:24 ehsan-HP sudo: pam_unix(sudo:session): session opened for user root by (uid=0)
Jan 13 13:40:24 ehsan-HP sudo: pam_unix(sudo:session): session closed for user root


来源: stackexchange

问:
How to obtain all employees leave balances in fewer API calls
I am working on a back-end service that needs to get all employees' leave balances in Xero.

I would like to know if there is a way that allows me to get all employees' leave balances in fewer API calls.

It seems like if I get the employees via the API:
GET https://api.xero.com/payroll.xro/1.0/Employees

The results do not contain leave balances.

Thus, I have to get all employee objects one by one via:
GET https://api.xero.com/payroll.xro/1.0/Employees/{EmployeeID}

In the meantime, because of the API calls limits (60 per minute), I have to wait minutes to get all results, as I need to get more than 100 employees' leave balances.

Is there a way that allows me to get all employees' leave balances in fewer API calls?

ContentLicense: CC BY-SA 4.0


问:
Google Cloud SQL real-time replication
is it possible to create a live replica of my PostgreSQL database which is inside Google Cloud SQL?

Currently I found the way to export the database via dump in this guide:

https://cloud.google.com/sql/docs/postgres/import-export/import-export-sql

Or is it possible to schedule this dump automatically?

Title: Google Cloud SQL real-time replication


问:
How to use gcc in Ubuntu without Root privilege?
I'm using an Ubuntu server to run npm install.

I have to use an account which is not sudoer to run services.

I would say this is a service account.

However, when I type gcc --version, it show permission denied.

```<code>-bash: /usr/bin/gcc: Permission denied
</code>```

I found out that gcc is in charge of root account.

So my question is that is there any way I can just use gcc to run npm install without changing any permission?

I'm not allowed to give sudo permission to this service account.

I ran "ls -lah /usr/bin/gcc" and the result is

```<code>lrwxrwxrwx 1 root root 5 May 21  2019 /usr/bin/gcc -> gcc-7
</code>```

Body:
I'm using an Ubuntu server to run npm install.

I have to use an account which is not sudoer to run services.

I would say this is a service account.

However, when I type gcc --version, it show permission denied.

-bash: /usr/bin/gcc: Permission denied

I found out that gcc is in charge of root account.

So my question is that is there any way I can just use gcc to run npm install without changing any permission?

I'm not allowed to give sudo permission to this service account.

I ran "ls -lah /usr/bin/gcc" and the result is

lrwxrwxrwx 1 root root 5 May 21  2019 /usr/bin/gcc -> gcc-7


问:
IOS Chrome won't offer to scan Credit Card, only working in safari?
```<code><input type="tel" autocomplete="cc-number" x-autocompletetype="cc-number" maxlength="23" class="form-control cardNumber" maxlength="23" data-rule-required="false">
</code>```

did the code like this its working safari and chrome on android and ios,

Body:
<input type="tel" autocomplete="cc-number" x-autocompletetype="cc-number" maxlength="23" class="form-control cardNumber" maxlength="23" data-rule-required="false">

did the code like this its working safari and chrome on android and ios,


问:
How can I install custom fonts when using a virtual environment in python?
I've created a virtaul enviroment for a project. I wanted to use google fonts (roboto). I installed on my mac but when trying to import the font, matplotlib does not find it. I tried to copy and paste the .ttf files into the fonts folder of matplotlib of my virtual enviroment but it didn't work. Any ideas?

I'm using vscode

even thought the .tff files are in the folder, when using:
matplotlib.font_manager.findfont("RobotoCondensed.tft")

I got:
findfont: Font family ['RobotoCondensed.tft'] not found. Falling back to DejaVu Sans.


问:
Deezer API fail request
i'm trying to consume deezer api, but idk how to do it.
I already read the documentation, learn how I can get my token, but when I'm trying to request i got this error:

```<code>Access to fetch at 'https://api.deezer.com/album/302127' from origin 'null' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
</code>```

how can I solve this?
url: https://api.deezer.com/album/302127

idk the problem with my request.

```<code>async function getAlbum() {
  try {
    const response = await fetch("https://api.deezer.com/album/302127", {
      headers: {
        "Authorization": "Bearer " + access_token
      }
    });
    const data = await response.json();
    console.log(data);
  } catch (error) {
    console.log(error);
  }
}
getAlbum();
</code>```

Title: Deezer API fail request

Body:
i'm trying to consume deezer api, but idk how to do it.
I already read the documentation, learn how I can get my token, but when I'm trying to request i got this error:

Access to fetch at 'https://api.deezer.com/album/302127' from origin 'null' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

how can I solve this?
url: https://api.deezer.com/album/302127

idk the problem with my request.

async function getAlbum() {
  try {
    const response = await fetch("https://api.deezer.com/album/302127", {
      headers: {
        "Authorization": "Bearer " + access_token
      }
    });
    const data = await response.json();
    console.log(data);
  } catch (error) {
    console.log(error);
  }
}
getAlbum();


问:
How to join(combine) two spark dataset using java where both data set contain different number of column in spark 2.4
How to join(combine) two spark dataset using java where both data set contain different number of column in spark 2.4

example : Dataset dataset1 contain id,name,address and Dataset dataset2 contain id and name.


问:
Laravel sqlsrv query execution time is very slow
I have Microsoft SQL Server database (SQLSRV) and I am trying to execute a query via Laravel DB class (Illuminate\Support\Facades\DB):

```<code>DB::select(DB::raw("select * from [table]"));
</code>```

and Laravel Eloquent:

```<code>Items::select('*')->get();
</code>```

and the execution time is in both (Eloquent & DB class) 1397 milliseconds.

I try to execute the same query using php_pdo_sqlsrv library (php_pdo_sqlsrv_81_ts_x64.dll):

```<code>$conn = sqlsrv_connect("192.168.0.100, 51484", $connectionInfo);
$tsql = "select * from [table]";
sqlsrv_query($conn, $tsql, array(), array());
</code>```

and the execution time is 52 milliseconds.

From the above observation, What do I need to config in Laravel to improve the execution time??

I am using:

php:

```<code>PHP 8.1.2 (cli) (built: Jan 19 2022 10:18:23) (ZTS Visual C++ 2019 x64)
Copyright (c) The PHP Group
Zend Engine v4.1.2, Copyright (c) Zend Technologies

</code>```

php external Libraries:

```<code>php_sqlsrv_81_ts_x64.dll
php_pdo_sqlsrv_81_ts_x64.dll
</code>```

Framework:

```<code>Laravel Framework 9.47.0
</code>```

Framework config: (/config/database.php):

```<code><?php

return [

    'default' => env('DB_CONNECTION', 'sqlsrv'),

    'connections' => [

        ....

        'sqlsrv' => [
            'driver' => 'sqlsrv',
            'url' => env('DATABASE_URL'),
            'host' => env('DB_HOST'),
            'port' => env('DB_PORT'),
            'database' => env('DB_DATABASE'),
            'username' => env('DB_USERNAME'),
            'password' => env('DB_PASSWORD'),
            'charset' => 'utf8',
            'prefix' => '',
            'prefix_indexes' => true,
            // 'encrypt' => env('DB_ENCRYPT', 'yes'),
            // 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'),
        ],

      .....

    ],
];

</code>```

Thanks in advance!

Body:
I have Microsoft SQL Server database (SQLSRV) and I am trying to execute a query via Laravel DB class (Illuminate\Support\Facades\DB):

DB::select(DB::raw("select * from [table]"));

and Laravel Eloquent:

Items::select('*')->get();

and the execution time is in both (Eloquent & DB class) 1397 milliseconds.

I try to execute the same query using php_pdo_sqlsrv library (php_pdo_sqlsrv_81_ts_x64.dll):

$conn = sqlsrv_connect("192.168.0.100, 51484", $connectionInfo);
$tsql = "select * from [table]";
sqlsrv_query($conn, $tsql, array(), array());

and the execution time is 52 milliseconds.

From the above observation, What do I need to config in Laravel to improve the execution time??

I am using:

php:

PHP 8.1.2 (cli) (built: Jan 19 2022 10:18:23) (ZTS Visual C++ 2019 x64)
Copyright (c) The PHP Group
Zend Engine v4.1.2, Copyright (c) Zend Technologies

php external Libraries:

php_sqlsrv_81_ts_x64.dll
php_pdo_sqlsrv_81_ts_x64.dll

Framework:

Laravel Framework 9.47.0

Framework config: (/config/database.php):

<?php

return [

    'default' => env('DB_CONNECTION', 'sqlsrv'),

    'connections' => [

        ....

        'sqlsrv' => [
            'driver' => 'sqlsrv',
            'url' => env('DATABASE_URL'),
            'host' => env('DB_HOST'),
            'port' => env('DB_PORT'),
            'database' => env('DB_DATABASE'),
            'username' => env('DB_USERNAME'),
            'password' => env('DB_PASSWORD'),
            'charset' => 'utf8',
            'prefix' => '',
            'prefix_indexes' => true,
            // 'encrypt' => env('DB_ENCRYPT', 'yes'),
            // 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'),
        ],

      .....

    ],
];

Thanks in advance!


问:
What does a template class do in the Maya api?
Looking at the inheritance diagram on the API, I noticed that MPxSelectionContext has this template class.

From what I read, If I were to have, multiple manipulators and wanted to use the same context, I could use a template class to reuse my code over different manipulators, is that use correct?

Are there other differences or advantages of using a template class?

Not all MPx classes have a template class equivalent, why is that?

Here's an API example.

Thanks for reading me.


问:
Convert dictionary to csv without pandas
I want to convert the dictionary of folowing format to a csv file using python:

```<code>{ "Mon" : [1, 4, 6],
"Tue":[5,7,8],
"Wed" : [5,8,1]
}
</code>```

Body:
I want to convert the dictionary of folowing format to a csv file using python:

{ "Mon" : [1, 4, 6],
"Tue":[5,7,8],
"Wed" : [5,8,1]
}


问:
How to make a way to make user join my guild using discord oauth2
Source :- https://sourceb.in/LioOeVpETB
Error :- https://sourceb.in/AE8jPE4SkG

I tried things as much as possible but got stuck to that


问:
docker compose "failed to solve: rpc error: code"
I'm using this little docker-compose.yaml file to start two containers in an EC2 to start a preview of my app:

```<code>version: "3.9"
services:
  redis:
      build:
        context: .
      ports:
        - 6379:6379
  database:
    container_name: postgres
    image: postgres:14.2
    ports:
      - 5432:5432
    volumes:
      - postgres:/var/lib/postgresql/data
    env_file:
      - .env
volumes:
  postgres:

</code>```

The redis image is build from a Dockerfile:

```<code>FROM redis:alpine

COPY ./redis.conf /etc/redis.conf

CMD ["redis-server", "/etc/redis.conf"]
</code>```

Now when I run docker compose up -d I get the following error:

```<code> => [internal] load build definition from Dockerfile                    0.0s
 => => transferring dockerfile: 31B                                     0.0s
 => [internal] load .dockerignore                                       0.0s
 => => transferring context: 2B                                         0.0s
 => ERROR [internal] load metadata for docker.io/library/redis:alpine   0.0s
------
 > [internal] load metadata for docker.io/library/redis:alpine:
------
failed to solve: rpc error: code = Unknown
desc = failed to solve with frontend dockerfile.v0:
failed to create LLB definition:
failed to authorize: rpc error: code = Unknown
desc = failed to fetch anonymous token:
Get "https://auth.docker.io/token?scope=repository%3Alibrary%2Fredis%3Apull&service=registry.docker.io":
dial tcp: lookup auth.docker.io on [::1]:53: read udp [::1]:58421->[::1]:53: read: connection refused
</code>```

But if I run docker image build -t . and then rerun docker compose up -d all works.

I searched online a bit about the error, but I didn't find any useful.

I find here on stack overflow that there are a bunch of questions with the same failed to solve: rpc error: code = Unknown, but the body of the error is different.

The compose file works perfectly on my local machine.

Body:
I'm using this little docker-compose.yaml file to start two containers in an EC2 to start a preview of my app:

version: "3.9"
services:
  redis:
      build:
        context: .
      ports:
        - 6379:6379
  database:
    container_name: postgres
    image: postgres:14.2
    ports:
      - 5432:5432
    volumes:
      - postgres:/var/lib/postgresql/data
    env_file:
      - .env
volumes:
  postgres:

The redis image is build from a Dockerfile:

FROM redis:alpine

COPY ./redis.conf /etc/redis.conf

CMD ["redis-server", "/etc/redis.conf"]

Now when I run docker compose up -d I get the following error:

 => [internal] load build definition from Dockerfile                    0.0s
 => => transferring dockerfile: 31B                                     0.0s
 => [internal] load .dockerignore                                       0.0s
 => => transferring context: 2B                                         0.0s
 => ERROR [internal] load metadata for docker.io/library/redis:alpine   0.0s
------
 > [internal] load metadata for docker.io/library/redis:alpine:
------
failed to solve: rpc error: code = Unknown
desc = failed to solve with frontend dockerfile.v0:
failed to create LLB definition:
failed to authorize: rpc error: code = Unknown
desc = failed to fetch anonymous token:
Get "https://auth.docker.io/token?scope=repository%3Alibrary%2Fredis%3Apull&service=registry.docker.io":
dial tcp: lookup auth.docker.io on [::1]:53: read udp [::1]:58421->[::1]:53: read: connection refused

But if I run docker image build -t . and then rerun docker compose up -d all works.

I searched online a bit about the error, but I didn't find any useful.

I find here on stack overflow that there are a bunch of questions with the same failed to solve: rpc error: code = Unknown, but the body of the error is different.

The compose file works perfectly on my local machine.


问:
Unable to Connect a salesforce named credentials with quickbooks companies
I have a requirement to connect a new QuickBooks company to salesforce.

the setup of sync invoices and payments from salesforce to QuickBooks is done and working correctly.

recently we have had a new company sync data in that company.

we are doing this using named credentials and use different named credentials for each company.

but after putting the required information in the named credential the option to choose a company is not appearing and it directly says authenticated.

Not sure it happens because of any new update from quickbook

Check below Images

All Named credential

Named credential

Thanks, In advance


问:
ngrx/data User EntityAction guard for "[User] @ngrx/data/save/add-one/success": payload has a missing or invalid entity key (id)
When I dispatch an Add-Action my Backend is updated and so is my Frontend (due to optimisticAdd: true).
But I still get this Error:

I debugged everything and found the place where the error happens:
The function mustBeEntity(action){...} is called three times. On the third time
const id = this.selectId(data); returns undefined, even though data has an valid id called 'id'.
I tried setting the selectId in the EntityMetaData resulting in the same Error.
Here is my EntyityMetadata:

```<code>const entityMetadata: EntityMetadataMap = {
  User: {
    selectId: (user: User) => user.id,
    entityName: 'User',
    entityDispatcherOptions: {
      optimisticAdd: true,
      optimisticDelete: true,
      optimisticUpdate: true,
      optimisticUpsert: true
    }
  }
};
</code>```

And here is my User Interface:

```<code>export interface User {
  id: number
  firstname: string,
  lastName: string,

}
</code>```

I also got some Screenshots where you can exactly see, that it returns undefined even tho the id is clearly there:

The user got an Id of 5, but then:

Is this a bug or do I misunderstand something?

I already Had a look at this Question:
ngrx/data - alternate id `has a missing or invalid entity key (id)`

But the only solution provided there is not the problem in my case!

Body:
When I dispatch an Add-Action my Backend is updated and so is my Frontend (due to optimisticAdd: true).
But I still get this Error:

I debugged everything and found the place where the error happens:
The function mustBeEntity(action){...} is called three times. On the third time
const id = this.selectId(data); returns undefined, even though data has an valid id called 'id'.
I tried setting the selectId in the EntityMetaData resulting in the same Error.
Here is my EntyityMetadata:

const entityMetadata: EntityMetadataMap = {
  User: {
    selectId: (user: User) => user.id,
    entityName: 'User',
    entityDispatcherOptions: {
      optimisticAdd: true,
      optimisticDelete: true,
      optimisticUpdate: true,
      optimisticUpsert: true
    }
  }
};

And here is my User Interface:

export interface User {
  id: number
  firstname: string,
  lastName: string,

}

I also got some Screenshots where you can exactly see, that it returns undefined even tho the id is clearly there:

The user got an Id of 5, but then:

Is this a bug or do I misunderstand something?

I already Had a look at this Question:
ngrx/data - alternate id `has a missing or invalid entity key (id)`

But the only solution provided there is not the problem in my case!


问:
Codeigniter 4 validation not showing
i was making validations for form, but i have some problem here, the validations is working but the errors message was not showing, i hope someone can help me

my code Controllers:

```<code>public function create_produk(){
        $data = [
            'title' => 'Tambah Produk',
            'validation' => \Config\Services::validation(),
        ];

        return view('admin/produk/create_produk', $data);
    }

public function save_produk()
    {
        //validasi
        $rules = $this->validate([
            'nama_produk' => 'required',
            'kategori_slug' => 'required',
            'deskripsi' => 'required',
        ]);

        //jika gagal
        if(!$rules){
            session()->setFlashdata('gagal', 'Data Produk Gagal Ditambahkan');
            return redirect()->back()->withInput();
        }

    }
</code>```

My views:

```<code><form action="/produk/save_produk" method="post" enctype="multipart/form-data">
        <?= csrf_field(); ?>
        <div class="row">
            <div class="mb-3 col-6">
                <label for="nama_produk">Nama Produk</label>
                <input type="text" class="form-control <?= $validation->hasError('nama_produk') ? 'is-invalid' : null ?>" id="nama_produk" name="nama_produk">

                <?php if ($validation->hasError('nama_produk')) : ?>
                    <div class="invalid-feedback">
                        <?= $validation->getError('nama_produk'); ?>
                    </div>
                <?php endif; ?>
            </div>
        </div>
        <div class="form-group row">
            <div class="col-sm-10">
                <button type="submit" class="btn btn-primary">Add</button>
            </div>
        </div>
    </form>
</code>```

I hope you can help me, thank you.

Title: Codeigniter 4 validation not showing

Body:
i was making validations for form, but i have some problem here, the validations is working but the errors message was not showing, i hope someone can help me

my code Controllers:

public function create_produk(){
        $data = [
            'title' => 'Tambah Produk',
            'validation' => \Config\Services::validation(),
        ];

        return view('admin/produk/create_produk', $data);
    }

public function save_produk()
    {
        //validasi
        $rules = $this->validate([
            'nama_produk' => 'required',
            'kategori_slug' => 'required',
            'deskripsi' => 'required',
        ]);

        //jika gagal
        if(!$rules){
            session()->setFlashdata('gagal', 'Data Produk Gagal Ditambahkan');
            return redirect()->back()->withInput();
        }

    }

My views:

<form action="/produk/save_produk" method="post" enctype="multipart/form-data">
        <?= csrf_field(); ?>

                Nama Produk
                <input type="text" class="form-control <?= $validation->hasError('nama_produk') ? 'is-invalid' : null ?>" id="nama_produk" name="nama_produk">

                <?php if ($validation->hasError('nama_produk')) : ?>

                        <?= $validation->getError('nama_produk'); ?>

                <?php endif; ?>

                <button type="submit" class="btn btn-primary">Add</button>

    </form>

I hope you can help me, thank you.


问:
Firefox goes blank on refreshing an Intermediate page
I'm working through a problem, where my Web application gets directed to a 3rd party application. There is an intermediate page, from where I can go back to my application or another 3rd party application. However, on refreshing this screen on Firefox, this screen goes blank with no html being loaded. The same thing works on Chrome but Firefox got the issue. On debugging locally this works well for both. Getting issue on deployed version only.

Note: This is a Dot Net angular application.

The link doesn't change on refreshing though.

While debugging, I figured out Request.UrlReferrer object is null, so I hardcoded it with the correct object data. Works well for firefox locally but not on deployed version.

Refreshed caches and cookies.


问:
Getting an Error in Jupyter Notebook Connection Error with kernel

We have uninstalled and reinstalled the Jupyter.
We created new jupyter kernel but still it remains unsolved.

How to resolve it?


问:
Wrong reinterpretation of the nullptr in a Qt 5.15-based project | C++
Both GCC (version 12.2) and Clang (version 14.0) compilers interpret nullptr as 32-bit integer (int) in some places, and this causes errors.

For example, in the qhashfunctions.h file there is a variant of function called qHash that takes nullptr as a main argument.

```<code>Q_DECL_CONST_FUNCTION inline uint qHash(std::nullptr_t, uint seed = 0) Q_DECL_NOTHROW
{
    return qHash(reinterpret_cast<quintptr>(nullptr), seed);
}
</code>```

Any compiler reports that int cannot be casted to quintptr (unsigned long long).

Second example has the same problem. In the std_thread.h file there is the following code:

```<code>_M_start_thread(_State_ptr(new _State_impl<_Wrapper>(
          std::forward<_Callable>(__f), std::forward<_Args>(__args)...)),
        __depend);
      }
</code>```

Earlier in this file __depend is declared as nullptr (auto __depend = nullptr;). This means that function pointer (2nd argument) is nullptr. Any compiler reports that a parameter of type void (*)() cannot be initialised with a value of type int.

What is the solution to the problem?

I use ArchLinux (x86-64) with latest updates and Qt version 5.15.8. Building is done through Qt Creator

I also tried to create another Qt-based project and write the following code in the main function:

```<code>unsigned long long i = reinterpret_cast<unsigned long long>(nullptr)
</code>```

Compilation succeded...

Body:
Both GCC (version 12.2) and Clang (version 14.0) compilers interpret nullptr as 32-bit integer (int) in some places, and this causes errors.

For example, in the qhashfunctions.h file there is a variant of function called qHash that takes nullptr as a main argument.

Q_DECL_CONST_FUNCTION inline uint qHash(std::nullptr_t, uint seed = 0) Q_DECL_NOTHROW
{
    return qHash(reinterpret_cast<quintptr>(nullptr), seed);
}

Any compiler reports that int cannot be casted to quintptr (unsigned long long).

Second example has the same problem. In the std_thread.h file there is the following code:

_M_start_thread(_State_ptr(new _State_impl<_Wrapper>(
          std::forward<_Callable>(__f), std::forward<_Args>(__args)...)),
        __depend);
      }

Earlier in this file __depend is declared as nullptr (auto __depend = nullptr;). This means that function pointer (2nd argument) is nullptr. Any compiler reports that a parameter of type void (*)() cannot be initialised with a value of type int.

What is the solution to the problem?

I use ArchLinux (x86-64) with latest updates and Qt version 5.15.8. Building is done through Qt Creator

I also tried to create another Qt-based project and write the following code in the main function:

unsigned long long i = reinterpret_cast<unsigned long long>(nullptr)

Compilation succeded...


问:
Angr for a HTB challenge, no solution found
I'm new to RE. I'm trying to solve a HackTheBox challenge called RAuth, with angr. I understand how to analyze and solve this challenge differently, without angr, but I really want to understand what is wrong with my angr script, or maybe what is the reason why angr is not feasible for this (and similar) case?

The application is easy, after it starts it's requesting the password from stdin, and exits if the password is incorrect:

```<code>>:~/challenges/rauth$ ./rauth
Welcome to secure login portal!
Enter the password to access the system:
wqeqwwqewqewqeqwewqeqweqweqweqweqwewqeqwe
You entered a wrong password!
</code>```

When I run my script it works for around 15 minutes and dies with one of two errors:

```<code>"Killed"
"IndexError: tuple index out of range"
</code>```

My angr script:

```<code>#!/usr/bin/env python
#coding: utf-8
import angr
import claripy
import time
import sys

def is_successful(st):
    output = st.posix.dumps(sys.stdout.fileno())
    if b'Successfully Authenticated' in output:
        return True
    return False

def should_abort(state):
    output = state.posix.dumps(sys.stdout.fileno())
    return b'You entered a wrong password!' in output

def main(round):
    print("Checking "+str(round))
    p = angr.Project('rauth',auto_load_libs=False)

    flag_chars = [claripy.BVS('flag_%d' % i, 8) for i in range(round)]
    flag = claripy.Concat(*flag_chars + [claripy.BVV(b'\n')])

    st = p.factory.full_init_state(
        args=['./rauth'],
        add_options=angr.options.unicorn,
        stdin=angr.SimPackets(name='stdin', content=[(flag, 32)])
        #stdin=flag,
    )
    st.options.add(angr.options.SYMBOL_FILL_UNCONSTRAINED_MEMORY)
    st.options.add(angr.options.SYMBOL_FILL_UNCONSTRAINED_REGISTERS)

    for k in flag_chars:
        st.solver.add(k >= ord(" "))
        st.solver.add(k <= ord("~"))

    sm = p.factory.simulation_manager(st)

    #sm.explore(find=is_successful,avoid=should_abort)
    sm.explore(find=lambda s: b"Successfully" in s.posix.dumps(1),avoid=lambda s: b"wrong" in s.posix.dumps(1))

    if len(sm.found) > 0:
        for solution_state in ex.found:
            print("[>>] {!r}".format(solution_state.solver.eval(flag,cast_to=bytes)))
    else:
        print("[>>] no solution found :(")

if __name__ == "__main__":
    print(main(32))
</code>```

Am I using angr for the case when it's not applicable? What am I missing?

A also tried to play with options, like removing unicorn, enabling auto_load_libs, using or disabling lambdas etc. No success.

Body:
I'm new to RE. I'm trying to solve a HackTheBox challenge called RAuth, with angr. I understand how to analyze and solve this challenge differently, without angr, but I really want to understand what is wrong with my angr script, or maybe what is the reason why angr is not feasible for this (and similar) case?

The application is easy, after it starts it's requesting the password from stdin, and exits if the password is incorrect:

>:~/challenges/rauth$ ./rauth
Welcome to secure login portal!
Enter the password to access the system:
wqeqwwqewqewqeqwewqeqweqweqweqweqwewqeqwe
You entered a wrong password!

When I run my script it works for around 15 minutes and dies with one of two errors:

"Killed"
"IndexError: tuple index out of range"

My angr script:

#!/usr/bin/env python
#coding: utf-8
import angr
import claripy
import time
import sys

def is_successful(st):
    output = st.posix.dumps(sys.stdout.fileno())
    if b'Successfully Authenticated' in output:
        return True
    return False

def should_abort(state):
    output = state.posix.dumps(sys.stdout.fileno())
    return b'You entered a wrong password!' in output

def main(round):
    print("Checking "+str(round))
    p = angr.Project('rauth',auto_load_libs=False)

    flag_chars = [claripy.BVS('flag_%d' % i, 8) for i in range(round)]
    flag = claripy.Concat(*flag_chars + [claripy.BVV(b'\n')])

    st = p.factory.full_init_state(
        args=['./rauth'],
        add_options=angr.options.unicorn,
        stdin=angr.SimPackets(name='stdin', content=[(flag, 32)])
        #stdin=flag,
    )
    st.options.add(angr.options.SYMBOL_FILL_UNCONSTRAINED_MEMORY)
    st.options.add(angr.options.SYMBOL_FILL_UNCONSTRAINED_REGISTERS)

    for k in flag_chars:
        st.solver.add(k >= ord(" "))
        st.solver.add(k <= ord("~"))

    sm = p.factory.simulation_manager(st)

    #sm.explore(find=is_successful,avoid=should_abort)
    sm.explore(find=lambda s: b"Successfully" in s.posix.dumps(1),avoid=lambda s: b"wrong" in s.posix.dumps(1))

    if len(sm.found) > 0:
        for solution_state in ex.found:
            print("[>>] {!r}".format(solution_state.solver.eval(flag,cast_to=bytes)))
    else:
        print("[>>] no solution found :(")

if __name__ == "__main__":
    print(main(32))

Am I using angr for the case when it's not applicable? What am I missing?

A also tried to play with options, like removing unicorn, enabling auto_load_libs, using or disabling lambdas etc. No success.


问:
How do I setup sqlsvr in PHP 8.1 and above?
Currently I have PHP 8.1.14,and right now when I try to use sqlsrv_connect() it will only show me this error:

```<code>Uncaught Error: Call to undefined function sqlsrv_connect().
</code>```

After some researching I realized that I need to download some extensions for my PHP in order to use it.

The two .dll I've downloaded are and placed in my C:\xampp\php\ext folder are:

php_pdo_sqlsrv_81_ts_x64.dll and php_sqlsrv_81_ts_x64.dll

Which I am not certain if I have downloaded the correct one.

I have also added these extensions in the php.ini file under the Dynamic Extension section.

```<code>;extension=pdo_pgsql
extension=pdo_sqlite
;extension=pgsql
;extension=shmop
extension=php_pdo_sqlsrv_81_ts_x64.dll
extension=php_sqlsrv_81_ts_x64.dll
</code>```

Also, these are the line of codes that i used to call sqlsvr_connect() function

```<code><?php
   $serverName = " **server name**, **Port Number**"; //serverName\instanceName, portNumber (default is 1433)
   $connectionInfo = array( "Database"=>"**Database**", "UID"=>"**user ID**", "PWD"=>"**Password**");
   $conn = sqlsrv_connect( $serverName, $connectionInfo);

            if( $conn ) {
                 echo "Connection established.<br />";
            }else{
                 echo "<script>alert('Could not establish connection!');
                    ";
                    die("window.history.go(-1);</script>");
                }

?>
</code>```

Would highly appreciate any help regarding this matter! Thank you in advance.

Body:
Currently I have PHP 8.1.14,and right now when I try to use sqlsrv_connect() it will only show me this error:

Uncaught Error: Call to undefined function sqlsrv_connect().

After some researching I realized that I need to download some extensions for my PHP in order to use it.

The two .dll I've downloaded are and placed in my C:\xampp\php\ext folder are:

php_pdo_sqlsrv_81_ts_x64.dll and php_sqlsrv_81_ts_x64.dll

Which I am not certain if I have downloaded the correct one.

I have also added these extensions in the php.ini file under the Dynamic Extension section.

;extension=pdo_pgsql
extension=pdo_sqlite
;extension=pgsql
;extension=shmop
extension=php_pdo_sqlsrv_81_ts_x64.dll
extension=php_sqlsrv_81_ts_x64.dll

Also, these are the line of codes that i used to call sqlsvr_connect() function

<?php
   $serverName = " **server name**, **Port Number**"; //serverName\instanceName, portNumber (default is 1433)
   $connectionInfo = array( "Database"=>"**Database**", "UID"=>"**user ID**", "PWD"=>"**Password**");
   $conn = sqlsrv_connect( $serverName, $connectionInfo);

            if( $conn ) {
                 echo "Connection established.
";
            }else{
                 echo "");
                }

?>

Would highly appreciate any help regarding this matter! Thank you in advance.


问:
How to acess GCS private Bucket file using Load Balancer
I am trying to upload dist folder in GCS private bucket and trying to access javascript file using load balancer facing access denied error

can any one help how to access a file in private bucket other than https://storage.cloud.google.com/ this url any other way, without adding allUsers or allAuthenticatedUsers

I had tried configuring load balancer and given the backend bucket
and also added Network Admin, Storage Admin role


问:
Timeout reading a post request containing heavy dictionnary
I am receiving a POST request containing a 3 mB Json dictionary. When i receive de POST, my view tries to read the args in the request but that causes a timeout on the Heroku server. When i try it locally, it works fine though.
Here is the code:

```<code>def send_request():
    with open(file) as f:
        data = json.loads(f.read())
    data = json.dumps(data)
    response = requests.post(url=url_recette, data=data)
    return response

@csrf_exempt
def view(request):
    print('the server gets here')
    _args = json.loads(request.body.decode('utf-8'))
    print('the server never gets here so the timeout occurs when i load the args')
</code>```

error on Heroku =>

```<code>Jan 13 09:00:03 gestion app[web] INFO [2023-01-13 09:00:03 +0100] [18] [INFO] Worker exiting (pid: 18)
Jan 13 09:00:03 gestion heroku[router] error at=error code=H13 desc="Connection closed without response" method=POST path="/resiliation/api_get_requete_from_ak" host=gestion-recette.herokuapp.com request_id=xx fwd="xxxx.231" dyno=web.1 connect=0ms service=30826ms status=503 bytes=0 protocol=https
Jan 13 09:00:04 gestion app[web] INFO [2023-01-13 09:00:04 +0100] [26] [INFO] Booting worker with pid: 26
</code>```

Does anyone have an idea of what could be the problem? thx in advance.

Body:
I am receiving a POST request containing a 3 mB Json dictionary. When i receive de POST, my view tries to read the args in the request but that causes a timeout on the Heroku server. When i try it locally, it works fine though.
Here is the code:

def send_request():
    with open(file) as f:
        data = json.loads(f.read())
    data = json.dumps(data)
    response = requests.post(url=url_recette, data=data)
    return response

@csrf_exempt
def view(request):
    print('the server gets here')
    _args = json.loads(request.body.decode('utf-8'))
    print('the server never gets here so the timeout occurs when i load the args')

error on Heroku =>

Jan 13 09:00:03 gestion app[web] INFO [2023-01-13 09:00:03 +0100] [18] [INFO] Worker exiting (pid: 18)
Jan 13 09:00:03 gestion heroku[router] error at=error code=H13 desc="Connection closed without response" method=POST path="/resiliation/api_get_requete_from_ak" host=gestion-recette.herokuapp.com request_id=xx fwd="xxxx.231" dyno=web.1 connect=0ms service=30826ms status=503 bytes=0 protocol=https
Jan 13 09:00:04 gestion app[web] INFO [2023-01-13 09:00:04 +0100] [26] [INFO] Booting worker with pid: 26

Does anyone have an idea of what could be the problem? thx in advance.


问:
Why markers of all categories are black when I use plotly
As shown in following graph, colors of all categories are black. How to fix it?


问:
NGINX Docker reverse proxy not working on server (Works locally)
I am running a Django app on Docker with Nginx, the configuration works perfectly locally but on the server, it doesn't.

i get the error 502 Bad Gateway in the web page

and the logs I get

```<code>2023/01/13 07:55:56 [error] 28#28: *1 connect() failed (111: Connection refused) while connecting
to upstream, client: xx.xxx.xx.xxx, server: , request: "GET /favicon.ico HTTP/1.1", upstream:
"http://xxx.xx.x.x:8000/favicon.ico", host: "xx.xxx.xxx.xxx", referrer: "http://xx.xxx.xxx.xxx/"
</code>```

This is how the configuration looks

Dockerfile

```<code>FROM nginx:1.23.3-alpine
RUN rm /etc/nginx/conf.d/default.conf
COPY ./default.conf /etc/nginx/conf.d/default.conf
</code>```

default.conf

```<code>upstream apii {
    server api:8000;
}

server {
    client_max_body_size 20M;
    listen 80;

    location / {
        proxy_pass http://apii;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $host;
        proxy_redirect off;
    }

    # location = /favicon.ico { access_log off; log_not_found off; }

    location /api {
        proxy_pass http://apii;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $host;
        proxy_redirect off;
    }

    location /realestateadmin {
        proxy_pass http://apii;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $host;
        proxy_redirect off;

    }

    location /staticfiles/ {
        alias /app/staticfiles/;
    }

    location /mediafiles/ {
        alias /app/mediafiles/;
    }

}
</code>```

docker-compose.yml

```<code>version: "3.9"

services:
    api:
        build:
            context: .
            dockerfile: ./docker/local/django/Dockerfile
        command: /start
        volumes:
            - .:/app
            - static_volume:/app/staticfiles
            - media_volume:/app/mediafiles
        # ports:
        #     - "8000:8000"
        expose:
            - 8000
        env_file:
            - .env
        depends_on:
            - postgres-db
        networks:
            - real-estate

    postgres-db:
      image: postgres:12.0-alpine
      ports:
          - "5432:5432"
      volumes:
          - postgres_data:/var/lib/postgresql/data/
      environment:
          - POSTGRES_USER=${DB_USER}
          - POSTGRES_PASSWORD=${DB_PASSWORD}
          - POSTGRES_DB=${DB_NAME}
      networks:
          - real-estate

    nginx:
        restart: always
        depends_on:
            - api
        volumes:
            - static_volume:/app/staticfiles
            - media_volume:/app/mediafiles
        build:
            context: ./docker/local/nginx
            dockerfile: Dockerfile
        ports:
          - "80:80"
        networks:
            - real-estate

networks:
  real-estate:
    driver: bridge

volumes:
  postgres_data:
  static_volume:
  media_volume:
</code>```

I have tried different things. I doesn't make sense to me.

Body:
I am running a Django app on Docker with Nginx, the configuration works perfectly locally but on the server, it doesn't.

i get the error 502 Bad Gateway in the web page

and the logs I get

2023/01/13 07:55:56 [error] 28#28: *1 connect() failed (111: Connection refused) while connecting
to upstream, client: xx.xxx.xx.xxx, server: , request: "GET /favicon.ico HTTP/1.1", upstream:
"http://xxx.xx.x.x:8000/favicon.ico", host: "xx.xxx.xxx.xxx", referrer: "http://xx.xxx.xxx.xxx/"

This is how the configuration looks

Dockerfile

FROM nginx:1.23.3-alpine
RUN rm /etc/nginx/conf.d/default.conf
COPY ./default.conf /etc/nginx/conf.d/default.conf

default.conf

upstream apii {
    server api:8000;
}

server {
    client_max_body_size 20M;
    listen 80;

    location / {
        proxy_pass http://apii;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $host;
        proxy_redirect off;
    }

    # location = /favicon.ico { access_log off; log_not_found off; }

    location /api {
        proxy_pass http://apii;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $host;
        proxy_redirect off;
    }

    location /realestateadmin {
        proxy_pass http://apii;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $host;
        proxy_redirect off;

    }

    location /staticfiles/ {
        alias /app/staticfiles/;
    }

    location /mediafiles/ {
        alias /app/mediafiles/;
    }

}

docker-compose.yml

version: "3.9"

services:
    api:
        build:
            context: .
            dockerfile: ./docker/local/django/Dockerfile
        command: /start
        volumes:
            - .:/app
            - static_volume:/app/staticfiles
            - media_volume:/app/mediafiles
        # ports:
        #     - "8000:8000"
        expose:
            - 8000
        env_file:
            - .env
        depends_on:
            - postgres-db
        networks:
            - real-estate

    postgres-db:
      image: postgres:12.0-alpine
      ports:
          - "5432:5432"
      volumes:
          - postgres_data:/var/lib/postgresql/data/
      environment:
          - POSTGRES_USER=${DB_USER}
          - POSTGRES_PASSWORD=${DB_PASSWORD}
          - POSTGRES_DB=${DB_NAME}
      networks:
          - real-estate

    nginx:
        restart: always
        depends_on:
            - api
        volumes:
            - static_volume:/app/staticfiles
            - media_volume:/app/mediafiles
        build:
            context: ./docker/local/nginx
            dockerfile: Dockerfile
        ports:
          - "80:80"
        networks:
            - real-estate

networks:
  real-estate:
    driver: bridge

volumes:
  postgres_data:
  static_volume:
  media_volume:

I have tried different things. I doesn't make sense to me.


问:
Why rememberCoroutineScope in jetpack compose doesn't have any launch method?
I am using jetpack compose version 1.3.2 and I am trying to call a suspend function using coroutine
but when I using rememberCoroutineScope function to create scope to launch it have no launch function.
Can anyone help?

this is my code

```<code>@OptIn(ExperimentalPagerApi::class)
@Composable
fun YearPicker(viewDate: JalaliCalendar, state: DatePickerState, pagerState: PagerState) {
    val gridState = rememberLazyGridState(viewDate.year - state.yearRange.first)
    val scope = rememberCoroutineScope()
    LazyVerticalGrid(
        columns = GridCells.Fixed(3),
        state = gridState,
//        modifier = Modifier.background(state.dialogBackground)
    ) {
        itemsIndexed(state.yearRange.toList()) { _, item ->
            val selected = remember { item == viewDate.year }
            YearPickerItem(year = item, selected = selected, colors = state.colors) {
                if (!selected) {
                    scope.launch{
                        pagerState.scrollToPage(
                            pagerState.currentPage + (item - viewDate.year) * 12
                        )
                    }
                }
                state.yearPickerShowing = false
            }
        }
    }
}
</code>```

Body:
I am using jetpack compose version 1.3.2 and I am trying to call a suspend function using coroutine
but when I using rememberCoroutineScope function to create scope to launch it have no launch function.
Can anyone help?

this is my code

@OptIn(ExperimentalPagerApi::class)
@Composable
fun YearPicker(viewDate: JalaliCalendar, state: DatePickerState, pagerState: PagerState) {
    val gridState = rememberLazyGridState(viewDate.year - state.yearRange.first)
    val scope = rememberCoroutineScope()
    LazyVerticalGrid(
        columns = GridCells.Fixed(3),
        state = gridState,
//        modifier = Modifier.background(state.dialogBackground)
    ) {
        itemsIndexed(state.yearRange.toList()) { _, item ->
            val selected = remember { item == viewDate.year }
            YearPickerItem(year = item, selected = selected, colors = state.colors) {
                if (!selected) {
                    scope.launch{
                        pagerState.scrollToPage(
                            pagerState.currentPage + (item - viewDate.year) * 12
                        )
                    }
                }
                state.yearPickerShowing = false
            }
        }
    }
}


问:
Can I find when a page is last viewed in the Notion api?
I am wondering if there is a possibility/workaround to find when a page is last viewed.

I have looked at the reference and have not been able to find it; only the last edited date. I have also looked at users, to see if they have some form of last viewed pages.

Within Notion itself that information is present. You can see who has viewed a page, when, and even whether they are viewing it at that moment.

In the end I want to run a script that checks all the pages on our Notion environment and flags the ones that have not been viewed for over a certain amount of time as ones that can possibly be deleted. The last edited date doesn't work here because some pages contain static info and may be viewed but not edited.


问:
Can I use AppiumDriver in remote server?
I want to develop this structure using java-client library.

server computer: not install appium, having not device
client computer: install appium, having connected device

but It is very important part that server computer has script file.
(script file is test code using AppiumDriver.)

If client want to auto test, it request auto test to server computer.
server make session between client computer and device (connected to client computer).

After this session, server can get client's appiumdriver remotely.

server use this appiumdriver to auto test.
In server, do auto test through this appiumdriver.

I have only one computer now. So I can't test it...
Is this scenario possible or not?

I would really appreciate it if you could give me an answer.


问:
Firefox is not sending allocate request to TURN server to get relay candidates
Find below logs from about webrtc while checking with trickle ICE.
https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/

ICE(PC:{f8be271e-a104-46d0-9666-1f5c4804b8e3} 1673540416421000 (id=6442450948 url=https://webrtc.github.io/samples/src/content/peercon): failed to resolve candidate relay(IP4:192.168.14.18:58951/UDP|IP4:0.0.0.0:3478/UDP).

Tried with other browsers on the same machine but did not face any issues. Cannot generate relay candidates in firefox browser alone. Even tried after reinstalling the browser.
In wireshark packet trace, I can see that there is not STUN request from the browser to the TURN server.


问:
jupyter notebook's kernel keeps dying when using dearpygui

Just installed dearpygui 1.8.0 module in a proper environment.

Then I ran the first step's code from:
https://dearpygui.readthedocs.io/en/latest/tutorials/first-steps.html

here is the code :

```<code>import dearpygui.dearpygui as dpg

dpg.create_context()
dpg.create_viewport(title='Custom Title', width=600, height=300)

with dpg.window(label="Example Window"):
    dpg.add_text("Hello, world")
    dpg.add_button(label="Save")
    dpg.add_input_text(label="string", default_value="Quick brown fox")
    dpg.add_slider_float(label="float", default_value=0.273, max_value=1)

dpg.setup_dearpygui()
dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()
</code>```

returns the error :

```<code>The kernel for Documents ... /DearPyGui/Studies&Tries.ipynb appears to have died. It will restart automatically.

</code>```

The same code ran directly from my python installation works well.

Command:

```<code>(dpg_py310) amen@ubu:~$ python dpg01.py

</code>```

reinstalling dearpygui 1.8.0 gives the same result

donwngrading to dearpygui 1.7.3 makes no change

no solution found on the net

Need help

Body:
Just installed dearpygui 1.8.0 module in a proper environment.

Then I ran the first step's code from:
https://dearpygui.readthedocs.io/en/latest/tutorials/first-steps.html

here is the code :

import dearpygui.dearpygui as dpg

dpg.create_context()
dpg.create_viewport(title='Custom Title', width=600, height=300)

with dpg.window(label="Example Window"):
    dpg.add_text("Hello, world")
    dpg.add_button(label="Save")
    dpg.add_input_text(label="string", default_value="Quick brown fox")
    dpg.add_slider_float(label="float", default_value=0.273, max_value=1)

dpg.setup_dearpygui()
dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()

returns the error :

The kernel for Documents ... /DearPyGui/Studies&Tries.ipynb appears to have died. It will restart automatically.

The same code ran directly from my python installation works well.

Command:

(dpg_py310) amen@ubu:~$ python dpg01.py

reinstalling dearpygui 1.8.0 gives the same result

donwngrading to dearpygui 1.7.3 makes no change

no solution found on the net

Need help


问:
Skip text comparison with regex and difflib
How could I put regex inside difflib.SequenceMatcher in order to save time writing possible matchups, here is an example of what I want to do

```<code>> SequenceMatcher(None, "Hi*", "Hiiiiiiiiiiii").ratio()
> 1.0
</code>```

This doesn't work, it's just an example of how I would like it to work

Body:
How could I put regex inside difflib.SequenceMatcher in order to save time writing possible matchups, here is an example of what I want to do

> SequenceMatcher(None, "Hi*", "Hiiiiiiiiiiii").ratio()
> 1.0

This doesn't work, it's just an example of how I would like it to work


问:
xgboost 1.7.3 on PY3.8 performance is different from xgboost 1.3.3 on PY3.7 with exactly the same parameters
I recently have upgraded the system to install PY38 and upgrade xgboost version from 1.3.3 to 1.7.3. I ran a model twice, once in xgb 1.3.3 and once in xgb 1.7.3.
To my surprise, with exactly the same hyperparameters, I got quite different results. The one from newer xgb version developed less trees and resulted in poorer performance than old version.

My parameters used are:
eta,
max_depth,
gamma,
alpha,
lambda,
subsample,
colsample_bytree,
min_child_weight,

objective:binary:logistic
booster: gbtree
grow_policy: lossguide
tree_method: hist
eval_metric: auc

Everything is the same for parameters above, but performances are so different.

Anyone has idea on the reason? Any default value change besides the ones above?

Thanks.

Try to solve this issue. Find the reason for the difference.


问:
ERROR in node_modules/export-from-json/dist/types/index.d.ts(2,13): error TS1005: '=' expected
I'm using angular version 6. After cloning the repo I did npm i. After that I did npm run start and facing this issue as shown below

Here is my package.json file

```<code>{
  "name": "somaf",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve --proxy-config proxy.config.json --port=4300 --disable-host-check",
    "build": "ng build --prod",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^6.1.0",
    "@angular/cdk": "^6.2.0",
    "@angular/common": "^6.1.0",
    "@angular/compiler": "^6.1.0",
    "@angular/core": "^6.1.0",
    "@angular/forms": "^6.1.0",
    "@angular/http": "^6.1.0",
    "@angular/material": "^6.4.7",
    "@angular/platform-browser": "^6.1.0",
    "@angular/platform-browser-dynamic": "^6.1.0",
    "@angular/router": "^6.1.0",
    "ang-jsoneditor": "^1.10.4",
    "angular-user-idle": "^2.2.7",
    "angular2-promise-buttons": "^3.0.0",
    "core-js": "^2.5.4",
    "export-from-json": "^1.4.1",
    "json-formatter-js": "^2.3.4",
    "jsoneditor": "^9.7.4",
    "rxjs": "6.2.0",
    "zone.js": "~0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.8.0",
    "@angular/cli": "~6.2.9",
    "@angular/compiler-cli": "^6.1.0",
    "@angular/language-service": "^6.1.0",
    "@types/jasmine": "~2.8.8",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~8.9.4",
    "codelyzer": "~4.3.0",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "^6.3.19",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~1.1.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "node-sass": "^4.14.1",
    "protractor": "^7.0.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.11.0",
    "typescript": "^2.9.2",
    "webpack": "^4.16.4"
  }
}
</code>```

I have tried updating the typescript version by removing '~' and adding '^' also updated the rxjs version by removing the '~' but did not work for me.

Body:
I'm using angular version 6. After cloning the repo I did npm i. After that I did npm run start and facing this issue as shown below

Here is my package.json file

{
  "name": "somaf",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve --proxy-config proxy.config.json --port=4300 --disable-host-check",
    "build": "ng build --prod",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^6.1.0",
    "@angular/cdk": "^6.2.0",
    "@angular/common": "^6.1.0",
    "@angular/compiler": "^6.1.0",
    "@angular/core": "^6.1.0",
    "@angular/forms": "^6.1.0",
    "@angular/http": "^6.1.0",
    "@angular/material": "^6.4.7",
    "@angular/platform-browser": "^6.1.0",
    "@angular/platform-browser-dynamic": "^6.1.0",
    "@angular/router": "^6.1.0",
    "ang-jsoneditor": "^1.10.4",
    "angular-user-idle": "^2.2.7",
    "angular2-promise-buttons": "^3.0.0",
    "core-js": "^2.5.4",
    "export-from-json": "^1.4.1",
    "json-formatter-js": "^2.3.4",
    "jsoneditor": "^9.7.4",
    "rxjs": "6.2.0",
    "zone.js": "~0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.8.0",
    "@angular/cli": "~6.2.9",
    "@angular/compiler-cli": "^6.1.0",
    "@angular/language-service": "^6.1.0",
    "@types/jasmine": "~2.8.8",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~8.9.4",
    "codelyzer": "~4.3.0",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "^6.3.19",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~1.1.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "node-sass": "^4.14.1",
    "protractor": "^7.0.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.11.0",
    "typescript": "^2.9.2",
    "webpack": "^4.16.4"
  }
}

I have tried updating the typescript version by removing '~' and adding '^' also updated the rxjs version by removing the '~' but did not work for me.


问:
http.Get("example url") is giving resize output file failed error
I am writing a code in GoLang to get data from a url but when I make http.Get() request, the response I get is as per the following.

"compile_output": "# command-line-arguments\n/usr/local/go-1.13.5/pkg/tool/linux_amd64/link: resize output file failed: truncate $WORK/b001/exe/a.out: file too large\n",

Please suggest me how to tackle this.

Code is as per the following:

```<code>    import (
        "fmt"
        "io/ioutil"
        "net/http"
    )

    func main() {
        // define the URL to get data from
        url := "my_example_url"

        // use http.Get() to make a GET request to the URL
        resp, err := http.Get(url)
        if err != nil {
            fmt.Println("Error getting data:", err)
            return
        }
        defer resp.Body.Close()

        // read the response body
        body, err := ioutil.ReadAll(resp.Body)
        if err != nil {
            fmt.Println("Error reading response:", err)
            return
        }

        // print the response body
        fmt.Println(string(body))
    }
</code>```

I tried reading through GoLang URl Documentations, but didn't help.

Body:
I am writing a code in GoLang to get data from a url but when I make http.Get() request, the response I get is as per the following.

"compile_output": "# command-line-arguments\n/usr/local/go-1.13.5/pkg/tool/linux_amd64/link: resize output file failed: truncate $WORK/b001/exe/a.out: file too large\n",

Please suggest me how to tackle this.

Code is as per the following:

    import (
        "fmt"
        "io/ioutil"
        "net/http"
    )

    func main() {
        // define the URL to get data from
        url := "my_example_url"

        // use http.Get() to make a GET request to the URL
        resp, err := http.Get(url)
        if err != nil {
            fmt.Println("Error getting data:", err)
            return
        }
        defer resp.Body.Close()

        // read the response body
        body, err := ioutil.ReadAll(resp.Body)
        if err != nil {
            fmt.Println("Error reading response:", err)
            return
        }

        // print the response body
        fmt.Println(string(body))
    }

I tried reading through GoLang URl Documentations, but didn't help.


问:
Error: Prevent writing to file that only differs in casing or query string from already written file
I just created laravel mix project but always get error:

```<code>[webpack-cli] Error: Prevent writing to file that only differs in casing or query string from already written file.
This will lead to a race-condition and corrupted files on case-insensitive file systems.
/home/edward/laravel2/public/images/wheel.png
/home/edward/laravel2/public/images/wheel.png
    at checkSimilarFile (/home/edward/laravel2/node_modules/webpack/lib/Compiler.js:666:11)
    at writeOut (/home/edward/laravel2/node_modules/webpack/lib/Compiler.js:840:13)
    at /home/edward/laravel2/node_modules/webpack/lib/util/fs.js:242:5
    at FSReqCallback.oncomplete (fs.js:180:23)
</code>```

My webpack.mix.js file:

```<code>            {
                test: /\.(png|jpe?g|gif)$/i,
                loader: 'file-loader',
                exclude: '/public/',
                options: {
                    name: '[hash].[ext]',
                    outputPath: 'images/',
                    emitFile: true,
                },
            },
            {
                test: /\.(mp3)$/i,
                loader: 'file-loader',
                exclude: '/public/',
                options: {
                    name: '[name].[ext]',
                    outputPath: 'trash/',
                    emitFile: true,
                },
            },
        ],
    },
</code>```

I dont understand what wrong with my config. I worked on that error for 3 hours

Body:
I just created laravel mix project but always get error:

[webpack-cli] Error: Prevent writing to file that only differs in casing or query string from already written file.
This will lead to a race-condition and corrupted files on case-insensitive file systems.
/home/edward/laravel2/public/images/wheel.png
/home/edward/laravel2/public/images/wheel.png
    at checkSimilarFile (/home/edward/laravel2/node_modules/webpack/lib/Compiler.js:666:11)
    at writeOut (/home/edward/laravel2/node_modules/webpack/lib/Compiler.js:840:13)
    at /home/edward/laravel2/node_modules/webpack/lib/util/fs.js:242:5
    at FSReqCallback.oncomplete (fs.js:180:23)

My webpack.mix.js file:

            {
                test: /\.(png|jpe?g|gif)$/i,
                loader: 'file-loader',
                exclude: '/public/',
                options: {
                    name: '[hash].[ext]',
                    outputPath: 'images/',
                    emitFile: true,
                },
            },
            {
                test: /\.(mp3)$/i,
                loader: 'file-loader',
                exclude: '/public/',
                options: {
                    name: '[name].[ext]',
                    outputPath: 'trash/',
                    emitFile: true,
                },
            },
        ],
    },

I dont understand what wrong with my config. I worked on that error for 3 hours


问:
Micro Frontend For Flutter Mobile
Is there any way to make microfrontend with Flutter Mobile. We have a big team and we wanna to use microfrontend with Flutter. I am not sure can we handle a big project with monolith application. We have goals to make a super app which is merging 8 application in one. I do not want to use webview. I want to make it with dart language.</p>

Title: Micro Frontend For Flutter Mobile


问:
React functional component: Forcefully show scroll in infinite scroll if the content is less than infinite scroll height
I'm using api data with pagination so each time we will get 6 record which we are showing in the table with infinite scroll.

Now the problem is in the first time these record is not taking the whole height so, in screen bottom some spaces are left which let the scroll bar to not visible.since, scrollbar is not there. So next function is not calling the next record.

I have tried overflow:scroll

My expectation is show to show the scroll bar in the screen even if some spaces are there in the bottom and if has more is true then call the next function for the next record


问:
Slider between positive and negative values
I'm using syncfusion_flutter_sliders package. Is it possible to display a slider where you choose a value between positive and negative? E.g. the default value is 0 - we can go left on the slider and select a value between 0 and -1, or we can go right and select a value between 0 and 1.

I would like the tack to highlight only the left or right side of the thumb.

An example in the screenshot below:

EDIT:

The best answer for this question is here: https://stackoverflow.com/a/75114671/6942599


问:
Let Firebase users know to update app because their account has been disabled for Expo Android app
My Android app's stack is Expo-React Native and Firebase. Recently I created a new Firebase account. Now I want to migrate users from previous database to newer one. For that my strategy is to disable all users, migrate data to new database, publish a new android app and ask users to update app on their own devices.
So my question how to let the disabled user know to update his app or may be forcefully update his app when he tries to re-login?
Is there a better strategy?
Thanks.</p>


问:
Lambda NodeJS works intermittent with async method
I have a lambda function written in node.js. The lambda logic is to extract secrets from aws secret manager and pass the params to another module with a token to make a soap call.This lambda was working as expected without async method to get secreats when secreats hardcoded.

But after adding an async getsecrets method the lambda works intermittently while testing in aws console. The getsecreats returns params every time. But the lambda terminates without the intended output. It doesn't make any soap call.

The logic of the lambda code is

Get the secret

Pass the secret to the CallServicewithToken()

get XML data from soap and populate it into the database.

Why it works intermittently when introducing async calls?  I have tried introducing async to all methods. still the same issue. Appreciate any input/help.

The code is as below

```<code>'use strict';

var soap = require('strong-soap').soap;
const aws = require("aws-sdk");
const request = require('request');

process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = 0;

var rfcUrl = process.env.rfcser_url;
var testUrl = process.env.faccser_url;
var region = process.env.region;
var secretName = process.env.secretName;
var oauthurl = process.env.oauthurl;
var rfcRequestArgs;

var parsedResult;
var tokenrequest;

exports.handler = async function(event, context,callback) {
   const secret = await getSecrets();
   CallServicewithToken();

};

async function getSecrets() {

const config = { region : region, apiVersion: 'latest' };

let secretManager = new aws.SecretsManager(config);
const Result = await secretManager.getSecretValue({ SecretId: secretName }).promise();

    parsedResult = JSON.parse(Result.SecretString);
    tokenrequest = {
      url: oauthurl,
      form: {
          client_id: parsedResult.client_id,
          client_secret: parsedResult.client_secret,
          grant_type:'client_credentials',
          scope:parsedResult.scope
      }
    };

    console.log('client_id: ' + parsedResult.client_id);
    console.log('client_secret: ' + parsedResult.client_secret);
    console.log('testservice_userid: ' + parsedResult.testservice_userid);

}

function CallServicewithToken() {

  console.log('Calling CallServicewithToken ');
  request.post(tokenrequest, (err, res, body) => {

    if (err) {
      console.log(' error2: ' + err);
      return;
    }

    rfcRequestArgs = {
      UserName: parsedResult.service_username
    };

    var tokenobj = JSON.parse(body);
    var token = 'Bearer '+ tokenobj.access_token;

    var credentials = {
      Authorization:{
        AuthToken: token
      }
    }

  var options = {};
  console.log('Calling Service.');
  soap.createClient(rfcUrl, options, function(err, client) {

  client.addSoapHeader(
      `<aut:Authorization xmlns:aut="http://soap.xyznet.net">
       <aut:AuthToken>${token}</aut:AuthToken>
       </aut:Authorization>`
    );

  var method = client['GetSourceLocationData'];

  method(RequestArgs, function(err, result, envelope, soapHeader) {
      if (err) {
        console.log('error3: ' + err);
        return;
    }
    else
      {
        console.log('Received response from GetSourceLocationData().');
        CallTESTService(JSON.stringify(result));
    }
});

function CallTESTService(LocData)
{

  var testRequestArgs = {
      UserID: parsedResult.testservice_userid,
      AuthorizationKey: parsedResult.testservice_authorizationkey,
      LocationData: LocData
  };

  console.log('Calling test Service.');
  options = {};
  soap.createClient(testUrl, options, function(err, client) {
    client.addSoapHeader(
      `<Authorization xmlns="testWebService">
       <AuthToken>${token}</AuthToken>
       </Authorization>`
    );
    var test_method = client['UpdateLocationData'];
    console.log('Called UpdateLocationData service method.');

    test_method(testRequestArgs, function(err, result, envelope, soapHeader) {
      if(err) {
          console.log('test error: ' + err);
          return;
      }
      else
      {
          console.log('Response: \n' + JSON.stringify(result));
          console.log('Data updated through test service method.');
      }
  });
  });
}
});

});
}

</code>```

Body:
I have a lambda function written in node.js. The lambda logic is to extract secrets from aws secret manager and pass the params to another module with a token to make a soap call.This lambda was working as expected without async method to get secreats when secreats hardcoded.

But after adding an async getsecrets method the lambda works intermittently while testing in aws console. The getsecreats returns params every time. But the lambda terminates without the intended output. It doesn't make any soap call.

The logic of the lambda code is

Get the secret

Pass the secret to the CallServicewithToken()

get XML data from soap and populate it into the database.

Why it works intermittently when introducing async calls?  I have tried introducing async to all methods. still the same issue. Appreciate any input/help.

The code is as below

'use strict';

var soap = require('strong-soap').soap;
const aws = require("aws-sdk");
const request = require('request');

process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = 0;

var rfcUrl = process.env.rfcser_url;
var testUrl = process.env.faccser_url;
var region = process.env.region;
var secretName = process.env.secretName;
var oauthurl = process.env.oauthurl;
var rfcRequestArgs;

var parsedResult;
var tokenrequest;

exports.handler = async function(event, context,callback) {
   const secret = await getSecrets();
   CallServicewithToken();

};

async function getSecrets() {

const config = { region : region, apiVersion: 'latest' };

let secretManager = new aws.SecretsManager(config);
const Result = await secretManager.getSecretValue({ SecretId: secretName }).promise();

    parsedResult = JSON.parse(Result.SecretString);
    tokenrequest = {
      url: oauthurl,
      form: {
          client_id: parsedResult.client_id,
          client_secret: parsedResult.client_secret,
          grant_type:'client_credentials',
          scope:parsedResult.scope
      }
    };

    console.log('client_id: ' + parsedResult.client_id);
    console.log('client_secret: ' + parsedResult.client_secret);
    console.log('testservice_userid: ' + parsedResult.testservice_userid);

}

function CallServicewithToken() {

  console.log('Calling CallServicewithToken ');
  request.post(tokenrequest, (err, res, body) => {

    if (err) {
      console.log(' error2: ' + err);
      return;
    }

    rfcRequestArgs = {
      UserName: parsedResult.service_username
    };

    var tokenobj = JSON.parse(body);
    var token = 'Bearer '+ tokenobj.access_token;

    var credentials = {
      Authorization:{
        AuthToken: token
      }
    }

  var options = {};
  console.log('Calling Service.');
  soap.createClient(rfcUrl, options, function(err, client) {

  client.addSoapHeader(
      `<aut:Authorization xmlns:aut="http://soap.xyznet.net">
       <aut:AuthToken>${token}</aut:AuthToken>
       </aut:Authorization>`
    );

  var method = client['GetSourceLocationData'];

  method(RequestArgs, function(err, result, envelope, soapHeader) {
      if (err) {
        console.log('error3: ' + err);
        return;
    }
    else
      {
        console.log('Received response from GetSourceLocationData().');
        CallTESTService(JSON.stringify(result));
    }
});

function CallTESTService(LocData)
{

  var testRequestArgs = {
      UserID: parsedResult.testservice_userid,
      AuthorizationKey: parsedResult.testservice_authorizationkey,
      LocationData: LocData
  };

  console.log('Calling test Service.');
  options = {};
  soap.createClient(testUrl, options, function(err, client) {
    client.addSoapHeader(
      `<Authorization xmlns="testWebService">
       <AuthToken>${token}</AuthToken>
       </Authorization>`
    );
    var test_method = client['UpdateLocationData'];
    console.log('Called UpdateLocationData service method.');

    test_method(testRequestArgs, function(err, result, envelope, soapHeader) {
      if(err) {
          console.log('test error: ' + err);
          return;
      }
      else
      {
          console.log('Response: \n' + JSON.stringify(result));
          console.log('Data updated through test service method.');
      }
  });
  });
}
});

});
}


问:
Manually triggering code action suggestion in VSCode extension
How to make a VSCode extension to only return the code action when the "lightbulb" code action suggestion feature is manually invoked?

I am trying to make a VSCode extension using TypeScript that suggests a code snippet when the user invokes the "lightbulb" code action suggestion feature on a specific line. However, I want the code action to only be returned when the user manually invokes the "lightbulb" code action suggestion feature and not when the code action is triggered automatically.

I have tried to check the context.trigger property in the provideCodeActions method, but it does not exist on the CodeActionContext type. I also tried to check the context.only property, but it does not have the contains method.

Is there a way to achieve this feature?

```<code>export function activate(context: vscode.ExtensionContext) {
    context.subscriptions.push(vscode.languages.registerCodeActionsProvider('python', {
        provideCodeActions: async (document, range, context, token) => {
            const action = await suggestfix(document, range, context);
            return action ? [action] : [];
        },
    }));
};
</code>```

Body:
How to make a VSCode extension to only return the code action when the "lightbulb" code action suggestion feature is manually invoked?

I am trying to make a VSCode extension using TypeScript that suggests a code snippet when the user invokes the "lightbulb" code action suggestion feature on a specific line. However, I want the code action to only be returned when the user manually invokes the "lightbulb" code action suggestion feature and not when the code action is triggered automatically.

I have tried to check the context.trigger property in the provideCodeActions method, but it does not exist on the CodeActionContext type. I also tried to check the context.only property, but it does not have the contains method.

Is there a way to achieve this feature?

export function activate(context: vscode.ExtensionContext) {
    context.subscriptions.push(vscode.languages.registerCodeActionsProvider('python', {
        provideCodeActions: async (document, range, context, token) => {
            const action = await suggestfix(document, range, context);
            return action ? [action] : [];
        },
    }));
};


问:
Dart - How to add async to class?
I wrote a code like this:

```<code>List elements = [
  'Lenovo IdeaPad 3 Intel Core i5 1135G7 8GB 512GB SSD Freedos 15.6" FHD Taşınabilir Bilgisayar 82H8020BTX',
  'Lenovo Ideapad 3 AMD Ryzen 3 3250U 8GB 256GB SSD Freedos 15.6" FHD Taşınabilir Bilgisayar 82KR00CVTX',
  'Lenovo Ideapad 3 Intel Core i3 1115G4 8GB 256GB SSD Freedos 15.6" FHD Taşınabilir Bilgisayar 82H802F4TX',
]; // default items

class WebScraping {
  factory WebScraping(String url) async {
    var scraper = WebScraper("https://www.hepsiburada.com/");
    if (await scraper.loadWebPage("/$url")) {
      var element = scraper.getElement(
        'div.wrapper > main.content-wrapper > div.product-detail-module > section.detail-main > div.container > div.hide-title> header.title-wrapper > span.product-name',
        [],
      );
      for (int i = 0; i < 1; i++) {
        var title = element[i]["title"];
        if (elements.firstWhere((a) => a == title) == true) {
          elements.add(title);
          print("Added");
        } else if (elements.firstWhere((a) => a == title) == false) {
          print("already attached");
        }
      }
    }
  }
  void AllProducts() async {
    // ...
  }
</code>```

I need to use async in WebScraping function inside WebScraping class. How can I do that? Thank you in advance for your help.

Title: Dart - How to add async to class?

Body:
I wrote a code like this:

List elements = [
  'Lenovo IdeaPad 3 Intel Core i5 1135G7 8GB 512GB SSD Freedos 15.6" FHD Taşınabilir Bilgisayar 82H8020BTX',
  'Lenovo Ideapad 3 AMD Ryzen 3 3250U 8GB 256GB SSD Freedos 15.6" FHD Taşınabilir Bilgisayar 82KR00CVTX',
  'Lenovo Ideapad 3 Intel Core i3 1115G4 8GB 256GB SSD Freedos 15.6" FHD Taşınabilir Bilgisayar 82H802F4TX',
]; // default items

class WebScraping {
  factory WebScraping(String url) async {
    var scraper = WebScraper("https://www.hepsiburada.com/");
    if (await scraper.loadWebPage("/$url")) {
      var element = scraper.getElement(
        'div.wrapper > main.content-wrapper > div.product-detail-module > section.detail-main > div.container > div.hide-title> header.title-wrapper > span.product-name',
        [],
      );
      for (int i = 0; i < 1; i++) {
        var title = element[i]["title"];
        if (elements.firstWhere((a) => a == title) == true) {
          elements.add(title);
          print("Added");
        } else if (elements.firstWhere((a) => a == title) == false) {
          print("already attached");
        }
      }
    }
  }
  void AllProducts() async {
    // ...
  }

I need to use async in WebScraping function inside WebScraping class. How can I do that? Thank you in advance for your help.


问:
Variable is None even tho it shouldn't be
I am trying to create an agenda for my app using tkinter and custom tkinter. the thing is I already used customtkinter.CTkEntry and I didn't have this issue but now It seems the variables are set to None instead of CTkEntry.

What I did before that works is this:

```<code>self.entry_agenda = customtkinter.CTkEntry(self, placeholder_text="Búsqueda...",)
        self.entry_agenda.grid(row=3, column=1, columnspan=2, padx=(20, 0), pady=(20, 20), sticky="ew")

        self.busqueda_agenda = customtkinter.CTkButton(master=self, text="Buscar", fg_color="LightSteelBlue2",
                                                       hover_color="LightSteelBlue3", text_color=("Black"),command= lambda : self.busquedaInformadaAgenda(self.entry_agenda.get()))
        self.busqueda_agenda.grid(row=3, column=3, padx=(20, 20), pady=(20, 20), sticky="e")
</code>```

And what I am trying to do is this:

```<code>self.entry_nombre = customtkinter.CTkEntry(master=self, placeholder_text="Nombre...", height=30 ).grid(row=0, column=1, columnspan=2, padx=(20, 0), pady=(20, 20), sticky="we")
        self.entry_tema = customtkinter.CTkEntry(master=self, placeholder_text="Tema...", width=300, height=30 ).grid(row=1, column=1, columnspan=2, padx=(20, 0), pady=(20, 20), sticky="we")
        self.entry_contacto = customtkinter.CTkEntry(master=self, placeholder_text="Contacto...", width=300, height=30 ).grid(row=2, column=1, columnspan=2, padx=(20, 0), pady=(20, 20), sticky="we")
        self.entry_tlfn = customtkinter.CTkEntry(master=self, placeholder_text="Tlfn...", width=300, height=30 ).grid(row=3, column=1, columnspan=1, padx=(20, 0), pady=(20, 20), sticky="w")
        self.entry_tlfn2 = customtkinter.CTkEntry(master=self, placeholder_text="Tlfn 2...", width=300, height=30 ).grid(row=4, column=1, columnspan=1, padx=(20, 0), pady=(20, 20), sticky="w")
        self.entry_tlfn3 = customtkinter.CTkEntry(master=self, placeholder_text="Tlfn 3...", width=300, height=30 ).grid(row=5, column=1, columnspan=1, padx=(20, 0), pady=(20, 20), sticky="w")
        self.entry_fax = customtkinter.CTkEntry(master=self, placeholder_text="Fax...", width=300, height=30 ).grid(row=3, column=3, columnspan=1, padx=(0, 0), pady=(20, 20), sticky="w")
        self.entry_email = customtkinter.CTkEntry(master=self, placeholder_text="Email...", width=300, height=30 ).grid(row=4, column=3, columnspan=2, padx=(0, 0), pady=(20, 20), sticky="w")
        self.entry_web = customtkinter.CTkEntry(master=self, placeholder_text="Web...", width=300, height=30 ).grid(row=5, column=3 , columnspan=2, padx=(0, 0), pady=(20, 20), sticky="w")
        self.entry_movil = customtkinter.CTkEntry(master=self, placeholder_text="Movil...", height=30 ).grid(row=6, column=1, columnspan=2, padx=(20, 0), pady=(20, 20), sticky="we")
        self.entry_movil2 = customtkinter.CTkEntry(master=self, placeholder_text="Movil 2...", height=30 ).grid(row=7, column=1, columnspan=2, padx=(20, 0), pady=(20, 20), sticky="we")
        self.entry_movil3 = customtkinter.CTkEntry(master=self, placeholder_text="Movil 3...", height=30 ).grid(row=8, column=1, columnspan=2, padx=(20, 0), pady=(20, 20), sticky="we")
        self.entry_observaciones = customtkinter.CTkTextbox(master=self, border_width=2, ).grid(row=9, column=1, columnspan=3, padx=(20, 60), pady=(20, 20), sticky="we")

        self.alta_agenda = customtkinter.CTkButton(master=self, text="Confirmar", fg_color="LightSteelBlue2",
                                                   hover_color="LightSteelBlue3", text_color=("Black"),
                                                   command=lambda: self.darAlta()).grid(row=10, columnspan=4, sticky='n', pady=(0,20))
    def darAlta(self):
        cur = self.connection.cursor()
        print(self.entry_contacto.get())
        sql = 'INSERT INTO agenda_telefonica VALUES ('+ self.entry_nombre.get()+''+ self.entry_tema.get()+''+ self.entry_contacto.get()+''+ self.entry_tlfn.get()+''+ self.entry_tlfn2.get()+''+ self.entry_tlfn3.get()+''+ self.entry_fax.get()+''+ self.entry_email.get()+''+ self.entry_web.get()+''+ self.entry_movil.get()+''+ self.entry_movil2.get()+''+ self.entry_movil3.get()+''+ self.entry_observaciones.get()+')'
        cur.execute(sql)
        cur.close()
</code>```

PS: I didn't check if the SQL sentence is correct, right now i am trying to use the entry value which i cannot access.

Body:
I am trying to create an agenda for my app using tkinter and custom tkinter. the thing is I already used customtkinter.CTkEntry and I didn't have this issue but now It seems the variables are set to None instead of CTkEntry.

What I did before that works is this:

self.entry_agenda = customtkinter.CTkEntry(self, placeholder_text="Búsqueda...",)
        self.entry_agenda.grid(row=3, column=1, columnspan=2, padx=(20, 0), pady=(20, 20), sticky="ew")

        self.busqueda_agenda = customtkinter.CTkButton(master=self, text="Buscar", fg_color="LightSteelBlue2",
                                                       hover_color="LightSteelBlue3", text_color=("Black"),command= lambda : self.busquedaInformadaAgenda(self.entry_agenda.get()))
        self.busqueda_agenda.grid(row=3, column=3, padx=(20, 20), pady=(20, 20), sticky="e")

And what I am trying to do is this:

self.entry_nombre = customtkinter.CTkEntry(master=self, placeholder_text="Nombre...", height=30 ).grid(row=0, column=1, columnspan=2, padx=(20, 0), pady=(20, 20), sticky="we")
        self.entry_tema = customtkinter.CTkEntry(master=self, placeholder_text="Tema...", width=300, height=30 ).grid(row=1, column=1, columnspan=2, padx=(20, 0), pady=(20, 20), sticky="we")
        self.entry_contacto = customtkinter.CTkEntry(master=self, placeholder_text="Contacto...", width=300, height=30 ).grid(row=2, column=1, columnspan=2, padx=(20, 0), pady=(20, 20), sticky="we")
        self.entry_tlfn = customtkinter.CTkEntry(master=self, placeholder_text="Tlfn...", width=300, height=30 ).grid(row=3, column=1, columnspan=1, padx=(20, 0), pady=(20, 20), sticky="w")
        self.entry_tlfn2 = customtkinter.CTkEntry(master=self, placeholder_text="Tlfn 2...", width=300, height=30 ).grid(row=4, column=1, columnspan=1, padx=(20, 0), pady=(20, 20), sticky="w")
        self.entry_tlfn3 = customtkinter.CTkEntry(master=self, placeholder_text="Tlfn 3...", width=300, height=30 ).grid(row=5, column=1, columnspan=1, padx=(20, 0), pady=(20, 20), sticky="w")
        self.entry_fax = customtkinter.CTkEntry(master=self, placeholder_text="Fax...", width=300, height=30 ).grid(row=3, column=3, columnspan=1, padx=(0, 0), pady=(20, 20), sticky="w")
        self.entry_email = customtkinter.CTkEntry(master=self, placeholder_text="Email...", width=300, height=30 ).grid(row=4, column=3, columnspan=2, padx=(0, 0), pady=(20, 20), sticky="w")
        self.entry_web = customtkinter.CTkEntry(master=self, placeholder_text="Web...", width=300, height=30 ).grid(row=5, column=3 , columnspan=2, padx=(0, 0), pady=(20, 20), sticky="w")
        self.entry_movil = customtkinter.CTkEntry(master=self, placeholder_text="Movil...", height=30 ).grid(row=6, column=1, columnspan=2, padx=(20, 0), pady=(20, 20), sticky="we")
        self.entry_movil2 = customtkinter.CTkEntry(master=self, placeholder_text="Movil 2...", height=30 ).grid(row=7, column=1, columnspan=2, padx=(20, 0), pady=(20, 20), sticky="we")
        self.entry_movil3 = customtkinter.CTkEntry(master=self, placeholder_text="Movil 3...", height=30 ).grid(row=8, column=1, columnspan=2, padx=(20, 0), pady=(20, 20), sticky="we")
        self.entry_observaciones = customtkinter.CTkTextbox(master=self, border_width=2, ).grid(row=9, column=1, columnspan=3, padx=(20, 60), pady=(20, 20), sticky="we")

        self.alta_agenda = customtkinter.CTkButton(master=self, text="Confirmar", fg_color="LightSteelBlue2",
                                                   hover_color="LightSteelBlue3", text_color=("Black"),
                                                   command=lambda: self.darAlta()).grid(row=10, columnspan=4, sticky='n', pady=(0,20))
    def darAlta(self):
        cur = self.connection.cursor()
        print(self.entry_contacto.get())
        sql = 'INSERT INTO agenda_telefonica VALUES ('+ self.entry_nombre.get()+''+ self.entry_tema.get()+''+ self.entry_contacto.get()+''+ self.entry_tlfn.get()+''+ self.entry_tlfn2.get()+''+ self.entry_tlfn3.get()+''+ self.entry_fax.get()+''+ self.entry_email.get()+''+ self.entry_web.get()+''+ self.entry_movil.get()+''+ self.entry_movil2.get()+''+ self.entry_movil3.get()+''+ self.entry_observaciones.get()+')'
        cur.execute(sql)
        cur.close()

PS: I didn't check if the SQL sentence is correct, right now i am trying to use the entry value which i cannot access.


问:
Blazor(Wasm) RDLC Report runs under Net3.1, Net5, but gets permission exception under Net6
I am following the instructions on this video: (https://www.youtube.com/watch?v=7V0Yb5drLgQ/)

It runs under .Net Core 3.1, .Net Core 5.0 perpectly.

but under NET6.0, it raises an exception:

System.IO.FileNotFoundException: "Could not load file or assembly 'System.Security.Permissions, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. Das System kann die angegebene Datei nicht finden."

by code line:

```<code>LocalReport localReport = new LocalReport(path);
</code>```

where path = $"{_webHostEnvironment.WebRootPath}\Reports\Report1.rdlc"

How to grant the Permissions of the path ...\wwwroot\Reports\ for LocalReport

Body:
I am following the instructions on this video: (https://www.youtube.com/watch?v=7V0Yb5drLgQ/)

It runs under .Net Core 3.1, .Net Core 5.0 perpectly.

but under NET6.0, it raises an exception:

System.IO.FileNotFoundException: "Could not load file or assembly 'System.Security.Permissions, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. Das System kann die angegebene Datei nicht finden."

by code line:

LocalReport localReport = new LocalReport(path);

where path = $"{_webHostEnvironment.WebRootPath}\Reports\Report1.rdlc"

How to grant the Permissions of the path ...\wwwroot\Reports\ for LocalReport


问:
Save file from the Azure AVD webclient to local machine
I have access to avd using webclient. When I open excel file and try to save it into my local machine I get an error and an empty tmp file is downloaded instead of the excel file.

When I copy an excel file to the download folder, it get it correctly. However not all users have access to windows desktop. So they can not copy to the download folder.

I used a Microsoft Remote desktop to do the same work and it works correctly when saving excel file.

Is it a limitation on when using web client or I missed a config on my browser?


问:
Symfony ParameterBagInterface not working in phpunit
I use ParameterBagInterface in my service and this is code:

private function getConfigs(): array { return (array)$this->params->get($this->config); }

now when I create unit test for this function  , return is empty array but I have content in services.yml in parameters

test: { url: 'hello test' }

parameterBagInterface not working in phpunit


问:
Could not convert string to float: '77\xa0°'
```<code>meteo_df = data_frame.copy()

#=======================================================  Drop useless columns
meteo_df.drop(['CONDITION'], axis=1, inplace=True)

#=======================================================  Map Wind to degrees on a circle
wdict = dict({"E": 0., "ENE": np.pi/8, "NE": np.pi/4, "NNE": 3*np.pi/8, "N": np.pi/2,
               "NNW": 5*np.pi/8, "NW": 3*np.pi/4, "WNW": 7*np.pi/8, "W": np.pi,
               "WSW": 9*np.pi/8, "SW": 5*np.pi/4, "SSW": 11*np.pi/8, "S": 3*np.pi/2,
               "SSE": 13*np.pi/8, "SE": 7*np.pi/4, "ESE": 15*np.pi/8})

meteo_df.WIND = meteo_df.WIND.apply(lambda x : (wdict[x] if type(x)==str else x))
meteo_df.WIND = meteo_df.WIND.fillna(method='ffill')

#=======================================================  Reformat values by dropping units
cols = meteo_df.select_dtypes(include=['object']).columns
meteo_df[cols] = meteo_df[cols].apply(lambda x : x.str.replace(r"[a-zA-Z\%\/²]",'').astype('float'))

meteo_df.head()
</code>```

csv file
xlsx file

The error occurred "ValueError: could not convert string to float: '77\xa0°'" when I tried to run the code.  code

Body:
meteo_df = data_frame.copy()

#=======================================================  Drop useless columns
meteo_df.drop(['CONDITION'], axis=1, inplace=True)

#=======================================================  Map Wind to degrees on a circle
wdict = dict({"E": 0., "ENE": np.pi/8, "NE": np.pi/4, "NNE": 3*np.pi/8, "N": np.pi/2,
               "NNW": 5*np.pi/8, "NW": 3*np.pi/4, "WNW": 7*np.pi/8, "W": np.pi,
               "WSW": 9*np.pi/8, "SW": 5*np.pi/4, "SSW": 11*np.pi/8, "S": 3*np.pi/2,
               "SSE": 13*np.pi/8, "SE": 7*np.pi/4, "ESE": 15*np.pi/8})

meteo_df.WIND = meteo_df.WIND.apply(lambda x : (wdict[x] if type(x)==str else x))
meteo_df.WIND = meteo_df.WIND.fillna(method='ffill')

#=======================================================  Reformat values by dropping units
cols = meteo_df.select_dtypes(include=['object']).columns
meteo_df[cols] = meteo_df[cols].apply(lambda x : x.str.replace(r"[a-zA-Z\%\/²]",'').astype('float'))

meteo_df.head()

csv file
xlsx file

The error occurred "ValueError: could not convert string to float: '77\xa0°'" when I tried to run the code.  code


问:
Is Cloudflare enough to make Express.js app resistant against Bots?
I'm using Cloudflare to do so. Is it necessary to add a Google Recaptcha to the login page?

Also, does Helmet interfere with Cloudflare's Bot Fight Mode?

I noticed when I refresh my every Express app page, in the browser console, there's a warning related to Cloudflare:

Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'self'. Either the 'unsafe-inline' keyword, ...

In front-end, execution of: