问:
using two consecutive values from a list in each iteration
I have posted a part of my code below. Newton() function calls Bezier() function. The Bezier() function has a list from where I get p0 and p3. What I am trying to do is, in 1st iteration the program should take the first and second items from the plist as p0 and p3. Then in 2nd iteration, p0 and p3 are the second and third items and so on. With each iteration, the p0 and p3 values should change. It's like the new p0 is the old p3. I could not put this in the code properly. Thank you.  </p>

```<code>import math

w = 1.0

def Newton(poly):
    """ Returns a root of the polynomial"""
    x = 0.5  # initial guess value
    counter = 0
    epsilon = 0.000000000001
    poly_diff = poly_differentiate(poly)

    while True:
        x_n = x - (float(poly_substitute(poly, x)) / float(poly_substitute(poly_diff, x)))
        counter += 1
        if abs(x_n - x) < epsilon :
            break
        x = x_n
        print "\tIteration " , counter , " : ", x_n

    print "u: ", x_n
    Bezier(x_n)

def Bezier(x_n) :
    """ Calculating sampling points using rational bezier curve equation"""
    u = x_n
    plist = [0.5, 0.1, 0.4, 0.35, 0.8, 0.6, 1.0, 0.2, 0.7, 0.9] # list of parameter values of the phonemes

    for i in range(len(plist) - 1) :
        p0 = plist[i]
        p3 = plist[i + 1]
        p1 = p0
        p2 = p3
        print p0, p3
        p_u = math.pow(1 - u, 3) * p0 + 3 * u * math.pow(1 - u, 2) * p1 \
            + 3 * (1 - u) * math.pow(u, 2) * p2 + math.pow(u, 3) * p3
        p_u = p_u * w
        d = math.pow(1 - u, 3) * w + 3 * u * w * math.pow(1 - u, 2) + 3 * (1 - u) * w * math.pow(u, 2) + math.pow(u, 3) * w
        p_u = p_u / d

    print "p(u): ", p_u
    return plist

if __name__ == "__main__" :
</code>```

答:
The algorithm you are actually asking for is called sliding window which was present in itertools recipes, a while ago:

```<code>from itertools import islice

def window(seq, n=2):
    "Returns a sliding window (of width n) over data from the iterable"
    "   s -> (s0,s1,...s[n-1]), (s1,s2,...,sn), ...                   "
    it = iter(seq)
    result = tuple(islice(it, n))
    if len(result) == n:
        yield result
    for elem in it:
        result = result[1:] + (elem,)
        yield result
</code>```

Body:
I have posted a part of my code below. Newton() function calls Bezier() function. The Bezier() function has a list from where I get p0 and p3. What I am trying to do is, in 1st iteration the program should take the first and second items from the plist as p0 and p3. Then in 2nd iteration, p0 and p3 are the second and third items and so on. With each iteration, the p0 and p3 values should change. It's like the new p0 is the old p3. I could not put this in the code properly. Thank you.

import math

w = 1.0

def Newton(poly):
    """ Returns a root of the polynomial"""
    x = 0.5  # initial guess value
    counter = 0
    epsilon = 0.000000000001
    poly_diff = poly_differentiate(poly)

    while True:
        x_n = x - (float(poly_substitute(poly, x)) / float(poly_substitute(poly_diff, x)))
        counter += 1
        if abs(x_n - x) < epsilon :
            break
        x = x_n
        print "\tIteration " , counter , " : ", x_n

    print "u: ", x_n
    Bezier(x_n)

def Bezier(x_n) :
    """ Calculating sampling points using rational bezier curve equation"""
    u = x_n
    plist = [0.5, 0.1, 0.4, 0.35, 0.8, 0.6, 1.0, 0.2, 0.7, 0.9] # list of parameter values of the phonemes

    for i in range(len(plist) - 1) :
        p0 = plist[i]
        p3 = plist[i + 1]
        p1 = p0
        p2 = p3
        print p0, p3
        p_u = math.pow(1 - u, 3) * p0 + 3 * u * math.pow(1 - u, 2) * p1 \
            + 3 * (1 - u) * math.pow(u, 2) * p2 + math.pow(u, 3) * p3
        p_u = p_u * w
        d = math.pow(1 - u, 3) * w + 3 * u * w * math.pow(1 - u, 2) + 3 * (1 - u) * w * math.pow(u, 2) + math.pow(u, 3) * w
        p_u = p_u / d

    print "p(u): ", p_u
    return plist

if __name__ == "__main__" :

Body:
The algorithm you are actually asking for is called sliding window which was present in itertools recipes, a while ago:

from itertools import islice

def window(seq, n=2):
    "Returns a sliding window (of width n) over data from the iterable"
    "   s -> (s0,s1,...s[n-1]), (s1,s2,...,sn), ...                   "
    it = iter(seq)
    result = tuple(islice(it, n))
    if len(result) == n:
        yield result
    for elem in it:
        result = result[1:] + (elem,)
        yield result


来源: stackexchange

问:
Google Drive API can't set permissions with reusable upload
When I did a basic file upload & set the permission like so, it worked great:

```<code>$file = $service->files->create($fileMetadata, array(
    'data' => $content,
    'mimeType' => $mimeType,
    'uploadType' => 'multipart',
    'fields' => 'id'));

$permissions = new Google_Service_Drive_Permission(array(
    "role" => "reader",
    "type" => "anyone",
));

$setPermission = $service->permissions->create($file->id, $permissions);
</code>```

But when I upload a large file that's split into chunks & use the resumable uploadType, the permissions aren't set on the file & I don't get any errors:

```<code>$service = new Google_Service_Drive($client);

$file = new Google_Service_Drive_DriveFile();
$file->title = $fileName;
$file->name = $fileName;

$chunkSizeBytes = 1 * 1024 * 1024;
$mimeType = mime_content_type($fullpath);

// Call the API with the media upload, defer so it doesn't immediately return.
$client->setDefer(true);
$request = $service->files->create($file);

// Create a media file upload to represent our upload process.
$media = new Google_Http_MediaFileUpload(
    $client,
    $request,
    $mimeType,
    null,
    true,
    $chunkSizeBytes
);
$media->setFileSize(filesize($fullpath));

// Upload the various chunks. $status will be false until the process is complete.
$status = false;
$handle = fopen($fullpath, "rb");
while (!$status && !feof($handle)) {
    $chunk = fread($handle, $chunkSizeBytes);
    $status = $media->nextChunk($chunk);
}

// The final value of $status will be the data from the API for the object that has been uploaded.
$result = false;
if($status != false) {
    $result = $status;
    error_log($result->id);
}

fclose($handle);

$permissions = new Google_Service_Drive_Permission(array(
    "role" => "reader",
    "type" => "anyone"
));

$setPermission = $service->permissions->create($result->id, $permissions);
</code>```

Any suggestions on what I'm doing wrong?

答:
$client->setDefer(true); is causing the issue. That's why it works when you create a new instance of Google client.

Another fix might be to do $client->setDefer(false); after uploading the file.

ContentLicense: CC BY-SA 4.0

Body:
When I did a basic file upload & set the permission like so, it worked great:

$file = $service->files->create($fileMetadata, array(
    'data' => $content,
    'mimeType' => $mimeType,
    'uploadType' => 'multipart',
    'fields' => 'id'));

$permissions = new Google_Service_Drive_Permission(array(
    "role" => "reader",
    "type" => "anyone",
));

$setPermission = $service->permissions->create($file->id, $permissions);

But when I upload a large file that's split into chunks & use the resumable uploadType, the permissions aren't set on the file & I don't get any errors:

$service = new Google_Service_Drive($client);

$file = new Google_Service_Drive_DriveFile();
$file->title = $fileName;
$file->name = $fileName;

$chunkSizeBytes = 1 * 1024 * 1024;
$mimeType = mime_content_type($fullpath);

// Call the API with the media upload, defer so it doesn't immediately return.
$client->setDefer(true);
$request = $service->files->create($file);

// Create a media file upload to represent our upload process.
$media = new Google_Http_MediaFileUpload(
    $client,
    $request,
    $mimeType,
    null,
    true,
    $chunkSizeBytes
);
$media->setFileSize(filesize($fullpath));

// Upload the various chunks. $status will be false until the process is complete.
$status = false;
$handle = fopen($fullpath, "rb");
while (!$status && !feof($handle)) {
    $chunk = fread($handle, $chunkSizeBytes);
    $status = $media->nextChunk($chunk);
}

// The final value of $status will be the data from the API for the object that has been uploaded.
$result = false;
if($status != false) {
    $result = $status;
    error_log($result->id);
}

fclose($handle);

$permissions = new Google_Service_Drive_Permission(array(
    "role" => "reader",
    "type" => "anyone"
));

$setPermission = $service->permissions->create($result->id, $permissions);

Any suggestions on what I'm doing wrong?


问:
Update a table using JPA in Play Framework
I'm trying to update a table using JPA

```<code>EntityManager em=JPA.em();
EntityTransaction entr = em.getTransaction();
try{
if(!entr.isActive())
  entr.begin();
  Tblrecordtypefields updateTblrecordtypes = em.find(Tblrecordtypefields.class,9);
  updateTblrecordtypes.setFieldlabel("JPATest");
  em.getTransaction().commit();
}finally
{
if(entr.isActive())
entr.rollback();
}
</code>```

i'm getting the error
NullPointerException occured : null at
updateTblrecordtypes.setFieldlabel("JPATest");
What should i do.

答:
This means that there is no row with ID 9 in the database table mapped by the entity Tblrecordtypefields.

BTW: I find it very questionable to commit a transaction in a method which is not necessary the one that started the transaction.

ContentLicense: CC BY-SA 3.0

Body:
I'm trying to update a table using JPA

EntityManager em=JPA.em();
EntityTransaction entr = em.getTransaction();
try{
if(!entr.isActive())
  entr.begin();
  Tblrecordtypefields updateTblrecordtypes = em.find(Tblrecordtypefields.class,9);
  updateTblrecordtypes.setFieldlabel("JPATest");
  em.getTransaction().commit();
}finally
{
if(entr.isActive())
entr.rollback();
}

i'm getting the error
NullPointerException occured : null at
updateTblrecordtypes.setFieldlabel("JPATest");
What should i do.


问:
adding child nodes in treeview
I'm new to C# and don't have any programming experience. But I've finish a C# basics.
Now I would like to design a simple tree view by adding parent node and child node.

I would like to add a second child for the Second node, I'm quite stuck here and don't know what's next.

Any ideas?

Here is the code:

```<code>    private void addParentNode_Click(object sender, EventArgs e)
    {
        string yourParentNode;
        yourParentNode = textBox1.Text.Trim();
        treeView2.Nodes.Add(yourParentNode);
    }

    private void addChildNode_Click(object sender, EventArgs e)
    {
        string yourChildNode;
        yourChildNode = textBox1.Text.Trim();
        treeView2.Nodes[0].Nodes.Add(yourChildNode);
    }
</code>```

Sorry I wasn't clear, I'm not sure if I really need this one here:

```<code>  //treeView1.BeginUpdate();
  //treeView1.Nodes.Clear();
</code>```

What I'm trying to do, is to add Parent Nodes and child node. In my code, I can add several Parent Nodes, but if I want to add a child node, it only add in the first parent node.
I want that if I add a child node, I want to add it to the second parent or third parent.

In my code I only use one treeview here which names as treeview2
Here is the screenshot

this is how my final code looks like:
Before I put the else, I'm getting an error if I don't select anything. So I made it that way that if there is nothing selected it will add the "child node" to the "default node" or (parent1 node). It seems to work good. Thanks guys;-)

```<code>    //This is for adding a parent node
    private void addParentNode_Click(object sender, EventArgs e)
    {
        treeView2.BeginUpdate();

        string yourParentNode;
        yourParentNode = textBox1.Text.Trim();
        treeView2.Nodes.Add(yourParentNode);
        treeView2.EndUpdate();
    }

    //This is for adding child node
    private void addChildNode_Click(object sender, EventArgs e)
    {
        if (treeView2.SelectedNode != null)
        {
            string yourChildNode;
            yourChildNode = textBox1.Text.Trim();

            treeView2.SelectedNode.Nodes.Add(yourChildNode);
            treeView2.ExpandAll();
        }
        //This is for adding the child node to the default node(parent 1 node)
        else
        {
            string yourChildNode;
            yourChildNode = textBox1.Text.Trim();
            treeView2.Nodes[0].Nodes.Add(yourChildNode);
        }
</code>```

Additional question: Are there any other ways on how the code be better? Because here, I declare the string "yourChildNode" twice. One in the if and other one in the else, are there any simplification?

答:
```<code>void tree()
{
    int counter = 0;
    int counter1 = 0;
    int counter2 = 0;
    treeView1.Nodes.Clear();

    var node = db.ChartOfAccounts.
    Include(c => c.chartOfAccounts)
    .Where(c => c.parent_account == null).ToList();

    foreach (var account in node)
    {
               treeView1.Nodes.Add(account.account_title);

                 var node1 = db.ChartOfAccounts
                .Where(c => c.parent_account == account.c_id).ToList();
                 bool t1 = db.ChartOfAccounts.Any(c => c.parent_account == account.c_id);
                 if (!t1) { counter = counter + 1; }
                else
                 {
                    foreach (var item in node1)
                     { treeView1.Nodes[(counter)].Nodes.Add(item.account_title);

                          bool test1 = db.ChartOfAccounts
                          .Any(c => c.parent_account == item.c_id);
                          if (!test1) { counter1 = counter1 + 1; }
                          else {
                                      var node2 = db.ChartOfAccounts
                                  .Where(c => c.parent_account == item.c_id).ToList();

                                    foreach (var item2 in node2)
                                    {
                                        treeView1.Nodes[counter].Nodes[(counter1)].Nodes.Add(item2.account_title);

                                        bool test2 = db.ChartOfAccounts
                                        .Any(c => c.parent_account == item2.c_id);
                                        if (!test2) { counter2 = counter2 + 1; }
                                        else
                                        {
                                            var node3 = db.ChartOfAccounts
                                        .Where(c => c.parent_account == item2.c_id).ToList();

                                            foreach (var item3 in node3)
                                            { treeView1.Nodes[counter].Nodes[counter1].Nodes[counter2].Nodes.Add(item3.account_title); }
                                        }
                                    }
                                }
                     }
                    counter = counter + 1;
                 }
    }
}
</code>```

Title: adding child nodes in treeview

Body:
I'm new to C# and don't have any programming experience. But I've finish a C# basics.
Now I would like to design a simple tree view by adding parent node and child node.

I would like to add a second child for the Second node, I'm quite stuck here and don't know what's next.

Any ideas?

Here is the code:

    private void addParentNode_Click(object sender, EventArgs e)
    {
        string yourParentNode;
        yourParentNode = textBox1.Text.Trim();
        treeView2.Nodes.Add(yourParentNode);
    }

    private void addChildNode_Click(object sender, EventArgs e)
    {
        string yourChildNode;
        yourChildNode = textBox1.Text.Trim();
        treeView2.Nodes[0].Nodes.Add(yourChildNode);
    }

Sorry I wasn't clear, I'm not sure if I really need this one here:

  //treeView1.BeginUpdate();
  //treeView1.Nodes.Clear();

What I'm trying to do, is to add Parent Nodes and child node. In my code, I can add several Parent Nodes, but if I want to add a child node, it only add in the first parent node.
I want that if I add a child node, I want to add it to the second parent or third parent.

In my code I only use one treeview here which names as treeview2
Here is the screenshot

this is how my final code looks like:
Before I put the else, I'm getting an error if I don't select anything. So I made it that way that if there is nothing selected it will add the "child node" to the "default node" or (parent1 node). It seems to work good. Thanks guys;-)

    //This is for adding a parent node
    private void addParentNode_Click(object sender, EventArgs e)
    {
        treeView2.BeginUpdate();

        string yourParentNode;
        yourParentNode = textBox1.Text.Trim();
        treeView2.Nodes.Add(yourParentNode);
        treeView2.EndUpdate();
    }

    //This is for adding child node
    private void addChildNode_Click(object sender, EventArgs e)
    {
        if (treeView2.SelectedNode != null)
        {
            string yourChildNode;
            yourChildNode = textBox1.Text.Trim();

            treeView2.SelectedNode.Nodes.Add(yourChildNode);
            treeView2.ExpandAll();
        }
        //This is for adding the child node to the default node(parent 1 node)
        else
        {
            string yourChildNode;
            yourChildNode = textBox1.Text.Trim();
            treeView2.Nodes[0].Nodes.Add(yourChildNode);
        }

Additional question: Are there any other ways on how the code be better? Because here, I declare the string "yourChildNode" twice. One in the if and other one in the else, are there any simplification?


问:
Regex to find numbers in text that are encountered 3 or more times
I need an regex to find numbers that were encountered 3 or more times in text.

```<code>some text 577
some 123 text
577 some text
some 577 text
some text 512
</code>```

I need regex to match 577

My last try was: (?:\d+){3,}

Body:
I need an regex to find numbers that were encountered 3 or more times in text.

some text 577
some 123 text
577 some text
some 577 text
some text 512

I need regex to match 577

My last try was: (?:\d+){3,}

Body:
Use

\b([0-9]+)\b(?=(?:[\w\W]*?\b\1\b){2})

See regex proof.

EXPLANATION

--------------------------------------------------------------------------------
  \b                       the boundary between a word char (\w) and
                           something that is not a word char
--------------------------------------------------------------------------------
  (                        group and capture to \1:
--------------------------------------------------------------------------------
    [0-9]+                   any character of: '0' to '9' (1 or more
                             times (matching the most amount
                             possible))
--------------------------------------------------------------------------------
  )                        end of \1
--------------------------------------------------------------------------------
  \b                       the boundary between a word char (\w) and
                           something that is not a word char
--------------------------------------------------------------------------------
  (?=                      look ahead to see if there is:
--------------------------------------------------------------------------------
    (?:                      group, but do not capture (2 times):
--------------------------------------------------------------------------------
      [\w\W]*?                 any character of: word characters (a-
                               z, A-Z, 0-9, _), non-word characters
                               (all but a-z, A-Z, 0-9, _) (0 or more
                               times (matching the least amount
                               possible))
--------------------------------------------------------------------------------
      \b                       the boundary between a word char (\w)
                               and something that is not a word char
--------------------------------------------------------------------------------
      \1                       what was matched by capture \1
--------------------------------------------------------------------------------
      \b                       the boundary between a word char (\w)
                               and something that is not a word char
--------------------------------------------------------------------------------
    ){2}                     end of grouping
--------------------------------------------------------------------------------
  )                        end of look-ahead


问:
Can't figure out logic for this assignment
```<code>school_days = 15
classes_per_day = 5
total_classes = 75
for counter in range(school_days):
    total_classes = total_classes + classes_per_day

print(total_classes)
</code>```

Here are the instructions in the assignment:

Task - Change the values stored in the variables school_days, classes_per_day, and total_classes so that the loop calculates the classes for a student that has 15 school days left. The student has 5 classes per day. The final value of total classes should be 75.

Output: 75

I've been trying to figure this out for the last hour, and I don't know what I'm doing wrong.

答:
There is no syntax error (which is an error that forbids to run the code by the way) but nothing can happen with zeros

You may set 15 and 5 but not total_classes that will contain the result

```<code>school_days = 15
classes_per_day = 5
total_classes = 0
</code>```

Body:
school_days = 15
classes_per_day = 5
total_classes = 75
for counter in range(school_days):
    total_classes = total_classes + classes_per_day

print(total_classes)

Here are the instructions in the assignment:

Task - Change the values stored in the variables school_days, classes_per_day, and total_classes so that the loop calculates the classes for a student that has 15 school days left. The student has 5 classes per day. The final value of total classes should be 75.

Output: 75

I've been trying to figure this out for the last hour, and I don't know what I'm doing wrong.

Body:
There is no syntax error (which is an error that forbids to run the code by the way) but nothing can happen with zeros

You may set 15 and 5 but not total_classes that will contain the result

school_days = 15
classes_per_day = 5
total_classes = 0


问:
How do you add a header to an excel csv file using python
So I'm trying to add a header to a csv file dynamically. My current code looks like the following:

```<code>import csv
from datetime import datetime
import pandas as pd

rows = []

with open(r'Test_Timestamp.csv', 'r', newline='') as file:
    with open(r'Test_Timestamp_Result.csv', 'w', newline='') as file2:
        reader = csv.reader(file, delimiter=',')
        for row in reader:
            rows.append(row)
        file_write = csv.writer(file2)
        for val in rows:
            current_date_time = datetime.now().replace(hour=0, minute=0, second=0, microsecond=0)
            val.insert(0, current_date_time)
            file_write.writerow(val)

</code>```

Currently how this works is it inserts a new timestamp at column A which is exactly what I want it to do, as I want everything to be pushed as I'll be working with csv files with various different number of columns.
What I'm having trouble with is, how am I able to add a column header? Currently a timestamp is created next to the header. I would want to create a new header named: Execution_Date

I have looked at pandas as a solution but from the documentation I've seen the examples given looks like its a set of column headers already pre-determined. I've tried inserting a column header with df.insert(0, "Execution_Date", current_date_time) but gives me an error when trying to accomplish this.

I know I'm fairly close to doing this but I'm running into errors. Is there a way to do this dynamically so it automatically does this with various different csv files and number of different columns in each csv file, etc.? The current output looks like:

What I want the final result to look like is:

Any help with this would be greatly appreciated! I'm going to continue to see if I can solve this in the meantime, but I'm at a wall with how to proceed.

答:
If the end result is something that excel can read like maybe a csv you can likely bypass pandas altogether:

Edit: adding support for existing titles

Given a simple csv like:

```<code>Title,Other
Geeks1,foo
Geeks2,bar
</code>```

Then you might use:

import contextlib
import csv
from datetime import datetime

with contextlib.ExitStack() as stack:
    file_in = open('Test_Timestamp.csv', "r", encoding="utf-8")
    file_out = open('Test_Timestamp_Result.csv', "w", encoding="utf-8", newline="")

    reader = csv.reader(file_in, delimiter=',')
    writer = csv.writer(file_out)
    writer.writerow(["Execution_Date"] + next(reader))
    writer.writerows(
        [datetime.now().replace(hour=0, minute=0, second=0, microsecond=0)] + row
        for row in reader
    )
```
<p>to give you a file like:</p>
```Execution_Date,Title,Other
2022-02-11 00:00:00,Geeks1,foo
2022-02-11 00:00:00,Geeks2,bar
```

Body:
So I'm trying to add a header to a csv file dynamically. My current code looks like the following:

import csv
from datetime import datetime
import pandas as pd

rows = []

with open(r'Test_Timestamp.csv', 'r', newline='') as file:
    with open(r'Test_Timestamp_Result.csv', 'w', newline='') as file2:
        reader = csv.reader(file, delimiter=',')
        for row in reader:
            rows.append(row)
        file_write = csv.writer(file2)
        for val in rows:
            current_date_time = datetime.now().replace(hour=0, minute=0, second=0, microsecond=0)
            val.insert(0, current_date_time)
            file_write.writerow(val)

Currently how this works is it inserts a new timestamp at column A which is exactly what I want it to do, as I want everything to be pushed as I'll be working with csv files with various different number of columns.
What I'm having trouble with is, how am I able to add a column header? Currently a timestamp is created next to the header. I would want to create a new header named: Execution_Date

I have looked at pandas as a solution but from the documentation I've seen the examples given looks like its a set of column headers already pre-determined. I've tried inserting a column header with df.insert(0, "Execution_Date", current_date_time) but gives me an error when trying to accomplish this.

I know I'm fairly close to doing this but I'm running into errors. Is there a way to do this dynamically so it automatically does this with various different csv files and number of different columns in each csv file, etc.? The current output looks like:

What I want the final result to look like is:

Any help with this would be greatly appreciated! I'm going to continue to see if I can solve this in the meantime, but I'm at a wall with how to proceed.

Body:
If the end result is something that excel can read like maybe a csv you can likely bypass pandas altogether:

Edit: adding support for existing titles

Given a simple csv like:

Title,Other
Geeks1,foo
Geeks2,bar

Then you might use:

import contextlib
import csv
from datetime import datetime

with contextlib.ExitStack() as stack:
    file_in = open('Test_Timestamp.csv', "r", encoding="utf-8")
    file_out = open('Test_Timestamp_Result.csv', "w", encoding="utf-8", newline="")

    reader = csv.reader(file_in, delimiter=',')
    writer = csv.writer(file_out)
    writer.writerow(["Execution_Date"] + next(reader))
    writer.writerows(
        [datetime.now().replace(hour=0, minute=0, second=0, microsecond=0)] + row
        for row in reader
    )

to give you a file like:

Execution_Date,Title,Other
2022-02-11 00:00:00,Geeks1,foo
2022-02-11 00:00:00,Geeks2,bar


问:
Cannot find name 'AbortSignal' during npm run build
```<code>node_modules/axios/index.d.ts:93:12 - error TS2304: Cannot find name 'AbortSignal'.

93   signal?: AbortSignal;
              ~~~~~~~~~~~

Found 1 error.
</code>```

When trying npm run build comand for node typescript project, i am getting above error, something related to axio package. before axio usage, npm run build working fine.

答:
You could also add "skipLibCheck": true, to your tsconfig.json under compilerOptions.
This will ignore errors that are present in libs under node_modules

Body:
node_modules/axios/index.d.ts:93:12 - error TS2304: Cannot find name 'AbortSignal'.

93   signal?: AbortSignal;
              ~~~~~~~~~~~

Found 1 error.

When trying npm run build comand for node typescript project, i am getting above error, something related to axio package. before axio usage, npm run build working fine.


问:
SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 96 Current browser version is 98.0
Error tracelogs:

```<code>DevTools listening on ws://127.0.0.1:54791/devtools/browser/6f264bcc-d44a-40d9-b6cf-
8b1655c97ccd
Traceback (most recent call last):
File "c:\Users\alsgn\OneDrive\desktop\mypython\getselenium\dc\findbulletins.py", line 11, in
<module>
browser = webdriver.Chrome()
File "C:\Users\alsgn\AppData\Local\Programs\Python\Python39\lib\site-
packages\selenium\webdriver\chrome\webdriver.py", line 70, in __init__
super(WebDriver, self).__init__(DesiredCapabilities.CHROME['browserName'], "goog",
File "C:\Users\alsgn\AppData\Local\Programs\Python\Python39\lib\site-
packages\selenium\webdriver\chromium\webdriver.py", line 93, in __init__
RemoteWebDriver.__init__(
File "C:\Users\alsgn\AppData\Local\Programs\Python\Python39\lib\site-
packages\selenium\webdriver\remote\webdriver.py", line 268, in __init__
self.start_session(capabilities, browser_profile)
File "C:\Users\alsgn\AppData\Local\Programs\Python\Python39\lib\site-
packages\selenium\webdriver\remote\webdriver.py", line 359, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "C:\Users\alsgn\AppData\Local\Programs\Python\Python39\lib\site-
packages\selenium\webdriver\remote\webdriver.py", line 424, in execute
self.error_handler.check_response(response)
File "C:\Users\alsgn\AppData\Local\Programs\Python\Python39\lib\site-
packages\selenium\webdriver\remote\errorhandler.py", line 247, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This
version of ChromeDriver only supports Chrome version 96
Current browser version is 98.0.4758.82 with binary path C:\Program
Files\Google\Chrome\Application\chrome.exe
Stacktrace:
Backtrace:
    Ordinal0 [0x00FF6903+2517251]
    Ordinal0 [0x00F8F8E1+2095329]
    Ordinal0 [0x00E92848+1058888]
    Ordinal0 [0x00EB0B9D+1182621]
    Ordinal0 [0x00EACA60+1165920]
    Ordinal0 [0x00EAA2CF+1155791]
    Ordinal0 [0x00EDAAAF+1354415]
    Ordinal0 [0x00EDA71A+1353498]
    Ordinal0 [0x00ED639B+1336219]
    Ordinal0 [0x00EB27A7+1189799]
    Ordinal0 [0x00EB3609+1193481]
    GetHandleVerifier [0x01185904+1577972]
    GetHandleVerifier [0x01230B97+2279047]
    GetHandleVerifier [0x01086D09+534521]
    GetHandleVerifier [0x01085DB9+530601]
    Ordinal0 [0x00F94FF9+2117625]
    Ordinal0 [0x00F998A8+2136232]
    Ordinal0 [0x00F999E2+2136546]
    Ordinal0 [0x00FA3541+2176321]
    BaseThreadInitThunk [0x755AFA29+25]
    RtlGetAppContainerNamedObjectPath [0x775C7A9E+286]
    RtlGetAppContainerNamedObjectPath [0x775C7A6E+238]
</code>```

The code that I ran was okay in 2 days ago, but now, the code have been showed this error.
Please say how to solve this problem. I wonder why it ran well before.

答:
This error message...

```<code>selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 96
Current browser version is 98.0.4758.82 with binary path C:\Program Files\Google\Chrome\Application\chrome.exe
</code>```

...implies that the ChromeDriver was unable to initiate/spawn a new Browsing Context i.e. google-chrome session.

Your main issue is the incompatibility between the version of the binaries you are using as follows:

You are using chrome=98.0.4758.82

Release Notes of ChromeDriver v98.0.4758.80 clearly mentions the following :

Supports Chrome version 98

But you are using chromedriver=96.0

Release Notes of chromedriver=96.0.4664.45 clearly mentions the following :

Supports Chrome version 96

So there is a clear mismatch between chromedriver=96.0 and the chrome=96.0.4664.45

Solution

Ensure that:

ChromeDriver is updated to  current ChromeDriver v98.0.4758.80 level.

Chrome Browser is updated to  current chrome=98 (as per chromedriver=98.0.4758.80 release notes).

Body:
Error tracelogs:

DevTools listening on ws://127.0.0.1:54791/devtools/browser/6f264bcc-d44a-40d9-b6cf-
8b1655c97ccd
Traceback (most recent call last):
File "c:\Users\alsgn\OneDrive\desktop\mypython\getselenium\dc\findbulletins.py", line 11, in
<module>
browser = webdriver.Chrome()
File "C:\Users\alsgn\AppData\Local\Programs\Python\Python39\lib\site-
packages\selenium\webdriver\chrome\webdriver.py", line 70, in __init__
super(WebDriver, self).__init__(DesiredCapabilities.CHROME['browserName'], "goog",
File "C:\Users\alsgn\AppData\Local\Programs\Python\Python39\lib\site-
packages\selenium\webdriver\chromium\webdriver.py", line 93, in __init__
RemoteWebDriver.__init__(
File "C:\Users\alsgn\AppData\Local\Programs\Python\Python39\lib\site-
packages\selenium\webdriver\remote\webdriver.py", line 268, in __init__
self.start_session(capabilities, browser_profile)
File "C:\Users\alsgn\AppData\Local\Programs\Python\Python39\lib\site-
packages\selenium\webdriver\remote\webdriver.py", line 359, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "C:\Users\alsgn\AppData\Local\Programs\Python\Python39\lib\site-
packages\selenium\webdriver\remote\webdriver.py", line 424, in execute
self.error_handler.check_response(response)
File "C:\Users\alsgn\AppData\Local\Programs\Python\Python39\lib\site-
packages\selenium\webdriver\remote\errorhandler.py", line 247, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This
version of ChromeDriver only supports Chrome version 96
Current browser version is 98.0.4758.82 with binary path C:\Program
Files\Google\Chrome\Application\chrome.exe
Stacktrace:
Backtrace:
    Ordinal0 [0x00FF6903+2517251]
    Ordinal0 [0x00F8F8E1+2095329]
    Ordinal0 [0x00E92848+1058888]
    Ordinal0 [0x00EB0B9D+1182621]
    Ordinal0 [0x00EACA60+1165920]
    Ordinal0 [0x00EAA2CF+1155791]
    Ordinal0 [0x00EDAAAF+1354415]
    Ordinal0 [0x00EDA71A+1353498]
    Ordinal0 [0x00ED639B+1336219]
    Ordinal0 [0x00EB27A7+1189799]
    Ordinal0 [0x00EB3609+1193481]
    GetHandleVerifier [0x01185904+1577972]
    GetHandleVerifier [0x01230B97+2279047]
    GetHandleVerifier [0x01086D09+534521]
    GetHandleVerifier [0x01085DB9+530601]
    Ordinal0 [0x00F94FF9+2117625]
    Ordinal0 [0x00F998A8+2136232]
    Ordinal0 [0x00F999E2+2136546]
    Ordinal0 [0x00FA3541+2176321]
    BaseThreadInitThunk [0x755AFA29+25]
    RtlGetAppContainerNamedObjectPath [0x775C7A9E+286]
    RtlGetAppContainerNamedObjectPath [0x775C7A6E+238]

The code that I ran was okay in 2 days ago, but now, the code have been showed this error.
Please say how to solve this problem. I wonder why it ran well before.

Body:
This error message...

selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 96
Current browser version is 98.0.4758.82 with binary path C:\Program Files\Google\Chrome\Application\chrome.exe

...implies that the ChromeDriver was unable to initiate/spawn a new Browsing Context i.e. google-chrome session.

Your main issue is the incompatibility between the version of the binaries you are using as follows:

You are using chrome=98.0.4758.82

Release Notes of ChromeDriver v98.0.4758.80 clearly mentions the following :

Supports Chrome version 98

But you are using chromedriver=96.0

Release Notes of chromedriver=96.0.4664.45 clearly mentions the following :

Supports Chrome version 96

So there is a clear mismatch between chromedriver=96.0 and the chrome=96.0.4664.45

Solution

Ensure that:

ChromeDriver is updated to  current ChromeDriver v98.0.4758.80 level.

Chrome Browser is updated to  current chrome=98 (as per chromedriver=98.0.4758.80 release notes).


问:
How to use the `env` parameter in data.table version 1.14.3
I'm trying to understand the new env parameter in data.table.

This works (data.table version 1.14.3)

```<code>df1 = data.table(x=seq(1,10))
a="x"
df1[a<5, env=list(a=a)]

   x
1: 1
2: 2
3: 3
4: 4

</code>```

However, I can't get it to work in join conditions

```<code>df1 = data.table(x=seq(1,10), xz=rnorm(10))
df2 = data.table(y=seq(5,14), yz=rnorm(10))
a="x"
b="y"

# This fails
df1[df2, on=.(a<b), nomatch=0, env=list(a=a,b=b)]
</code>```

Any thoughts on how to pass variables a and b to the on clause of data.table? I understand how to do it via function.  However, I'm struggling to find best way to pass a and b as characters, and still use in the on clause

```<code># This works
func <- function(d1,d2,a,b) {
  eval(substitute(d1[d2, on=.(a<b), nomatch=0]))
}
func(df1,df2,x,y)
</code>```

Body:
I'm trying to understand the new env parameter in data.table.

This works (data.table version 1.14.3)

df1 = data.table(x=seq(1,10))
a="x"
df1[a<5, env=list(a=a)]

   x
1: 1
2: 2
3: 3
4: 4

However, I can't get it to work in join conditions

df1 = data.table(x=seq(1,10), xz=rnorm(10))
df2 = data.table(y=seq(5,14), yz=rnorm(10))
a="x"
b="y"

# This fails
df1[df2, on=.(a<b), nomatch=0, env=list(a=a,b=b)]

Any thoughts on how to pass variables a and b to the on clause of data.table? I understand how to do it via function.  However, I'm struggling to find best way to pass a and b as characters, and still use in the on clause

# This works
func <- function(d1,d2,a,b) {
  eval(substitute(d1[d2, on=.(a<b), nomatch=0]))
}
func(df1,df2,x,y)

Body:
According to the documentation for ?data.table (1.14.3)

env - List or an environment, passed to substitute2 for substitution of parameters in i, j and by (or keyby). Use verbose to preview constructed expressions.

The usage of env with on is not specified.  An option without the eval/substitute would be to pass a named vector in on

out1 <- df1[df2, on = setNames(b, a), nomatch = 0]

-checking with the output of actual columns

> out2 <- df1[df2, on = .(x = y), nomatch = 0]
> identical(out1, out2)
[1] TRUE

For the non-equi join, as @jangorecki mentioned in the comments, use substitute2

eval(substitute2(df1[df2, on = .(a <b), nomatch = 0], env = list(a=a, b = b)))

-output

    x         xz          yz
    <int>      <num>       <num>
 1:     5 -1.1259516 -0.78272556
 2:     5 -0.4893074 -0.78272556
 3:     5  1.8534867 -0.78272556
 4:     5 -0.0376076 -0.78272556
 5:     6 -1.1259516 -0.38678402
 6:     6 -0.4893074 -0.38678402
 7:     6  1.8534867 -0.38678402
 8:     6 -0.0376076 -0.38678402
 9:     6 -0.8409438 -0.38678402
10:     7 -1.1259516  1.18356550
11:     7 -0.4893074  1.18356550
12:     7  1.8534867  1.18356550
13:     7 -0.0376076  1.18356550
14:     7 -0.8409438  1.18356550
15:     7  2.4536938  1.18356550
16:     8 -1.1259516  1.01226735
17:     8 -0.4893074  1.01226735
18:     8  1.8534867  1.01226735
19:     8 -0.0376076  1.01226735
20:     8 -0.8409438  1.01226735
21:     8  2.4536938  1.01226735
22:     8 -0.4296828  1.01226735
23:     9 -1.1259516  0.64996351
24:     9 -0.4893074  0.64996351
25:     9  1.8534867  0.64996351
26:     9 -0.0376076  0.64996351
27:     9 -0.8409438  0.64996351
28:     9  2.4536938  0.64996351
29:     9 -0.4296828  0.64996351
30:     9  0.9030399  0.64996351
31:    10 -1.1259516 -1.23172125
32:    10 -0.4893074 -1.23172125
33:    10  1.8534867 -1.23172125
34:    10 -0.0376076 -1.23172125
35:    10 -0.8409438 -1.23172125
36:    10  2.4536938 -1.23172125
37:    10 -0.4296828 -1.23172125
38:    10  0.9030399 -1.23172125
39:    10  0.5757248 -1.23172125
40:    11 -1.1259516  0.21203485
41:    11 -0.4893074  0.21203485
42:    11  1.8534867  0.21203485
43:    11 -0.0376076  0.21203485
44:    11 -0.8409438  0.21203485
45:    11  2.4536938  0.21203485
46:    11 -0.4296828  0.21203485
47:    11  0.9030399  0.21203485
48:    11  0.5757248  0.21203485
49:    11 -1.1732665  0.21203485
50:    12 -1.1259516 -1.28178320
51:    12 -0.4893074 -1.28178320
52:    12  1.8534867 -1.28178320
53:    12 -0.0376076 -1.28178320
54:    12 -0.8409438 -1.28178320
55:    12  2.4536938 -1.28178320
56:    12 -0.4296828 -1.28178320
57:    12  0.9030399 -1.28178320
58:    12  0.5757248 -1.28178320
59:    12 -1.1732665 -1.28178320
60:    13 -1.1259516 -0.03909294
61:    13 -0.4893074 -0.03909294
62:    13  1.8534867 -0.03909294
63:    13 -0.0376076 -0.03909294
64:    13 -0.8409438 -0.03909294
65:    13  2.4536938 -0.03909294
66:    13 -0.4296828 -0.03909294
67:    13  0.9030399 -0.03909294
68:    13  0.5757248 -0.03909294
69:    13 -1.1732665 -0.03909294
70:    14 -1.1259516  0.25522954
71:    14 -0.4893074  0.25522954
72:    14  1.8534867  0.25522954
73:    14 -0.0376076  0.25522954
74:    14 -0.8409438  0.25522954
75:    14  2.4536938  0.25522954
76:    14 -0.4296828  0.25522954
77:    14  0.9030399  0.25522954
78:    14  0.5757248  0.25522954
79:    14 -1.1732665  0.25522954


问:
Change the time zone only for certain rows in a column?
I am working with data in R and would like to change the time zone of some POSIXct data, but only for certain rows within the columns (Survey_Start and Survey_End). Some of the data is already in the proper time zone, so converting the entire column is a problem. My code to change the time zone is:

```<code>    herps2021 <- herps2021 %>%
    mutate(Survey_Start = as.POSIXct(Survey_Start, format = "%H:%M:%S",
    tz = "UTC"),
     Survey_End = as.POSIXct(Survey_End, format = "%H:%M:%S", tz =
    "UTC"),

          #Change to proper time zone
         Survey_Start = with_tz(Survey_Start, tzone = "America/Los_Angeles"),
         Survey_End  = with_tz(Survey_End , tzone = "America/Los_Angeles")
          )
</code>```

Is there a way to specify which rows for the columns Survey_Start and Survey_End I want to convert, so that the data already in the correct time zone is unaffected?

Thanks!

答:
you could try using parse_date_time that allows you to parse multiple dates and times in a column.

Looks something like this:

```<code>library(lubridate)
parse_date_time(c("2016", "2016-04"), orders = c("Y", "Ym"))
#> [1] "2016-01-01 UTC" "2016-04-01 UTC"
</code>```

here is the link to the documentation: https://lubridate.tidyverse.org/reference/parse_date_time.html

Body:
I am working with data in R and would like to change the time zone of some POSIXct data, but only for certain rows within the columns (Survey_Start and Survey_End). Some of the data is already in the proper time zone, so converting the entire column is a problem. My code to change the time zone is:

    herps2021 <- herps2021 %>%
    mutate(Survey_Start = as.POSIXct(Survey_Start, format = "%H:%M:%S",
    tz = "UTC"),
     Survey_End = as.POSIXct(Survey_End, format = "%H:%M:%S", tz =
    "UTC"),

          #Change to proper time zone
         Survey_Start = with_tz(Survey_Start, tzone = "America/Los_Angeles"),
         Survey_End  = with_tz(Survey_End , tzone = "America/Los_Angeles")
          )

Is there a way to specify which rows for the columns Survey_Start and Survey_End I want to convert, so that the data already in the correct time zone is unaffected?

Thanks!

Body:
you could try using parse_date_time that allows you to parse multiple dates and times in a column.

Looks something like this:

library(lubridate)
parse_date_time(c("2016", "2016-04"), orders = c("Y", "Ym"))
#> [1] "2016-01-01 UTC" "2016-04-01 UTC"

here is the link to the documentation: https://lubridate.tidyverse.org/reference/parse_date_time.html


问:
How do I zoom in graph with matplotlib?
Hi I'm working with matplotlab library and want to zoom in graph I made too see it more clearly.
Any ideas?

pic of code

答:
In matplotlib you can zoom in the plot by specifying the x and y limits. For the case you have provided an example can be:

```<code>plt.xlim(-2.5, 1)
plt.ylim(0, 50)
</code>```

If you only want to zoom in in the x axis use only the first line. Analogously you can zoom in only in the y axis by using the second line.

Title: How do I zoom in graph with matplotlib?

Body:
In matplotlib you can zoom in the plot by specifying the x and y limits. For the case you have provided an example can be:

plt.xlim(-2.5, 1)
plt.ylim(0, 50)

If you only want to zoom in in the x axis use only the first line. Analogously you can zoom in only in the y axis by using the second line.


问:
macOS Monterey - Install Scipy Error "No lapack/blas resources found"
I have installed pyenv on Mac using brew install pyenv. I want to run a python project which requires installation of scipy==1.5.4. I tried installing it using the command pip3 install scipy==1.5.4 but I got an error No lapack/blas resources found.

To solve that I ran the following commands as suggested in the error and other solutions.

brew install openblas

Followed by:

```<code>export LDFLAGS="-L/usr/local/opt/openblas/lib"
export CPPFLAGS="-I/usr/local/opt/openblas/include"
export PKG_CONFIG_PATH="/usr/local/opt/openblas/lib/pkgconfig"
</code>```

Next I did

```<code>brew install lapack
</code>```

Followed by

```<code>export LDFLAGS="-L/usr/local/opt/lapack/lib"
export CPPFLAGS="-I/usr/local/opt/lapack/include"
export PKG_CONFIG_PATH="/usr/local/opt/lapack/lib/pkgconfig"
</code>```

Now that I've installed both blas and lapack I expected the error to go away but I am still facing similar error. How can I solve this?

PS

Complete Error

```<code>    Running from SciPy source directory.
    lapack_opt_info:
    lapack_mkl_info:
    customize UnixCCompiler
      libraries mkl_rt not found in ['/Users/furqan/.pyenv/versions/3.6.13/envs/venv/lib', '/usr/local/lib', '/usr/lib']
      NOT AVAILABLE

    openblas_lapack_info:
    customize UnixCCompiler
    customize UnixCCompiler
      libraries openblas not found in ['/Users/furqan/.pyenv/versions/3.6.13/envs/venv/lib', '/usr/local/lib', '/usr/lib']
      NOT AVAILABLE

    openblas_clapack_info:
    customize UnixCCompiler
    customize UnixCCompiler
      libraries openblas,lapack not found in ['/Users/furqan/.pyenv/versions/3.6.13/envs/venv/lib', '/usr/local/lib', '/usr/lib']
      NOT AVAILABLE

    atlas_3_10_threads_info:
    Setting PTATLAS=ATLAS
    customize UnixCCompiler
      libraries tatlas,tatlas not found in /Users/furqan/.pyenv/versions/3.6.13/envs/venv/lib
    customize UnixCCompiler
      libraries lapack_atlas not found in /Users/furqan/.pyenv/versions/3.6.13/envs/venv/lib
    customize UnixCCompiler
      libraries tatlas,tatlas not found in /usr/local/lib
    customize UnixCCompiler
      libraries lapack_atlas not found in /usr/local/lib
    customize UnixCCompiler
      libraries tatlas,tatlas not found in /usr/lib
    customize UnixCCompiler
      libraries lapack_atlas not found in /usr/lib
    <class 'numpy.distutils.system_info.atlas_3_10_threads_info'>
      NOT AVAILABLE

    atlas_3_10_info:
    customize UnixCCompiler
      libraries satlas,satlas not found in /Users/furqan/.pyenv/versions/3.6.13/envs/venv/lib
    customize UnixCCompiler
      libraries lapack_atlas not found in /Users/furqan/.pyenv/versions/3.6.13/envs/venv/lib
    customize UnixCCompiler
      libraries satlas,satlas not found in /usr/local/lib
    customize UnixCCompiler
      libraries lapack_atlas not found in /usr/local/lib
    customize UnixCCompiler
      libraries satlas,satlas not found in /usr/lib
    customize UnixCCompiler
      libraries lapack_atlas not found in /usr/lib
    <class 'numpy.distutils.system_info.atlas_3_10_info'>
      NOT AVAILABLE

    atlas_threads_info:
    Setting PTATLAS=ATLAS
    customize UnixCCompiler
      libraries ptf77blas,ptcblas,atlas not found in /Users/furqan/.pyenv/versions/3.6.13/envs/venv/lib
    customize UnixCCompiler
      libraries lapack_atlas not found in /Users/furqan/.pyenv/versions/3.6.13/envs/venv/lib
    customize UnixCCompiler
      libraries ptf77blas,ptcblas,atlas not found in /usr/local/lib
    customize UnixCCompiler
      libraries lapack_atlas not found in /usr/local/lib
    customize UnixCCompiler
      libraries ptf77blas,ptcblas,atlas not found in /usr/lib
    customize UnixCCompiler
      libraries lapack_atlas not found in /usr/lib
    <class 'numpy.distutils.system_info.atlas_threads_info'>
      NOT AVAILABLE

    atlas_info:
    customize UnixCCompiler
      libraries f77blas,cblas,atlas not found in /Users/furqan/.pyenv/versions/3.6.13/envs/venv/lib
    customize UnixCCompiler
      libraries lapack_atlas not found in /Users/furqan/.pyenv/versions/3.6.13/envs/venv/lib
    customize UnixCCompiler
      libraries f77blas,cblas,atlas not found in /usr/local/lib
    customize UnixCCompiler
      libraries lapack_atlas not found in /usr/local/lib
    customize UnixCCompiler
      libraries f77blas,cblas,atlas not found in /usr/lib
    customize UnixCCompiler
      libraries lapack_atlas not found in /usr/lib
    <class 'numpy.distutils.system_info.atlas_info'>
      NOT AVAILABLE

    /private/var/folders/8p/qhqd9mgj7n93g_6snx_4y9rh0000gn/T/pip-build-env-n8dln98w/lib/python3.6/site-packages/numpy/distutils/system_info.py:624: UserWarning:
        Atlas (http://math-atlas.sourceforge.net/) libraries not found.
        Directories to search for the libraries can be specified in the
        numpy/distutils/site.cfg file (section [atlas]) or by setting
        the ATLAS environment variable.
      self.calc_info()
    lapack_info:
    customize UnixCCompiler
      libraries lapack not found in ['/Users/furqan/.pyenv/versions/3.6.13/envs/venv/lib', '/usr/local/lib', '/usr/lib']
      NOT AVAILABLE

    /private/var/folders/8p/qhqd9mgj7n93g_6snx_4y9rh0000gn/T/pip-build-env-n8dln98w/lib/python3.6/site-packages/numpy/distutils/system_info.py:624: UserWarning:
        Lapack (http://www.netlib.org/lapack/) libraries not found.
        Directories to search for the libraries can be specified in the
        numpy/distutils/site.cfg file (section [lapack]) or by setting
        the LAPACK environment variable.
      self.calc_info()
    lapack_src_info:
      NOT AVAILABLE

    /private/var/folders/8p/qhqd9mgj7n93g_6snx_4y9rh0000gn/T/pip-build-env-n8dln98w/lib/python3.6/site-packages/numpy/distutils/system_info.py:624: UserWarning:
        Lapack (http://www.netlib.org/lapack/) sources not found.
        Directories to search for the sources can be specified in the
        numpy/distutils/site.cfg file (section [lapack_src]) or by setting
        the LAPACK_SRC environment variable.
      self.calc_info()
      NOT AVAILABLE

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/8p/qhqd9mgj7n93g_6snx_4y9rh0000gn/T/pip-install-x19xcozn/scipy/setup.py", line 583, in <module>
        setup_package()
      File "/private/var/folders/8p/qhqd9mgj7n93g_6snx_4y9rh0000gn/T/pip-install-x19xcozn/scipy/setup.py", line 579, in setup_package
        setup(**metadata)
      File "/private/var/folders/8p/qhqd9mgj7n93g_6snx_4y9rh0000gn/T/pip-build-env-n8dln98w/lib/python3.6/site-packages/numpy/distutils/core.py", line 135, in setup
        config = configuration()
      File "/private/var/folders/8p/qhqd9mgj7n93g_6snx_4y9rh0000gn/T/pip-install-x19xcozn/scipy/setup.py", line 477, in configuration
        raise NotFoundError(msg)
    numpy.distutils.system_info.NotFoundError: No lapack/blas resources found. Note: Accelerate is no longer supported.

    ----------------------------------------
Command "/Users/furqan/.pyenv/versions/3.6.13/envs/venv/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/8p/qhqd9mgj7n93g_6snx_4y9rh0000gn/T/pip-install-x19xcozn/scipy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/8p/qhqd9mgj7n93g_6snx_4y9rh0000gn/T/pip-record-uy6kggfm/install-record.txt --single-version-externally-managed --compile --install-headers /Users/furqan/.pyenv/versions/3.6.13/envs/venv/include/site/python3.6/scipy" failed with error code 1 in /private/var/folders/8p/qhqd9mgj7n93g_6snx_4y9rh0000gn/T/pip-install-x19xcozn/scipy/
</code>```

答: We had a similar issue when upgrading a Django app to use Python 3.8. The solution for us came out of this github thread. We're running on Big Sur so not sure if the same fix would work for you, but before you run your package install run export SYSTEM_VERSION_COMPAT=1. Again, not sure if this will solve in your context, but it worked for us.

Body:
I have installed pyenv on Mac using brew install pyenv. I want to run a python project which requires installation of scipy==1.5.4. I tried installing it using the command pip3 install scipy==1.5.4 but I got an error No lapack/blas resources found.

To solve that I ran the following commands as suggested in the error and other solutions.

brew install openblas

Followed by:

export LDFLAGS="-L/usr/local/opt/openblas/lib"
export CPPFLAGS="-I/usr/local/opt/openblas/include"
export PKG_CONFIG_PATH="/usr/local/opt/openblas/lib/pkgconfig"

Next I did

brew install lapack

Followed by

export LDFLAGS="-L/usr/local/opt/lapack/lib"
export CPPFLAGS="-I/usr/local/opt/lapack/include"
export PKG_CONFIG_PATH="/usr/local/opt/lapack/lib/pkgconfig"

Now that I've installed both blas and lapack I expected the error to go away but I am still facing similar error. How can I solve this?

PS

Complete Error

    Running from SciPy source directory.
    lapack_opt_info:
    lapack_mkl_info:
    customize UnixCCompiler
      libraries mkl_rt not found in ['/Users/furqan/.pyenv/versions/3.6.13/envs/venv/lib', '/usr/local/lib', '/usr/lib']
      NOT AVAILABLE

    openblas_lapack_info:
    customize UnixCCompiler
    customize UnixCCompiler
      libraries openblas not found in ['/Users/furqan/.pyenv/versions/3.6.13/envs/venv/lib', '/usr/local/lib', '/usr/lib']
      NOT AVAILABLE

    openblas_clapack_info:
    customize UnixCCompiler
    customize UnixCCompiler
      libraries openblas,lapack not found in ['/Users/furqan/.pyenv/versions/3.6.13/envs/venv/lib', '/usr/local/lib', '/usr/lib']
      NOT AVAILABLE

    atlas_3_10_threads_info:
    Setting PTATLAS=ATLAS
    customize UnixCCompiler
      libraries tatlas,tatlas not found in /Users/furqan/.pyenv/versions/3.6.13/envs/venv/lib
    customize UnixCCompiler
      libraries lapack_atlas not found in /Users/furqan/.pyenv/versions/3.6.13/envs/venv/lib
    customize UnixCCompiler
      libraries tatlas,tatlas not found in /usr/local/lib
    customize UnixCCompiler
      libraries lapack_atlas not found in /usr/local/lib
    customize UnixCCompiler
      libraries tatlas,tatlas not found in /usr/lib
    customize UnixCCompiler
      libraries lapack_atlas not found in /usr/lib
    <class 'numpy.distutils.system_info.atlas_3_10_threads_info'>
      NOT AVAILABLE

    atlas_3_10_info:
    customize UnixCCompiler
      libraries satlas,satlas not found in /Users/furqan/.pyenv/versions/3.6.13/envs/venv/lib
    customize UnixCCompiler
      libraries lapack_atlas not found in /Users/furqan/.pyenv/versions/3.6.13/envs/venv/lib
    customize UnixCCompiler
      libraries satlas,satlas not found in /usr/local/lib
    customize UnixCCompiler
      libraries lapack_atlas not found in /usr/local/lib
    customize UnixCCompiler
      libraries satlas,satlas not found in /usr/lib
    customize UnixCCompiler
      libraries lapack_atlas not found in /usr/lib
    <class 'numpy.distutils.system_info.atlas_3_10_info'>
      NOT AVAILABLE

    atlas_threads_info:
    Setting PTATLAS=ATLAS
    customize UnixCCompiler
      libraries ptf77blas,ptcblas,atlas not found in /Users/furqan/.pyenv/versions/3.6.13/envs/venv/lib
    customize UnixCCompiler
      libraries lapack_atlas not found in /Users/furqan/.pyenv/versions/3.6.13/envs/venv/lib
    customize UnixCCompiler
      libraries ptf77blas,ptcblas,atlas not found in /usr/local/lib
    customize UnixCCompiler
      libraries lapack_atlas not found in /usr/local/lib
    customize UnixCCompiler
      libraries ptf77blas,ptcblas,atlas not found in /usr/lib
    customize UnixCCompiler
      libraries lapack_atlas not found in /usr/lib
    <class 'numpy.distutils.system_info.atlas_threads_info'>
      NOT AVAILABLE

    atlas_info:
    customize UnixCCompiler
      libraries f77blas,cblas,atlas not found in /Users/furqan/.pyenv/versions/3.6.13/envs/venv/lib
    customize UnixCCompiler
      libraries lapack_atlas not found in /Users/furqan/.pyenv/versions/3.6.13/envs/venv/lib
    customize UnixCCompiler
      libraries f77blas,cblas,atlas not found in /usr/local/lib
    customize UnixCCompiler
      libraries lapack_atlas not found in /usr/local/lib
    customize UnixCCompiler
      libraries f77blas,cblas,atlas not found in /usr/lib
    customize UnixCCompiler
      libraries lapack_atlas not found in /usr/lib
    <class 'numpy.distutils.system_info.atlas_info'>
      NOT AVAILABLE

    /private/var/folders/8p/qhqd9mgj7n93g_6snx_4y9rh0000gn/T/pip-build-env-n8dln98w/lib/python3.6/site-packages/numpy/distutils/system_info.py:624: UserWarning:
        Atlas (http://math-atlas.sourceforge.net/) libraries not found.
        Directories to search for the libraries can be specified in the
        numpy/distutils/site.cfg file (section [atlas]) or by setting
        the ATLAS environment variable.
      self.calc_info()
    lapack_info:
    customize UnixCCompiler
      libraries lapack not found in ['/Users/furqan/.pyenv/versions/3.6.13/envs/venv/lib', '/usr/local/lib', '/usr/lib']
      NOT AVAILABLE

    /private/var/folders/8p/qhqd9mgj7n93g_6snx_4y9rh0000gn/T/pip-build-env-n8dln98w/lib/python3.6/site-packages/numpy/distutils/system_info.py:624: UserWarning:
        Lapack (http://www.netlib.org/lapack/) libraries not found.
        Directories to search for the libraries can be specified in the
        numpy/distutils/site.cfg file (section [lapack]) or by setting
        the LAPACK environment variable.
      self.calc_info()
    lapack_src_info:
      NOT AVAILABLE

    /private/var/folders/8p/qhqd9mgj7n93g_6snx_4y9rh0000gn/T/pip-build-env-n8dln98w/lib/python3.6/site-packages/numpy/distutils/system_info.py:624: UserWarning:
        Lapack (http://www.netlib.org/lapack/) sources not found.
        Directories to search for the sources can be specified in the
        numpy/distutils/site.cfg file (section [lapack_src]) or by setting
        the LAPACK_SRC environment variable.
      self.calc_info()
      NOT AVAILABLE

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/8p/qhqd9mgj7n93g_6snx_4y9rh0000gn/T/pip-install-x19xcozn/scipy/setup.py", line 583, in <module>
        setup_package()
      File "/private/var/folders/8p/qhqd9mgj7n93g_6snx_4y9rh0000gn/T/pip-install-x19xcozn/scipy/setup.py", line 579, in setup_package
        setup(**metadata)
      File "/private/var/folders/8p/qhqd9mgj7n93g_6snx_4y9rh0000gn/T/pip-build-env-n8dln98w/lib/python3.6/site-packages/numpy/distutils/core.py", line 135, in setup
        config = configuration()
      File "/private/var/folders/8p/qhqd9mgj7n93g_6snx_4y9rh0000gn/T/pip-install-x19xcozn/scipy/setup.py", line 477, in configuration
        raise NotFoundError(msg)
    numpy.distutils.system_info.NotFoundError: No lapack/blas resources found. Note: Accelerate is no longer supported.

    ----------------------------------------
Command "/Users/furqan/.pyenv/versions/3.6.13/envs/venv/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/8p/qhqd9mgj7n93g_6snx_4y9rh0000gn/T/pip-install-x19xcozn/scipy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/8p/qhqd9mgj7n93g_6snx_4y9rh0000gn/T/pip-record-uy6kggfm/install-record.txt --single-version-externally-managed --compile --install-headers /Users/furqan/.pyenv/versions/3.6.13/envs/venv/include/site/python3.6/scipy" failed with error code 1 in /private/var/folders/8p/qhqd9mgj7n93g_6snx_4y9rh0000gn/T/pip-install-x19xcozn/scipy/


问:
How find max of an inner element in a list of key, values?
I have a list of items as you see below. The values for each year key is a list of 10 items but to make it short, I am only showing the first couple of them. How I can find the maximum of all inner "count" values? I have looked at various approaches but none has worked so far and perhaps I am missing something here. For instance, I really like some of one liners here but they didnt work for me enter link description here

Just to clarify that data is the result of a nest on csv file and it meant to be used in d3 chart and preferably no import library other than standard ones.

```<code>data = [
         {'2015': values: [{key: '0', value: {count: 45}},{key: '1', value: {count: 3}}, ... ]},
         {'2016': values: [{key: '0', value: {count: 67}},{key: '1', value: {count: 0}}, ... ]},
     {'2017': values: [{key: '0', value: {count: 12}},{key: '1', value: {count: 8}}, ... ]}
        ]
</code>```

To better show how data looks like, here is the screen shot in case it helps clarification of the question.

答:
Something like this should work

const myData = [
  { key: "2015", values: [10, 5, 4, 3, 2, 1, 0] },
  { key: "2015", values: [10, 5, 4, 3, 2, 1, 0] },
  { key: "2015", values: [10, 5, 4, 3, 2, 1, 0] },
  { key: "2015", values: [100, 5, 4, 3, 2, 1, 0] },
  { key: "2015", values: [10, 5, 4, 3, 2, 1, 0] },
]

const maxValue = (data) => {

  // Setting an initial value to the lowest possible value in Javascript
  let max = Number.MIN_VALUE;

  // Iterate over each object in your array of data
  data.forEach(({values}) => {

    // Destructure the values from each object and then iterate over those
    values.forEach(value => {

      // Set the max to the higher over the current max or current value
      max = Math.max(max, value);
    })
  })

  // Return the max
  return max;
}

console.log(maxValue(myData))```

What we are doing here is iterating over each object in the initial array.  Then iterating over the values keeping track of a current max.

Body:
I have a list of items as you see below. The values for each year key is a list of 10 items but to make it short, I am only showing the first couple of them. How I can find the maximum of all inner "count" values? I have looked at various approaches but none has worked so far and perhaps I am missing something here. For instance, I really like some of one liners here but they didnt work for me enter link description here

Just to clarify that data is the result of a nest on csv file and it meant to be used in d3 chart and preferably no import library other than standard ones.

data = [
         {'2015': values: [{key: '0', value: {count: 45}},{key: '1', value: {count: 3}}, ... ]},
         {'2016': values: [{key: '0', value: {count: 67}},{key: '1', value: {count: 0}}, ... ]},
     {'2017': values: [{key: '0', value: {count: 12}},{key: '1', value: {count: 8}}, ... ]}
        ]

To better show how data looks like, here is the screen shot in case it helps clarification of the question.

Body:
Something like this should work

const myData = [
  { key: "2015", values: [10, 5, 4, 3, 2, 1, 0] },
  { key: "2015", values: [10, 5, 4, 3, 2, 1, 0] },
  { key: "2015", values: [10, 5, 4, 3, 2, 1, 0] },
  { key: "2015", values: [100, 5, 4, 3, 2, 1, 0] },
  { key: "2015", values: [10, 5, 4, 3, 2, 1, 0] },
]

const maxValue = (data) => {

  // Setting an initial value to the lowest possible value in Javascript
  let max = Number.MIN_VALUE;

  // Iterate over each object in your array of data
  data.forEach(({values}) => {

    // Destructure the values from each object and then iterate over those
    values.forEach(value => {

      // Set the max to the higher over the current max or current value
      max = Math.max(max, value);
    })
  })

  // Return the max
  return max;
}

console.log(maxValue(myData))

What we are doing here is iterating over each object in the initial array.  Then iterating over the values keeping track of a current max.


问:
Internal links in rmarkdown don't work
I use rmarkdown to render pdf documents. Now I want to add internal links in the texts.

In the helping pages of rmarkdown, it says an internal link is defined as:

```<code>See the [Introduction](#introduction).
</code>```

When I Use e.g. the next code there should be two internal links: link1 and link2. Both don't link. Is there something obvious that I am doing wrong? Many thanks in advance!

```<code>   ---
title: "Test"
author: "test test"
output:
  pdf_document:
    latex_engine: xelatex
    number_sections: yes
    toc: yes
    toc_depth: 3
  html_document:
    css: tables.css
    number_sections: yes
    theme: cerulean
    toc: yes
    toc_depth: 3
subtitle: test test test
mainfont: Calibri Light
fontsize: 12pt
header-includes:
- \usepackage[dutch]{babel}
- \usepackage{fancyhdr}
- \pagestyle{fancy}
- \fancyfoot[LE,RO]{this is a fancy foot}
- \usepackage{dcolumn}
- \usepackage{here}
- \usepackage{longtable}
- \usepackage{caption}
- \captionsetup{skip=2pt,labelsep=space,justification=justified,singlelinecheck=off}
---

# start

```{r results="asis",tidy=FALSE,eval=TRUE,echo=FALSE,message=FALSE, error=FALSE, warning=FALSE, comment = NA}
cat("click here: [link1](#test 1)")
```

click here: [link2](#test 1)

\pagebreak

#test 3

\pagebreak

#test 2

\pagebreak

#test 1
</code>```

答:
I've tried to compile a lot of the information across multiple different posts into a single-answer, working .Rmd file example below:

```<code>---
title: "internal link testing"
output: html_document
---

Create some headings that we want to link to later:

# Heading 1

## Heading 2

### Heading  3

Improperly created headings will not work because there must be a space between the hash (#) and the heading text:

#Heading1a
##Heading2a
###Heading3a

The following links work as expected regardless of capitalization:
[Heading 1] [heading 1]
[Heading 2] [heading 2]
[Heading  3] [heading  3]

But, do not replace space(s) with dash(es)... these links will not work:
[heading-1] [Heading-1]
[heading-2] [Heading-2]
[heading--3] [Heading--3]

*HOWEVER... *

If using an explicit link, you MUST:
- replace spaces with dash
- use lower case
- and there must be no leading space between the hash and the text:

[explicit heading 1 link](#heading-1)

Leaving in space(s) creates a broken link leading to something that doesn't exist:
[broken heading 1 link](#heading 1)
[broken heading 1 link](# heading-1)

You can create links within a code chunk as well by `cat`ting or pasting the text and setting results='asis':

```{r testchunk, results='asis', message=FALSE, warning=FALSE}

# These all work:
cat("[Heading 1] [heading 1] [explicit heading 1 link](#heading-1) ")
paste("[Heading 1] [heading 1] [explicit heading 1 link](#heading-1) ")
cat('heading 1 href')

library(DT)
library(dplyr)

for(car in unique(rownames(mtcars))) {

  # You can programmatically create section headers within a for loop, but make sure to include some extra newlines:

  cat("\n")
  cat(paste0("## ", car))
  cat("\n")

  # within a kable, make sure to replace spaces, use lowercase, and set escape=FALSE
  # and remember to print the table within the loop
  mtcars %>%
    tibble::rownames_to_column(var="vname") %>%
    mutate(link = paste0('', car, '')) %>%
    filter(vname == car) %>%
    knitr::kable(escape=FALSE) %>%
    print()
}

# if using DT::datatable, make sure to specify escape=F to allow html within the table:
mtcars %>%
  tibble::rownames_to_column(var="vname") %>%
  mutate(link = paste0('', vname, '')) %>%
  datatable(escape=FALSE)

```

Title: Internal links in rmarkdown don't work

Body:
I use rmarkdown to render pdf documents. Now I want to add internal links in the texts.

In the helping pages of rmarkdown, it says an internal link is defined as:

See the [Introduction](#introduction).

When I Use e.g. the next code there should be two internal links: link1 and link2. Both don't link. Is there something obvious that I am doing wrong? Many thanks in advance!

   ---
title: "Test"
author: "test test"
output:
  pdf_document:
    latex_engine: xelatex
    number_sections: yes
    toc: yes
    toc_depth: 3
  html_document:
    css: tables.css
    number_sections: yes
    theme: cerulean
    toc: yes
    toc_depth: 3
subtitle: test test test
mainfont: Calibri Light
fontsize: 12pt
header-includes:
- \usepackage[dutch]{babel}
- \usepackage{fancyhdr}
- \pagestyle{fancy}
- \fancyfoot[LE,RO]{this is a fancy foot}
- \usepackage{dcolumn}
- \usepackage{here}
- \usepackage{longtable}
- \usepackage{caption}
- \captionsetup{skip=2pt,labelsep=space,justification=justified,singlelinecheck=off}
---

# start

```{r results="asis",tidy=FALSE,eval=TRUE,echo=FALSE,message=FALSE, error=FALSE, warning=FALSE, comment = NA}
cat("click here: [link1](#test 1)")
```

click here: [link2](#test 1)

\pagebreak

#test 3

\pagebreak

#test 2

\pagebreak

#test 1

Body:
I've tried to compile a lot of the information across multiple different posts into a single-answer, working .Rmd file example below:

---
title: "internal link testing"
output: html_document
---

Create some headings that we want to link to later:

# Heading 1

## Heading 2

### Heading  3

Improperly created headings will not work because there must be a space between the hash (#) and the heading text:

#Heading1a
##Heading2a
###Heading3a

The following links work as expected regardless of capitalization:
[Heading 1] [heading 1]
[Heading 2] [heading 2]
[Heading  3] [heading  3]

But, do not replace space(s) with dash(es)... these links will not work:
[heading-1] [Heading-1]
[heading-2] [Heading-2]
[heading--3] [Heading--3]

*HOWEVER... *

If using an explicit link, you MUST:
- replace spaces with dash
- use lower case
- and there must be no leading space between the hash and the text:

[explicit heading 1 link](#heading-1)

Leaving in space(s) creates a broken link leading to something that doesn't exist:
[broken heading 1 link](#heading 1)
[broken heading 1 link](# heading-1)

You can create links within a code chunk as well by `cat`ting or pasting the text and setting results='asis':

```{r testchunk, results='asis', message=FALSE, warning=FALSE}

# These all work:
cat("[Heading 1] [heading 1] [explicit heading 1 link](#heading-1) ")
paste("[Heading 1] [heading 1] [explicit heading 1 link](#heading-1) ")
cat('<a href="#heading-1">heading 1 href</a>')

library(DT)
library(dplyr)

for(car in unique(rownames(mtcars))) {

  # You can programmatically create section headers within a for loop, but make sure to include some extra newlines:

  cat("\n")
  cat(paste0("## ", car))
  cat("\n")

  # within a kable, make sure to replace spaces, use lowercase, and set escape=FALSE
  # and remember to print the table within the loop
  mtcars %>%
    tibble::rownames_to_column(var="vname") %>%
    mutate(link = paste0('<a href="#', tolower(gsub(" ", "-", car)), '">', car, '</a>')) %>%
    filter(vname == car) %>%
    knitr::kable(escape=FALSE) %>%
    print()
}

# if using DT::datatable, make sure to specify escape=F to allow html within the table:
mtcars %>%
  tibble::rownames_to_column(var="vname") %>%
  mutate(link = paste0('<a href="#', tolower(gsub(" ", "-", vname)), '">', vname, '</a>')) %>%
  datatable(escape=FALSE)


问:
Error 1133 when creating users in SQL script?
I have this .sql script I've written which, among other things, creates the DB, creates tables, creates procedures, and sets up users.

Here is a segment of it:

```<code>DELETE FROM mysql.user WHERE User = 'fwtrRWW';
DELETE FROM mysql.user WHERE User = 'fwtrRW';
DELETE FROM mysql.user WHERE User = 'fwtrR';

FLUSH PRIVILEGES;

CREATE USER 'fwtrRWW'@'localhost' IDENTIFIED BY 'abc123';
CREATE USER  'fwtrRW'@'localhost' IDENTIFIED BY 'abc213';
CREATE USER  ' fwtrR'@'localhost' IDENTIFIED BY 'qwerty';

FLUSH PRIVILEGES;

GRANT ALL                    ON fwtr.* TO 'fwtrRWW';
GRANT SELECT, INSERT, UPDATE ON fwtr.* TO 'fwtrRW';
GRANT SELECT                 ON fwtr.* TO 'fwtrR';
</code>```

I keep getting MySQL error 1133: Can't find any matching row in the user table, despite the fact that SELECT * FROM mysql.User clearly shows that the users are there.

I have tried putting more FLUSH PRIVILEGES in here and there but it doesn't seem to help like it does for others on other forums.

Any ideas what might be wrong?

答:
I think you just need to change your GRANT statements to:

```<code>GRANT ALL                    ON fwtr.* TO 'fwtrRWW'@'localhost';
GRANT SELECT, INSERT, UPDATE ON fwtr.* TO 'fwtrRW'@'localhost';
GRANT SELECT                 ON fwtr.* TO 'fwtrR'@'localhost';
</code>```

Body:
I have this .sql script I've written which, among other things, creates the DB, creates tables, creates procedures, and sets up users.

Here is a segment of it:

DELETE FROM mysql.user WHERE User = 'fwtrRWW';
DELETE FROM mysql.user WHERE User = 'fwtrRW';
DELETE FROM mysql.user WHERE User = 'fwtrR';

FLUSH PRIVILEGES;

CREATE USER 'fwtrRWW'@'localhost' IDENTIFIED BY 'abc123';
CREATE USER  'fwtrRW'@'localhost' IDENTIFIED BY 'abc213';
CREATE USER  ' fwtrR'@'localhost' IDENTIFIED BY 'qwerty';

FLUSH PRIVILEGES;

GRANT ALL                    ON fwtr.* TO 'fwtrRWW';
GRANT SELECT, INSERT, UPDATE ON fwtr.* TO 'fwtrRW';
GRANT SELECT                 ON fwtr.* TO 'fwtrR';

I keep getting MySQL error 1133: Can't find any matching row in the user table, despite the fact that SELECT * FROM mysql.User clearly shows that the users are there.

I have tried putting more FLUSH PRIVILEGES in here and there but it doesn't seem to help like it does for others on other forums.

Any ideas what might be wrong?

Body:
I think you just need to change your GRANT statements to:

GRANT ALL                    ON fwtr.* TO 'fwtrRWW'@'localhost';
GRANT SELECT, INSERT, UPDATE ON fwtr.* TO 'fwtrRW'@'localhost';
GRANT SELECT                 ON fwtr.* TO 'fwtrR'@'localhost';


问:
Find rows that have different value on a column in MySQL
I want to get all the user_id that are having different user_ip_address on user_device table using a MySQL query.

```<code>Table: user_device

id    user_id    user_ip_address
-----------------------------------
1        1        1.1.1.1
2        1        1.1.1.1
3        2        2.2.2.2
4        3        3.3.3.3
5        1        10.10.10.10
6        4        4.4.4.4
7        2        20.20.20.20
8        3        3.3.3.3
</code>```

In this data, user_id 1 and user_id 2 have different user_ip_address.
It should output 1 and 2

I tried:

```<code>SELECT user_ip_address AS c
FROM user_device WHERE user_ip_address IN (SELECT user_id
FROM user_device group by user_id having user_ip_address!=c)
</code>```

答:
untested:

```<code>select user_id
from (
  select user_id
  from user_device
  group by user_id, user_ip_address
)
group by user_id
having count(*) > 1
</code>```

should give you in theory user_id = 1 and 2

Body:
I want to get all the user_id that are having different user_ip_address on user_device table using a MySQL query.

Table: user_device

id    user_id    user_ip_address
-----------------------------------
1        1        1.1.1.1
2        1        1.1.1.1
3        2        2.2.2.2
4        3        3.3.3.3
5        1        10.10.10.10
6        4        4.4.4.4
7        2        20.20.20.20
8        3        3.3.3.3

In this data, user_id 1 and user_id 2 have different user_ip_address.
It should output 1 and 2

I tried:

SELECT user_ip_address AS c
FROM user_device WHERE user_ip_address IN (SELECT user_id
FROM user_device group by user_id having user_ip_address!=c)

Body:
untested:

select user_id
from (
  select user_id
  from user_device
  group by user_id, user_ip_address
)
group by user_id
having count(*) > 1

should give you in theory user_id = 1 and 2


问:
How can I solve error gypgyp ERR!ERR! find VSfind VS msvs_version not set from command line or npm config?
I want to run this project : https://github.com/adonis-china/adonis-adminify

When I run npm install, there exist error :

```<code>> sqlite3@3.1.13 install C:\laragon\www\adonis-admin\node_modules\sqlite3
> node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.13/node-v64-win32-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for sqlite3@3.1.13 and node@10.15.0 (node-v64 ABI) (falling back to source compile with node-gyp)
node-pre-gyp ERR! Tried to download(undefined): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.13/node-v64-win32-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for sqlite3@3.1.13 and node@10.15.0 (node-v64 ABI) (falling back to source compile with node-gyp)
gyp ERR! gypfind VS
 gyp ERR!ERR!  find VSfind VS
 msvs_version not set from command line or npm config
gypgyp  ERR!ERR!  find VSfind VS msvs_version not set from command line or npm config
 VCINSTALLDIR not set, not running in VS Command Prompt
gyp gypERR! ERR!  find VSfind VS VCINSTALLDIR not set, not running in VS Command Prompt
gyp checking VS2019 (16.2.29230.47) found at:
 gypERR!  find VSERR! checking VS2019 (16.2.29230.47) found at:
gyp  find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional"
ERR!gyp find VS ERR! "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional"
 gypfind VS ERR! - "Visual Studio C++ core features" missing
gyp  ERR!find VS  - "Visual Studio C++ core features" missing
find VSgyp could not find a version of Visual Studio 2017 or newer to use
 gypERR!  ERR!find VS  could not find a version of Visual Studio 2017 or newer to use
find VS looking for Visual Studio 2015
gyp gyp ERR!ERR!  find VSfind VS looking for Visual Studio 2015
 - not found
gyp gyp ERR!ERR!  find VSfind VS - not found
 not looking for VS2013 as it is only supported up to Node.js 8
gyp ERR!gyp  ERR!find VS find VS not looking for VS2013 as it is only supported up to Node.js 8

gyp gypERR!  ERR!find VS
 gypfind VS  **************************************************************
gypERR!  ERR!find VS find VS **************************************************************
 You need to install the latest version of Visual Studio
gypgyp ERR!  ERR!find VS find VS You need to install the latest version of Visual Studio
 including the "Desktop development with C++" workload.
gypgyp  ERR!ERR! find VS find VS including the "Desktop development with C++" workload.
 For more information consult the documentation at:
gyp ERR!gyp find VS  For more information consult the documentation at:
ERR!gyp  ERR! find VSfind VS https://github.com/nodejs/node-gyp#on-windows
 https://github.com/nodejs/node-gyp#on-windows
gyp gyp ERR!ERR! find VS  **************************************************************
find VSgyp **************************************************************
 gypERR! find VS
ERR! find VS
gyp gypERR!  ERR!configure error
 configure errorgyp
 ERR! stackgyp Error: Could not find any Visual Studio installation to use
 gypERR!  stackERR! Error: Could not find any Visual Studio installation to use
 stackgyp      at VisualStudioFinder.fail (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:121:47)
ERR!gyp stack      at VisualStudioFinder.fail (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:121:47)
ERR! gypstack      at findVisualStudio2013 (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:74:16)
gypERR!  ERR!stack      at findVisualStudio2013 (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:74:16)
stack     at VisualStudioFinder.findVisualStudio2013 (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:344:14)
gypgyp ERR! stack     at findVisualStudio2015 (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:70:14)
 gypERR!  ERR! stackstack     at regSearchKeys (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:365:16)
     at VisualStudioFinder.findVisualStudio2013 (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:344:14)
gyp gypERR!  ERR!stack stack     at regGetValue (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\util.js:54:7)
     at findVisualStudio2015 (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:70:14)
gypgyp  ERR!ERR!  stackstack     at C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\util.js:33:16
gyp     at regSearchKeys (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:365:16)
 gyp ERR! ERR!stack     at ChildProcess.exithandler (child_process.js:301:5)
 gypstack      at regGetValue (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\util.js:54:7)
ERR! gypstack     at ChildProcess.emit (events.js:182:13)
 gypERR! ERR!  stack     at C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\util.js:33:16
stack     at maybeClose (internal/child_process.js:962:16)
gyp gypERR! ERR!  System Windows_NT 10.0.17134
stackgyp     at ChildProcess.exithandler (child_process.js:301:5)
 ERR!gyp  commandERR! "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Chelsea\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--module=C:\\laragon\\www\\adonis-admin\\node_modules\\sqlite3\\lib\\binding\\node-v64-win32-x64\\node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=C:\\laragon\\www\\adonis-admin\\node_modules\\sqlite3\\lib\\binding\\node-v64-win32-x64" "--python=C:\\Users\\Chelsea\\.windows-build-tools\\python27\\python.exe"
 gypstack     at ChildProcess.emit (events.js:182:13)
 gypERR!  ERR!cwd C:\laragon\www\adonis-admin\node_modules\sqlite3
 gypstack ERR!     at maybeClose (internal/child_process.js:962:16)
 node -v v10.15.0
gypgyp  ERR!ERR!  Systemnode-gyp -v Windows_NT 10.0.17134
 v5.0.3
gypgyp  ERR!ERR! command  "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Chelsea\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--module=C:\\laragon\\www\\adonis-admin\\node_modules\\sqlite3\\lib\\binding\\node-v64-win32-x64\\node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=C:\\laragon\\www\\adonis-admin\\node_modules\\sqlite3\\lib\\binding\\node-v64-win32-x64" "--python=C:\\Users\\Chelsea\\.windows-build-tools\\python27\\python.exe"
not okgyp
 ERR! cwd C:\laragon\www\adonis-admin\node_modules\sqlite3
gyp ERR! node -v v10.15.0
gyp ERR! node-gyp -v v5.0.3
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\laragon\www\adonis-admin\node_modules\sqlite3\lib\binding\node-v64-win32-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=C:\laragon\www\adonis-admin\node_modules\sqlite3\lib\binding\node-v64-win32-x64 --python=C:\Users\Chelsea\.windows-build-tools\python27\python.exe' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (C:\laragon\www\adonis-admin\node_modules\sqlite3\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:962:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
node-pre-gyp ERR! System Windows_NT 10.0.17134
node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\laragon\\www\\adonis-admin\\node_modules\\sqlite3\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd C:\laragon\www\adonis-admin\node_modules\sqlite3
node-pre-gyp ERR! node -v v10.15.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.38
node-pre-gyp ERR! not ok
Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\laragon\www\adonis-admin\node_modules\sqlite3\lib\binding\node-v64-win32-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=C:\laragon\www\adonis-admin\node_modules\sqlite3\lib\binding\node-v64-win32-x64 --python=C:\Users\Chelsea\.windows-build-tools\python27\python.exe' (1)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sqlite3@3.1.13 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sqlite3@3.1.13 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Chelsea\AppData\Roaming\npm-cache\_logs\2019-09-10T22_53_41_072Z-debug.log
</code>```

How can I solve the error?

答:
I finally solved it on my end
here is how I did it

run this command on visual studio: npm config get msvs_version( mine was saying undefined)

then I run npm config set msvs_version 2022 --global(I was not seeing undefined anymore)

Then run: npm install. then I run my automation but this time I was seeing (Miscellaneous Warning SELF_SIGNED_CERT_IN_CHAIN:)

then I run set NODE_TLS_REJECT_UNAUTHORIZED=0 and voila!!! it is working

I hope this helps .it was really annoying because some of my automation file was not working

Body:
I want to run this project : https://github.com/adonis-china/adonis-adminify

When I run npm install, there exist error :

> sqlite3@3.1.13 install C:\laragon\www\adonis-admin\node_modules\sqlite3
> node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.13/node-v64-win32-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for sqlite3@3.1.13 and node@10.15.0 (node-v64 ABI) (falling back to source compile with node-gyp)
node-pre-gyp ERR! Tried to download(undefined): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.13/node-v64-win32-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for sqlite3@3.1.13 and node@10.15.0 (node-v64 ABI) (falling back to source compile with node-gyp)
gyp ERR! gypfind VS
 gyp ERR!ERR!  find VSfind VS
 msvs_version not set from command line or npm config
gypgyp  ERR!ERR!  find VSfind VS msvs_version not set from command line or npm config
 VCINSTALLDIR not set, not running in VS Command Prompt
gyp gypERR! ERR!  find VSfind VS VCINSTALLDIR not set, not running in VS Command Prompt
gyp checking VS2019 (16.2.29230.47) found at:
 gypERR!  find VSERR! checking VS2019 (16.2.29230.47) found at:
gyp  find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional"
ERR!gyp find VS ERR! "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional"
 gypfind VS ERR! - "Visual Studio C++ core features" missing
gyp  ERR!find VS  - "Visual Studio C++ core features" missing
find VSgyp could not find a version of Visual Studio 2017 or newer to use
 gypERR!  ERR!find VS  could not find a version of Visual Studio 2017 or newer to use
find VS looking for Visual Studio 2015
gyp gyp ERR!ERR!  find VSfind VS looking for Visual Studio 2015
 - not found
gyp gyp ERR!ERR!  find VSfind VS - not found
 not looking for VS2013 as it is only supported up to Node.js 8
gyp ERR!gyp  ERR!find VS find VS not looking for VS2013 as it is only supported up to Node.js 8

gyp gypERR!  ERR!find VS
 gypfind VS  **************************************************************
gypERR!  ERR!find VS find VS **************************************************************
 You need to install the latest version of Visual Studio
gypgyp ERR!  ERR!find VS find VS You need to install the latest version of Visual Studio
 including the "Desktop development with C++" workload.
gypgyp  ERR!ERR! find VS find VS including the "Desktop development with C++" workload.
 For more information consult the documentation at:
gyp ERR!gyp find VS  For more information consult the documentation at:
ERR!gyp  ERR! find VSfind VS https://github.com/nodejs/node-gyp#on-windows
 https://github.com/nodejs/node-gyp#on-windows
gyp gyp ERR!ERR! find VS  **************************************************************
find VSgyp **************************************************************
 gypERR! find VS
ERR! find VS
gyp gypERR!  ERR!configure error
 configure errorgyp
 ERR! stackgyp Error: Could not find any Visual Studio installation to use
 gypERR!  stackERR! Error: Could not find any Visual Studio installation to use
 stackgyp      at VisualStudioFinder.fail (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:121:47)
ERR!gyp stack      at VisualStudioFinder.fail (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:121:47)
ERR! gypstack      at findVisualStudio2013 (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:74:16)
gypERR!  ERR!stack      at findVisualStudio2013 (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:74:16)
stack     at VisualStudioFinder.findVisualStudio2013 (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:344:14)
gypgyp ERR! stack     at findVisualStudio2015 (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:70:14)
 gypERR!  ERR! stackstack     at regSearchKeys (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:365:16)
     at VisualStudioFinder.findVisualStudio2013 (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:344:14)
gyp gypERR!  ERR!stack stack     at regGetValue (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\util.js:54:7)
     at findVisualStudio2015 (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:70:14)
gypgyp  ERR!ERR!  stackstack     at C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\util.js:33:16
gyp     at regSearchKeys (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:365:16)
 gyp ERR! ERR!stack     at ChildProcess.exithandler (child_process.js:301:5)
 gypstack      at regGetValue (C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\util.js:54:7)
ERR! gypstack     at ChildProcess.emit (events.js:182:13)
 gypERR! ERR!  stack     at C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\util.js:33:16
stack     at maybeClose (internal/child_process.js:962:16)
gyp gypERR! ERR!  System Windows_NT 10.0.17134
stackgyp     at ChildProcess.exithandler (child_process.js:301:5)
 ERR!gyp  commandERR! "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Chelsea\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--module=C:\\laragon\\www\\adonis-admin\\node_modules\\sqlite3\\lib\\binding\\node-v64-win32-x64\\node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=C:\\laragon\\www\\adonis-admin\\node_modules\\sqlite3\\lib\\binding\\node-v64-win32-x64" "--python=C:\\Users\\Chelsea\\.windows-build-tools\\python27\\python.exe"
 gypstack     at ChildProcess.emit (events.js:182:13)
 gypERR!  ERR!cwd C:\laragon\www\adonis-admin\node_modules\sqlite3
 gypstack ERR!     at maybeClose (internal/child_process.js:962:16)
 node -v v10.15.0
gypgyp  ERR!ERR!  Systemnode-gyp -v Windows_NT 10.0.17134
 v5.0.3
gypgyp  ERR!ERR! command  "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Chelsea\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--module=C:\\laragon\\www\\adonis-admin\\node_modules\\sqlite3\\lib\\binding\\node-v64-win32-x64\\node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=C:\\laragon\\www\\adonis-admin\\node_modules\\sqlite3\\lib\\binding\\node-v64-win32-x64" "--python=C:\\Users\\Chelsea\\.windows-build-tools\\python27\\python.exe"
not okgyp
 ERR! cwd C:\laragon\www\adonis-admin\node_modules\sqlite3
gyp ERR! node -v v10.15.0
gyp ERR! node-gyp -v v5.0.3
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\laragon\www\adonis-admin\node_modules\sqlite3\lib\binding\node-v64-win32-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=C:\laragon\www\adonis-admin\node_modules\sqlite3\lib\binding\node-v64-win32-x64 --python=C:\Users\Chelsea\.windows-build-tools\python27\python.exe' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (C:\laragon\www\adonis-admin\node_modules\sqlite3\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:962:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
node-pre-gyp ERR! System Windows_NT 10.0.17134
node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\laragon\\www\\adonis-admin\\node_modules\\sqlite3\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd C:\laragon\www\adonis-admin\node_modules\sqlite3
node-pre-gyp ERR! node -v v10.15.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.38
node-pre-gyp ERR! not ok
Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\Chelsea\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\laragon\www\adonis-admin\node_modules\sqlite3\lib\binding\node-v64-win32-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=C:\laragon\www\adonis-admin\node_modules\sqlite3\lib\binding\node-v64-win32-x64 --python=C:\Users\Chelsea\.windows-build-tools\python27\python.exe' (1)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sqlite3@3.1.13 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sqlite3@3.1.13 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Chelsea\AppData\Roaming\npm-cache\_logs\2019-09-10T22_53_41_072Z-debug.log

How can I solve the error?


问:
Flutter app crashes on startup on Android 12
I have published an app on Google Play and it is being used regularly. In the last update, I have released updated both, compileSdkVersion and targetSdkVersion to 31.

I have seen that users with an Android version less than 12 do not have any issues with the app, while those with an Android version 12 are facing an app crash whenever they try to open the app.

This is the message I get from Google Play Store:

Did anyone face a similar problem? Would appreciate any suggestion!

答:
I have resolved the issue. Here is what I did:

I have added android:exported="true" in my AndroidManifest.xml to all activities, services, or broadcast receivers that use intent filters

I have added implementation 'androidx.work:work-runtime-ktx:2.7.0' in the dependencies section of my app level build.gradle (android/app/build.gradle)

After that my app was working regularly on Android 12 and these changes did not affect the lower Android versions


问:
geom_text change factor order of facet plot
I am trying annotate individual plots of a facet plot. I have set the order to 2008, 1999 using factor levels.
But when I add the geom_text to the ggplot, the order of the plots change. See examples below. What am I doing wrong? How can I solve this?

```<code>library(tidyverse)

df <- mpg %>% mutate(year = factor(year, levels = c(2008,1999)))

anno <- data.frame(xstar = c(5, 2), ystar = c(100, 70),
                   lab = c("text1","text2"),
                   year = c("2008","1999"))

df %>%  ggplot(aes(class, displ)) +
  geom_col(aes(fill=drv)) +
  facet_grid(~year) +
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1)) +
  geom_text(data = anno, aes(x = xstar,  y = ystar, label = lab))
</code>```

答:
Convert the year column in your annotation dataframe also to a factor with the same levels and order as in your main df:

library(ggplot2)

df <- mpg
df$year = factor(df$year, levels = c(2008, 1999))

anno <- data.frame(
  xstar = c(5, 2), ystar = c(100, 70),
  lab = c("text1", "text2"),
  year = factor(c("2008", "1999"), levels = c(2008, 1999))
)

ggplot(df, aes(class, displ)) +
  geom_col(aes(fill = drv)) +
  geom_text(data = anno, aes(x = xstar, y = ystar, label = lab)) +
  facet_grid(~year) +
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust = 1))
```

Body:
I am trying annotate individual plots of a facet plot. I have set the order to 2008, 1999 using factor levels.
But when I add the geom_text to the ggplot, the order of the plots change. See examples below. What am I doing wrong? How can I solve this?

library(tidyverse)

df <- mpg %>% mutate(year = factor(year, levels = c(2008,1999)))

anno <- data.frame(xstar = c(5, 2), ystar = c(100, 70),
                   lab = c("text1","text2"),
                   year = c("2008","1999"))

df %>%  ggplot(aes(class, displ)) +
  geom_col(aes(fill=drv)) +
  facet_grid(~year) +
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1)) +
  geom_text(data = anno, aes(x = xstar,  y = ystar, label = lab))