问:
Trying to open a device using HidDevice FromIdAsync in UWP always returns null unless using FileAccessMode.Read
I can confirm that my HID device can have read and write capabilities, because this has been verified in WPF application, where one Endpoint can read and the other can read and write.

I thought it might be a permissions issue, but I defined almost every possible Usage in the manifest, and this still doesn't work.

Is there any other way to test HID besides buying SuperMUTT? (It costs 350$)

My code:

            //This method will be called on the UI thread
            private async Task OpenDevice()
            {
                string aqs = HidDevice.GetDeviceSelector(0x0001, 0x0005, 0xAAAA, 0xBBBB);
                //Two Endpoints are returned here, one of which can only be opened by Read, and the other cannot be opened by Read or ReadWrite
                var devices = await DeviceInformation.FindAllAsync(aqs);
                foreach (var deviceInfo in devices)
                {
                    var access = DeviceAccessInformation.CreateFromId(deviceInfo.Id);
                    if (access.CurrentStatus == DeviceAccessStatus.Allowed)
                    {
                        var deviceWithReadWrite = await HidDevice.FromIdAsync(deviceInfo.Id, FileAccessMode.ReadWrite);
                        //deviceWithReadWrite is null
                        var deviceWithRead = await HidDevice.FromIdAsync(deviceInfo.Id, FileAccessMode.ReadWrite);
                        //deviceWithRead is not null
                    }
                }
            }
```
<p><strong>Capabilities in Package.appxmanifest</strong></p>
```    <Capabilities>
        <DeviceCapability Name="humaninterfacedevice">
            <Device Id="any">
                <Function Type="usage:0001 *"/>
                <Function Type="usage:0009 *"/>
                <Function Type="usage:FF00 *"/>
                <Function Type="usage:FFF0 *"/>
                <Function Type="usage:FF80 *"/>
            </Device>
        </DeviceCapability>
    </Capabilities>
```
<p><strong>HID Report Descriptor</strong></p>
```0x08,              // Usage
0x05, 0x01,        // Usage Page (Generic Desktop Ctrls)
0x09, 0x05,        // Usage (Game Pad)
0xA1, 0x01,        // Collection (Application)
0x85, 0x01,        //   Report ID (1)
0x09, 0x30,        //   Usage (X)
0x09, 0x31,        //   Usage (Y)
0x09, 0x32,        //   Usage (Z)
0x09, 0x35,        //   Usage (Rz)
0x15, 0x00,        //   Logical Minimum (0)
0x26, 0xFF, 0x00,  //   Logical Maximum (255)
0x75, 0x08,        //   Report Size (8)
0x95, 0x04,        //   Report Count (4)
0x81, 0x02,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x09, 0x39,        //   Usage (Hat switch)
0x15, 0x00,        //   Logical Minimum (0)
0x25, 0x07,        //   Logical Maximum (7)
0x35, 0x00,        //   Physical Minimum (0)
0x46, 0x3B, 0x01,  //   Physical Maximum (315)
0x65, 0x14,        //   Unit (System: English Rotation, Length: Centimeter)
0x75, 0x04,        //   Report Size (4)
0x95, 0x01,        //   Report Count (1)
0x81, 0x42,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,Null State)
0x65, 0x00,        //   Unit (None)
0x05, 0x09,        //   Usage Page (Button)
0x19, 0x01,        //   Usage Minimum (0x01)
0x29, 0x11,        //   Usage Maximum (0x11)
0x15, 0x00,        //   Logical Minimum (0)
0x25, 0x01,        //   Logical Maximum (1)
0x75, 0x01,        //   Report Size (1)
0x95, 0x11,        //   Report Count (17)
0x81, 0x02,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x06, 0x00, 0xFF,  //   Usage Page (Vendor Defined 0xFF00)
0x09, 0x20,        //   Usage (0x20)
0x75, 0x03,        //   Report Size (3)
0x95, 0x01,        //   Report Count (1)
0x81, 0x02,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x05, 0x01,        //   Usage Page (Generic Desktop Ctrls)
0x09, 0x33,        //   Usage (Rx)
0x09, 0x34,        //   Usage (Ry)
0x15, 0x00,        //   Logical Minimum (0)
0x26, 0xFF, 0x00,  //   Logical Maximum (255)
0x75, 0x08,        //   Report Size (8)
0x95, 0x02,        //   Report Count (2)
0x81, 0x02,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x06, 0x00, 0xFF,  //   Usage Page (Vendor Defined 0xFF00)
0x09, 0x21,        //   Usage (0x21)
0x95, 0x36,        //   Report Count (54)
0x81, 0x02,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x85, 0x05,        //   Report ID (5)
0x09, 0x22,        //   Usage (0x22)
0x95, 0x1F,        //   Report Count (31)
0x91, 0x02,        //   Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0x85, 0x03,        //   Report ID (3)
0x0A, 0x21, 0x27,  //   Usage (0x2721)
0x95, 0x2F,        //   Report Count (47)
0xB1, 0x02,        //   Feature (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0x06, 0x80, 0xFF,  //   Usage Page (Vendor Defined 0xFF80)
0x85, 0xE0,        //   Report ID (-32)
0x09, 0x57,        //   Usage (0x57)
0x95, 0x02,        //   Report Count (2)
0xB1, 0x02,        //   Feature (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0xC0,              // End Collection
0x06, 0xF0, 0xFF,  // Usage Page (Vendor Defined 0xFFF0)
0x09, 0x40,        // Usage (0x40)
0xA1, 0x01,        // Collection (Application)
0x85, 0xF0,        //   Report ID (-16)
0x09, 0x47,        //   Usage (0x47)
0x95, 0x3F,        //   Report Count (63)
0xB1, 0x02,        //   Feature (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0x85, 0xF1,        //   Report ID (-15)
0x09, 0x48,        //   Usage (0x48)
0x95, 0x3F,        //   Report Count (63)
0xB1, 0x02,        //   Feature (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0x85, 0xF2,        //   Report ID (-14)
0x09, 0x49,        //   Usage (0x49)
0x95, 0x0F,        //   Report Count (15)
0xB1, 0x02,        //   Feature (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0x85, 0xF3,        //   Report ID (-13)
0x0A, 0x01, 0x47,  //   Usage (0x4701)
0x95, 0x07,        //   Report Count (7)
0xB1, 0x02,        //   Feature (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0x06, 0x00, 0xFF,  //   Usage Page (Vendor Defined 0xFF00)
0x09, 0x00,        //   Usage (0x00)
0x85, 0x10,        //   Report ID (16)
0x15, 0x00,        //   Logical Minimum (0)
0x25, 0xFF,        //   Logical Maximum (-1)
0x35, 0x00,        //   Physical Minimum (0)
0x45, 0xFF,        //   Physical Maximum (-1)
0x75, 0x08,        //   Report Size (8)
0x95, 0x3F,        //   Report Count (63)
0x81, 0x02,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x06, 0x00, 0xFF,  //   Usage Page (Vendor Defined 0xFF00)
0x09, 0x20,        //   Usage (0x20)
0x85, 0xDD,        //   Report ID (-35)
0x75, 0x08,        //   Report Size (8)
0x95, 0x3F,        //   Report Count (63)
0x81, 0x02,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x85, 0x0F,        //   Report ID (15)
0x09, 0x22,        //   Usage (0x22)
0x95, 0x3F,        //   Report Count (63)
0x91, 0x02,        //   Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0xC0,              // End Collection
```

Body:
I can confirm that my HID device can have read and write capabilities, because this has been verified in WPF application, where one Endpoint can read and the other can read and write.

I thought it might be a permissions issue, but I defined almost every possible Usage in the manifest, and this still doesn't work.

Is there any other way to test HID besides buying SuperMUTT? (It costs 350$)

My code:

            //This method will be called on the UI thread
            private async Task OpenDevice()
            {
                string aqs = HidDevice.GetDeviceSelector(0x0001, 0x0005, 0xAAAA, 0xBBBB);
                //Two Endpoints are returned here, one of which can only be opened by Read, and the other cannot be opened by Read or ReadWrite
                var devices = await DeviceInformation.FindAllAsync(aqs);
                foreach (var deviceInfo in devices)
                {
                    var access = DeviceAccessInformation.CreateFromId(deviceInfo.Id);
                    if (access.CurrentStatus == DeviceAccessStatus.Allowed)
                    {
                        var deviceWithReadWrite = await HidDevice.FromIdAsync(deviceInfo.Id, FileAccessMode.ReadWrite);
                        //deviceWithReadWrite is null
                        var deviceWithRead = await HidDevice.FromIdAsync(deviceInfo.Id, FileAccessMode.ReadWrite);
                        //deviceWithRead is not null
                    }
                }
            }

Capabilities in Package.appxmanifest

    <Capabilities>
        <DeviceCapability Name="humaninterfacedevice">
            <Device Id="any">
                <Function Type="usage:0001 *"/>
                <Function Type="usage:0009 *"/>
                <Function Type="usage:FF00 *"/>
                <Function Type="usage:FFF0 *"/>
                <Function Type="usage:FF80 *"/>
            </Device>
        </DeviceCapability>
    </Capabilities>

HID Report Descriptor

0x08,              // Usage
0x05, 0x01,        // Usage Page (Generic Desktop Ctrls)
0x09, 0x05,        // Usage (Game Pad)
0xA1, 0x01,        // Collection (Application)
0x85, 0x01,        //   Report ID (1)
0x09, 0x30,        //   Usage (X)
0x09, 0x31,        //   Usage (Y)
0x09, 0x32,        //   Usage (Z)
0x09, 0x35,        //   Usage (Rz)
0x15, 0x00,        //   Logical Minimum (0)
0x26, 0xFF, 0x00,  //   Logical Maximum (255)
0x75, 0x08,        //   Report Size (8)
0x95, 0x04,        //   Report Count (4)
0x81, 0x02,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x09, 0x39,        //   Usage (Hat switch)
0x15, 0x00,        //   Logical Minimum (0)
0x25, 0x07,        //   Logical Maximum (7)
0x35, 0x00,        //   Physical Minimum (0)
0x46, 0x3B, 0x01,  //   Physical Maximum (315)
0x65, 0x14,        //   Unit (System: English Rotation, Length: Centimeter)
0x75, 0x04,        //   Report Size (4)
0x95, 0x01,        //   Report Count (1)
0x81, 0x42,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,Null State)
0x65, 0x00,        //   Unit (None)
0x05, 0x09,        //   Usage Page (Button)
0x19, 0x01,        //   Usage Minimum (0x01)
0x29, 0x11,        //   Usage Maximum (0x11)
0x15, 0x00,        //   Logical Minimum (0)
0x25, 0x01,        //   Logical Maximum (1)
0x75, 0x01,        //   Report Size (1)
0x95, 0x11,        //   Report Count (17)
0x81, 0x02,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x06, 0x00, 0xFF,  //   Usage Page (Vendor Defined 0xFF00)
0x09, 0x20,        //   Usage (0x20)
0x75, 0x03,        //   Report Size (3)
0x95, 0x01,        //   Report Count (1)
0x81, 0x02,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x05, 0x01,        //   Usage Page (Generic Desktop Ctrls)
0x09, 0x33,        //   Usage (Rx)
0x09, 0x34,        //   Usage (Ry)
0x15, 0x00,        //   Logical Minimum (0)
0x26, 0xFF, 0x00,  //   Logical Maximum (255)
0x75, 0x08,        //   Report Size (8)
0x95, 0x02,        //   Report Count (2)
0x81, 0x02,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x06, 0x00, 0xFF,  //   Usage Page (Vendor Defined 0xFF00)
0x09, 0x21,        //   Usage (0x21)
0x95, 0x36,        //   Report Count (54)
0x81, 0x02,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x85, 0x05,        //   Report ID (5)
0x09, 0x22,        //   Usage (0x22)
0x95, 0x1F,        //   Report Count (31)
0x91, 0x02,        //   Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0x85, 0x03,        //   Report ID (3)
0x0A, 0x21, 0x27,  //   Usage (0x2721)
0x95, 0x2F,        //   Report Count (47)
0xB1, 0x02,        //   Feature (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0x06, 0x80, 0xFF,  //   Usage Page (Vendor Defined 0xFF80)
0x85, 0xE0,        //   Report ID (-32)
0x09, 0x57,        //   Usage (0x57)
0x95, 0x02,        //   Report Count (2)
0xB1, 0x02,        //   Feature (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0xC0,              // End Collection
0x06, 0xF0, 0xFF,  // Usage Page (Vendor Defined 0xFFF0)
0x09, 0x40,        // Usage (0x40)
0xA1, 0x01,        // Collection (Application)
0x85, 0xF0,        //   Report ID (-16)
0x09, 0x47,        //   Usage (0x47)
0x95, 0x3F,        //   Report Count (63)
0xB1, 0x02,        //   Feature (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0x85, 0xF1,        //   Report ID (-15)
0x09, 0x48,        //   Usage (0x48)
0x95, 0x3F,        //   Report Count (63)
0xB1, 0x02,        //   Feature (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0x85, 0xF2,        //   Report ID (-14)
0x09, 0x49,        //   Usage (0x49)
0x95, 0x0F,        //   Report Count (15)
0xB1, 0x02,        //   Feature (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0x85, 0xF3,        //   Report ID (-13)
0x0A, 0x01, 0x47,  //   Usage (0x4701)
0x95, 0x07,        //   Report Count (7)
0xB1, 0x02,        //   Feature (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0x06, 0x00, 0xFF,  //   Usage Page (Vendor Defined 0xFF00)
0x09, 0x00,        //   Usage (0x00)
0x85, 0x10,        //   Report ID (16)
0x15, 0x00,        //   Logical Minimum (0)
0x25, 0xFF,        //   Logical Maximum (-1)
0x35, 0x00,        //   Physical Minimum (0)
0x45, 0xFF,        //   Physical Maximum (-1)
0x75, 0x08,        //   Report Size (8)
0x95, 0x3F,        //   Report Count (63)
0x81, 0x02,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x06, 0x00, 0xFF,  //   Usage Page (Vendor Defined 0xFF00)
0x09, 0x20,        //   Usage (0x20)
0x85, 0xDD,        //   Report ID (-35)
0x75, 0x08,        //   Report Size (8)
0x95, 0x3F,        //   Report Count (63)
0x81, 0x02,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x85, 0x0F,        //   Report ID (15)
0x09, 0x22,        //   Usage (0x22)
0x95, 0x3F,        //   Report Count (63)
0x91, 0x02,        //   Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0xC0,              // End Collection


来源: stackexchange

问:
Difference in two pattern of cloudwatch logging to understand pricing
Lets say I have 10 lines of data with 1000 byte in each line.

What is the difference in cost incurred if I log in the following pattern.

All 10 lines is logged in single entity in cloudwatch logs. i.e. only 1 entry is created in it

Each of 10 line is logged in single entity in cloudwatch logs. i.e. 10 entry is created in it.

ContentLicense: CC BY-SA 4.0


问:
C# System.Net.Sockets.SocketException: Network is unreachable (10051)
I'm working on a Unity game that uses Mirror to establish a TCP socket connection to a game server hosted on GameLift. The server picks a random port to listen on between 45000 and 46000 before a game session starts.

One of our users cannot connect to servers when using mobile data but has no problems when on WiFi. This user's partner is experiencing the same problem. They both have the same mobile network operator (Three). The user is using an iPhone X on iOS 16 and so is the partner (not sure about the OS version).

Our logs show that TcpClient.Connect is throwing a SocketException with ErrorCode 10051 and SocketErrorCode NetworkUnreachable. There's no InnerException.

We've checked that the ports are open on the server when a game is active and other players have been able to join those game sessions.

We've checked that his mobile network allows him to use the port picked by the server using http://portquiz.net/.

I've ensured that we're using the latest version of Mirror and I've looked for a similar issue in the GitHub repo but found nothing similar.

I'm not sure what else to check and would appreciate any input you guys might have.


问:
Notion Api - Export PDF
Is it possible to download a Notion page as PDF via the API?
Just like the Export -> PDF function that is available in the UI?

I am trying to automate the exporting process.
I have searched the Notion API but could not find anything.

Title: Notion Api - Export PDF


问:
Notification system using socket.io based on MYSQL table inserts | updates
Initial setup - Client and backend are connected on a socket server.

Query - I have a notifications SQL table which will store notifications with created and updated timestamps
I need to push the recent 5 notifications records to the user connected. (User should have the latest 5 notifications at all times).
How to emit event from the backend for this when new record is inserted or updated in SQL? Is there any conventional way to approach this scenario?


问:
KAGGLE BERT : ValueError: Shapes (None, 2) and (None, 3) are incompatible
I'm trying to follow a kaggle for the BERT model : https://www.kaggle.com/code/ludovicocuoghi/twitter-sentiment-analysis-with-bert-roberta/notebook

And at the step near the end I get this error :

```<code>ValueError: Shapes (None, 2) and (None, 3) are incompatible
</code>```

The cell :

```<code>history_bert = model.fit([train_input_ids,train_attention_masks], y_train, validation_data=([val_input_ids,val_attention_masks], y_valid), epochs=4, batch_size=32)
</code>```

I tried many things but I didnt find any solution If someone cane enlight me it'll be useful !

the shape of differents variables :

```<code> train_input_ids SHAPE: (640740, 128)
 train_attention_masks SHAPE: (640740, 128)
 y_train SHAPE: (640740, 2)
 val_input_ids SHAPE: (71194, 128)
 val_attention_masks SHAPE: (71194, 128)
 y_valid SHAPE: (71194, 2)
</code>```

In my dataset Sentiment has only 2 value 0 / 1 idk if this may have an impact on the error

I switched the variable's place in the functions fit.
I search for similar errors on differents forums to find a solution.

Body:
I'm trying to follow a kaggle for the BERT model : https://www.kaggle.com/code/ludovicocuoghi/twitter-sentiment-analysis-with-bert-roberta/notebook

And at the step near the end I get this error :

ValueError: Shapes (None, 2) and (None, 3) are incompatible

The cell :

history_bert = model.fit([train_input_ids,train_attention_masks], y_train, validation_data=([val_input_ids,val_attention_masks], y_valid), epochs=4, batch_size=32)

I tried many things but I didnt find any solution If someone cane enlight me it'll be useful !

the shape of differents variables :

 train_input_ids SHAPE: (640740, 128)
 train_attention_masks SHAPE: (640740, 128)
 y_train SHAPE: (640740, 2)
 val_input_ids SHAPE: (71194, 128)
 val_attention_masks SHAPE: (71194, 128)
 y_valid SHAPE: (71194, 2)

In my dataset Sentiment has only 2 value 0 / 1 idk if this may have an impact on the error

I switched the variable's place in the functions fit.
I search for similar errors on differents forums to find a solution.


问:
Open url link from lambda for cache html
I use nextjs with amplify and after deployment cache was reset. To save an HTML file to CloudFront cache it needs to be opened from browser. I use dynamic routes witch cache JSON (not HTML) in cache after navigating to page. Also i use lambda function for getting JSON data. Is there a way to store HTML to cache from lambda function, for example, open link with HTML from lambda?</p>


问:
Script Macros for go to Last Row Google Sheet
I was try to record macros on Google Sheet

```<code>function Database() {
  var spreadsheet = SpreadsheetApp.getActive();
  spreadsheet.getRange('E:G').activate();
  spreadsheet.setActiveSheet(spreadsheet.getSheetByName('Sheet9'), true);

spreadsheet.getRange('B193').activate();
  spreadsheet.getRange('sheet8!E:G').copyTo(spreadsheet.getActiveRange(), SpreadsheetApp.CopyPasteType.PASTE_VALUES, false);
  spreadsheet.setActiveSheet(spreadsheet.getSheetByName('Sheet10'), true);

spreadsheet.getRange('A1').activate();
  spreadsheet.getActiveRangeList().clear({contentsOnly: true, skipFilteredRows: true});
};
</code>```

On that script, I want to change part spreadsheet.getRange('B193').activate(); because actually I go to last row, not to range B193

what do I need to change so that the script can go to the last row, not to cell B193

I've tried doing a few things but it hasn't worked

Body:
I was try to record macros on Google Sheet

function Database() {
  var spreadsheet = SpreadsheetApp.getActive();
  spreadsheet.getRange('E:G').activate();
  spreadsheet.setActiveSheet(spreadsheet.getSheetByName('Sheet9'), true);

spreadsheet.getRange('B193').activate();
  spreadsheet.getRange('sheet8!E:G').copyTo(spreadsheet.getActiveRange(), SpreadsheetApp.CopyPasteType.PASTE_VALUES, false);
  spreadsheet.setActiveSheet(spreadsheet.getSheetByName('Sheet10'), true);

spreadsheet.getRange('A1').activate();
  spreadsheet.getActiveRangeList().clear({contentsOnly: true, skipFilteredRows: true});
};

On that script, I want to change part spreadsheet.getRange('B193').activate(); because actually I go to last row, not to range B193

what do I need to change so that the script can go to the last row, not to cell B193

I've tried doing a few things but it hasn't worked


问:
Check If Service Is Started With Espresso By Click On View
I want to test that when i click on btnRestore , CloudRestoreService should be start.
how to test this ?</p>
```<code>@Test
fun testBtnRestore_expectedIntentCloudRestoreService() {
    Intents.init()
    onView(withId(R.id.btnRestore))
        .check(matches(isDisplayed()))
        .check(matches(isEnabled()))
        .perform(click())
    intended(hasComponent(CloudRestoreService::class.java.name))
    Intents.release()
}
</code>```

Body:
I want to test that when i click on btnRestore , CloudRestoreService should be start.
how to test this ?

@Test
fun testBtnRestore_expectedIntentCloudRestoreService() {
    Intents.init()
    onView(withId(R.id.btnRestore))
        .check(matches(isDisplayed()))
        .check(matches(isEnabled()))
        .perform(click())
    intended(hasComponent(CloudRestoreService::class.java.name))
    Intents.release()
}


问:
react-native app crashes on release mode - IOS with SIGABRT
App run on debug mode well and no error occur. But when i archive and run to below command;

```<code>npx react-native run-ios --configuration=Release
</code>```

Archive is success but app crashes at LaunchScreen. Here is the Problem Report's backtrace.

```<code>Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note:  EXC_CORPSE_NOTIFY
Triggered by Thread:  0

Last Exception Backtrace:
0   CoreFoundation                         0x10f9f7368 __exceptionPreprocess + 226
1   libobjc.A.dylib                        0x10b148baf objc_exception_throw + 48
2   MyApp                              ->  0x100f4039c RCTFormatError + 0 (RCTAssert.m:167)
3   MyApp                              ->  0x100f59d6d __28-[RCTCxxBridge handleError:]_block_invoke + 651
4   libdispatch.dylib                      0x10f0cb7fb _dispatch_call_block_and_release + 12
5   libdispatch.dylib                      0x10f0cca3a _dispatch_client_callout + 8
6   libdispatch.dylib                      0x10f0dc32c _dispatch_main_queue_drain + 1338
7   libdispatch.dylib                      0x10f0dbde4 _dispatch_main_queue_callback_4CF + 31
8   CoreFoundation                         0x10f9569f7 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
9   CoreFoundation                         0x10f9513c6 __CFRunLoopRun + 2482
10  CoreFoundation                         0x10f950637 CFRunLoopRunSpecific + 560
11  GraphicsServices                       0x115fcd28a GSEventRunModal + 139
12  UIKitCore                              0x11e4b1425 -[UIApplication _run] + 994
13  UIKitCore                              0x11e4b6301 UIApplicationMain + 123
14  Akıllı Karavan                         0x100e51ac0 main + 72 (main.m:8)
15  dyld_sim                               0x10a9c32bf start_sim + 10
16  dyld                                   0x20240852e start + 462
17  dyld                                   0x202403000 ???
</code>```

Any solution ?

Body:
App run on debug mode well and no error occur. But when i archive and run to below command;

npx react-native run-ios --configuration=Release

Archive is success but app crashes at LaunchScreen. Here is the Problem Report's backtrace.

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note:  EXC_CORPSE_NOTIFY
Triggered by Thread:  0

Last Exception Backtrace:
0   CoreFoundation                         0x10f9f7368 __exceptionPreprocess + 226
1   libobjc.A.dylib                        0x10b148baf objc_exception_throw + 48
2   MyApp                              ->  0x100f4039c RCTFormatError + 0 (RCTAssert.m:167)
3   MyApp                              ->  0x100f59d6d __28-[RCTCxxBridge handleError:]_block_invoke + 651
4   libdispatch.dylib                      0x10f0cb7fb _dispatch_call_block_and_release + 12
5   libdispatch.dylib                      0x10f0cca3a _dispatch_client_callout + 8
6   libdispatch.dylib                      0x10f0dc32c _dispatch_main_queue_drain + 1338
7   libdispatch.dylib                      0x10f0dbde4 _dispatch_main_queue_callback_4CF + 31
8   CoreFoundation                         0x10f9569f7 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
9   CoreFoundation                         0x10f9513c6 __CFRunLoopRun + 2482
10  CoreFoundation                         0x10f950637 CFRunLoopRunSpecific + 560
11  GraphicsServices                       0x115fcd28a GSEventRunModal + 139
12  UIKitCore                              0x11e4b1425 -[UIApplication _run] + 994
13  UIKitCore                              0x11e4b6301 UIApplicationMain + 123
14  Akıllı Karavan                         0x100e51ac0 main + 72 (main.m:8)
15  dyld_sim                               0x10a9c32bf start_sim + 10
16  dyld                                   0x20240852e start + 462
17  dyld                                   0x202403000 ???

Any solution ?


问:
Migrating to latest react native firebase version
I am having some issues on my iOS app for the react native firebase version's conflicts.

There were some errors when I tried to run my app for IOS yesterday.
react-native-firebase/crashlytics, analytics and messaging were depending on different versions of react-native-firebase/app.

When I tried to resolve them I got into multiple problems, one after another.

The first thing was, I followed a solution to update my firebase/app to the latest version by this command: npm i @react-native-firebase/app@16.4.0 --legacy-peer-deps. This updated the version but I got several other issues.

The other thing I did to resolve the second problem was:

pod 'GoogleUtilities', :modular_headers => true

pod 'FirebaseCore', :modular_headers => true

In my Podfile. But then I got 127 issue related to Undefined symbol: ........ etc

This was my PodFile:

```<code>require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

$FirebaseSDKVersion = '8.0.0'
platform :ios, '11.0'

target 'Buggy' do
  config = use_native_modules!

  use_react_native!(:path => config["reactNativePath"])

  # permissions_path = '../node_modules/react-native-permissions/ios'

  # pod 'Permission-Camera', :path => "#{permissions_path}/Camera"
  # pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary"

  pod 'RNCAsyncStorage', :path => '../node_modules/@react-native-async-storage/async-storage'

  pod 'react-native-netinfo', :path => '../node_modules/@react-native-community/netinfo'

  pod 'RNGestureHandler', :path => '../node_modules/react-native-gesture-handler'

  pod 'react-native-version-check', :path => '../node_modules/react-native-version-check'

  pod 'ReactNativeExceptionHandler', :path => '../node_modules/react-native-exception-handler'

  target 'BuggyTests' do
    inherit! :complete
    # Pods for testing
  end

  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable these next few lines.
#   use_flipper!
#   post_install do |installer|
#     flipper_post_install(installer)
#   end
end

target 'Buggy-tvOS' do
  # Pods for Buggy-tvOS

  target 'Buggy-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  end
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings["ONLY_ACTIVE_ARCH"] = "NO"
    end
  end
end
# post_install do |pi|
#   pi.pods_project.targets.each do |t|
#     t.build_configurations.each do |config|
#       config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '10.0'
#     end
#   end
# end
</code>```

And package.json

```<code>{
  "name": "Buggy",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint ."
  },
  "dependencies": {
    "@apollo/client": "^3.3.6",
    "@apollo/react-hooks": "^4.0.0",
    "@ptomasroos/react-native-multi-slider": "^2.2.2",
    "@react-native-async-storage/async-storage": "^1.13.4",
    "@react-native-community/checkbox": "^0.5.6",
    "@react-native-community/masked-view": "^0.1.10",
    "@react-native-community/netinfo": "^5.9.10",
    "@react-native-community/push-notification-ios": "^1.8.0",
    "@react-native-firebase/analytics": "^11.0.0",
    "@react-native-firebase/app": "^12.0.0",
    "@react-native-firebase/crashlytics": "^11.0.0",
    "@react-native-firebase/firestore": "^14.5.1",
    "@react-native-firebase/messaging": "^12.0.0",
    "@react-native-firebase/perf": "^11.0.0",
    "@react-native-picker/picker": "^1.9.10",
    "@react-navigation/bottom-tabs": "^5.11.2",
    "@react-navigation/material-bottom-tabs": "^5.3.10",
    "@react-navigation/native": "^5.8.10",
    "@react-navigation/stack": "^5.12.8",
    "apollo-boost": "^0.4.7",
    "apollo-cache-inmemory": "^1.6.6",
    "apollo-client": "^2.6.10",
    "apollo-link-rest": "^0.8.0-beta.0",
    "dotenv": "^10.0.0",
    "events": "^3.3.0",
    "express": "^4.17.1",
    "graphql": "^15.4.0",
    "graphql-tag": "^2.11.0",
    "moment": "^2.29.1",
    "moment-timezone": "^0.5.33",
    "react": "16.13.1",
    "react-native": "0.63.4",
    "react-native-animate-loading-button": "^1.0.3",
    "react-native-animated-login": "^0.2.1",
    "react-native-calendar-picker": "^7.1.1",
    "react-native-device-info": "^8.0.7",
    "react-native-dialog": "^6.1.2",
    "react-native-dropdownalert": "^4.3.0",
    "react-native-elements": "^3.0.1",
    "react-native-exception-handler": "^2.10.10",
    "react-native-file-viewer": "^2.1.4",
    "react-native-gesture-handler": "^1.9.0",
    "react-native-google-places-autocomplete": "^2.1.3",
    "react-native-image-crop-picker": "^0.36.0",
    "react-native-image-resizer": "^1.4.4",
    "react-native-image-slider-box": "^1.0.12",
    "react-native-image-view": "^2.1.9",
    "react-native-input-credit-card": "^0.5.5",
    "react-native-internet-connection-alert": "^0.1.4",
    "react-native-keyboard-aware-scroll-view": "^0.9.3",
    "react-native-launch-navigator": "^1.0.8",
    "react-native-linear-gradient": "^2.5.6",
    "react-native-modal": "^11.6.1",
    "react-native-paper": "^4.5.0",
    "react-native-paper-dropdown": "^0.0.5",
    "react-native-picker-select": "^8.0.4",
    "react-native-push-notification": "^7.3.1",
    "react-native-pusher-push-notifications": "^2.5.1",
    "react-native-reanimated": "^1.13.2",
    "react-native-responsive-screen": "^1.4.1",
    "react-native-restart": "^0.0.22",
    "react-native-safe-area-context": "^3.1.9",
    "react-native-screens": "^2.16.1",
    "react-native-simple-dialogs": "^1.4.0",
    "react-native-tab-view": "^2.16.0",
    "react-native-toast-message": "^1.4.9",
    "react-native-vector-icons": "^7.1.0",
    "react-native-version-check": "^3.4.2",
    "react-navigation": "^4.4.4",
    "rn-fetch-blob": "^0.12.0"
  },
  "devDependencies": {
    "@babel/core": "^7.8.4",
    "@babel/runtime": "^7.8.4",
    "@react-native-community/eslint-config": "^1.1.0",
    "babel-jest": "^25.1.0",
    "eslint": "^6.5.1",
    "jest": "^25.1.0",
    "metro-react-native-babel-preset": "^0.59.0",
    "react-test-renderer": "16.13.1"
  },
  "jest": {
    "preset": "react-native"
  }
}
</code>```

I think I need to migrate to the latest version But I am having difficulties as I am a newbiew, Please help me to get the solution for this, Thanks!

Body:
I am having some issues on my iOS app for the react native firebase version's conflicts.

There were some errors when I tried to run my app for IOS yesterday.
react-native-firebase/crashlytics, analytics and messaging were depending on different versions of react-native-firebase/app.

When I tried to resolve them I got into multiple problems, one after another.

The first thing was, I followed a solution to update my firebase/app to the latest version by this command: npm i @react-native-firebase/app@16.4.0 --legacy-peer-deps. This updated the version but I got several other issues.

The other thing I did to resolve the second problem was:

pod 'GoogleUtilities', :modular_headers => true

pod 'FirebaseCore', :modular_headers => true

In my Podfile. But then I got 127 issue related to Undefined symbol: ........ etc

This was my PodFile:

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

$FirebaseSDKVersion = '8.0.0'
platform :ios, '11.0'

target 'Buggy' do
  config = use_native_modules!

  use_react_native!(:path => config["reactNativePath"])

  # permissions_path = '../node_modules/react-native-permissions/ios'

  # pod 'Permission-Camera', :path => "#{permissions_path}/Camera"
  # pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary"

  pod 'RNCAsyncStorage', :path => '../node_modules/@react-native-async-storage/async-storage'

  pod 'react-native-netinfo', :path => '../node_modules/@react-native-community/netinfo'

  pod 'RNGestureHandler', :path => '../node_modules/react-native-gesture-handler'

  pod 'react-native-version-check', :path => '../node_modules/react-native-version-check'

  pod 'ReactNativeExceptionHandler', :path => '../node_modules/react-native-exception-handler'

  target 'BuggyTests' do
    inherit! :complete
    # Pods for testing
  end

  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable these next few lines.
#   use_flipper!
#   post_install do |installer|
#     flipper_post_install(installer)
#   end
end

target 'Buggy-tvOS' do
  # Pods for Buggy-tvOS

  target 'Buggy-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  end
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings["ONLY_ACTIVE_ARCH"] = "NO"
    end
  end
end
# post_install do |pi|
#   pi.pods_project.targets.each do |t|
#     t.build_configurations.each do |config|
#       config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '10.0'
#     end
#   end
# end

And package.json

{
  "name": "Buggy",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint ."
  },
  "dependencies": {
    "@apollo/client": "^3.3.6",
    "@apollo/react-hooks": "^4.0.0",
    "@ptomasroos/react-native-multi-slider": "^2.2.2",
    "@react-native-async-storage/async-storage": "^1.13.4",
    "@react-native-community/checkbox": "^0.5.6",
    "@react-native-community/masked-view": "^0.1.10",
    "@react-native-community/netinfo": "^5.9.10",
    "@react-native-community/push-notification-ios": "^1.8.0",
    "@react-native-firebase/analytics": "^11.0.0",
    "@react-native-firebase/app": "^12.0.0",
    "@react-native-firebase/crashlytics": "^11.0.0",
    "@react-native-firebase/firestore": "^14.5.1",
    "@react-native-firebase/messaging": "^12.0.0",
    "@react-native-firebase/perf": "^11.0.0",
    "@react-native-picker/picker": "^1.9.10",
    "@react-navigation/bottom-tabs": "^5.11.2",
    "@react-navigation/material-bottom-tabs": "^5.3.10",
    "@react-navigation/native": "^5.8.10",
    "@react-navigation/stack": "^5.12.8",
    "apollo-boost": "^0.4.7",
    "apollo-cache-inmemory": "^1.6.6",
    "apollo-client": "^2.6.10",
    "apollo-link-rest": "^0.8.0-beta.0",
    "dotenv": "^10.0.0",
    "events": "^3.3.0",
    "express": "^4.17.1",
    "graphql": "^15.4.0",
    "graphql-tag": "^2.11.0",
    "moment": "^2.29.1",
    "moment-timezone": "^0.5.33",
    "react": "16.13.1",
    "react-native": "0.63.4",
    "react-native-animate-loading-button": "^1.0.3",
    "react-native-animated-login": "^0.2.1",
    "react-native-calendar-picker": "^7.1.1",
    "react-native-device-info": "^8.0.7",
    "react-native-dialog": "^6.1.2",
    "react-native-dropdownalert": "^4.3.0",
    "react-native-elements": "^3.0.1",
    "react-native-exception-handler": "^2.10.10",
    "react-native-file-viewer": "^2.1.4",
    "react-native-gesture-handler": "^1.9.0",
    "react-native-google-places-autocomplete": "^2.1.3",
    "react-native-image-crop-picker": "^0.36.0",
    "react-native-image-resizer": "^1.4.4",
    "react-native-image-slider-box": "^1.0.12",
    "react-native-image-view": "^2.1.9",
    "react-native-input-credit-card": "^0.5.5",
    "react-native-internet-connection-alert": "^0.1.4",
    "react-native-keyboard-aware-scroll-view": "^0.9.3",
    "react-native-launch-navigator": "^1.0.8",
    "react-native-linear-gradient": "^2.5.6",
    "react-native-modal": "^11.6.1",
    "react-native-paper": "^4.5.0",
    "react-native-paper-dropdown": "^0.0.5",
    "react-native-picker-select": "^8.0.4",
    "react-native-push-notification": "^7.3.1",
    "react-native-pusher-push-notifications": "^2.5.1",
    "react-native-reanimated": "^1.13.2",
    "react-native-responsive-screen": "^1.4.1",
    "react-native-restart": "^0.0.22",
    "react-native-safe-area-context": "^3.1.9",
    "react-native-screens": "^2.16.1",
    "react-native-simple-dialogs": "^1.4.0",
    "react-native-tab-view": "^2.16.0",
    "react-native-toast-message": "^1.4.9",
    "react-native-vector-icons": "^7.1.0",
    "react-native-version-check": "^3.4.2",
    "react-navigation": "^4.4.4",
    "rn-fetch-blob": "^0.12.0"
  },
  "devDependencies": {
    "@babel/core": "^7.8.4",
    "@babel/runtime": "^7.8.4",
    "@react-native-community/eslint-config": "^1.1.0",
    "babel-jest": "^25.1.0",
    "eslint": "^6.5.1",
    "jest": "^25.1.0",
    "metro-react-native-babel-preset": "^0.59.0",
    "react-test-renderer": "16.13.1"
  },
  "jest": {
    "preset": "react-native"
  }
}

I think I need to migrate to the latest version But I am having difficulties as I am a newbiew, Please help me to get the solution for this, Thanks!


问:
SQLALchemy Many-to-Many with multiple same Objects
```<code>article_links = db.Table('article_links',
    db.Column('parent_id', db.Integer, db.ForeignKey('articles.id'), nullable=False),
    db.Column('child_id', db.Integer, db.ForeignKey('articles.id'), nullable=False)
)

class Articles(db.Model):

    id = db.Column(db.Integer, primary_key=True)
    consists = db.relation(
        'Articles',
        secondary=article_links,
        primaryjoin=(article_links.c.parent_id == id),
        secondaryjoin=(article_links.c.child_id == id),
        back_populates='part_of'
    )
    part_of = db.relation(
        'Articles',
        secondary=article_links,
        primaryjoin=(article_links.c.child_id == id),
        secondaryjoin=(article_links.c.parent_id == id),
        back_populates='consists'
    )

result = session.query(article_links).where(article_links.c.parent_id==483).all()
for row in result:
    print(row)

$ [(483, 484), (483, 485), (483, 486), (483, 486), (483, 486)]
</code>```
```<code>print(Articles.query.get(483).consists)
$ [<Articles 484>, <Articles 485>, <Articles 486>]
</code>```

The article 486 is linked several times within article_links. Unfortunately, I get the article back only once.

```<code>sub = db.session.query(article_links).filter_by(parent_id=483).subquery()
res = db.session.execute(select(Articles).select_from(sub).where(sub.c.child_id==Articles.id))
print([r for r in res])

$ [(<Articles 484>,), (<Articles 485>,), (<Articles 486>,), (<Articles 486>,), (<Articles 486>,)]
</code>```

If I leave the ORM model of SQLAlchemy I get the expected result.

How can I retrieve all results within the ORM?

Body:
article_links = db.Table('article_links',
    db.Column('parent_id', db.Integer, db.ForeignKey('articles.id'), nullable=False),
    db.Column('child_id', db.Integer, db.ForeignKey('articles.id'), nullable=False)
)

class Articles(db.Model):

    id = db.Column(db.Integer, primary_key=True)
    consists = db.relation(
        'Articles',
        secondary=article_links,
        primaryjoin=(article_links.c.parent_id == id),
        secondaryjoin=(article_links.c.child_id == id),
        back_populates='part_of'
    )
    part_of = db.relation(
        'Articles',
        secondary=article_links,
        primaryjoin=(article_links.c.child_id == id),
        secondaryjoin=(article_links.c.parent_id == id),
        back_populates='consists'
    )

result = session.query(article_links).where(article_links.c.parent_id==483).all()
for row in result:
    print(row)

$ [(483, 484), (483, 485), (483, 486), (483, 486), (483, 486)]

print(Articles.query.get(483).consists)
$ [<Articles 484>, <Articles 485>, <Articles 486>]

The article 486 is linked several times within article_links. Unfortunately, I get the article back only once.

sub = db.session.query(article_links).filter_by(parent_id=483).subquery()
res = db.session.execute(select(Articles).select_from(sub).where(sub.c.child_id==Articles.id))
print([r for r in res])

$ [(<Articles 484>,), (<Articles 485>,), (<Articles 486>,), (<Articles 486>,), (<Articles 486>,)]

If I leave the ORM model of SQLAlchemy I get the expected result.

How can I retrieve all results within the ORM?


问:
Async SocketIO client emits only when sio.emit is called in the same function as the sio.connect is called in
I'm not sure how to propelry call AsyncSocketIO emit

Below works fine

```<code>sio = socketio.AsyncClient()

async def connect_to_server():
    global sio

    await sio.connect('https://some.domain')
    await sio.emit("test", 'hello')

asyncio.run(connect_to_server())
</code>```

Than I'd like to call the sio.emit again from another function like this

```<code>async def send():
    global sio
    await sio.emit("awm:test", 'hello')

asyncio.run(send())
</code>```

There is no error, just nothing happens. What am I missing?

Body:
I'm not sure how to propelry call AsyncSocketIO emit

Below works fine

sio = socketio.AsyncClient()

async def connect_to_server():
    global sio

    await sio.connect('https://some.domain')
    await sio.emit("test", 'hello')

asyncio.run(connect_to_server())

Than I'd like to call the sio.emit again from another function like this

async def send():
    global sio
    await sio.emit("awm:test", 'hello')

asyncio.run(send())

There is no error, just nothing happens. What am I missing?


问:
ElasticSearch: translate sql to dsl; x_content_parse_exception error
recently started working with elastic search and I want to translate the following sql snippet to a DSL object.

```<code>              (
                a.import_batch IS NOT NULL
                AND (
                    a.import_status = 'imported'
                    OR (
                        a.import_status = 'joined'
                        AND d.signup_stage IS NOT NULL
                    )
                )
              )
              OR (
                  a.import_status = 'joined'
                  AND (
                    d.approved IS NOT true
                    OR (
                      d.signup_stage IS NOT NULL
                    )
                  )
              )
</code>```

and this is my attempt at translating it to DSL,

```<code>{
                bool: {
                  should: [
                    {
                      bool: {
                        must: {
                          term: { [`${path}.import_batch`]: null },
                        },
                        should: [
                          {
                            term: { [`${path}.import_status`]: 'imported' },
                          },
                          {
                            bool: {
                              must: [
                                {
                                  term: { [`${path}.import_status`]: 'joined' },
                                },
                                {
                                  exists: { field: 'signup_stage' },
                                },
                              ],
                            },
                          },
                        ],
                      },
                    },
                    {
                      bool: {
                        must: { term: { [`${path}.import_status`]: 'joined' } },
                        should: [
                          { must_not: { term: { approved: true } } },
                          { exists: { field: 'signup_stage' } },
                        ],
                      },
                    },
                  ],
                },
              }
</code>```

Ignore, the alias references in sql. I have two sql tables, group_users(a), and users(d). In ES, users data is indexed at top level, while the group_users is at path group_users. In the DSL above, path is group_users.

I'm getting x_content_parse_exception with this DSL. Any help is much appreciated.

Body:
recently started working with elastic search and I want to translate the following sql snippet to a DSL object.

              (
                a.import_batch IS NOT NULL
                AND (
                    a.import_status = 'imported'
                    OR (
                        a.import_status = 'joined'
                        AND d.signup_stage IS NOT NULL
                    )
                )
              )
              OR (
                  a.import_status = 'joined'
                  AND (
                    d.approved IS NOT true
                    OR (
                      d.signup_stage IS NOT NULL
                    )
                  )
              )

and this is my attempt at translating it to DSL,

{
                bool: {
                  should: [
                    {
                      bool: {
                        must: {
                          term: { [`${path}.import_batch`]: null },
                        },
                        should: [
                          {
                            term: { [`${path}.import_status`]: 'imported' },
                          },
                          {
                            bool: {
                              must: [
                                {
                                  term: { [`${path}.import_status`]: 'joined' },
                                },
                                {
                                  exists: { field: 'signup_stage' },
                                },
                              ],
                            },
                          },
                        ],
                      },
                    },
                    {
                      bool: {
                        must: { term: { [`${path}.import_status`]: 'joined' } },
                        should: [
                          { must_not: { term: { approved: true } } },
                          { exists: { field: 'signup_stage' } },
                        ],
                      },
                    },
                  ],
                },
              }

Ignore, the alias references in sql. I have two sql tables, group_users(a), and users(d). In ES, users data is indexed at top level, while the group_users is at path group_users. In the DSL above, path is group_users.

I'm getting x_content_parse_exception with this DSL. Any help is much appreciated.


问:
How to remove equivalent elements in two different lists that are inside a tuple
Having a tuples like:
(['kg', 'm', 'm', 's'], ['m', 's', 's'])  , (['kg', 'm', 'm', 's'], ['s', 'm', 'm', 'kg']) or

(['s', 'kg', 'm', '1'], ['1', '1'])

their respective results are:
(['kg', 'm'], ['s']), (['1'], ['1']) and (['kg', 'm', 's'], ['1'])

The test here being:
print(canonical(unit))
since it is a function def canonical(unit) that will define the conditions for this to happen.
It's an exercise about SI Units and their definitions. What's asked is for we to get a tuple like the initial but you "divide" the elements from the l1 by the elements in l2, knowing that if there's more than one 1, it is erased (only one 1 can remain in each list). The elements in each list are organized in alphabetical order too.

I've tried to use iteration and loops but without success, I got a ton of errors and the farthest I got was using set but it just removes the repeating elements altogether; i.e:

```<code>unit = (['kg', 'm', 'm', 's'], ['m', 's', 's'])
l1, l2 = unit
res = list(set(l1)^set(l2))
print(res)
</code>```

I'm a beginner so I still haven't learnt things like dictionaries and streams.

Body:
Having a tuples like:
(['kg', 'm', 'm', 's'], ['m', 's', 's'])  , (['kg', 'm', 'm', 's'], ['s', 'm', 'm', 'kg']) or

(['s', 'kg', 'm', '1'], ['1', '1'])

their respective results are:
(['kg', 'm'], ['s']), (['1'], ['1']) and (['kg', 'm', 's'], ['1'])

The test here being:
print(canonical(unit))
since it is a function def canonical(unit) that will define the conditions for this to happen.
It's an exercise about SI Units and their definitions. What's asked is for we to get a tuple like the initial but you "divide" the elements from the l1 by the elements in l2, knowing that if there's more than one 1, it is erased (only one 1 can remain in each list). The elements in each list are organized in alphabetical order too.

I've tried to use iteration and loops but without success, I got a ton of errors and the farthest I got was using set but it just removes the repeating elements altogether; i.e:

unit = (['kg', 'm', 'm', 's'], ['m', 's', 's'])
l1, l2 = unit
res = list(set(l1)^set(l2))
print(res)

I'm a beginner so I still haven't learnt things like dictionaries and streams.


问:
Scipy.ndimage.rotate on 3D image gives a different result if spline_filter is applied before
The scipy.ndimage.rotate is supposed to apply a spline filter before rotation. But with images of at least 3 dimensions, when I apply scipy.ndimage.prefilter before and I then call rotate with prefilter=False, the result is very different in comparison with a simple call to rotate with prefilter=True.

Here is a simple reproducer with a rotation of 0, which is supposed to let unchanged the input array:

```<code>from scipy import ndimage
import numpy as np

t = np.random.uniform(0,1000,size=(3,3,3))

trans1 = ndimage.rotate(t, angle=0, axes=(1,0), reshape=False, mode='constant', cval=0, prefilter=True)

trans2 = ndimage.spline_filter(t, mode='constant')
trans2 = ndimage.rotate(trans2, angle=0, axes=(1,0), reshape=False, mode='constant', cval=0, prefilter=False)

print(f"dist (t,trans1) = {abs(t-trans1).mean():.6f}")
print(f"dist (t,trans2) = {abs(t-trans2).mean():.6f}")
</code>```

Example of output:

```<code>dist (t,trans1) = 0.000000
dist (t,trans2) = 240.582366
</code>```

We can see that, when we apply prefilter before rotate, the result is very different and I don't understand why.

Body:
The scipy.ndimage.rotate is supposed to apply a spline filter before rotation. But with images of at least 3 dimensions, when I apply scipy.ndimage.prefilter before and I then call rotate with prefilter=False, the result is very different in comparison with a simple call to rotate with prefilter=True.

Here is a simple reproducer with a rotation of 0, which is supposed to let unchanged the input array:

from scipy import ndimage
import numpy as np

t = np.random.uniform(0,1000,size=(3,3,3))

trans1 = ndimage.rotate(t, angle=0, axes=(1,0), reshape=False, mode='constant', cval=0, prefilter=True)

trans2 = ndimage.spline_filter(t, mode='constant')
trans2 = ndimage.rotate(trans2, angle=0, axes=(1,0), reshape=False, mode='constant', cval=0, prefilter=False)

print(f"dist (t,trans1) = {abs(t-trans1).mean():.6f}")
print(f"dist (t,trans2) = {abs(t-trans2).mean():.6f}")

Example of output:

dist (t,trans1) = 0.000000
dist (t,trans2) = 240.582366

We can see that, when we apply prefilter before rotate, the result is very different and I don't understand why.


问:
Fastapi request form not displaying example
fastapi Form unable to display example in documentation. My other Query works with example field, but not under Form.

```<code>@router.post(
    "/identify",
    status_code=status.HTTP_200_OK,
    description="Identify video",
    response_model=IdentifyVideo,
)
async def identify(
    probe_video_file: Optional[UploadFile] = File(None, description="Probe video file"),
    every_nth_frame: int = Form(int(1), description="Only process every nth frame", example=5),
):
</code>```

The example is not displaying in documentation page, but if I change Form to Query, then the example works in documentation. Any idea on how to resolve this issue?

Body:
fastapi Form unable to display example in documentation. My other Query works with example field, but not under Form.

@router.post(
    "/identify",
    status_code=status.HTTP_200_OK,
    description="Identify video",
    response_model=IdentifyVideo,
)
async def identify(
    probe_video_file: Optional[UploadFile] = File(None, description="Probe video file"),
    every_nth_frame: int = Form(int(1), description="Only process every nth frame", example=5),
):

The example is not displaying in documentation page, but if I change Form to Query, then the example works in documentation. Any idea on how to resolve this issue?


问:
How to be able to connect to MariaDB docker container at localhost:3306 from Python application running in another container?
Yesterday i created a MariaDB image with this command:

```<code>docker run --name test_smdb -e MYSQL_ROOT_PASSWORD=<some_password> -p 3306:3306 -d mariadb:10.4.26
</code>```

And as here is said:
https://docs.docker.com/config/containers/container-networking/

-p 8080:80    Map TCP port 80 in the container to port 8080 on the Docker host.

So i expected to be able to connect to the database via localhost:3306, from a Python application, running in another container in the same Docker instance (deployed on my machine), but this did not happen. I got:

```<code> Can't connect to MariaDB : 2003 (HY000): Can't connect to MySQL server on 'localhost:3306' (99)
</code>```

So after some investigation and following some advices from here:
Docker cannot connect application to MySQL
, executing :

```<code>docker network list
docker network inspect <id>
</code>```

i got the ip of the container and connected to MariaDB, using it.
But i still would like to connect to the MariaDB container, using localhost. How to do that?

Body:
Yesterday i created a MariaDB image with this command:

docker run --name test_smdb -e MYSQL_ROOT_PASSWORD=<some_password> -p 3306:3306 -d mariadb:10.4.26

And as here is said:
https://docs.docker.com/config/containers/container-networking/

-p 8080:80    Map TCP port 80 in the container to port 8080 on the Docker host.

So i expected to be able to connect to the database via localhost:3306, from a Python application, running in another container in the same Docker instance (deployed on my machine), but this did not happen. I got:

 Can't connect to MariaDB : 2003 (HY000): Can't connect to MySQL server on 'localhost:3306' (99)

So after some investigation and following some advices from here:
Docker cannot connect application to MySQL
, executing :

docker network list
docker network inspect <id>

i got the ip of the container and connected to MariaDB, using it.
But i still would like to connect to the MariaDB container, using localhost. How to do that?


问:
MemoryError: with json in python
I have json file with 38 GB and i need to convert it into table and move it  to the data base

The problem here is the size of the file and to solve it I thought to split the file into small files.

so for that I use this code:

```<code>import os
import json

#you need to add you path here
with open(os.path.join('folder/data.json'), 'r',
          encoding='utf-8') as f1:
    ll = [json.loads(line.strip()) for line in f1.readlines()]

    #this is the total length size of the json file
    print(len(ll))

    #in here 2000 means we getting splits of 2000 tweets
    #you can define your own size of split according to your need

    size_of_the_split=1000000
    total = len(ll) // size_of_the_split

    #in here you will get the Number of splits
    print(total+1)

    for i in range(total+1):
        json.dump(ll[i * size_of_the_split:(i + 1) * size_of_the_split], open(
            "result/data_split" + str(i+1) + ".json", 'w',
            encoding='utf8'), ensure_ascii=False, indent=True)
</code>```

it works fine with any other Json files except this one I get this error MemoryError:

any advice

Title: MemoryError: with json in python

Body:
I have json file with 38 GB and i need to convert it into table and move it  to the data base

The problem here is the size of the file and to solve it I thought to split the file into small files.

so for that I use this code:

import os
import json

#you need to add you path here
with open(os.path.join('folder/data.json'), 'r',
          encoding='utf-8') as f1:
    ll = [json.loads(line.strip()) for line in f1.readlines()]

    #this is the total length size of the json file
    print(len(ll))

    #in here 2000 means we getting splits of 2000 tweets
    #you can define your own size of split according to your need

    size_of_the_split=1000000
    total = len(ll) // size_of_the_split

    #in here you will get the Number of splits
    print(total+1)

    for i in range(total+1):
        json.dump(ll[i * size_of_the_split:(i + 1) * size_of_the_split], open(
            "result/data_split" + str(i+1) + ".json", 'w',
            encoding='utf8'), ensure_ascii=False, indent=True)

it works fine with any other Json files except this one I get this error MemoryError:

any advice


问:
How does vscode or gdb know where the source code is?
When I use vscode debug my code, how does the debugger know where to find the source code? Is the source code path recorded into the binary file when compiling? Sometimes, the debugger complains "Unknown Source"， what are the rules behind this?</p>


问:
WooCommerce hooks in plugin class not working on pay_for_order page
woocommerce_review_order_after_order_total hook does not work on pay_for_order page but it's working fine in checkout page.

```<code>function uv_show_usd_total_at_checkout(): void {
    error_log( 'aaa' );
    $total  = WC()->cart->get_cart_contents_total();
    $total  = uv_get_amount_in_usd( $total );
    $markup = <<<HTML
        <tr class="order-total">
            <th>Equal</th>
            <td><span class="woocommerce-Price-amount amount"><bdi><span class="woocommerce-Price-currencySymbol" id="uv-usd-total">$total </span>دلار</bdi></span></td>
        </tr>
        HTML;

    echo $markup;
}
add_action( 'woocommerce_review_order_after_order_total', 'uv_show_usd_total_at_checkout' );
</code>```

Body:
woocommerce_review_order_after_order_total hook does not work on pay_for_order page but it's working fine in checkout page.

function uv_show_usd_total_at_checkout(): void {
    error_log( 'aaa' );
    $total  = WC()->cart->get_cart_contents_total();
    $total  = uv_get_amount_in_usd( $total );
    $markup = <<<HTML

            Equal
            <bdi>$total دلار</bdi>

        HTML;

    echo $markup;
}
add_action( 'woocommerce_review_order_after_order_total', 'uv_show_usd_total_at_checkout' );


问:
Import a local xls to Google Sheets with Apps Script
I want to automatically import an xls file that i save to a specified local folder on a laptop weekly to a Google Sheets.

I want to replace the data in a sheet each time the import is done. The file name changes everytime also but does always start with report so could I use "report*"

If anyone can help with the script it would be appreciated, it will save me a manual import each time

Thanks
Martin

I have never used the Google Apps Script extension previously and I seem to be having issues trying to define the local drive as the location with the filename changing each time.

Example location would be C:\Reports\ and the filename will always start with Report (report123456.xls) as example, I want to then import that to the existing Sheet named Details


问:
Sync with online file so that existing place-holder has offline status (MacOS)
I'd like to sync an online file so that becomes available offline.
This wasn't an issue before the recent change to dropbox, since the apps
would interact via the file system to  sync with the latest copy.

I haven't found a relevant topic in the forums, though  this one is close- but in my case the local file is an empty placeholder with appropriate extended attributes.

Scott


问:
Docker + Traefik 2.2 - www.app.com not using https. How to set https redirect regex
Just started using traefik. if i access www.myappdomain.com, its insecure and wont redirect to https. Please all this versioning of apps are very confusing. I am still uising .toml and configured both static and dynamic traefik files. Please can someone direct me on how to redirect using the regex as what i have tried havent worked in v2.2.
Below is my docker-compose.yaml:

```<code>version: '3.9'
services:
  traefik:
    image: 'traefik:v2.2'
    volumes:
      - '/var/run/docker.sock:/var/run/docker.sock'
      - '$PWD/traefik/traefik.toml:/traefik.toml'
      - '$PWD/traefik/traefik_dynamic.toml:/traefik_dynamic.toml'
      - '$PWD/traefik/acme.json:/acme.json'
    ports:
      - '80:80'
      - '443:443'
    restart: always
    networks:
      - web
    container_name: traefik

  postgres:
    image: postgres:13-alpine
    restart: always
    container_name: postgres
    depends_on:
      - traefik
    environment:
      - POSTGRES_USER
      - POSTGRES_PASSWORD
      - POSTGRES_DB
    volumes:
      - /home/development/db_data:/var/lib/postgresql/data
    networks:
      - web
  app:
    image: golang
    ports:
      - "8080:8080"
    restart: always
    environment:
      - DB_SOURCE
    depends_on:
      - postgres
    networks:
      - web
    entrypoint: [ "/app/wait-for.sh", "app:5432", "--", "/app/start.sh" ]
    command: [ "/app/main" ]
    container_name: golang-app
    labels:
      - traefik.http.routers.app.rule=Host(`mayapp.com`)
      - traefik.http.routers.app.tls=true
      - traefik.http.routers.app.tls.certresolver=lets-encrypt
      - "traefik.port=8080"
volumes:
  db-data:
secrets:
  db-password:
    file: docker/db/password.txt
networks:
  web:
    external: true

</code>```

For the static traefik.toml

```<code>[entryPoints]
  [entryPoints.web]
    address = ":80"
    [entryPoints.web.http.redirections.entryPoint]
      to = "websecure"
      scheme = "https"

  [entryPoints.websecure]
    address = ":443"

[api]
  dashboard = true

[certificatesResolvers.lets-encrypt.acme]
  email = "admin@app.com"
  storage = "acme.json"
  [certificatesResolvers.lets-encrypt.acme.tlsChallenge]

[providers.docker]
  watch = true
  network = "web"

[providers.file]
  filename = "traefik_dynamic.toml"
</code>```

For the traefik_dynamic.toml

```<code>[http.middlewares.simpleAuth.basicAuth]
  users = [
    "admin:$appapppapppapapapappapappa/"
  ]

[http.routers.api]
  rule = "Host(`monitor.app.com`)"
  entrypoints = ["websecure"]
  middlewares = ["simpleAuth"]
  service = "api@internal"
  [http.routers.api.tls]
    certResolver = "lets-encrypt"
</code>```

I have tried adding labels to the traefik container, but it still wont make www secure. Please can someone point me in the right direction? thank you

Body:
Just started using traefik. if i access www.myappdomain.com, its insecure and wont redirect to https. Please all this versioning of apps are very confusing. I am still uising .toml and configured both static and dynamic traefik files. Please can someone direct me on how to redirect using the regex as what i have tried havent worked in v2.2.
Below is my docker-compose.yaml:

version: '3.9'
services:
  traefik:
    image: 'traefik:v2.2'
    volumes:
      - '/var/run/docker.sock:/var/run/docker.sock'
      - '$PWD/traefik/traefik.toml:/traefik.toml'
      - '$PWD/traefik/traefik_dynamic.toml:/traefik_dynamic.toml'
      - '$PWD/traefik/acme.json:/acme.json'
    ports:
      - '80:80'
      - '443:443'
    restart: always
    networks:
      - web
    container_name: traefik

  postgres:
    image: postgres:13-alpine
    restart: always
    container_name: postgres
    depends_on:
      - traefik
    environment:
      - POSTGRES_USER
      - POSTGRES_PASSWORD
      - POSTGRES_DB
    volumes:
      - /home/development/db_data:/var/lib/postgresql/data
    networks:
      - web
  app:
    image: golang
    ports:
      - "8080:8080"
    restart: always
    environment:
      - DB_SOURCE
    depends_on:
      - postgres
    networks:
      - web
    entrypoint: [ "/app/wait-for.sh", "app:5432", "--", "/app/start.sh" ]
    command: [ "/app/main" ]
    container_name: golang-app
    labels:
      - traefik.http.routers.app.rule=Host(`mayapp.com`)
      - traefik.http.routers.app.tls=true
      - traefik.http.routers.app.tls.certresolver=lets-encrypt
      - "traefik.port=8080"
volumes:
  db-data:
secrets:
  db-password:
    file: docker/db/password.txt
networks:
  web:
    external: true

For the static traefik.toml

[entryPoints]
  [entryPoints.web]
    address = ":80"
    [entryPoints.web.http.redirections.entryPoint]
      to = "websecure"
      scheme = "https"

  [entryPoints.websecure]
    address = ":443"

[api]
  dashboard = true

[certificatesResolvers.lets-encrypt.acme]
  email = "admin@app.com"
  storage = "acme.json"
  [certificatesResolvers.lets-encrypt.acme.tlsChallenge]

[providers.docker]
  watch = true
  network = "web"

[providers.file]
  filename = "traefik_dynamic.toml"

For the traefik_dynamic.toml

[http.middlewares.simpleAuth.basicAuth]
  users = [
    "admin:$appapppapppapapapappapappa/"
  ]

[http.routers.api]
  rule = "Host(`monitor.app.com`)"
  entrypoints = ["websecure"]
  middlewares = ["simpleAuth"]
  service = "api@internal"
  [http.routers.api.tls]
    certResolver = "lets-encrypt"

I have tried adding labels to the traefik container, but it still wont make www secure. Please can someone point me in the right direction? thank you


问:
Search Bar to filter checkboxes in Qlistview
I have a program where it shows all c files from a selected folder as checkboxes in a Qlistview. I'm trying to make a search bar to filter the file names in the qlistview.
Here is my code so far

```<code>class MainWindow(QWidget):
    def __init__(self):
        super().__init__()
        self.fileLVModel = None
        self.pathTB = None
        self._initUI()

    def _initUI(self):
        self.setStyleSheet("QLabel {font: 10pt Lucida Sans}")
        self.setGeometry(300, 200, 600, 450)
        self.resize(600, 530)
        self.setWindowTitle("Ingeneers Software Metrics")
        self.setWindowIcon(QIcon("icon.png"))
        self._initMetricsUI()
        self.show()

    def _initMetricsUI(self):
        # Path textbox
        self.pathTB = QLineEdit(self)
        self.pathTB.move(10, 180)
        self.pathTB.resize(535, 25)
        self.pathTB.setText(os.path.dirname(os.path.realpath(__file__)))
        self.pathTB.textChanged.connect(self._pathTextBoxTextChangedHandler)

        # file list
        self.fileLV = QListView(self)
        self._pathTextBoxTextChangedHandler()
        self.fileLV.move(10, 260)
        self.fileLV.resize(580, 115)

        # search bar
        model = QStandardItemModel(len(self.fileArr), 1)
        for row, file in enumerate(self.fileArr):
            item = QStandardItem(file)
            model.setItem(row, 0, item)
        filter_proxy_file = QSortFilterProxyModel()
        filter_proxy_file.setSourceModel(model)
        filter_proxy_file.setFilterCaseSensitivity(Qt.CaseInsensitive)
        filter_proxy_file.setFilterKeyColumn(0)

        self.searchTB = QLineEdit(self)
        self.searchTB.move(10, 230)
        self.searchTB.resize(580, 25)
        self.searchTB.textChanged.connect(filter_proxy_file.setFilterRegExp)

    def _pathButtonClickHandler(self):
        tbPath = self.pathTB.text()
        pathString = str(
            QFileDialog.getExistingDirectory(self, "Select Directory", str(tbPath), QFileDialog.ShowDirsOnly))
        if pathString != "":
            self.pathTB.setText(pathString)

    def _pathTextBoxTextChangedHandler(self):
        self.fileCheckBoxes = []
        self.fileArr = []
        self.fileLVModel = QStandardItemModel()
        self.fileLV.setModel(self.fileLVModel)
        try:
            for file in os.listdir(self.pathTB.text()):
                if file.endswith(".c"):
                    item = QStandardItem(str(file))
                    item.setFlags(Qt.ItemIsUserCheckable | Qt.ItemIsEnabled)
                    item.setData(QVariant(Qt.Checked), Qt.CheckStateRole)
                    self.fileCheckBoxes.append(item)
                    self.fileArr.append(str(file))
                    self.fileLVModel.appendRow(item)
        except (FileNotFoundError, OSError):
            pass

</code>```

I used SortFilterProxyModel, but in the search bar nothing happen when I write something

Body:
I have a program where it shows all c files from a selected folder as checkboxes in a Qlistview. I'm trying to make a search bar to filter the file names in the qlistview.
Here is my code so far

class MainWindow(QWidget):
    def __init__(self):
        super().__init__()
        self.fileLVModel = None
        self.pathTB = None
        self._initUI()

    def _initUI(self):
        self.setStyleSheet("QLabel {font: 10pt Lucida Sans}")
        self.setGeometry(300, 200, 600, 450)
        self.resize(600, 530)
        self.setWindowTitle("Ingeneers Software Metrics")
        self.setWindowIcon(QIcon("icon.png"))
        self._initMetricsUI()
        self.show()

    def _initMetricsUI(self):
        # Path textbox
        self.pathTB = QLineEdit(self)
        self.pathTB.move(10, 180)
        self.pathTB.resize(535, 25)
        self.pathTB.setText(os.path.dirname(os.path.realpath(__file__)))
        self.pathTB.textChanged.connect(self._pathTextBoxTextChangedHandler)

        # file list
        self.fileLV = QListView(self)
        self._pathTextBoxTextChangedHandler()
        self.fileLV.move(10, 260)
        self.fileLV.resize(580, 115)

        # search bar
        model = QStandardItemModel(len(self.fileArr), 1)
        for row, file in enumerate(self.fileArr):
            item = QStandardItem(file)
            model.setItem(row, 0, item)
        filter_proxy_file = QSortFilterProxyModel()
        filter_proxy_file.setSourceModel(model)
        filter_proxy_file.setFilterCaseSensitivity(Qt.CaseInsensitive)
        filter_proxy_file.setFilterKeyColumn(0)

        self.searchTB = QLineEdit(self)
        self.searchTB.move(10, 230)
        self.searchTB.resize(580, 25)
        self.searchTB.textChanged.connect(filter_proxy_file.setFilterRegExp)

    def _pathButtonClickHandler(self):
        tbPath = self.pathTB.text()
        pathString = str(
            QFileDialog.getExistingDirectory(self, "Select Directory", str(tbPath), QFileDialog.ShowDirsOnly))
        if pathString != "":
            self.pathTB.setText(pathString)

    def _pathTextBoxTextChangedHandler(self):
        self.fileCheckBoxes = []
        self.fileArr = []
        self.fileLVModel = QStandardItemModel()
        self.fileLV.setModel(self.fileLVModel)
        try:
            for file in os.listdir(self.pathTB.text()):
                if file.endswith(".c"):
                    item = QStandardItem(str(file))
                    item.setFlags(Qt.ItemIsUserCheckable | Qt.ItemIsEnabled)
                    item.setData(QVariant(Qt.Checked), Qt.CheckStateRole)
                    self.fileCheckBoxes.append(item)
                    self.fileArr.append(str(file))
                    self.fileLVModel.appendRow(item)
        except (FileNotFoundError, OSError):
            pass

I used SortFilterProxyModel, but in the search bar nothing happen when I write something


问:
Xml Serialise class with a property being an interface
I am trying to Serialise the class 'Person', which contains a property where the type is an interface.

I a getting an exception - System.NotSupportedException - saying
----> System.NotSupportedException : Cannot serialize member Tests.Person.Names of type Writer.Tests.INames because it is an interface.

Is there a way round this? Or just simply can not be done.

```<code> public interface INames
    {
        string First { get; set; }
        string Last { get; set; }
    }

    public class Names : INames
    {
        public string First { get; set; }
        public string Last { get; set; }
    }

    public class Person
    {
        public INames Names { get; set; }
        public double WeightKg { get; set; }
        public double HeightCm { get; set; }
    }
</code>```
```<code></code>```

Body:
I am trying to Serialise the class 'Person', which contains a property where the type is an interface.

I a getting an exception - System.NotSupportedException - saying
----> System.NotSupportedException : Cannot serialize member Tests.Person.Names of type Writer.Tests.INames because it is an interface.

Is there a way round this? Or just simply can not be done.

 public interface INames
    {
        string First { get; set; }
        string Last { get; set; }
    }

    public class Names : INames
    {
        public string First { get; set; }
        public string Last { get; set; }
    }

    public class Person
    {
        public INames Names { get; set; }
        public double WeightKg { get; set; }
        public double HeightCm { get; set; }
    }


问:
Exception caught by rendering library (Fitted Box Error)
Since i implemnetd the FittedBox with a Full width Image the app tells me to that i have a render error but i cant fix it.

All the other widgets have a expanded function and it all worked fine until i inserted the banner.

But even if i make it as small as 5 pixel the app tells me the same error..

How can i fix that?

I assume its the fitted box.

The Error:

════════ Exception caught by rendering library ═════════════════════════════════
RenderBox was not laid out: RenderFittedBox#d209c relayoutBoundary=up3 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
package:flutter/…/rendering/box.dart:1
Failed assertion: line 2001 pos 12: 'hasSize'

The relevant error-causing widget was
Column
lib/…/event_details_screen/match_details.dart:45
The following RenderObject was being processed when the exception was fired: RenderFittedBox#d209c relayoutBoundary=up3 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
RenderObject: RenderFittedBox#d209c relayoutBoundary=up3 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
parentData: offset=Offset(0.0, 0.0); flex=null; fit=null (can use size)
constraints: BoxConstraints(0.0<=w<=428.0, 0.0<=h<=Infinity)
size: MISSING
fit: fitWidth
alignment: Alignment.center
textDirection: ltr
child: RenderSemanticsAnnotations#a5a83 relayoutBoundary=up4 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
parentData:  (can use size)
constraints: BoxConstraints(unconstrained)
size: Size(0.0, 0.0)
child: RenderImage#d2457 relayoutBoundary=up5 NEEDS-PAINT
parentData:  (can use size)
constraints: BoxConstraints(unconstrained)
size: Size(0.0, 0.0)
image: null
alignment: Alignment.center
invertColors: false
filterQuality: low

```<code>class _DefaultDetailsState extends State<DefaultDetails> {
  final double padding = EVENT_DETAILS_PADDING;

  @override
  Widget build(BuildContext context) {
    return DetailScreen(
      child: _screen(),
    );
  }

  Widget _screen() {
    return Column(
      children: [
        _section(
          flex: 4,
          child: TournamentTitleSection(
            event: widget.event,
            host: widget.host,
          ),
        ),
        FittedBox(
          fit: BoxFit.fitWidth,
          child: Image.asset('assets/images/ads/mockup_ad.PNG'),
        ),
        _section(
          flex: 10,
          child: DefaultDetailsSection(
            event: widget.event,
            host: widget.host,
          ),
        ),
        _divider(),
        _section(
          flex: 4,
          child: TimesSection(
            event: widget.event,
            calendarName: _calendarName,
          ),
        ),
        ...
</code>```

The Widget _section.

```<code>Widget _section({Widget? child, int flex = 1}) {
    return Expanded(
      flex: flex,
      child: Padding(
        padding: EdgeInsets.symmetric(horizontal: padding),
        child: child ?? const SizedBox(),
      ),
    );
  }
</code>```

I allready tried to wrap it in a Expanded Widget and also sized boy but nothing worked.

Body:
Since i implemnetd the FittedBox with a Full width Image the app tells me to that i have a render error but i cant fix it.

All the other widgets have a expanded function and it all worked fine until i inserted the banner.

But even if i make it as small as 5 pixel the app tells me the same error..

How can i fix that?

I assume its the fitted box.

The Error:

════════ Exception caught by rendering library ═════════════════════════════════
RenderBox was not laid out: RenderFittedBox#d209c relayoutBoundary=up3 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
package:flutter/…/rendering/box.dart:1
Failed assertion: line 2001 pos 12: 'hasSize'

The relevant error-causing widget was
Column
lib/…/event_details_screen/match_details.dart:45
The following RenderObject was being processed when the exception was fired: RenderFittedBox#d209c relayoutBoundary=up3 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
RenderObject: RenderFittedBox#d209c relayoutBoundary=up3 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
parentData: offset=Offset(0.0, 0.0); flex=null; fit=null (can use size)
constraints: BoxConstraints(0.0<=w<=428.0, 0.0<=h<=Infinity)
size: MISSING
fit: fitWidth
alignment: Alignment.center
textDirection: ltr
child: RenderSemanticsAnnotations#a5a83 relayoutBoundary=up4 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
parentData:  (can use size)
constraints: BoxConstraints(unconstrained)
size: Size(0.0, 0.0)
child: RenderImage#d2457 relayoutBoundary=up5 NEEDS-PAINT
parentData:  (can use size)
constraints: BoxConstraints(unconstrained)
size: Size(0.0, 0.0)
image: null
alignment: Alignment.center
invertColors: false
filterQuality: low

class _DefaultDetailsState extends State<DefaultDetails> {
  final double padding = EVENT_DETAILS_PADDING;

  @override
  Widget build(BuildContext context) {
    return DetailScreen(
      child: _screen(),
    );
  }

  Widget _screen() {
    return Column(
      children: [
        _section(
          flex: 4,
          child: TournamentTitleSection(
            event: widget.event,
            host: widget.host,
          ),
        ),
        FittedBox(
          fit: BoxFit.fitWidth,
          child: Image.asset('assets/images/ads/mockup_ad.PNG'),
        ),
        _section(
          flex: 10,
          child: DefaultDetailsSection(
            event: widget.event,
            host: widget.host,
          ),
        ),
        _divider(),
        _section(
          flex: 4,
          child: TimesSection(
            event: widget.event,
            calendarName: _calendarName,
          ),
        ),
        ...

The Widget _section.

Widget _section({Widget? child, int flex = 1}) {
    return Expanded(
      flex: flex,
      child: Padding(
        padding: EdgeInsets.symmetric(horizontal: padding),
        child: child ?? const SizedBox(),
      ),
    );
  }

I allready tried to wrap it in a Expanded Widget and also sized boy but nothing worked.


问:
How to edit email html to make it fit in a smaller screen size?
I have an email and I want to make it fit in a smaller screen size. Just like how Gmail handles this in their app. But I couldn't find any lib or tool that accepts an email and returns the edited HTML. Do you know I can achieve that?

I Wrote an algorithm that removes empty elements and resizes picture to work with the screen size (width:100%) but there is always another email that is built ever so slightly different and my code  don't catch or parse it wrong.


问:
keras returning Attribute error 'Dense' object has no attribute '_saved_model_inputs_spec'
I am trying to upgrade a code from tensorflow 1.x to tensorflow 2.x, since I need to use it with python>=3.8. The code is from someone else who is not updating it, you can find it here if needed: https://github.com/NetManAIOps/donut.
I have used the tools provided by tensorflow to upgrade it (i.e. running tf_upgrade_v2 in each file).
Already for a while I have been stuck with an error that I cannot track down.

```<code> File "test_model.py", line 227, in <module>
   get_anomaly_score(test_files, KPI=args.KPI)
 File "test_model.py", line 79, in get_anomaly_score
   test_score = dm.predictor.get_score(test_values, test_missing)
 File "/home/miguel/gitlab_projects/test/donut_haowen/donut/prediction.py", line 138, in get_score
   b_r = sess.run(self._get_score(), feed_dict=feed_dict)
 File "/home/miguel/gitlab_projects/test/donut_haowen/donut/prediction.py", line 64, in _get_score
   self._score = self.model.get_score(
 File "/home/miguel/gitlab_projects/test/donut_haowen/donut/model.py", line 197, in get_score
   x_r = iterative_masked_reconstruct(
 File "/home/miguel/gitlab_projects/test/donut_haowen/donut/reconstruction.py", line 101, in iterative_masked_reconstruct
   x_r, _ = tf.while_loop(
 File "/home/miguel/anaconda3/envs/test/lib/python3.8/site-packages/tensorflow/python/util/deprecation.py", line 629, in new_func
   return func(*args, **kwargs)
 File "/home/miguel/anaconda3/envs/test/lib/python3.8/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2516, in while_loop_v2
   return while_loop(
 File "/home/miguel/anaconda3/envs/test/lib/python3.8/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2716, in while_loop
   return while_v2.while_loop(
 File "/home/miguel/anaconda3/envs/test/lib/python3.8/site-packages/tensorflow/python/ops/while_v2.py", line 222, in while_loop
   body_graph = func_graph_module.func_graph_from_py_func(
 File "/home/miguel/anaconda3/envs/test/lib/python3.8/site-packages/tensorflow/python/framework/func_graph.py", line 1283, in func_graph_from_py_func
   func_outputs = python_func(*func_args, **func_kwargs)
 File "/home/miguel/anaconda3/envs/test/lib/python3.8/site-packages/tensorflow/python/ops/while_v2.py", line 200, in wrapped_body
   outputs = body(
 File "/home/miguel/gitlab_projects/test/donut_haowen/donut/reconstruction.py", line 103, in <lambda>
   body=lambda x_i, i: (masked_reconstruct(reconstruct, x_i, mask), i + 1),
 File "/home/miguel/gitlab_projects/test/donut_haowen/donut/reconstruction.py", line 65, in masked_reconstruct
   r_x = reconstruct(x)
 File "/home/miguel/gitlab_projects/test/src/tfsnippet/tfsnippet/modules/auto_encoders/vae.py", line 469, in reconstruct
   model = self.model(z=q_net['z'], n_z=n_z, n_x=n_x)
 File "/home/miguel/gitlab_projects/test/src/tfsnippet/tfsnippet/utils/reuse.py", line 179, in wrapper
   return method(*args, **kwargs)
 File "/home/miguel/gitlab_projects/test/src/tfsnippet/tfsnippet/modules/auto_encoders/vae.py", line 314, in model
   x_params = self.h_for_p_x(z)
 File "/home/miguel/gitlab_projects/test/src/tfsnippet/tfsnippet/modules/base.py", line 89, in __call__
   return self._forward(inputs, **kwargs)
 File "/home/miguel/gitlab_projects/test/src/tfsnippet/tfsnippet/modules/container/lambda_.py", line 47, in _forward
   return self._factory(inputs, **kwargs)
 File "/home/miguel/gitlab_projects/test/donut_haowen/donut/model.py", line 24, in wrap_params_net
   h = h_for_dist(inputs)
 File "/home/miguel/gitlab_projects/test/src/tfsnippet/tfsnippet/modules/base.py", line 89, in __call__
   return self._forward(inputs, **kwargs)
 File "/home/miguel/gitlab_projects/test/src/tfsnippet/tfsnippet/modules/container/sequential.py", line 76, in _forward
   outputs = c(outputs, **kwargs)
 File "/home/miguel/anaconda3/envs/test/lib/python3.8/site-packages/keras/utils/traceback_utils.py", line 70, in error_handler
   raise e.with_traceback(filtered_tb) from None
 File "/home/miguel/anaconda3/envs/test/lib/python3.8/site-packages/keras/engine/base_layer.py", line 1140, in __call__
   if self._saved_model_inputs_spec is None:
AttributeError: 'Dense' object has no attribute '_saved_model_inputs_spec'
</code>```

This occurs when I call the predictor.py file in the donut package. This will call another package called TFsnippet, which I also upgraded, and this will finally call the keras package.
Since it is not my code that I am using I have trouble to write any kind of minimum reproducible example.

I am looking for any idea of where could the issue be, and what parts of the code should I maybe check. At the moment I do not have any idea of why or how this error occurs.

Please, tell me if I should add something.

Body:
I am trying to upgrade a code from tensorflow 1.x to tensorflow 2.x, since I need to use it with python>=3.8. The code is from someone else who is not updating it, you can find it here if needed: https://github.com/NetManAIOps/donut.
I have used the tools provided by tensorflow to upgrade it (i.e. running tf_upgrade_v2 in each file).
Already for a while I have been stuck with an error that I cannot track down.

 File "test_model.py", line 227, in <module>
   get_anomaly_score(test_files, KPI=args.KPI)
 File "test_model.py", line 79, in get_anomaly_score
   test_score = dm.predictor.get_score(test_values, test_missing)
 File "/home/miguel/gitlab_projects/test/donut_haowen/donut/prediction.py", line 138, in get_score
   b_r = sess.run(self._get_score(), feed_dict=feed_dict)
 File "/home/miguel/gitlab_projects/test/donut_haowen/donut/prediction.py", line 64, in _get_score
   self._score = self.model.get_score(
 File "/home/miguel/gitlab_projects/test/donut_haowen/donut/model.py", line 197, in get_score
   x_r = iterative_masked_reconstruct(
 File "/home/miguel/gitlab_projects/test/donut_haowen/donut/reconstruction.py", line 101, in iterative_masked_reconstruct
   x_r, _ = tf.while_loop(
 File "/home/miguel/anaconda3/envs/test/lib/python3.8/site-packages/tensorflow/python/util/deprecation.py", line 629, in new_func
   return func(*args, **kwargs)
 File "/home/miguel/anaconda3/envs/test/lib/python3.8/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2516, in while_loop_v2
   return while_loop(
 File "/home/miguel/anaconda3/envs/test/lib/python3.8/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2716, in while_loop
   return while_v2.while_loop(
 File "/home/miguel/anaconda3/envs/test/lib/python3.8/site-packages/tensorflow/python/ops/while_v2.py", line 222, in while_loop
   body_graph = func_graph_module.func_graph_from_py_func(
 File "/home/miguel/anaconda3/envs/test/lib/python3.8/site-packages/tensorflow/python/framework/func_graph.py", line 1283, in func_graph_from_py_func
   func_outputs = python_func(*func_args, **func_kwargs)
 File "/home/miguel/anaconda3/envs/test/lib/python3.8/site-packages/tensorflow/python/ops/while_v2.py", line 200, in wrapped_body
   outputs = body(
 File "/home/miguel/gitlab_projects/test/donut_haowen/donut/reconstruction.py", line 103, in <lambda>
   body=lambda x_i, i: (masked_reconstruct(reconstruct, x_i, mask), i + 1),
 File "/home/miguel/gitlab_projects/test/donut_haowen/donut/reconstruction.py", line 65, in masked_reconstruct
   r_x = reconstruct(x)
 File "/home/miguel/gitlab_projects/test/src/tfsnippet/tfsnippet/modules/auto_encoders/vae.py", line 469, in reconstruct
   model = self.model(z=q_net['z'], n_z=n_z, n_x=n_x)
 File "/home/miguel/gitlab_projects/test/src/tfsnippet/tfsnippet/utils/reuse.py", line 179, in wrapper
   return method(*args, **kwargs)
 File "/home/miguel/gitlab_projects/test/src/tfsnippet/tfsnippet/modules/auto_encoders/vae.py", line 314, in model
   x_params = self.h_for_p_x(z)
 File "/home/miguel/gitlab_projects/test/src/tfsnippet/tfsnippet/modules/base.py", line 89, in __call__
   return self._forward(inputs, **kwargs)
 File "/home/miguel/gitlab_projects/test/src/tfsnippet/tfsnippet/modules/container/lambda_.py", line 47, in _forward
   return self._factory(inputs, **kwargs)
 File "/home/miguel/gitlab_projects/test/donut_haowen/donut/model.py", line 24, in wrap_params_net
   h = h_for_dist(inputs)
 File "/home/miguel/gitlab_projects/test/src/tfsnippet/tfsnippet/modules/base.py", line 89, in __call__
   return self._forward(inputs, **kwargs)
 File "/home/miguel/gitlab_projects/test/src/tfsnippet/tfsnippet/modules/container/sequential.py", line 76, in _forward
   outputs = c(outputs, **kwargs)
 File "/home/miguel/anaconda3/envs/test/lib/python3.8/site-packages/keras/utils/traceback_utils.py", line 70, in error_handler
   raise e.with_traceback(filtered_tb) from None
 File "/home/miguel/anaconda3/envs/test/lib/python3.8/site-packages/keras/engine/base_layer.py", line 1140, in __call__
   if self._saved_model_inputs_spec is None:
AttributeError: 'Dense' object has no attribute '_saved_model_inputs_spec'

This occurs when I call the predictor.py file in the donut package. This will call another package called TFsnippet, which I also upgraded, and this will finally call the keras package.
Since it is not my code that I am using I have trouble to write any kind of minimum reproducible example.

I am looking for any idea of where could the issue be, and what parts of the code should I maybe check. At the moment I do not have any idea of why or how this error occurs.

Please, tell me if I should add something.


问:
Django - Paginator.get_page() in ListViews
I am using django 3.2

ListView uses "Paginator.page(number)" for pagination. I would like to use "Paginator.get_page(number)".

If this is my views what should I do to use "Paginator.get_page(number)"?

```<code>class MyList(ListView):
      model = MyModel
      template_name = "template.html"
      paginate_by = 5
</code>```

and as an extra I would like to use "Paginator.get_elided_page_range(number, *, on_each_side=3, on_ends=2)"

Thanks.

Body:
I am using django 3.2

ListView uses "Paginator.page(number)" for pagination. I would like to use "Paginator.get_page(number)".

If this is my views what should I do to use "Paginator.get_page(number)"?

class MyList(ListView):
      model = MyModel
      template_name = "template.html"
      paginate_by = 5

and as an extra I would like to use "Paginator.get_elided_page_range(number, *, on_each_side=3, on_ends=2)"

Thanks.