问:
CSS transition property for changing background image not working
I'm trying to change a background image on hover with the transition property to make it smoother, but it isn't working. Here's what I have. It's usually enough for this to work.</p>
```<code>    #c8 {
    width: 30%;
    height: 300px;
    background-image: url(../imgs/image1.jpg);
    background-size:cover;
    background-repeat: no-repeat;
    border-radius: 20px;
    transition: 0.4s;
}

#c8:hover {
    background-image: url(../imgs/image2.jpg);
}
</code>```

Body:
I'm trying to change a background image on hover with the transition property to make it smoother, but it isn't working. Here's what I have. It's usually enough for this to work.

    #c8 {
    width: 30%;
    height: 300px;
    background-image: url(../imgs/image1.jpg);
    background-size:cover;
    background-repeat: no-repeat;
    border-radius: 20px;
    transition: 0.4s;
}

#c8:hover {
    background-image: url(../imgs/image2.jpg);
}


来源: stackexchange

问:
Spyder extremely lags when exploring GeoDataFrame of a shapefile
I do a simple tutorial on geopandas.

When I try to explore GeoDataFrame and scroll to "geometry" column, my IDE starts to lag extremely and my program almost crashes.
The only thing I have loaded in my IDE is one shapefile with polygons representing countries.
I run spyder as administrator.

What might be the issue?

"brak odpowiedzi" means "program is not responding" after I tried to scroll down a bit or do anything.

ContentLicense: CC BY-SA 4.0


问:
Scrambling variables and inserting them into file c++
I am creating a c++ quiz maker which offers a user the ability to insert different types of questions and answers and it inserts all that info into a neat file. The whole code is here. My issue is that after gathering input to create a 'connect the word to definition' I do not know how I would scramble the variables of each word and definition to print out something like this:

1.) Connect the definitions to the word.

```<code>Astronaut                An expert of automobiles.
Mechanic                 An individual that has been to space.
Pilot                    An individual who is knows about electronics.
Electronic engineer      An individual who is skilled in flying planes.
</code>```
```<code>void connectDefinitions() {
    fstream file;

    if (!file) {
        cout << "Error when opening file.";
    }

    file.open("quiz.txt", ios::app);

    if (file.is_open()) {
        counter = 0;

        file << current_numbered_question
             << ".) Connect the definitions to the word.";
        file << "\n\n";

        while (counter != 4) {
            cout << "What is the word you would like to add?\n";
            cin.ignore();
            file << "\n\n";
            getline(cin, user_word);

            cout << "What is the definition of the word you added?\n\n";
            cin.ignore();
            file << "\n\n";
            getline(cin, user_def);

            if (counter == 0) {
                connectword1 = user_word;
                connectdef1 = user_def;
            }
            if (counter == 1) {
                connectword2 = user_word;
                connectdef2 = user_def;
            }
            if (counter == 2) {
                connectword3 = user_word;
                connectdef3 = user_def;
            }
            if (counter == 3) {
                connectword4 = user_word;
                connectdef4 = user_def;
            }

            counter++;
        }
    }
    return;
}
</code>```

Body:
I am creating a c++ quiz maker which offers a user the ability to insert different types of questions and answers and it inserts all that info into a neat file. The whole code is here. My issue is that after gathering input to create a 'connect the word to definition' I do not know how I would scramble the variables of each word and definition to print out something like this:

1.) Connect the definitions to the word.

Astronaut                An expert of automobiles.
Mechanic                 An individual that has been to space.
Pilot                    An individual who is knows about electronics.
Electronic engineer      An individual who is skilled in flying planes.

void connectDefinitions() {
    fstream file;

    if (!file) {
        cout << "Error when opening file.";
    }

    file.open("quiz.txt", ios::app);

    if (file.is_open()) {
        counter = 0;

        file << current_numbered_question
             << ".) Connect the definitions to the word.";
        file << "\n\n";

        while (counter != 4) {
            cout << "What is the word you would like to add?\n";
            cin.ignore();
            file << "\n\n";
            getline(cin, user_word);

            cout << "What is the definition of the word you added?\n\n";
            cin.ignore();
            file << "\n\n";
            getline(cin, user_def);

            if (counter == 0) {
                connectword1 = user_word;
                connectdef1 = user_def;
            }
            if (counter == 1) {
                connectword2 = user_word;
                connectdef2 = user_def;
            }
            if (counter == 2) {
                connectword3 = user_word;
                connectdef3 = user_def;
            }
            if (counter == 3) {
                connectword4 = user_word;
                connectdef4 = user_def;
            }

            counter++;
        }
    }
    return;
}


问:
vue -v: command not found (git bash)
For some reason my terminal git bash can't see the version of installed packages of vue and normalize.css. That is what it shows:
vue -v
bash: vue: command not found

Webpack version it does see. In package.json these dependencies are written. The path is correct as far as I understand.. Help :(

(https://i.stack.imgur.com/4jiQR.png)

(https://i.stack.imgur.com/sqfZC.png)

......................

Title: vue -v: command not found (git bash)


问:
Can TypeScript understand which return type is valid for overloaded function with union return type?
I am trying to figure out a way to get the following function to show an error when returning a number, when based on the function overload the return type should be a string. I know the return type of the implementation function is string | number, but I was hoping TypeScript could use the function overloads to tell me when if I return the wrong type by narrowing down what the return type could be. As it is here, in a longer function, it seems too easy to return the wrong type be accident.

```<code>function getValue(returnString: true): string;
function getValue(returnString: false): number;
function getValue(returnString: boolean): string | number {
    if (returnString) {
        return 7; // No error
    }

    return 7;
}
</code>```

Link to playground.

Body:
I am trying to figure out a way to get the following function to show an error when returning a number, when based on the function overload the return type should be a string. I know the return type of the implementation function is string | number, but I was hoping TypeScript could use the function overloads to tell me when if I return the wrong type by narrowing down what the return type could be. As it is here, in a longer function, it seems too easy to return the wrong type be accident.

function getValue(returnString: true): string;
function getValue(returnString: false): number;
function getValue(returnString: boolean): string | number {
    if (returnString) {
        return 7; // No error
    }

    return 7;
}

Link to playground.


问:
How to convert a "for loop" in rxjava 3
I try to convert this code in rx java

```<code>
    List<String> pathInArray = new ArrayList<>(Arrays.asList(leChemin.split("/")));
    pathInArray.remove(0);

    List<Folder> foldersFromDB = new ArrayList<>();
    Folder current = dao.getRootFolderFromDB(pathInArray.size());

    for (String folderName : pathInArray)
    {
      current = dao.getFolderByNameFromDB(folderName, current.getId());
      foldersFromDB.add(current);
    }
</code>```

I do it with Observable.fromStream but i've the problem with "current" that is not updated fron an iteration to the next...

Any idea ?

I 've done this code but it's not very relevent

```<code>Observable
          .fromStream(leCheminParse.stream())
          .flatMapSingle(nomDuRepertoire ->
          {
            dao.getDaoFolder()
                .getFolderByName(nomDuRepertoire, fs.get(fs.size()-1).getId(), safeId)
                .doOnSuccess(f1 ->
                {
                  logger.debug("---------------folder = {}", f1);
                  fs.add(f1);
                })
                .flatMap(f2 ->
                {
                  return
                      dao.getDaoFolder()
                      .getFolderByName(nomDuRepertoire, f2.getId(), safeId);
                })
                .flatMap(f3 ->
                {

                })

              ;

//            return List.of();
            return Single.just("");
          })
</code>```

Title: How to convert a "for loop" in rxjava 3

Body:
I try to convert this code in rx java

    List<String> pathInArray = new ArrayList<>(Arrays.asList(leChemin.split("/")));
    pathInArray.remove(0);

    List<Folder> foldersFromDB = new ArrayList<>();
    Folder current = dao.getRootFolderFromDB(pathInArray.size());

    for (String folderName : pathInArray)
    {
      current = dao.getFolderByNameFromDB(folderName, current.getId());
      foldersFromDB.add(current);
    }

I do it with Observable.fromStream but i've the problem with "current" that is not updated fron an iteration to the next...

Any idea ?

I 've done this code but it's not very relevent

Observable
          .fromStream(leCheminParse.stream())
          .flatMapSingle(nomDuRepertoire ->
          {
            dao.getDaoFolder()
                .getFolderByName(nomDuRepertoire, fs.get(fs.size()-1).getId(), safeId)
                .doOnSuccess(f1 ->
                {
                  logger.debug("---------------folder = {}", f1);
                  fs.add(f1);
                })
                .flatMap(f2 ->
                {
                  return
                      dao.getDaoFolder()
                      .getFolderByName(nomDuRepertoire, f2.getId(), safeId);
                })
                .flatMap(f3 ->
                {

                })

              ;

//            return List.of();
            return Single.just("");
          })


问:
Add ACL to Spring log file after logback rotates it
Our Spring Boot application generates a log file using logback based on activity within the OpenID Connect authentication module. This file is read by Splunk Universal Forwarder for aggregation on a central server. The "splunk" user is not in the same group as the application user, so an ACL is installed on the log file and its parent directory to allow splunk to read the file.

Just recently the log was rotated by logback as configured. It appears this action creates a new file and renames and compresses the existing one. As a result the ACL on the log file is destroyed, making it impossible for splunk to read it. This raises alarms at the Splunk central server.

Is there any way to make logback re-create the ACL on the log file during rotation, or failing that, to trigger a shell script to do so?

I've not attempted to do anything on this because I don't know what is possible to do within the Spring logback framework. But we need this to happen before the log rotates next time.

ACLs are created from the shell:
setfacl -m user:splunk:r-x spring_audit.log


问:
PHPUnit test returning null at each index of array
I am testing a function in PHP that sorts modules by their marks in descending order where it takes in an array of the module names and another array of the module marks. However, when I am testing it, it returns null at each index of the array.

For example, here is my Unit test:

```<code>public function testCorrect()
{
    $this->assertEquals(["Computer Science",60,"Religion",50, "English",40, "Business",30, "Maths",20],
    getSortedModules(["Maths","Business","English","Religion","Computer Science"],[20,30,40,50,60]));
}
</code>```

I don't get the expected return but instead get:

```<code>+    0 => Array (...)
+    1 => Array (...)
+    2 => Array (...)
+    3 => Array (...)
+    4 => Array (...)
</code>```

The function getSortedModules seems to work correctly in the frontend of my system but the code for it is:

```<code>function getSortedModules($modules, $marks)
{
$module_marks = array();
for ($i = 0; $i < count($modules); $i++) {
  $module_marks_array = array("module"=>$modules[$i], "marks"=>$marks[$i]);
  array_push($module_marks,$module_marks_array);
}
usort($module_marks, function($a, $b) {
      return $b['marks'] <=> $a['marks'];
});

return $module_marks;
}
</code>```

Body:
I am testing a function in PHP that sorts modules by their marks in descending order where it takes in an array of the module names and another array of the module marks. However, when I am testing it, it returns null at each index of the array.

For example, here is my Unit test:

public function testCorrect()
{
    $this->assertEquals(["Computer Science",60,"Religion",50, "English",40, "Business",30, "Maths",20],
    getSortedModules(["Maths","Business","English","Religion","Computer Science"],[20,30,40,50,60]));
}

I don't get the expected return but instead get:

+    0 => Array (...)
+    1 => Array (...)
+    2 => Array (...)
+    3 => Array (...)
+    4 => Array (...)

The function getSortedModules seems to work correctly in the frontend of my system but the code for it is:

function getSortedModules($modules, $marks)
{
$module_marks = array();
for ($i = 0; $i < count($modules); $i++) {
  $module_marks_array = array("module"=>$modules[$i], "marks"=>$marks[$i]);
  array_push($module_marks,$module_marks_array);
}
usort($module_marks, function($a, $b) {
      return $b['marks'] <=> $a['marks'];
});

return $module_marks;
}


问:
styled-components error on build if css is invalid
We recently had a slip through into prod where invalid css caused some funky errors in styling. Thanks to vscode-styled-components, this showed in our IDE where the issue was.

I would like this to be part of our build process in webpack if possible, so that the build fails if invalid styled-components css is detected. Is something like this possible? I've tried adding a few plugins but these seem to just be for transpiling, not for checking.


问:
Could not determine type for: pl.Domain.Series, at table: origin, for columns: [org.hibernate.mapping.Column(series)]
I'm using Hibernate for all CRUD operations in my project. It doesn't work for One-To-Many and Many-To-One relationships. It gives me the below error. I followed several stackoverflows problems like that, but still cannot figure it out.

```<code>Caused by: javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.MappingException: Could not determine type for: pl.Domain.Series, at table: origin, for columns: [org.hibernate.mapping.Column(series)]
</code>```

Series.java

```<code>@Entity
public class Series {
    @Id
    @GeneratedValue(strategy=GenerationType.AUTO)
    private Long id;
    private String series_name;

    private String director_name;

    private String year;

    @OneToMany(targetEntity=Origin.class, mappedBy="series",cascade =CascadeType.ALL)
    private List<Origin> origins;
    public List<Origin> getOrigins() {
        return origins;
    }

    public void setOrigins(List<Origin> origins) {
        this.origins = origins;
    }
</code>```

Origin.java

```<code>@Entity
public class Origin {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private int originId;
    private String originName;

    private Series series;
    @ManyToOne
    @JoinColumn(name="id")
    public Series getSeries() {
        return series;
    }
    public void setSeries(Series series) {
        this.series = series;
    }

    public int getOriginId() {
        return originId;
    }

}
</code>```

Body:
I'm using Hibernate for all CRUD operations in my project. It doesn't work for One-To-Many and Many-To-One relationships. It gives me the below error. I followed several stackoverflows problems like that, but still cannot figure it out.

Caused by: javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.MappingException: Could not determine type for: pl.Domain.Series, at table: origin, for columns: [org.hibernate.mapping.Column(series)]

Series.java

@Entity
public class Series {
    @Id
    @GeneratedValue(strategy=GenerationType.AUTO)
    private Long id;
    private String series_name;

    private String director_name;

    private String year;

    @OneToMany(targetEntity=Origin.class, mappedBy="series",cascade =CascadeType.ALL)
    private List<Origin> origins;
    public List<Origin> getOrigins() {
        return origins;
    }

    public void setOrigins(List<Origin> origins) {
        this.origins = origins;
    }

Origin.java

@Entity
public class Origin {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private int originId;
    private String originName;

    private Series series;
    @ManyToOne
    @JoinColumn(name="id")
    public Series getSeries() {
        return series;
    }
    public void setSeries(Series series) {
        this.series = series;
    }

    public int getOriginId() {
        return originId;
    }

}


问:
Use Spring converter in integration test
When running my tests, I get the following exception:
Cannot convert value of type 'java.lang.String' to required type 'OrderCriteria' for property 'order[0]': no matching editors or conversion strategy found]

I realized that's because I am not adding my custom converter in the integration tests.

I looked around a bit and I've come across this answer, where they explain how to add any converter into your tests, this is the piece of code in question:

```<code>this.mockMvc = MockMvcBuilders.standaloneSetup(getController())
        .setConversionService(formattingConversionService) // Add it to mockito
        .build();
</code>```

My problem is that I am not using a standaloneSetup, instead I'm using a webAppContext:

```<code>mvc = MockMvcBuilders.webAppContextSetup(context).build()
</code>```

But I can't find a way to add or set a conversion service into it.

Does anyone have a hint on this?

Body:
When running my tests, I get the following exception:
Cannot convert value of type 'java.lang.String' to required type 'OrderCriteria' for property 'order[0]': no matching editors or conversion strategy found]

I realized that's because I am not adding my custom converter in the integration tests.

I looked around a bit and I've come across this answer, where they explain how to add any converter into your tests, this is the piece of code in question:

this.mockMvc = MockMvcBuilders.standaloneSetup(getController())
        .setConversionService(formattingConversionService) // Add it to mockito
        .build();

My problem is that I am not using a standaloneSetup, instead I'm using a webAppContext:

mvc = MockMvcBuilders.webAppContextSetup(context).build()

But I can't find a way to add or set a conversion service into it.

Does anyone have a hint on this?


问:
Can't access to mi local server through WAN router ip
I´ve set up a port forward from my router to my web server running locally, but when I try to access to my web server from another network it doesn't work. It just works locally.The pc firewall is deactivated as well as the router's. Someone knows why is this problem caused?


问:
Build DAG using edges and nodes from networkx
I have trouble to build defining Node object to build a graph from networkx. For example, the code is

```<code>class Node:
    def __init__(self, nid=None, val=0, neighbors=[]):
        self.id = nid
        self.val = val
        self.neighbors = neighbors

G = nx.DiGraph()
G.add_nodes_from([("s1", {"val": 5}), ("s2", {"val": 10}), ("s3", {"val": 15})])
G.add_edges_from([("s1", "s2"), ("s2", "s3")])
</code>```

G is a networkX graph, and list(G.nodes), list(G.edges) gave

```<code>[('s1', {'val': 5}), ('s2', {'val': 10}), ('s3', {'val': 15})],
[('s1', 's2'), ('s2', 's3')]
</code>```

Everything looks fine so far. But if I used

```<code>def make_graph(G):

    nodes = {}
    for n in G.nodes.data():
        nodes[n[0]] = Node(nid=n[0], val=n[1]["latency"])

    for n1, n2 in G.edges:
        nodes[n1].neighbors.append(nodes[n2])

    return nodes
</code>```

and then check both nodes["s1"], nodes["s3"] has 3 neighbors (suppose only "s2" for "s1", and no neighbor for "s3")

```<code>print ([x.id for x in list(nodes["s1"].neighbors)], [x.id for x in list(nodes["s3"].neighbors)])
['s2', 's3'] ['s2', 's3']
</code>```

What is the bug here? When I run over all edges, it pushes the neighbors for all nodes?

Thank you for your help!!

Body:
I have trouble to build defining Node object to build a graph from networkx. For example, the code is

class Node:
    def __init__(self, nid=None, val=0, neighbors=[]):
        self.id = nid
        self.val = val
        self.neighbors = neighbors

G = nx.DiGraph()
G.add_nodes_from([("s1", {"val": 5}), ("s2", {"val": 10}), ("s3", {"val": 15})])
G.add_edges_from([("s1", "s2"), ("s2", "s3")])

G is a networkX graph, and list(G.nodes), list(G.edges) gave

[('s1', {'val': 5}), ('s2', {'val': 10}), ('s3', {'val': 15})],
[('s1', 's2'), ('s2', 's3')]

Everything looks fine so far. But if I used

def make_graph(G):

    nodes = {}
    for n in G.nodes.data():
        nodes[n[0]] = Node(nid=n[0], val=n[1]["latency"])

    for n1, n2 in G.edges:
        nodes[n1].neighbors.append(nodes[n2])

    return nodes

and then check both nodes["s1"], nodes["s3"] has 3 neighbors (suppose only "s2" for "s1", and no neighbor for "s3")

print ([x.id for x in list(nodes["s1"].neighbors)], [x.id for x in list(nodes["s3"].neighbors)])
['s2', 's3'] ['s2', 's3']

What is the bug here? When I run over all edges, it pushes the neighbors for all nodes?

Thank you for your help!!


问:
How to style SwiftUI calendar events with rounded rectangle border
How can I achieve this:

I'm using https://github.com/GGJJack/SwiftUICalendar as a calendar base and each day is a separate view. How can I draw such borders based on that if the date is begin, middle or end of event.


问:
android studio emulator hangs on startup on m1
I'm trying to run Android Studio emulator version 31.3.13.0 on MacOS 12.5.1 with M1. The emulator hangs with no error message after the following lines:

```<code>~/Library/Android/sdk/emulator$ ./emulator -avd Pixel_5_API_33 -verbose -show-kernel
INFO    | Android emulator version 31.3.13.0 (build_id 9189900) (CL:N/A)
INFO    | Found AVD name 'Pixel_5_API_33'
INFO    | Found AVD target architecture: arm64
INFO    | argv[0]: './emulator'; program directory: '/Users/x/Library/Android/sdk/emulator'
VERBOSE |  Found directory: /Users/x/Library/Android/sdk/system-images/android-33/google_apis/arm64-v8a/
emulator: INFO: Found systemPath /Users/x/Library/Android/sdk/system-images/android-33/google_apis/arm64-v8a/
INFO    | emuDirName: '/Users/x/Library/Android/sdk/emulator'
INFO    | try dir /Users/x/Library/Android/sdk/emulator
INFO    | Trying emulator path '/Users/x/Library/Android/sdk/emulator/qemu/darwin-aarch64/qemu-system-aarch64'
INFO    | Found target-specific 64-bit emulator binary: /Users/x/Library/Android/sdk/emulator/qemu/darwin-aarch64/qemu-system-aarch64
INFO    | Adding library search path: '/Users/x/Library/Android/sdk/emulator/lib64'
INFO    | Adding library search path: '/Users/x/Library/Android/sdk/emulator/lib64/gles_angle'
INFO    | Adding library search path: '/Users/x/Library/Android/sdk/emulator/lib64/gles_angle9'
INFO    | Adding library search path: '/Users/x/Library/Android/sdk/emulator/lib64/gles_angle11'
VERBOSE | Adding library search path for Qt: '/Users/x/Library/Android/sdk/emulator/lib64/qt/lib'
VERBOSE | Silencing all qWarning(); use qCWarning(...) instead: QT_LOGGING_RULES=default.warning=false
VERBOSE | Setting Qt plugin search path: QT_QPA_PLATFORM_PLUGIN_PATH=/Users/x/Library/Android/sdk/emulator/lib64/qt/plugins
VERBOSE | Setting Qt to use software OpenGL: QT_OPENGL=software
VERBOSE | Setting QML to use software QtQuick2D: QMLSCENE_DEVICE=softwarecontext
VERBOSE | Overriding pre-existing bad Qt high dpi settings...
VERBOSE | emulator: Running :/Users/x/Library/Android/sdk/emulator/qemu/darwin-aarch64/qemu-system-aarch64
VERBOSE | qemu backend: argv[00] = "/Users/x/Library/Android/sdk/emulator/qemu/darwin-aarch64/qemu-system-aarch64"
VERBOSE | qemu backend: argv[01] = "-avd"
VERBOSE | qemu backend: argv[02] = "Pixel_5_API_33"
VERBOSE | qemu backend: argv[03] = "-verbose"
VERBOSE | qemu backend: argv[04] = "-show-kernel"
VERBOSE | Concatenated backend parameters:  /Users/x/Library/Android/sdk/emulator/qemu/darwin-aarch64/qemu-system-aarch64 -avd Pixel_5_API_33 -verbose -show-kernel
</code>```

Any help would be appreciated.

Body:
I'm trying to run Android Studio emulator version 31.3.13.0 on MacOS 12.5.1 with M1. The emulator hangs with no error message after the following lines:

~/Library/Android/sdk/emulator$ ./emulator -avd Pixel_5_API_33 -verbose -show-kernel
INFO    | Android emulator version 31.3.13.0 (build_id 9189900) (CL:N/A)
INFO    | Found AVD name 'Pixel_5_API_33'
INFO    | Found AVD target architecture: arm64
INFO    | argv[0]: './emulator'; program directory: '/Users/x/Library/Android/sdk/emulator'
VERBOSE |  Found directory: /Users/x/Library/Android/sdk/system-images/android-33/google_apis/arm64-v8a/
emulator: INFO: Found systemPath /Users/x/Library/Android/sdk/system-images/android-33/google_apis/arm64-v8a/
INFO    | emuDirName: '/Users/x/Library/Android/sdk/emulator'
INFO    | try dir /Users/x/Library/Android/sdk/emulator
INFO    | Trying emulator path '/Users/x/Library/Android/sdk/emulator/qemu/darwin-aarch64/qemu-system-aarch64'
INFO    | Found target-specific 64-bit emulator binary: /Users/x/Library/Android/sdk/emulator/qemu/darwin-aarch64/qemu-system-aarch64
INFO    | Adding library search path: '/Users/x/Library/Android/sdk/emulator/lib64'
INFO    | Adding library search path: '/Users/x/Library/Android/sdk/emulator/lib64/gles_angle'
INFO    | Adding library search path: '/Users/x/Library/Android/sdk/emulator/lib64/gles_angle9'
INFO    | Adding library search path: '/Users/x/Library/Android/sdk/emulator/lib64/gles_angle11'
VERBOSE | Adding library search path for Qt: '/Users/x/Library/Android/sdk/emulator/lib64/qt/lib'
VERBOSE | Silencing all qWarning(); use qCWarning(...) instead: QT_LOGGING_RULES=default.warning=false
VERBOSE | Setting Qt plugin search path: QT_QPA_PLATFORM_PLUGIN_PATH=/Users/x/Library/Android/sdk/emulator/lib64/qt/plugins
VERBOSE | Setting Qt to use software OpenGL: QT_OPENGL=software
VERBOSE | Setting QML to use software QtQuick2D: QMLSCENE_DEVICE=softwarecontext
VERBOSE | Overriding pre-existing bad Qt high dpi settings...
VERBOSE | emulator: Running :/Users/x/Library/Android/sdk/emulator/qemu/darwin-aarch64/qemu-system-aarch64
VERBOSE | qemu backend: argv[00] = "/Users/x/Library/Android/sdk/emulator/qemu/darwin-aarch64/qemu-system-aarch64"
VERBOSE | qemu backend: argv[01] = "-avd"
VERBOSE | qemu backend: argv[02] = "Pixel_5_API_33"
VERBOSE | qemu backend: argv[03] = "-verbose"
VERBOSE | qemu backend: argv[04] = "-show-kernel"
VERBOSE | Concatenated backend parameters:  /Users/x/Library/Android/sdk/emulator/qemu/darwin-aarch64/qemu-system-aarch64 -avd Pixel_5_API_33 -verbose -show-kernel

Any help would be appreciated.


问:
Problem in my R code when plugging inputs back onto my dataset, they are under the wrong columns
Using RStudio
After running a my code and inputting an example/test of variables, the variables are not inputted into the right rows in my dataset.

I was given a data set that already had 15 already completed sets of data, I had to write a code to input certain variables.  Which is shown below.
The inputted data does not show up in the right columns.

```<code>read.csv("MontrealDogs.csv", header = T, stringsAsFactors = FALSE)

# Create the data frame
MontrealDogs <- "MontrealDogs.csv"(
  DogName = character(),
  LicenceNumber = numeric(),
  Breed = character(),
  Sex = character(),
  OwnerName = character(),
  OwnerPhone = numeric(),
  BitingRecord = logical()
)

# Issue a license
Issue <- function(MontrealDogs, DogName, OwnerName, Breed, Sex, OwnerPhone){
  LicenceNumber <- max(MontrealDogs$LicenceNumber) + 12
  BitingRecord <- FALSE
  MontrealDogs <- rbind(MontrealDogs,
                         c(DogName, LicenceNumber, Breed, Sex, OwnerName, OwnerPhone, BitingRecord))
  print(paste("The new licence number is", LicenceNumber))
  return(MontrealDogs)
}

# Query
Query <- function(MontrealDogs, LicenceNumber){
  if (LicenceNumber %in% MontrealDogs$LicenceNumber){
    OwnerName <- MontrealDogs$OwnerName[MontrealDogs$LicenceNumber == LicenceNumber]
    OwnerPhone <- MontrealDogs$OwnerPhone[MontrealDogs$LicenceNumber == LicenceNumber]
    print(paste0("The owner's name is ", OwnerName, " and the phone number is ", OwnerPhone))
  } else {
    print("The dog stays at the SPCA until the owner picks it up and gets a licence.")
  }
}

# Delete a licence
Delete <- function(MontrealDogs, LicenceNumber){
  MontrealDogs <- MontrealDogs[MontrealDogs$LicenceNumber != LicenceNumber, ]
  return(MontrealDogs)
}

# Report crime
Report <- function(MontrealDogs, OwnerName, DogName){
  if (OwnerName %in% MontrealDogs$OwnerName & DogName %in% MontrealDogs$DogName){
    BitingRecord <- TRUE
    MontrealDogs$BitingRecord[MontrealDogs$OwnerName == OwnerName] <- BitingRecord
  }
  return(MontrealDogs)
}

# List biters
List <- function(MontrealDogs){
  Biters <- MontrealDogs[MontrealDogs$BitingRecord == TRUE, ]
  print(Biters)
}

# Main program
# Read in the MontrealDogs.csv file
MontrealDogs <- read.csv("MontrealDogs.csv", header = TRUE, stringsAsFactors = FALSE)

# Outermost portion of the main program
quit <- FALSE
while(quit == FALSE){
  command <- readline(prompt = "Please enter a command (Issue, Query, Delete, Report, List, Quit): ")
  if (command == "Issue"){
    DogName <- readline(prompt = "Please enter the dog's name: ")
    OwnerName <- readline(prompt = "Please enter the owner's name: ")
    Breed <- readline(prompt = "Please enter the breed: ")
    Sex <- readline(prompt = "Please enter the sex (F/M): ")
    OwnerPhone <- readline(prompt = "Please enter the owner's phone number: ")
    MontrealDogs <- Issue(MontrealDogs, DogName, OwnerName, Breed, Sex, OwnerPhone)
  } else if (command == "Query"){
    LicenceNumber <- readline(prompt = "Please enter the licence number: ")
    Query(MontrealDogs, LicenceNumber)
  } else if (command == "Delete"){
    LicenceNumber <- readline(prompt = "Please enter the licence number: ")
    MontrealDogs <- Delete(MontrealDogs, LicenceNumber)
  } else if (command == "Report"){
    OwnerName <- readline(prompt = "Please enter the owner's name: ")
    DogName <- readline(prompt = "Please enter the dog's name: ")
    MontrealDogs <- Report(MontrealDogs, OwnerName, DogName)
  } else if (command == "List"){
    List(MontrealDogs)
  } else if (command == "Quit"){
    quit <- TRUE
  }
}

# Write out the dog database as a .csv file
write.csv(MontrealDogs, "MontrealDogs.csv")

</code>```

As shown in my dataset, I used titles with examples to show what I had inputted but they are clearly not under the right columns and I do not know how to fix this.
Any help would be greatly appreciated :)

Thank you!

I cannot really know how to get the correct inputted variables in the correct columns.

Body:
Using RStudio
After running a my code and inputting an example/test of variables, the variables are not inputted into the right rows in my dataset.

I was given a data set that already had 15 already completed sets of data, I had to write a code to input certain variables.  Which is shown below.
The inputted data does not show up in the right columns.

read.csv("MontrealDogs.csv", header = T, stringsAsFactors = FALSE)

# Create the data frame
MontrealDogs <- "MontrealDogs.csv"(
  DogName = character(),
  LicenceNumber = numeric(),
  Breed = character(),
  Sex = character(),
  OwnerName = character(),
  OwnerPhone = numeric(),
  BitingRecord = logical()
)

# Issue a license
Issue <- function(MontrealDogs, DogName, OwnerName, Breed, Sex, OwnerPhone){
  LicenceNumber <- max(MontrealDogs$LicenceNumber) + 12
  BitingRecord <- FALSE
  MontrealDogs <- rbind(MontrealDogs,
                         c(DogName, LicenceNumber, Breed, Sex, OwnerName, OwnerPhone, BitingRecord))
  print(paste("The new licence number is", LicenceNumber))
  return(MontrealDogs)
}

# Query
Query <- function(MontrealDogs, LicenceNumber){
  if (LicenceNumber %in% MontrealDogs$LicenceNumber){
    OwnerName <- MontrealDogs$OwnerName[MontrealDogs$LicenceNumber == LicenceNumber]
    OwnerPhone <- MontrealDogs$OwnerPhone[MontrealDogs$LicenceNumber == LicenceNumber]
    print(paste0("The owner's name is ", OwnerName, " and the phone number is ", OwnerPhone))
  } else {
    print("The dog stays at the SPCA until the owner picks it up and gets a licence.")
  }
}

# Delete a licence
Delete <- function(MontrealDogs, LicenceNumber){
  MontrealDogs <- MontrealDogs[MontrealDogs$LicenceNumber != LicenceNumber, ]
  return(MontrealDogs)
}

# Report crime
Report <- function(MontrealDogs, OwnerName, DogName){
  if (OwnerName %in% MontrealDogs$OwnerName & DogName %in% MontrealDogs$DogName){
    BitingRecord <- TRUE
    MontrealDogs$BitingRecord[MontrealDogs$OwnerName == OwnerName] <- BitingRecord
  }
  return(MontrealDogs)
}

# List biters
List <- function(MontrealDogs){
  Biters <- MontrealDogs[MontrealDogs$BitingRecord == TRUE, ]
  print(Biters)
}

# Main program
# Read in the MontrealDogs.csv file
MontrealDogs <- read.csv("MontrealDogs.csv", header = TRUE, stringsAsFactors = FALSE)

# Outermost portion of the main program
quit <- FALSE
while(quit == FALSE){
  command <- readline(prompt = "Please enter a command (Issue, Query, Delete, Report, List, Quit): ")
  if (command == "Issue"){
    DogName <- readline(prompt = "Please enter the dog's name: ")
    OwnerName <- readline(prompt = "Please enter the owner's name: ")
    Breed <- readline(prompt = "Please enter the breed: ")
    Sex <- readline(prompt = "Please enter the sex (F/M): ")
    OwnerPhone <- readline(prompt = "Please enter the owner's phone number: ")
    MontrealDogs <- Issue(MontrealDogs, DogName, OwnerName, Breed, Sex, OwnerPhone)
  } else if (command == "Query"){
    LicenceNumber <- readline(prompt = "Please enter the licence number: ")
    Query(MontrealDogs, LicenceNumber)
  } else if (command == "Delete"){
    LicenceNumber <- readline(prompt = "Please enter the licence number: ")
    MontrealDogs <- Delete(MontrealDogs, LicenceNumber)
  } else if (command == "Report"){
    OwnerName <- readline(prompt = "Please enter the owner's name: ")
    DogName <- readline(prompt = "Please enter the dog's name: ")
    MontrealDogs <- Report(MontrealDogs, OwnerName, DogName)
  } else if (command == "List"){
    List(MontrealDogs)
  } else if (command == "Quit"){
    quit <- TRUE
  }
}

# Write out the dog database as a .csv file
write.csv(MontrealDogs, "MontrealDogs.csv")

As shown in my dataset, I used titles with examples to show what I had inputted but they are clearly not under the right columns and I do not know how to fix this.
Any help would be greatly appreciated :)

Thank you!

I cannot really know how to get the correct inputted variables in the correct columns.


问:
Use "Environment" for deployment with GitHub Actions
I want to deploy my app by using secrets in a "Production" environment.

I create a GitHub Action workflow for deployment. The workflow is triggered by push, and pull_request events on main branch. The workflow has a check_deploy job that uses Production environment secrets for check the eligibility for deployment.
When I create a pull request to main branch, the workflow is triggered and run. The job check_deploy should run successfully.
Because the job check_deploy uses Production, it is added to the deployment history, and I do not expect this behavior.

GitHub repository is the demo.

And this is my question "How to use secrets in the Github Environment without adding to the deployment history of this environment?"


问:
Styling my contentful blog page on my website
I'm trying to style my blogs page for my website. I integrated my Contentful blog using API's and its all displayed correctly, but I just don't know how to target individual elements to style them individually. I would like to be able to

Style my main blogs page asa grid layout, attached is the specific grid layout I would like to achieve. I've also attached what my current main blogs page looks like now. I just don't know the code syntax to achieve this

I would like to style my individual (slug) blogs page simply adding space between each paragraphs, I jus don't know the code syntax to achieve this

I would like to be able to add tags to fetch the tags from my Contentful and display them on my blogs main page and on the individual slugs page

I've also attatched all the data that I have from contentful, could someone point me in the right direction for the syntax to use for the things I want to do? Thanks!

The grid layout I would like to achieve

My current grid layout

```<code>My blogs.js code
```import Navbar from "../components/Navbar/Navbar";
import Footer from "../components/Footer/Footer";
import { createClient } from "contentful";
import BlogCard from "../components/BlogCard/BlogCard";

export async function getStaticProps() {
  const client = createClient({
    space: process.env.CONTENTFUL_SPACE_ID,
    accessToken: process.env.CONTENTFUL_ACCESS_TOKEN,
    previewacessToken: process.env.PREVIEW_ACCESS_TOKEN,
  });

  const res = await client.getEntries({ content_type: "menuItem" });
  return {
    props: {
      blog: res.items,
    },
  };
}
export default function Blog({ blog }) {
  console.log(blog);
  return (

            {" "}
            <Navbar />

                        {blog.map((menuItem) => (
                          <BlogCard key={menuItem.sys.id} menuItem={menuItem} />
                        ))}

  );
}```

My slug.js code
``` return (

            <Navbar />

{date}

                        {author}

                        {title}

                      <Image
                        className="pb-20 w-full max-w-full h-auto leading-7 max-md:-mt-8 max-md:pb-5"
                        src={"https:" + image.fields.file.url}
                        width={image.fields.file.details.image.width}
                        height={image.fields.file.details.image.height}
                        alt=""
                      />

{documentToReactComponents(text)}

                          {documentToReactComponents(text.content.paragraph)}

  );
}
```

My Individual blog card code
````export function BlogCard({ menuItem }) {
  const { title, slug, date, author, image, shortDescription } =
    menuItem.fields;

  return (
    <Link href={"/Blogs/" + slug}>

        <Image
          src={"https:" + image.fields.file.url}
          width={image.fields.file.details.image.width}
          height={image.fields.file.details.image.height}
          alt=""
        />

{title}

{shortDescription}

{date}

{author}

    </Link>
  );
}

export default BlogCard;```
</code>```

Body:
I'm trying to style my blogs page for my website. I integrated my Contentful blog using API's and its all displayed correctly, but I just don't know how to target individual elements to style them individually. I would like to be able to

Style my main blogs page asa grid layout, attached is the specific grid layout I would like to achieve. I've also attached what my current main blogs page looks like now. I just don't know the code syntax to achieve this

I would like to style my individual (slug) blogs page simply adding space between each paragraphs, I jus don't know the code syntax to achieve this

I would like to be able to add tags to fetch the tags from my Contentful and display them on my blogs main page and on the individual slugs page

I've also attatched all the data that I have from contentful, could someone point me in the right direction for the syntax to use for the things I want to do? Thanks!

The grid layout I would like to achieve

My current grid layout

My blogs.js code
```import Navbar from "../components/Navbar/Navbar";
import Footer from "../components/Footer/Footer";
import { createClient } from "contentful";
import BlogCard from "../components/BlogCard/BlogCard";

export async function getStaticProps() {
  const client = createClient({
    space: process.env.CONTENTFUL_SPACE_ID,
    accessToken: process.env.CONTENTFUL_ACCESS_TOKEN,
    previewacessToken: process.env.PREVIEW_ACCESS_TOKEN,
  });

  const res = await client.getEntries({ content_type: "menuItem" });
  return {
    props: {
      blog: res.items,
    },
  };
}
export default function Blog({ blog }) {
  console.log(blog);
  return (
    <div>
      <div className="bg-[#F5f5f5] pt-16">
        <div className="flex flex-col">
          <header>
            {" "}
            <Navbar />
          </header>
          <main className="flex-1">
            <div className="relative left-1/2 mt-12 min-w[100vw] translate-x-[-50%]">
              <div className="relative mx-auto pb-30 lg:pb-30">
                <div className="px-6 md:px-8.5 lg:px-40">
                  <div className="mx-auto max-w-container">
                    <div className="max-md:w-screen max-md:pr-5">
                      <div className="grid grid-cols-2 grid-rows-2 gap-10 mt-24 mb-32 h-full sm:grid-cols-2 sm:h-full sm:w-full md:mb-24 md:w-full max-lg:block max-md:mt-16">
                        {blog.map((menuItem) => (
                          <BlogCard key={menuItem.sys.id} menuItem={menuItem} />
                        ))}
                      </div>
                    </div>
                  </div>
                  <Footer />
                </div>
              </div>
            </div>
          </main>
        </div>
      </div>
    </div>
  );
}```

My slug.js code
``` return (
    <div>
      <div className="bg-[#F5f5f5] pt-16">
        <div className="flex flex-col">
          <header>
            <Navbar />
          </header>
          <main className="flex-1">
            <div className="relative left-1/2 mt-12 min-w[100vw] translate-x-[-50%]">
              <div className="relative mx-auto pb-30 lg:pb-30">
                <div className="px-6 md:px-8.5 lg:px-40">
                  <div className="mx-auto max-w-container">
                    <div className="py-24 px-40 mx-auto leading-7 text-center0 md:mx-auto max-lg:px-0 max-md:px-0 max-md:py-16">
                      <p>{date}</p>
                      <p className="leading-7 text-left pb-10 max-md:-mb-5">
                        {author}
                      </p>
                      <h1 className="pb-20 w-full max-w-full h-auto text-5xl font-bold text-left md:w-full">
                        {title}
                      </h1>
                      <Image
                        className="pb-20 w-full max-w-full h-auto leading-7 max-md:-mt-8 max-md:pb-5"
                        src={"https:" + image.fields.file.url}
                        width={image.fields.file.details.image.width}
                        height={image.fields.file.details.image.height}
                        alt=""
                      />
                      <div>
                        <div>{documentToReactComponents(text)}</div>
                        <div className="pb-10">
                          {documentToReactComponents(text.content.paragraph)}
                        </div>
                      </div>
                    </div>
                    <Footer />
                  </div>
                </div>
              </div>
            </div>
          </main>
        </div>
      </div>
    </div>
  );
}
```

My Individual blog card code
````export function BlogCard({ menuItem }) {
  const { title, slug, date, author, image, shortDescription } =
    menuItem.fields;

  return (
    <Link href={"/Blogs/" + slug}>
      <div>
        <Image
          src={"https:" + image.fields.file.url}
          width={image.fields.file.details.image.width}
          height={image.fields.file.details.image.height}
          alt=""
        />
      </div>

      <div className="mr-auto">
        <div className="content">
          <div className="info">
            <h2>{title}</h2>
            <p className="pb-5">{shortDescription}</p>
            <p className="pb-2">{date}</p>
            <p>{author}</p>
          </div>
        </div>
      </div>
    </Link>
  );
}

export default BlogCard;```


问:
on macOS a DisclosureGroup inside List crashes with .searchable
On macOS I get an unexpected crash with the following code when entering a search that is not in the data (e.g. "100"). It does NOT crash on iOS with the same code.

Any hints appreciated.

```<code>struct ContentView: View {

    let data: [Int] = (1...20).map { $0 }

    var filteredData: [Int] {
        if search.isEmpty {
            return data
        } else {
            return data.filter { String($0).contains(search) }
        }
    }

    @State private var selection: Int? = nil
    @State private var search = ""

    var body: some View {

        NavigationStack {
            List(selection: $selection) {
                DisclosureGroup("Group") {
                    ForEach(filteredData, id: \.self) { item in
                        Text("\(item)")
                    }
                }
            }
            .searchable(text: $search)
        }
    }
}
</code>```

Body:
On macOS I get an unexpected crash with the following code when entering a search that is not in the data (e.g. "100"). It does NOT crash on iOS with the same code.

Any hints appreciated.

struct ContentView: View {

    let data: [Int] = (1...20).map { $0 }

    var filteredData: [Int] {
        if search.isEmpty {
            return data
        } else {
            return data.filter { String($0).contains(search) }
        }
    }

    @State private var selection: Int? = nil
    @State private var search = ""

    var body: some View {

        NavigationStack {
            List(selection: $selection) {
                DisclosureGroup("Group") {
                    ForEach(filteredData, id: \.self) { item in
                        Text("\(item)")
                    }
                }
            }
            .searchable(text: $search)
        }
    }
}


问:
Get coordinates/limits of AnchoredText
I set up a figure with multiple axes, where some axes have an AnchoredText. I want to add a ConnectionPatch to connect one axis to an AnchoredText in another axis. While I can get the limits of the axis, I'm not sure if something similar can be done for an AnchoredText.

I have looked through the properties of AnchoredText, Offsetbox, and Artist, and have tried a couple of methods but haven't found anything that gives me anything close to what I'm looking for. At best, I can only guess, although I want to be able to code this in a way in which it can be done dynamically.

Title: Get coordinates/limits of AnchoredText


问:
Bug trying to use .call with non-native ERC20 token in Solidity
I have this function called "exchangeCall" in my contract with which I can send an amount of its native ETH token ("values"), data in bytes ("callData") and an estimated gas ("estimatedGas") towards another contract ("target"). The purpose is to send the byte data ("callData"), which already contains a previously defined series of steps.

This script works perfectly when I try (for example) to exchange through the Uniswap contract, ETH (native token) for UNI (or another token).

However, when I try to do it the other way around by exchanging any token other than ETH for another one it generates an error.

In the following video you can find a more specific explanation through an example:

Videolink -> https://drive.google.com/file/d/1ujP5Q_-_PHpkDNb1Jeldo1HveReWZUMT/view

For my case, it is important that this code is made only in solidity (not web3 or similar).

I have already checked the permissions so that the non-native token can be used by the contract, it can be done with the other auxiliary functions present in the contract or through the IERC20 which is also invoked there.

I hope someone can help me, and I share the script code.

```<code>// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
pragma experimental ABIEncoderV2;

import {IERC20} from "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/IERC20.sol";

contract SimpleExchange  {
    address payable owner;

    // SOME TOKENS FOR TEST
    address private immutable uniAddress =
        0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984; // UNI TOKEN
    address private immutable usdcAddress =
        0xA2025B15a1757311bfD68cb14eaeFCc237AF5b43; // USDC TOKEN
    address dexContractAddress =
        0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45; // Contrato Objetivo

    // FUNCTION FOR EXCHANGE
    function exchangeCall(address target, bytes memory callData, uint values, uint estimatedGas) public payable returns (uint256 blockNumber) {
        blockNumber = block.number;
        (bool success, bytes memory ret) = target.call{value:values,gas:estimatedGas}(callData);
        require(success);
    }

    //OPTIONAL FUNCTIONS FOR DEVELOPMENT TESTS
    function approveUSDC(uint256 _amount) external returns (bool) {
        return IERC20(usdcAddress).approve(dexContractAddress, _amount);
    }

    function allowanceUSDC() external view returns (uint256) {
        return IERC20(usdcAddress).allowance(address(this), dexContractAddress);
    }

    function approveUNI(uint256 _amount) external returns (bool) {
        return IERC20(uniAddress).approve(dexContractAddress, _amount);
    }

    function allowanceUNI() external view returns (uint256) {
        return IERC20(uniAddress).allowance(address(this), dexContractAddress);
    }

    function getBalance(address _tokenAddress) external view returns (uint256) {
        return IERC20(_tokenAddress).balanceOf(address(this));
    }

    function transfer(address _tokenAddress, address receiverAddr, uint receiverAmnt) public payable{
        IERC20 token = IERC20(_tokenAddress);
        token.transfer(receiverAddr, receiverAmnt);
    }

    function transferFrom(address sender, address recipient, uint256 amount,address token) external returns (bool){
        IERC20(token).transferFrom(sender,recipient,amount);
        return true;
    }

    function withdraw(address _tokenAddress) external {
        IERC20 token = IERC20(_tokenAddress);
        token.transfer(msg.sender, token.balanceOf(address(this)));
    }

    // Function to receive Ether. msg.data must be empty
    receive() external payable {}

    // Fallback function is called when msg.data is not empty
    fallback() external payable {}
}
</code>```

Body:
I have this function called "exchangeCall" in my contract with which I can send an amount of its native ETH token ("values"), data in bytes ("callData") and an estimated gas ("estimatedGas") towards another contract ("target"). The purpose is to send the byte data ("callData"), which already contains a previously defined series of steps.

This script works perfectly when I try (for example) to exchange through the Uniswap contract, ETH (native token) for UNI (or another token).

However, when I try to do it the other way around by exchanging any token other than ETH for another one it generates an error.

In the following video you can find a more specific explanation through an example:

Videolink -> https://drive.google.com/file/d/1ujP5Q_-_PHpkDNb1Jeldo1HveReWZUMT/view

For my case, it is important that this code is made only in solidity (not web3 or similar).

I have already checked the permissions so that the non-native token can be used by the contract, it can be done with the other auxiliary functions present in the contract or through the IERC20 which is also invoked there.

I hope someone can help me, and I share the script code.

// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
pragma experimental ABIEncoderV2;

import {IERC20} from "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/IERC20.sol";

contract SimpleExchange  {
    address payable owner;

    // SOME TOKENS FOR TEST
    address private immutable uniAddress =
        0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984; // UNI TOKEN
    address private immutable usdcAddress =
        0xA2025B15a1757311bfD68cb14eaeFCc237AF5b43; // USDC TOKEN
    address dexContractAddress =
        0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45; // Contrato Objetivo

    // FUNCTION FOR EXCHANGE
    function exchangeCall(address target, bytes memory callData, uint values, uint estimatedGas) public payable returns (uint256 blockNumber) {
        blockNumber = block.number;
        (bool success, bytes memory ret) = target.call{value:values,gas:estimatedGas}(callData);
        require(success);
    }

    //OPTIONAL FUNCTIONS FOR DEVELOPMENT TESTS
    function approveUSDC(uint256 _amount) external returns (bool) {
        return IERC20(usdcAddress).approve(dexContractAddress, _amount);
    }

    function allowanceUSDC() external view returns (uint256) {
        return IERC20(usdcAddress).allowance(address(this), dexContractAddress);
    }

    function approveUNI(uint256 _amount) external returns (bool) {
        return IERC20(uniAddress).approve(dexContractAddress, _amount);
    }

    function allowanceUNI() external view returns (uint256) {
        return IERC20(uniAddress).allowance(address(this), dexContractAddress);
    }

    function getBalance(address _tokenAddress) external view returns (uint256) {
        return IERC20(_tokenAddress).balanceOf(address(this));
    }

    function transfer(address _tokenAddress, address receiverAddr, uint receiverAmnt) public payable{
        IERC20 token = IERC20(_tokenAddress);
        token.transfer(receiverAddr, receiverAmnt);
    }

    function transferFrom(address sender, address recipient, uint256 amount,address token) external returns (bool){
        IERC20(token).transferFrom(sender,recipient,amount);
        return true;
    }

    function withdraw(address _tokenAddress) external {
        IERC20 token = IERC20(_tokenAddress);
        token.transfer(msg.sender, token.balanceOf(address(this)));
    }

    // Function to receive Ether. msg.data must be empty
    receive() external payable {}

    // Fallback function is called when msg.data is not empty
    fallback() external payable {}
}


问:
AWS Cloud Watch: Metric Filter Value Extraction from Log
I have api.log logs being sent to CloudWatch and I want to create a metric filter to extract the userId of the user tried to access application.

A sample log entry looks like:

```<code>2022-12-06T19:13:59.329Z    2a-b0bc-7a79c791f19c    INFO    Validated that user fakeId has access to the following gated roles: create, update and delete
</code>```

And the value I would like to extract is: fakeId

I read through this guide and it seems pretty straight forward because user [fakeId] seconds is unique to just this line. This guide on metric filter syntax seems to only show examples for extracting values from JSON logs and this official example list doesn't cover it.

Based on the documentation and a few other stackoverflow answers, I tried these things:

```<code>[validation="Validated", that="that", user="user", userId, ...]
[,,user="user",userId,...]
[,,user=user,userId,...]
</code>```

but it didn't. Any help would be really appreciated!

Body:
I have api.log logs being sent to CloudWatch and I want to create a metric filter to extract the userId of the user tried to access application.

A sample log entry looks like:

2022-12-06T19:13:59.329Z    2a-b0bc-7a79c791f19c    INFO    Validated that user fakeId has access to the following gated roles: create, update and delete

And the value I would like to extract is: fakeId

I read through this guide and it seems pretty straight forward because user [fakeId] seconds is unique to just this line. This guide on metric filter syntax seems to only show examples for extracting values from JSON logs and this official example list doesn't cover it.

Based on the documentation and a few other stackoverflow answers, I tried these things:

[validation="Validated", that="that", user="user", userId, ...]
[,,user="user",userId,...]
[,,user=user,userId,...]

but it didn't. Any help would be really appreciated!


问:
Prevent Flask Server From Including FIN bit in Response to Client
I'm working with a Flask server in a test environment. After each HTTP packet it receives from a client, it sends an HTTP 200 OK packet that includes a FIN bit. Is there anyway to change the socket configuration on the server side to keep the connection open between reception of HTTP packets from the client?</p>


问:
NextJS export , the results html files on the project images not loaded
```<code>    import React from "react";

export default function PromoBanner() {
  return (
    <section className="container mt-4 mb-grid-gutter">
      <div className="bg-faded-info rounded-3 py-4">
        <div className="row align-items-center">
          <div className="col-md-5">
            <div className="px-4 pe-sm-0 ps-sm-5">
              <span className="badge bg-danger">Limitli Süre</span>
              <h3 className="mt-4 mb-1 text-body fw-light">Small Title</h3>
              <h2 className="mb-1">En Son Teknoloji</h2>
              <p className="h5 text-body fw-light">
                product Title
              </p>
              <a className="btn btn-accent" href="#">
                Btn Text
                <i className="ci-arrow-right fs-ms ms-1" />
              </a>
            </div>
          </div>
          <div className="col-md-7 d-flex align-items-center justify-content-center">
            <img
              src="/general/01.png"
              alt="Güç Kontrol"
              className="PromoBannerImage"
            />
          </div>
        </div>
      </div>
    </section>
  );
}
</code>```

Here is my sample comp. When ı export my project the image does not show how can ı solve this problem ?

Here is my jsconfig.json file. With this the css files is uploading but not images uploading when ı check the browser's Network developer tab ı can not see any images.

```<code>{
"compilerOptions": {
  "baseUrl": "."
}
</code>```

}

This is my file structure.

This is out file.

This is the root files.

This is my Public folder.

This is in out file index.html

When I add a dot like "./general/01.png" the image show and again give an error ı mean When ı refresh my browser the images show just  1 second after that the images  does not show.

Body:
    import React from "react";

export default function PromoBanner() {
  return (

              Limitli Süre

Small Title

En Son Teknoloji

                product Title

                Btn Text

  );
}

Here is my sample comp. When ı export my project the image does not show how can ı solve this problem ?

Here is my jsconfig.json file. With this the css files is uploading but not images uploading when ı check the browser's Network developer tab ı can not see any images.

{
"compilerOptions": {
  "baseUrl": "."
}

}

This is my file structure.

This is out file.

This is the root files.

This is my Public folder.

This is in out file index.html

When I add a dot like "./general/01.png" the image show and again give an error ı mean When ı refresh my browser the images show just  1 second after that the images  does not show.


问:
Efficient way to update all rankings of a table?
Hope this question makes sense. Suppose we have a table of the top 1,000,000 most visited websites on the internet. The table would look something like this.

Name
Address
Visits
Ranking

Example Site
example.com
1000000000
1

Stack Overflow
stackoverflow.com
900000000
2

...
...
...
...

Small Site
smallsite.com
100
999999

Tiny Site
tinysite.com
1
1000000

Each week we check how many site visits each site had, and depending on the site visits we update their ranking. If we had a site that blew up in the past week and went say from rank 900,000 to 1,000, what is the most efficient way to update all the rows affected in the table? As they would need to be bumped up by 1.

Is there a concept in SQL that would allow us to make large batch changes like that without locking out the table?

Obviously this doesn't take into consideration all the other changes in rankings, but wanted to keep this as simple as possible.


问:
.net6 integration test auth identity is null
I just upgraded from .net5 to .net6 and that resulted in a slew of integration tests to fail. Certain controller endpoints query the current user's id and that is handled by this line of code:

```<code>public Task<IActionResult> MyControllerMethod() {
  if (int.TryParse(_context.HttpContext?.User.Identity?.Name, out int userId))
  {
    Console.WriteLine("Current user id is " + userId.ToString());
  }
}
</code>```

However, since the upgrade, User.Identity is null, therefore no user id can be found and the endpoint cannot proceed. Live production/development/staging services have had no issues since the upgrade, it is just the integration tests that are failing.

I have followed Microsoft's guide on mocking authentication within integration tests and have set up my webapplicationfactory with the following test services:

```<code>builder.ConfigureTestServices(services =>
{
    services.AddAuthentication(Env.Test)
        .AddScheme<AuthenticationSchemeOptions, TestAuthHandler>(Env.Test, options => { });
});
</code>```

As well as the HandleAuthenticateAsync() method:

```<code>protected override Task<AuthenticateResult> HandleAuthenticateAsync()
{
    IHeaderDictionary headers = _context.HttpContext!.Request.Headers;

    if (headers.ContainsKey("AuthorizationUserId"))
    {
        if (int.TryParse(headers["AuthorizationUserId"], out int userId))
        {
            var claims = new List<Claim> {new(ClaimTypes.Name, userId.ToString())};

            if (userId == 1) // maybe only do user 1 for now?
                claims.Add(new Claim(ClaimTypes.Role, $"{UserRoleType.Admin}"));

            StringValues email = headers["AuthorizationEmail"];
            StringValues dob = headers["AuthorizationBirthdate"];

            claims.Add(new Claim(ClaimTypes.Email, email.ToString()));
            claims.Add(new Claim(ClaimTypes.DateOfBirth, dob.ToString()));
            ClaimsPrincipal claimsPrincipal = BuildClaimsPrincipal(claims);
            var identity = new ClaimsIdentity(claims);
            var principal = new ClaimsPrincipal(identity);
            var ticket = new AuthenticationTicket(principal, JwtBearerDefaults.AuthenticationScheme); // Tried changing the scheme to "Test", same issue
            AuthenticateResult result = AuthenticateResult.Success(ticket);
            return Task.FromResult(result);
        }
    }

    AuthenticateResult result = AuthenticateResult.Fail("User id/Email was not found in headers, and no JWT set on request");
    return Task.FromResult(result);
}
</code>```

I did find that within a controller method context.HttpContext.AuthenticateAsync() spits out the full user identity with all of the claims that are set up in HandleAuthenticateAsync(). How could I avoid this workaround?

Body:
I just upgraded from .net5 to .net6 and that resulted in a slew of integration tests to fail. Certain controller endpoints query the current user's id and that is handled by this line of code:

public Task<IActionResult> MyControllerMethod() {
  if (int.TryParse(_context.HttpContext?.User.Identity?.Name, out int userId))
  {
    Console.WriteLine("Current user id is " + userId.ToString());
  }
}

However, since the upgrade, User.Identity is null, therefore no user id can be found and the endpoint cannot proceed. Live production/development/staging services have had no issues since the upgrade, it is just the integration tests that are failing.

I have followed Microsoft's guide on mocking authentication within integration tests and have set up my webapplicationfactory with the following test services:

builder.ConfigureTestServices(services =>
{
    services.AddAuthentication(Env.Test)
        .AddScheme<AuthenticationSchemeOptions, TestAuthHandler>(Env.Test, options => { });
});

As well as the HandleAuthenticateAsync() method:

protected override Task<AuthenticateResult> HandleAuthenticateAsync()
{
    IHeaderDictionary headers = _context.HttpContext!.Request.Headers;

    if (headers.ContainsKey("AuthorizationUserId"))
    {
        if (int.TryParse(headers["AuthorizationUserId"], out int userId))
        {
            var claims = new List<Claim> {new(ClaimTypes.Name, userId.ToString())};

            if (userId == 1) // maybe only do user 1 for now?
                claims.Add(new Claim(ClaimTypes.Role, $"{UserRoleType.Admin}"));

            StringValues email = headers["AuthorizationEmail"];
            StringValues dob = headers["AuthorizationBirthdate"];

            claims.Add(new Claim(ClaimTypes.Email, email.ToString()));
            claims.Add(new Claim(ClaimTypes.DateOfBirth, dob.ToString()));
            ClaimsPrincipal claimsPrincipal = BuildClaimsPrincipal(claims);
            var identity = new ClaimsIdentity(claims);
            var principal = new ClaimsPrincipal(identity);
            var ticket = new AuthenticationTicket(principal, JwtBearerDefaults.AuthenticationScheme); // Tried changing the scheme to "Test", same issue
            AuthenticateResult result = AuthenticateResult.Success(ticket);
            return Task.FromResult(result);
        }
    }

    AuthenticateResult result = AuthenticateResult.Fail("User id/Email was not found in headers, and no JWT set on request");
    return Task.FromResult(result);
}

I did find that within a controller method context.HttpContext.AuthenticateAsync() spits out the full user identity with all of the claims that are set up in HandleAuthenticateAsync(). How could I avoid this workaround?


问:
regeneration system Script timeout: exhausted allowed execution time
so I'm trying to create a regeneration system for my game In Roblox I'm having problems with the Script this is the script:

```<code>task.wait(10)
game.Workspace.CoreGame:Destroy()
task.wait(10)
game.ServerStorage.Map.CoreGame:Clone().Parent=workspace
print("DONE!")
</code>```

it's giving me the Error “Script timeout: exhausted allowed execution time” even though there is no Loop At all I've looked for days trying to figure out a solution but I couldn't find any info about the problem I'm having here is a picture of the error:

it always says it on the last line of the script no matter what is in it I Have Tryed to limit how much stuff is in the CoreGame folder and still did not work

limiting stuff in the folder
putting the folder in a different area
cloning the folder instead of using :Destroy()

Body:
so I'm trying to create a regeneration system for my game In Roblox I'm having problems with the Script this is the script:

task.wait(10)
game.Workspace.CoreGame:Destroy()
task.wait(10)
game.ServerStorage.Map.CoreGame:Clone().Parent=workspace
print("DONE!")

it's giving me the Error “Script timeout: exhausted allowed execution time” even though there is no Loop At all I've looked for days trying to figure out a solution but I couldn't find any info about the problem I'm having here is a picture of the error:

it always says it on the last line of the script no matter what is in it I Have Tryed to limit how much stuff is in the CoreGame folder and still did not work

limiting stuff in the folder
putting the folder in a different area
cloning the folder instead of using :Destroy()


问:
Android The SSL connection could not be established
My Xamarin.Android project was working fine until today. Now my code is not working anymore:

```<code>var client = new RestClient("https://myapp.auth0.com/oauth/ro");
var request = new RestRequest();
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "some_json", ParameterType.RequestBody);
RestResponse response = await client.ExecutePostAsync(request);
Auth0Response auth0Response = JsonConvert.DeserializeObject<MyAuth0Response>(response.Content);
</code>```

The response.Content is null and the request returns an error message:

The SSL connection could not be established

Inner exception:

InnerException    {System.Security.Authentication.AuthenticationException:
Authentication failed, see inner exception. --->
Mono.Btls.MonoBtlsException: Ssl error:1000007d:SSL
routines:OPENSSL_internal:CERTIFICATE_VERIFY_FAILED} at /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/boringssl/ssl/handshake_client.c:1132

Inner message:

Authentication failed, see inner exception.

Stack trace:

at Mono.Btls.MonoBtlsContext.ProcessHandshake () [0x00042] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/System/Mono.Btls/MonoBtlsContext.cs:220
at Mono.Net.Security.MobileAuthenticatedStream.ProcessHandshake (Mono.Net.Security.AsyncOperationStatus status, System.Boolean renegotiate) [0x000da] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/System/Mono.Net.Security/MobileAuthenticatedStream.cs:715
at (wrapper remoting-invoke-with-check) Mono.Net.Security.MobileAuthenticatedStream.ProcessHandshake(Mono.Net.Security.AsyncOperationStatus,bool)
at Mono.Net.Security.AsyncHandshakeRequest.Run (Mono.Net.Security.AsyncOperationStatus status) [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/System/Mono.Net.Security/AsyncProtocolRequest.cs:289
at Mono.Net.Security.AsyncProtocolRequest.ProcessOperation (System.Threading.CancellationToken cancellationToken) [0x000fc] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/System/Mono.Net.Security/AsyncProtocolRequest.cs:223

Body:
My Xamarin.Android project was working fine until today. Now my code is not working anymore:

var client = new RestClient("https://myapp.auth0.com/oauth/ro");
var request = new RestRequest();
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "some_json", ParameterType.RequestBody);
RestResponse response = await client.ExecutePostAsync(request);
Auth0Response auth0Response = JsonConvert.DeserializeObject<MyAuth0Response>(response.Content);

The response.Content is null and the request returns an error message:

The SSL connection could not be established

Inner exception:

InnerException    {System.Security.Authentication.AuthenticationException:
Authentication failed, see inner exception. --->
Mono.Btls.MonoBtlsException: Ssl error:1000007d:SSL
routines:OPENSSL_internal:CERTIFICATE_VERIFY_FAILED} at /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/boringssl/ssl/handshake_client.c:1132

Inner message:

Authentication failed, see inner exception.

Stack trace:

at Mono.Btls.MonoBtlsContext.ProcessHandshake () [0x00042] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/System/Mono.Btls/MonoBtlsContext.cs:220
at Mono.Net.Security.MobileAuthenticatedStream.ProcessHandshake (Mono.Net.Security.AsyncOperationStatus status, System.Boolean renegotiate) [0x000da] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/System/Mono.Net.Security/MobileAuthenticatedStream.cs:715
at (wrapper remoting-invoke-with-check) Mono.Net.Security.MobileAuthenticatedStream.ProcessHandshake(Mono.Net.Security.AsyncOperationStatus,bool)
at Mono.Net.Security.AsyncHandshakeRequest.Run (Mono.Net.Security.AsyncOperationStatus status) [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/System/Mono.Net.Security/AsyncProtocolRequest.cs:289
at Mono.Net.Security.AsyncProtocolRequest.ProcessOperation (System.Threading.CancellationToken cancellationToken) [0x000fc] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/System/Mono.Net.Security/AsyncProtocolRequest.cs:223


问:
Adding variables of different classes to List of another class

public class Project
{
    public string ProjectName { get; set; }
    public string Startdate { get; set; }
    public string Enddate { get; set; }
    public int? id { get; set; }

    public Project(string projectname, string startdate, string enddate, int Id)
    {
        this.ProjectName = projectname;
        this.Startdate = startdate;
        this.Enddate = enddate;
        this.id = Id;
    }

    public Project()
    {
    }
}

public class Employee
{
    public int EmployeeID { get; set; }
    public string firstName { get; set; }
    public string lastName { get; set; }
    public string email { get; set; }
    public string mobile { get; set; }
    public string address { get; set; }
    public int roleid { get; set; }
    public string roleName { get; set; }

    public Employee(int empid, string FirstName, string LastName, string Email, string Mobile, string Address, int ROleID, string ROlename)
    {
        EmployeeID = empid;
        firstName = FirstName;
        lastName = LastName;
        email = Email;
        mobile = Mobile;
        address = Address;
        roleid = ROleID;
        roleName = ROlename;
    }

    public Employee()
    {
    }
}

public class AddEmptoProject
{
    public string ProjectName { get; set; }
    public int EmployeeID { get; set; }
    Project projecting = new Project();
    Employee employing = new Employee();

    public AddEmptoProject(string projectName, int employeeID)
    {
        this.ProjectName = projectName;
        projectName = projecting.ProjectName;
        this.EmployeeID = employeeID;
        employeeID = employing.EmployeeID;
    }

    public AddEmptoProject()
    {
    }
}

public class AddingEmptoProject
{
    public List<AddEmptoProject> AddingEmplist = new List<AddEmptoProject>();

    public void addingemp(AddEmptoProject add)
    {
        AddingEmplist.Add(add);
    }
}

//This part of code will be in main method
var PROJname = Console.ReadLine();
Console.WriteLine("Enter the id of employee to add into project");
int EMPID = Convert.ToInt32(Console.ReadLine());
AddEmptoProject ADDTOPROJ = new AddEmptoProject();
Project ADDTOPROJ1 = new Project();
Employee EMPIDD = new Employee();

if(PROJname.Equals(ADDTOPROJ1.ProjectName) && EMPID.Equals(EMPIDD.EmployeeID))
{
    AddEmptoProject YADD = new AddEmptoProject(PROJname, EMPID);
    AddingEmptoProject addition = new AddingEmptoProject();
    addition.addingemp(YADD);
}
else
{
    Console.WriteLine("Invalid Entry bro");
}
```

I am new to C#

I am trying to build a console application

In this everything seems to work fine but the if statement will does not execute

what is the error here ?

Is there any other way better than this ?

If possible can someone explain me the right way to add variables of different classes into List of another class

Body:
public class Project
{
    public string ProjectName { get; set; }
    public string Startdate { get; set; }
    public string Enddate { get; set; }
    public int? id { get; set; }

    public Project(string projectname, string startdate, string enddate, int Id)
    {
        this.ProjectName = projectname;
        this.Startdate = startdate;
        this.Enddate = enddate;
        this.id = Id;
    }

    public Project()
    {
    }
}

public class Employee
{
    public int EmployeeID { get; set; }
    public string firstName { get; set; }
    public string lastName { get; set; }
    public string email { get; set; }
    public string mobile { get; set; }
    public string address { get; set; }
    public int roleid { get; set; }
    public string roleName { get; set; }

    public Employee(int empid, string FirstName, string LastName, string Email, string Mobile, string Address, int ROleID, string ROlename)
    {
        EmployeeID = empid;
        firstName = FirstName;
        lastName = LastName;
        email = Email;
        mobile = Mobile;
        address = Address;
        roleid = ROleID;
        roleName = ROlename;
    }

    public Employee()
    {
    }
}

public class AddEmptoProject
{
    public string ProjectName { get; set; }
    public int EmployeeID { get; set; }
    Project projecting = new Project();
    Employee employing = new Employee();

    public AddEmptoProject(string projectName, int employeeID)
    {
        this.ProjectName = projectName;
        projectName = projecting.ProjectName;
        this.EmployeeID = employeeID;
        employeeID = employing.EmployeeID;
    }

    public AddEmptoProject()
    {
    }
}

public class AddingEmptoProject
{
    public List<AddEmptoProject> AddingEmplist = new List<AddEmptoProject>();

    public void addingemp(AddEmptoProject add)
    {
        AddingEmplist.Add(add);
    }
}

//This part of code will be in main method
var PROJname = Console.ReadLine();
Console.WriteLine("Enter the id of employee to add into project");
int EMPID = Convert.ToInt32(Console.ReadLine());
AddEmptoProject ADDTOPROJ = new AddEmptoProject();
Project ADDTOPROJ1 = new Project();
Employee EMPIDD = new Employee();

if(PROJname.Equals(ADDTOPROJ1.ProjectName) && EMPID.Equals(EMPIDD.EmployeeID))
{
    AddEmptoProject YADD = new AddEmptoProject(PROJname, EMPID);
    AddingEmptoProject addition = new AddingEmptoProject();
    addition.addingemp(YADD);
}
else
{
    Console.WriteLine("Invalid Entry bro");
}

I am new to C#

I am trying to build a console application

In this everything seems to work fine but the if statement will does not execute

what is the error here ?

Is there any other way better than this ?

If possible can someone explain me the right way to add variables of different classes into List of another class


问:
remote server: dash_leaflet + javascript through a "No match for [dashExtensions.default.function0]" error
I'm trying to display some maps using GeoJSON from dash_leaflet, and it works fine, but for performance reasons I have to use javascript to change the way the points are displayed. Locally it works fine, but as soon as I upload my code to pythonanywhere, the map is displayed but not the points. If I comment the argument options (in the code below), the points are displayed, but not the way I wanted, which causes the performance issue...

```<code>import dash_leaflet as dl
from dash_extensions.javascript import assign

# Geojson rendering logic, must be JavaScript
# as it is executed in clientside.
point_to_layer = assign(
    """function(feature, latlong, context){
    const {circleOptions} = context.props.hideout;
    return L.circleMarker(latlong, circleOptions);
}"""
)

main_map = dl.Map(
    children=[
        dl.LayersControl(
            children=[
                dl.BaseLayer(
                    dl.TileLayer(),
                    name="Background",
                    checked=True,
                )
            ]
            + [
                dl.Overlay(
                    dl.GeoJSON(
                        id="dives_data",
                        format="geobuf",
                        zoomToBounds=True,
                        # comment options make it works...
                        options=dict(
                            pointToLayer=point_to_layer
                        ),
                        hideout=dict(
                            circleOptions=dict(fillOpacity=1,
                                               stroke=False,
                                               radius=5)
                        ),
                    ),
                    checked=True,
                    id="overlay_dive_map",
                    name="Data",
                )
            ],
            id="layer_data",
        ),
    ],
    center=(37, -140),
    zoom=5,
    style={"width": "100%", "height": "87vh", "margin": "auto"},
)
</code>```

I opened a topic on pythonanywhere's forum (https://www.pythonanywhere.com/forums/topic/32111/#id_post_107799), and looked at the problems in the dev tools of my browser as suggested by the staff. I found these two problems:

```<code>Error: No match for [dashExtensions.default.function0] in the global window object.
    r index.js:33
    r index.js:18
    o index.js:53
    value React
    Ie react-dom@16.v2_7_0m1670302186.14.0.min.js:104
    rh react-dom@16.v2_7_0m1670302186.14.0.min.js:103
    zj react-dom@16.v2_7_0m1670302186.14.0.min.js:228
    Th react-dom@16.v2_7_0m1670302186.14.0.min.js:152
    tj react-dom@16.v2_7_0m1670302186.14.0.min.js:152
    Te react-dom@16.v2_7_0m1670302186.14.0.min.js:146
    Pg react-dom@16.v2_7_0m1670302186.14.0.min.js:61
    unstable_runWithPriority react@16.v2_7_0m1670302186.14.0.min.js:25
    Da react-dom@16.v2_7_0m1670302186.14.0.min.js:60
    Pg react-dom@16.v2_7_0m1670302186.14.0.min.js:61
    ha react-dom@16.v2_7_0m1670302186.14.0.min.js:60
    Dj react-dom@16.v2_7_0m1670302186.14.0.min.js:163
    unstable_runWithPriority react@16.v2_7_0m1670302186.14.0.min.js:25
    Da react-dom@16.v2_7_0m1670302186.14.0.min.js:60
    xb react-dom@16.v2_7_0m1670302186.14.0.min.js:162
    Bj react-dom@16.v2_7_0m1670302186.14.0.min.js:162
    U react@16.v2_7_0m1670302186.14.0.min.js:16
    onmessage react@16.v2_7_0m1670302186.14.0.min.js:24
    EventHandlerNonNull* react@16.v2_7_0m1670302186.14.0.min.js:24
    <anonymous> react@16.v2_7_0m1670302186.14.0.min.js:9
    <anonymous> react@16.v2_7_0m1670302186.14.0.min.js:9
    ...
</code>```

and

```<code>Error: No match for [dashExtensions.default.function0] in the global window object.
    r index.js:33
    r index.js:18
    o index.js:53
    value React
    Ie react-dom@16.v2_7_0m1670302186.14.0.min.js:104
    rh react-dom@16.v2_7_0m1670302186.14.0.min.js:103
    zj react-dom@16.v2_7_0m1670302186.14.0.min.js:228
    Th react-dom@16.v2_7_0m1670302186.14.0.min.js:152
    tj react-dom@16.v2_7_0m1670302186.14.0.min.js:152
    Te react-dom@16.v2_7_0m1670302186.14.0.min.js:146
    Pg react-dom@16.v2_7_0m1670302186.14.0.min.js:61
    unstable_runWithPriority react@16.v2_7_0m1670302186.14.0.min.js:25
    Da react-dom@16.v2_7_0m1670302186.14.0.min.js:60
    Pg react-dom@16.v2_7_0m1670302186.14.0.min.js:61
    ha react-dom@16.v2_7_0m1670302186.14.0.min.js:60
    Dj react-dom@16.v2_7_0m1670302186.14.0.min.js:163
    unstable_runWithPriority react@16.v2_7_0m1670302186.14.0.min.js:25
    Da react-dom@16.v2_7_0m1670302186.14.0.min.js:60
    xb react-dom@16.v2_7_0m1670302186.14.0.min.js:162
    Bj react-dom@16.v2_7_0m1670302186.14.0.min.js:162
    U react@16.v2_7_0m1670302186.14.0.min.js:16
    onmessage react@16.v2_7_0m1670302186.14.0.min.js:24
    EventHandlerNonNull* react@16.v2_7_0m1670302186.14.0.min.js:24
    <anonymous> react@16.v2_7_0m1670302186.14.0.min.js:9
    <anonymous> react@16.v2_7_0m1670302186.14.0.min.js:9
    ...
</code>```

Body:
I'm trying to display some maps using GeoJSON from dash_leaflet, and it works fine, but for performance reasons I have to use javascript to change the way the points are displayed. Locally it works fine, but as soon as I upload my code to pythonanywhere, the map is displayed but not the points. If I comment the argument options (in the code below), the points are displayed, but not the way I wanted, which causes the performance issue...

import dash_leaflet as dl
from dash_extensions.javascript import assign

# Geojson rendering logic, must be JavaScript
# as it is executed in clientside.
point_to_layer = assign(
    """function(feature, latlong, context){
    const {circleOptions} = context.props.hideout;
    return L.circleMarker(latlong, circleOptions);
}"""
)

main_map = dl.Map(
    children=[
        dl.LayersControl(
            children=[
                dl.BaseLayer(
                    dl.TileLayer(),
                    name="Background",
                    checked=True,
                )
            ]
            + [
                dl.Overlay(
                    dl.GeoJSON(
                        id="dives_data",
                        format="geobuf",
                        zoomToBounds=True,
                        # comment options make it works...
                        options=dict(
                            pointToLayer=point_to_layer
                        ),
                        hideout=dict(
                            circleOptions=dict(fillOpacity=1,
                                               stroke=False,
                                               radius=5)
                        ),
                    ),
                    checked=True,
                    id="overlay_dive_map",
                    name="Data",
                )
            ],
            id="layer_data",
        ),
    ],
    center=(37, -140),
    zoom=5,
    style={"width": "100%", "height": "87vh", "margin": "auto"},
)

I opened a topic on pythonanywhere's forum (https://www.pythonanywhere.com/forums/topic/32111/#id_post_107799), and looked at the problems in the dev tools of my browser as suggested by the staff. I found these two problems:

Error: No match for [dashExtensions.default.function0] in the global window object.
    r index.js:33
    r index.js:18
    o index.js:53
    value React
    Ie react-dom@16.v2_7_0m1670302186.14.0.min.js:104
    rh react-dom@16.v2_7_0m1670302186.14.0.min.js:103
    zj react-dom@16.v2_7_0m1670302186.14.0.min.js:228
    Th react-dom@16.v2_7_0m1670302186.14.0.min.js:152
    tj react-dom@16.v2_7_0m1670302186.14.0.min.js:152
    Te react-dom@16.v2_7_0m1670302186.14.0.min.js:146
    Pg react-dom@16.v2_7_0m1670302186.14.0.min.js:61
    unstable_runWithPriority react@16.v2_7_0m1670302186.14.0.min.js:25
    Da react-dom@16.v2_7_0m1670302186.14.0.min.js:60
    Pg react-dom@16.v2_7_0m1670302186.14.0.min.js:61
    ha react-dom@16.v2_7_0m1670302186.14.0.min.js:60
    Dj react-dom@16.v2_7_0m1670302186.14.0.min.js:163
    unstable_runWithPriority react@16.v2_7_0m1670302186.14.0.min.js:25
    Da react-dom@16.v2_7_0m1670302186.14.0.min.js:60
    xb react-dom@16.v2_7_0m1670302186.14.0.min.js:162
    Bj react-dom@16.v2_7_0m1670302186.14.0.min.js:162
    U react@16.v2_7_0m1670302186.14.0.min.js:16
    onmessage react@16.v2_7_0m1670302186.14.0.min.js:24
    EventHandlerNonNull* react@16.v2_7_0m1670302186.14.0.min.js:24
    <anonymous> react@16.v2_7_0m1670302186.14.0.min.js:9
    <anonymous> react@16.v2_7_0m1670302186.14.0.min.js:9
    ...

and

Error: No match for [dashExtensions.default.function0] in the global window object.
    r index.js:33
    r index.js:18
    o index.js:53
    value React
    Ie react-dom@16.v2_7_0m1670302186.14.0.min.js:104
    rh react-dom@16.v2_7_0m1670302186.14.0.min.js:103
    zj react-dom@16.v2_7_0m1670302186.14.0.min.js:228
    Th react-dom@16.v2_7_0m1670302186.14.0.min.js:152
    tj react-dom@16.v2_7_0m1670302186.14.0.min.js:152
    Te react-dom@16.v2_7_0m1670302186.14.0.min.js:146
    Pg react-dom@16.v2_7_0m1670302186.14.0.min.js:61
    unstable_runWithPriority react@16.v2_7_0m1670302186.14.0.min.js:25
    Da react-dom@16.v2_7_0m1670302186.14.0.min.js:60
    Pg react-dom@16.v2_7_0m1670302186.14.0.min.js:61
    ha react-dom@16.v2_7_0m1670302186.14.0.min.js:60
    Dj react-dom@16.v2_7_0m1670302186.14.0.min.js:163
    unstable_runWithPriority react@16.v2_7_0m1670302186.14.0.min.js:25
    Da react-dom@16.v2_7_0m1670302186.14.0.min.js:60
    xb react-dom@16.v2_7_0m1670302186.14.0.min.js:162
    Bj react-dom@16.v2_7_0m1670302186.14.0.min.js:162
    U react@16.v2_7_0m1670302186.14.0.min.js:16
    onmessage react@16.v2_7_0m1670302186.14.0.min.js:24
    EventHandlerNonNull* react@16.v2_7_0m1670302186.14.0.min.js:24
    <anonymous> react@16.v2_7_0m1670302186.14.0.min.js:9
    <anonymous> react@16.v2_7_0m1670302186.14.0.min.js:9
    ...


问:
Upgrade to OneSignal 4.0 SDK not compatible with PCL Profile44 and others Visual Studio Mac 2022
when trying to install the OneSignal 4.x SDK to the shared project part of my pcs project I get the following error:

OneSignalSDK.Xamarin 4.1.0 with .NETPortable,Version=v4.5,Profile=Profile259.
Package OneSignalSDK.Xamarin 4.1.0 is not compatible with portable45-net45+win8+wp8+wpa81 (.NETPortable,Version=v4.5,Profile=Profile259). Package OneSignalSDK.Xamarin 4.1.0 supports:

monoandroid41 (MonoAndroid,Version=v4.1)

netstandard2.0 (.NETStandard,Version=v2.0)

xamarinios (Xamarin.iOS,Version=v0.0)

I tried almost every other Profile with the same result. I cant get this to install.
The SDK installs fine in the iOS and Android projects. And the former sdk 3.x also installed fine.

Any help on this would be great!

Thanks
Thomas


问:
Why do accessing Client certs for AAD Auth require console Apps to Run as Administrator? Does it have too?
I have a basic console app that I want to access Azure Key Vault for a connection string. Been told over and over to use client certs in production environment for AAD Authentication. Problem is doing so seems to force the console app to be "Run as Administrator" triggering the UAC, making it impossible to be scheduled unattended.

Relevant code:

```<code>
using Azure.Extensions.AspNetCore.Configuration.Secrets;
using Azure.Identity;
using Azure.Security.KeyVault.Secrets;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Serilog;
using System.Security.Cryptography.X509Certificates;

var host = Host.CreateDefaultBuilder()
.ConfigureServices((context, services) =>
{
...
    .
})
.UseSerilog()
.ConfigureAppConfiguration(config =>
{
   ...

    var credential = new ClientCertificateCredential(tenantId, clientID, GetCertificate(thumbPrint));
    var client = new SecretClient(kvUri, credential);
    config.AddAzureKeyVault(client, new AzureKeyVaultConfigurationOptions());

})
.Build();

static X509Certificate2 GetCertificate(string thumbprint)
{
    var store = new X509Store(StoreName.Root);

    try
    {
        store.Open(OpenFlags.ReadOnly | OpenFlags.OpenExistingOnly);
        var collection = store.Certificates.Find(X509FindType.FindByThumbprint, thumbprint, false);

        if (collection.Count == 0) throw new System.Exception("Certificate is not installed.");

        return collection[0];
    }
    finally
    {
        store.Close();
    }

}
</code>```

At this point I'm down to making it a Windows Background Service...

Body:
I have a basic console app that I want to access Azure Key Vault for a connection string. Been told over and over to use client certs in production environment for AAD Authentication. Problem is doing so seems to force the console app to be "Run as Administrator" triggering the UAC, making it impossible to be scheduled unattended.

Relevant code:

using Azure.Extensions.AspNetCore.Configuration.Secrets;
using Azure.Identity;
using Azure.Security.KeyVault.Secrets;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Serilog;
using System.Security.Cryptography.X509Certificates;

var host = Host.CreateDefaultBuilder()
.ConfigureServices((context, services) =>
{
...
    .
})
.UseSerilog()
.ConfigureAppConfiguration(config =>
{
   ...

    var credential = new ClientCertificateCredential(tenantId, clientID, GetCertificate(thumbPrint));
    var client = new SecretClient(kvUri, credential);
    config.AddAzureKeyVault(client, new AzureKeyVaultConfigurationOptions());

})
.Build();

static X509Certificate2 GetCertificate(string thumbprint)
{
    var store = new X509Store(StoreName.Root);

    try
    {
        store.Open(OpenFlags.ReadOnly | OpenFlags.OpenExistingOnly);
        var collection = store.Certificates.Find(X509FindType.FindByThumbprint, thumbprint, false);

        if (collection.Count == 0) throw new System.Exception("Certificate is not installed.");

        return collection[0];
    }
    finally
    {
        store.Close();
    }

}

At this point I'm down to making it a Windows Background Service...


问:
dispatchEvent without scroll on object
All works good, but in page i have scroll to this element, how i can disable scroll or how i can simulate click on btn without scroll to this button on page

    var evt = new MouseEvent("click", {
       view: window,
       bubbles: true,
       cancelable: false,
       composed: false,
    });
    document.querySelector('.selectize-input').dispatchEvent(evt);
    }```

or how to document.querySelector('.selectize-input').click()  without scroll?

Title: dispatchEvent without scroll on object

Body:
All works good, but in page i have scroll to this element, how i can disable scroll or how i can simulate click on btn without scroll to this button on page

    var evt = new MouseEvent("click", {
       view: window,
       bubbles: true,
       cancelable: false,
       composed: false,
    });
    document.querySelector('.selectize-input').dispatchEvent(evt);
    }

or how to document.querySelector('.selectize-input').click()  without scroll?


问:
Missingdataerror: exog contains inf or nan while trying to fit an OLS model
Trying to fit an OLS model but not successful.
2 responses were gotten as error:

missingdataerror: exog contains inf or nan

olsmodel1 not defined
Below is my code:
olsmodel1 =sm.OLS(y_train, x_train).fit()
print(olsmodel1.summary())

I have checked for missing values using :
df1.isna().sum()

Here is the output:

```<code>brand_name               0
os                       0
screen_size              0
4g                       0
5g                       0
main_camera_mp           0
selfie_camera_mp         0
int_memory               0
ram                      0
battery                  0
weight                   0
release_year             0
days_used                0
normalized_used_price    0
normalized_new_price     0
</code>```

I will appreciate of someone can help me out.
Thank you

I was actually expecting the OLS result to be generated

Body:
Trying to fit an OLS model but not successful.
2 responses were gotten as error:

missingdataerror: exog contains inf or nan

olsmodel1 not defined
Below is my code:
olsmodel1 =sm.OLS(y_train, x_train).fit()
print(olsmodel1.summary())

I have checked for missing values using :
df1.isna().sum()

Here is the output:

brand_name               0
os                       0
screen_size              0
4g                       0
5g                       0
main_camera_mp           0
selfie_camera_mp         0
int_memory               0
ram                      0
battery                  0
weight                   0
release_year             0
days_used                0
normalized_used_price    0
normalized_new_price     0

I will appreciate of someone can help me out.
Thank you

I was actually expecting the OLS result to be generated