问:
Can you wildcard route paths to multiple backends in Google API Gateway?
I'm trying to use Google API Gateway as the entry point for multiple backend services. The services have common endpoints, like /api/data that conflict with one another. I would like to pre-pend an identifier at the API Gateway level to route requests to the appropriate backend. In addition, I want to wildcard all requests versus explicitly defining every endpoint per service.

Example:

```<code>paths:
  '/service_1/*':
    get:
      x-google-backend:
        address: https://service_1/
        path_translation: APPEND_PATH_TO_ADDRESS
  '/service_2/*':
    get:
      x-google-backend:
        address: https://service_2/
        path_translation: APPEND_PATH_TO_ADDRESS

</code>```

In the above example, I want to EXCLUDE /service_*/ from the path that is passed to the backend. Therefore a client request like /service_1/api/data would call the backend as /api/data.

Is this possible?

Body:
I'm trying to use Google API Gateway as the entry point for multiple backend services. The services have common endpoints, like /api/data that conflict with one another. I would like to pre-pend an identifier at the API Gateway level to route requests to the appropriate backend. In addition, I want to wildcard all requests versus explicitly defining every endpoint per service.

Example:

paths:
  '/service_1/*':
    get:
      x-google-backend:
        address: https://service_1/
        path_translation: APPEND_PATH_TO_ADDRESS
  '/service_2/*':
    get:
      x-google-backend:
        address: https://service_2/
        path_translation: APPEND_PATH_TO_ADDRESS

In the above example, I want to EXCLUDE /service_*/ from the path that is passed to the backend. Therefore a client request like /service_1/api/data would call the backend as /api/data.

Is this possible?


来源: stackexchange

问:
How to convert THREE.Geometry to THREE.BufferGeometry from Face3?
I'm trying to convert/update THREE.Geometry calls to THREE.BufferGeometry when that geometry is constructed also using the deprecated THREE.Face3 calls which I can't find any tidy solution to

Source: https://github.com/juniorxsound/Depthkit.js/blob/master/README.md

```<code>DepthKit.geo = new THREE.Geometry();

    for (let y = 0; y < VERTS_TALL; y++) {
        for (let x = 0; x < VERTS_WIDE; x++) {
            DepthKit.geo.vertices.push(new THREE.Vector3(x, y, 0));
        }
    }
    for (let y = 0; y < VERTS_TALL - 1; y++) {
        for (let x = 0; x < VERTS_WIDE - 1; x++) {
            DepthKit.geo.faces.push(
                new THREE.Face3(
                    x + y * VERTS_WIDE,
                    x + (y + 1) * VERTS_WIDE,
                    (x + 1) + y * (VERTS_WIDE)
                ));
            DepthKit.geo.faces.push(
                new THREE.Face3(
                    x + 1 + y * VERTS_WIDE,
                    x + (y + 1) * VERTS_WIDE,
                    (x + 1) + (y + 1) * (VERTS_WIDE)
                ));
        }
    }
</code>```

I can get as far as using the guidance here to make an array of Vector3 as 'points' and set the points on the buffer geometry using that, but I can't get the faces between each point to be written in any similar method to that of THREE.Face3 above... Any ideas?

I'm not the only person stuck on this for well over a year

ContentLicense: CC BY-SA 4.0

Body:
I'm trying to convert/update THREE.Geometry calls to THREE.BufferGeometry when that geometry is constructed also using the deprecated THREE.Face3 calls which I can't find any tidy solution to

Source: https://github.com/juniorxsound/Depthkit.js/blob/master/README.md

DepthKit.geo = new THREE.Geometry();

    for (let y = 0; y < VERTS_TALL; y++) {
        for (let x = 0; x < VERTS_WIDE; x++) {
            DepthKit.geo.vertices.push(new THREE.Vector3(x, y, 0));
        }
    }
    for (let y = 0; y < VERTS_TALL - 1; y++) {
        for (let x = 0; x < VERTS_WIDE - 1; x++) {
            DepthKit.geo.faces.push(
                new THREE.Face3(
                    x + y * VERTS_WIDE,
                    x + (y + 1) * VERTS_WIDE,
                    (x + 1) + y * (VERTS_WIDE)
                ));
            DepthKit.geo.faces.push(
                new THREE.Face3(
                    x + 1 + y * VERTS_WIDE,
                    x + (y + 1) * VERTS_WIDE,
                    (x + 1) + (y + 1) * (VERTS_WIDE)
                ));
        }
    }

I can get as far as using the guidance here to make an array of Vector3 as 'points' and set the points on the buffer geometry using that, but I can't get the faces between each point to be written in any similar method to that of THREE.Face3 above... Any ideas?

I'm not the only person stuck on this for well over a year


问:
Reactjs Map through array of base64 images only renders last item in array
In my mongodb i have documents that contain arrays called stackUsed, the stackUsed arrays contain images converted to  base64. I want to display the base64(images) but it only renders the last item from the array for every document. I attached a picture for 1 of the stackUsed arrays.

this image is a image of the mongodb documents

This is my jsx for rendering the array but it only renders the last image in the array

```<code>   <ul>
    {stackUsed.map((image, key) => {
      return (
        <li key={key} className="stackUsedimgList">
          <img
             // what should i set src to?
            src={image}
            alt="icon corresponding programming language used."
            className="stackUsedImg"
          />
        </li>
      );
    })}
  </ul>
</code>```

Body:
In my mongodb i have documents that contain arrays called stackUsed, the stackUsed arrays contain images converted to  base64. I want to display the base64(images) but it only renders the last item from the array for every document. I attached a picture for 1 of the stackUsed arrays.

this image is a image of the mongodb documents

This is my jsx for rendering the array but it only renders the last image in the array

    {stackUsed.map((image, key) => {
      return (

      );
    })}


问:
I tried to make MultilingualModel in Django but the language keeps being by default and won't change
I am trying to make multilingual model in Django.
But my code doesn't work, it just ignores my function select_language and selects default_language. I have no idea what can cause the error. Here is my code

models.py

class MultilingualQuerySet(models.query.QuerySet):
    selected_language = None

    def __init__(self, *args, **kwargs):
        super(MultilingualQuerySet, self).__init__(*args, **kwargs)

    def select_language(self, lang):
        self.selected_language = lang
        return self

    def iterator(self):
        result_iter = super(MultilingualQuerySet, self).iterator()
        for result in result_iter:
            if hasattr(result, 'select_language'):
                result.select_language(self.selected_language)
            yield result

    def _clone(self, *args, **kwargs):
        qs = super(MultilingualQuerySet, self)._clone(*args, **kwargs)
        if hasattr(qs, 'select_language'):
            qs.select_language(self.selected_language)
        return qs

class MultilingualManager(models.Manager):
    use_for_related_fields = True
    selected_language = None

    def select_language(self, lang):
        self.selected_language = lang
        return self

    def get_query_set(self):
        qs = MultilingualQuerySet(self.model, using=self._db)
        return qs.select_language(self.selected_language)

class MultilingualModel(models.Model):
    objects = MultilingualManager()
    # fallback/default language code

    default_language = None

    # currently selected language
    selected_language = None

    class Meta:
        abstract = True

    def select_language(self, lang):
        """Select a language"""
        self.selected_language = lang
        return self

    def __getattribute__(self, name):
        def get(x):
            return super(MultilingualModel, self).__getattribute__(x)

        try:
            # Try to get the original field, if exists
            value = get(name)
            # If we can select language on the field as well, do it
            if isinstance(value, MultilingualModel):
                value.select_language(get('selected_language'))
            return value
        except AttributeError as e:
            # Try the translated variant, falling back to default if no
            # language has been explicitly selected
            lang = self.selected_language
            if not lang:
                lang = self.default_language
            if not lang:
                raise

            value = get(name + '_' + lang)

            # If the translated variant is empty, fallback to default
            if isinstance(value, str) and value == u'':
                value = get(name + '_' + self.default_language)

        return value

class Blog(MultilingualModel):
    default_language = 'es'

    title_en = models.CharField(max_length=300, blank=True, default='')
    title_es = models.CharField(max_length=300, blank=True, default='')
    text_en = models.TextField(blank=True, default='')
    text_es = models.TextField(blank=True, default='')
    photo1 = models.ImageField(upload_to='photos_blog/%Y/%m/')

    def __str__(self):
        return self.title

```
<p>And I tried to get all <code>Blog</code> objects with English title</p>
```print(Blog.objects.select_language('en').all())
```

But I still get Spanish titles.

Body:
I am trying to make multilingual model in Django.
But my code doesn't work, it just ignores my function select_language and selects default_language. I have no idea what can cause the error. Here is my code

models.py

class MultilingualQuerySet(models.query.QuerySet):
    selected_language = None

    def __init__(self, *args, **kwargs):
        super(MultilingualQuerySet, self).__init__(*args, **kwargs)

    def select_language(self, lang):
        self.selected_language = lang
        return self

    def iterator(self):
        result_iter = super(MultilingualQuerySet, self).iterator()
        for result in result_iter:
            if hasattr(result, 'select_language'):
                result.select_language(self.selected_language)
            yield result

    def _clone(self, *args, **kwargs):
        qs = super(MultilingualQuerySet, self)._clone(*args, **kwargs)
        if hasattr(qs, 'select_language'):
            qs.select_language(self.selected_language)
        return qs

class MultilingualManager(models.Manager):
    use_for_related_fields = True
    selected_language = None

    def select_language(self, lang):
        self.selected_language = lang
        return self

    def get_query_set(self):
        qs = MultilingualQuerySet(self.model, using=self._db)
        return qs.select_language(self.selected_language)

class MultilingualModel(models.Model):
    objects = MultilingualManager()
    # fallback/default language code

    default_language = None

    # currently selected language
    selected_language = None

    class Meta:
        abstract = True

    def select_language(self, lang):
        """Select a language"""
        self.selected_language = lang
        return self

    def __getattribute__(self, name):
        def get(x):
            return super(MultilingualModel, self).__getattribute__(x)

        try:
            # Try to get the original field, if exists
            value = get(name)
            # If we can select language on the field as well, do it
            if isinstance(value, MultilingualModel):
                value.select_language(get('selected_language'))
            return value
        except AttributeError as e:
            # Try the translated variant, falling back to default if no
            # language has been explicitly selected
            lang = self.selected_language
            if not lang:
                lang = self.default_language
            if not lang:
                raise

            value = get(name + '_' + lang)

            # If the translated variant is empty, fallback to default
            if isinstance(value, str) and value == u'':
                value = get(name + '_' + self.default_language)

        return value

class Blog(MultilingualModel):
    default_language = 'es'

    title_en = models.CharField(max_length=300, blank=True, default='')
    title_es = models.CharField(max_length=300, blank=True, default='')
    text_en = models.TextField(blank=True, default='')
    text_es = models.TextField(blank=True, default='')
    photo1 = models.ImageField(upload_to='photos_blog/%Y/%m/')

    def __str__(self):
        return self.title

And I tried to get all Blog objects with English title

print(Blog.objects.select_language('en').all())

But I still get Spanish titles.


问:
Azure CosmosDB Pagination without OrderBy
When we execute a simple query on CosmosDB without any SORT/Order By clauses :-

```<code>SELECT * from c
</code>```

What is the order of the records retrieved? Is it insertion order or is it random and unpredictable?

If it's random, how does it maintain order for a paginated Query? And what happens if more records are inserted after I get a continuation token from a query?

Body:
When we execute a simple query on CosmosDB without any SORT/Order By clauses :-

SELECT * from c

What is the order of the records retrieved? Is it insertion order or is it random and unpredictable?

If it's random, how does it maintain order for a paginated Query? And what happens if more records are inserted after I get a continuation token from a query?


问:
What is the correct way to yield values from events?
Suppose a function that gets called on messages like this:

def on_message(message):
    yield message # can't use return value
```
<p>I wish to create a function that uses a generator continuously yield the messages:</p>
<pre class="lang-py prettyprint-override"><code>def get_all_messages():
  # yield from on_message()
</code>```

What would be the correct way to do this?

I have thought of these possible ways:

Using files or os.pipe. Create a file and write to it on the on_message function, and in the get_all_messages function read from that file in an infinite loop and yield the buffer. This is less preferable as I would have to create temporary files, and also convert all of my data to strings or raw bytes.

Using sockets for IO in a similar way to how I would use files. This is also less preferable then I have to create a server and connect to it.

Body:
Suppose a function that gets called on messages like this:

def on_message(message):
    yield message # can't use return value

I wish to create a function that uses a generator continuously yield the messages:

def get_all_messages():
  # yield from on_message()

What would be the correct way to do this?

I have thought of these possible ways:

Using files or os.pipe. Create a file and write to it on the on_message function, and in the get_all_messages function read from that file in an infinite loop and yield the buffer. This is less preferable as I would have to create temporary files, and also convert all of my data to strings or raw bytes.

Using sockets for IO in a similar way to how I would use files. This is also less preferable then I have to create a server and connect to it.


问:
How can I set up this Python file to set d = dict() with the correct data so I can use it in all methods? This python file is called through C++
Python File:

```<code>import re
import string

class Dictonary:

    d = dict()

    def __init__(self):
       Dictonary.d = storeData();

def storeData():
    text = open("CS210_Project_Three_Input_File.txt", "r")
    d = dict()
    for line in text:
        line = line.strip()
        line = line.lower()
        words = line.split(" ")
        for word in words:
            if word in d:
                d[word] = d[word] + 1
            else:
                d[word] = 1
    return d;

def countTimesEveryItemOccurs():
    for key in list(Dictonary.d.keys()):
        print(key, ":", Dictonary.d[key])

</code>```

I call this Python file within the C++ file below. I want to be able to set the quantity of all the items in the text file when I first call the menu. Since each option will need that data, I would not like to recall the same code over and over. I would like to set the data within d = dict(). What would be the best way to set this up? Maybe set up a Class within Python file?

C++ File:

```<code>#include <Python.h>
#include <iostream>
#include <Windows.h>
#include <cmath>
#include <string>
#include<fstream>
#include<sstream>

using namespace std;

/*
Description:
    To call this function, simply pass the function name in Python that you wish to call.
Example:
    callProcedure("printsomething");
Output:
    Python will print on the screen: Hello from python!
Return:
    None
*/
void CallProcedure(string pName)
{
    char* procname = new char[pName.length() + 1];
    std::strcpy(procname, pName.c_str());

    Py_Initialize();
    PyObject* my_module = PyImport_ImportModule("PythonCode");
    PyErr_Print();
    PyObject* my_function = PyObject_GetAttrString(my_module, procname);
    PyObject* my_result = PyObject_CallObject(my_function, NULL);
    Py_Finalize();

    delete[] procname;
}

/*
Description:
    To call this function, pass the name of the Python functino you wish to call and the string parameter you want to send
Example:
    int x = callIntFunc("PrintMe","Test");
Output:
    Python will print on the screen:
        You sent me: Test
Return:
    100 is returned to the C++
*/
int callIntFunc(string proc, string param)
{
    char* procname = new char[proc.length() + 1];
    std::strcpy(procname, proc.c_str());

    char* paramval = new char[param.length() + 1];
    std::strcpy(paramval, param.c_str());

    PyObject* pName, * pModule, * pDict, * pFunc, * pValue = nullptr, * presult = nullptr;
    // Initialize the Python Interpreter
    Py_Initialize();
    // Build the name object
    pName = PyUnicode_FromString((char*)"PythonCode");
    // Load the module object
    pModule = PyImport_Import(pName);
    // pDict is a borrowed reference
    pDict = PyModule_GetDict(pModule);
    // pFunc is also a borrowed reference
    pFunc = PyDict_GetItemString(pDict, procname);
    if (PyCallable_Check(pFunc))
    {
        pValue = Py_BuildValue("(z)", paramval);
        PyErr_Print();
        presult = PyObject_CallObject(pFunc, pValue);
        PyErr_Print();
    }
    else
    {
        PyErr_Print();
    }
    //printf("Result is %d\n", _PyLong_AsInt(presult));
    Py_DECREF(pValue);
    // Clean up
    Py_DECREF(pModule);
    Py_DECREF(pName);
    // Finish the Python Interpreter
    Py_Finalize();

    // clean
    delete[] procname;
    delete[] paramval;

    return _PyLong_AsInt(presult);
}

/*
Description:
    To call this function, pass the name of the Python functino you wish to call and the string parameter you want to send
Example:
    int x = callIntFunc("doublevalue",5);
Return:
    25 is returned to the C++
*/
int callIntFunc(string proc, int param)
{
    char* procname = new char[proc.length() + 1];
    std::strcpy(procname, proc.c_str());

    PyObject* pName, * pModule, * pDict, * pFunc, * pValue = nullptr, * presult = nullptr;
    // Initialize the Python Interpreter
    Py_Initialize();
    // Build the name object
    pName = PyUnicode_FromString((char*)"PythonCode");
    // Load the module object
    pModule = PyImport_Import(pName);
    // pDict is a borrowed reference
    pDict = PyModule_GetDict(pModule);
    // pFunc is also a borrowed reference
    pFunc = PyDict_GetItemString(pDict, procname);
    if (PyCallable_Check(pFunc))
    {
        pValue = Py_BuildValue("(i)", param);
        PyErr_Print();
        presult = PyObject_CallObject(pFunc, pValue);
        PyErr_Print();
    }
    else
    {
        PyErr_Print();
    }
    //printf("Result is %d\n", _PyLong_AsInt(presult));
    Py_DECREF(pValue);
    // Clean up
    Py_DECREF(pModule);
    Py_DECREF(pName);
    // Finish the Python Interpreter
    Py_Finalize();

    // clean
    delete[] procname;

    return _PyLong_AsInt(presult);
}

string nCharString(int t_length, char t_character) { //Parameter: length, (Number of times character is repeated) / Parameter character (Character to be repeated).
    string returnString;                         //String to be returned.
    for (int i = 0; i < t_length; i++) {             //Loop 'length' amount of times.
        returnString += t_character;                 //Adding the 'character' to 'returnString' each time.
    }
    return returnString;                         //Return 'returnString'.
}

boolean checkIfDigitAndRange(string input, int lowEnd, int highEnd, int& choice) {
    if (isdigit(input[0])) {
        int temp = stoi(input);
        if (temp >= lowEnd && temp <= highEnd) {
            choice = temp;
            return true;
        }
        else{
            cout << "Out of range choice, try again!" << endl;
            return false;
        }
    }
    cout << "Digit was not entered, try again!" << endl;
    return false;   // If NOT digit
}

boolean checkIfInputYesOrNo(char input) {
    if (input == 'y' || input == 'Y')
        return true;
    return false;
}

void readFile() {   // Function to read the file with a paramater of a vector composed of City objects, and a & sign since we will change this vector's contents.
    fstream file;   // Create fstream instance.
    file.open("CS210_Project_Three_Input_File.txt", ios::in);    // Open the file.
    if (file.is_open()) {
        string line;
        while (getline(file, line)) {

        }
        cout << "CS210_Project_Three_Input_File.txt opened and read successfully!" << endl;
    }
    else   // If file was not open.
        cout << "Unable to open file\n";    // Print to console to show that it was NOT successful.
    file.close();   // Close file, this is so we can use the file again.
}

void choiceOne() {
    cout << "List of quantity of each item purchased on a given day." << endl << nCharString(55, '-') << endl;
    CallProcedure("countTimesEveryItemOccurs");
    cout << endl << "Would you like to rerun this program? Enter 'Y' for yes, enter anything else for no!" << endl;
}

void choiceTwo() {
    string itemToFind;
    cout << "Enter an item to see how much that item sold on a given day:" << endl;
    cin >> itemToFind;
    system("cls");
    cout << itemToFind << " was sold " << callIntFunc("countSpecificItemOccurances", itemToFind) << "times!";

}

void choiceThree() {

}

int getMenuAndChoice() {
    char yOrNo;
    string input;
    while (true) {
        int choice = 0;
        cout << nCharString(78, '-') << endl;
        cout << "Choose an option, '1', '2', '3', or '4'" << endl;
        cout << "1: Produce list of number of times each item was purchased." << endl;
        cout << "2: Produce a number representing how many times a specific item was purchased." << endl;
        cout << "3: Produce a text-based histogram listing all items purchased." << endl;
        cout << "4: Exit Program." << endl;
        cout << nCharString(78, '-') << endl;
        cin >> input;
        system("cls");
        if (checkIfDigitAndRange(input, 1, 4, choice)) {
            if (choice == 1) {
                choiceOne();
                cin >> yOrNo;
                if (!checkIfInputYesOrNo(yOrNo))
                    break;
                system("cls");
            }
            else if (choice == 2) {
                choiceTwo();
                cin >> yOrNo;
                if (!checkIfInputYesOrNo(yOrNo))
                    break;
                system("cls");
            }
            else if (choice == 3) {
                choiceThree();
                cin >> yOrNo;
                if (!checkIfInputYesOrNo(yOrNo))
                    break;
                system("cls");
            }
            else {
                break;
            }
        }
    }
}

void main()
{
    getMenuAndChoice();

}
</code>```

Body:
Python File:

import re
import string

class Dictonary:

    d = dict()

    def __init__(self):
       Dictonary.d = storeData();

def storeData():
    text = open("CS210_Project_Three_Input_File.txt", "r")
    d = dict()
    for line in text:
        line = line.strip()
        line = line.lower()
        words = line.split(" ")
        for word in words:
            if word in d:
                d[word] = d[word] + 1
            else:
                d[word] = 1
    return d;

def countTimesEveryItemOccurs():
    for key in list(Dictonary.d.keys()):
        print(key, ":", Dictonary.d[key])

I call this Python file within the C++ file below. I want to be able to set the quantity of all the items in the text file when I first call the menu. Since each option will need that data, I would not like to recall the same code over and over. I would like to set the data within d = dict(). What would be the best way to set this up? Maybe set up a Class within Python file?

C++ File:

#include <Python.h>
#include <iostream>
#include <Windows.h>
#include <cmath>
#include <string>
#include<fstream>
#include<sstream>

using namespace std;

/*
Description:
    To call this function, simply pass the function name in Python that you wish to call.
Example:
    callProcedure("printsomething");
Output:
    Python will print on the screen: Hello from python!
Return:
    None
*/
void CallProcedure(string pName)
{
    char* procname = new char[pName.length() + 1];
    std::strcpy(procname, pName.c_str());

    Py_Initialize();
    PyObject* my_module = PyImport_ImportModule("PythonCode");
    PyErr_Print();
    PyObject* my_function = PyObject_GetAttrString(my_module, procname);
    PyObject* my_result = PyObject_CallObject(my_function, NULL);
    Py_Finalize();

    delete[] procname;
}

/*
Description:
    To call this function, pass the name of the Python functino you wish to call and the string parameter you want to send
Example:
    int x = callIntFunc("PrintMe","Test");
Output:
    Python will print on the screen:
        You sent me: Test
Return:
    100 is returned to the C++
*/
int callIntFunc(string proc, string param)
{
    char* procname = new char[proc.length() + 1];
    std::strcpy(procname, proc.c_str());

    char* paramval = new char[param.length() + 1];
    std::strcpy(paramval, param.c_str());

    PyObject* pName, * pModule, * pDict, * pFunc, * pValue = nullptr, * presult = nullptr;
    // Initialize the Python Interpreter
    Py_Initialize();
    // Build the name object
    pName = PyUnicode_FromString((char*)"PythonCode");
    // Load the module object
    pModule = PyImport_Import(pName);
    // pDict is a borrowed reference
    pDict = PyModule_GetDict(pModule);
    // pFunc is also a borrowed reference
    pFunc = PyDict_GetItemString(pDict, procname);
    if (PyCallable_Check(pFunc))
    {
        pValue = Py_BuildValue("(z)", paramval);
        PyErr_Print();
        presult = PyObject_CallObject(pFunc, pValue);
        PyErr_Print();
    }
    else
    {
        PyErr_Print();
    }
    //printf("Result is %d\n", _PyLong_AsInt(presult));
    Py_DECREF(pValue);
    // Clean up
    Py_DECREF(pModule);
    Py_DECREF(pName);
    // Finish the Python Interpreter
    Py_Finalize();

    // clean
    delete[] procname;
    delete[] paramval;

    return _PyLong_AsInt(presult);
}

/*
Description:
    To call this function, pass the name of the Python functino you wish to call and the string parameter you want to send
Example:
    int x = callIntFunc("doublevalue",5);
Return:
    25 is returned to the C++
*/
int callIntFunc(string proc, int param)
{
    char* procname = new char[proc.length() + 1];
    std::strcpy(procname, proc.c_str());

    PyObject* pName, * pModule, * pDict, * pFunc, * pValue = nullptr, * presult = nullptr;
    // Initialize the Python Interpreter
    Py_Initialize();
    // Build the name object
    pName = PyUnicode_FromString((char*)"PythonCode");
    // Load the module object
    pModule = PyImport_Import(pName);
    // pDict is a borrowed reference
    pDict = PyModule_GetDict(pModule);
    // pFunc is also a borrowed reference
    pFunc = PyDict_GetItemString(pDict, procname);
    if (PyCallable_Check(pFunc))
    {
        pValue = Py_BuildValue("(i)", param);
        PyErr_Print();
        presult = PyObject_CallObject(pFunc, pValue);
        PyErr_Print();
    }
    else
    {
        PyErr_Print();
    }
    //printf("Result is %d\n", _PyLong_AsInt(presult));
    Py_DECREF(pValue);
    // Clean up
    Py_DECREF(pModule);
    Py_DECREF(pName);
    // Finish the Python Interpreter
    Py_Finalize();

    // clean
    delete[] procname;

    return _PyLong_AsInt(presult);
}

string nCharString(int t_length, char t_character) { //Parameter: length, (Number of times character is repeated) / Parameter character (Character to be repeated).
    string returnString;                         //String to be returned.
    for (int i = 0; i < t_length; i++) {             //Loop 'length' amount of times.
        returnString += t_character;                 //Adding the 'character' to 'returnString' each time.
    }
    return returnString;                         //Return 'returnString'.
}

boolean checkIfDigitAndRange(string input, int lowEnd, int highEnd, int& choice) {
    if (isdigit(input[0])) {
        int temp = stoi(input);
        if (temp >= lowEnd && temp <= highEnd) {
            choice = temp;
            return true;
        }
        else{
            cout << "Out of range choice, try again!" << endl;
            return false;
        }
    }
    cout << "Digit was not entered, try again!" << endl;
    return false;   // If NOT digit
}

boolean checkIfInputYesOrNo(char input) {
    if (input == 'y' || input == 'Y')
        return true;
    return false;
}

void readFile() {   // Function to read the file with a paramater of a vector composed of City objects, and a & sign since we will change this vector's contents.
    fstream file;   // Create fstream instance.
    file.open("CS210_Project_Three_Input_File.txt", ios::in);    // Open the file.
    if (file.is_open()) {
        string line;
        while (getline(file, line)) {

        }
        cout << "CS210_Project_Three_Input_File.txt opened and read successfully!" << endl;
    }
    else   // If file was not open.
        cout << "Unable to open file\n";    // Print to console to show that it was NOT successful.
    file.close();   // Close file, this is so we can use the file again.
}

void choiceOne() {
    cout << "List of quantity of each item purchased on a given day." << endl << nCharString(55, '-') << endl;
    CallProcedure("countTimesEveryItemOccurs");
    cout << endl << "Would you like to rerun this program? Enter 'Y' for yes, enter anything else for no!" << endl;
}

void choiceTwo() {
    string itemToFind;
    cout << "Enter an item to see how much that item sold on a given day:" << endl;
    cin >> itemToFind;
    system("cls");
    cout << itemToFind << " was sold " << callIntFunc("countSpecificItemOccurances", itemToFind) << "times!";

}

void choiceThree() {

}

int getMenuAndChoice() {
    char yOrNo;
    string input;
    while (true) {
        int choice = 0;
        cout << nCharString(78, '-') << endl;
        cout << "Choose an option, '1', '2', '3', or '4'" << endl;
        cout << "1: Produce list of number of times each item was purchased." << endl;
        cout << "2: Produce a number representing how many times a specific item was purchased." << endl;
        cout << "3: Produce a text-based histogram listing all items purchased." << endl;
        cout << "4: Exit Program." << endl;
        cout << nCharString(78, '-') << endl;
        cin >> input;
        system("cls");
        if (checkIfDigitAndRange(input, 1, 4, choice)) {
            if (choice == 1) {
                choiceOne();
                cin >> yOrNo;
                if (!checkIfInputYesOrNo(yOrNo))
                    break;
                system("cls");
            }
            else if (choice == 2) {
                choiceTwo();
                cin >> yOrNo;
                if (!checkIfInputYesOrNo(yOrNo))
                    break;
                system("cls");
            }
            else if (choice == 3) {
                choiceThree();
                cin >> yOrNo;
                if (!checkIfInputYesOrNo(yOrNo))
                    break;
                system("cls");
            }
            else {
                break;
            }
        }
    }
}

void main()
{
    getMenuAndChoice();

}


问:
Firestore: Copy/Import data from local emulator to Cloud DB
I need to copy Firestore DB data from my local Firebase emulator to the cloud instance. I can move data from the Cloud DB to the local DB fine, using the EXPORT functionality in the Firebase admin console.  We have been working on the local database instance for 3-4 months and now we need to move it back to the Cloud.  I have tried to move the local "--export-on-exit" files back to my storage bucket and then IMPORT from there to the Cloud DB, but it fails everytime.

I have seen one comment by Doug at https://stackoverflow.com/a/71819566/20390759 that this is not possible, but the best solution is to write a program to copy from local to cloud.  I've started working on that, but I can't find a way to have both projects/databases open at the same time, both local and cloud.  They are all the same project ID, app-key, etc.

Attempted IMPORT:  I copied the files created by "--export-on-exit" in the emulator to my cloud storage bucket.  Then, I selected IMPORT and chose the file I copied up to the bucket.  I get this error message:

Google Cloud Storage file does not exist: /xxxxxx.appspot.com/2022-12-05 from local/2022-12-05 from local.overall_export_metadata

So, I renamed the file metadata file to match the directory name from the local system, and the IMPORT claims to initiate successfully, but then fails with no error message.

I've been using Firestore for several years, but we just started using the emulator this year.  Overall I like it, but if I can't easily move data back to the Cloud, I can't use it.  Thanks for any ideas/help.


问:
Trouble Importing KMeans from Sklearn
I Have an error message when importing KMeans but I am able to import pandas and matplotlib.pyplot

Error Message is as follows:

```<code>TypeError                                 Traceback (most recent call last)
File /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/numpy/core/getlimits.py:649, in iinfo.__init__(self, int_type)
    648 try:
--> 649     self.dtype = numeric.dtype(int_type)
    650 except TypeError:

TypeError: 'NoneType' object is not callable

During handling of the above exception, another exception occurred:

TypeError                                 Traceback (most recent call last)
/Users/Downloads/Unclassified Learning/Unclassified Learning.ipynb Cell 27 in <cell line: 1>()
----> 1 from sklearn.cluster.KMeans import KMeans

File /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/sklearn/__init__.py:82, in <module>
     80 from . import _distributor_init  # noqa: F401
     81 from . import __check_build  # noqa: F401
---> 82 from .base import clone
     83 from .utils._show_versions import show_versions
     85 __all__ = [
     86     "calibration",
     87     "cluster",
   (...)
    128     "show_versions",
...
--> 651     self.dtype = numeric.dtype(type(int_type))
    652 self.kind = self.dtype.kind
    653 self.bits = self.dtype.itemsize * 8

TypeError: 'NoneType' object is not callable
</code>```

I tried different variations of the code to import KMeans but still get the same error, would love to understand what is causing this. I have tried pip install -U scikit-learn and then the import but has this error instead:

```<code>TypeError                                 Traceback (most recent call last)
File /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/numpy/core/getlimits.py:649, in iinfo.__init__(self, int_type)
    648 try:
--> 649     self.dtype = numeric.dtype(int_type)
    650 except TypeError:

TypeError: 'NoneType' object is not callable

During handling of the above exception, another exception occurred:

TypeError                                 Traceback (most recent call last)
/Users/Downloads/Unclassified Learning/Unclassified Learning.ipynb Cell 27 in <cell line: 2>()
      1 get_ipython().system('pip install -U scikit-learn')
----> 2 from sklearn.cluster import KMeans

File /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/sklearn/__init__.py:82, in <module>
     80 from . import _distributor_init  # noqa: F401
     81 from . import __check_build  # noqa: F401
---> 82 from .base import clone
     83 from .utils._show_versions import show_versions
     85 __all__ = [
     86     "calibration",
     87     "cluster",
   (...)
...
--> 651     self.dtype = numeric.dtype(type(int_type))
    652 self.kind = self.dtype.kind
    653 self.bits = self.dtype.itemsize * 8

TypeError: 'NoneType' object is not callable
</code>```

I have done this for other libraries and no issue so I am very lost, would appreciate any help!

Title: Trouble Importing KMeans from Sklearn

Body:
I Have an error message when importing KMeans but I am able to import pandas and matplotlib.pyplot

Error Message is as follows:

TypeError                                 Traceback (most recent call last)
File /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/numpy/core/getlimits.py:649, in iinfo.__init__(self, int_type)
    648 try:
--> 649     self.dtype = numeric.dtype(int_type)
    650 except TypeError:

TypeError: 'NoneType' object is not callable

During handling of the above exception, another exception occurred:

TypeError                                 Traceback (most recent call last)
/Users/Downloads/Unclassified Learning/Unclassified Learning.ipynb Cell 27 in <cell line: 1>()
----> 1 from sklearn.cluster.KMeans import KMeans

File /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/sklearn/__init__.py:82, in <module>
     80 from . import _distributor_init  # noqa: F401
     81 from . import __check_build  # noqa: F401
---> 82 from .base import clone
     83 from .utils._show_versions import show_versions
     85 __all__ = [
     86     "calibration",
     87     "cluster",
   (...)
    128     "show_versions",
...
--> 651     self.dtype = numeric.dtype(type(int_type))
    652 self.kind = self.dtype.kind
    653 self.bits = self.dtype.itemsize * 8

TypeError: 'NoneType' object is not callable

I tried different variations of the code to import KMeans but still get the same error, would love to understand what is causing this. I have tried pip install -U scikit-learn and then the import but has this error instead:

TypeError                                 Traceback (most recent call last)
File /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/numpy/core/getlimits.py:649, in iinfo.__init__(self, int_type)
    648 try:
--> 649     self.dtype = numeric.dtype(int_type)
    650 except TypeError:

TypeError: 'NoneType' object is not callable

During handling of the above exception, another exception occurred:

TypeError                                 Traceback (most recent call last)
/Users/Downloads/Unclassified Learning/Unclassified Learning.ipynb Cell 27 in <cell line: 2>()
      1 get_ipython().system('pip install -U scikit-learn')
----> 2 from sklearn.cluster import KMeans

File /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/sklearn/__init__.py:82, in <module>
     80 from . import _distributor_init  # noqa: F401
     81 from . import __check_build  # noqa: F401
---> 82 from .base import clone
     83 from .utils._show_versions import show_versions
     85 __all__ = [
     86     "calibration",
     87     "cluster",
   (...)
...
--> 651     self.dtype = numeric.dtype(type(int_type))
    652 self.kind = self.dtype.kind
    653 self.bits = self.dtype.itemsize * 8

TypeError: 'NoneType' object is not callable

I have done this for other libraries and no issue so I am very lost, would appreciate any help!


问:
Scraping an HTML Table which is returning a list of 0
I am trying to scrape a table from OECD website about FDI b/w 2005-2021. But when I run the code for the table using html_table, it's returning a list of 0.

I tried the same code with a different table and it worked fine, but this one is not working.

```<code>library(rvest)
library(dplyr)

link = "https://data.oecd.org/fdi/fdi-flows.htm#indicator-table"
page = read_html(link)
table = page %>% html_nodes("table.DataTable") %>% html_table()
</code>```

the above code is returning 'table2: List of 0' and consequently converting it to a table with %>% . [[1]] is not working because it gives the following error:

```<code>Error in .[[1]] : subscript out of bounds
</code>```

Body:
I am trying to scrape a table from OECD website about FDI b/w 2005-2021. But when I run the code for the table using html_table, it's returning a list of 0.

I tried the same code with a different table and it worked fine, but this one is not working.

library(rvest)
library(dplyr)

link = "https://data.oecd.org/fdi/fdi-flows.htm#indicator-table"
page = read_html(link)
table = page %>% html_nodes("table.DataTable") %>% html_table()

the above code is returning 'table2: List of 0' and consequently converting it to a table with %>% . [[1]] is not working because it gives the following error:

Error in .[[1]] : subscript out of bounds


问:
not reach breakpoints in application development ---- using spyder as python IDE in a virtual environment
I am using the spyder IDE  for python. I am not reaching breakpoint when debuging my application using the main program "DIEP_LEAPS_KJL.pyw" which is outside of the package "betaDIEPLEAPS".

(If I save the "DIEP_LEAPS_KJL.pys" within the packages, components of a subpackage do not import on from the ini file.)

I've tried...
-adding the project folder to pythonpath
-installing the application within the environment with "-e" option to make it editable


问:
Question about the interaction between Fragments and the Adapter (Kotlin) (Android)
Is it possible to share variable values between Fragments and RecyclerView Adapters? I am currently using SharedPreferences to store data persistently.

I am currently working on a Save button that upon clicking, it will save the article in the Room database. Each itemview in the recyclerview has a save button, I am having trouble updating the UI of the button upon clicking it.

For example, the button is supposed to have a default text save, upon clicking it once, it saves the data and changes the Button text to saved.
In the Activity below I initialized the preferences variable

MainActivity.kt

```<code>class MainActivity : AppCompatActivity() {
   lateinit var preferences:SharedPreferences

   override fun onCreate(savedInstanceState: Bundle?) {
         preferences = getSharedPreferences("file",Context.MODE_PRIVATE)
   }
}
</code>```

This is the fragment where I use the RecyclerView. In the code below I am resolving the logic part of the button, like for instance when the button is clicked it is saved in the Database/displaying Toast.

That is when the main problem comes as I am having difficulty syncing the UI and the Logic aspect of the Button. The if-statement helps with the states of the button

BreakingNewsFragment

```<code>class BreakingNews: Fragment(R.layout.breakingnews) {
   lateinit var Main:SharedPreferences
   override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)

        Main = (activity as MainActivity).preferences  //Initializing the Main lateinit var
        val editor = Main.edit()

        newsAdapter.savedOnClickListener {
            if(Main.getInt("numbers",0) == 0)
            {
            editor.putInt("Adapter",0).apply()

            Toast.makeText(activity, "Article Successfully saved", Toast.LENGTH_SHORT).show()
            editor.putInt("numbers",1).apply()
                viewModel.saveArticle(it)

            }else if(Main.getInt("numbers",0) == 1) {
                editor.putInt("Adapter",1).apply()

                android.widget.Toast.makeText(activity, "Article is already saved", android.widget.Toast.LENGTH_SHORT).show()
                editor.putInt("numbers",2).apply()

            }else if(Main.getInt("numbers",0) == 2){
                editor.clear().apply()
                android.widget.Toast.makeText(activity, "Restart", android.widget.Toast.LENGTH_SHORT).show()
            }
        }
}
    }
</code>```

This is where I will handle the UI portion of the Button, I can't find a way to share variable values between the Adapter and the Fragment so they can be in sync.

NewsAdapter.kt

```<code>class NewsAdapter: RecyclerView.Adapter<NewsAdapter.ArticleViewHolder>() {
     class ArticleViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView){

         val button = itemView.findViewById<Button>(R.id.button)}

     fun savedOnClickListener(listen:(Article) -> Unit) {
         SavedonItemClickListener = listen
     }

     private var SavedonItemClickListener: ((Article) -> Unit)? = null

  override fun onBindViewHolder(holder: ArticleViewHolder, position: Int) {

    val article = differ.currentList[position]
    holder.button.setOnClickListener {
        Log.e("Adapter","Before savedOnITEM")
                SavedonItemClickListener?.let {
                        Log.e("Adapter","After if")
                        it(article)
        }
        }
}
}
</code>```

Body:
Is it possible to share variable values between Fragments and RecyclerView Adapters? I am currently using SharedPreferences to store data persistently.

I am currently working on a Save button that upon clicking, it will save the article in the Room database. Each itemview in the recyclerview has a save button, I am having trouble updating the UI of the button upon clicking it.

For example, the button is supposed to have a default text save, upon clicking it once, it saves the data and changes the Button text to saved.
In the Activity below I initialized the preferences variable

MainActivity.kt

class MainActivity : AppCompatActivity() {
   lateinit var preferences:SharedPreferences

   override fun onCreate(savedInstanceState: Bundle?) {
         preferences = getSharedPreferences("file",Context.MODE_PRIVATE)
   }
}

This is the fragment where I use the RecyclerView. In the code below I am resolving the logic part of the button, like for instance when the button is clicked it is saved in the Database/displaying Toast.

That is when the main problem comes as I am having difficulty syncing the UI and the Logic aspect of the Button. The if-statement helps with the states of the button

BreakingNewsFragment

class BreakingNews: Fragment(R.layout.breakingnews) {
   lateinit var Main:SharedPreferences
   override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)

        Main = (activity as MainActivity).preferences  //Initializing the Main lateinit var
        val editor = Main.edit()

        newsAdapter.savedOnClickListener {
            if(Main.getInt("numbers",0) == 0)
            {
            editor.putInt("Adapter",0).apply()

            Toast.makeText(activity, "Article Successfully saved", Toast.LENGTH_SHORT).show()
            editor.putInt("numbers",1).apply()
                viewModel.saveArticle(it)

            }else if(Main.getInt("numbers",0) == 1) {
                editor.putInt("Adapter",1).apply()

                android.widget.Toast.makeText(activity, "Article is already saved", android.widget.Toast.LENGTH_SHORT).show()
                editor.putInt("numbers",2).apply()

            }else if(Main.getInt("numbers",0) == 2){
                editor.clear().apply()
                android.widget.Toast.makeText(activity, "Restart", android.widget.Toast.LENGTH_SHORT).show()
            }
        }
}
    }

This is where I will handle the UI portion of the Button, I can't find a way to share variable values between the Adapter and the Fragment so they can be in sync.

NewsAdapter.kt

class NewsAdapter: RecyclerView.Adapter<NewsAdapter.ArticleViewHolder>() {
     class ArticleViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView){

         val button = itemView.findViewById<Button>(R.id.button)}

     fun savedOnClickListener(listen:(Article) -> Unit) {
         SavedonItemClickListener = listen
     }

     private var SavedonItemClickListener: ((Article) -> Unit)? = null

  override fun onBindViewHolder(holder: ArticleViewHolder, position: Int) {

    val article = differ.currentList[position]
    holder.button.setOnClickListener {
        Log.e("Adapter","Before savedOnITEM")
                SavedonItemClickListener?.let {
                        Log.e("Adapter","After if")
                        it(article)
        }
        }
}
}


问:
Setting profile for dependency of multipart project command line
I have a multi-module project. Basically, I have a Project A, and Project B (An integration test). Project B relies on Project A to run. So when we run project B, we do something like: mvn clean package -B -pl :project-B -am. The -am part of the command instructs maven to also compile the dependency (Project A) and to include it. Problem is... When we run the dependency for project A, it doesn't seem to be pulling the correct profile. How do we set the profile to be used for compilation for dependency A in this command?

Thanks!


问:
Adding file path from options in Command line argument(Python)
Im trying to call a script to run some commands in remote dev server with this path.

Sample code for dev server

```<code>def funcA():

        if os.path.exists("/opt/dev/bin"):
            process = subprocess.run(["ls", "****" , "*****"],stdout=subprocess.PIPE)
        else:
            print("the path doesnt exist")
            sys.exit(2)

</code>```

When i run it it works fine. I want to modify the script in such a way that i can check paths in different environment

I tried this

```<code>def funcA():
    path=sys.argv[1]

 if os.path.exists(path):
            process = subprocess.run(["ls", "****" , "*****"],stdout=subprocess.PIPE)
        else:
            print("the path doesnt exist")
            sys.exit(2)

i add the path as argument it works fine.

sample.py /opt/prod/bin
</code>```

Is there a better way to do this ?   instead of entering the whole path  as argument such as asking the user which environment(prod,test etc) and updating the path accordingly ?

Body:
Im trying to call a script to run some commands in remote dev server with this path.

Sample code for dev server

def funcA():

        if os.path.exists("/opt/dev/bin"):
            process = subprocess.run(["ls", "****" , "*****"],stdout=subprocess.PIPE)
        else:
            print("the path doesnt exist")
            sys.exit(2)

When i run it it works fine. I want to modify the script in such a way that i can check paths in different environment

I tried this

def funcA():
    path=sys.argv[1]

 if os.path.exists(path):
            process = subprocess.run(["ls", "****" , "*****"],stdout=subprocess.PIPE)
        else:
            print("the path doesnt exist")
            sys.exit(2)

i add the path as argument it works fine.

sample.py /opt/prod/bin

Is there a better way to do this ?   instead of entering the whole path  as argument such as asking the user which environment(prod,test etc) and updating the path accordingly ?


问:
sending an email with attachments using 'react-native-mail' library works but didn't receive email
I have a React Native app (Only for IOS) and I implemented a feature where user can share a pdf file via email using the Mail app on ios devices. I used 'react-native-mail' library for this feature and it works great. However, there was one person who said that it did send an email but didn't get an email. Checked spam folder and tried everything we could to find an email. Thought it was an issue with email credentials so we tried with a brand new gmail account but still didn't get an email.

Let me explain how this library works first. You need to set up a gmail account (has to be gmail to get this library to work) in Settings on your ios device (if there are multiple gmail accounts, only the first one is used as a sender for the react-native-mail library.) Then activate mail app with this email account. Go to the app then enter a recipient then send an email with any attachments (for my case, a small pdf file.) then we get an email on the recipient gmail account!

I could be sure an email is sent because when I get the event, it says 'sent'. I tried to reproduce the issue that person had but there was no luck. Here's my code snippet below.

```<code>const sharePdf = async () => {
    Mailer.mail(
      {
        subject: 'Assessment Report',
        recipients: [currentUser.email ? currentUser.email : ''],
        body: 'Assessment Report',
        isHTML: true,
        attachments: [
          {
            path: reportUri,
            type: 'pdf',
            name: 'Report',
          },
        ],
      },
      (error, event) => {
        console.log('error => ', error);

        if (error === 'not_available') {
          Alert.alert(
            'Please add a Gmail (Google) account to your iPad',
            'Go to settings > Mail > accounts > Add Account > Google',
            [
              {
                text: 'OK',
                onPress: () => console.log('OK: Email Error Response'),
              },
            ],
            {cancelable: true},
          );
        } else {
          Alert.alert(
            event,
            error,
            [
              {
                text: 'Ok',
                onPress: () => console.log('OK: Email Error Response'),
              },
            ],
            {cancelable: true},
          );
        }
      },
    );
  };
</code>```

please help me if anyone has faced this issue or has an idea of fixing this issue.. Thank you :)

Body:
I have a React Native app (Only for IOS) and I implemented a feature where user can share a pdf file via email using the Mail app on ios devices. I used 'react-native-mail' library for this feature and it works great. However, there was one person who said that it did send an email but didn't get an email. Checked spam folder and tried everything we could to find an email. Thought it was an issue with email credentials so we tried with a brand new gmail account but still didn't get an email.

Let me explain how this library works first. You need to set up a gmail account (has to be gmail to get this library to work) in Settings on your ios device (if there are multiple gmail accounts, only the first one is used as a sender for the react-native-mail library.) Then activate mail app with this email account. Go to the app then enter a recipient then send an email with any attachments (for my case, a small pdf file.) then we get an email on the recipient gmail account!

I could be sure an email is sent because when I get the event, it says 'sent'. I tried to reproduce the issue that person had but there was no luck. Here's my code snippet below.

const sharePdf = async () => {
    Mailer.mail(
      {
        subject: 'Assessment Report',
        recipients: [currentUser.email ? currentUser.email : ''],
        body: 'Assessment Report',
        isHTML: true,
        attachments: [
          {
            path: reportUri,
            type: 'pdf',
            name: 'Report',
          },
        ],
      },
      (error, event) => {
        console.log('error => ', error);

        if (error === 'not_available') {
          Alert.alert(
            'Please add a Gmail (Google) account to your iPad',
            'Go to settings > Mail > accounts > Add Account > Google',
            [
              {
                text: 'OK',
                onPress: () => console.log('OK: Email Error Response'),
              },
            ],
            {cancelable: true},
          );
        } else {
          Alert.alert(
            event,
            error,
            [
              {
                text: 'Ok',
                onPress: () => console.log('OK: Email Error Response'),
              },
            ],
            {cancelable: true},
          );
        }
      },
    );
  };

please help me if anyone has faced this issue or has an idea of fixing this issue.. Thank you :)


问:
Colab session shutdowned when using fit_params parameter of cross_val_score
I'm kinda newbie in both ML and programming, so I wanted to deal with basic classification problem. Since it is imbalanced data, I was trying to give weight for each classes. For DecisionTreeClassifier, RandomForestClassifier, things go well with hyperparameter class_weight="balanced". But for XGBClassifier, there is no such hyperparameter, so I wanted to use sample_weight parameter for .fit() method. When using fit_params for cross_val_score, suddenly Colab session shutdowned.

Here's a reproduced code that works fine

pipe = Pipeline([("xgb", XGBClassifier(
    n_estimators=500,
    tree_method="gpu_hist",
))])
cross_val_score(estimator=pipe, X=X_train, y=y_train, cv=5, scoring="accuracy")
```
<p>Here's reproduced code for causing session down</p>
<pre class="lang-py prettyprint-override"><code>class_weight = compute_class_weight(class_weight="balanced", classes=np.unique(y_train), y=y_train)
pipe = Pipeline([("xgb", XGBClassifier(
    n_estimators=500,
    tree_method="gpu_hist",
))])
cross_val_score(estimator=pipe, X=X_train, y=y_train, cv=5, scoring="accuracy", fit_params={"xgb__sample_weight":class_weight})
</code>```

These are last runtime logs before session downed

Timestamp
Level
Message

Dec 6, 2022, 3:54:11 AM
WARNING
WARNING:root:kernel c255a02e-7a32-41ad-9923-e26feff322ee restarted

Dec 6, 2022, 3:54:11 AM
INFO
KernelRestarter: restarting kernel (1/5), keep random ports

Dec 6, 2022, 3:54:10 AM
WARNING
terminate called recursively

Dec 6, 2022, 3:50:44 AM
WARNING
WARNING:root:kernel c255a02e-7a32-41ad-9923-e26feff322ee restarted

Dec 6, 2022, 3:50:44 AM
INFO
KernelRestarter: restarting kernel (1/5), keep random ports

Dec 6, 2022, 3:50:44 AM
WARNING
terminate called recursively

Dec 6, 2022, 3:50:44 AM
WARNING
terminate called recursively

Dec 6, 2022, 3:42:24 AM
WARNING
warnings.warn(

Dec 6, 2022, 3:42:24 AM
WARNING
/usr/local/lib/python3.8/dist-packages/joblib/externals/loky/backend/resource_tracker.py:310: UserWarning: resource_tracker: There appear to be 30 leaked folder objects to clean up at shutdown

When I removed tree_method hyperparameter, it raised error rather than shutting down.

class_weight = compute_class_weight(class_weight="balanced", classes=np.unique(y_train), y=y_train)
pipe = Pipeline([("xgb", XGBClassifier(
    n_estimators=500,
    # tree_method="gpu_hist",
))])
cross_val_score(estimator=pipe, X=X_train, y=y_train, cv=5, scoring="accuracy", fit_params={"xgb__sample_weight":class_weight})
```
```/usr/local/lib/python3.8/dist-packages/sklearn/model_selection/_validation.py:372: FitFailedWarning:
5 fits failed out of a total of 5.
The score on these train-test partitions for these parameters will be set to nan.
If these failures are not expected, you can try to debug them by setting error_score='raise'.

Below are more details about the failures:
--------------------------------------------------------------------------------
5 fits failed with the following error:
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/sklearn/model_selection/_validation.py", line 680, in _fit_and_score
    estimator.fit(X_train, y_train, **fit_params)
  File "/usr/local/lib/python3.8/dist-packages/imblearn/pipeline.py", line 266, in fit
    self._final_estimator.fit(Xt, yt, **fit_params_last_step)
  File "/usr/local/lib/python3.8/dist-packages/xgboost/core.py", line 620, in inner_f
    return func(**kwargs)
  File "/usr/local/lib/python3.8/dist-packages/xgboost/sklearn.py", line 1516, in fit
    self._Booster = train(
  File "/usr/local/lib/python3.8/dist-packages/xgboost/core.py", line 620, in inner_f
    return func(**kwargs)
  File "/usr/local/lib/python3.8/dist-packages/xgboost/training.py", line 185, in train
    bst.update(dtrain, i, obj)
  File "/usr/local/lib/python3.8/dist-packages/xgboost/core.py", line 1918, in update
    _check_call(_LIB.XGBoosterUpdateOneIter(self.handle,
  File "/usr/local/lib/python3.8/dist-packages/xgboost/core.py", line 279, in _check_call
    raise XGBoostError(py_str(_LIB.XGBGetLastError()))
xgboost.core.XGBoostError: [19:33:34] ../src/data/data.cc:701: Check failed: weights_.Size() == num_row_ (3 vs. 96) : Size of weights must equal to number of rows.
Stack trace:
  [bt] (0) /usr/local/lib/python3.8/dist-packages/xgboost/lib/libxgboost.so(+0x1fcff9) [0x7f900f13aff9]
  [bt] (1) /usr/local/lib/python3.8/dist-packages/xgboost/lib/libxgboost.so(+0x202fc2) [0x7f900f140fc2]
  [bt] (2) /usr/local/lib/python3.8/dist-packages/xgboost/lib/libxgboost.so(+0x2dd54d) [0x7f900f21b54d]
  [bt] (3) /usr/local/lib/python3.8/dist-packages/xgboost/lib/libxgboost.so(+0x2ddb54) [0x7f900f21bb54]
  [bt] (4) /usr/local/lib/python3.8/dist-packages/xgboost/lib/libxgboost.so(XGBoosterUpdateOneIter+0x70) [0x7f900f06c000]
  [bt] (5) /usr/lib/x86_64-linux-gnu/libffi.so.6(ffi_call_unix64+0x4c) [0x7f90426dfdae]
  [bt] (6) /usr/lib/x86_64-linux-gnu/libffi.so.6(ffi_call+0x22f) [0x7f90426df71f]
  [bt] (7) /usr/lib/python3.8/lib-dynload/_ctypes.cpython-38-x86_64-linux-gnu.so(_ctypes_callproc+0x8ce) [0x7f90428f534e]
  [bt] (8) /usr/lib/python3.8/lib-dynload/_ctypes.cpython-38-x86_64-linux-gnu.so(+0xe4e4) [0x7f90428f04e4]
```
<p>It seems that <code>sample_weight</code> needs weights for each instances, not classes. So I changed <code>compute_class_weight</code> to <code>compute_sample_weight</code>.</p>
<p>And it works fine!</p>
<pre class="lang-py prettyprint-override"><code>sample_weight = compute_sample_weight(class_weight="balanced", y=y_train)
pipe = Pipeline([("xgb", XGBClassifier(
    n_estimators=500,
    tree_method="gpu_hist",
))])
cross_val_score(estimator=pipe, X=X_train, y=y_train, cv=5, scoring="accuracy", fit_params={"xgb__sample_weight":sample_weight})
</code>```

But I still don't know why session downed rather than raising a error. Something related to GPU problem?

Body:
I'm kinda newbie in both ML and programming, so I wanted to deal with basic classification problem. Since it is imbalanced data, I was trying to give weight for each classes. For DecisionTreeClassifier, RandomForestClassifier, things go well with hyperparameter class_weight="balanced". But for XGBClassifier, there is no such hyperparameter, so I wanted to use sample_weight parameter for .fit() method. When using fit_params for cross_val_score, suddenly Colab session shutdowned.

Here's a reproduced code that works fine

pipe = Pipeline([("xgb", XGBClassifier(
    n_estimators=500,
    tree_method="gpu_hist",
))])
cross_val_score(estimator=pipe, X=X_train, y=y_train, cv=5, scoring="accuracy")

Here's reproduced code for causing session down

class_weight = compute_class_weight(class_weight="balanced", classes=np.unique(y_train), y=y_train)
pipe = Pipeline([("xgb", XGBClassifier(
    n_estimators=500,
    tree_method="gpu_hist",
))])
cross_val_score(estimator=pipe, X=X_train, y=y_train, cv=5, scoring="accuracy", fit_params={"xgb__sample_weight":class_weight})

These are last runtime logs before session downed

Timestamp
Level
Message

Dec 6, 2022, 3:54:11 AM
WARNING
WARNING:root:kernel c255a02e-7a32-41ad-9923-e26feff322ee restarted

Dec 6, 2022, 3:54:11 AM
INFO
KernelRestarter: restarting kernel (1/5), keep random ports

Dec 6, 2022, 3:54:10 AM
WARNING
terminate called recursively

Dec 6, 2022, 3:50:44 AM
WARNING
WARNING:root:kernel c255a02e-7a32-41ad-9923-e26feff322ee restarted

Dec 6, 2022, 3:50:44 AM
INFO
KernelRestarter: restarting kernel (1/5), keep random ports

Dec 6, 2022, 3:50:44 AM
WARNING
terminate called recursively

Dec 6, 2022, 3:50:44 AM
WARNING
terminate called recursively

Dec 6, 2022, 3:42:24 AM
WARNING
warnings.warn(

Dec 6, 2022, 3:42:24 AM
WARNING
/usr/local/lib/python3.8/dist-packages/joblib/externals/loky/backend/resource_tracker.py:310: UserWarning: resource_tracker: There appear to be 30 leaked folder objects to clean up at shutdown

When I removed tree_method hyperparameter, it raised error rather than shutting down.

class_weight = compute_class_weight(class_weight="balanced", classes=np.unique(y_train), y=y_train)
pipe = Pipeline([("xgb", XGBClassifier(
    n_estimators=500,
    # tree_method="gpu_hist",
))])
cross_val_score(estimator=pipe, X=X_train, y=y_train, cv=5, scoring="accuracy", fit_params={"xgb__sample_weight":class_weight})

/usr/local/lib/python3.8/dist-packages/sklearn/model_selection/_validation.py:372: FitFailedWarning:
5 fits failed out of a total of 5.
The score on these train-test partitions for these parameters will be set to nan.
If these failures are not expected, you can try to debug them by setting error_score='raise'.

Below are more details about the failures:
--------------------------------------------------------------------------------
5 fits failed with the following error:
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/sklearn/model_selection/_validation.py", line 680, in _fit_and_score
    estimator.fit(X_train, y_train, **fit_params)
  File "/usr/local/lib/python3.8/dist-packages/imblearn/pipeline.py", line 266, in fit
    self._final_estimator.fit(Xt, yt, **fit_params_last_step)
  File "/usr/local/lib/python3.8/dist-packages/xgboost/core.py", line 620, in inner_f
    return func(**kwargs)
  File "/usr/local/lib/python3.8/dist-packages/xgboost/sklearn.py", line 1516, in fit
    self._Booster = train(
  File "/usr/local/lib/python3.8/dist-packages/xgboost/core.py", line 620, in inner_f
    return func(**kwargs)
  File "/usr/local/lib/python3.8/dist-packages/xgboost/training.py", line 185, in train
    bst.update(dtrain, i, obj)
  File "/usr/local/lib/python3.8/dist-packages/xgboost/core.py", line 1918, in update
    _check_call(_LIB.XGBoosterUpdateOneIter(self.handle,
  File "/usr/local/lib/python3.8/dist-packages/xgboost/core.py", line 279, in _check_call
    raise XGBoostError(py_str(_LIB.XGBGetLastError()))
xgboost.core.XGBoostError: [19:33:34] ../src/data/data.cc:701: Check failed: weights_.Size() == num_row_ (3 vs. 96) : Size of weights must equal to number of rows.
Stack trace:
  [bt] (0) /usr/local/lib/python3.8/dist-packages/xgboost/lib/libxgboost.so(+0x1fcff9) [0x7f900f13aff9]
  [bt] (1) /usr/local/lib/python3.8/dist-packages/xgboost/lib/libxgboost.so(+0x202fc2) [0x7f900f140fc2]
  [bt] (2) /usr/local/lib/python3.8/dist-packages/xgboost/lib/libxgboost.so(+0x2dd54d) [0x7f900f21b54d]
  [bt] (3) /usr/local/lib/python3.8/dist-packages/xgboost/lib/libxgboost.so(+0x2ddb54) [0x7f900f21bb54]
  [bt] (4) /usr/local/lib/python3.8/dist-packages/xgboost/lib/libxgboost.so(XGBoosterUpdateOneIter+0x70) [0x7f900f06c000]
  [bt] (5) /usr/lib/x86_64-linux-gnu/libffi.so.6(ffi_call_unix64+0x4c) [0x7f90426dfdae]
  [bt] (6) /usr/lib/x86_64-linux-gnu/libffi.so.6(ffi_call+0x22f) [0x7f90426df71f]
  [bt] (7) /usr/lib/python3.8/lib-dynload/_ctypes.cpython-38-x86_64-linux-gnu.so(_ctypes_callproc+0x8ce) [0x7f90428f534e]
  [bt] (8) /usr/lib/python3.8/lib-dynload/_ctypes.cpython-38-x86_64-linux-gnu.so(+0xe4e4) [0x7f90428f04e4]

It seems that sample_weight needs weights for each instances, not classes. So I changed compute_class_weight to compute_sample_weight.

And it works fine!

sample_weight = compute_sample_weight(class_weight="balanced", y=y_train)
pipe = Pipeline([("xgb", XGBClassifier(
    n_estimators=500,
    tree_method="gpu_hist",
))])
cross_val_score(estimator=pipe, X=X_train, y=y_train, cv=5, scoring="accuracy", fit_params={"xgb__sample_weight":sample_weight})

But I still don't know why session downed rather than raising a error. Something related to GPU problem?


问:
Change css if ( empty( $variation_id ) && $product && $product->is_type( 'variable' ) )
I´m trying to find the css class in woocomece, that show's me the nottice:
Please choose product options by visiting...

But canot find the class or id. to change css
Just find the file class-wc-form-handler.php where the mesage is
Is this image:

This is the text i want to change css


问:
Crystal Reports Summary field with sum of amounts from SQL command
I have a sub-report that returns the following....

```<code>SELECT
    SUM (SorDetail.MPrice) OVER (PARTITION BY SorDetail.SalesOrder,     [CusSorDetailMerch+].InvoiceGrouping) AS GroupTotal,
    SorDetail.SalesOrder,
    SorDetail.SalesOrderLine,
    SorDetail.MStockCode,
    SorDetail.MStockDes,
    [CusSorDetailMerch+].InvoiceGrouping,
    SorDetail.MOrderQty,
    SorDetail.MPrice,
    [CusSorDetailMerch+].SerialNumber
FROM
    SorDetail
INNER JOIN
    [CusSorDetailMerch+] ON SorDetail.SalesOrder = [CusSorDetailMerch+].SalesOrder
                         AND SorDetail.SalesOrderLine = [CusSorDetailMerch+].SalesOrderInitLine
WHERE
    (dbo.SorDetail.SalesOrder = '000000000' + '{?SalesOrder}')
    AND (dbo.SorDetail.SalesOrderInitLine = '{?Line}')
ORDER BY
    [CusSorDetailMerch+].InvoiceGrouping
</code>```

It returns this which is what I want:

Data Returned

What I just cant seem to do id to add a column that sums the different groups and separates the groups like this:

enter image description here

I have tried everything but cannot get the sums individually

Body:
I have a sub-report that returns the following....

SELECT
    SUM (SorDetail.MPrice) OVER (PARTITION BY SorDetail.SalesOrder,     [CusSorDetailMerch+].InvoiceGrouping) AS GroupTotal,
    SorDetail.SalesOrder,
    SorDetail.SalesOrderLine,
    SorDetail.MStockCode,
    SorDetail.MStockDes,
    [CusSorDetailMerch+].InvoiceGrouping,
    SorDetail.MOrderQty,
    SorDetail.MPrice,
    [CusSorDetailMerch+].SerialNumber
FROM
    SorDetail
INNER JOIN
    [CusSorDetailMerch+] ON SorDetail.SalesOrder = [CusSorDetailMerch+].SalesOrder
                         AND SorDetail.SalesOrderLine = [CusSorDetailMerch+].SalesOrderInitLine
WHERE
    (dbo.SorDetail.SalesOrder = '000000000' + '{?SalesOrder}')
    AND (dbo.SorDetail.SalesOrderInitLine = '{?Line}')
ORDER BY
    [CusSorDetailMerch+].InvoiceGrouping

It returns this which is what I want:

Data Returned

What I just cant seem to do id to add a column that sums the different groups and separates the groups like this:

enter image description here

I have tried everything but cannot get the sums individually


问:
copy/move/link android shared library from nativelibdir to nativelibdir/somedir
I'd like to get the android NDK, via cmake, to place a .so file in a sub-directory:

i.e. from:

/data/app/com.example.app/lib/arm64/libstuff.so

to:
/data/app/com.example.app/lib/arm64/something/libstuff.so

I'm using CMake like this:

```<code>add_library(stuff SHARED ${CMAKE_CURRENT_SOURCE_DIR}/../path/to/stuff.c)
target_include_directories(stuff PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../path/to/include )
target_compile_definitions(stuff PRIVATE)
target_link_libraries(stuff PRIVATE otherstuff)
</code>```

Is there a magic spell to make a link/copy of the .so appear in a subdirectory of the native lib dir?

thanks!

Body:
I'd like to get the android NDK, via cmake, to place a .so file in a sub-directory:

i.e. from:

/data/app/com.example.app/lib/arm64/libstuff.so

to:
/data/app/com.example.app/lib/arm64/something/libstuff.so

I'm using CMake like this:

add_library(stuff SHARED ${CMAKE_CURRENT_SOURCE_DIR}/../path/to/stuff.c)
target_include_directories(stuff PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../path/to/include )
target_compile_definitions(stuff PRIVATE)
target_link_libraries(stuff PRIVATE otherstuff)

Is there a magic spell to make a link/copy of the .so appear in a subdirectory of the native lib dir?

thanks!


问:
Did anyone had this issue of genes from same clusters showing on different contigs when you run antismash
I had assembled genomes by SPAdes and I am pretty confident that the assemblies are good per the stats report I have. I am looking into secondary metabolite clusters in these genomes and finds that when I run antismash, the genes from a particular cluster appears on different contigs.
This makes me a little worried if my assemly is not good enough
We had sequenced these genomes using illumina so they are short reads.

I tried assemling using a different tool and the stats came out pretty similar. Now I dont know if it has something to do with assemly or antismash. I work on Psuedomonads


问:
Multi column index with date field
I have a 3-column composite index on a table below defined using SqlAlchemy and Postgres. I'm trying to figure out what order to make the internal_date and email_id to make the query the most efficient. Or if I need the composite index at all.

I want to query by folder_id and get the most recent 100 emails. If I order the index by folder_id, internal_date and then email_id that would appear to be the most logical, but I'm not sure if applying the composite index like this will work well or I should just have a single index on each column?

This model assumes there are many thousands of folder_ids and millions of email_ids. (i.e. a folder can have many emails)

```<code>
class EmailMessages(db.Model):
    __tablename__ = "email_message_mapped_model"

    folder_id = db.Column(
        sa.Integer,
        db.ForeignKey("folders.folder_id", ondelete="CASCADE"),
        primary_key=True,
    )

    email_id = db.Column(
        sa.Integer,
        db.ForeignKey("emails.email_id", ondelete="CASCADE"),
        primary_key=True,
    )

    internal_date = db.Column(db.DateTime, default=datetime.utcnow)

</code>```

Indexes:

```<code>    __table_args__ = (
        db.Index(
            'ix_index1',
            folder_id, email_id, internal_date
        ),
    )
</code>```

OR

```<code>    __table_args__ = (
        db.Index(
            'ix_index2',
            folder_id, internal_date, email_id
        ),
    )
</code>```

OR

```<code>    __table_args__ = (
        db.Index(
            'ix_index3a',
            folder_id,
        ),
        db.Index(
            'ix_index3b',
            internal_date,
        ),
        db.Index(
            'ix_index3c',
            email_id,
        ),

    )
</code>```

Title: Multi column index with date field

Body:
I have a 3-column composite index on a table below defined using SqlAlchemy and Postgres. I'm trying to figure out what order to make the internal_date and email_id to make the query the most efficient. Or if I need the composite index at all.

I want to query by folder_id and get the most recent 100 emails. If I order the index by folder_id, internal_date and then email_id that would appear to be the most logical, but I'm not sure if applying the composite index like this will work well or I should just have a single index on each column?

This model assumes there are many thousands of folder_ids and millions of email_ids. (i.e. a folder can have many emails)

class EmailMessages(db.Model):
    __tablename__ = "email_message_mapped_model"

    folder_id = db.Column(
        sa.Integer,
        db.ForeignKey("folders.folder_id", ondelete="CASCADE"),
        primary_key=True,
    )

    email_id = db.Column(
        sa.Integer,
        db.ForeignKey("emails.email_id", ondelete="CASCADE"),
        primary_key=True,
    )

    internal_date = db.Column(db.DateTime, default=datetime.utcnow)

Indexes:

    __table_args__ = (
        db.Index(
            'ix_index1',
            folder_id, email_id, internal_date
        ),
    )

OR

    __table_args__ = (
        db.Index(
            'ix_index2',
            folder_id, internal_date, email_id
        ),
    )

OR

    __table_args__ = (
        db.Index(
            'ix_index3a',
            folder_id,
        ),
        db.Index(
            'ix_index3b',
            internal_date,
        ),
        db.Index(
            'ix_index3c',
            email_id,
        ),

    )


问:
Google Calendar ICS to include the day before
This is for a custody calendar which shows who has the kids and when.  There is a situation revolving around several holidays that happen on x Monday of every year.  The custody terms give a parent time on that Monday as well as the Sunday before.  For example, MLK day is celebrated on the third Monday of January every year.  Since it's possible for January to begin on a Monday, I can not begin the calendar event on the third Sunday as it will displace the event by a week.

Is there a way to trigger the event on the third Monday but include the Sunday before within the ICS file?

I'm not sure where to begin here.  I have not been able to find anything relevant while searching for a solution.


问:
how to make half a day available in easepick datepicker
I want to have preselected dates in easepick example saturday to saturday booking.  i want to show a half day available with a half triangle as checkout is 10am and check in is 4pm.

How can i make them only to select a saturday to start the 7 day selection?

I tried adding the time formats of MM/DD/YYYY HH:mm:SS but it wouldn't allow saturday to be picked.


问:
Android EAS build failing because of outdated library
I am trying to complete an Android build using EAS for my react native app. Right now it is failing in the Run gradlew section because one of the packages in my package.json titled fiction-expo-restart ends up importing unimodules, which are not compatible with expo-sdk-47. Expo has long moved onto expo modules instead.

So far I have been unable to resolve this error, and I have the most recent version of the fiction-expo-restart library. How can I resolve this?

Here is the error:

```<code>[stderr] Error loading assets JSON from Metro. Ensure you've followed all expo-updates installation steps correctly. Unable to resolve module @unimodules/core from /home/expo/workingdir/build/node_modules/fiction-expo-restart/node_modules/expo-updates/build/Updates.js: @unimodules/core could not be found within the project or in these directories:
[stderr]   node_modules/fiction-expo-restart/node_modules/expo-updates/node_modules
[stderr]   node_modules/fiction-expo-restart/node_modules
[stderr]   node_modules
[stderr] > 1 | import { RCTDeviceEventEmitter, CodedError, NativeModulesProxy, UnavailabilityError, } from '@unimodules/core';
[stderr]     |                                                                                ^
[stderr]   2 | import { EventEmitter } from 'fbemitter';
[stderr]   3 | import ExpoUpdates from './ExpoUpdates';
[stderr]   4 | export * from './Updates.types';
[stderr] @build-script-error-end
[stderr]     at /home/expo/workingdir/build/node_modules/expo-updates/scripts/createManifest.js:59:11
[stderr]     at runMicrotasks (<anonymous>)
[stderr]     at processTicksAndRejections (node:internal/process/task_queues:96:5)
</code>```

And my package.json looks like this:

```<code>{
  "version": "1.0.30",
  "scripts": {
    "start": "expo start --dev-client",
    "android": "expo run:android",
    "ios": "expo run:ios",
    "web": "expo start --web",
    "postinstall": "patch-package"
  },
  "dependencies": {
    "@ptomasroos/react-native-multi-slider": "^2.2.2",
    "@react-native-community/datetimepicker": "6.5.2",
    "@react-native-picker/picker": "2.4.8",
    "@react-navigation/bottom-tabs": "^6.4.0",
    "@react-navigation/drawer": "^6.5.0",
    "@react-navigation/native": "^6.0.13",
    "@react-navigation/native-stack": "^6.9.1",
    "@react-navigation/stack": "^6.3.2",
    "crypto-js": "^3.1.9-1",
    "deprecated-react-native-prop-types": "2.2.0",
    "expo": "^47.0.8",
    "expo-av": "~13.0.2",
    "expo-crypto": "~12.0.0",
    "expo-dev-client": "~2.0.1",
    "expo-device": "~5.0.0",
    "expo-linear-gradient": "~12.0.1",
    "expo-location": "~15.0.1",
    "expo-permissions": "~14.0.0",
    "expo-splash-screen": "~0.17.5",
    "expo-sqlite": "~11.0.0",
    "expo-status-bar": "~1.4.2",
    "expo-updates": "~0.15.6",
    "fiction-expo-restart": "^1.1.3", // Problem package
    "isaac": "^0.0.5",
    "lodash.clonedeep": "^4.5.0",
    "lodash.debounce": "^4.0.8",
    "lodash.isequal": "^4.5.0",
    "moment": "^2.29.4",
    "patch-package": "^6.4.7",
    "react": "18.1.0",
    "react-native": "0.70.5",
    "react-native-bcrypt": "^2.4.0",
    "react-native-draggable-flatlist": "^3.1.2",
    "react-native-gesture-handler": "~2.8.0",
    "react-native-get-random-values": "~1.8.0",
    "react-native-keyboard-aware-scroll-view": "^0.9.5",
    "react-native-keyboard-spacer": "^0.4.1",
    "react-native-modal-selector": "^2.1.2",
    "react-native-open-maps": "^0.4.0",
    "react-native-pager-view": "6.0.1",
    "react-native-randombytes": "^3.6.1",
    "react-native-reanimated": "~2.12.0",
    "react-native-safe-area-context": "4.4.1",
    "react-native-screens": "~3.18.0",
    "react-native-signature-pad": "^0.1.2",
    "react-native-svg": "13.4.0",
    "react-native-svg-charts": "^5.4.0",
    "react-native-tab-view": "^3.3.0",
    "react-native-webview": "11.23.1",
    "react-navigation": "^4.4.4",
    "react-navigation-drawer": "^2.7.2",
    "react-redux": "^8.0.4",
    "react-serialize": "^0.2.1",
    "redux": "^4.2.0",
    "redux-thunk": "^2.4.1",
    "serialize-javascript": "^6.0.0",
    "socket.io-client": "2.1.0"
  },
  "devDependencies": {
    "@babel/core": "^7.19.3"
  },
  "private": true,
  "name": "mobile-updated"
}
</code>```

Body:
I am trying to complete an Android build using EAS for my react native app. Right now it is failing in the Run gradlew section because one of the packages in my package.json titled fiction-expo-restart ends up importing unimodules, which are not compatible with expo-sdk-47. Expo has long moved onto expo modules instead.

So far I have been unable to resolve this error, and I have the most recent version of the fiction-expo-restart library. How can I resolve this?

Here is the error:

[stderr] Error loading assets JSON from Metro. Ensure you've followed all expo-updates installation steps correctly. Unable to resolve module @unimodules/core from /home/expo/workingdir/build/node_modules/fiction-expo-restart/node_modules/expo-updates/build/Updates.js: @unimodules/core could not be found within the project or in these directories:
[stderr]   node_modules/fiction-expo-restart/node_modules/expo-updates/node_modules
[stderr]   node_modules/fiction-expo-restart/node_modules
[stderr]   node_modules
[stderr] > 1 | import { RCTDeviceEventEmitter, CodedError, NativeModulesProxy, UnavailabilityError, } from '@unimodules/core';
[stderr]     |                                                                                ^
[stderr]   2 | import { EventEmitter } from 'fbemitter';
[stderr]   3 | import ExpoUpdates from './ExpoUpdates';
[stderr]   4 | export * from './Updates.types';
[stderr] @build-script-error-end
[stderr]     at /home/expo/workingdir/build/node_modules/expo-updates/scripts/createManifest.js:59:11
[stderr]     at runMicrotasks (<anonymous>)
[stderr]     at processTicksAndRejections (node:internal/process/task_queues:96:5)

And my package.json looks like this:

{
  "version": "1.0.30",
  "scripts": {
    "start": "expo start --dev-client",
    "android": "expo run:android",
    "ios": "expo run:ios",
    "web": "expo start --web",
    "postinstall": "patch-package"
  },
  "dependencies": {
    "@ptomasroos/react-native-multi-slider": "^2.2.2",
    "@react-native-community/datetimepicker": "6.5.2",
    "@react-native-picker/picker": "2.4.8",
    "@react-navigation/bottom-tabs": "^6.4.0",
    "@react-navigation/drawer": "^6.5.0",
    "@react-navigation/native": "^6.0.13",
    "@react-navigation/native-stack": "^6.9.1",
    "@react-navigation/stack": "^6.3.2",
    "crypto-js": "^3.1.9-1",
    "deprecated-react-native-prop-types": "2.2.0",
    "expo": "^47.0.8",
    "expo-av": "~13.0.2",
    "expo-crypto": "~12.0.0",
    "expo-dev-client": "~2.0.1",
    "expo-device": "~5.0.0",
    "expo-linear-gradient": "~12.0.1",
    "expo-location": "~15.0.1",
    "expo-permissions": "~14.0.0",
    "expo-splash-screen": "~0.17.5",
    "expo-sqlite": "~11.0.0",
    "expo-status-bar": "~1.4.2",
    "expo-updates": "~0.15.6",
    "fiction-expo-restart": "^1.1.3", // Problem package
    "isaac": "^0.0.5",
    "lodash.clonedeep": "^4.5.0",
    "lodash.debounce": "^4.0.8",
    "lodash.isequal": "^4.5.0",
    "moment": "^2.29.4",
    "patch-package": "^6.4.7",
    "react": "18.1.0",
    "react-native": "0.70.5",
    "react-native-bcrypt": "^2.4.0",
    "react-native-draggable-flatlist": "^3.1.2",
    "react-native-gesture-handler": "~2.8.0",
    "react-native-get-random-values": "~1.8.0",
    "react-native-keyboard-aware-scroll-view": "^0.9.5",
    "react-native-keyboard-spacer": "^0.4.1",
    "react-native-modal-selector": "^2.1.2",
    "react-native-open-maps": "^0.4.0",
    "react-native-pager-view": "6.0.1",
    "react-native-randombytes": "^3.6.1",
    "react-native-reanimated": "~2.12.0",
    "react-native-safe-area-context": "4.4.1",
    "react-native-screens": "~3.18.0",
    "react-native-signature-pad": "^0.1.2",
    "react-native-svg": "13.4.0",
    "react-native-svg-charts": "^5.4.0",
    "react-native-tab-view": "^3.3.0",
    "react-native-webview": "11.23.1",
    "react-navigation": "^4.4.4",
    "react-navigation-drawer": "^2.7.2",
    "react-redux": "^8.0.4",
    "react-serialize": "^0.2.1",
    "redux": "^4.2.0",
    "redux-thunk": "^2.4.1",
    "serialize-javascript": "^6.0.0",
    "socket.io-client": "2.1.0"
  },
  "devDependencies": {
    "@babel/core": "^7.19.3"
  },
  "private": true,
  "name": "mobile-updated"
}