问:
bind() returns error code 10038 using winsock.h
I am trying to implement a client-server architecture using sockets in Windows with winsock.h. When I call bind() function I get the error code 10038 and I don`t know why.

Here it is my code. This is only the server, created inside a thread where I initialice the socket and jump into an infinite loop to read data from client usng recvfrom function.

```<code>typedef struct
{
    int sockfd;
    struct sockaddr_in dir_client;
    int long_dir_client;
    struct sockaddr_in dir_server;
    uint32_t receive_data;
}server_t;

void RX_thread_Client(void)
{
    WSADATA wsaData;
    server_t server;
    int iResult;
    int BytesReceived;

    // Initialize Winsock
    iResult = WSAStartup(MAKEWORD(2, 2), &wsaData);
    if (iResult != 0) {
        printf("[RxThreadClient] WSAStartup failed with error: %d\n", iResult);
        return;
    }

    memset((char*)& server.dir_server, 0, sizeof(server.dir_server));
    server.dir_server.sin_family = AF_INET;
    server.dir_server.sin_addr.s_addr = inet_addr("10.128.169.46");
    server.dir_server.sin_port = htons(6500);
    server.long_dir_client = sizeof(server.dir_client);

    // Create a new socket to make a client connection.
    // AF_INET = 2, The Internet Protocol version 4 (IPv4) address family, TCP protocol
    if ( server.sockfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP) == INVALID_SOCKET)
    {
        printf("[RxThreadClient] Client: socket() failed! Error code: %ld\n", WSAGetLastError());
        // Do the clean up
        WSACleanup();
        // Exit with error
        return;
    }
    else
        printf("[RxThreadClient] Client: socket() is OK!\n");

    if ( bind(server.sockfd, (struct sockaddr*)&server.dir_server, sizeof(server.dir_server)) < 0)  // ERROR IS HERE!!!
    {
        printf("[RxThreadClient] bind() failed! Error code: %ld\n", WSAGetLastError());
        return;
    }
    else
        printf("[RxThreadClient] Client: bind() is OK!\n");

    while (1)
    {
        BytesReceived = recvfrom (server.sockfd, (char*)&server.receive_data,
                                  sizeof(server.receive_data), 0,
                                  (struct sockaddr*) & server.dir_client,
                                  &server.long_dir_client);
        if (BytesReceived == SOCKET_ERROR)
        {
            printf("[RxThreadClient] Client: send() error %ld.\n", WSAGetLastError());
            break;
        }
        else
        {
            printf("[RxThreadClient] Client: send() is OK - bytes received: %ld\n", BytesReceived);
            printf("[RxThreadClient] Word received: %d\n", server.receive_data);
        }

        Sleep(1000);
    }
 }
</code>```

Thank you very much

Body:
I am trying to implement a client-server architecture using sockets in Windows with winsock.h. When I call bind() function I get the error code 10038 and I don`t know why.

Here it is my code. This is only the server, created inside a thread where I initialice the socket and jump into an infinite loop to read data from client usng recvfrom function.

typedef struct
{
    int sockfd;
    struct sockaddr_in dir_client;
    int long_dir_client;
    struct sockaddr_in dir_server;
    uint32_t receive_data;
}server_t;

void RX_thread_Client(void)
{
    WSADATA wsaData;
    server_t server;
    int iResult;
    int BytesReceived;

    // Initialize Winsock
    iResult = WSAStartup(MAKEWORD(2, 2), &wsaData);
    if (iResult != 0) {
        printf("[RxThreadClient] WSAStartup failed with error: %d\n", iResult);
        return;
    }

    memset((char*)& server.dir_server, 0, sizeof(server.dir_server));
    server.dir_server.sin_family = AF_INET;
    server.dir_server.sin_addr.s_addr = inet_addr("10.128.169.46");
    server.dir_server.sin_port = htons(6500);
    server.long_dir_client = sizeof(server.dir_client);

    // Create a new socket to make a client connection.
    // AF_INET = 2, The Internet Protocol version 4 (IPv4) address family, TCP protocol
    if ( server.sockfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP) == INVALID_SOCKET)
    {
        printf("[RxThreadClient] Client: socket() failed! Error code: %ld\n", WSAGetLastError());
        // Do the clean up
        WSACleanup();
        // Exit with error
        return;
    }
    else
        printf("[RxThreadClient] Client: socket() is OK!\n");

    if ( bind(server.sockfd, (struct sockaddr*)&server.dir_server, sizeof(server.dir_server)) < 0)  // ERROR IS HERE!!!
    {
        printf("[RxThreadClient] bind() failed! Error code: %ld\n", WSAGetLastError());
        return;
    }
    else
        printf("[RxThreadClient] Client: bind() is OK!\n");

    while (1)
    {
        BytesReceived = recvfrom (server.sockfd, (char*)&server.receive_data,
                                  sizeof(server.receive_data), 0,
                                  (struct sockaddr*) & server.dir_client,
                                  &server.long_dir_client);
        if (BytesReceived == SOCKET_ERROR)
        {
            printf("[RxThreadClient] Client: send() error %ld.\n", WSAGetLastError());
            break;
        }
        else
        {
            printf("[RxThreadClient] Client: send() is OK - bytes received: %ld\n", BytesReceived);
            printf("[RxThreadClient] Word received: %d\n", server.receive_data);
        }

        Sleep(1000);
    }
 }

Thank you very much


来源: stackexchange

问:
Jasper Report Crosstab with ArrayList of Data
I am trying to create Jasper Report with crosstab by writing JRXML with DTOs.

I am trying to create rows dynamic number of chargeCodes and their total. It looks something like this:

jobNo
chargeCodeA
chargeCodeB
Total

jobNoABC
100.10
300.30
400.40

jobNoDEF
200.20
400.40
600.60

In my Java backend, I have DTO which looks like this

```<code>class MyDTO {
private String jobNo;
private List <String> chargeCode = new ArrayList <> ();
private List <BigDecimal> chargeCodeTotal = new ArrayList <> ();
}
</code>```

where the list codeCode contains chargeCodeA, chargeCodeB for jobNoABC

and chargeCodeTotal contains 100.10, 300.30 for jobNoABC also.

In my JRXML, I have this:

```<code><?xml version="1.0" encoding="UTF-8"  ?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd"
        name="vendorBillingCompletedJobReport" leftMargin="5" rightMargin="5">

    <parameter name="lblJobNo" class="java.lang.String" isForPrompting="false"/>

    <field name="jobNo" class="java.lang.String"/>

    <field name="chargeCode" class="java.util.List"/>
    <field name="chargeCodeTotal" class="java.util.List"/>
  <summary>
    <band height="60">
      <crosstab>
        <reportElement width="782" y="0" x="0" height="60" />
        <rowGroup name="jobNo" width="100" totalPosition="End">
          <bucket>
            <bucketExpression class="java.util.List">
              <![CDATA[$F{jobNo}]]>
            </bucketExpression>
          </bucket>
          <crosstabRowHeader>
            <cellContents>
              <box>
                <pen lineColor="black" lineWidth="1"/>
              </box>
              <textField>
                <reportElement width="100" y="0" x="0" height="20" />
                <textElement textAlignment="Right" verticalAlignment="Middle" />
                <textFieldExpression>
                  <![CDATA[$V{jobNo}]]>
                </textFieldExpression>
              </textField>
            </cellContents>
          </crosstabRowHeader>
          <crosstabTotalRowHeader>
            <cellContents>
              <box>
                <pen lineColor="black" lineWidth="1"/>
              </box>
              <staticText>
                <reportElement x="0" y="0" width="60" height="20" />
                <textElement verticalAlignment="Middle" />
                <text>TOTAL</text>
              </staticText>
            </cellContents>
          </crosstabTotalRowHeader>
        </rowGroup>
        <columnGroup name="chargeCode" height="20" totalPosition="End">
          <bucket>
            <bucketExpression class="java.util.List">
              $F{chargeCode}
            </bucketExpression>
          </bucket>
          <crosstabColumnHeader>
            <cellContents>
              <box>
                <pen lineColor="black" lineWidth="1"/>
              </box>
              <textField isStretchWithOverflow="true">
                <reportElement width="60" y="0" x="0" height="20" />
                <textElement verticalAlignment="Bottom" />
                <textFieldExpression>
                  <![CDATA[$V{chargeCode}]]>
                </textFieldExpression>
              </textField>
            </cellContents>
          </crosstabColumnHeader>
          <crosstabTotalColumnHeader>
            <cellContents>
              <box>
                <pen lineColor="black" lineWidth="1"/>
              </box>
              <staticText>
                <reportElement width="60" y="0" x="0" height="20" />
                <textElement verticalAlignment="Bottom" />
                <text>TOTAL</text>
              </staticText>
            </cellContents>
          </crosstabTotalColumnHeader>
        </columnGroup>
        <measure name="chargeCodeTotalCount" class="java.math.BigDecimal" calculation="Sum">
          <measureExpression>$F{chargeCodeTotal}</measureExpression>
        </measure>
        <crosstabCell height="20" width="60">
          <cellContents backcolor="#FFFFFF">
            <box>
              <pen lineColor="black" lineWidth="1"/>
            </box>
            <textField>
              <reportElement x="5" y="0" width="55" height="20" />
              <textElement textAlignment="Left" verticalAlignment="Bottom" />
              <textFieldExpression class="java.math.BigDecimal">
                $V{chargeCodeTotalCount}
              </textFieldExpression>
            </textField>
          </cellContents>
        </crosstabCell>
      </crosstab>
    </band>
  </summary>
</jasperReport>
</code>```

But I am getting error:

java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.lang.Comparable
at org.apache.commons.collections.comparators.ComparableComparator.compare(ComparableComparator.java:91)

I am not sure how to create infinite number of chargeCodes using JRXML.

And I cannot use Dynamic Jasper. I can only think of crosstab. Please help. Thanks.

ContentLicense: CC BY-SA 4.0

Body:
I am trying to create Jasper Report with crosstab by writing JRXML with DTOs.

I am trying to create rows dynamic number of chargeCodes and their total. It looks something like this:

jobNo
chargeCodeA
chargeCodeB
Total

jobNoABC
100.10
300.30
400.40

jobNoDEF
200.20
400.40
600.60

In my Java backend, I have DTO which looks like this

class MyDTO {
private String jobNo;
private List <String> chargeCode = new ArrayList <> ();
private List <BigDecimal> chargeCodeTotal = new ArrayList <> ();
}

where the list codeCode contains chargeCodeA, chargeCodeB for jobNoABC

and chargeCodeTotal contains 100.10, 300.30 for jobNoABC also.

In my JRXML, I have this:

<?xml version="1.0" encoding="UTF-8"  ?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd"
        name="vendorBillingCompletedJobReport" leftMargin="5" rightMargin="5">

    <parameter name="lblJobNo" class="java.lang.String" isForPrompting="false"/>

    <field name="jobNo" class="java.lang.String"/>

    <field name="chargeCode" class="java.util.List"/>
    <field name="chargeCodeTotal" class="java.util.List"/>

    <band height="60">
      <crosstab>
        <reportElement width="782" y="0" x="0" height="60" />
        <rowGroup name="jobNo" width="100" totalPosition="End">
          <bucket>
            <bucketExpression class="java.util.List">
              <![CDATA[$F{jobNo}]]>
            </bucketExpression>
          </bucket>
          <crosstabRowHeader>
            <cellContents>
              <box>
                <pen lineColor="black" lineWidth="1"/>
              </box>
              <textField>
                <reportElement width="100" y="0" x="0" height="20" />
                <textElement textAlignment="Right" verticalAlignment="Middle" />
                <textFieldExpression>
                  <![CDATA[$V{jobNo}]]>
                </textFieldExpression>
              </textField>
            </cellContents>
          </crosstabRowHeader>
          <crosstabTotalRowHeader>
            <cellContents>
              <box>
                <pen lineColor="black" lineWidth="1"/>
              </box>
              <staticText>
                <reportElement x="0" y="0" width="60" height="20" />
                <textElement verticalAlignment="Middle" />
                <text>TOTAL</text>
              </staticText>
            </cellContents>
          </crosstabTotalRowHeader>
        </rowGroup>
        <columnGroup name="chargeCode" height="20" totalPosition="End">
          <bucket>
            <bucketExpression class="java.util.List">
              $F{chargeCode}
            </bucketExpression>
          </bucket>
          <crosstabColumnHeader>
            <cellContents>
              <box>
                <pen lineColor="black" lineWidth="1"/>
              </box>
              <textField isStretchWithOverflow="true">
                <reportElement width="60" y="0" x="0" height="20" />
                <textElement verticalAlignment="Bottom" />
                <textFieldExpression>
                  <![CDATA[$V{chargeCode}]]>
                </textFieldExpression>
              </textField>
            </cellContents>
          </crosstabColumnHeader>
          <crosstabTotalColumnHeader>
            <cellContents>
              <box>
                <pen lineColor="black" lineWidth="1"/>
              </box>
              <staticText>
                <reportElement width="60" y="0" x="0" height="20" />
                <textElement verticalAlignment="Bottom" />
                <text>TOTAL</text>
              </staticText>
            </cellContents>
          </crosstabTotalColumnHeader>
        </columnGroup>
        <measure name="chargeCodeTotalCount" class="java.math.BigDecimal" calculation="Sum">
          <measureExpression>$F{chargeCodeTotal}</measureExpression>
        </measure>
        <crosstabCell height="20" width="60">
          <cellContents backcolor="#FFFFFF">
            <box>
              <pen lineColor="black" lineWidth="1"/>
            </box>
            <textField>
              <reportElement x="5" y="0" width="55" height="20" />
              <textElement textAlignment="Left" verticalAlignment="Bottom" />
              <textFieldExpression class="java.math.BigDecimal">
                $V{chargeCodeTotalCount}
              </textFieldExpression>
            </textField>
          </cellContents>
        </crosstabCell>
      </crosstab>
    </band>

</jasperReport>

But I am getting error:

java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.lang.Comparable
at org.apache.commons.collections.comparators.ComparableComparator.compare(ComparableComparator.java:91)

I am not sure how to create infinite number of chargeCodes using JRXML.

And I cannot use Dynamic Jasper. I can only think of crosstab. Please help. Thanks.


问:
Scala in VSCode: error highlighting not working
I want to use VSCode to work on Scala code, but cannot get error highlighting to work.
See some example code below, how it looks like, vs. how I want it to highlight errors.

I think every proper programming language should have code editor support for highlighting of obvious errors regarding undefined variables, functions or operator overloadings.

What can I do, to get error highlighting for Scala in VSCode?


问:
Copy and paste in values and format multiple worksheets with different range into a new workbook
My workbook consists of following worksheets: ATP610, ATP610 Power, ATP620, ATP620 Power, ATP648, ATP648 Power, ATP648 KWTP, ATP648 SW, etc. As such, I will need to export three groups of worksheets:

ATP610 and ATP610 Power into a new workbook called ATP610. The worksheets are named as "ATP610 WP&B" and "ATP610 Electricity Profile".

ATP620 and ATP620 Power into a new workbook called ATP620. The worksheets are named as "ATP620 WP&B" and "ATP620 Electricity Profile".

ATP648, ATP648 Power, ATP648 KWTP and ATP648 SW into a new workbook called ATP648. The worksheets are named as "ATP648 WP&B", "ATP648 Electricity Profile", "ATP648 KWTP" and "ATP648 SW".

Note that each worksheet has a different range that I need to copy and paste in both values and format in their own worksheets in a new workbook. E.g. for ATP610, I need to copy D3:AU197 and ATP610 Power, D3:Q29.

Can someone help me with a set of workable VBA codes?

I am trying to export a group of worksheets from existing workbook into a new workbook that I need to circulate to external parties in both excel and pdf. As such, the copied sheets in the new workbook cannot contain any linkages and formula, while retaining the formatting of the original workbook.

Below set of codes give me an error message "Run-time error '424': Object required" and it stopped after the first sheet was copied over to the new workbook. The second worksheet "ATP610 Power" did not get copied over to the new workbook. What did I miss?

```<code>Sub ExportDataTEST()

    Dim wb As Workbook: Set wb = ThisWorkbook: Dim ws As Worksheet: Set ws = wb.Sheets("ATP610"): ExportData ws, "D3:AU197", "ATP610": Set ws = wb.Sheets("ATP610 Power"): ExportData ws, "D3:Q29", "ATP610":

End Sub

Sub ExportData(_
        ByVal SourceWorksheet As Worksheet,_
        ByVal SourceRangeAddress As String,_
        ByVal TargetNameSuffix As String)
    Const PROC_TITLE As String = "Export Data"

    ' Reference the Source range.
    Dim srg As Range: Set srg = SourceWorksheet.Range(SourceRangeAddress)

    ' Create and reference a new single-worksheet workbook, the Target workbook.
    Dim twb As Workbook: Set twb = Application.Workbooks.Add(xlWBATWorksheet)

    ' Reference the Target worksheet.
    Dim tws As Worksheet: Set tws = twb.Sheets(1) ' the one and only

    ' Copy/paste.

    srg.Copy

    With tws.Range("A1")
        .PasteSpecial Paste:=xlPasteValues
        .PasteSpecial Paste:=xlPasteFormats
        .PasteSpecial Paste:=xlPasteColumnWidths
    End With

    ' Adjust the row heights.

    Dim sCell As Range, r As Long

    For Each sCell In srg.Columns(1).Cells
        r = r + 1
        tws.Rows(1).RowHeight = sCell.RowHeight
    Next sCell

    ' Get the path of the new workbook.

    Dim tBaseName As String: tBaseName = ws.Name & TargetNameSuffix

    Dim tPath As Variant: tPath = Application.GetSaveAsFilename( _
        InitialFileName:=tBaseName, _
        FileFilter:="Excel Workbooks (*.xlsx),*.xlsx")

    If VarType(tPath) = vbBoolean Then
        MsgBox "Saving operation canceled", vbExclamation, PROC_TITLE
        twb.Close SaveChanges:=False
        Application.CutCopyMode = False
        Exit Sub
    End If

    ' Save the new workbook.

    Dim ErrNum As Long
    Dim ErrDescription As String

    Application.DisplayAlerts = False ' overwrite without confirmation
        On Error Resume Next ' e.g. workbook with same name is already open
           twb.SaveAs Filename:=tPath
           ErrNum = Err.Number
           ErrDescription = Err.Description
        On Error GoTo 0
    Application.DisplayAlerts = True

    If ErrNum <> 0 Then
        MsgBox "Run-time error '" & ErrNum & vbLf & vbLf & ErrDescription, _
            vbCritical, PROC_TITLE
        Exit Sub
    End If

    twb.Close SaveChanges:=False ' just got saved

    ' Export to PDF.

    srg.ExportAsFixedFormat Type:=xlTypePDF, Filename:=tBaseName, _
        Quality:=xlQualityStandard, IncludeDocProperties:=True, _
        IgnorePrintAreas:=False, OpenAfterPublish:=False

End Sub

</code>```

Body:
My workbook consists of following worksheets: ATP610, ATP610 Power, ATP620, ATP620 Power, ATP648, ATP648 Power, ATP648 KWTP, ATP648 SW, etc. As such, I will need to export three groups of worksheets:

ATP610 and ATP610 Power into a new workbook called ATP610. The worksheets are named as "ATP610 WP&B" and "ATP610 Electricity Profile".

ATP620 and ATP620 Power into a new workbook called ATP620. The worksheets are named as "ATP620 WP&B" and "ATP620 Electricity Profile".

ATP648, ATP648 Power, ATP648 KWTP and ATP648 SW into a new workbook called ATP648. The worksheets are named as "ATP648 WP&B", "ATP648 Electricity Profile", "ATP648 KWTP" and "ATP648 SW".

Note that each worksheet has a different range that I need to copy and paste in both values and format in their own worksheets in a new workbook. E.g. for ATP610, I need to copy D3:AU197 and ATP610 Power, D3:Q29.

Can someone help me with a set of workable VBA codes?

I am trying to export a group of worksheets from existing workbook into a new workbook that I need to circulate to external parties in both excel and pdf. As such, the copied sheets in the new workbook cannot contain any linkages and formula, while retaining the formatting of the original workbook.

Below set of codes give me an error message "Run-time error '424': Object required" and it stopped after the first sheet was copied over to the new workbook. The second worksheet "ATP610 Power" did not get copied over to the new workbook. What did I miss?

Sub ExportDataTEST()

    Dim wb As Workbook: Set wb = ThisWorkbook: Dim ws As Worksheet: Set ws = wb.Sheets("ATP610"): ExportData ws, "D3:AU197", "ATP610": Set ws = wb.Sheets("ATP610 Power"): ExportData ws, "D3:Q29", "ATP610":

End Sub

Sub ExportData(_
        ByVal SourceWorksheet As Worksheet,_
        ByVal SourceRangeAddress As String,_
        ByVal TargetNameSuffix As String)
    Const PROC_TITLE As String = "Export Data"

    ' Reference the Source range.
    Dim srg As Range: Set srg = SourceWorksheet.Range(SourceRangeAddress)

    ' Create and reference a new single-worksheet workbook, the Target workbook.
    Dim twb As Workbook: Set twb = Application.Workbooks.Add(xlWBATWorksheet)

    ' Reference the Target worksheet.
    Dim tws As Worksheet: Set tws = twb.Sheets(1) ' the one and only

    ' Copy/paste.

    srg.Copy

    With tws.Range("A1")
        .PasteSpecial Paste:=xlPasteValues
        .PasteSpecial Paste:=xlPasteFormats
        .PasteSpecial Paste:=xlPasteColumnWidths
    End With

    ' Adjust the row heights.

    Dim sCell As Range, r As Long

    For Each sCell In srg.Columns(1).Cells
        r = r + 1
        tws.Rows(1).RowHeight = sCell.RowHeight
    Next sCell

    ' Get the path of the new workbook.

    Dim tBaseName As String: tBaseName = ws.Name & TargetNameSuffix

    Dim tPath As Variant: tPath = Application.GetSaveAsFilename( _
        InitialFileName:=tBaseName, _
        FileFilter:="Excel Workbooks (*.xlsx),*.xlsx")

    If VarType(tPath) = vbBoolean Then
        MsgBox "Saving operation canceled", vbExclamation, PROC_TITLE
        twb.Close SaveChanges:=False
        Application.CutCopyMode = False
        Exit Sub
    End If

    ' Save the new workbook.

    Dim ErrNum As Long
    Dim ErrDescription As String

    Application.DisplayAlerts = False ' overwrite without confirmation
        On Error Resume Next ' e.g. workbook with same name is already open
           twb.SaveAs Filename:=tPath
           ErrNum = Err.Number
           ErrDescription = Err.Description
        On Error GoTo 0
    Application.DisplayAlerts = True

    If ErrNum <> 0 Then
        MsgBox "Run-time error '" & ErrNum & vbLf & vbLf & ErrDescription, _
            vbCritical, PROC_TITLE
        Exit Sub
    End If

    twb.Close SaveChanges:=False ' just got saved

    ' Export to PDF.

    srg.ExportAsFixedFormat Type:=xlTypePDF, Filename:=tBaseName, _
        Quality:=xlQualityStandard, IncludeDocProperties:=True, _
        IgnorePrintAreas:=False, OpenAfterPublish:=False

End Sub


问:
How to pass subtable of a word document using java in katalon?
How to pass subtable from Word document using java in katalon?

I tried in this way,in this table we have another table like HEADER ROW: Hypoglycemic Event Attributes so that i can't able to pass that table values.Please help anyone.


问:
what is package name "system" refer to in android
Does anybody know what the package name for "system" is?

core/java/android/app/ContextImpl.java

```<code>if (packageName.equals("system") || packageName.equals("android")) {
</code>```

I know android refer to framework-res.apk , but what is system refer to?
Thanks

Body:
Does anybody know what the package name for "system" is?

core/java/android/app/ContextImpl.java

if (packageName.equals("system") || packageName.equals("android")) {

I know android refer to framework-res.apk , but what is system refer to?
Thanks


问:
Laravel Check All Multiple Requests Boolean Variable's value to True
I made an if condition for checking request boolean in laravel controller method update, it worked but the line seems too long and i want make the code in short line. And this is my code that i wrote:

```<code>if( $request->jamlak == 1
            && $request->kontrak == 1
            && $request->jamuk == 1
            && $request->sprin_pc == 1
            && $request->pc == 1
            && $request->izin_bekal == 1
            && $request->sprin_komisi == 1
            && $request->bek == 1
            && $request->komisi == 1
            && $request->bagudang== 1
            && $request->pem_gudang == 1
            && $request->bast == 1
            && $request->lpp == 1
            && $request->pemerataan == 1){
            $validatedData['is_complete'] = 1;

        }
else {
            $validatedData['is_complete'] = 0;
        }
</code>```
```<code>Task::where('id', $task->id)
        ->update($validatedData);

        return redirect('/admin/tasks')->with('success', 'New post has been updated!');
</code>```

So about this code i want to make $validatedData['is_complete'] turns to be 1(true) after it checks all of requests 1 True, Is there any chance to make it way more efficient line?

Body:
I made an if condition for checking request boolean in laravel controller method update, it worked but the line seems too long and i want make the code in short line. And this is my code that i wrote:

if( $request->jamlak == 1
            && $request->kontrak == 1
            && $request->jamuk == 1
            && $request->sprin_pc == 1
            && $request->pc == 1
            && $request->izin_bekal == 1
            && $request->sprin_komisi == 1
            && $request->bek == 1
            && $request->komisi == 1
            && $request->bagudang== 1
            && $request->pem_gudang == 1
            && $request->bast == 1
            && $request->lpp == 1
            && $request->pemerataan == 1){
            $validatedData['is_complete'] = 1;

        }
else {
            $validatedData['is_complete'] = 0;
        }

Task::where('id', $task->id)
        ->update($validatedData);

        return redirect('/admin/tasks')->with('success', 'New post has been updated!');

So about this code i want to make $validatedData['is_complete'] turns to be 1(true) after it checks all of requests 1 True, Is there any chance to make it way more efficient line?


问:
delete Auto-Renewable subscription when user delete account
I'm coding a mobile app (React Native) and using library react-native-iap to handle In-App Purchase logic for IOS device.

My question is: How to stop renew and delete current subscription when user delete their account?

I'm using Sandbox Tester on AppStoreConnect for In-App Purchase testing.


问:
Space between axis categories and bars in coord_flip() in ggplot
Currently I have the following graph, which is a geom_bar after adjusting by coord_flip()

But there is too much space between the y axis categories and the bars (the area that I've marked in yellow).

How can I modify it?


问:
PHPWord TemplateProcessor PageBreak
I have a word template that is a single page, its something like this:

```<code>${blockToClone}
two tables
${pageBreak}
${/blockToClone}
</code>```

I generate X numer of copies as needed with:

```<code>$template = new TemplateProcessor('path to template');
$template->cloneBlock('blockToclone', number of copies, true, true);
</code>```

And for each block cloned, I replace the pageBreak like this:

```<code>//For example I generate 5 pages, so index goes from 1 to 5
$template->setValue('pageBreak'.$index, '<w:r><w:br w:type="page"/></w:r>');
//And for the last index(last page) I set as value for pageBreak an empty string
</code>```

The problem is that, when I set values for the tables, if the second table of each block ends near the end of the page, it inserts a blank page:

Page 1, second table ends near end of the page(last line of the page or the previous one)

Blank page

Page 2

Page 3

Page 4, second table ends near end of the page(last line of the page or the previous one)

Blank page

Page 5

Is there someway to avoid the blank pages?

Title: PHPWord TemplateProcessor PageBreak

Body:
I have a word template that is a single page, its something like this:

${blockToClone}
two tables
${pageBreak}
${/blockToClone}

I generate X numer of copies as needed with:

$template = new TemplateProcessor('path to template');
$template->cloneBlock('blockToclone', number of copies, true, true);

And for each block cloned, I replace the pageBreak like this:

//For example I generate 5 pages, so index goes from 1 to 5
$template->setValue('pageBreak'.$index, '<w:r><w:br w:type="page"/></w:r>');
//And for the last index(last page) I set as value for pageBreak an empty string

The problem is that, when I set values for the tables, if the second table of each block ends near the end of the page, it inserts a blank page:

Page 1, second table ends near end of the page(last line of the page or the previous one)

Blank page

Page 2

Page 3

Page 4, second table ends near end of the page(last line of the page or the previous one)

Blank page

Page 5

Is there someway to avoid the blank pages?


问:
Bootstrap 3 for Razor Html Action List
I made a list with the following MVC5 C# code to create the menu

```<code>public ActionResult List()
        {
            List<Menu> entity = _menuService.List();
            List<MenuModel> model = new List<MenuModel>();

            foreach (var item in entity)
            {
                model.Add(new MenuModel() {
                    Id = item.Id,
                    Title = item.Title,
                    Priority = item.Priority
                });
            }

            return PartialView("_List",model);
        }
</code>```

Next, I used the following Razor in the Index document

```<code><h2>Menu List</h2>

<a class="badge , btn btn-success" href="/Dashboard/Menu/Create">
    Create Menu
</a>

<hr />

@Html.Action("List", "Menu", new { area = "Dashboard"})
</code>```

Now how can I use bootstrap classes for this Razor

Title: Bootstrap 3 for Razor Html Action List

Body:
I made a list with the following MVC5 C# code to create the menu

public ActionResult List()
        {
            List<Menu> entity = _menuService.List();
            List<MenuModel> model = new List<MenuModel>();

            foreach (var item in entity)
            {
                model.Add(new MenuModel() {
                    Id = item.Id,
                    Title = item.Title,
                    Priority = item.Priority
                });
            }

            return PartialView("_List",model);
        }

Next, I used the following Razor in the Index document

Menu List

    Create Menu

@Html.Action("List", "Menu", new { area = "Dashboard"})

Now how can I use bootstrap classes for this Razor


问:
Tooltip type bar at zero value
I use a custom tooltip, and there, with null data, the bar type shows a tooltip with a value of 0, as I understand it, it shows the formattedValue. At the same time, if I use the tooltip from ChartJs, then everything is fine and it only shows the label. What do i do?

I tried turning off the custom tooltip and turning on the standard one. It shows only the label along the x-axis.
I also tried to write a callback label, and in this case I managed to return an empty value, but the point and color are displayed without an inscription, which is also not very beautiful

Title: Tooltip type bar at zero value


问:
How to get rid of strange gaps between in sections in tableView
My table view doesn't want to be displayed without weird gaps between its sections. I pinned a screenshot that visually describes the problem.
Note that these gaps are not represented by some kind of UIView, they are just uncovered pieces of the table.

I tried both view/heightForFooterInSection, it did not give me any results.
Methods view/heightForHeaderInSection are already in use (labels describing sections name, seen on the screenshot. If heightForHeaderInSection is set to 0 or any other value less than 10, labels start to look cut.
However I did find the solution: the method tableView.sectionHeaderTopPadding
works just fine, but is only available from iOS 15, that does not arrange me.
I will be grateful for any help. I just don't want tot believe that Apple didn't provide us with any ways to solve this for iOS older than 15.


问:
Static ip for alb
I have alb with port 3838,8787 running on it.
I have created 2 tgs with http-3838,http-8787 to instance.later i have created the nlb tg with port 80 forwarding to alb.
The alb tgs are healthy where ad the nlb tg are unhealthy.

Static ip for the alb to map it to domain register

Title: Static ip for alb


问:
Firebase Security Rules are working when on Localhost but not when Deployed on VERCEL
POST https://firestore.googleapis.com/google.firestore.v1.Firestore/Write/channel?VER=8&database=projects%2Fringtonedownloader-e8aae%2Fdatabases%2F(default)&gsessionid=d2XnM0a5gjA_QztOsE36S1h6MRDktfnP7TXH6UFbjqg&SID=kYIS51-cP7n_6NRbxiHVdA&RID=14377&TYPE=terminate&zx=svfev1gm8mej net::ERR_BLOCKED_BY_CLIENT

This is Error I am Getting after Deploying. It works like a charm on localhost during dev.

Changed all the Security Rules to true and it works

But when Checking if there is a user it does not work!
This is my security Rules

```<code>service cloud.firestore {
  match /databases/{database}/documents {
    match /ringtones/{ringtone=**}{
        allow read: if true;
      allow create: if isSignedIn();
      allow delete: if isSignedIn();
      allow update: if isSignedIn();
    }
  }
}

function isSignedIn() {
  return request.auth.uid != null;
}
</code>```

Body:
POST https://firestore.googleapis.com/google.firestore.v1.Firestore/Write/channel?VER=8&database=projects%2Fringtonedownloader-e8aae%2Fdatabases%2F(default)&gsessionid=d2XnM0a5gjA_QztOsE36S1h6MRDktfnP7TXH6UFbjqg&SID=kYIS51-cP7n_6NRbxiHVdA&RID=14377&TYPE=terminate&zx=svfev1gm8mej net::ERR_BLOCKED_BY_CLIENT

This is Error I am Getting after Deploying. It works like a charm on localhost during dev.

Changed all the Security Rules to true and it works

But when Checking if there is a user it does not work!
This is my security Rules

service cloud.firestore {
  match /databases/{database}/documents {
    match /ringtones/{ringtone=**}{
        allow read: if true;
      allow create: if isSignedIn();
      allow delete: if isSignedIn();
      allow update: if isSignedIn();
    }
  }
}

function isSignedIn() {
  return request.auth.uid != null;
}


问:
when I am trying to set packetbeat.exe setup dashboards. In the services when I check it is up and running
I am facing this error when trying to setup dashbords for packebeat "Exiting: error loading config file: open packetbeat.yml: The system cannot find the file specified.

I tried to modify the packetbeat.yml . How to solve this issue


问:
I want to give 410 response code to few defined HTTP URLs on Nginx
I want to give 410 response code to few defined HTTP URLs on Nginx, can anyone help me with the nginx sample config, which I test py getting print on nginx logs.

```<code>server  {

add_header Custom-Header Value always;
    }

if ($Custom-Header = yes) {

                return 412;
        }

</code>```

not working

Body:
I want to give 410 response code to few defined HTTP URLs on Nginx, can anyone help me with the nginx sample config, which I test py getting print on nginx logs.

server  {

add_header Custom-Header Value always;
    }

if ($Custom-Header = yes) {

                return 412;
        }

not working


问:
How to include instances of a given class in its constructor in python?
How do we include instances of a given class in its constructor?

```<code>class Node:
  # Results in "Unresolved reference 'Node'"
  def __init__(self, val: int, left: Node, right: Node):
           self.val = val
           self.left = left
           self.right = right

</code>```

Note: I have seen several questions similar to this but they are not asking exactly the same thing and/or are garbled.

Update  Not surprisingly there does exist an answer somewhere in SOF to the question. But given the question I posed it's basically impossible to find that Q&A from This question already has answers here .  The answer given in a comment below is

```<code>from __future_ import annotations
</code>```

as the first line in the script/module

Body:
How do we include instances of a given class in its constructor?

class Node:
  # Results in "Unresolved reference 'Node'"
  def __init__(self, val: int, left: Node, right: Node):
           self.val = val
           self.left = left
           self.right = right

Note: I have seen several questions similar to this but they are not asking exactly the same thing and/or are garbled.

Update  Not surprisingly there does exist an answer somewhere in SOF to the question. But given the question I posed it's basically impossible to find that Q&A from This question already has answers here .  The answer given in a comment below is

from __future_ import annotations

as the first line in the script/module


问:
MobileAds.SharedInstance.Start(completionHandler: null) throws NRE
I try to implement MTAdMob to my Xamarin.iOS project, but when I try to call
MobileAds.SharedInstance.Start(completionHandler: null)

I get following error:

```<code>13:44:00:044    [0:] An error occurred: 'Object reference not set to an instance of an object.'. Callstack: '  at Blank.AppDelegate.FinishedLaunching (UIKit.UIApplication application, Foundation.NSDictionary launchOptions) [0x00013] in C:\Users\CRoeder\source\repos\Privat\PLUTester\PLUTester\PLUTester.iOS\AppDelegate.cs:27
13:44:00:044      at (wrapper managed-to-native) UIKit.UIApplication.xamarin_UIApplicationMain(int,string[],intptr,intptr,intptr&)
13:44:00:044      at UIKit.UIApplication.UIApplicationMain (System.Int32 argc, System.String[] argv, System.IntPtr principalClassName, System.IntPtr delegateClassName) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/16.0.0.92/src/Xamarin.iOS/UIKit/UIApplication.cs:57
13:44:00:044      at UIKit.UIApplication.Main (System.String[] args, System.Type principalClass, System.Type delegateClass) [0x0003b] in /Library/Frameworks/Xamarin.iOS.framework/Versions/16.0.0.92/src/Xamarin.iOS/UIKit/UIApplication.cs:92
13:44:00:044      at PLUTester.iOS.Application.Main (System.String[] args) [0x00001] in C:\Users\CRoeder\source\repos\Privat\PLUTester\PLUTester\PLUTester.iOS\Main.cs:12
13:44:00:044      at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
13:44:00:044      at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:395 '
</code>```

When I set the breakpoint before the Start method, I see, that SharedInstance is null.
Is there anything else, I have to init first?

Body:
I try to implement MTAdMob to my Xamarin.iOS project, but when I try to call
MobileAds.SharedInstance.Start(completionHandler: null)

I get following error:

13:44:00:044    [0:] An error occurred: 'Object reference not set to an instance of an object.'. Callstack: '  at Blank.AppDelegate.FinishedLaunching (UIKit.UIApplication application, Foundation.NSDictionary launchOptions) [0x00013] in C:\Users\CRoeder\source\repos\Privat\PLUTester\PLUTester\PLUTester.iOS\AppDelegate.cs:27
13:44:00:044      at (wrapper managed-to-native) UIKit.UIApplication.xamarin_UIApplicationMain(int,string[],intptr,intptr,intptr&)
13:44:00:044      at UIKit.UIApplication.UIApplicationMain (System.Int32 argc, System.String[] argv, System.IntPtr principalClassName, System.IntPtr delegateClassName) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/16.0.0.92/src/Xamarin.iOS/UIKit/UIApplication.cs:57
13:44:00:044      at UIKit.UIApplication.Main (System.String[] args, System.Type principalClass, System.Type delegateClass) [0x0003b] in /Library/Frameworks/Xamarin.iOS.framework/Versions/16.0.0.92/src/Xamarin.iOS/UIKit/UIApplication.cs:92
13:44:00:044      at PLUTester.iOS.Application.Main (System.String[] args) [0x00001] in C:\Users\CRoeder\source\repos\Privat\PLUTester\PLUTester\PLUTester.iOS\Main.cs:12
13:44:00:044      at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
13:44:00:044      at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/corlib/System.Reflection/RuntimeMethodInfo.cs:395 '

When I set the breakpoint before the Start method, I see, that SharedInstance is null.
Is there anything else, I have to init first?


问:
Tensorflow error: ValueError: Input 0 of layer conv2d_4 is incompatible with the layer
I am new to tensorflow and recently startet course on udacity.
I have fashion mnist dataset and model

```<code>model = tf.keras.Sequential([
tf.keras.layers.Conv2D(32, (3,3), padding='same', activation=tf.nn.relu,
                       input_shape=(28, 28, 1)),
tf.keras.layers.MaxPooling2D((2, 2), strides=2),
tf.keras.layers.Conv2D(64, (3,3), padding='same', activation=tf.nn.relu),
tf.keras.layers.MaxPooling2D((2, 2), strides=2),
tf.keras.layers.Flatten(),
tf.keras.layers.Dense(128, activation=tf.nn.relu),
tf.keras.layers.Dense(10, activation=tf.nn.softmax)])
</code>```

After compiling and starting  ValueError: Input 0 of layer conv2d_4 is incompatible with the layer: expected axis -1 of input shape to have value 1 but received input with shape (None, None, 28, 28)

I really have no idea what happened, can someone please help me?
Thank you!

Body:
I am new to tensorflow and recently startet course on udacity.
I have fashion mnist dataset and model

model = tf.keras.Sequential([
tf.keras.layers.Conv2D(32, (3,3), padding='same', activation=tf.nn.relu,
                       input_shape=(28, 28, 1)),
tf.keras.layers.MaxPooling2D((2, 2), strides=2),
tf.keras.layers.Conv2D(64, (3,3), padding='same', activation=tf.nn.relu),
tf.keras.layers.MaxPooling2D((2, 2), strides=2),
tf.keras.layers.Flatten(),
tf.keras.layers.Dense(128, activation=tf.nn.relu),
tf.keras.layers.Dense(10, activation=tf.nn.softmax)])

After compiling and starting  ValueError: Input 0 of layer conv2d_4 is incompatible with the layer: expected axis -1 of input shape to have value 1 but received input with shape (None, None, 28, 28)

I really have no idea what happened, can someone please help me?
Thank you!


问:
Slash command not being listed
So 2 out of 3 commands that i made show up on discord.com...

But I can't get the 3rd one to show up.

All 3 command files have the exact same structure:

```<code>let { SlashCommandBuilder } = require('discord.js');

module.exports = {
    data: new SlashCommandBuilder()
        .setName('yt')
        .setDescription('link to ait youtube page'),
        async execute(interaction) {
            await interaction.reply('(link)');
        },
};
</code>```

```<code>let { SlashCommandBuilder } = require('discord.js');

module.exports = {
    data: new SlashCommandBuilder()
        .setName('ping')
        .setDescription('pong'),
    async execute(interaction) {
        await interaction.reply('Pong!');
    },
};
</code>```

```<code>let { SlashCommandBuilder } = require('discord.js');

module.exports = {
    data: new SlashCommandBuilder()
        .setName('rules')
        .setDescription('server rules'),
        async execute(interaction) {
            await interaction.reply('(rules)');
        },
};
</code>```

Here's my main.js:

```<code>// let {...}...
let fs = require('node:fs');
let path = require('node:path');

// let client...

client.commands = new Collection();

let cmdPath = path.join(__dirname, 'cmd');
let cmdFiles = fs.readdirSync(cmdPath).filter(file => file.endsWith('.js'));

for (let file of cmdFiles) {
    let filePath = path.join(cmdPath, file);
    let command = require(filePath);

    if ('data' in command && 'execute' in command) {
        client.commands.set(command.data.name, command);
    } else {
        console.log(`[warn] The command at ${filePath} is missing a required "data" or "execute" property.`);
    }
}

// client.login(token)...

//client.on('ready', () => ...)...

client.on(Events.InteractionCreate, async interaction => {
    if (!interaction.isChatInputCommand()) return;

    let command = interaction.client.commands.get(interaction.commandName);

    if (!command) {
        console.error(`[warn] No command matching '${interaction.commandName}' was found.`);
        return;
    }

    try {
        await command.execute(interaction);
    } catch (error) {
        console.error(`[warn] Error occured running command '${interaction.commandName}'`);
        await interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true });
    }
</code>```

This is probably an uncommon problem, but if you know how to fix it, let me know.

Title: Slash command not being listed

Body:
So 2 out of 3 commands that i made show up on discord.com...

But I can't get the 3rd one to show up.

All 3 command files have the exact same structure:

let { SlashCommandBuilder } = require('discord.js');

module.exports = {
    data: new SlashCommandBuilder()
        .setName('yt')
        .setDescription('link to ait youtube page'),
        async execute(interaction) {
            await interaction.reply('(link)');
        },
};

let { SlashCommandBuilder } = require('discord.js');

module.exports = {
    data: new SlashCommandBuilder()
        .setName('ping')
        .setDescription('pong'),
    async execute(interaction) {
        await interaction.reply('Pong!');
    },
};

let { SlashCommandBuilder } = require('discord.js');

module.exports = {
    data: new SlashCommandBuilder()
        .setName('rules')
        .setDescription('server rules'),
        async execute(interaction) {
            await interaction.reply('(rules)');
        },
};

Here's my main.js:

// let {...}...
let fs = require('node:fs');
let path = require('node:path');

// let client...

client.commands = new Collection();

let cmdPath = path.join(__dirname, 'cmd');
let cmdFiles = fs.readdirSync(cmdPath).filter(file => file.endsWith('.js'));

for (let file of cmdFiles) {
    let filePath = path.join(cmdPath, file);
    let command = require(filePath);

    if ('data' in command && 'execute' in command) {
        client.commands.set(command.data.name, command);
    } else {
        console.log(`[warn] The command at ${filePath} is missing a required "data" or "execute" property.`);
    }
}

// client.login(token)...

//client.on('ready', () => ...)...

client.on(Events.InteractionCreate, async interaction => {
    if (!interaction.isChatInputCommand()) return;

    let command = interaction.client.commands.get(interaction.commandName);

    if (!command) {
        console.error(`[warn] No command matching '${interaction.commandName}' was found.`);
        return;
    }

    try {
        await command.execute(interaction);
    } catch (error) {
        console.error(`[warn] Error occured running command '${interaction.commandName}'`);
        await interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true });
    }

This is probably an uncommon problem, but if you know how to fix it, let me know.


问:
Swagger / Fetch errorService Unavailable /swagger/v1/swagger.json ERROR
I want to open swagger in .net core project without using localhost. There is a website url link.

I got an error Fetch error Service Unavailable /swagger/v1/swagger.json.
(By the way, If I run this project in localhost, It works.)

How can I solve this problem ?


问:
How to init socket io connection with nextjs
I'm really new in websockets and I have some problems and misunderstanding with socket.io-client. Also sorry for my english :)
First things first I dont understand how to connect from client to socket.

I did this, and it worked

```<code>useEffect(() => {
 fetch('/api/socket')
 const socket = io()
}, [])
</code>```

But in socket io docs and some articles I saw this implementation

```<code>useEffect(() => {
 const socket = io('/api/socket')
}, [])
</code>```

This approach didn't work, and my browser sent this:

Firefox can’t establish a connection to the server at ws://localhost:3000/socket.io/?EIO=4&transport=websocket&sid=N-H8vGv1-uiKmvAjAAAe.

Also I saw some init code like: io.connect() / SocketClientIO.connect (or smth like that) but they just didnt work as well. (I think it's for old versions socket io, am I right?)

So how to do it right?

Second question Is it a good idea in general connect to socket io in useEffect? I know, that useEffect bad place for effects etc, but all tutorials I found made it in useEffect.

Third question It's connected with the second. I use nextjs with strict mode, so useEffect make double render. This is my client component

```<code>import { useRouter } from 'next/router'
import { useEffect } from 'react'
import { io, Socket } from 'socket.io-client'
import { DefaultEventsMap } from '@socket.io/component-emitter'

let socket: Socket<DefaultEventsMap, DefaultEventsMap>

const RoomPage = () => {
  const router = useRouter()
  const { room } = router.query

  const leaveRoomHandler = () => {
    router.push('/rooms')
  }

  const socketInitializer = async () => {
    await fetch('/api/socket')
    socket = io()

    socket.on('user-joined', (msg) => {
      console.log(msg)
    })
  }

  useEffect(() => {
    if (room) {
      socketInitializer().then(() => socket.emit('join-room', room))
    }

    return () => {
      socket?.disconnect()
    }
  }, [room])

  return (
     <>
      <h2>Room {room}</h2>
      <button onClick={leaveRoomHandler}>Leave room</button>
    </>
   )
}

export default RoomPage
</code>```

So with this code I get some errors. When I enter the page first time I see, in server console, that 'user connected', then again 'user connected', and nothing about disconnect. Why? When I manually leave the page disconnect works well. So after that if I connect and disconnect several times to this component, I get two times more console.logs on client than last time (2, 4, 6, 8, etc).
Whats the problem with my code?)

Body:
I'm really new in websockets and I have some problems and misunderstanding with socket.io-client. Also sorry for my english :)
First things first I dont understand how to connect from client to socket.

I did this, and it worked

useEffect(() => {
 fetch('/api/socket')
 const socket = io()
}, [])

But in socket io docs and some articles I saw this implementation

useEffect(() => {
 const socket = io('/api/socket')
}, [])

This approach didn't work, and my browser sent this:

Firefox can’t establish a connection to the server at ws://localhost:3000/socket.io/?EIO=4&transport=websocket&sid=N-H8vGv1-uiKmvAjAAAe.

Also I saw some init code like: io.connect() / SocketClientIO.connect (or smth like that) but they just didnt work as well. (I think it's for old versions socket io, am I right?)

So how to do it right?

Second question Is it a good idea in general connect to socket io in useEffect? I know, that useEffect bad place for effects etc, but all tutorials I found made it in useEffect.

Third question It's connected with the second. I use nextjs with strict mode, so useEffect make double render. This is my client component

import { useRouter } from 'next/router'
import { useEffect } from 'react'
import { io, Socket } from 'socket.io-client'
import { DefaultEventsMap } from '@socket.io/component-emitter'

let socket: Socket<DefaultEventsMap, DefaultEventsMap>

const RoomPage = () => {
  const router = useRouter()
  const { room } = router.query

  const leaveRoomHandler = () => {
    router.push('/rooms')
  }

  const socketInitializer = async () => {
    await fetch('/api/socket')
    socket = io()

    socket.on('user-joined', (msg) => {
      console.log(msg)
    })
  }

  useEffect(() => {
    if (room) {
      socketInitializer().then(() => socket.emit('join-room', room))
    }

    return () => {
      socket?.disconnect()
    }
  }, [room])

  return (
     <>

Room {room}

      <button onClick={leaveRoomHandler}>Leave room</button>
    </>
   )
}

export default RoomPage

So with this code I get some errors. When I enter the page first time I see, in server console, that 'user connected', then again 'user connected', and nothing about disconnect. Why? When I manually leave the page disconnect works well. So after that if I connect and disconnect several times to this component, I get two times more console.logs on client than last time (2, 4, 6, 8, etc).
Whats the problem with my code?)


问:
Istio Circuitbreaker - maxconnections limit under connectionpool is for service or pod level
Description:

i have istio service mesh with envoy running as sidecar, a destination service with below configuration in destination rule is deployed.
mainly i was trying to check ciruitbreaker beaviour of envoy/istio.

```<code>     trafficPolicy:
   connectionPool:
     http:
       http1MaxPendingRequests: 1
     tcp:
       maxConnections: 5
</code>```

my client proxy is sending request to this and i see a same maxconnection limit getting applied to client side also.
if a scale destination replicas to 4, would be my destination service work with total 20 connections (5 connections each pod ) ? or 5 strict connections would be shared between all 4 pods ?

context:- i see after increasing the destination replicas i get less 503 with reponse flag UO.

Body:
Description:

i have istio service mesh with envoy running as sidecar, a destination service with below configuration in destination rule is deployed.
mainly i was trying to check ciruitbreaker beaviour of envoy/istio.

     trafficPolicy:
   connectionPool:
     http:
       http1MaxPendingRequests: 1
     tcp:
       maxConnections: 5

my client proxy is sending request to this and i see a same maxconnection limit getting applied to client side also.
if a scale destination replicas to 4, would be my destination service work with total 20 connections (5 connections each pod ) ? or 5 strict connections would be shared between all 4 pods ?

context:- i see after increasing the destination replicas i get less 503 with reponse flag UO.


问:
Unable to install ddtrace using poetry on M1 Max
I have a new M1 Max machine (Monterey) and when I run poetry install I get the error Installing ddtrace (1.4.5): Failed.

There's a long stack trace you can find here

the first error appears to be

ddtrace/internal/pack_template.h:561:5: error: implicit declaration of function '_PyFloat_Pack8' is invalid in C99 [-Werror,-Wimplicit-function-declaration] _PyFloat_Pack8(d, &buf[1], 0);

I am unsure how to debug this issue - can anyone help?


问:
Github Actions - use PullRequest Label Names as Values in Workflow if conditions
I'm trying to retrieve Pull Request label name and use it as app version value in further workflow steps. The difficult part is that label name is not fixed, I want to pass it as a placeholder/structure and if it matches the workflow starts

I have tried setting up like this

```<code>name: sandbox

on:
  pull_request:
    branches: [ "master" ]
    types: [ closed ]

jobs:

  job1:
    if: contains(github.event.pull_request.labels.*.name, 'v*.*.*')
    runs-on: [ self-hosted ]
    steps:
      - id: app-ver
        run: |
          APP_VERSION=${{ toJson(github.event.pull_request.labels.*.name) }}
          echo $APP_VERSION
          echo "::set-output name=app_version::$APP_VERSION" >> $GITHUB_ENV
    outputs:
      app_version: ${{ steps.app-ver.outputs.app_version }}

  job2:
    needs: job1
    if: ${{ needs.job1.outputs.app_version}} != ''
    # continue if version label is set/exists
</code>```

But the workflow skips checks and workflow fails when I add label named v1.0.0 and merge,close pull request.

I want to achieve something like this

```<code>1. (job1 - checks if 'app version' label with structure 'v*.*.*' exists in closed pull request)
2. (job2 - extracts version and uses it in building app)
3. (job3 - checks if 'testing approval' label has been added to closed pull request)
4. (job4 - when approval label been added deploy the app)
</code>```

Body:
I'm trying to retrieve Pull Request label name and use it as app version value in further workflow steps. The difficult part is that label name is not fixed, I want to pass it as a placeholder/structure and if it matches the workflow starts

I have tried setting up like this

name: sandbox

on:
  pull_request:
    branches: [ "master" ]
    types: [ closed ]

jobs:

  job1:
    if: contains(github.event.pull_request.labels.*.name, 'v*.*.*')
    runs-on: [ self-hosted ]
    steps:
      - id: app-ver
        run: |
          APP_VERSION=${{ toJson(github.event.pull_request.labels.*.name) }}
          echo $APP_VERSION
          echo "::set-output name=app_version::$APP_VERSION" >> $GITHUB_ENV
    outputs:
      app_version: ${{ steps.app-ver.outputs.app_version }}

  job2:
    needs: job1
    if: ${{ needs.job1.outputs.app_version}} != ''
    # continue if version label is set/exists

But the workflow skips checks and workflow fails when I add label named v1.0.0 and merge,close pull request.

I want to achieve something like this

1. (job1 - checks if 'app version' label with structure 'v*.*.*' exists in closed pull request)
2. (job2 - extracts version and uses it in building app)
3. (job3 - checks if 'testing approval' label has been added to closed pull request)
4. (job4 - when approval label been added deploy the app)


问:
How to duplicate data into new group?
I am trying to duplicate my teamsNetworks into another Group but I keep getting Error 404.
I used prop to pass the selected teamNetworks into my model. I have a dropdown where I can choose what group the teamNetworks will be duplicated into. When I click submit the response is empty.

What am I missing? or is there a better way to duplicate rows into another group?

new Vue({
      el: '#demo',
      props: {
        groupId: {
          type: Number
        },
        netId: {
          type: Number
        },
        groups: {
          type: Array
        },
        selected: {
          type: Array
        },
      },
      data() {
        return {
          selectedProp: {
            source: '',
            accountId: '',
            tmId: '',
            name: '',
            description: '',
            size: '',
            sourceId: '',
            isExclusion: true,
            isActive: true
          }
        }
      },
      computed: {
        selectedProps: {
          get() {
            return this.selected;
          },
          set(value) {
            this.$emit('update:selected', value);
          },
        },
        methods: {
          fixedNetworkTeams() {
            return this.selectedProps.networkNumber.data.objectData ? .map(u => {
              return { ...u,
                source: this.sources[u.source]
              };
            });
          },
          async submit() {

            this.pendingRequestsInProgress = true;
            axios.post(projConfig.apiRoot + `/s/groups/${this.groupId}/network-teams/`, this.selectedProp, {
                headers: {
                  'Authorization': this.$store.state.user.auth.token
                }
              })
              .then(response => {
                this.handleSuccess('Network Teams has been added.');
                this.selectedProps = response.data;
                this.$emit('on-success');
              })
              .catch(error => {
                console.error(error);
                this.handleError(`There was an error ${error}`);
              });
          },
        },

      })```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="demo">
  <label for="tmId">
              <span>Duplicate to Group</span>

              <b-form-select
                id="selectedProps.tmId"
                v-model="selectedProps.tmId"
                name="tmId"
              >
                <option value="">Select</option>
                <option
                  v-for="(team, index) in teams"
                  :key="index"
                  value="team.id"
                > {{ team.name }} </option>

              </b-form-select>
            </label>
  <table>
    <tbody>
      <tr v-for="(selectedProp, index) in selectedProps" :key="index">
        <td>{{ selectedProp.source }}</td>
        <td>{{ selectedProp.accountId }}</td>
        <td>{{ selectedProp.name }}</td>
        <td>{{ selectedProp.sourceId }}</td>
      </tr>
    </tbody>
  </table>
  <div>
    <b-button :disabled="pendingRequestsInProgress" variant="-creation" @click="submit()">
  </div>
</div></code>```

this is what my table looks like:
[[2]
Thanks in Advance for any help!

Title: How to duplicate data into new group?

Body:
I am trying to duplicate my teamsNetworks into another Group but I keep getting Error 404.
I used prop to pass the selected teamNetworks into my model. I have a dropdown where I can choose what group the teamNetworks will be duplicated into. When I click submit the response is empty.

What am I missing? or is there a better way to duplicate rows into another group?

new Vue({
      el: '#demo',
      props: {
        groupId: {
          type: Number
        },
        netId: {
          type: Number
        },
        groups: {
          type: Array
        },
        selected: {
          type: Array
        },
      },
      data() {
        return {
          selectedProp: {
            source: '',
            accountId: '',
            tmId: '',
            name: '',
            description: '',
            size: '',
            sourceId: '',
            isExclusion: true,
            isActive: true
          }
        }
      },
      computed: {
        selectedProps: {
          get() {
            return this.selected;
          },
          set(value) {
            this.$emit('update:selected', value);
          },
        },
        methods: {
          fixedNetworkTeams() {
            return this.selectedProps.networkNumber.data.objectData ? .map(u => {
              return { ...u,
                source: this.sources[u.source]
              };
            });
          },
          async submit() {

            this.pendingRequestsInProgress = true;
            axios.post(projConfig.apiRoot + `/s/groups/${this.groupId}/network-teams/`, this.selectedProp, {
                headers: {
                  'Authorization': this.$store.state.user.auth.token
                }
              })
              .then(response => {
                this.handleSuccess('Network Teams has been added.');
                this.selectedProps = response.data;
                this.$emit('on-success');
              })
              .catch(error => {
                console.error(error);
                this.handleError(`There was an error ${error}`);
              });
          },
        },

      })

              Duplicate to Group

                <option value="">Select</option>
                <option
                  v-for="(team, index) in teams"
                  :key="index"
                  value="team.id"
                > {{ team.name }} </option>

        {{ selectedProp.source }}
        {{ selectedProp.accountId }}
        {{ selectedProp.name }}
        {{ selectedProp.sourceId }}

this is what my table looks like:
[[2]
Thanks in Advance for any help!


问:
Using chrome.declarativeNetRequest to update the First Document (HTML) Fetch request call
We have an array of tab ids stored in chrome storage, using those I wanted to modify the user-agent of the First Document Fetch call on a webPage of those tabs.

i am using chrome.declarativeNetRequest API to dynamically update the rules with new Tab Ids whenever there is an update on any tab (chrome.tabs.onUpdated). But the first call always seems to bypass the eventListener because tabs.onUpdated are triggered after the first fetch call has been made. All the other requests after that are updated as intented. How can I modify the First request.

We previously in MV2 architecture used to do the same using chrome.webRequest.onBeforeSendHeaders event directly, but in Mv3 blocking request is not allowed.

background.js :

```<code>chrome.tabs.onUpdated.addListener(function (request, sender, callback) {
    chrome.storage.local.get(["tabs"], (tabs) => {
        const ruleId = 1;
        const rules = {
            removeRuleIds: [ruleId],
            addRules: [{
                id: ruleId,
                priority: 1,
                condition: {
                    tabIds: tabs,
                    resourceTypes: ["main_frame", "sub_frame", "xmlhttprequest"],
                },
                action: {
                    type: "modifyHeaders",
                    requestHeaders: [{
                        header: "user-agent",
                        operation: "set",
                        value: MY_USER_AGENT
}],
                }
            }],
        };

        chrome.declarativeNetRequest.updateSessionRules(rules);
    });
});
</code>```

Body:
We have an array of tab ids stored in chrome storage, using those I wanted to modify the user-agent of the First Document Fetch call on a webPage of those tabs.

i am using chrome.declarativeNetRequest API to dynamically update the rules with new Tab Ids whenever there is an update on any tab (chrome.tabs.onUpdated). But the first call always seems to bypass the eventListener because tabs.onUpdated are triggered after the first fetch call has been made. All the other requests after that are updated as intented. How can I modify the First request.

We previously in MV2 architecture used to do the same using chrome.webRequest.onBeforeSendHeaders event directly, but in Mv3 blocking request is not allowed.

background.js :

chrome.tabs.onUpdated.addListener(function (request, sender, callback) {
    chrome.storage.local.get(["tabs"], (tabs) => {
        const ruleId = 1;
        const rules = {
            removeRuleIds: [ruleId],
            addRules: [{
                id: ruleId,
                priority: 1,
                condition: {
                    tabIds: tabs,
                    resourceTypes: ["main_frame", "sub_frame", "xmlhttprequest"],
                },
                action: {
                    type: "modifyHeaders",
                    requestHeaders: [{
                        header: "user-agent",
                        operation: "set",
                        value: MY_USER_AGENT
}],
                }
            }],
        };

        chrome.declarativeNetRequest.updateSessionRules(rules);
    });
});


问:
Error When changes spring framework version
I have used sbt Scala, and my sbt have spring framework
before we have used  org.springframework » spring-beans » 5.2.20.RELEASE
but I need to change use

```<code>libraryDependencies +=Seq(
  xxx others dependencies
  "org.springframework" % "spring-beans" % "6.0.0",
  "org.springframework" % "spring-core" % "6.0.0"
)
dependencyOverrides += "org.springframework" % "spring-beans" % "6.0.0"
dependencyOverrides += "org.springframework" % "spring-core" % "6.0.0"
</code>```

when I tried to use sbt run I got error like this
cannot access org.springframework.util.CollectionUtils
my question how to fix this issue ?

Body:
I have used sbt Scala, and my sbt have spring framework
before we have used  org.springframework » spring-beans » 5.2.20.RELEASE
but I need to change use

libraryDependencies +=Seq(
  xxx others dependencies
  "org.springframework" % "spring-beans" % "6.0.0",
  "org.springframework" % "spring-core" % "6.0.0"
)
dependencyOverrides += "org.springframework" % "spring-beans" % "6.0.0"
dependencyOverrides += "org.springframework" % "spring-core" % "6.0.0"

when I tried to use sbt run I got error like this
cannot access org.springframework.util.CollectionUtils
my question how to fix this issue ?


问:
Print Manager inside Download Listener
I have this Download Listener in my webview to handle download file from my web app.

```<code>webView.setDownloadListener(new DownloadListener() {
    @Override
    public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) {
        DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
        DownloadManager dm = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);

        request.setDescription(dlfilename);
        request.allowScanningByMediaScanner();
        request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
        request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, "ClodiOs" + File.separator + dlfilename);
        dm.enqueue(request);
        Toast.makeText(MainActivity.this, "Downloading File", Toast.LENGTH_SHORT).show();
    }
});
</code>```

Is it possible to add Print Manager inside Download Listener? So that users can have option to save or print file, instead of direct download.

Title: Print Manager inside Download Listener

Body:
I have this Download Listener in my webview to handle download file from my web app.

webView.setDownloadListener(new DownloadListener() {
    @Override
    public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) {
        DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
        DownloadManager dm = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);

        request.setDescription(dlfilename);
        request.allowScanningByMediaScanner();
        request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
        request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, "ClodiOs" + File.separator + dlfilename);
        dm.enqueue(request);
        Toast.makeText(MainActivity.this, "Downloading File", Toast.LENGTH_SHORT).show();
    }
});

Is it possible to add Print Manager inside Download Listener? So that users can have option to save or print file, instead of direct download.


问:
How to represent a Map<string, string> type in a Spring Boot Rest URL
Let me use an example to clarify the question more:

Let's say I have want to implement a GET method for the /query path. I have the following query parameters that I want to pass in:

param1 : int

param2 : string

param3 : list<string>

param4 : map<string, string>

I know how to represent the first 3 parameters in the URL:

/query?param1=1&param2=foo&param3=a,b,c

but for param4, I couldn't figure out how to represent it. I have read this page: https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/bind/annotation/RequestParam.html about RequestParam annotation, I understand that:

"If the method parameter is Map<String, String> or MultiValueMap<String, String> and a parameter name is not specified, then the map parameter is populated with all request parameter names and values."
This partly works for my problem, but the param4 that I get will also contain keys of param1-3 (since it's populated with all params) which I need to manually remove in my application logic, which seems ugly.

I feel the correct approach lies in this sentence
"If the method parameter type is Map and a request parameter name is specified, then the request parameter value is converted to a Map assuming an appropriate conversion strategy is available." But I can't find any reference how that "conversion strategy" mean and works.


问:
How to increase apache superset capabilities it is dying while showing more than 100K rows
I've tried all those things but apache superset table vizualisation dies while trying to vizualise more than 100k in a table.

Can you help what to do???

I don't really think it's hard query just easy select nothing complicated i need it for business to export as csv.
Please Help!

I've tried this but nothing helps:
[I've tried ])(https://i.stack.imgur.com/83Mch.png)


问:
what does this mean `const {latitude} = position.coords;`
I was learning from a course and i encountered this code :

```<code>
if (navigator.geolocation) {
  navigator.geolocation.getCurrentPosition(function(position){
    const {latitude} = position.coords;
    const {longitude} = position.coords;
    console.log(lat,longitude);
    console.log(position);

  },
  function(){
    alert('could not get position');
  });
}

</code>```

Can someone please explain me the meaning of this line of code ?
const {latitude} = position.coords; and const {longitude} = position.coords;
i would really appreciate an help.........

Please someone explain me the meaning of the line of code.

Body:
I was learning from a course and i encountered this code :

if (navigator.geolocation) {
  navigator.geolocation.getCurrentPosition(function(position){
    const {latitude} = position.coords;
    const {longitude} = position.coords;
    console.log(lat,longitude);
    console.log(position);

  },
  function(){
    alert('could not get position');
  });
}

Can someone please explain me the meaning of this line of code ?
const {latitude} = position.coords; and const {longitude} = position.coords;
i would really appreciate an help.........

Please someone explain me the meaning of the line of code.


问:
Laravel Sheduler doesnt reach Storage without Exeption and Error
I save live video to S3. Sometimes it takes some minutes. I want to check upload is ended with a scheduler job. The job stops and doesn't get any error or exception. When I call a function from the controller it works well.

Kernel.php

```<code>\Log::channel('fejeri')->info('sheduler Start');
            $schedule->call('App\Helpers\UploadedFinished@start')->everyMinute()->when(function () {

                return File::where('is_upload_ended','=', 0)->whereNotNull('storage')->count() > 0?true:false;
            });
</code>```

This time I try by a Helper function, but I tried by job and command.
The problem was same.

UploadedFinished.php

```<code> function start()
    {
            // upload limit 4 hours
            // status 0 - not uploaded
            // status 1 - uploaded
            // status 3 - error

        $files= File::where('is_upload_ended','=', 0)
        ->whereNotNull('storage')->where('created_at', '>',
        Carbon::now()->subHours(4)->toDateTimeString())->get();
        $i=0;
        foreach($files as $file){

            \Log::channel('fejeri')->info($file->filename);

            try {
                 \Log::channel('fejeri')->info('log nr.1');
                if(Storage::disk($file->storage)->exists($file->filename)){
                    \Log::channel('fejeri')->info('log nr.2');
                    $file->size = Storage::disk($file->storage)->size($file->filename);
                    $file->is_upload_ended=1;
                    $file->save();
                }else{
                    \Log::channel('fejeri')->info('File not ready!');
                }
                \Log::channel('fejeri')->info('log nr.3');
            }
            catch(\Exeption  $e) {
                 \Log::channel('fejeri')->info('Error type1:'.$e);

            }catch(\Throwable  $e) {
                  \Log::channel('fejeri')->info('Error type2:'.$e);

            }catch(\Error  $e) {
                 \Log::channel('fejeri')->info('Error type3:'.$e);
            }
        }

        $files2= File::where('is_upload_ended','=', 0)
        ->whereNotNull('storage')->where('created_at', '<',
        Carbon::now()->subHours(4)->toDateTimeString())->get();
        foreach($files2 as $filez){
            $filez->is_upload_ended=3;
            $filez->save();
        }
    }
</code>```

the log

```<code>[2022-12-15 16:07:01] local.INFO: sheduler
[2022-12-15 16:07:01] local.INFO: sport/sport798/vod/1670594132-196.mp4
[2022-12-15 16:07:01] local.INFO: log nr.1
[2022-12-15 16:08:01] local.INFO: sheduler

.....

</code>```

After the foreach is stop and run again.
When call function from a controller or call command on terminal the log is

```<code>[2022-12-15 16:30:10] local.INFO: sport/sport798/vod/1670594132-196.mp4
[2022-12-15 16:30:10] local.INFO: log nr.1
[2022-12-15 16:30:10] local.INFO: log nr.2
[2022-12-15 16:30:10] local.INFO: log nr.3
</code>```

Body:
I save live video to S3. Sometimes it takes some minutes. I want to check upload is ended with a scheduler job. The job stops and doesn't get any error or exception. When I call a function from the controller it works well.

Kernel.php

\Log::channel('fejeri')->info('sheduler Start');
            $schedule->call('App\Helpers\UploadedFinished@start')->everyMinute()->when(function () {

                return File::where('is_upload_ended','=', 0)->whereNotNull('storage')->count() > 0?true:false;
            });

This time I try by a Helper function, but I tried by job and command.
The problem was same.

UploadedFinished.php

 function start()
    {
            // upload limit 4 hours
            // status 0 - not uploaded
            // status 1 - uploaded
            // status 3 - error

        $files= File::where('is_upload_ended','=', 0)
        ->whereNotNull('storage')->where('created_at', '>',
        Carbon::now()->subHours(4)->toDateTimeString())->get();
        $i=0;
        foreach($files as $file){

            \Log::channel('fejeri')->info($file->filename);

            try {
                 \Log::channel('fejeri')->info('log nr.1');
                if(Storage::disk($file->storage)->exists($file->filename)){
                    \Log::channel('fejeri')->info('log nr.2');
                    $file->size = Storage::disk($file->storage)->size($file->filename);
                    $file->is_upload_ended=1;
                    $file->save();
                }else{
                    \Log::channel('fejeri')->info('File not ready!');
                }
                \Log::channel('fejeri')->info('log nr.3');
            }
            catch(\Exeption  $e) {
                 \Log::channel('fejeri')->info('Error type1:'.$e);

            }catch(\Throwable  $e) {
                  \Log::channel('fejeri')->info('Error type2:'.$e);

            }catch(\Error  $e) {
                 \Log::channel('fejeri')->info('Error type3:'.$e);
            }
        }

        $files2= File::where('is_upload_ended','=', 0)
        ->whereNotNull('storage')->where('created_at', '<',
        Carbon::now()->subHours(4)->toDateTimeString())->get();
        foreach($files2 as $filez){
            $filez->is_upload_ended=3;
            $filez->save();
        }
    }

the log

[2022-12-15 16:07:01] local.INFO: sheduler
[2022-12-15 16:07:01] local.INFO: sport/sport798/vod/1670594132-196.mp4
[2022-12-15 16:07:01] local.INFO: log nr.1
[2022-12-15 16:08:01] local.INFO: sheduler

.....

After the foreach is stop and run again.
When call function from a controller or call command on terminal the log is

[2022-12-15 16:30:10] local.INFO: sport/sport798/vod/1670594132-196.mp4
[2022-12-15 16:30:10] local.INFO: log nr.1
[2022-12-15 16:30:10] local.INFO: log nr.2
[2022-12-15 16:30:10] local.INFO: log nr.3


问:
YACE exporter for CloudWatch Metrics does not work
I want to export the CloudWatch Metrics for AWS Lambda functions and hence configured the YACE exporter following this link

Configured this as a cronJob as shown below. I end up with error about Missing region even though I have specified region.

Here's the cronjob:

```<code>apiVersion: v1
kind: Namespace
metadata:
  name: tools

---

apiVersion: batch/v1
kind: CronJob
metadata:
  name: cloudwatch-metrics-exporter
  labels:
    app: cloudwatch-exporter

spec:
  schedule: "* * * * *"
  jobTemplate:
    spec:
      template:
        metadata:
          labels:
            app: cloudwatch-exporter
        spec:
          volumes:
            - configMap:
                defaultMode: 420
                name: yace-lambda-config
              name: yace-lambda-config
            - secret:
                defaultMode: 420
                secretName: cloudwatch-metrics-exporter-secrets
              name: cloudwatch-credentials
          containers:
            - name: yace
              image: quay.io/invisionag/yet-another-cloudwatch-exporter:v0.16.0-alpha
              imagePullPolicy: IfNotPresent
              ports:
                - containerPort: 5000
              volumeMounts:
                - name: yace-lambda-config
                  mountPath: /tmp/config.yml
                  subPath: config.yml
              resources:
                limits:
                  memory: "128Mi"
                  cpu: "500m"
              terminationMessagePath: /dev/termination-log
              terminationMessagePolicy: File
              securityContext:
                capabilities:
                  drop:
                    - ALL
                privileged: false
                runAsUser: 1000
                runAsNonRoot: true
                readOnlyRootFilesystem: false
                allowPrivilegeEscalation: false
          terminationGracePeriodSeconds: 30
          dnsPolicy: ClusterFirst
          automountServiceAccountToken: true
          shareProcessNamespace: false
          securityContext:
            runAsNonRoot: false
            seccompProfile:
              type: RuntimeDefault
          restartPolicy: OnFailure

---
apiVersion: v1
kind: ConfigMap
metadata:
  name: yace-lambda-config
  namespace: tools
data:
  config.yml: |
    discovery:
      jobs:
      - type: lambda
        regions:
          - eu-central-1
        enableMetricData: true
        metrics:
           - name: Duration
             statistics: [ Sum, Maximum, Minimum, Average ]
             period: 300
             length: 3600
           - name: Invocations
             statistics: [ Sum ]
             period: 300
             length: 3600
           - name: Errors
             statistics: [ Sum ]
             period: 300
             length: 3600
           - name: Throttles
             statistics: [ Sum ]
             period: 300
             length: 3600
           - name: DeadLetterErrors
             statistics: [ Sum ]
             period: 300
             length: 3600
           - name: DestinationDeliveryFailures
             statistics: [ Sum ]
             period: 300
             length: 3600
           - name: ProvisionedConcurrencyInvocations
             statistics: [ Sum ]
             period: 300
             length: 3600
           - name: ProvisionedConcurrencySpilloverInvocations
             statistics: [ Sum ]
             period: 300
             length: 3600
           - name: IteratorAge
             statistics: [ Average, Maximum ]
             period: 300
             length: 3600
           - name: ConcurrentExecutions
             statistics: [ Sum ]
             period: 300
             length: 3600
           - name: ProvisionedConcurrentExecutions
             statistics: [ Sum ]
             period: 300
             length: 3600
           - name: ProvisionedConcurrencyUtilization
             statistics:
             - Maximum
             period: 300
             length: 3600
           - name: UnreservedConcurrentExecutions
             statistics: [ Sum ]
             period: 300
             length: 3600
</code>```

Error:

```<code>2022/12/16 08:54:28 ERROR: unable to resolve endpoint for service "tagging", region "", err: UnknownEndpointError: could not resolve endpoint
    partition: "aws", service: "tagging", region: "", known: [us-east-2 us-west-1 ap-northeast-1 ap-southeast-1 eu-west-1 eu-west-2 ap-southeast-2 eu-west-3 us-west-2 sa-east-1 us-east-1 ap-east-1 ap-northeast-2 ca-central-1 me-south-1 ap-south-1 eu-central-1 eu-north-1]

</code>```

What am I doing wrong?

Update: Turns out it was indentation problem with my yaml. I resolved that and now have a different issue

Here's the error:

```<code>{"level":"warning","msg":"NoCredentialProviders: no valid providers in chain. Deprecated.\n\tFor verbose messaging see aws.Config.CredentialsChainVerboseErrors","time":"2022-12-16T16:35:47Z"}
{"level":"info","msg":"Couldn't describe resources for region eu-central-1: NoCredentialProviders: no valid providers in chain. Deprecated.\n\tFor verbose messaging see aws.Config.CredentialsChainVerboseErrors\n","time":"2022-12-16T16:35:47Z"}
</code>```

I have provided AWS credentials via ENV variables by doing an export of necessary AWS credentials and then did kubectl apply config.yaml

Body:
I want to export the CloudWatch Metrics for AWS Lambda functions and hence configured the YACE exporter following this link

Configured this as a cronJob as shown below. I end up with error about Missing region even though I have specified region.

Here's the cronjob:

apiVersion: v1
kind: Namespace
metadata:
  name: tools

---

apiVersion: batch/v1
kind: CronJob
metadata:
  name: cloudwatch-metrics-exporter
  labels:
    app: cloudwatch-exporter

spec:
  schedule: "* * * * *"
  jobTemplate:
    spec:
      template:
        metadata:
          labels:
            app: cloudwatch-exporter
        spec:
          volumes:
            - configMap:
                defaultMode: 420
                name: yace-lambda-config
              name: yace-lambda-config
            - secret:
                defaultMode: 420
                secretName: cloudwatch-metrics-exporter-secrets
              name: cloudwatch-credentials
          containers:
            - name: yace
              image: quay.io/invisionag/yet-another-cloudwatch-exporter:v0.16.0-alpha
              imagePullPolicy: IfNotPresent
              ports:
                - containerPort: 5000
              volumeMounts:
                - name: yace-lambda-config
                  mountPath: /tmp/config.yml
                  subPath: config.yml
              resources:
                limits:
                  memory: "128Mi"
                  cpu: "500m"
              terminationMessagePath: /dev/termination-log
              terminationMessagePolicy: File
              securityContext:
                capabilities:
                  drop:
                    - ALL
                privileged: false
                runAsUser: 1000
                runAsNonRoot: true
                readOnlyRootFilesystem: false
                allowPrivilegeEscalation: false
          terminationGracePeriodSeconds: 30
          dnsPolicy: ClusterFirst
          automountServiceAccountToken: true
          shareProcessNamespace: false
          securityContext:
            runAsNonRoot: false
            seccompProfile:
              type: RuntimeDefault
          restartPolicy: OnFailure

---
apiVersion: v1
kind: ConfigMap
metadata:
  name: yace-lambda-config
  namespace: tools
data:
  config.yml: |
    discovery:
      jobs:
      - type: lambda
        regions:
          - eu-central-1
        enableMetricData: true
        metrics:
           - name: Duration
             statistics: [ Sum, Maximum, Minimum, Average ]
             period: 300
             length: 3600
           - name: Invocations
             statistics: [ Sum ]
             period: 300
             length: 3600
           - name: Errors
             statistics: [ Sum ]
             period: 300
             length: 3600
           - name: Throttles
             statistics: [ Sum ]
             period: 300
             length: 3600
           - name: DeadLetterErrors
             statistics: [ Sum ]
             period: 300
             length: 3600
           - name: DestinationDeliveryFailures
             statistics: [ Sum ]
             period: 300
             length: 3600
           - name: ProvisionedConcurrencyInvocations
             statistics: [ Sum ]
             period: 300
             length: 3600
           - name: ProvisionedConcurrencySpilloverInvocations
             statistics: [ Sum ]
             period: 300
             length: 3600
           - name: IteratorAge
             statistics: [ Average, Maximum ]
             period: 300
             length: 3600
           - name: ConcurrentExecutions
             statistics: [ Sum ]
             period: 300
             length: 3600
           - name: ProvisionedConcurrentExecutions
             statistics: [ Sum ]
             period: 300
             length: 3600
           - name: ProvisionedConcurrencyUtilization
             statistics:
             - Maximum
             period: 300
             length: 3600
           - name: UnreservedConcurrentExecutions
             statistics: [ Sum ]
             period: 300
             length: 3600

Error:

2022/12/16 08:54:28 ERROR: unable to resolve endpoint for service "tagging", region "", err: UnknownEndpointError: could not resolve endpoint
    partition: "aws", service: "tagging", region: "", known: [us-east-2 us-west-1 ap-northeast-1 ap-southeast-1 eu-west-1 eu-west-2 ap-southeast-2 eu-west-3 us-west-2 sa-east-1 us-east-1 ap-east-1 ap-northeast-2 ca-central-1 me-south-1 ap-south-1 eu-central-1 eu-north-1]

What am I doing wrong?

Update: Turns out it was indentation problem with my yaml. I resolved that and now have a different issue

Here's the error:

{"level":"warning","msg":"NoCredentialProviders: no valid providers in chain. Deprecated.\n\tFor verbose messaging see aws.Config.CredentialsChainVerboseErrors","time":"2022-12-16T16:35:47Z"}
{"level":"info","msg":"Couldn't describe resources for region eu-central-1: NoCredentialProviders: no valid providers in chain. Deprecated.\n\tFor verbose messaging see aws.Config.CredentialsChainVerboseErrors\n","time":"2022-12-16T16:35:47Z"}

I have provided AWS credentials via ENV variables by doing an export of necessary AWS credentials and then did kubectl apply config.yaml


问:
Problems when migrating a Wordpress-Site into Docker
Solved: I found the solution to my problem here:
https://serverfault.com/a/955471
This is the docker entry in my wp-config.php:

```<code>if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false) {
$_SERVER['HTTPS'] = 'on';}
</code>```

but it seems, in my case it was not recognized, that my docker installation is behind a reverse proxy. I needed to write the "$_SERVER['HTTPS'] = 'on';" entry without the if query.

Edit: The Problem is not the migration, but it seems a wrong apache2 configuration

I am trying to migrate my wordpress site into docker. I have successfully inserted my database with the command:

```<code>docker exec -i wordpress_db_1 mysql -u exampleuser -pexamplepass exampledb < /home/dockerNutzer/datenbanken/wpdatabase.sql
</code>```

and i have copied my old wp-content into the new Docker volume:

```<code>rsync -avc /home/dockerNutzer/wordpressSeite/wp-content/ /var/lib/docker/volumes/wordpress_wordpress/_data/wp-content/
</code>```

The site is up and running, but it doesn't look like expected:

I can browse through the site, but when I try to log in, I get a redirect error from firefox with the message, that an error occurred during the connection with my address. A connection to a page like

```<code>/my-wordpress.site/?m=202210
</code>```

is working, but not

```<code>/my-wordpress.site/wp-login.php
</code>```

I am using the standard docker-compose file for installation:

```<code>version: '3.1'

services:

  wordpress:
    image: wordpress
    restart: always
    ports:
      - 8050:80
    environment:
      WORDPRESS_DB_HOST: db
      WORDPRESS_DB_USER: exampleuser
      WORDPRESS_DB_PASSWORD: examplepass
      WORDPRESS_DB_NAME: exampledb
    volumes:
      - wordpress:/var/www/html

  db:
    image: mariadb:10.5
    restart: always
    ports:
      - 3307:3306
    environment:
      MYSQL_DATABASE: exampledb
      MYSQL_USER: exampleuser
      MYSQL_PASSWORD: examplepass
      MYSQL_RANDOM_ROOT_PASSWORD: '1'
    volumes:
      - db:/var/lib/mysql

volumes:
  wordpress:
  db:
</code>```

I tried to clear the rewrite rules in the apache config file and the .htaccess file.

I tried to insert my whole old site into the docker volume and not only the wp-content folder.

Edit:
I tried with this site
https://ithemes.com/blog/wordpress-login-redirect-loop/
to fix the redirect loop. But it doesn't worked.
I also checked the database with db check, like it is described here:
https://ithemes.com/blog/error-establishing-database-connection/

It showed no error:

docker exec -i wordpressaltepw_wpcli_1 wp db check
wpdatabase.wp_commentmeta                          OK
wpdatabase.wp_comments                             OK

...
Success: Database checked.

Body:
Solved: I found the solution to my problem here:
https://serverfault.com/a/955471
This is the docker entry in my wp-config.php:

if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false) {
$_SERVER['HTTPS'] = 'on';}

but it seems, in my case it was not recognized, that my docker installation is behind a reverse proxy. I needed to write the "$_SERVER['HTTPS'] = 'on';" entry without the if query.

Edit: The Problem is not the migration, but it seems a wrong apache2 configuration

I am trying to migrate my wordpress site into docker. I have successfully inserted my database with the command:

docker exec -i wordpress_db_1 mysql -u exampleuser -pexamplepass exampledb < /home/dockerNutzer/datenbanken/wpdatabase.sql

and i have copied my old wp-content into the new Docker volume:

rsync -avc /home/dockerNutzer/wordpressSeite/wp-content/ /var/lib/docker/volumes/wordpress_wordpress/_data/wp-content/

The site is up and running, but it doesn't look like expected:

I can browse through the site, but when I try to log in, I get a redirect error from firefox with the message, that an error occurred during the connection with my address. A connection to a page like

/my-wordpress.site/?m=202210

is working, but not

/my-wordpress.site/wp-login.php

I am using the standard docker-compose file for installation:

version: '3.1'

services:

  wordpress:
    image: wordpress
    restart: always
    ports:
      - 8050:80
    environment:
      WORDPRESS_DB_HOST: db
      WORDPRESS_DB_USER: exampleuser
      WORDPRESS_DB_PASSWORD: examplepass
      WORDPRESS_DB_NAME: exampledb
    volumes:
      - wordpress:/var/www/html

  db:
    image: mariadb:10.5
    restart: always
    ports:
      - 3307:3306
    environment:
      MYSQL_DATABASE: exampledb
      MYSQL_USER: exampleuser
      MYSQL_PASSWORD: examplepass
      MYSQL_RANDOM_ROOT_PASSWORD: '1'
    volumes:
      - db:/var/lib/mysql

volumes:
  wordpress:
  db:

I tried to clear the rewrite rules in the apache config file and the .htaccess file.

I tried to insert my whole old site into the docker volume and not only the wp-content folder.

Edit:
I tried with this site
https://ithemes.com/blog/wordpress-login-redirect-loop/
to fix the redirect loop. But it doesn't worked.
I also checked the database with db check, like it is described here:
https://ithemes.com/blog/error-establishing-database-connection/

It showed no error:

docker exec -i wordpressaltepw_wpcli_1 wp db check
wpdatabase.wp_commentmeta                          OK
wpdatabase.wp_comments                             OK

...
Success: Database checked.


问:
react native android deactivating the back of the alert
I want to deactivate everything on the screen behind the popup, how do I do that?</p>
```<code>  <DeleteButton
  disabled={buttonDisabled}
  type="DELETE"
  onPress={() => {
    AlertDialog.showAlert({
      content: <Delete onDelete={() => { props.onDelete() }} description={'text'} />,
      hideConfirmButton: true,
    });
  }}
/>
</code>```

Body:
I want to deactivate everything on the screen behind the popup, how do I do that?

  <DeleteButton
  disabled={buttonDisabled}
  type="DELETE"
  onPress={() => {
    AlertDialog.showAlert({
      content: <Delete onDelete={() => { props.onDelete() }} description={'text'} />,
      hideConfirmButton: true,
    });
  }}
/>