问:
i have scheduled C# exe in task scheduler,when trigerring manually it send mail and pdf but from task scheduler it fails to create and attached pdf
i have scheduled C# exe in task scheduler,when trigerring manually it send mail and pdf attached but from task scheduler it fails to create and  attached pdf it is only sending mail

below is my code snippets for pdf

```<code> public static void ExportToPdF_Verify_report(DataTable myDataTable, DataTable dt2, string filename)
        {
            DataTable dt = myDataTable;
            Document pdfDoc = new Document(PageSize.A4.Rotate(), 10, 10, 35, 10);
            Font font13 = FontFactory.GetFont("ARIAL", 13);
            Font font18 = FontFactory.GetFont("ARIAL", 10, Font.BOLD);
            Font fonttext = FontFactory.GetFont("ARIAL", 10, Font.NORMAL);
            try
            {
                PdfWriter writer = PdfWriter.GetInstance(pdfDoc, new FileStream(filename, FileMode.Create));
                pdfDoc.Open();

                if (dt.Rows.Count > 0)
                {
                    PdfPTable PdfTable = new PdfPTable(1);
                    PdfTable.TotalWidth = 200f;
                    PdfTable.LockedWidth = true;

                    PdfPCell PdfPCell = new PdfPCell(new Phrase(new Chunk("", font18)));
                    //PdfPCell PdfPCell = new PdfPCell(new Phrase(new Chunk("Manual Discrepancy Report", font18)));
                    PdfPCell.Border = Rectangle.NO_BORDER;
                    PdfTable.AddCell(PdfPCell);
                    //DrawLine(writer, 25f, pdfDoc.Top - 30f, pdfDoc.PageSize.Width - 25f, pdfDoc.Top - 30f, new BaseColor(222,0,0));
                    //DrawLine(writer, 25f, pdfDoc.Top - 30f, pdfDoc.PageSize.Width - 25f, pdfDoc.Top - 30f, new BaseColor(0,0,0));
                    pdfDoc.Add(PdfTable);

                    PdfTable = new PdfPTable(4); /* new PdfPTable(dt.Columns.Count); */
                    PdfTable.SpacingBefore = 20f;
                    PdfTable.DefaultCell.BackgroundColor = BaseColor.LIGHT_GRAY;
                    PdfPCell cell_heading = new PdfPCell(new Phrase(new Chunk("Coupon Verification Report", font18)));
                    cell_heading.BackgroundColor = BaseColor.LIGHT_GRAY;
                    cell_heading.MinimumHeight = 16;
                    cell_heading.Colspan = 4;
                    cell_heading.HorizontalAlignment = 1; //0=Left, 1=Centre, 2=Right
                    PdfTable.AddCell(cell_heading);
                    PdfTable.DefaultCell.BackgroundColor = BaseColor.WHITE;
                    //for (int columns = 0; columns <= dt.Columns.Count - 1; columns++)
                    //{
                    //    PdfPCell = new PdfPCell(new Phrase(new Chunk(dt.Columns[columns].ColumnName, font18)));
                    //    PdfTable.AddCell(PdfPCell);
                    //}
                    PdfTable.HorizontalAlignment = 1;
                    int valid_amnt = 0; int excep_amnt = 0;
                    for (int rows = 0; rows <= dt2.Rows.Count - 1; rows++)
                    {
                        valid_amnt = valid_amnt + int.Parse(dt2.Rows[rows][6].ToString());
                        excep_amnt = excep_amnt + int.Parse(dt2.Rows[rows][8].ToString());
                    }

                    PdfTable.AddCell(new PdfPCell(new Phrase(new Chunk("Batch Id", font18))));
                    PdfTable.AddCell(new PdfPCell(new Phrase(new Chunk(dt.Rows[0][0].ToString(), fonttext))));
                    PdfTable.AddCell(new PdfPCell(new Phrase(new Chunk("Sap Code", font18))));
                    PdfTable.AddCell(new PdfPCell(new Phrase(new Chunk(dt.Rows[0][3].ToString(), fonttext))));
                    //pdfDoc.Add(PdfTable);
                    PdfTable.AddCell(new PdfPCell(new Phrase(new Chunk("Distributor Name", font18))));
                    PdfTable.AddCell(new PdfPCell(new Phrase(new Chunk(dt.Rows[0][2].ToString(), fonttext))));
                    PdfTable.AddCell(new PdfPCell(new Phrase(new Chunk("State", font18))));
                    PdfTable.AddCell(new PdfPCell(new Phrase(new Chunk(dt.Rows[0][5].ToString(), fonttext))));
                    //pdfDoc.Add(PdfTable);
                    PdfTable.AddCell(new PdfPCell(new Phrase(new Chunk("Batch Date", font18))));
                    PdfTable.AddCell(new PdfPCell(new Phrase(new Chunk(dt.Rows[0][1].ToString(), fonttext))));
                    PdfTable.AddCell(new PdfPCell(new Phrase(new Chunk("Valid Amount", font18))));
                    PdfTable.AddCell(new PdfPCell(new Phrase(new Chunk(valid_amnt.ToString(), fonttext))));
                    //pdfDoc.Add(PdfTable);
                    PdfTable.AddCell(new PdfPCell(new Phrase(new Chunk("Scan Date", font18))));
                    PdfTable.AddCell(new PdfPCell(new Phrase(new Chunk(dt.Rows[0][4].ToString(), fonttext))));
                    PdfTable.AddCell(new PdfPCell(new Phrase(new Chunk("Exception Amount", font18))));
                    PdfTable.AddCell(new PdfPCell(new Phrase(new Chunk(excep_amnt.ToString(), fonttext))));
                    pdfDoc.Add(PdfTable);

                    PdfTable = new PdfPTable(9);
                    PdfTable.SpacingBefore = 20f;
                    PdfTable.DefaultCell.BackgroundColor = BaseColor.LIGHT_GRAY;
                    PdfPCell cell_heading2 = new PdfPCell(new Phrase(new Chunk("Detailed Summary", font18)));
                    cell_heading2.BackgroundColor = BaseColor.LIGHT_GRAY;
                    cell_heading2.MinimumHeight = 15;
                    cell_heading2.Colspan = 9;
                    cell_heading2.HorizontalAlignment = 1; //0=Left, 1=Centre, 2=Right
                    PdfTable.AddCell(cell_heading2);
                    //for (int columns = 0; columns <= dt2.Columns.Count - 1; columns++)
                    string[] arr_det = new string[] { "Coupon Type", "Claimed Coupon Count", "Claimed Coupon Amount", "Coupon Receipt Count", "Valid Coupon Count", "Valid Coupon Amount", "Exceptions Coupon Count", "Exceptions Coupon Amount", "Short/Excess Coupon Count" };

                    for (int columns = 0; columns < arr_det.Length; columns++)
                    {
                        PdfPCell = new PdfPCell(new Phrase(new Chunk(arr_det[columns], font18)));
                        PdfTable.AddCell(PdfPCell);
                    }

                    for (int rows = 0; rows <= dt2.Rows.Count - 1; rows++)
                    {
                        //for (int column = 0; column <9; column++)
                        //{
                        PdfPCell = new PdfPCell(new Phrase(new Chunk(dt2.Rows[rows][0].ToString(), fonttext)));
                        PdfTable.AddCell(PdfPCell);
                        PdfPCell = new PdfPCell(new Phrase(new Chunk(dt2.Rows[rows][2].ToString(), fonttext)));
                        PdfTable.AddCell(PdfPCell);
                        PdfPCell = new PdfPCell(new Phrase(new Chunk(dt2.Rows[rows][3].ToString(), fonttext)));
                        PdfTable.AddCell(PdfPCell);
                        PdfPCell = new PdfPCell(new Phrase(new Chunk(dt2.Rows[rows][4].ToString(), fonttext)));
                        PdfTable.AddCell(PdfPCell);
                        PdfPCell = new PdfPCell(new Phrase(new Chunk(dt2.Rows[rows][5].ToString(), fonttext)));
                        PdfTable.AddCell(PdfPCell);
                        PdfPCell = new PdfPCell(new Phrase(new Chunk(dt2.Rows[rows][6].ToString(), fonttext)));
                        PdfTable.AddCell(PdfPCell);
                        // int sums_exception = int.Parse(dt2.Rows[rows][8].ToString())+ int.Parse(dt2.Rows[rows][9].ToString())+ int.Parse(dt2.Rows[rows][10].ToString())+ int.Parse(dt2.Rows[rows][11].ToString()) + int.Parse(dt2.Rows[rows][12].ToString()) + int.Parse(dt2.Rows[rows][13].ToString());
                        PdfPCell = new PdfPCell(new Phrase(new Chunk(dt2.Rows[rows][7].ToString(), fonttext)));
                        PdfTable.AddCell(PdfPCell);
                        PdfPCell = new PdfPCell(new Phrase(new Chunk(dt2.Rows[rows][8].ToString(), fonttext)));
                        PdfTable.AddCell(PdfPCell);
                        PdfPCell = new PdfPCell(new Phrase(new Chunk(dt2.Rows[rows][9].ToString(), fonttext)));
                        PdfTable.AddCell(PdfPCell);
                        //}
                    }
                    PdfPCell = new PdfPCell(new Phrase(new Chunk("Total", font18)));
                    PdfTable.AddCell(PdfPCell);
                    string sum_colmns = sum_datatable_column(dt2, 2).ToString();
                    PdfPCell = new PdfPCell(new Phrase(new Chunk(sum_colmns, font18)));
                    PdfTable.AddCell(PdfPCell);

                    sum_colmns = sum_datatable_column(dt2, 3).ToString();
                    PdfPCell = new PdfPCell(new Phrase(new Chunk(sum_colmns, font18)));
                    PdfTable.AddCell(PdfPCell);
                    sum_colmns = sum_datatable_column(dt2, 4).ToString();
                    PdfPCell = new PdfPCell(new Phrase(new Chunk(sum_colmns, font18)));
                    PdfTable.AddCell(PdfPCell);
                    sum_colmns = sum_datatable_column(dt2, 5).ToString();
                    PdfPCell = new PdfPCell(new Phrase(new Chunk(sum_colmns, font18)));
                    PdfTable.AddCell(PdfPCell);
                    sum_colmns = sum_datatable_column(dt2, 6).ToString();
                    PdfPCell = new PdfPCell(new Phrase(new Chunk(sum_colmns, font18)));
                    PdfTable.AddCell(PdfPCell);

                    sum_colmns = sum_datatable_column(dt2, 7).ToString();
                    PdfPCell = new PdfPCell(new Phrase(new Chunk(sum_colmns, font18)));
                    PdfTable.AddCell(PdfPCell);
                    sum_colmns = sum_datatable_column(dt2, 8).ToString();
                    PdfPCell = new PdfPCell(new Phrase(new Chunk(sum_colmns, font18)));
                    PdfTable.AddCell(PdfPCell);
                    sum_colmns = sum_datatable_column(dt2, 9).ToString();
                    PdfPCell = new PdfPCell(new Phrase(new Chunk(sum_colmns, font18)));
                    PdfTable.AddCell(PdfPCell);
                    pdfDoc.Add(PdfTable);

                }
                pdfDoc.Close();
</code>```

i  tried to run change

run user when user not logged on

in action changes added path for arguments and optional

checked about itextsharper

changed configure for window server 2012 R2

please anyone help me on this , any more info required let me know

Body:
i have scheduled C# exe in task scheduler,when trigerring manually it send mail and pdf attached but from task scheduler it fails to create and  attached pdf it is only sending mail

below is my code snippets for pdf

 public static void ExportToPdF_Verify_report(DataTable myDataTable, DataTable dt2, string filename)
        {
            DataTable dt = myDataTable;
            Document pdfDoc = new Document(PageSize.A4.Rotate(), 10, 10, 35, 10);
            Font font13 = FontFactory.GetFont("ARIAL", 13);
            Font font18 = FontFactory.GetFont("ARIAL", 10, Font.BOLD);
            Font fonttext = FontFactory.GetFont("ARIAL", 10, Font.NORMAL);
            try
            {
                PdfWriter writer = PdfWriter.GetInstance(pdfDoc, new FileStream(filename, FileMode.Create));
                pdfDoc.Open();

                if (dt.Rows.Count > 0)
                {
                    PdfPTable PdfTable = new PdfPTable(1);
                    PdfTable.TotalWidth = 200f;
                    PdfTable.LockedWidth = true;

                    PdfPCell PdfPCell = new PdfPCell(new Phrase(new Chunk("", font18)));
                    //PdfPCell PdfPCell = new PdfPCell(new Phrase(new Chunk("Manual Discrepancy Report", font18)));
                    PdfPCell.Border = Rectangle.NO_BORDER;
                    PdfTable.AddCell(PdfPCell);
                    //DrawLine(writer, 25f, pdfDoc.Top - 30f, pdfDoc.PageSize.Width - 25f, pdfDoc.Top - 30f, new BaseColor(222,0,0));
                    //DrawLine(writer, 25f, pdfDoc.Top - 30f, pdfDoc.PageSize.Width - 25f, pdfDoc.Top - 30f, new BaseColor(0,0,0));
                    pdfDoc.Add(PdfTable);

                    PdfTable = new PdfPTable(4); /* new PdfPTable(dt.Columns.Count); */
                    PdfTable.SpacingBefore = 20f;
                    PdfTable.DefaultCell.BackgroundColor = BaseColor.LIGHT_GRAY;
                    PdfPCell cell_heading = new PdfPCell(new Phrase(new Chunk("Coupon Verification Report", font18)));
                    cell_heading.BackgroundColor = BaseColor.LIGHT_GRAY;
                    cell_heading.MinimumHeight = 16;
                    cell_heading.Colspan = 4;
                    cell_heading.HorizontalAlignment = 1; //0=Left, 1=Centre, 2=Right
                    PdfTable.AddCell(cell_heading);
                    PdfTable.DefaultCell.BackgroundColor = BaseColor.WHITE;
                    //for (int columns = 0; columns <= dt.Columns.Count - 1; columns++)
                    //{
                    //    PdfPCell = new PdfPCell(new Phrase(new Chunk(dt.Columns[columns].ColumnName, font18)));
                    //    PdfTable.AddCell(PdfPCell);
                    //}
                    PdfTable.HorizontalAlignment = 1;
                    int valid_amnt = 0; int excep_amnt = 0;
                    for (int rows = 0; rows <= dt2.Rows.Count - 1; rows++)
                    {
                        valid_amnt = valid_amnt + int.Parse(dt2.Rows[rows][6].ToString());
                        excep_amnt = excep_amnt + int.Parse(dt2.Rows[rows][8].ToString());
                    }

                    PdfTable.AddCell(new PdfPCell(new Phrase(new Chunk("Batch Id", font18))));
                    PdfTable.AddCell(new PdfPCell(new Phrase(new Chunk(dt.Rows[0][0].ToString(), fonttext))));
                    PdfTable.AddCell(new PdfPCell(new Phrase(new Chunk("Sap Code", font18))));
                    PdfTable.AddCell(new PdfPCell(new Phrase(new Chunk(dt.Rows[0][3].ToString(), fonttext))));
                    //pdfDoc.Add(PdfTable);
                    PdfTable.AddCell(new PdfPCell(new Phrase(new Chunk("Distributor Name", font18))));
                    PdfTable.AddCell(new PdfPCell(new Phrase(new Chunk(dt.Rows[0][2].ToString(), fonttext))));
                    PdfTable.AddCell(new PdfPCell(new Phrase(new Chunk("State", font18))));
                    PdfTable.AddCell(new PdfPCell(new Phrase(new Chunk(dt.Rows[0][5].ToString(), fonttext))));
                    //pdfDoc.Add(PdfTable);
                    PdfTable.AddCell(new PdfPCell(new Phrase(new Chunk("Batch Date", font18))));
                    PdfTable.AddCell(new PdfPCell(new Phrase(new Chunk(dt.Rows[0][1].ToString(), fonttext))));
                    PdfTable.AddCell(new PdfPCell(new Phrase(new Chunk("Valid Amount", font18))));
                    PdfTable.AddCell(new PdfPCell(new Phrase(new Chunk(valid_amnt.ToString(), fonttext))));
                    //pdfDoc.Add(PdfTable);
                    PdfTable.AddCell(new PdfPCell(new Phrase(new Chunk("Scan Date", font18))));
                    PdfTable.AddCell(new PdfPCell(new Phrase(new Chunk(dt.Rows[0][4].ToString(), fonttext))));
                    PdfTable.AddCell(new PdfPCell(new Phrase(new Chunk("Exception Amount", font18))));
                    PdfTable.AddCell(new PdfPCell(new Phrase(new Chunk(excep_amnt.ToString(), fonttext))));
                    pdfDoc.Add(PdfTable);

                    PdfTable = new PdfPTable(9);
                    PdfTable.SpacingBefore = 20f;
                    PdfTable.DefaultCell.BackgroundColor = BaseColor.LIGHT_GRAY;
                    PdfPCell cell_heading2 = new PdfPCell(new Phrase(new Chunk("Detailed Summary", font18)));
                    cell_heading2.BackgroundColor = BaseColor.LIGHT_GRAY;
                    cell_heading2.MinimumHeight = 15;
                    cell_heading2.Colspan = 9;
                    cell_heading2.HorizontalAlignment = 1; //0=Left, 1=Centre, 2=Right
                    PdfTable.AddCell(cell_heading2);
                    //for (int columns = 0; columns <= dt2.Columns.Count - 1; columns++)
                    string[] arr_det = new string[] { "Coupon Type", "Claimed Coupon Count", "Claimed Coupon Amount", "Coupon Receipt Count", "Valid Coupon Count", "Valid Coupon Amount", "Exceptions Coupon Count", "Exceptions Coupon Amount", "Short/Excess Coupon Count" };

                    for (int columns = 0; columns < arr_det.Length; columns++)
                    {
                        PdfPCell = new PdfPCell(new Phrase(new Chunk(arr_det[columns], font18)));
                        PdfTable.AddCell(PdfPCell);
                    }

                    for (int rows = 0; rows <= dt2.Rows.Count - 1; rows++)
                    {
                        //for (int column = 0; column <9; column++)
                        //{
                        PdfPCell = new PdfPCell(new Phrase(new Chunk(dt2.Rows[rows][0].ToString(), fonttext)));
                        PdfTable.AddCell(PdfPCell);
                        PdfPCell = new PdfPCell(new Phrase(new Chunk(dt2.Rows[rows][2].ToString(), fonttext)));
                        PdfTable.AddCell(PdfPCell);
                        PdfPCell = new PdfPCell(new Phrase(new Chunk(dt2.Rows[rows][3].ToString(), fonttext)));
                        PdfTable.AddCell(PdfPCell);
                        PdfPCell = new PdfPCell(new Phrase(new Chunk(dt2.Rows[rows][4].ToString(), fonttext)));
                        PdfTable.AddCell(PdfPCell);
                        PdfPCell = new PdfPCell(new Phrase(new Chunk(dt2.Rows[rows][5].ToString(), fonttext)));
                        PdfTable.AddCell(PdfPCell);
                        PdfPCell = new PdfPCell(new Phrase(new Chunk(dt2.Rows[rows][6].ToString(), fonttext)));
                        PdfTable.AddCell(PdfPCell);
                        // int sums_exception = int.Parse(dt2.Rows[rows][8].ToString())+ int.Parse(dt2.Rows[rows][9].ToString())+ int.Parse(dt2.Rows[rows][10].ToString())+ int.Parse(dt2.Rows[rows][11].ToString()) + int.Parse(dt2.Rows[rows][12].ToString()) + int.Parse(dt2.Rows[rows][13].ToString());
                        PdfPCell = new PdfPCell(new Phrase(new Chunk(dt2.Rows[rows][7].ToString(), fonttext)));
                        PdfTable.AddCell(PdfPCell);
                        PdfPCell = new PdfPCell(new Phrase(new Chunk(dt2.Rows[rows][8].ToString(), fonttext)));
                        PdfTable.AddCell(PdfPCell);
                        PdfPCell = new PdfPCell(new Phrase(new Chunk(dt2.Rows[rows][9].ToString(), fonttext)));
                        PdfTable.AddCell(PdfPCell);
                        //}
                    }
                    PdfPCell = new PdfPCell(new Phrase(new Chunk("Total", font18)));
                    PdfTable.AddCell(PdfPCell);
                    string sum_colmns = sum_datatable_column(dt2, 2).ToString();
                    PdfPCell = new PdfPCell(new Phrase(new Chunk(sum_colmns, font18)));
                    PdfTable.AddCell(PdfPCell);

                    sum_colmns = sum_datatable_column(dt2, 3).ToString();
                    PdfPCell = new PdfPCell(new Phrase(new Chunk(sum_colmns, font18)));
                    PdfTable.AddCell(PdfPCell);
                    sum_colmns = sum_datatable_column(dt2, 4).ToString();
                    PdfPCell = new PdfPCell(new Phrase(new Chunk(sum_colmns, font18)));
                    PdfTable.AddCell(PdfPCell);
                    sum_colmns = sum_datatable_column(dt2, 5).ToString();
                    PdfPCell = new PdfPCell(new Phrase(new Chunk(sum_colmns, font18)));
                    PdfTable.AddCell(PdfPCell);
                    sum_colmns = sum_datatable_column(dt2, 6).ToString();
                    PdfPCell = new PdfPCell(new Phrase(new Chunk(sum_colmns, font18)));
                    PdfTable.AddCell(PdfPCell);

                    sum_colmns = sum_datatable_column(dt2, 7).ToString();
                    PdfPCell = new PdfPCell(new Phrase(new Chunk(sum_colmns, font18)));
                    PdfTable.AddCell(PdfPCell);
                    sum_colmns = sum_datatable_column(dt2, 8).ToString();
                    PdfPCell = new PdfPCell(new Phrase(new Chunk(sum_colmns, font18)));
                    PdfTable.AddCell(PdfPCell);
                    sum_colmns = sum_datatable_column(dt2, 9).ToString();
                    PdfPCell = new PdfPCell(new Phrase(new Chunk(sum_colmns, font18)));
                    PdfTable.AddCell(PdfPCell);
                    pdfDoc.Add(PdfTable);

                }
                pdfDoc.Close();

i  tried to run change

run user when user not logged on

in action changes added path for arguments and optional

checked about itextsharper

changed configure for window server 2012 R2

please anyone help me on this , any more info required let me know


来源: stackexchange

问:
How to creatte an index pattern in Opensearch use the API?
I want to create an index pattern using the Opensearch API. The issue i'm having is with the message body type. I'm getting the following message when running my script

I'm running opensearch 1.3

```<code>Invoke-RestMethod: {"statusCode":400,"error":"Bad Request","message":"[request body.attributes]: expected value of type [object] but got [undefined]"}
</code>```
```<code>$baseuri = "https://<clusterendpoint>.<region>.es.amazonaws.com"

#obtain auth cookie
$authbody  = @"
{"username":"$apiUserName", "password":"$apiPassword"}
"@
$authUri = "$baseuri/_dashboards/auth/login"
Invoke-RestMethod -Method Post -Uri $authUri -Headers @{"osd-xsrf"="true"} -ContentType "application/json" -Body $authbody -SessionVariable S1

#### create index pattern
$indexid = "indexname"
$body=@"
{
    "index_pattern": {
        "title": "indexname-*",
        "timeFieldName": "@timestamp"
    }
}
"@
$uri = "$baseuri/_dashboards/api/saved_objects/index-pattern/$indexid"

Invoke-RestMethod -Method Post -Uri $uri -Headers @{"osd-xsrf"="true"} -ContentType "application/json" -WebSession $S1 -Body $body -Verbose
</code>```

i've attempted various ways of defining an object with no luck. when I run the invoke with ($body | convertfrom-json) i get a different error message.

```<code>Invoke-RestMethod: {"statusCode":400,"error":"Bad Request","message":"[request body]: expected a plain object value, but found [null] instead."}
</code>```

UPDATE: I did originally attempt to use the create index pattern API for elastic, but this results in a new index being created, not an opensearch index_pattern.

```<code>$body=@{
    "index_pattern"= @{
        "title"= "ai-summary"
    }
}

$uri = "$baseuri/api/index_patterns/$indexid"

Invoke-RestMethod -Method Post -Uri $uri -Headers @{"osd-xsrf"="true"} -ContentType "application/json" -WebSession $S1 -Body ($body | ConvertTo-Json) -Verbose -Credential $credObject
</code>```

ContentLicense: CC BY-SA 4.0

Body:
I want to create an index pattern using the Opensearch API. The issue i'm having is with the message body type. I'm getting the following message when running my script

I'm running opensearch 1.3

Invoke-RestMethod: {"statusCode":400,"error":"Bad Request","message":"[request body.attributes]: expected value of type [object] but got [undefined]"}

$baseuri = "https://<clusterendpoint>.<region>.es.amazonaws.com"

#obtain auth cookie
$authbody  = @"
{"username":"$apiUserName", "password":"$apiPassword"}
"@
$authUri = "$baseuri/_dashboards/auth/login"
Invoke-RestMethod -Method Post -Uri $authUri -Headers @{"osd-xsrf"="true"} -ContentType "application/json" -Body $authbody -SessionVariable S1

#### create index pattern
$indexid = "indexname"
$body=@"
{
    "index_pattern": {
        "title": "indexname-*",
        "timeFieldName": "@timestamp"
    }
}
"@
$uri = "$baseuri/_dashboards/api/saved_objects/index-pattern/$indexid"

Invoke-RestMethod -Method Post -Uri $uri -Headers @{"osd-xsrf"="true"} -ContentType "application/json" -WebSession $S1 -Body $body -Verbose

i've attempted various ways of defining an object with no luck. when I run the invoke with ($body | convertfrom-json) i get a different error message.

Invoke-RestMethod: {"statusCode":400,"error":"Bad Request","message":"[request body]: expected a plain object value, but found [null] instead."}

UPDATE: I did originally attempt to use the create index pattern API for elastic, but this results in a new index being created, not an opensearch index_pattern.

$body=@{
    "index_pattern"= @{
        "title"= "ai-summary"
    }
}

$uri = "$baseuri/api/index_patterns/$indexid"

Invoke-RestMethod -Method Post -Uri $uri -Headers @{"osd-xsrf"="true"} -ContentType "application/json" -WebSession $S1 -Body ($body | ConvertTo-Json) -Verbose -Credential $credObject


问:
Android studio adb daemon on Linux Mint
I often get error in Android Studio logs like this:

daemon not running; starting now at tcp:5038

daemon started successfully

When I start adb from linux command line, no problems occurr, but when adb starts from Android Studio it lives a short time, and then daemon is killed.

How to fix this problem ?

Title: Android studio adb daemon on Linux Mint


问:
How to read an encrypted zip file compressed by deflate64? In Java code
A zip file compressed using the Deflate64 method, and it is encrypted with a password.

Is there a way to read it in java?


问:
how to get sharepoint list items in zoho crm list(layout)
I dont Know is it possible or not pls recommend me any way to achieve this requirement.

I have a list in SharePoint (name='FORTNIGHTLY REPORTS') and in this list there are 6 columns (name= Title, Date, Procurement Status, HR Status, Marketing Status, Legal Status) and I also have a list(layout) in Zoho CRM of same columns (name= Title, Date, Procurement Status, HR Status, Marketing Status, Legal Status) and i want to create a power automate flow. When flow get triggered the data(items) present in sharepoint list should get copied in zoho crm list(layout) in same name column (means the items present in 'title' column in sharepoint list should get copied in zoho list(layout) column 'title'

I am expecting that when power automate flow gets triggers the items present in sharepoint list should get copied in zoho list with respected column.


问:
App build error # Caused by: org.gradle.workers.internal
I am facing this error while building the application

```<code># Caused by: org.gradle.workers.internal.DefaultWorkerExecutor$WorkExecutionException: A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
</code>```

Please help me whats the wrong

Body:
I am facing this error while building the application

# Caused by: org.gradle.workers.internal.DefaultWorkerExecutor$WorkExecutionException: A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction

Please help me whats the wrong


问:
How to fix require() of ES Module /dir/node_modules/@angular/core/fesm2015/core.mjs not supported
On VsCode, I included Quokka.js extension. I tried running it on a typescript file and received the following error:

```<code>require() of ES Module /project/node_modules/@angular/core/fesm2015/core.mjs not supported.
Instead change the require of /project/node_modules/@angular/core/fesm2015/core.mjs to a dynamic import() which is available in all CommonJS modules.
  at Object.<anonymous> libs/features/orders/src/lib/components/order-list.component.ts:1
</code>```

An Nx monorepo is used for this project. Which error is this, and how do I fix it?

Body:
On VsCode, I included Quokka.js extension. I tried running it on a typescript file and received the following error:

require() of ES Module /project/node_modules/@angular/core/fesm2015/core.mjs not supported.
Instead change the require of /project/node_modules/@angular/core/fesm2015/core.mjs to a dynamic import() which is available in all CommonJS modules.
  at Object.<anonymous> libs/features/orders/src/lib/components/order-list.component.ts:1

An Nx monorepo is used for this project. Which error is this, and how do I fix it?


问:
Artificial Neural Network training for an Automatic Voltage regulator
```<code>I = out.input';
T = out.output';
net=newff(minmax(I),[3,5,1],{'logsig','tansig','purelin'},'trainlm');
net = init(net);                     % Used to initialize the network (weight and biases)
net.trainParam.show =1;     % The result of error (mse) is shown at each iteration (epoch)
net.trainParam.epochs = 10000;       % Maximum limit of the network training iteration process
net.trainParam.goal =1e-12;          % Stopping criterion based on error (mse) goal
net=train(net,I,T);                % Start training the network
</code>```

I have this code, on matlab r2022b and I already have a simulink file for my output. But when I ran it, it showed me this error:
Error using minmax
Data is not a matrix or cell array.

```<code>Error in untitled2 (line 3)
net=newff(minmax(I),[3,5,1],{'logsig','tansig','purelin'},'trainlm');
Please help me understand how to fix this issue.
</code>```

I have using different ANN codes that doesn't use a simulink simulation for data that ran fine, but for whatever reason this code showed this error.

Body:
I = out.input';
T = out.output';
net=newff(minmax(I),[3,5,1],{'logsig','tansig','purelin'},'trainlm');
net = init(net);                     % Used to initialize the network (weight and biases)
net.trainParam.show =1;     % The result of error (mse) is shown at each iteration (epoch)
net.trainParam.epochs = 10000;       % Maximum limit of the network training iteration process
net.trainParam.goal =1e-12;          % Stopping criterion based on error (mse) goal
net=train(net,I,T);                % Start training the network

I have this code, on matlab r2022b and I already have a simulink file for my output. But when I ran it, it showed me this error:
Error using minmax
Data is not a matrix or cell array.

Error in untitled2 (line 3)
net=newff(minmax(I),[3,5,1],{'logsig','tansig','purelin'},'trainlm');
Please help me understand how to fix this issue.

I have using different ANN codes that doesn't use a simulink simulation for data that ran fine, but for whatever reason this code showed this error.


问:
Improving the state design pattern in the least expensive mode
I have a question about the improving state design pattern.

How does the diagram class change when I added the new method to have the lowest cost?


问:
Creating subset of a data
I have a column called Project_Id which lists the names of many different projects, say Project A, Project B and so on. A second column lists the sales for each project.

A third column shows time series information. For example:

Project_ID   Sales   Time Series Information
A               10            1
A               25            2
A               31            3
A               59            4
B               22            1
B               38            2
B               76            3
C               82            1
C               23            2
C               83            3
C               12            4
C               90            5
D               14            1
D               62            2

From this dataset, I need to choose (and thus create a new data set) only those projects which have at least 4 time series points, say, to get the new dataset (How do I get this by using an R code, is my question):

Project_ID   Sales   Time Series Information
A               10            1
A               25            2
A               31            3
A               59            4
C               82            1
C               23            2
C               83            3
C               12            4
C               90            5

Could someone please help?
Thanks a lot!

I tried to do some filtering with R but had little success.

Title: Creating subset of a data


问:
Flutter:how to stream mysql database
I am trying to read database continuously but I am not finding any way to do it.First of all I am having a doubt that wether Firebase Realtime Database can do this task with out calling api multiple times.As per I researched over internet to accomplish my task I came to know that socket.io package or web sockets can Abel to complete task but I am trying to find the difference between Firebase Realtime Database and socket.io package which is the best approach to read data in database continuously.If I use socket.io package then how should I connect to my server and what is the procedure can any one explain with example</p>

Title: Flutter:how to stream mysql database


问:
Execute promise after 2 seconds only when previous element is done
I have the following code;

```<code>const query1 = Character.findOneAndUpdate(filter, update); // mongoose update query

let queries = [query1, query2, query3, .... query10000]
let chunksArr = [];

while(queries.length){
  const chunk = queries.splice(0, 1000)
   chunksArr.push( chunk )
}
</code>```

Notice where I defined the query1, I didn't use await with it. that's because in later while loop I'm dividing queries array (of 10000) in to 10 smaller arrays so that chunksArr is an array of array where each array contains 1000 unfinished queries. I am aware of Promise.all(chunksArr) which will allow these queries to run in parallel. but I want to execute each element (which is an array) in chunksArr after 2 seconds only when previous element is done. which means sequentially. Is there any way to do this? Any help will be greatly appreciated. Thanks

Body:
I have the following code;

const query1 = Character.findOneAndUpdate(filter, update); // mongoose update query

let queries = [query1, query2, query3, .... query10000]
let chunksArr = [];

while(queries.length){
  const chunk = queries.splice(0, 1000)
   chunksArr.push( chunk )
}

Notice where I defined the query1, I didn't use await with it. that's because in later while loop I'm dividing queries array (of 10000) in to 10 smaller arrays so that chunksArr is an array of array where each array contains 1000 unfinished queries. I am aware of Promise.all(chunksArr) which will allow these queries to run in parallel. but I want to execute each element (which is an array) in chunksArr after 2 seconds only when previous element is done. which means sequentially. Is there any way to do this? Any help will be greatly appreciated. Thanks


问:
(HTML)Load, edit, save config.txt file in web browser
Thanks for read.

I'm very new at html coding. I'm pythone or arduino coder, but my boss make me to work on html too...
I'm trying to make web page (test.html) work as below

page loaded.

click 'load config' button

load config.txt file from same folder with html file (server's root folder)
-print 'load done' when sucess or 'failed'

show config.txt file on textarea

edit something

click 'save confgif' button

textarea overwrite 'config.txt' on same folder
-print 'save done' when sucess or 'failed'

I couldn't find exact code for this.
The most similar thing I found was this on link

https://thiscouldbebetter.wordpress.com/2012/12/18/loading-editing-and-saving-a-text-file-in-html5-using-javascrip/

```<code><html>
<body>

<table>
    <tr><td>Text to Save:</td></tr>
    <tr>
        <td colspan="3">
            <textarea id="inputTextToSave" cols="80" rows="25"></textarea>
        </td>
    </tr>
    <tr>
        <td>Filename to Save As:</td>
        <td><input id="inputFileNameToSaveAs"></input></td>
        <td><button onclick="saveTextAsFile()">Save Text to File</button></td>
    </tr>
    <tr>
        <td>Select a File to Load:</td>
        <td><input type="file" id="fileToLoad"></td>
        <td><button onclick="loadFileAsText()">Load Selected File</button><td>
    </tr>
</table>

<script type="text/javascript">

function saveTextAsFile()
{
    var textToSave = document.getElementById("inputTextToSave").value;
    var textToSaveAsBlob = new Blob([textToSave], {type:"text/plain"});
    var textToSaveAsURL = window.URL.createObjectURL(textToSaveAsBlob);
    var fileNameToSaveAs = document.getElementById("inputFileNameToSaveAs").value;

    var downloadLink = document.createElement("a");
    downloadLink.download = fileNameToSaveAs;
    downloadLink.innerHTML = "Download File";
    downloadLink.href = textToSaveAsURL;
    downloadLink.onclick = destroyClickedElement;
    downloadLink.style.display = "none";
    document.body.appendChild(downloadLink);

    downloadLink.click();
}

function destroyClickedElement(event)
{
    document.body.removeChild(event.target);
}

function loadFileAsText()
{
    var fileToLoad = document.getElementById("fileToLoad").files[0];

    var fileReader = new FileReader();
    fileReader.onload = function(fileLoadedEvent)
    {
        var textFromFileLoaded = fileLoadedEvent.target.result;
        document.getElementById("inputTextToSave").value = textFromFileLoaded;
    };
    fileReader.readAsText(fileToLoad, "UTF-8");
}

</script>

</body>
</html>
</code>```

The security issue is off the table.
(it considered at before loading web page)

I've tried to find command line for deignate file's loot but I've failed.

how could I change file loding process from client's local upload file to server's root file?

Body:
Thanks for read.

I'm very new at html coding. I'm pythone or arduino coder, but my boss make me to work on html too...
I'm trying to make web page (test.html) work as below

page loaded.

click 'load config' button

load config.txt file from same folder with html file (server's root folder)
-print 'load done' when sucess or 'failed'

show config.txt file on textarea

edit something

click 'save confgif' button

textarea overwrite 'config.txt' on same folder
-print 'save done' when sucess or 'failed'

I couldn't find exact code for this.
The most similar thing I found was this on link

https://thiscouldbebetter.wordpress.com/2012/12/18/loading-editing-and-saving-a-text-file-in-html5-using-javascrip/

Text to Save:

            <textarea id="inputTextToSave" cols="80" rows="25"></textarea>

        Filename to Save As:
        <input id="inputFileNameToSaveAs"></input>
        <button onclick="saveTextAsFile()">Save Text to File</button>

        Select a File to Load:
        <input type="file" id="fileToLoad">
        <button onclick="loadFileAsText()">Load Selected File</button>

The security issue is off the table.
(it considered at before loading web page)

I've tried to find command line for deignate file's loot but I've failed.

how could I change file loding process from client's local upload file to server's root file?


问:
Lost connection for MYSQL while manipulating a certain row
I have one table in Mysql named parent having id as primary key,

another table named child having a parent_id as foreign key which is linked to the id of the parent table,

I am trying to update an entry in the parent table for a specific id but I am getting the error "Error Code: 2013. Lost connection to MySQL server during query", otherwise it is working smoothly for all other ids.
I am also trying to insert an entry in the child table, everything works smoothly otherwise, except for one entry, that child entry's parent id already exists in the parent table as id, there is no foreign key error, just "Error Code: 2013. Lost connection to MySQL server during query". I am not able to debug this because it is specific for only that id.

I have tried it multiple times through my code and also directly on Mysql workbench but did not reach any conclusion.


问:
Duplicate class found error in android studio
This is my error

```<code>Duplicate class org.json.JSONWriter found in modules jetified-java-json (java-json.jar) and jetified-json-20090211 (org.json:json:20090211)
Duplicate class org.json.XML found in modules jetified-java-json (java-json.jar) and jetified-json-20090211 (org.json:json:20090211)
Duplicate class org.json.XMLTokener found in modules jetified-java-json (java-json.jar) and jetified-json-20090211 (org.json:json:20090211)

Go to the documentation to learn how to Fix dependency resolution errors.
</code>```

I have added a payu dependency after that this error is poping up .In this project it has old payu sdk

Body:
This is my error

Duplicate class org.json.JSONWriter found in modules jetified-java-json (java-json.jar) and jetified-json-20090211 (org.json:json:20090211)
Duplicate class org.json.XML found in modules jetified-java-json (java-json.jar) and jetified-json-20090211 (org.json:json:20090211)
Duplicate class org.json.XMLTokener found in modules jetified-java-json (java-json.jar) and jetified-json-20090211 (org.json:json:20090211)

Go to the documentation to learn how to Fix dependency resolution errors.

I have added a payu dependency after that this error is poping up .In this project it has old payu sdk


问:
Flutter image_gallery_saver returns wrong file path on Android
I'm using image gallery saver to save an image to the user's device and get the file path back to store in a DB so I can use the image in the app. This works fine on iOS, but on Android, it gives me back this file path:

```<code>filePath: content://media/external/images/media/1000006846
</code>```

And when trying to use this path in an image widget, I get this error:

```<code>'content://media/external/images/media/1000006846' (OS Error: No such file or directory, errno = 2)
</code>```

Body:
I'm using image gallery saver to save an image to the user's device and get the file path back to store in a DB so I can use the image in the app. This works fine on iOS, but on Android, it gives me back this file path:

filePath: content://media/external/images/media/1000006846

And when trying to use this path in an image widget, I get this error:

'content://media/external/images/media/1000006846' (OS Error: No such file or directory, errno = 2)


问:
SeaweedFS - Added new volume server but not able to add new files
I've one master(x.x.x.61), one volume(x.x.x.63) and one filer + s3API (x.x.x.62) setup on 3 separate machines.
I added a new volume server (x.x.x.64) because I've max out the storage space on the first volume server.
But I'm still not able to add new files on the filer UI(http://x.x.x.62:8888)

In my filer logs, I noticed that it's trying to connect to the first volume server IP address that's out of space. Am I missing a configuration for it to connect to the new volume server?

```<code>E1221 11:09:48.027930 upload_content.go:351 unmarshal http://x.x.x.63:8080/7,2bafadaa4666: {"error":"failed to write to local disk: write data/chrisDir_7.dat: no space left on device"}{"name":"app_progress4.apk","size":2353734,"eTag":"92b10892"}
W1221 11:09:48.027950 upload_content.go:168 uploading 2 to http://x.x.x.63:8080/7,2bafadaa4666: unmarshal http://x.x.x.63:8080/7,2bafadaa4666: invalid character '{' after top-level value
E1221 11:09:48.027965 filer_server_handlers_write_upload.go:209 upload error: unmarshal http://x.x.x.63:8080/7,2bafadaa4666: invalid character '{' after top-level value
I1221 11:09:48.028022 common.go:70 response method:POST URL:/buckets/chrisDir/ with httpStatus:500 and JSON:{"error":"unmarshal http://x.x.x.63:8080/2,2ba84b2894a7: invalid character '{' after top-level value"}
</code>```

In the master log, I see that the second volume server was added successfully and master.toml file was executed to rebalance

```<code>I1221 11:36:09.522690 node.go:225 topo:DefaultDataCenter:DefaultRack adds child x.x.x.64:8080
I1221 11:36:09.522716 node.go:225 topo:DefaultDataCenter:DefaultRack:x.x.x.64:8080 adds child
I1221 11:36:09.522724 master_grpc_server.go:138 added volume server 0: x.x.x.64:8080 [3caad049-38a6-43f6-8192-d1082c5e838b]
I1221 11:36:09.522744 master_grpc_server.go:49 found new uuid:x.x.x.64:8080 [3caad049-38a6-43f6-8192-d1082c5e838b] , map[x.x.x.63:8080:[5005b287-c812-4dba-ba41-9b5a6a022f12] x.x.x.64:8080:[3caad049-38a6-43f6-8192-d1082c5e838b]]
I1221 11:36:09.522866 volume_layout.go:393 Volume 11 becomes writable
I1221 11:36:09.522880 master_grpc_server.go:199 master see new volume 11 from x.x.x.64:8080
I1221 11:38:33.481721 master_server.go:323 executing: lock []
I1221 11:38:33.482821 master_server.go:323 executing: ec.encode [-fullPercent=95 -quietFor=1h]
I1221 11:38:33.483925 master_server.go:323 executing: ec.rebuild [-force]
I1221 11:38:33.484372 master_server.go:323 executing: ec.balance [-force]
I1221 11:38:33.484777 master_server.go:323 executing: volume.balance [-force]
2022/12/21 11:38:48 copying volume 21 from x.x.x.63:8080 to x.x.x.64:8080
I1221 11:38:48.486778 volume_layout.go:407 Volume 21 has 0 replica, less than required 1
I1221 11:38:48.486798 volume_layout.go:380 Volume 21 becomes unwritable
I1221 11:38:48.494998 volume_layout.go:393 Volume 21 becomes writable
2022/12/21 11:38:48 tailing volume 21 from x.x.x.63:8080 to x.x.x.64:8080
2022/12/21 11:38:58 deleting volume 21 from x.x.x.63:8080
....
</code>```

How I start master

```<code>./weed master -mdir='.'
</code>```

How I start volume

```<code>./weed volume -max=100 -mserver="x.x.x.61:9333" -dir="$dataDir"
</code>```

How I start filer and s3

```<code>./weed filer -master="x.x.x.61:9333" -s3
</code>```

What's in $HOME/.seaweedfs

```<code>drwxrwxr-x  2 seaweedfs seaweedfs 4096 Dec 20 16:01 .
drwxr-xr-x 20 seaweedfs seaweedfs 4096 Dec 20 16:01 ..
-rw-r--r--  1 seaweedfs seaweedfs 2234 Dec 20 15:57 master.toml
</code>```

Content of master.toml file

```<code># Put this file to one of the location, with descending priority
#    ./master.toml
#    $HOME/.seaweedfs/master.toml
#    /etc/seaweedfs/master.toml
# this file is read by master

[master.maintenance]
# periodically run these scripts are the same as running them from 'weed shell'
scripts = """
  lock
  ec.encode -fullPercent=95 -quietFor=1h
  ec.rebuild -force
  ec.balance -force
  volume.deleteEmpty -quietFor=24h -force
  volume.balance -force
  volume.fix.replication
  s3.clean.uploads -timeAgo=24h
  unlock
"""
sleep_minutes = 7          # sleep minutes between each script execution

[master.sequencer]
type = "raft"     # Choose [raft|snowflake] type for storing the file id sequence
# when sequencer.type = snowflake, the snowflake id must be different from other masters
sequencer_snowflake_id = 0     # any number between 1~1023

# configurations for tiered cloud storage
# old volumes are transparently moved to cloud for cost efficiency
[storage.backend]
[storage.backend.s3.default]
enabled = false
aws_access_key_id = ""         # if empty, loads from the shared credentials file (~/.aws/credentials).
aws_secret_access_key = ""     # if empty, loads from the shared credentials file (~/.aws/credentials).
region = "us-east-2"
bucket = "your_bucket_name"    # an existing bucket
endpoint = ""
storage_class = "STANDARD_IA"

# create this number of logical volumes if no more writable volumes
# count_x means how many copies of data.
# e.g.:
#   000 has only one copy, copy_1
#   010 and 001 has two copies, copy_2
#   011 has only 3 copies, copy_3
[master.volume_growth]
copy_1 = 7                # create 1 x 7 = 7 actual volumes
copy_2 = 6                # create 2 x 6 = 12 actual volumes
copy_3 = 3                # create 3 x 3 = 9 actual volumes
copy_other = 1            # create n x 1 = n actual volumes

# configuration flags for replication
[master.replication]
# any replication counts should be considered minimums. If you specify 010 and
# have 3 different racks, that's still considered writable. Writes will still
# try to replicate to all available volumes. You should only use this option
# if you are doing your own replication or periodic sync of volumes.
treat_replication_as_minimums = false
</code>```

System status

```<code>curl http://localhost:9333/dir/assign?pretty=y
{
  "fid": "9,2bb2fd75d706",
  "url": "x.x.x.63:8080",
  "publicUrl": "x.x.x.63:8080",
  "count": 1
}

curl http://x.x.x.61:9333/cluster/status?pretty=y
{
  "IsLeader": true,
  "Leader": "x.x.x.61:9333",
  "MaxVolumeId": 21
}

curl "http://x.x.x.61:9333/dir/status?pretty=y"
{
  "Topology": {
    "Max": 200,
    "Free": 179,
    "DataCenters": [
      {
        "Id": "DefaultDataCenter",
        "Racks": [
          {
            "Id": "DefaultRack",
            "DataNodes": [
              {
                "Url": "x.x.x.63:8080",
                "PublicUrl": "x.x.x.63:8080",
                "Volumes": 20,
                "EcShards": 0,
                "Max": 100,
                "VolumeIds": " 1-10 12-21"
              },
              {
                "Url": "x.x.x.64:8080",
                "PublicUrl": "x.x.x.64:8080",
                "Volumes": 1,
                "EcShards": 0,
                "Max": 100,
                "VolumeIds": " 11"
              }
            ]
          }
        ]
      }
    ],
    "Layouts": [
      {
        "replication": "000",
        "ttl": "",
        "writables": [
          6,
          1,
          2,
          7,
          3,
          4,
          5
        ],
        "collection": "chrisDir"
      },
      {
        "replication": "000",
        "ttl": "",
        "writables": [
          16,
          19,
          17,
          21,
          15,
          18,
          20
        ],
        "collection": "chrisDir2"
      },
      {
        "replication": "000",
        "ttl": "",
        "writables": [
          8,
          12,
          13,
          9,
          14,
          10,
          11
        ],
        "collection": ""
      }
    ]
  },
  "Version": "30GB 3.37 438146249f50bf36b4c46ece02a430f44152777f"
}
</code>```

Body:
I've one master(x.x.x.61), one volume(x.x.x.63) and one filer + s3API (x.x.x.62) setup on 3 separate machines.
I added a new volume server (x.x.x.64) because I've max out the storage space on the first volume server.
But I'm still not able to add new files on the filer UI(http://x.x.x.62:8888)

In my filer logs, I noticed that it's trying to connect to the first volume server IP address that's out of space. Am I missing a configuration for it to connect to the new volume server?

E1221 11:09:48.027930 upload_content.go:351 unmarshal http://x.x.x.63:8080/7,2bafadaa4666: {"error":"failed to write to local disk: write data/chrisDir_7.dat: no space left on device"}{"name":"app_progress4.apk","size":2353734,"eTag":"92b10892"}
W1221 11:09:48.027950 upload_content.go:168 uploading 2 to http://x.x.x.63:8080/7,2bafadaa4666: unmarshal http://x.x.x.63:8080/7,2bafadaa4666: invalid character '{' after top-level value
E1221 11:09:48.027965 filer_server_handlers_write_upload.go:209 upload error: unmarshal http://x.x.x.63:8080/7,2bafadaa4666: invalid character '{' after top-level value
I1221 11:09:48.028022 common.go:70 response method:POST URL:/buckets/chrisDir/ with httpStatus:500 and JSON:{"error":"unmarshal http://x.x.x.63:8080/2,2ba84b2894a7: invalid character '{' after top-level value"}

In the master log, I see that the second volume server was added successfully and master.toml file was executed to rebalance

I1221 11:36:09.522690 node.go:225 topo:DefaultDataCenter:DefaultRack adds child x.x.x.64:8080
I1221 11:36:09.522716 node.go:225 topo:DefaultDataCenter:DefaultRack:x.x.x.64:8080 adds child
I1221 11:36:09.522724 master_grpc_server.go:138 added volume server 0: x.x.x.64:8080 [3caad049-38a6-43f6-8192-d1082c5e838b]
I1221 11:36:09.522744 master_grpc_server.go:49 found new uuid:x.x.x.64:8080 [3caad049-38a6-43f6-8192-d1082c5e838b] , map[x.x.x.63:8080:[5005b287-c812-4dba-ba41-9b5a6a022f12] x.x.x.64:8080:[3caad049-38a6-43f6-8192-d1082c5e838b]]
I1221 11:36:09.522866 volume_layout.go:393 Volume 11 becomes writable
I1221 11:36:09.522880 master_grpc_server.go:199 master see new volume 11 from x.x.x.64:8080
I1221 11:38:33.481721 master_server.go:323 executing: lock []
I1221 11:38:33.482821 master_server.go:323 executing: ec.encode [-fullPercent=95 -quietFor=1h]
I1221 11:38:33.483925 master_server.go:323 executing: ec.rebuild [-force]
I1221 11:38:33.484372 master_server.go:323 executing: ec.balance [-force]
I1221 11:38:33.484777 master_server.go:323 executing: volume.balance [-force]
2022/12/21 11:38:48 copying volume 21 from x.x.x.63:8080 to x.x.x.64:8080
I1221 11:38:48.486778 volume_layout.go:407 Volume 21 has 0 replica, less than required 1
I1221 11:38:48.486798 volume_layout.go:380 Volume 21 becomes unwritable
I1221 11:38:48.494998 volume_layout.go:393 Volume 21 becomes writable
2022/12/21 11:38:48 tailing volume 21 from x.x.x.63:8080 to x.x.x.64:8080
2022/12/21 11:38:58 deleting volume 21 from x.x.x.63:8080
....

How I start master

./weed master -mdir='.'

How I start volume

./weed volume -max=100 -mserver="x.x.x.61:9333" -dir="$dataDir"

How I start filer and s3

./weed filer -master="x.x.x.61:9333" -s3

What's in $HOME/.seaweedfs

drwxrwxr-x  2 seaweedfs seaweedfs 4096 Dec 20 16:01 .
drwxr-xr-x 20 seaweedfs seaweedfs 4096 Dec 20 16:01 ..
-rw-r--r--  1 seaweedfs seaweedfs 2234 Dec 20 15:57 master.toml

Content of master.toml file

# Put this file to one of the location, with descending priority
#    ./master.toml
#    $HOME/.seaweedfs/master.toml
#    /etc/seaweedfs/master.toml
# this file is read by master

[master.maintenance]
# periodically run these scripts are the same as running them from 'weed shell'
scripts = """
  lock
  ec.encode -fullPercent=95 -quietFor=1h
  ec.rebuild -force
  ec.balance -force
  volume.deleteEmpty -quietFor=24h -force
  volume.balance -force
  volume.fix.replication
  s3.clean.uploads -timeAgo=24h
  unlock
"""
sleep_minutes = 7          # sleep minutes between each script execution

[master.sequencer]
type = "raft"     # Choose [raft|snowflake] type for storing the file id sequence
# when sequencer.type = snowflake, the snowflake id must be different from other masters
sequencer_snowflake_id = 0     # any number between 1~1023

# configurations for tiered cloud storage
# old volumes are transparently moved to cloud for cost efficiency
[storage.backend]
[storage.backend.s3.default]
enabled = false
aws_access_key_id = ""         # if empty, loads from the shared credentials file (~/.aws/credentials).
aws_secret_access_key = ""     # if empty, loads from the shared credentials file (~/.aws/credentials).
region = "us-east-2"
bucket = "your_bucket_name"    # an existing bucket
endpoint = ""
storage_class = "STANDARD_IA"

# create this number of logical volumes if no more writable volumes
# count_x means how many copies of data.
# e.g.:
#   000 has only one copy, copy_1
#   010 and 001 has two copies, copy_2
#   011 has only 3 copies, copy_3
[master.volume_growth]
copy_1 = 7                # create 1 x 7 = 7 actual volumes
copy_2 = 6                # create 2 x 6 = 12 actual volumes
copy_3 = 3                # create 3 x 3 = 9 actual volumes
copy_other = 1            # create n x 1 = n actual volumes

# configuration flags for replication
[master.replication]
# any replication counts should be considered minimums. If you specify 010 and
# have 3 different racks, that's still considered writable. Writes will still
# try to replicate to all available volumes. You should only use this option
# if you are doing your own replication or periodic sync of volumes.
treat_replication_as_minimums = false

System status

curl http://localhost:9333/dir/assign?pretty=y
{
  "fid": "9,2bb2fd75d706",
  "url": "x.x.x.63:8080",
  "publicUrl": "x.x.x.63:8080",
  "count": 1
}

curl http://x.x.x.61:9333/cluster/status?pretty=y
{
  "IsLeader": true,
  "Leader": "x.x.x.61:9333",
  "MaxVolumeId": 21
}

curl "http://x.x.x.61:9333/dir/status?pretty=y"
{
  "Topology": {
    "Max": 200,
    "Free": 179,
    "DataCenters": [
      {
        "Id": "DefaultDataCenter",
        "Racks": [
          {
            "Id": "DefaultRack",
            "DataNodes": [
              {
                "Url": "x.x.x.63:8080",
                "PublicUrl": "x.x.x.63:8080",
                "Volumes": 20,
                "EcShards": 0,
                "Max": 100,
                "VolumeIds": " 1-10 12-21"
              },
              {
                "Url": "x.x.x.64:8080",
                "PublicUrl": "x.x.x.64:8080",
                "Volumes": 1,
                "EcShards": 0,
                "Max": 100,
                "VolumeIds": " 11"
              }
            ]
          }
        ]
      }
    ],
    "Layouts": [
      {
        "replication": "000",
        "ttl": "",
        "writables": [
          6,
          1,
          2,
          7,
          3,
          4,
          5
        ],
        "collection": "chrisDir"
      },
      {
        "replication": "000",
        "ttl": "",
        "writables": [
          16,
          19,
          17,
          21,
          15,
          18,
          20
        ],
        "collection": "chrisDir2"
      },
      {
        "replication": "000",
        "ttl": "",
        "writables": [
          8,
          12,
          13,
          9,
          14,
          10,
          11
        ],
        "collection": ""
      }
    ]
  },
  "Version": "30GB 3.37 438146249f50bf36b4c46ece02a430f44152777f"
}


问:
could not access tableau trusted url in iframe show error too many redirections
I tried to access the views of tableau with trusted ticket which i generated with curl in php
tickets are generated properly but when try to make the trusted url and embedded it in iframe it shows the error of too many redirection

i used below url[which i found from the tableau doc] to show in iframe

```<code>http://<server_name/trusted/<unique_ticket>/t/Sales/views/<workbook_name>/<view_name>
</code>```

my trusted ticket generate code is like :

```<code>$xml = curlTableauXML($URL."/api/3.0/sites/sitename/workbooks/$id/views", $token);
    $view = $xml->views->view[0]->attributes()->contentUrl;
    $params = ':embed=yes&:toolbar=no';

    $fields_string ="target_site=$siteID&username=$adminuser";
    $curlurl = 'https://'.$server.'/trusted';
    $ch = curl_init($curlurl);
    $data = array('username' => $adminuser, 'client_ip' => 'client_ip');

    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch,CURLOPT_POSTFIELDS, $data);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $ticket = curl_exec($ch);
    curl_close($ch);
</code>```

Body:
I tried to access the views of tableau with trusted ticket which i generated with curl in php
tickets are generated properly but when try to make the trusted url and embedded it in iframe it shows the error of too many redirection

i used below url[which i found from the tableau doc] to show in iframe

http://<server_name/trusted/<unique_ticket>/t/Sales/views/<workbook_name>/<view_name>

my trusted ticket generate code is like :

$xml = curlTableauXML($URL."/api/3.0/sites/sitename/workbooks/$id/views", $token);
    $view = $xml->views->view[0]->attributes()->contentUrl;
    $params = ':embed=yes&:toolbar=no';

    $fields_string ="target_site=$siteID&username=$adminuser";
    $curlurl = 'https://'.$server.'/trusted';
    $ch = curl_init($curlurl);
    $data = array('username' => $adminuser, 'client_ip' => 'client_ip');

    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch,CURLOPT_POSTFIELDS, $data);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $ticket = curl_exec($ch);
    curl_close($ch);


问:
Trying to map which zones of IPAM the range against the rule supplied IP range
```<code>
Hi everyone, I am Trying to map which zones of IPAM the range against the rule supplied IP range
Example:

IPAM subnets
  Zone Subnet IPs involved
  HR 9.2.0.0/16 [9.2.(0-255).(0-255)]
  MAIL 9.3.0.0/16  [9.3.(0-255).(0-255)]
  HR 9.5.0.0/16 [9.5.(0-255).(0-255)]

Rule1
  source: has a range of IPs now 9.2.0.0 - 9.5.233.233

Expected: This range covers a wide range of IPs, however per IPAM defined zones, the first half and last parts are only present in HR zones while the middle subnet is part of MAIL zone so the expected output should be null
Here do we have an easy way of function to identify this without running a very extensive recessive search of IPs one by one against the available zone's subnets?

</code>```

Tried pynetbox function IPAM to first take the start of range (9.2.0.0) from rule1 find its falling zone, marked it as HR range, likewise took the last IP (9.5.233.233) from rule and mapped it against zone from IPAM to understand its HR range. Final output is this rule falls under HR zone. But this is wrong technically.

Body:
Hi everyone, I am Trying to map which zones of IPAM the range against the rule supplied IP range
Example:

IPAM subnets
  Zone Subnet IPs involved
  HR 9.2.0.0/16 [9.2.(0-255).(0-255)]
  MAIL 9.3.0.0/16  [9.3.(0-255).(0-255)]
  HR 9.5.0.0/16 [9.5.(0-255).(0-255)]

Rule1
  source: has a range of IPs now 9.2.0.0 - 9.5.233.233

Expected: This range covers a wide range of IPs, however per IPAM defined zones, the first half and last parts are only present in HR zones while the middle subnet is part of MAIL zone so the expected output should be null
Here do we have an easy way of function to identify this without running a very extensive recessive search of IPs one by one against the available zone's subnets?

Tried pynetbox function IPAM to first take the start of range (9.2.0.0) from rule1 find its falling zone, marked it as HR range, likewise took the last IP (9.5.233.233) from rule and mapped it against zone from IPAM to understand its HR range. Final output is this rule falls under HR zone. But this is wrong technically.


问:
Angular how to use VS code inside angular app?
Is there any support for online code editor for angular 14 app?

we have the situation where we want to user online code editor inside my application and we want to  store those information inside my application or your server. Please help on this.

I want use inside my angular application ?


问:
Performance issue in drill view
We have a drill view where we are flattening a field. The specific field is a json with more than 160 attributes. When flattening the table with this field we are facing performance issue. Is there any optimization configuration we can do @ apache drill ?</p>

Title: Performance issue in drill view


问:
Component is missing template or render function - VueJS Library
I am trying to create an SVG library using Vue3 but all I am getting is error...I created the basic library project following this article. Here is my file structure

and this is my code in BaseIcon.vue

```<code><template>
  <component :is="iconComponent" class="inline-block fill-current"
    style="height: 1em; width: 1em; vertical-align: -0.125em" />
</template>

<script>
const icons = {}
const requireComponents = require.context('../assets/icons/', false, /.svg$/)
requireComponents.keys().forEach(fileName => {
  const iconName = fileName.replace(/^\.\/icon-(.+)\.svg$/, '$1')
  const componentConfig = requireComponents(fileName)
  icons[iconName] = componentConfig.default || componentConfig
})
export default {
  props: {
    name: {
      type: String,
      required: true,
      validator(value) {
        return Object.prototype.hasOwnProperty.call(icons, value)
      }
    }
  },
  computed: {
    iconComponent() {
      return icons[this.name]
    },
  }
}
</script>
</code>```

This is the App.vue file code

```<code><template>
  <div id="app" class="p-10 text-xl">
    <BaseIcon name="user" class="text-blue-500" /> Home
    <BaseIcon name="home" class="text-blue-500" /> Profile
  </div>
</template>

<script>
import BaseIcon from './BaseIcon.vue'
export default {
  name: 'App',
  components: {
    BaseIcon,
  }
}
</script>
</code>```

My Index.js looks like this

```<code>/* eslint-disable import/prefer-default-export */
export { default as App } from './App.vue'
</code>```

Dev Dependencies in my Package.json are these:

```<code>"devDependencies": {
  "@babel/core": "^7.14.6",
  "@babel/preset-env": "^7.14.7",
  "@rollup/plugin-alias": "^3.1.2",
  "@rollup/plugin-babel": "^5.3.0",
  "@rollup/plugin-commonjs": "^14.0.0",
  "@rollup/plugin-node-resolve": "^9.0.0",
  "@rollup/plugin-replace": "^2.4.2",
  "@vue/cli-plugin-babel": "^4.5.13",
  "@vue/cli-service": "^4.5.13",
  "@vue/compiler-sfc": "^3.1.0-0",
  "cross-env": "^7.0.3",
  "minimist": "^1.2.5",
  "postcss": "^8.2.10",
  "rimraf": "^3.0.2",
  "rollup": "^2.52.8",
  "rollup-plugin-postcss": "^4.0.0",
  "rollup-plugin-terser": "^7.0.2",
  "rollup-plugin-vue": "^6.0.0",
  "vue-loader": "16.8.3",
  "vue-svg-loader": "^0.17.0-beta.2",
  "vue": "^3.0.5"
},
</code>```

and I've added vue.config.json with following settings:

```<code>module.exports = {
  chainWebpack: (config) => {
    const svgRule = config.module.rule('svg');

    svgRule.uses.clear();

    svgRule
      .use('babel-loader')
      .loader('babel-loader')
      .end()
      .use('vue-svg-loader')
      .loader('vue-svg-loader');
  },
};
</code>```

And here is what I am getting as error:

I'm not sure what I am missing here, or what is wrong.. Any kind of help will be appreciated, because its been days that I am stuck here and just couldn't get any idea of resolving this.

Body:
I am trying to create an SVG library using Vue3 but all I am getting is error...I created the basic library project following this article. Here is my file structure

and this is my code in BaseIcon.vue

<template>
  <component :is="iconComponent" class="inline-block fill-current"
    style="height: 1em; width: 1em; vertical-align: -0.125em" />
</template>

This is the App.vue file code

<template>

    <BaseIcon name="user" class="text-blue-500" /> Home
    <BaseIcon name="home" class="text-blue-500" /> Profile

</template>

My Index.js looks like this

/* eslint-disable import/prefer-default-export */
export { default as App } from './App.vue'

Dev Dependencies in my Package.json are these:

"devDependencies": {
  "@babel/core": "^7.14.6",
  "@babel/preset-env": "^7.14.7",
  "@rollup/plugin-alias": "^3.1.2",
  "@rollup/plugin-babel": "^5.3.0",
  "@rollup/plugin-commonjs": "^14.0.0",
  "@rollup/plugin-node-resolve": "^9.0.0",
  "@rollup/plugin-replace": "^2.4.2",
  "@vue/cli-plugin-babel": "^4.5.13",
  "@vue/cli-service": "^4.5.13",
  "@vue/compiler-sfc": "^3.1.0-0",
  "cross-env": "^7.0.3",
  "minimist": "^1.2.5",
  "postcss": "^8.2.10",
  "rimraf": "^3.0.2",
  "rollup": "^2.52.8",
  "rollup-plugin-postcss": "^4.0.0",
  "rollup-plugin-terser": "^7.0.2",
  "rollup-plugin-vue": "^6.0.0",
  "vue-loader": "16.8.3",
  "vue-svg-loader": "^0.17.0-beta.2",
  "vue": "^3.0.5"
},

and I've added vue.config.json with following settings:

module.exports = {
  chainWebpack: (config) => {
    const svgRule = config.module.rule('svg');

    svgRule.uses.clear();

    svgRule
      .use('babel-loader')
      .loader('babel-loader')
      .end()
      .use('vue-svg-loader')
      .loader('vue-svg-loader');
  },
};

And here is what I am getting as error:

I'm not sure what I am missing here, or what is wrong.. Any kind of help will be appreciated, because its been days that I am stuck here and just couldn't get any idea of resolving this.


问:
Unable to obtain the correct CSS layout on iOS devices (Eg: iPhones)
I'm unable to obtain the correct CSS design layout when viewed on an iPhone while when I view the same code on a Android, the CSS design layout works well. There are unnecessary spaces in the layout at some sections and some section even overlap each other.

Code:

(HTML sample code)

```<code>            <!-- ABOUT US SECTION(GLIMPSE OF US) -->
            <div class="about-section">
                <div class="about-us">
                    <h1 class="about-web">A GLIMPSE<br>OF US</h1>
                    <h1 class="about-mobile">A GLIMPSE OF US</h1>
                    <div class="text-plus-pointers">
                        <p class="about-us-text">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.</p>
                        <div class="adjectives">
                            <h1 class="the-value">LOREM IPSUM</h1>
                            <div class="frame14-list">
                                <div class="frame14"><img class="frame14-img" src="res/Check circle.png">
                                    <h1 class="frame14-text">valueone</h1>
                                </div>
                                <div class="frame14"><img class="frame14-img" src="res/Check circle.png">
                                    <h1 class="frame14-text">valuetwo</h1>
                                </div>
                                <div class="frame14"><img class="frame14-img" src="res/Check circle.png">
                                    <h1 class="frame14-text">valuethree</h1>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
</code>```

(Corresponding CSS sample code)

```<code>    .about-web{
        display: none;
    }
    .about-section {
        background: #F5F5F5;
        height: 130.5vw;
    }
    .about-us{
        flex-direction: column;
        justify-content: center;
        align-self: center;
        gap: 6vw;
        height: fit-content;
        width: 88%;
    }
    .about-mobile{
        display: flex;
        padding: 0;
        margin: 0;
        font-family: 'Roboto Condensed';
        font-style: normal;
        font-weight: 600;
        font-size: 9vw;
        line-height: 100%;
        width: 100%;
        letter-spacing: -0.04em;
        color: #222222;
    }
    .text-plus-pointers{
        width: 100%;
        gap: 5vw;
    }
    .about-us-text{
        font-size: 3.5vw;
        height: fit-content;
        margin: 0;
        padding: 0;
    }
    .the-value{
        display: flex;
        width: 65%;
        height: 100%;
        font-size: 5.5vw;
        line-height: 6.2vw;
    }
    .adjectives{
        height: fit-content;
        align-items: flex-start;
        padding: 11vw 9vw 11vw 9vw;
        gap: 3vw;
    }
    .frame14-list{
        width: 100%;
        gap: 1vw;
    }
    .frame14{
        height: 8vw;
        gap: 3vw;
    }
    .frame14-img {
        width: 5.5vw;
        height: 5.5vw;
    }
    .frame14-text{
        font-size: 5.5vw;
    }
</code>```

I've used all the properties like this only without any modification?

Need help with it. If there are any extensions that need to be added so that this code is also compatible with iOS smartphones.

Body:
I'm unable to obtain the correct CSS design layout when viewed on an iPhone while when I view the same code on a Android, the CSS design layout works well. There are unnecessary spaces in the layout at some sections and some section even overlap each other.

Code:

(HTML sample code)

A GLIMPSE
OF US

A GLIMPSE OF US

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.

LOREM IPSUM

valueone

valuetwo

valuethree

(Corresponding CSS sample code)

    .about-web{
        display: none;
    }
    .about-section {
        background: #F5F5F5;
        height: 130.5vw;
    }
    .about-us{
        flex-direction: column;
        justify-content: center;
        align-self: center;
        gap: 6vw;
        height: fit-content;
        width: 88%;
    }
    .about-mobile{
        display: flex;
        padding: 0;
        margin: 0;
        font-family: 'Roboto Condensed';
        font-style: normal;
        font-weight: 600;
        font-size: 9vw;
        line-height: 100%;
        width: 100%;
        letter-spacing: -0.04em;
        color: #222222;
    }
    .text-plus-pointers{
        width: 100%;
        gap: 5vw;
    }
    .about-us-text{
        font-size: 3.5vw;
        height: fit-content;
        margin: 0;
        padding: 0;
    }
    .the-value{
        display: flex;
        width: 65%;
        height: 100%;
        font-size: 5.5vw;
        line-height: 6.2vw;
    }
    .adjectives{
        height: fit-content;
        align-items: flex-start;
        padding: 11vw 9vw 11vw 9vw;
        gap: 3vw;
    }
    .frame14-list{
        width: 100%;
        gap: 1vw;
    }
    .frame14{
        height: 8vw;
        gap: 3vw;
    }
    .frame14-img {
        width: 5.5vw;
        height: 5.5vw;
    }
    .frame14-text{
        font-size: 5.5vw;
    }

I've used all the properties like this only without any modification?

Need help with it. If there are any extensions that need to be added so that this code is also compatible with iOS smartphones.


问:
In Angular, how to insert
 container on ckeditor5 content value?
I want to grouping ckeditor ngModel value in div container with ck-content css class;
Is it possible to put the content of the ckeditor in a div?  When using a build in angular

```<code> editor.model.schema.register( 'div', {
      inheritAllFrom: '$root',
      isLimit: true,
    } );

    editor.conversion.elementToElement( {
      model: 'div',
      view: 'div'
    } );

    // Trigger issue:
    setTimeout( () => {
      const block = editor.model.document.selection.getSelectedBlocks().next().value;

      editor.model.change( writer => {
        const myWidget = writer.createElement( 'div' );
        writer.insert( div, block, 'after' );
        writer.appendElement( 'paragraph', div );
        editor.ui.getEditableElement().parentElement.insertBefore(
          div,
          editor.ui.getEditableElement()
      );
      } );
    }, 1000 );
</code>```

Title: In Angular, how to insert <div class="..."> container on ckeditor5 content value?

Body:
I want to grouping ckeditor ngModel value in div container with ck-content css class;
Is it possible to put the content of the ckeditor in a div?  When using a build in angular

 editor.model.schema.register( 'div', {
      inheritAllFrom: '$root',
      isLimit: true,
    } );

    editor.conversion.elementToElement( {
      model: 'div',
      view: 'div'
    } );

    // Trigger issue:
    setTimeout( () => {
      const block = editor.model.document.selection.getSelectedBlocks().next().value;

      editor.model.change( writer => {
        const myWidget = writer.createElement( 'div' );
        writer.insert( div, block, 'after' );
        writer.appendElement( 'paragraph', div );
        editor.ui.getEditableElement().parentElement.insertBefore(
          div,
          editor.ui.getEditableElement()
      );
      } );
    }, 1000 );


问:
Handle unretryable exceptions on producer Kafka [Spring-boot]
I want to be able to catch unretryable exceptions when sending a message through kafkaTemplate and then send the message to a different error topic where I can investigate the message.

How it's easier to implement such a behavior on consumer side than in producer side ?

I understand that for some exceptions like RecordTooLargeException the message could not be send to the new topic either. But for these kind of messages I will log it to the system as warning.

I don't know how to approach this problem and what Kafka actually offer as functionality for this kind of handling on the producer side.


问:
Gradle exec block not using passed environment
I am trying to use npm to build some projects. In jenkins there are various node versions installed but I need to use a specific version of npm to build my project. I am passing the environement with 'PATH' variable value in exec block but it is not picking that path.

```<code>def pathEnvironment = [:]
    pathEnvironment["PATH"] = "/scratch/jenkins/.nvm/versions/node/v16.18.1/bin:" + System.getenv("PATH")

    exec {
        environment = pathEnvironment
        workingDir workspaceLocation
        commandLine "npm", "install"
    }
</code>```
```<code>exec {
        environment "PATH", "/scratch/jenkins/.nvm/versions/node/v16.18.1/bin:" + System.getenv("PATH")
        workingDir workspaceLocation
        commandLine "npm", "install"
    }
</code>```

I am getting error shown in above image.

I am using jenkins gradle plugin with gradle version 5.4.1.

What needs to be done to be able to set the path for the exec block?

Body:
I am trying to use npm to build some projects. In jenkins there are various node versions installed but I need to use a specific version of npm to build my project. I am passing the environement with 'PATH' variable value in exec block but it is not picking that path.

def pathEnvironment = [:]
    pathEnvironment["PATH"] = "/scratch/jenkins/.nvm/versions/node/v16.18.1/bin:" + System.getenv("PATH")

    exec {
        environment = pathEnvironment
        workingDir workspaceLocation
        commandLine "npm", "install"
    }

exec {
        environment "PATH", "/scratch/jenkins/.nvm/versions/node/v16.18.1/bin:" + System.getenv("PATH")
        workingDir workspaceLocation
        commandLine "npm", "install"
    }

I am getting error shown in above image.

I am using jenkins gradle plugin with gradle version 5.4.1.

What needs to be done to be able to set the path for the exec block?


问:
predicting vehicle utilization
predicting vehicle utilization :

dears this is my data for the full year (8000 records) ...and like to make prediction for next 3 months
could you please advice which Algorithm should i use and  any other advice...(i am beginner)

```<code>|Branch |month| date        |Util        |
|:----- |:---:|:-----------:|-----------:|
|1101   |1    |  2022-01-01 |  43.54     |
|1103   |1    |  2022-01-02 |  74.37     |
|1104   |1    |  2022-01-03 |  0         |
|1126   |2    |  2022-01-04 |  65.83     |
</code>```

Title: predicting vehicle utilization

Body:
predicting vehicle utilization :

dears this is my data for the full year (8000 records) ...and like to make prediction for next 3 months
could you please advice which Algorithm should i use and  any other advice...(i am beginner)

|Branch |month| date        |Util        |
|:----- |:---:|:-----------:|-----------:|
|1101   |1    |  2022-01-01 |  43.54     |
|1103   |1    |  2022-01-02 |  74.37     |
|1104   |1    |  2022-01-03 |  0         |
|1126   |2    |  2022-01-04 |  65.83     |


问:
How to prevent XSS in the url? or prevent execution of script tag in the url? https://example.com/about/?">
If I append a script tag to a url in the browser the script executes and then the page loads. I want to avoid the execution of the script tag. I tried redirecting to the encoded url using servlet filter and owasp java encoder. The script is getting triggered first and then encoding happens. How do I prevent the script tag from executing?

Server: Tomcat v8.5

Browser: Chrome, Edge

Below is the code for the servlet filter

public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
    HttpServletRequest httpServletRequest = ((HttpServletRequest) request);
    String queryString = httpServletRequest.getQueryString();
    if (queryString.contains("script")) {
        HttpServletRequest modifiedRequest = new HttpServletRequestWrapper((httpServletRequest)) {
            @Override
            public String getRequestURI() {
                String encodedQueryString = Encode.forUri(httpServletRequest.getQueryString());
                return httpServletRequest.getRequestURI() + "?" + encodedQueryString;
            }
        };
        chain.doFilter(modifiedRequest, response);
    } else {
        chain.doFilter(request, response);
    }
}
```

Title: How to prevent XSS in the url? or prevent execution of script tag in the url? https://example.com/about/?"><script>alert(1)</script>


问:
How to retry HTTP request when response in pending
I am making an HTTP request to the server to get a file upload status which takes a little time around 3 to 4 minutes. If the request is in the pending state or it has not returned the status of success or error then I want to recall the HTTP request until I get the response.
I am using a set timeout recursively, Is there any way to achieve it using RXJS operators

```<code>getImportStatus(): void {
        this.restaurantService
            .getImportStatus()
            .pipe(takeUntil(this.destroy$))
            .subscribe(
                (res) => {
                    if (
                        res.result.status == 'error' ||
                        res.result.status == 'success'
                    ) {
                        this.spinner.hide();
                        if (res.result.status == 'error') {
                            this.toastr.error(
                                res.result.restaurant.message,
                                'Error!'
                            );
                        } else {
                            this.toastr.success(
                                res.result.message,
                                'Success'
                            );
                        }
                    } else {
                       //retry the same http request
                        //after every three seconds
                        setTimeout(() => {
                            this.getImportStatus();
                        }, 3000);
                    }
                },
                (err) => {
                    console.log(err);
                }
            );
    }
</code>```

Body:
I am making an HTTP request to the server to get a file upload status which takes a little time around 3 to 4 minutes. If the request is in the pending state or it has not returned the status of success or error then I want to recall the HTTP request until I get the response.
I am using a set timeout recursively, Is there any way to achieve it using RXJS operators

getImportStatus(): void {
        this.restaurantService
            .getImportStatus()
            .pipe(takeUntil(this.destroy$))
            .subscribe(
                (res) => {
                    if (
                        res.result.status == 'error' ||
                        res.result.status == 'success'
                    ) {
                        this.spinner.hide();
                        if (res.result.status == 'error') {
                            this.toastr.error(
                                res.result.restaurant.message,
                                'Error!'
                            );
                        } else {
                            this.toastr.success(
                                res.result.message,
                                'Success'
                            );
                        }
                    } else {
                       //retry the same http request
                        //after every three seconds
                        setTimeout(() => {
                            this.getImportStatus();
                        }, 3000);
                    }
                },
                (err) => {
                    console.log(err);
                }
            );
    }


问:
A memory efficient and fast alternative to usual `expm()` function in MATLAB or Python?
People have asked similar questions before but none has a satisfactory answer. I'm trying to solve Lindblad Master Equation and the matrix size I'm trying to simulate are of order 10000 x 10000. But the problem is with exponentiation of the matrix, which is consuming a lot of RAM.

The MATLAB and Python expm() function take around 20s and 80s for a matrix of size 1000 x 1000 respectively. The code I've shown below.

pd = makedist('Normal');
N = 1000;
r = random(pd ,[N, N]);
t0 = tic;
r = expm(r);
t_total = toc(t0);
```

The problem comes when I try to do the same for a matrix of size 10000 x 10000. Whenever I apply expm(), the RAM usage grows and it take all the RAM and SWAP memory on my PC (I've 128 GB RAM and 64 Core CPU) and it's same in case of both MATLAB and Scipy. I don't understand what is taking so much RAM and how can I efficiently rum expm() or if it is not possible at all? Even if I could do it on any other language efficiently it would be really helpful!

Body:
People have asked similar questions before but none has a satisfactory answer. I'm trying to solve Lindblad Master Equation and the matrix size I'm trying to simulate are of order 10000 x 10000. But the problem is with exponentiation of the matrix, which is consuming a lot of RAM.

The MATLAB and Python expm() function take around 20s and 80s for a matrix of size 1000 x 1000 respectively. The code I've shown below.

pd = makedist('Normal');
N = 1000;
r = random(pd ,[N, N]);
t0 = tic;
r = expm(r);
t_total = toc(t0);

The problem comes when I try to do the same for a matrix of size 10000 x 10000. Whenever I apply expm(), the RAM usage grows and it take all the RAM and SWAP memory on my PC (I've 128 GB RAM and 64 Core CPU) and it's same in case of both MATLAB and Scipy. I don't understand what is taking so much RAM and how can I efficiently rum expm() or if it is not possible at all? Even if I could do it on any other language efficiently it would be really helpful!


问:
Unable to navigate to another view using controller in CodeIgniter3
Ive created a quiz application using code igniter 3. I want to send the answers the user chose to a 4 question mcq.Ive created a button to submit answers.

```<code><button id="submitBtn" onclick="evaluateQuiz()">Check Answers</button>
</code>```

and I have a created a evaluateQuiz method.I'll be sending the data to markQuiz function in the Controller called Quiz using AJAX.

evaluateQuiz function in view

```<code> function evaluateQuiz() {
        alert(JSON.stringify(quizQuestionData));

        var q1a = document.getElementsByName(quizQuestionData[0].questionId);
        var q2a = document.getElementsByName(quizQuestionData[1].questionId);
        var q3a = document.getElementsByName(quizQuestionData[2].questionId);
        var q4a = document.getElementsByName(quizQuestionData[3].questionId);
        var answer1, answer2, answer3, answer4;
        for (i = 0; i < q1a.length; i++) {
            if (q1a[i].checked)
                alert(q1a[i].value);
            answer1 = q1a[i].value;
        }
        for (x = 0; x < q2a.length; x++) {
            if (q2a[x].checked)
                alert(q2a[x].value);
            answer2 = q2a[x].value
        }
        for (y = 0; y < q3a.length; y++) {
            if (q3a[y].checked)
                alert(q3a[y].value);
            answer3 = q3a[y].value;
        }
        for (z = 0; z < q4a.length; z++) {
            if (q4a[z].checked)
                alert(q4a[z].value);
            answer4 = q4a[z].value;
        }
        $.ajax({
            url: "/CW2/ASSWDCW2/cw2app/index.php/Quiz/markQuiz",
            method: "GET",
            data: {
                'quizId': quizQuestionData[0].quizId,
                'answer1': answer1,
                'answer2': answer2,
                'answer3': answer3,
                'answer4': answer4,
                'correctAnswer1': quizQuestionData[0].correctAnswer,
                'correctAnswer2': quizQuestionData[1].correctAnswer,
                'correctAnswer3': quizQuestionData[2].correctAnswer,
                'correctAnswer4': quizQuestionData[3].correctAnswer,

            },
        }).done(function(data) {
            alert(JSON.stringify(data));
        });
        return false;
    }
</code>```

markQuiz function in controller

```<code> public function markQuiz()
{

    log_message('debug', "--------- CALLED EVALUATE----------");
    $this->load->view('messages/quiz_result_view');
}
</code>```

Right now all that markQuiz function is doing is, navigating to a view called quiz_result_view.
But on submitbutton press, it wont get directed to the quiz_result_view

Body:
Ive created a quiz application using code igniter 3. I want to send the answers the user chose to a 4 question mcq.Ive created a button to submit answers.

<button id="submitBtn" onclick="evaluateQuiz()">Check Answers</button>

and I have a created a evaluateQuiz method.I'll be sending the data to markQuiz function in the Controller called Quiz using AJAX.

evaluateQuiz function in view

 function evaluateQuiz() {
        alert(JSON.stringify(quizQuestionData));

        var q1a = document.getElementsByName(quizQuestionData[0].questionId);
        var q2a = document.getElementsByName(quizQuestionData[1].questionId);
        var q3a = document.getElementsByName(quizQuestionData[2].questionId);
        var q4a = document.getElementsByName(quizQuestionData[3].questionId);
        var answer1, answer2, answer3, answer4;
        for (i = 0; i < q1a.length; i++) {
            if (q1a[i].checked)
                alert(q1a[i].value);
            answer1 = q1a[i].value;
        }
        for (x = 0; x < q2a.length; x++) {
            if (q2a[x].checked)
                alert(q2a[x].value);
            answer2 = q2a[x].value
        }
        for (y = 0; y < q3a.length; y++) {
            if (q3a[y].checked)
                alert(q3a[y].value);
            answer3 = q3a[y].value;
        }
        for (z = 0; z < q4a.length; z++) {
            if (q4a[z].checked)
                alert(q4a[z].value);
            answer4 = q4a[z].value;
        }
        $.ajax({
            url: "/CW2/ASSWDCW2/cw2app/index.php/Quiz/markQuiz",
            method: "GET",
            data: {
                'quizId': quizQuestionData[0].quizId,
                'answer1': answer1,
                'answer2': answer2,
                'answer3': answer3,
                'answer4': answer4,
                'correctAnswer1': quizQuestionData[0].correctAnswer,
                'correctAnswer2': quizQuestionData[1].correctAnswer,
                'correctAnswer3': quizQuestionData[2].correctAnswer,
                'correctAnswer4': quizQuestionData[3].correctAnswer,

            },
        }).done(function(data) {
            alert(JSON.stringify(data));
        });
        return false;
    }

markQuiz function in controller

 public function markQuiz()
{

    log_message('debug', "--------- CALLED EVALUATE----------");
    $this->load->view('messages/quiz_result_view');
}

Right now all that markQuiz function is doing is, navigating to a view called quiz_result_view.
But on submitbutton press, it wont get directed to the quiz_result_view


问:
Images captured using CameraX are larger compared to images captured using Camera1
We are working on updating our legacy Camera application to use CameraX APIs instead of Camera1 APIs. We have used same camera configurations in both Camera1 and CameraX, we read the JPEG image byte array from Camera, in-memory and then upload that to a server. However, we have noticed that the byte array length that is got from CameraX is around 2X that of the byte array that we get from Camera1. Does CameraX output has some additional data or metadata in the byte array that is got in the callback? Or, are we doing something wrong while reading byte array from ImageProxy?

Camera Initialization in Camera1 along with setting target resolution, JPEG quality:

```<code>camera = Camera.open(cameraId); //cameraId is the ID of back camera
parameters = camera.getParameters();

//set target resolution to 1600 * 1200
parameters.setPictureSize(1600, 1200);

//set JPEG quality to 100
parameters.setJpegQuality(100);

//set image format to JPEG
setImageFormat(ImageFormat.JPEG);
</code>```

Camera Initliazation in CameraX along with setting target resolution, JPEG quality:

```<code>//select back camera
CameraSelector cameraSelector = CameraSelector.DEFAULT_BACK_CAMERA;

//create preview
Preview preview = new Preview.Builder().build();

//create Image Capture use case, set JPEG quality to 100, target resolution to 1600*1200
ImageCapture imageCapture = new ImageCapture.Builder()
        .setJpegQuality(100)
        .setTargetResolution(new Size(1600, 1200))
        .build();

//by default output format will be JPEG, no need to explicitly set it.

//start camera
provider.bindToLifecycle(
        this, cameraSelector, preview, imageCapture
);
</code>```

Callback method passed to takePicture method in Camera API:

```<code>camera.takePicture(shutterCallback, null, pictureTaken);

private Camera.PictureCallback pictureTaken = new Camera.PictureCallback() {
   @Override
   public void onPictureTaken(final byte[] data, final Camera camera){
         Log.d(“Data byte array length”, data.length); // for same image this is around 400000 bytes

       ///Logic to upload data to server
   }
</code>```

Callback method passed to takePicture method in CameraX API:

```<code>imageCapture.takePicture(ContextCompat.getMainExecutor(this),
    new ImageCapture.OnImageCapturedCallback() {
             @Override
             public void onCaptureSuccess(@NonNull ImageProxy imageProxy) {
            //convert imageProxy to byte array, image format is JPEG.
            ByteBuffer buffer = imageProxy.getPlanes()[0].getBuffer();
            buffer.rewind();
            byte[] data = new byte[buffer.capacity()];
            buffer.get(data);

            Log.d(“Data byte array length”, data.length); //for same image this is around 700000 bytes
        }

)
</code>```

Final image size is also considerably higher in CameraX implementation. In Camera its around 400kb and in CameraX its around 700kb. Is there any configuration we are missing or is there any metadata in the byte array that we need to strip off ?

Body:
We are working on updating our legacy Camera application to use CameraX APIs instead of Camera1 APIs. We have used same camera configurations in both Camera1 and CameraX, we read the JPEG image byte array from Camera, in-memory and then upload that to a server. However, we have noticed that the byte array length that is got from CameraX is around 2X that of the byte array that we get from Camera1. Does CameraX output has some additional data or metadata in the byte array that is got in the callback? Or, are we doing something wrong while reading byte array from ImageProxy?

Camera Initialization in Camera1 along with setting target resolution, JPEG quality:

camera = Camera.open(cameraId); //cameraId is the ID of back camera
parameters = camera.getParameters();

//set target resolution to 1600 * 1200
parameters.setPictureSize(1600, 1200);

//set JPEG quality to 100
parameters.setJpegQuality(100);

//set image format to JPEG
setImageFormat(ImageFormat.JPEG);

Camera Initliazation in CameraX along with setting target resolution, JPEG quality:

//select back camera
CameraSelector cameraSelector = CameraSelector.DEFAULT_BACK_CAMERA;

//create preview
Preview preview = new Preview.Builder().build();

//create Image Capture use case, set JPEG quality to 100, target resolution to 1600*1200
ImageCapture imageCapture = new ImageCapture.Builder()
        .setJpegQuality(100)
        .setTargetResolution(new Size(1600, 1200))
        .build();

//by default output format will be JPEG, no need to explicitly set it.

//start camera
provider.bindToLifecycle(
        this, cameraSelector, preview, imageCapture
);

Callback method passed to takePicture method in Camera API:

camera.takePicture(shutterCallback, null, pictureTaken);

private Camera.PictureCallback pictureTaken = new Camera.PictureCallback() {
   @Override
   public void onPictureTaken(final byte[] data, final Camera camera){
         Log.d(“Data byte array length”, data.length); // for same image this is around 400000 bytes

       ///Logic to upload data to server
   }

Callback method passed to takePicture method in CameraX API:

imageCapture.takePicture(ContextCompat.getMainExecutor(this),
    new ImageCapture.OnImageCapturedCallback() {
             @Override
             public void onCaptureSuccess(@NonNull ImageProxy imageProxy) {
            //convert imageProxy to byte array, image format is JPEG.
            ByteBuffer buffer = imageProxy.getPlanes()[0].getBuffer();
            buffer.rewind();
            byte[] data = new byte[buffer.capacity()];
            buffer.get(data);

            Log.d(“Data byte array length”, data.length); //for same image this is around 700000 bytes
        }

)

Final image size is also considerably higher in CameraX implementation. In Camera its around 400kb and in CameraX its around 700kb. Is there any configuration we are missing or is there any metadata in the byte array that we need to strip off ?