typescript – Unable to get the return value of the asynchronous function, the wait does not work as expected (API View Service)

I'm trying to create a service to communicate with my API. I do not know async / wait very well, but I am faced with the following problem and, from what I read in the documentation, it does not make much sense.

If I try to use wait to get the result of an asynchronous function (UserAuthService.login), this gives me an error by saying:
"Expression" wait "is allowed only in an asynchronous function"

The error occurs in the Login component when I try to get the result. The "login" function works correctly if the connection function is an asynchronous function. Why is this error displayed? How can I get the result of the async function?

auth_user_service.ts:

const UserAuthService = {
  /**
     * Login the user and store the access token to TokenService.
     *
     * @returns success
     * @throws AuthenticationError
    **/
  login: async function (email: string, password: string): Promise {
    const requestData = {
      method: 'POST',
      url: 'auth/token/',
      header: {
        'X-Requested-With': 'XMLHttpRequest',
        'Content-Type': 'application/json;charset=UTF-8',
        //'Access-Control-Allow-Origin': '*'
      },
      data: {
        client_id: process.env.VUE_APP_APPLICATION_CLIENT_ID,
        client_secret: process.env.VUE_APP_APPLICATION_SECRET,
        grant_type: 'password',
        username: email,
        password: password,
        scope: 'read write'
      }
    }

    try {
      const response = await ApiService.customRequest(requestData) // just return axios(data);


      if (response.status == 200) {
        return true;
      } else {
        return false;
      }

    } catch (error) {
      return false;
    }
  },
}

Login.vue:



tsconfig.json

{
  "compilerOptions": {
    "target": "esnext",
    "module": "esnext",
    "strict": false,
    "jsx": "preserve",
    "importHelpers": true,
    "moduleResolution": "node",
    "experimentalDecorators": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "sourceMap": true,
    "baseUrl": ".",
    "typeRoots": (
      "node_modules/@types",
      "src/types"
    ),
    "types": (
      "webpack-env",
      "jest",
      "vuetify"
    ),
    "paths": {
      "@/*": (
        "src/*"
      )
    },
    "lib": (
      "esnext",
      "dom",
      "dom.iterable",
      "scripthost"
    )
  },
  "include": (
    "src/**/*.ts",
    "src/**/*.tsx",
    "src/**/*.vue",
    "tests/**/*.ts",
    "tests/**/*.tsx"
  ),
  "exclude": (
    "node_modules"
  )
}

c ++ – Unable to replicate code with the same logic

The code that gets the good value (percentage of utility)

#include 
#include 

using namespace std;

const int N = 50;

// Geografines platumos koordinates
double lat(N) = { 54.683,  54.9,    55.717,  54.95,   55.733,  54.4,    54.517,  55.4,    55.083,  55.5,
                  55.283,  55.983,  55.6,    55.25,   55.25,   55.917,  55.883,  55.35,   55.483,  55.917,
                  55.717,  54.017,  54.411,  55.967,  56.2,    54.767,  54.817,  56,      55.067,  54.65,
                  55.367,  55.533,  54.65,   54.683,  56.317,  54.633,  54.395,  55.067,  55.633,  54.217,
                  54.867,  56.067,  55.833,  55.733,  56.267,  55.233,  54.45,   55.05,   54.3,    54.893 };

// Geografines ilgumos koordinates
double lon(N) = { 25.317,  23.9,    21.117,  25.067,  24.35,   24.05,   25.317,  24.7,    24.283,  25.6,
                  23.967,  22.25,   26.417,  22.283,  24.75,   21.85,   21.25,   21.483,  24.15,   21.05,
                  21.4,    23.967,  24.018,  25.583,  24.75,   24.633,  23.867,  22.933,  22.767,  23.033,
                  23.117,  25.1,    25.05,   25.083,  22.9,    23.95,   23.997,  25.65,   22.933,  24.567,
                  24.45,   24.4,    24.967,  26.25,   21.533,  25.417,  23.294,  24.95,   25.383,  23.917 };

// Populiacijos (gyventoju skaicius)
int pop(N) = { 543071,  336817,  177823,  120934,  109034,  63651,   44910,   38840,   33178,   31142,
                  29850,   29119,   26805,   26444,   25886,   22311,   20776,   19751,   18453,   17244,
                  16314,   15547,   14960,   14947,   13780,   13248,   12938,   12721,   12510,   12483,
                  11644,   11400,   11277,   11121,   10733,   10489,   10489,   10312,   9984,    9771,
                  9395,    7997,    7833,    7349,    6920,    6771,    6658,    6654,    6402,    6330 };

// Rinkoje esanciu objektu vietu indeksai
const int nP = 5;
int P(nP) = { 0, 1, 2, 3, 4 };

// Nauji objektai
const int nX = 3;
int X(nX) = { 5, 6, 7 };

//Kiekvieno miesto platumos ir ilgumos koordinaciu masyvas
double xy(N)(2);

//Kiekvieno miesto artimiausias jau rinkoje esantis objektas ir artimiausias iš naujai planuojamų statyti objektų.
int ae(N); //artimiausias esantis
int ap(N); //artimiausias planuojamas

int visi = 0;

template 
void PrintArray(T M)
{
    for (int i = 0; i < N; i++)
        cout << M(i) << "t";
    cout << endl;
}

double HaversineDistance(double* a, double* b)
{
    double dlon = fabs(a(0) - b(0));
    double dlat = fabs(a(1) - b(1));
    double aa = pow((sin((double)dlon / (double)2 * 0.01745)), 2) + cos(a(0) * 0.01745) * cos(b(0) * 0.01745) * pow((sin((double)dlat / (double)2 * 0.01745)), 2);
    double c = 2 * atan2(sqrt(aa), sqrt(1 - aa));
    double d = 6371 * c;
    return d;
}

double Utility(int X)
{
    double procentai;
    for (int i = 0; i < N; i++)
    {
        visi += pop(i);
    }
    procentai = ((double)X / visi) * 100;
    return procentai;
    /* Skaičiuoja ir grąžina kiek procentų klientų tenka naujiems objektams,
       kurių vietovės (indeksai duomenų masyve) aprašytos masyve X */
}

int main()
{
    int klientai = 0;
    PrintArray(lat);
    PrintArray(lon);
    PrintArray(pop);
    for (int i = 0; i < N; i++)
    {
        xy(i)(0) = lat(i);
        xy(i)(1) = lon(i);
    }

    for (int i = 0; i < N; i++)
    {
        double minn = INT_MAX;    //minimum reiksme
        for (int j = 0; j < nP; j++)
        {
            if (HaversineDistance(xy(i), xy(j)) < minn)
            {
                minn = HaversineDistance(xy(i), xy(j));
                ae(i) = j;
            }
        }
    }
    for (int i = 0; i < N; i++)
    {
        double minn = INT_MAX;    //minimum reiksme
        for (int j = nP; j < nP + nX; j++)
            if (HaversineDistance(xy(i), xy(j)) < minn)
            {
                minn = HaversineDistance(xy(i), xy(j));
                ap(i) = j;
            }
    }
    for (int i = 0; i < N; i++)
    {
        if (HaversineDistance(xy(i), xy(ap(i))) < HaversineDistance(xy(i), xy(ae(i))))
        {
            klientai += pop(i);
            std::cout << "n" << i << std::endl;
        }
        else if (HaversineDistance(xy(i), xy(ap(i))) == HaversineDistance(xy(i), xy(ae(i))))
        {
            klientai += (double)1 / 3 * pop(i);
        }

    }
    cout << Utility(klientai);

    /* Naudodami funkciją PrintArray atspausdinkite visus tris aukščiau nurodytus masyvus.
    Paskaičiuokite Utility funkcijos reikšmę. Kai P = {0, 1, 2, 3, 4}, X = {5, 6, 7}, Utility(X) turi būti 15.7809. */

    return 0;
}

And my code that gives an incorrect result of a few% ...

  #include 
#include 
#include 

using namespace std;

const int N = 50;

// Geografines platumos koordinates
double lat(N) = { 54.683,  54.9,    55.717,  54.95,   55.733,  54.4,    54.517,  55.4,    55.083,  55.5,
                  55.283,  55.983,  55.6,    55.25,   55.25,   55.917,  55.883,  55.35,   55.483,  55.917,
                  55.717,  54.017,  54.411,  55.967,  56.2,    54.767,  54.817,  56,      55.067,  54.65,
                  55.367,  55.533,  54.65,   54.683,  56.317,  54.633,  54.395,  55.067,  55.633,  54.217,
                  54.867,  56.067,  55.833,  55.733,  56.267,  55.233,  54.45,   55.05,   54.3,    54.893 };

// Geografines ilgumos koordinates
double lon(N) = { 25.317,  23.9,    21.117,  25.067,  24.35,   24.05,   25.317,  24.7,    24.283,  25.6,
                  23.967,  22.25,   26.417,  22.283,  24.75,   21.85,   21.25,   21.483,  24.15,   21.05,
                  21.4,    23.967,  24.018,  25.583,  24.75,   24.633,  23.867,  22.933,  22.767,  23.033,
                  23.117,  25.1,    25.05,   25.083,  22.9,    23.95,   23.997,  25.65,   22.933,  24.567,
                  24.45,   24.4,    24.967,  26.25,   21.533,  25.417,  23.294,  24.95,   25.383,  23.917 };

// Populiacijos (gyventoju skaicius)
int pop(N) = { 543071,  336817,  177823,  120934,  109034,  63651,   44910,   38840,   33178,   31142,
                  29850,   29119,   26805,   26444,   25886,   22311,   20776,   19751,   18453,   17244,
                  16314,   15547,   14960,   14947,   13780,   13248,   12938,   12721,   12510,   12483,
                  11644,   11400,   11277,   11121,   10733,   10489,   10489,   10312,   9984,    9771,
                  9395,    7997,    7833,    7349,    6920,    6771,    6658,    6654,    6402,    6330 };

// Rinkoje esanciu objektu vietu indeksai
const int nP = 5;
int P(nP) = { 0, 1, 2, 3, 4 };

//Nauji objektai
const int nX = 3;



double getDistance(double alon, double blon, double alat, double blat) {
    double dlon = fabs(alon - blon);
    double dlat = fabs(alat - blat);
    double aa = pow((sin((double)dlon / (double)2 * 0.01745)), 2) + cos(alon * 0.01745) * cos(blon * 0.01745) * pow((sin((double)dlat / (double)2 * 0.01745)), 2);
    double c = 2 * atan2(sqrt(aa), sqrt(1 - aa));
    double d = 6371 * c;
    return d;
}

template 
void PrintArray(T array) {
    std::cout << '(';
    for (int i = 0; i < N; ++i)
    {
        std::cout << array(i);
        if (i + 1 != N)
            std::cout << ", ";
    }
    std::cout << ')' << "nn";
}

double Utility(int* X) {

    int population = std::accumulate(pop, pop + N, 0);
    double attracted = 0;


    for (int i = 0; i < N; ++i) //Loop through coords
    {
        double closestNew = INT_MAX, closestOld = INT_MAX;
        for (int j = 0; j < nX; ++j) //Loop through new objects
        {
            double newDistance = getDistance(lon(X(j)), lon(i), lat(X(j)), lat(i));
            if (newDistance < closestNew)
            {
                closestNew = newDistance;
            }
        }
        for (int b = 0; b < nP; ++b) //Loop through old objects
        {
            double oldDistance = getDistance(lon(P(b)), lon(i), lat(P(b)), lat(i));
            if (oldDistance < closestOld) {
                closestOld = oldDistance;
            }
        }
        if (closestNew < closestOld)
        {
            std::cout << "n" << i << std::endl;
            attracted += pop(i); //One that's closest gets all the population
        }

        else if (closestNew == closestOld)
        {
            attracted += pop(i) / 3.0;
        }

    }
    return attracted / population * 100;
    /* Skaičiuoja ir grąžina kiek procentų klientų tenka naujiems objektams,
       kurių vietovės (indeksai duomenų masyve) aprašytos masyve X */
}

int main() {

    // Nauji objektai
    int X(nX) = { 5, 6, 7 };

    PrintArray(lat);
    PrintArray(lon);
    PrintArray(pop);
    std::cout << "Utility: " << Utility(X) << std::endl;
    //Paskaičiuokite Utility funkcijos reikšmę. Kai P = {0, 1, 2, 3, 4}, X = {5, 6, 7}, Utility(X) turi būti 15.7809.

    return 0;
}

I can not understand that and your help would be really appreciated! I guess I'm comparing the wrong distances because my attracted number is lower, but again, I do not know how to know it.

16.04 – Unable to locate flameshot package

I tried to install Flameshot but an error occurred stating that it was impossible to locate the flameshot package

(base) kong:~$ sudo apt install flameshot
(sudo) password for kong: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package flameshot

I'm using ubuntu
version 16.04

(base) kong:~$ lsb_release -a
LSB Version:    core-9.20160110ubuntu0.2-amd64:core-9.20160110ubuntu0.2-noarch:printing-9.20160110ubuntu0.2-amd64:printing-9.20160110ubuntu0.2-noarch:security-9.20160110ubuntu0.2-amd64:security-9.20160110ubuntu0.2-noarch
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.6 LTS
Release:    16.04
Codename:   xenial

magento2 – Unable to retrieve data from a form UI component to the controller in Magento 2

I create a form ui component and a controller backup, but I can not get data on the controller. I have tried this code, but it does not display error and does not recover data.

$data = $this->getRequest()->getParam();

This shows that this page does not work, but if I echo 1; exit; he shows 1.

2010 – Calculated field SharePoint Unable to update the value of all items in the large list

So that's the problem:

I have a list with about 1 million records

I added a calculated column, with a very simple formula:

"0" + (textfield)

and return it as a number

The request returned an update conflict error, but when I looked at the list, I found that the items were updated from oldest to newest with the new calculated field value. . but some time later, it stopped leaving more than half of the elements without getting their calculated value, which returns them in the form -4XXXXXXX (I think it means a null number)

I checked the logs and discovered that for 3 hours every 20 seconds, the SUL continued to log the following error:

A large block of literal text has been sent to SQL. This can lead to SQL blocking and excessive memory usage on the front end. Verify that no binary parameter is passed as literal and consider splitting batches into smaller components. If this request is for a SharePoint list or list item, you may be able to resolve this issue by reducing the number of fields.

And then finally a query timeout error log having the same correlation ID as the previous error

Is there a sure way to add this calculated field?

Do I need to increase a timeout variable to give the calculated field enough time to calculate all the elements?

How can I recalculate the remaining fields without affecting the modification date and modification date of the elements?

Thank you!

Unable to change the screen resolution after trying to overclock the nvidia 1050ti graphics

I was trying to overclock my nvidia 1050ti graphics card but I was not able to.
After restarting my computer, the resolution of my screen is completely wrong, all the icons and the slider are really big and I can not change the new driver into nvidia driver.
Picture

I am also unable to change the screen resolution with the settings

-Ubuntu 18.04

-Nvidia 1050ti

-Amd ryzen 1600

Azure – Windows Server Failover Cluster – Unable to Connect to Cluster Name

In our environment, we have some Windows Server failover clusters hosted in Azure. I have a problem that I can not find information on.

In the current state of things, the clusters are working properly, except that we can not connect to the cluster name (via PSRemoting, Failover Cluster Manager, etc.). I am aware that these names are not designed to be pingable but must be available for management. The result is a situation in which the only way to manage the cluster is to know the node names and connect directly to one of them.

We probably have more than 40 clusters in our environment, with only 4 in Azure. Azure clusters are the only ones to have this problem, and all have this problem, so this is a common denominator.

I'm sure the configuration has not been finalized, but I do not know enough about the Azure architecture to understand the problem and what needs to be fixed. The closest thing I've found is on the clusteringformeremortals website, which indicates a possible need for load balancers; but this is specific to SQL clusters (our SQL cluster listeners work well).

This problem adds management overhead and leads to complications for automation.
Any help on this would be fantastic.

applications – Unable to uninstall Kingroot in SONY Xperia E3

I own a SONY XPERIA E3. Yesterday I installed Kingroot. But now, I can not delete it when I go into Kingroot> General Settings> and uninstall Kingroot. This shows the error:

Sorry, the deletion failed. Thank you for sharing your comments and doing our best to solve the problem.

Can you provide a solution to solve my problem?

itunes – Unable to unmount an external drive used with the Music application due to the AMPLibraryAgent process

I'm using an external storage drive for my music library in macOS 10.15 Catalina because the required file size is several times that of my internal SSD. After upgrading to Catalina, when I connect the player to use Music, I can not eject the player later because of the player lock. AMPLibraryAgent process. Here is the exit of the terminal detailing the problem:

diskutil unmountdisk /dev/disk2
Unmount of disk2 failed: at least one volume could not be unmounted
Unmount was dissented by PID 710 (/System/Library/PrivateFrameworks/AMPLibrary.framework/Versions/A/Support/AMPLibraryAgent)
Dissenter parent PPID 1 (/sbin/launchd)

How can I remove this lock without leaving the service process or turning off my computer?

docker – Unable to access the .jar file when starting the container due to an authorization error

I've got the following Docker file, and I'm basically trying to make sure my image is running as NonRoot but unable to resolve the error of permissions.
How can I make sure that I can run this container without root permissions?

I've tried to add the chmod + x RUN line as shown below, but that made no difference

FROM openjdk:8-jre
COPY . /app
EXPOSE 8079
WORKDIR /app
RUN addgroup --gid 2000 tester && adduser --uid 2000 --no-create-home --gid 2000 tester
COPY --chown=tester Dockerfile enrichment-service*.jar /app/testing-service*.jar . 
#RUN ["chmod", "+x", "/app/testing-service*.jar"]
ENV JVM_OPTS "-Xms1g -Xmx1g"
CMD exec java -XX:+UseConcMarkSweepGC -verbosegc -XX:NewRatio=2 -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/app/heapdump $JVM_OPTS -jar /app/testing-service*.jar

Everything works fine if I delete the addgroup / adduser line from this fixed menu file.