问:
Css Animation does not work on older safari browser, but works just fine on all other browsers
Animation bug only when on older safari version. It works just fine when using Safari 16.1 and other browsers.

Wanted behavior => https://www.veed.io/embed/00e7eed6-5a48-4838-8adc-734bf91f46fb

Unwanted behavior => https://www.veed.io/view/2ce920a2-3f48-4f3c-a13b-1315725e0487?sharingWidget=true&panel=share

I'm open to recreating the component instead of fixing the existing one.

CSS

```<code>.arrow-container {
   transform: rotate(180deg);
    position: relative;
    padding: 5px;

    > * {
        height: 2px;

        :first-of-type,
        :last-of-type {
            transform-origin: top left;
            transition-timing-function: 0.3s cubic-bezier(0.19, 1, 0.22, 1);
            transition-duration: 0.3s;
            transition-property: transform;
        }

        :first-of-type {
            transform: rotate(-45deg) translate(-2.1px, 1.3px);
        }

        :last-of-type {
            transform: rotate(45deg) translate(-1px, -2.3px);
        }

        :nth-child(2) {
            transform: scaleX(0);
            width: 1px;
            opacity: 0;
            transition-duration: 0.3s;
            transition-property: all;
        }
    }

    &:hover {
        > * {
            :first-of-type {
                transform: rotate(-45deg) translate(-8.5px, -5.4px);
            }

            :last-of-type {
                transform: rotate(45deg) translate(-7.5px, 4.4px);
            }

            :nth-child(2) {
                opacity: 1;
                transform: scaleX(20);
                transition-duration: 0.3s;
                transition-property: all;
            }
        }
    }
}
</code>```

Html-markup

```<code><div className="arrow-container">
      <div></div>
      <div></div>
      <div></div>
    </div>
</code>```

Body:
Animation bug only when on older safari version. It works just fine when using Safari 16.1 and other browsers.

Wanted behavior => https://www.veed.io/embed/00e7eed6-5a48-4838-8adc-734bf91f46fb

Unwanted behavior => https://www.veed.io/view/2ce920a2-3f48-4f3c-a13b-1315725e0487?sharingWidget=true&panel=share

I'm open to recreating the component instead of fixing the existing one.

CSS

.arrow-container {
   transform: rotate(180deg);
    position: relative;
    padding: 5px;

    > * {
        height: 2px;

        :first-of-type,
        :last-of-type {
            transform-origin: top left;
            transition-timing-function: 0.3s cubic-bezier(0.19, 1, 0.22, 1);
            transition-duration: 0.3s;
            transition-property: transform;
        }

        :first-of-type {
            transform: rotate(-45deg) translate(-2.1px, 1.3px);
        }

        :last-of-type {
            transform: rotate(45deg) translate(-1px, -2.3px);
        }

        :nth-child(2) {
            transform: scaleX(0);
            width: 1px;
            opacity: 0;
            transition-duration: 0.3s;
            transition-property: all;
        }
    }

    &:hover {
        > * {
            :first-of-type {
                transform: rotate(-45deg) translate(-8.5px, -5.4px);
            }

            :last-of-type {
                transform: rotate(45deg) translate(-7.5px, 4.4px);
            }

            :nth-child(2) {
                opacity: 1;
                transform: scaleX(20);
                transition-duration: 0.3s;
                transition-property: all;
            }
        }
    }
}

Html-markup


来源: stackexchange

问:
Sizing an SVG in Blazor server side application
I am sizing an SVG in a custom component in Blazor and getting odd results.

The code is below - please note that with the viewBox attribute ... setting the values of the 3rd and 4th valuese (width & height) lower actually INCREASES the size of the rendered image.   Setting to 80 x 80 puts the image well out of bounds of the container also, which is also 80 x 80.  I have to set it to around 120 to fit it the way I want which just seems wrong.

My objective is simply to size the SVG to the container of IconSvg.

```<code> <IconSvg FillColor="Black">
     <ImageContent>
         <MyPathData />
     </ImageContent>
 </IconSvg>
</code>```

Here is the IconSvg razor component:

```<code><svg viewBox="0 0 50 50" style="fill: @FillColor;">
    @ImageContent
</svg>

@code {
    [Parameter]
    public string FillColor { get; set; }

    [Parameter]
    public RenderFragment ImageContent { get; set; }
}
</code>```

Here is the path data itself (MyPathData.razor):

```<code><path d="M55.931,47.463L94.306,9.09c0.826-0.827,0.826-2.167,0-2.994L88.833,0.62C88.436,0.224,87.896,0,87.335,0
    c-0.562,0-1.101,0.224-1.498,0.62L47.463,38.994L9.089,0.62c-0.795-0.795-2.202-0.794-2.995,0L0.622,6.096
    c-0.827,0.827-0.827,2.167,0,2.994l38.374,38.373L0.622,85.836c-0.827,0.827-0.827,2.167,0,2.994l5.473,5.476
    c0.397,0.396,0.936,0.62,1.498,0.62s1.1-0.224,1.497-0.62l38.374-38.374l38.374,38.374c0.397,0.396,0.937,0.62,1.498,0.62
    s1.101-0.224,1.498-0.62l5.473-5.476c0.826-0.827,0.826-2.167,0-2.994L55.931,47.463z"/>
</code>```

ContentLicense: CC BY-SA 4.0

Body:
I am sizing an SVG in a custom component in Blazor and getting odd results.

The code is below - please note that with the viewBox attribute ... setting the values of the 3rd and 4th valuese (width & height) lower actually INCREASES the size of the rendered image.   Setting to 80 x 80 puts the image well out of bounds of the container also, which is also 80 x 80.  I have to set it to around 120 to fit it the way I want which just seems wrong.

My objective is simply to size the SVG to the container of IconSvg.

 <IconSvg FillColor="Black">
     <ImageContent>
         <MyPathData />
     </ImageContent>
 </IconSvg>

Here is the IconSvg razor component:

<svg viewBox="0 0 50 50" style="fill: @FillColor;">
    @ImageContent
</svg>

@code {
    [Parameter]
    public string FillColor { get; set; }

    [Parameter]
    public RenderFragment ImageContent { get; set; }
}

Here is the path data itself (MyPathData.razor):

<path d="M55.931,47.463L94.306,9.09c0.826-0.827,0.826-2.167,0-2.994L88.833,0.62C88.436,0.224,87.896,0,87.335,0
    c-0.562,0-1.101,0.224-1.498,0.62L47.463,38.994L9.089,0.62c-0.795-0.795-2.202-0.794-2.995,0L0.622,6.096
    c-0.827,0.827-0.827,2.167,0,2.994l38.374,38.373L0.622,85.836c-0.827,0.827-0.827,2.167,0,2.994l5.473,5.476
    c0.397,0.396,0.936,0.62,1.498,0.62s1.1-0.224,1.497-0.62l38.374-38.374l38.374,38.374c0.397,0.396,0.937,0.62,1.498,0.62
    s1.101-0.224,1.498-0.62l5.473-5.476c0.826-0.827,0.826-2.167,0-2.994L55.931,47.463z"/>


问:
Calculate python gaussian area
I'm trying to calculate the area under the curve of a Gaussian, I even managed to fit my data but I can't make an integral using this fit.
`

```<code>import numpy as np
from scipy.optimize import curve_fit
import matplotlib.pyplot as mpl

# Let's create a function to model and create data
def func(x, a, x0, sigma):
    return a*np.exp(-(x-x0)**2/(4*sigma**2))

# Generating clean data
x = dados.col1
y = dados.col2

# Adding noise to the data
yn = y + 0.2 * np.random.normal(size=len(x))

# Plot out the current state of the data and model
fig = mpl.figure()
ax = fig.add_subplot(111)
ax.plot(x, y, c='k', label='Function')
ax.scatter(x, yn)

# Executing curve_fit on noisy data
popt, pcov = curve_fit(func, x, yn)

#popt returns the best fit values for parameters of the given model (func)
print (popt)

ym = func(x, popt[0], popt[1], popt[2])
ax.plot(x, ym, c='r', label='Best fit')
ax.legend()
fig.savefig('model_fit.png')

</code>```

`

I hope to have the area of this function

Title: Calculate python gaussian area

Body:
I'm trying to calculate the area under the curve of a Gaussian, I even managed to fit my data but I can't make an integral using this fit.
`

import numpy as np
from scipy.optimize import curve_fit
import matplotlib.pyplot as mpl

# Let's create a function to model and create data
def func(x, a, x0, sigma):
    return a*np.exp(-(x-x0)**2/(4*sigma**2))

# Generating clean data
x = dados.col1
y = dados.col2

# Adding noise to the data
yn = y + 0.2 * np.random.normal(size=len(x))

# Plot out the current state of the data and model
fig = mpl.figure()
ax = fig.add_subplot(111)
ax.plot(x, y, c='k', label='Function')
ax.scatter(x, yn)

# Executing curve_fit on noisy data
popt, pcov = curve_fit(func, x, yn)

#popt returns the best fit values for parameters of the given model (func)
print (popt)

ym = func(x, popt[0], popt[1], popt[2])
ax.plot(x, ym, c='r', label='Best fit')
ax.legend()
fig.savefig('model_fit.png')

`

I hope to have the area of this function


问:
Failed to load in Laravel/maatwebsite/excel when export excel file
Developer!
I export excel from html view in Laravel/maatwebsite. It's going very well but if there have a "&" special character then occur an error. I find out it. But I couldn't solve it.
Please help me.
Error is like this.
PhpOffice\PhpSpreadsheet\Reader\Exception
Failed to load /home//*/storage/framework/cache/laravel-excel/laravel-excel-vRQ1Fp0mrWZjoXeFWJPGtI0M2DfylYeF.html as a DOM Document

I searched this problem in google but i didn't get any solution.


问:
Get the last certain years
I am looking to get the last couple of years worth of data that goes back to 1/1/2020 and need this to be the case as I pull the data next month and the month after that, etc. I don't want to have to change the -34 to -35, then -36 and so on to continue getting data 1/1/2020 to 2/28/2023 etc. Each month I refresh the stored procedure I need to keep 1/1/2020 but pick up to then end of the prior month. If I refresh my SP April 2023, I want to see 1/1/2020 through 3/31/2023. If I refresh my SP May 2023, I want to see 1/1/2020 through 4/30/2023. This is the below code I have.</p>
```<code>            start_receipt_date --between @startdatetime and @enddatetime
            between DATEADD(Day,1,DATEADD(MONTH,-34,EOMONTH(DATEADD(Month,-2,GETDATE()))))
            And EOMONTH(DATEADD(Month,-1,GETDATE()))
</code>```

Title: Get the last certain years

Body:
I am looking to get the last couple of years worth of data that goes back to 1/1/2020 and need this to be the case as I pull the data next month and the month after that, etc. I don't want to have to change the -34 to -35, then -36 and so on to continue getting data 1/1/2020 to 2/28/2023 etc. Each month I refresh the stored procedure I need to keep 1/1/2020 but pick up to then end of the prior month. If I refresh my SP April 2023, I want to see 1/1/2020 through 3/31/2023. If I refresh my SP May 2023, I want to see 1/1/2020 through 4/30/2023. This is the below code I have.

            start_receipt_date --between @startdatetime and @enddatetime
            between DATEADD(Day,1,DATEADD(MONTH,-34,EOMONTH(DATEADD(Month,-2,GETDATE()))))
            And EOMONTH(DATEADD(Month,-1,GETDATE()))


问:
Array Formula To Return List Based on Multiple Conditions
I am appareantly not entitled to add a comment under the actual forum topic directly, so for this reason a new question.

Using the index formula as described in the forum with the same title gives me a 'too few arguments' error in Excel O365.

What am I overlooking?

tried this (as given)

=INDEX(B2:B10676,SMALL(IF(A2:A10676=0,IF(C2:C10676="OPEN",IF(D2:D10676="Current",ROW(B2:B10676)-ROW(B2)+1)),ROW(INDIRECT("1:"&E2))))

ctrl + shift + enter

Got the message "too few arguments"


问:
How can I stop cropping of image being uploaded on a wordpress theme? It's giving me a crop failure error
I am trying to update my profile image on a Wordpress Sweet date theme to be specific but the process is failling giving me an error "There was a problem cropping your profile photo". Is there a way I can stop this cropping process and instead allow members to upload their profile photos directly with specific sizes?

I tried to upload my profile photo on that theme but generated a failure error stating cannot upload.


问:
Object are read only after 2nd run
I have built a script which works on a google form and create HTML templates from the rows.

There are two functions in the Objects.gs script file holding the objects needed:

basicObj()

```<code>*****
 ***  This Function returns the basic objects for the email
 */
function basicObj(sheet, column){
  // Get the Timestamp
  let timestamp_colNo = getColNoByName(sheet, "Timestamp")
  let timestamp       = column[timestamp_colNo]

  // Get the User's First Name
  let firstname_colNo = getColNoByName(sheet, "User_FirstN")
  let firstname       = column[firstname_colNo]

  // Get the User's Last Name
  let lastname_colNo  = getColNoByName(sheet, "User_LastN")
  let lastname        = column[lastname_colNo]

  // Get the Sender's Email Address
  let sender_colNo    = getColNoByName(sheet, "Email address")
  let sender          = column[sender_colNo]

  // Get the Lot Number
  let lot_no_colNo    = getColNoByName(sheet, "LotNo")
  let lot_no          = column[lot_no_colNo]

  // Get the Supplier
  let supplier_colNo  = getColNoByName(sheet, "ProperSupplier")
  let supplier        = column[supplier_colNo]

  // Lot Description
  let lot_descr_colNo = getColNoByName(sheet, "Tell us about the lot")
  let lot_description = column[lot_descr_colNo]

  // Document Folder
  let doc_folder_colNo = getColNoByName(sheet, "DocURL")
  let documents_folder = column[doc_folder_colNo]

  // Action on Material 1
  let mat1_action_colNo     = getColNoByName(sheet, "Material 1 Type of Action")
  let material1_action_type = column[mat1_action_colNo]
  if (material1_action_type === "Send Offer" || material1_action_type === "Add a 2nd material to the Offer"){
    material1_action_type = "OFFER"
  } else {
    material1_action_type = "BUY"
  }

  let returnObj = {
    timestamp: timestamp,
    firstname: firstname, // we need this for the mail
    lastname: lastname,   // we need this for the mail
    lot_no: lot_no,       // we need this for the mail
    sender: sender,
    supplier: supplier,
    lot_description: lot_description,
    documents_folder: documents_folder  // we need this for the mail (LINK 1)

    };
  return returnObj;
}
</code>```

and

mat1BasicObj

```<code>/*****
 ***  This Function returns the basic objects for the OFFER DETAILS of Material 1
 */
function mat1BasicObj(sheet, column){

  // Material 1 Initial Details
  let mat1_name_colNo      = getColNoByName(sheet, "Mat1Name")
  let material1_name       = column[mat1_name_colNo]
  let mat1_details_colNo   = getColNoByName(sheet, "Material 1 Additional Details")
  let material1_details    = column[mat1_details_colNo]
  let mat1_qty_colNo       = getColNoByName(sheet, "Material 1 Qty")
  let material1_qty        =  column[mat1_qty_colNo]
  let mat1_unit_colNo      = getColNoByName(sheet, "Material 1 Unit")
  let material1_unit       =  column[mat1_unit_colNo]
  let mat1_pack_colNo      =  getColNoByName(sheet, "Material 1 Packaging")
  let material1_packaging  =  column[mat1_pack_colNo]

  // Links to Picture Folders
  let mat1_offerpics_colNo = getColNoByName(sheet, "M1OfferPicsURL")
  let material1_offerpics  = column[mat1_offerpics_colNo]
  let mat1_sell1pics_colNo = getColNoByName(sheet, "M1SellPics1URL")
  let material1_sell1pics  = column[mat1_sell1pics_colNo]
  let mat1_sell2pics_colNo = getColNoByName(sheet, "M1SellPics2URL")
  let material1_sell2pics  = column[mat1_sell2pics_colNo]
  let mat1_recpics_colNo   = getColNoByName(sheet, "M1ReceptionPicsURL")
  let material1_recpics    = column[mat1_recpics_colNo]

  // Action on Material 1
  let mat1_action_colNo     = getColNoByName(sheet, "Material 1 Type of Action")
  let material1_action_type = column[mat1_action_colNo]
  if (material1_action_type === "Send Offer" || material1_action_type === "Add a 2nd material to the Offer"){
    material1_action_type = "OFFER"
  } else {
    material1_action_type = "BUY"
  }

  // Material 1 Supplier's Target
  let mat1_spT_price_colNo              = getColNoByName(sheet, "Material 1 Supplier's Target") // Action ?
  let material1_suppliertarget_price    = column[mat1_spT_price_colNo]
  let mat1_spT_cur_colNo                = getColNoByName(sheet, "Material 1 Supplier Target Currency")
  let material1_suppliertarget_currency = column[mat1_spT_cur_colNo]
  let mat1_spT_incot_colNo              = getColNoByName(sheet, "Material 1 Supplier Target Incoterm")
  let material1_suppliertarget_incot    = column[mat1_spT_incot_colNo]
  let mat1_spT_place_colNo              = getColNoByName(sheet, "Material 1 Supplier Target Place")
  let material1_suppliertarget_place    = column[mat1_spT_place_colNo]

  let material1_suppliertarget = material1_suppliertarget_price + " " + material1_suppliertarget_currency + " " + material1_suppliertarget_incot + " " + material1_suppliertarget_place

  let returnObj = {
    material1_name: material1_name,
    material1_details: material1_details,
    material1_qty: material1_qty,
    material1_unit: material1_unit,
    material1_packaging: material1_packaging,
    material1_offerpics: material1_offerpics,  // we need this for the mail (LINK 2 )
    material1_sell1pics: material1_sell1pics,  // we need this for the mail (LINK 3 )
    material1_sell2pics: material1_sell2pics,  // we need this for the mail (LINK 4 )
    material1_recpics: material1_recpics,      // we need this for the mail (LINK 5 )
    material1_action_type: material1_action_type,
    material1_suppliertarget: material1_suppliertarget
    };
  return returnObj;
}
</code>```

This is the main() Function which handles the project:

```<code>function main(){
  // let sheet = form_response_sheet

  // Get Data Range of form response sheet
  let data = form_response_sheet.getDataRange().getValues();

  // Shift the Data
  data.shift()

  // Iterate over the rows and columns
  data.forEach(function(column,index){

    // Get the objects of the lot status (if lot has been created and email has been sent)
    lot_status = check_LotCreated(form_response_sheet, column)

    if (lot_status.lot_created === false){
      // Create all Lot Subfolders and return their IDs
      folder_ids = createAllFolders(column, index)

      // Move all uploaded files to the lot Subfolders
      moveAllUploadedFiles(column, index, folder_ids)

      // Set LOT_CREATED flag to LOT_CREATED column
      form_response_sheet.getRange(index + 2, lot_status.lot_created_status_colNo + 1).setValue("LOT_CREATED")

      if (lot_status.email_sent === false){       /// <<<<<<<<<THIS IS OUR EMAIL FUNCTION below
        emailMaster(form_response_sheet, column, index, lot_status.col_no_email_sent_status)
      }

    } else {

    if (lot_status.email_sent === false){
      emailMaster(form_response_sheet, column, index, lot_status.col_no_email_sent_status)

    }}
  })
}

</code>```

It goes over to the emailMaster() Function, it handles :

```<code>*****
 ***  This Function determines which objects are needed and composes multiple Emails to be send by     ******the sendEmail function
 ***  After completion it sets the EMAIL_SENT tag to the cell of the lot
 */

function emailMaster(sheet, column, index, col_no_email_sent_status){

  // Get the Names of Material 2 + 3
  let mat2_name_colNo = getColNoByName(sheet,"Mat2Name")
  let mat2_name = column[mat2_name_colNo]
  let mat3_name_colNo = getColNoByName(sheet,"Mat3Name")
  let mat3_name = column[mat3_name_colNo]

  // Get the Action Types of material 2-3
  let mat2_action_colNo = getColNoByName(sheet, "Material 2 Type of Action")
  let mat2_actiontype   = column[mat2_action_colNo]
  let mat3_action_colNo = getColNoByName(sheet, "Material 3 Type of Action")
  let mat3_actiontype   = column[mat3_action_colNo]

  // The receiver of the Email
  // let emailReceiver = "anschuster@eco-remarketing.com"
  let emailReceiver = "jakob.mailto@gmail.com"

  // Return the Basic Objects of the Offer
  basic = basicObj(sheet, column)

  // Return the Basic Objects of the Offer of Material 1
  m1basic = mat1BasicObj(sheet, column)

  //  Declare templ_offer Variable: This Variable will hold the html content of the email body
  let templ_offer;

  // The Subject of the Email
  let emailSubject = basic.lot_no

  // Get the html content of the template for the email body
  //
  // If only 1 material present > get template for 1 Material scenario
  if (mat2_name === "" && mat3_name === ""){
    // get the offer template for 1 material
    templ_offer = get_offer_template_1mat(sheet, column, templ_offer)

  // If 2 materials present > get template for 1 Material scenario
  } else if (mat2_name !== "" && mat3_name === ""){
    // get the offer template for 2 materials
    templ_offer = get_offer_template_2mat(sheet, column, templ_offer)

  // If 3 materials present > get template for 1 Material scenario
  } else {
    // get the offer template for 3 materials
    templ_offer = get_offer_template_3mat(sheet, column)
  }

  // load the contents of the email body from the template
  let emailBody = templ_offer.evaluate().getContent();

  Logger.log (emailBody)

  sendEmail(emailReceiver, emailSubject, emailBody)

  // Set EMAIL_SENT to column
  sheet.getRange(index + 2,col_no_email_sent_status + 1).setValue("EMAIL_SENT")
}

</code>```

It then calls the subsequent function get_offer_template_1mat(), where the problem occurs:

```<code>/*****
 ***  This Function creates a template for a 1 Material scenario
 */
function get_offer_template_1mat(sheet, column, templ_offer){

  if (m1basic.material1_action_type === "OFFER"){

    //Logger.log(document_link)

    Logger.log("{get_offer_template_1mat}: [basic]: " + basic)
    Logger.log("{get_offer_template_1mat}: [m1basic]: " + m1basic)

    Logger.log("1 Material Offer")

    Logger.log("BEFORE")
    Logger.log("{get_offer_template_1mat}: [basic.documents_folder]: " + basic.documents_folder)
    Logger.log("{get_offer_template_1mat}: [m1basic.material1_offerpics]: " + m1basic.material1_offerpics)
    Logger.log("{get_offer_template_1mat}: [m1basic.material1_sell1pics]: " + m1basic.material1_sell1pics)
    Logger.log("{get_offer_template_1mat}: [m1basic.material1_sell2pics]: " + m1basic.material1_sell2pics)
    Logger.log("{get_offer_template_1mat}: [m1basic.material1_recpics]: " + m1basic.material1_recpics)

    // Load the Offer's HTML Template
    templ_offer = HtmlService.createTemplateFromFile('templ_1mat.html')

    Logger.log("INBETWEEN")
    Logger.log("{get_offer_template_1mat}: [basic.documents_folder]: " + basic.documents_folder)
    Logger.log("{get_offer_template_1mat}: [m1basic.material1_offerpics]: " + m1basic.material1_offerpics)
    Logger.log("{get_offer_template_1mat}: [m1basic.material1_sell1pics]: " + m1basic.material1_sell1pics)
    Logger.log("{get_offer_template_1mat}: [m1basic.material1_sell2pics]: " + m1basic.material1_sell2pics)
    Logger.log("{get_offer_template_1mat}: [m1basic.material1_recpics]: " + m1basic.material1_recpics)

    // Load basic objects into the template as basic
    templ_offer.basic = basic;

    // Load m1basic objects into the template as m1basic
    templ_offer.m1basic = m1basic;

    Logger.log("AFTER")
    Logger.log("{get_offer_template_1mat}: [basic.documents_folder]: " + basic.documents_folder)
    Logger.log("{get_offer_template_1mat}: [m1basic.material1_offerpics]: " + m1basic.material1_offerpics)
    Logger.log("{get_offer_template_1mat}: [m1basic.material1_sell1pics]: " + m1basic.material1_sell1pics)
    Logger.log("{get_offer_template_1mat}: [m1basic.material1_sell2pics]: " + m1basic.material1_sell2pics)
    Logger.log("{get_offer_template_1mat}: [m1basic.material1_recpics]: " + m1basic.material1_recpics)

  } else { // "MAT1 BUY"

    // Get the Objects needed for the Buy scenarios
    m1Buy = load_mat1_BuyObj(sheet, column)

    // Load the Offer's HTML Template
    templ_offer = HtmlService.createTemplateFromFile('templ_1mat.html')

    // Load basic objects into the template as basic
    templ_offer.basic = basic;
    // Load m1Buy Objects into the template as m1Buy
    templ_offer.m1Buy = m1Buy;

    Logger.log(m1Buy.initial)
    Logger.log(m1Buy.buy_type)
    Logger.log(m1Buy.buy_type.material1_buy_fixedprice_price)

  }

  return templ_offer;

}
</code>```

The strange thing is that the first run does return all objects BUT the links:

```<code>    material1_offerpics: material1_offerpics,  // we need this for the mail (LINK 2)
    material1_sell1pics: material1_sell1pics,  // we need this for the mail (LINK 3)
    material1_sell2pics: material1_sell2pics,  // we need this for the mail (LINK 4)
    material1_recpics: material1_recpics,      // we need this for the mail (LINK 5)
</code>```

On the 2nd run... everything works and the Links are there.

I checked by the Logger.log() statements to check whether the html template does not work with the scriptlets > it is not the template but the variables are simply not returned.

Then EMAIL_SENT was removed from the column by hand (script only runs if the template is not

```<code>if (email_sent_status !== "EMAIL_SENT"){
    email_sent = false
  } else {
    email_sent = true
  }
</code>```
```<code>On the 2nd run however it WORKS!

without any changes to the script.

Please help...

</code>```

`

Title: Object are read only after 2nd run

Body:
I have built a script which works on a google form and create HTML templates from the rows.

There are two functions in the Objects.gs script file holding the objects needed:

basicObj()

*****
 ***  This Function returns the basic objects for the email
 */
function basicObj(sheet, column){
  // Get the Timestamp
  let timestamp_colNo = getColNoByName(sheet, "Timestamp")
  let timestamp       = column[timestamp_colNo]

  // Get the User's First Name
  let firstname_colNo = getColNoByName(sheet, "User_FirstN")
  let firstname       = column[firstname_colNo]

  // Get the User's Last Name
  let lastname_colNo  = getColNoByName(sheet, "User_LastN")
  let lastname        = column[lastname_colNo]

  // Get the Sender's Email Address
  let sender_colNo    = getColNoByName(sheet, "Email address")
  let sender          = column[sender_colNo]

  // Get the Lot Number
  let lot_no_colNo    = getColNoByName(sheet, "LotNo")
  let lot_no          = column[lot_no_colNo]

  // Get the Supplier
  let supplier_colNo  = getColNoByName(sheet, "ProperSupplier")
  let supplier        = column[supplier_colNo]

  // Lot Description
  let lot_descr_colNo = getColNoByName(sheet, "Tell us about the lot")
  let lot_description = column[lot_descr_colNo]

  // Document Folder
  let doc_folder_colNo = getColNoByName(sheet, "DocURL")
  let documents_folder = column[doc_folder_colNo]

  // Action on Material 1
  let mat1_action_colNo     = getColNoByName(sheet, "Material 1 Type of Action")
  let material1_action_type = column[mat1_action_colNo]
  if (material1_action_type === "Send Offer" || material1_action_type === "Add a 2nd material to the Offer"){
    material1_action_type = "OFFER"
  } else {
    material1_action_type = "BUY"
  }

  let returnObj = {
    timestamp: timestamp,
    firstname: firstname, // we need this for the mail
    lastname: lastname,   // we need this for the mail
    lot_no: lot_no,       // we need this for the mail
    sender: sender,
    supplier: supplier,
    lot_description: lot_description,
    documents_folder: documents_folder  // we need this for the mail (LINK 1)

    };
  return returnObj;
}

and

mat1BasicObj

/*****
 ***  This Function returns the basic objects for the OFFER DETAILS of Material 1
 */
function mat1BasicObj(sheet, column){

  // Material 1 Initial Details
  let mat1_name_colNo      = getColNoByName(sheet, "Mat1Name")
  let material1_name       = column[mat1_name_colNo]
  let mat1_details_colNo   = getColNoByName(sheet, "Material 1 Additional Details")
  let material1_details    = column[mat1_details_colNo]
  let mat1_qty_colNo       = getColNoByName(sheet, "Material 1 Qty")
  let material1_qty        =  column[mat1_qty_colNo]
  let mat1_unit_colNo      = getColNoByName(sheet, "Material 1 Unit")
  let material1_unit       =  column[mat1_unit_colNo]
  let mat1_pack_colNo      =  getColNoByName(sheet, "Material 1 Packaging")
  let material1_packaging  =  column[mat1_pack_colNo]

  // Links to Picture Folders
  let mat1_offerpics_colNo = getColNoByName(sheet, "M1OfferPicsURL")
  let material1_offerpics  = column[mat1_offerpics_colNo]
  let mat1_sell1pics_colNo = getColNoByName(sheet, "M1SellPics1URL")
  let material1_sell1pics  = column[mat1_sell1pics_colNo]
  let mat1_sell2pics_colNo = getColNoByName(sheet, "M1SellPics2URL")
  let material1_sell2pics  = column[mat1_sell2pics_colNo]
  let mat1_recpics_colNo   = getColNoByName(sheet, "M1ReceptionPicsURL")
  let material1_recpics    = column[mat1_recpics_colNo]

  // Action on Material 1
  let mat1_action_colNo     = getColNoByName(sheet, "Material 1 Type of Action")
  let material1_action_type = column[mat1_action_colNo]
  if (material1_action_type === "Send Offer" || material1_action_type === "Add a 2nd material to the Offer"){
    material1_action_type = "OFFER"
  } else {
    material1_action_type = "BUY"
  }

  // Material 1 Supplier's Target
  let mat1_spT_price_colNo              = getColNoByName(sheet, "Material 1 Supplier's Target") // Action ?
  let material1_suppliertarget_price    = column[mat1_spT_price_colNo]
  let mat1_spT_cur_colNo                = getColNoByName(sheet, "Material 1 Supplier Target Currency")
  let material1_suppliertarget_currency = column[mat1_spT_cur_colNo]
  let mat1_spT_incot_colNo              = getColNoByName(sheet, "Material 1 Supplier Target Incoterm")
  let material1_suppliertarget_incot    = column[mat1_spT_incot_colNo]
  let mat1_spT_place_colNo              = getColNoByName(sheet, "Material 1 Supplier Target Place")
  let material1_suppliertarget_place    = column[mat1_spT_place_colNo]

  let material1_suppliertarget = material1_suppliertarget_price + " " + material1_suppliertarget_currency + " " + material1_suppliertarget_incot + " " + material1_suppliertarget_place

  let returnObj = {
    material1_name: material1_name,
    material1_details: material1_details,
    material1_qty: material1_qty,
    material1_unit: material1_unit,
    material1_packaging: material1_packaging,
    material1_offerpics: material1_offerpics,  // we need this for the mail (LINK 2 )
    material1_sell1pics: material1_sell1pics,  // we need this for the mail (LINK 3 )
    material1_sell2pics: material1_sell2pics,  // we need this for the mail (LINK 4 )
    material1_recpics: material1_recpics,      // we need this for the mail (LINK 5 )
    material1_action_type: material1_action_type,
    material1_suppliertarget: material1_suppliertarget
    };
  return returnObj;
}

This is the main() Function which handles the project:

function main(){
  // let sheet = form_response_sheet

  // Get Data Range of form response sheet
  let data = form_response_sheet.getDataRange().getValues();

  // Shift the Data
  data.shift()

  // Iterate over the rows and columns
  data.forEach(function(column,index){

    // Get the objects of the lot status (if lot has been created and email has been sent)
    lot_status = check_LotCreated(form_response_sheet, column)

    if (lot_status.lot_created === false){
      // Create all Lot Subfolders and return their IDs
      folder_ids = createAllFolders(column, index)

      // Move all uploaded files to the lot Subfolders
      moveAllUploadedFiles(column, index, folder_ids)

      // Set LOT_CREATED flag to LOT_CREATED column
      form_response_sheet.getRange(index + 2, lot_status.lot_created_status_colNo + 1).setValue("LOT_CREATED")

      if (lot_status.email_sent === false){       /// <<<<<<<<<THIS IS OUR EMAIL FUNCTION below
        emailMaster(form_response_sheet, column, index, lot_status.col_no_email_sent_status)
      }

    } else {

    if (lot_status.email_sent === false){
      emailMaster(form_response_sheet, column, index, lot_status.col_no_email_sent_status)

    }}
  })
}

It goes over to the emailMaster() Function, it handles :

*****
 ***  This Function determines which objects are needed and composes multiple Emails to be send by     ******the sendEmail function
 ***  After completion it sets the EMAIL_SENT tag to the cell of the lot
 */

function emailMaster(sheet, column, index, col_no_email_sent_status){

  // Get the Names of Material 2 + 3
  let mat2_name_colNo = getColNoByName(sheet,"Mat2Name")
  let mat2_name = column[mat2_name_colNo]
  let mat3_name_colNo = getColNoByName(sheet,"Mat3Name")
  let mat3_name = column[mat3_name_colNo]

  // Get the Action Types of material 2-3
  let mat2_action_colNo = getColNoByName(sheet, "Material 2 Type of Action")
  let mat2_actiontype   = column[mat2_action_colNo]
  let mat3_action_colNo = getColNoByName(sheet, "Material 3 Type of Action")
  let mat3_actiontype   = column[mat3_action_colNo]

  // The receiver of the Email
  // let emailReceiver = "anschuster@eco-remarketing.com"
  let emailReceiver = "jakob.mailto@gmail.com"

  // Return the Basic Objects of the Offer
  basic = basicObj(sheet, column)

  // Return the Basic Objects of the Offer of Material 1
  m1basic = mat1BasicObj(sheet, column)

  //  Declare templ_offer Variable: This Variable will hold the html content of the email body
  let templ_offer;

  // The Subject of the Email
  let emailSubject = basic.lot_no

  // Get the html content of the template for the email body
  //
  // If only 1 material present > get template for 1 Material scenario
  if (mat2_name === "" && mat3_name === ""){
    // get the offer template for 1 material
    templ_offer = get_offer_template_1mat(sheet, column, templ_offer)

  // If 2 materials present > get template for 1 Material scenario
  } else if (mat2_name !== "" && mat3_name === ""){
    // get the offer template for 2 materials
    templ_offer = get_offer_template_2mat(sheet, column, templ_offer)

  // If 3 materials present > get template for 1 Material scenario
  } else {
    // get the offer template for 3 materials
    templ_offer = get_offer_template_3mat(sheet, column)
  }

  // load the contents of the email body from the template
  let emailBody = templ_offer.evaluate().getContent();

  Logger.log (emailBody)

  sendEmail(emailReceiver, emailSubject, emailBody)

  // Set EMAIL_SENT to column
  sheet.getRange(index + 2,col_no_email_sent_status + 1).setValue("EMAIL_SENT")
}

It then calls the subsequent function get_offer_template_1mat(), where the problem occurs:

/*****
 ***  This Function creates a template for a 1 Material scenario
 */
function get_offer_template_1mat(sheet, column, templ_offer){

  if (m1basic.material1_action_type === "OFFER"){

    //Logger.log(document_link)

    Logger.log("{get_offer_template_1mat}: [basic]: " + basic)
    Logger.log("{get_offer_template_1mat}: [m1basic]: " + m1basic)

    Logger.log("1 Material Offer")

    Logger.log("BEFORE")
    Logger.log("{get_offer_template_1mat}: [basic.documents_folder]: " + basic.documents_folder)
    Logger.log("{get_offer_template_1mat}: [m1basic.material1_offerpics]: " + m1basic.material1_offerpics)
    Logger.log("{get_offer_template_1mat}: [m1basic.material1_sell1pics]: " + m1basic.material1_sell1pics)
    Logger.log("{get_offer_template_1mat}: [m1basic.material1_sell2pics]: " + m1basic.material1_sell2pics)
    Logger.log("{get_offer_template_1mat}: [m1basic.material1_recpics]: " + m1basic.material1_recpics)

    // Load the Offer's HTML Template
    templ_offer = HtmlService.createTemplateFromFile('templ_1mat.html')

    Logger.log("INBETWEEN")
    Logger.log("{get_offer_template_1mat}: [basic.documents_folder]: " + basic.documents_folder)
    Logger.log("{get_offer_template_1mat}: [m1basic.material1_offerpics]: " + m1basic.material1_offerpics)
    Logger.log("{get_offer_template_1mat}: [m1basic.material1_sell1pics]: " + m1basic.material1_sell1pics)
    Logger.log("{get_offer_template_1mat}: [m1basic.material1_sell2pics]: " + m1basic.material1_sell2pics)
    Logger.log("{get_offer_template_1mat}: [m1basic.material1_recpics]: " + m1basic.material1_recpics)

    // Load basic objects into the template as basic
    templ_offer.basic = basic;

    // Load m1basic objects into the template as m1basic
    templ_offer.m1basic = m1basic;

    Logger.log("AFTER")
    Logger.log("{get_offer_template_1mat}: [basic.documents_folder]: " + basic.documents_folder)
    Logger.log("{get_offer_template_1mat}: [m1basic.material1_offerpics]: " + m1basic.material1_offerpics)
    Logger.log("{get_offer_template_1mat}: [m1basic.material1_sell1pics]: " + m1basic.material1_sell1pics)
    Logger.log("{get_offer_template_1mat}: [m1basic.material1_sell2pics]: " + m1basic.material1_sell2pics)
    Logger.log("{get_offer_template_1mat}: [m1basic.material1_recpics]: " + m1basic.material1_recpics)

  } else { // "MAT1 BUY"

    // Get the Objects needed for the Buy scenarios
    m1Buy = load_mat1_BuyObj(sheet, column)

    // Load the Offer's HTML Template
    templ_offer = HtmlService.createTemplateFromFile('templ_1mat.html')

    // Load basic objects into the template as basic
    templ_offer.basic = basic;
    // Load m1Buy Objects into the template as m1Buy
    templ_offer.m1Buy = m1Buy;

    Logger.log(m1Buy.initial)
    Logger.log(m1Buy.buy_type)
    Logger.log(m1Buy.buy_type.material1_buy_fixedprice_price)

  }

  return templ_offer;

}

The strange thing is that the first run does return all objects BUT the links:

    material1_offerpics: material1_offerpics,  // we need this for the mail (LINK 2)
    material1_sell1pics: material1_sell1pics,  // we need this for the mail (LINK 3)
    material1_sell2pics: material1_sell2pics,  // we need this for the mail (LINK 4)
    material1_recpics: material1_recpics,      // we need this for the mail (LINK 5)

On the 2nd run... everything works and the Links are there.

I checked by the Logger.log() statements to check whether the html template does not work with the scriptlets > it is not the template but the variables are simply not returned.

Then EMAIL_SENT was removed from the column by hand (script only runs if the template is not

if (email_sent_status !== "EMAIL_SENT"){
    email_sent = false
  } else {
    email_sent = true
  }

On the 2nd run however it WORKS!

without any changes to the script.

Please help...

`


问:
New Windows installation, CLI not picking up .bigqueryrc
I had a Windows 10 machine working great with bq/gloud and gsutils all working great.  Had to move to new machine and setting all of this back up.  I cannot seem to get bq to recognize the entries in my .bigqueryrc file which was copied from my working machine.  On my working machine, I am not using BIGQUERYRC environmental file, but just HOME, ie ~/.bigqueryrc

I say it does not seem to recognize is because if I introduce a random character I get an error about my .bigqueryrc file.

Let me first show that bq seems to be operating, overall, as expected

```<code>C:\Users\boyer>bq ls --project_id=broad-tapestry-sbx-boyer-14
    datasetId
 ---------------
  Broad_DataGov
  Broad_EDW
  Broad_Kitchen
  Broad_Lake
  Broad_Tableau
  Broad_Utils
</code>```

SHELL> bq ls brings nothing.  The contents of my .biqqueryrc file is as thus:

```<code>credential_file = C:\Users\boyer\AppData\Roaming\gcloud\legacy_credentials\boyer@broadinstitute.org\singlestore_bq.json
project_id = broad-tapestry-sbx-boyer-14

[query]
--use_legacy_sql=false
</code>```

Here is showing where my .bigqueryrc file is:

```<code>:\Users\boyer>ls -ls ~/.bigqueryrc
1 -rwx------+ 1 CHARLES+boyer CHARLES+boyer 198 Dec 22 12:48 /cygdrive/c/Users/boyer/.bigqueryrc
</code>```

So, I try this and nothing happens either:

```<code>C:\Users\boyer>bq ls --bigqueryrc=c:/users/boyer/.bigqueryrc

C:\Users\boyer>bq ls --bigqueryrc=c:\users\boyer\.bigqueryrc

C:\Users\boyer>
</code>```

But here is the error I purposefully introduced to see if it is actually looking at the file and it seems it is finding it.

```<code>C:\Users\boyer>bq ls --bigqueryrc=c:\users\boyer\.bigqueryrc
Unknown flag x found in bigqueryrc file in section global
</code>```

The error above was introduced by adding a random 'x' character to the top of the file:

```<code>x
credential_file = C:\Users\boyer\AppData\Roaming\gcloud\legacy_credentials\boyer@broadinstitute.org\singlestore_bq.json
project_id = broad-tapestry-sbx-boyer-14

[query]
--use_legacy_sql=false
</code>```

Body:
I had a Windows 10 machine working great with bq/gloud and gsutils all working great.  Had to move to new machine and setting all of this back up.  I cannot seem to get bq to recognize the entries in my .bigqueryrc file which was copied from my working machine.  On my working machine, I am not using BIGQUERYRC environmental file, but just HOME, ie ~/.bigqueryrc

I say it does not seem to recognize is because if I introduce a random character I get an error about my .bigqueryrc file.

Let me first show that bq seems to be operating, overall, as expected

C:\Users\boyer>bq ls --project_id=broad-tapestry-sbx-boyer-14
    datasetId
 ---------------
  Broad_DataGov
  Broad_EDW
  Broad_Kitchen
  Broad_Lake
  Broad_Tableau
  Broad_Utils

SHELL> bq ls brings nothing.  The contents of my .biqqueryrc file is as thus:

credential_file = C:\Users\boyer\AppData\Roaming\gcloud\legacy_credentials\boyer@broadinstitute.org\singlestore_bq.json
project_id = broad-tapestry-sbx-boyer-14

[query]
--use_legacy_sql=false

Here is showing where my .bigqueryrc file is:

:\Users\boyer>ls -ls ~/.bigqueryrc
1 -rwx------+ 1 CHARLES+boyer CHARLES+boyer 198 Dec 22 12:48 /cygdrive/c/Users/boyer/.bigqueryrc

So, I try this and nothing happens either:

C:\Users\boyer>bq ls --bigqueryrc=c:/users/boyer/.bigqueryrc

C:\Users\boyer>bq ls --bigqueryrc=c:\users\boyer\.bigqueryrc

C:\Users\boyer>

But here is the error I purposefully introduced to see if it is actually looking at the file and it seems it is finding it.

C:\Users\boyer>bq ls --bigqueryrc=c:\users\boyer\.bigqueryrc
Unknown flag x found in bigqueryrc file in section global

The error above was introduced by adding a random 'x' character to the top of the file:

x
credential_file = C:\Users\boyer\AppData\Roaming\gcloud\legacy_credentials\boyer@broadinstitute.org\singlestore_bq.json
project_id = broad-tapestry-sbx-boyer-14

[query]
--use_legacy_sql=false


问:
How send origin in Next.js request (ISR)?
I have the multilanguege app in next.js with ISR. Data fetch using graphQL. The API return data for a given language after getting origin from header request. Unfortunately, If I do it in function getStaticProps() then origin is empty. How Can I submit origin which domain is request?

In example below use apollo client.
The origin header is not visible in the API.
Where should I type something?
How can I submit this origin?

```<code>
export const APOLLO_STATE_PROP_NAME = '__APOLLO_STATE__'

let apolloClient: ApolloClient<NormalizedCacheObject> | undefined

const createApolloClient = (headers: IncomingHttpHeaders | null = null) => {
    const enhancedFetch = (url: RequestInfo, init: RequestInit) => {
        return fetch(url, {
            ...init,
            headers: {
                ...init.headers,
                Cookie: headers?.cookie ?? '',
            },
        }).then((response) => {
            return response
        })
    }
    return new ApolloClient({
        ssrMode: typeof window === 'undefined',
        link: ApolloLink.from([
            onError(({ graphQLErrors, networkError, operation, forward, response }) => {
                if (graphQLErrors) {
                    graphQLErrors.forEach(({ message, locations, path, }) =>
                        console.error(
                            `[GraphQL error]: Message: ${message}, Location: ${locations}, Path: ${path}`
                        )
                    )
                }
                if (networkError)
                    console.error(
                        `[Network error]: ${networkError}. Backend is unreachable. Is it running?`
                    )
            }),

            createUploadLink({
                uri: "https://api.url_site/api/graphql",
                fetchOptions: {
                    mode: 'cors',
                },
                credentials: 'same-origin',
                fetch: enhancedFetch,
            }),
        ]),

        cache: new InMemoryCache(),
    })
type InitialState = NormalizedCacheObject | undefined

interface IInitializeApollo {
    headers?: IncomingHttpHeaders | null
    initialState?: InitialState | null
}

export const initializeApollo = (
    { headers, initialState }: IInitializeApollo = {
        headers: {
            // 'Access-Control-Allow-Origin': '*'
        },
        initialState: null,
    }
) => {
    const _apolloClient = apolloClient ?? createApolloClient(headers)
    if (initialState) {
        const existingCache = _apolloClient.extract()
        const data = merge(existingCache, initialState, {
            arrayMerge: (destinationArray, sourceArray) => [
                ...sourceArray,
                ...destinationArray.filter((d) =>
                    sourceArray.every((s) => !isEqual(d, s))
                ),
            ],
        })
        _apolloClient.cache.restore(data)
    }
    if (typeof window === 'undefined') return _apolloClient
    if (!apolloClient) apolloClient = _apolloClient
    return _apolloClient
}

export function addApolloState(
    client: ApolloClient<NormalizedCacheObject>,
    pageProps: AppProps['pageProps']
) {
    // @ts-ignore
    if (pageProps?.props) {
        // @ts-ignore
        pageProps.props[APOLLO_STATE_PROP_NAME] = client.cache.extract()
    }
    return pageProps
}

export function useApollo(pageProps: AppProps['pageProps']) {
    // @ts-ignore
    const state = pageProps[APOLLO_STATE_PROP_NAME]
    const store = useMemo(() => initializeApollo(state), [state])
    return store
}
}
</code>```

Body:
I have the multilanguege app in next.js with ISR. Data fetch using graphQL. The API return data for a given language after getting origin from header request. Unfortunately, If I do it in function getStaticProps() then origin is empty. How Can I submit origin which domain is request?

In example below use apollo client.
The origin header is not visible in the API.
Where should I type something?
How can I submit this origin?

export const APOLLO_STATE_PROP_NAME = '__APOLLO_STATE__'

let apolloClient: ApolloClient<NormalizedCacheObject> | undefined

const createApolloClient = (headers: IncomingHttpHeaders | null = null) => {
    const enhancedFetch = (url: RequestInfo, init: RequestInit) => {
        return fetch(url, {
            ...init,
            headers: {
                ...init.headers,
                Cookie: headers?.cookie ?? '',
            },
        }).then((response) => {
            return response
        })
    }
    return new ApolloClient({
        ssrMode: typeof window === 'undefined',
        link: ApolloLink.from([
            onError(({ graphQLErrors, networkError, operation, forward, response }) => {
                if (graphQLErrors) {
                    graphQLErrors.forEach(({ message, locations, path, }) =>
                        console.error(
                            `[GraphQL error]: Message: ${message}, Location: ${locations}, Path: ${path}`
                        )
                    )
                }
                if (networkError)
                    console.error(
                        `[Network error]: ${networkError}. Backend is unreachable. Is it running?`
                    )
            }),

            createUploadLink({
                uri: "https://api.url_site/api/graphql",
                fetchOptions: {
                    mode: 'cors',
                },
                credentials: 'same-origin',
                fetch: enhancedFetch,
            }),
        ]),

        cache: new InMemoryCache(),
    })
type InitialState = NormalizedCacheObject | undefined

interface IInitializeApollo {
    headers?: IncomingHttpHeaders | null
    initialState?: InitialState | null
}

export const initializeApollo = (
    { headers, initialState }: IInitializeApollo = {
        headers: {
            // 'Access-Control-Allow-Origin': '*'
        },
        initialState: null,
    }
) => {
    const _apolloClient = apolloClient ?? createApolloClient(headers)
    if (initialState) {
        const existingCache = _apolloClient.extract()
        const data = merge(existingCache, initialState, {
            arrayMerge: (destinationArray, sourceArray) => [
                ...sourceArray,
                ...destinationArray.filter((d) =>
                    sourceArray.every((s) => !isEqual(d, s))
                ),
            ],
        })
        _apolloClient.cache.restore(data)
    }
    if (typeof window === 'undefined') return _apolloClient
    if (!apolloClient) apolloClient = _apolloClient
    return _apolloClient
}

export function addApolloState(
    client: ApolloClient<NormalizedCacheObject>,
    pageProps: AppProps['pageProps']
) {
    // @ts-ignore
    if (pageProps?.props) {
        // @ts-ignore
        pageProps.props[APOLLO_STATE_PROP_NAME] = client.cache.extract()
    }
    return pageProps
}

export function useApollo(pageProps: AppProps['pageProps']) {
    // @ts-ignore
    const state = pageProps[APOLLO_STATE_PROP_NAME]
    const store = useMemo(() => initializeApollo(state), [state])
    return store
}
}


问:
How to obtain errors from solutions in trust-constr in scipy
I have a relatively simple problem. Let's say I have some data with known errors, and an array of arrays for my constants

```<code>data=[1,2,3,4,5]
errors=[0.1,0.2,0.1,0.3,0.5]
constants=[[1,3,1,1,2],[1,2,1,3,4]]
</code>```

I want to minimize a linear combination of these constants with 3 adjustable parameters to best match my data (I am reducing my 3 variable problem to 2 since x+y+z=1).

```<code>equation=x*c_1+y*c_2
#where
z=1-(x+y)
</code>```

This is my setup

```<code>def fun(x,c1,c2,y,error):
    equation=x[0]*c1+x[1]*c2
    return np.sqrt((np.sum(((y-equation)/errors)**2))/len(y))
linear_constraint = LinearConstraint([1, 1], [0], [1])
bnds = np.array([(0.00000001, 1), (0.0000001, 1)])
xinit = np.array([0.5, 0.5])
solution=minimize(fun,args=(constants[0],constants[1],data,errors), x0=xinit, bounds=bnds, constraints=linear_constraint,method='trust-constr')
x,y=solution.x
z=1-sum(solution.x)
</code>```

Since I am solving for 2 parameters and extracting the third, I have to set a constraint where x+y<1 with bounds 0<x<1 and 0<y<1.

Assuming I set everything up properly, I am getting solutions from this. However, I'm trying to find the uncertaintity of the solutions. Normally I use the default L-BFGS-B for bounded minimization, which gives you the inverse Hessian for your errors. I don't quite know how to get errors from this minimization method however.

Any help would be appreciated!

Body:
I have a relatively simple problem. Let's say I have some data with known errors, and an array of arrays for my constants

data=[1,2,3,4,5]
errors=[0.1,0.2,0.1,0.3,0.5]
constants=[[1,3,1,1,2],[1,2,1,3,4]]

I want to minimize a linear combination of these constants with 3 adjustable parameters to best match my data (I am reducing my 3 variable problem to 2 since x+y+z=1).

equation=x*c_1+y*c_2
#where
z=1-(x+y)

This is my setup

def fun(x,c1,c2,y,error):
    equation=x[0]*c1+x[1]*c2
    return np.sqrt((np.sum(((y-equation)/errors)**2))/len(y))
linear_constraint = LinearConstraint([1, 1], [0], [1])
bnds = np.array([(0.00000001, 1), (0.0000001, 1)])
xinit = np.array([0.5, 0.5])
solution=minimize(fun,args=(constants[0],constants[1],data,errors), x0=xinit, bounds=bnds, constraints=linear_constraint,method='trust-constr')
x,y=solution.x
z=1-sum(solution.x)

Since I am solving for 2 parameters and extracting the third, I have to set a constraint where x+y<1 with bounds 0<x<1 and 0<y<1.

Assuming I set everything up properly, I am getting solutions from this. However, I'm trying to find the uncertaintity of the solutions. Normally I use the default L-BFGS-B for bounded minimization, which gives you the inverse Hessian for your errors. I don't quite know how to get errors from this minimization method however.

Any help would be appreciated!


问:
How to remove github extension from Jupyterlab
Yesterday I added an extension of github to Jupyterlab but it seems to make the notebook very slow. I uninstalled it but I still see the fork on the side of my notebook. Any suggestions on how to remove it?

As I mentioned, I tried to uninstall github through the extensions section of Jupyterlab. Yet there still is some functionality with the extension.

Update: clearing the cookies and cache within my browser solved the problem. It wasn't the extension


问:
UICollectionViewDiffableDataSource cellProvider closure deallocated reference
I've got my view controller setup like:

class HomeViewController: UIViewController {

    unowned var viewModel: HomeViewModelInterface!

    private lazy var collectionViewDataSource: UICollectionViewDiffableDataSource<Segment, Int> = {
        configureCollectionViewDataSource()
    }()

    // ...
    // ...

    func configureCollectionViewDataSource() -> UICollectionViewDiffableDataSource<Segment, Int> {
        let dataSource = UICollectionViewDiffableDataSource<Segment, Int>(collectionView: collectionView) { [unowned self] collectionView, indexPath, itemIdentifier in
            let cell = cell(with: HomeItemCollectionViewCell.self, for: indexPath, in: collectionView)
            cell.configure(with: itemIdentifier, delegate: viewModel)
            return cell
        }
        return dataSource
    }
}
```

The problem occurs inside the cellProvider closure where it always says the unowned reference view model was already deallocated. I'm trying to understand why and also how to fix this. I know the cell provider closure is an escaping closure, maybe that has something to do with it that it could be called long after the function has returned and therefore not be able to access the view model any more? Does anyone know how I get  around this?

The viewModel is set as a class instance from elsewhere just FYI.

Any help appreciated.

Body:
I've got my view controller setup like:

class HomeViewController: UIViewController {

    unowned var viewModel: HomeViewModelInterface!

    private lazy var collectionViewDataSource: UICollectionViewDiffableDataSource<Segment, Int> = {
        configureCollectionViewDataSource()
    }()

    // ...
    // ...

    func configureCollectionViewDataSource() -> UICollectionViewDiffableDataSource<Segment, Int> {
        let dataSource = UICollectionViewDiffableDataSource<Segment, Int>(collectionView: collectionView) { [unowned self] collectionView, indexPath, itemIdentifier in
            let cell = cell(with: HomeItemCollectionViewCell.self, for: indexPath, in: collectionView)
            cell.configure(with: itemIdentifier, delegate: viewModel)
            return cell
        }
        return dataSource
    }
}

The problem occurs inside the cellProvider closure where it always says the unowned reference view model was already deallocated. I'm trying to understand why and also how to fix this. I know the cell provider closure is an escaping closure, maybe that has something to do with it that it could be called long after the function has returned and therefore not be able to access the view model any more? Does anyone know how I get  around this?

The viewModel is set as a class instance from elsewhere just FYI.

Any help appreciated.


问:
Spring Web Socket with STOMP Issues
I am working on WebSocket application with STOMP and RabbitMQ as the broker. It is a chat-like application. I tried to dump thousands of messages to check if the socket will crash or observe any flicker in the UI.

Javascript code:

```<code>for(let i=1;i<1000;i++)
{
   if (stompClient) {
      var chatMessage = {
         sender : name,
         content : "File Processing at "+i+ " %",
         type : 'Process'
      };
      stompClient.send("/app/chat.sendMessage", {}, JSON.stringify(chatMessage));
   }
}
</code>```

I followed this tutorial.

Here is what I observed:

A fresh session will send and receive messages within seconds, but if I send again and again the time taken will increase every time 1s, 3s, 5s, & 20s up to 1 min 30s for same 1,000 messages.

After sending 4-5 times if it takes more than 30s. Once messages are received the WebSocket session is terminated, and sometimes flicker is observed.

Re-connecting to the WebSocket after timeout will again take longer than previous to send and receive, and flickering is observed. The UI gets stuck for a while.

I am very new to this concept. Can anyone tell me why is this happening and how to overcome this?

Title: Spring Web Socket with STOMP Issues

Body:
I am working on WebSocket application with STOMP and RabbitMQ as the broker. It is a chat-like application. I tried to dump thousands of messages to check if the socket will crash or observe any flicker in the UI.

Javascript code:

for(let i=1;i<1000;i++)
{
   if (stompClient) {
      var chatMessage = {
         sender : name,
         content : "File Processing at "+i+ " %",
         type : 'Process'
      };
      stompClient.send("/app/chat.sendMessage", {}, JSON.stringify(chatMessage));
   }
}

I followed this tutorial.

Here is what I observed:

A fresh session will send and receive messages within seconds, but if I send again and again the time taken will increase every time 1s, 3s, 5s, & 20s up to 1 min 30s for same 1,000 messages.

After sending 4-5 times if it takes more than 30s. Once messages are received the WebSocket session is terminated, and sometimes flicker is observed.

Re-connecting to the WebSocket after timeout will again take longer than previous to send and receive, and flickering is observed. The UI gets stuck for a while.

I am very new to this concept. Can anyone tell me why is this happening and how to overcome this?


问:
How do I set the dependencyResolutionManagement on init.gradle?
I am trying to install a package but it seems to be going to https://jitpack.io/ which is having an outage at the moment.  I have a personal proxy repo which already has the image I want but because the dependent code has 42.2.+ it is looking for some other data which I think I also have but it is resolving to jitpack.

cat <<EOT > $HOME/.gradle/init.gradle
allprojects {
  configurations.all {
    resolutionStrategy {
      force "com.facebook.react:react-native:0.70.5"
    }
  }

  repositories {
  mavenLocal()
  maven {
    url = uri('https://mine/')
    credentials {
      ...
    }
  }
  <-- tried putting here
}
<-- and here
```
<p>This is the block I wanted to add</p>
```dependencyResolutionManagement {
  repositories {
    maven {
      url = uri('https://mine/')
      credentials {
          ...
      }
    }
  }
}
```
<p>But it is saying signature not found.</p>
<p>There's a closed issue for this but I can't find an example on how to do it.  I tried to copy the one from the Issue OP but it didn't appear to work</p>
```settingsEvaluated {
  it.dependencyResolutionManagement {
    repositories {
      maven {
        url = uri('https://mine/')
        credentials {
          ...
        }
      }
    }
  }
}
```
<p>In the end I get this</p>
```[RUN_GRADLEW] A problem occurred configuring project ':rn-pendo-sdk'.
[RUN_GRADLEW] > Could not resolve all files for configuration ':rn-pendo-sdk:implementation'.
[RUN_GRADLEW]    > Could not resolve sdk.pendo.io:pendoIO:2.19.+.
[RUN_GRADLEW]      Required by:
[RUN_GRADLEW]          project :rn-pendo-sdk
[RUN_GRADLEW]       > Failed to list versions for sdk.pendo.io:pendoIO.
[RUN_GRADLEW]          > Unable to load Maven meta-data from https://www.jitpack.io/sdk/pendo/io/pendoIO/maven-metadata.xml.
[RUN_GRADLEW]             > Could not GET 'https://www.jitpack.io/sdk/pendo/io/pendoIO/maven-metadata.xml'. Received status code 521 from server:
```

Body:
I am trying to install a package but it seems to be going to https://jitpack.io/ which is having an outage at the moment.  I have a personal proxy repo which already has the image I want but because the dependent code has 42.2.+ it is looking for some other data which I think I also have but it is resolving to jitpack.

cat <<EOT > $HOME/.gradle/init.gradle
allprojects {
  configurations.all {
    resolutionStrategy {
      force "com.facebook.react:react-native:0.70.5"
    }
  }

  repositories {
  mavenLocal()
  maven {
    url = uri('https://mine/')
    credentials {
      ...
    }
  }
  <-- tried putting here
}
<-- and here

This is the block I wanted to add

dependencyResolutionManagement {
  repositories {
    maven {
      url = uri('https://mine/')
      credentials {
          ...
      }
    }
  }
}

But it is saying signature not found.

There's a closed issue for this but I can't find an example on how to do it.  I tried to copy the one from the Issue OP but it didn't appear to work

settingsEvaluated {
  it.dependencyResolutionManagement {
    repositories {
      maven {
        url = uri('https://mine/')
        credentials {
          ...
        }
      }
    }
  }
}

In the end I get this

[RUN_GRADLEW] A problem occurred configuring project ':rn-pendo-sdk'.
[RUN_GRADLEW] > Could not resolve all files for configuration ':rn-pendo-sdk:implementation'.
[RUN_GRADLEW]    > Could not resolve sdk.pendo.io:pendoIO:2.19.+.
[RUN_GRADLEW]      Required by:
[RUN_GRADLEW]          project :rn-pendo-sdk
[RUN_GRADLEW]       > Failed to list versions for sdk.pendo.io:pendoIO.
[RUN_GRADLEW]          > Unable to load Maven meta-data from https://www.jitpack.io/sdk/pendo/io/pendoIO/maven-metadata.xml.
[RUN_GRADLEW]             > Could not GET 'https://www.jitpack.io/sdk/pendo/io/pendoIO/maven-metadata.xml'. Received status code 521 from server:


问:
How do I fix the import error that comes up in visual studio code?
I'm using visual studio code with python, and i'm trying to make a game using pygame. When I try importing pygame an error comes and it says

Import "pygame" could not be resolved ''

What confuses me is that i tried running the exact same code in pycharm and it worked without any problems. It also has no problem importing other modules. For some reason only pygame is the one that gives the error.

I tried restarting my PC and visual studio code. I tried selecting different python interpreters witch I don't fully understand so maybe I did something wrong there. If anyone has any ideas on how to fix this I would appreciate it.


问:
Testdriven.io: Building Your Own Python Web Framework: p1 Web App build error
In the Web App chapter, launching gunicorn fails with the following error:

```<code>❯ gunicorn app:app
[2022-12-22 17:30:31 +0000] [84731] [INFO] Starting gunicorn 20.1.0
[2022-12-22 17:30:31 +0000] [84731] [INFO] Listening at: http://127.0.0.1:8000 (84731)
[2022-12-22 17:30:31 +0000] [84731] [INFO] Using worker: sync
[2022-12-22 17:30:31 +0000] [84741] [INFO] Booting worker with pid: 84741
[2022-12-22 17:30:31 +0000] [84741] [ERROR] Exception in worker process
Traceback (most recent call last):
  File "/Users/i/.pyenv/versions/3.9.15/lib/python3.9/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker
    worker.init_process()
  File "/Users/i/.pyenv/versions/3.9.15/lib/python3.9/site-packages/gunicorn/workers/base.py", line 134, in init_process
    self.load_wsgi()
  File "/Users/i/.pyenv/versions/3.9.15/lib/python3.9/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
    self.wsgi = self.app.wsgi()
  File "/Users/i/.pyenv/versions/3.9.15/lib/python3.9/site-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/Users/i/.pyenv/versions/3.9.15/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
    return self.load_wsgiapp()
  File "/Users/i/.pyenv/versions/3.9.15/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/Users/i/.pyenv/versions/3.9.15/lib/python3.9/site-packages/gunicorn/util.py", line 359, in import_app
    mod = importlib.import_module(module)
  File "/Users/i/.pyenv/versions/3.9.15/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/Users/i/Dropbox/0DEV/0TDriven/1_BYOWF_2/webapp/app.py", line 1, in <module>
    from bumbo.api import API
  File "/Users/i/.pyenv/versions/3.9.15/lib/python3.9/site-packages/bumbo/api.py", line 8, in <module>
    from jinja2 import Environment, FileSystemLoader
  File "/Users/i/.pyenv/versions/3.9.15/lib/python3.9/site-packages/jinja2/__init__.py", line 33, in <module>
    from jinja2.environment import Environment, Template
  File "/Users/i/.pyenv/versions/3.9.15/lib/python3.9/site-packages/jinja2/environment.py", line 16, in <module>
    from jinja2.defaults import BLOCK_START_STRING, \
  File "/Users/i/.pyenv/versions/3.9.15/lib/python3.9/site-packages/jinja2/defaults.py", line 31, in <module>
    from jinja2.filters import FILTERS as DEFAULT_FILTERS
  File "/Users/i/.pyenv/versions/3.9.15/lib/python3.9/site-packages/jinja2/filters.py", line 1176, in <module>
    'string':               soft_unicode,
NameError: name 'soft_unicode' is not defined
[2022-12-22 17:30:31 +0000] [84741] [INFO] Worker exiting (pid: 84741)
[2022-12-22 17:30:31 +0000] [84731] [INFO] Shutting down: Master
[2022-12-22 17:30:31 +0000] [84731] [INFO] Reason: Worker failed to boot.
</code>```

I've tried with my own type along code (on Python 3.10.8) and using the author's bumbo module (using Python 3.9.15) with the same results. Any assistance appreciated

Body:
In the Web App chapter, launching gunicorn fails with the following error:

❯ gunicorn app:app
[2022-12-22 17:30:31 +0000] [84731] [INFO] Starting gunicorn 20.1.0
[2022-12-22 17:30:31 +0000] [84731] [INFO] Listening at: http://127.0.0.1:8000 (84731)
[2022-12-22 17:30:31 +0000] [84731] [INFO] Using worker: sync
[2022-12-22 17:30:31 +0000] [84741] [INFO] Booting worker with pid: 84741
[2022-12-22 17:30:31 +0000] [84741] [ERROR] Exception in worker process
Traceback (most recent call last):
  File "/Users/i/.pyenv/versions/3.9.15/lib/python3.9/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker
    worker.init_process()
  File "/Users/i/.pyenv/versions/3.9.15/lib/python3.9/site-packages/gunicorn/workers/base.py", line 134, in init_process
    self.load_wsgi()
  File "/Users/i/.pyenv/versions/3.9.15/lib/python3.9/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
    self.wsgi = self.app.wsgi()
  File "/Users/i/.pyenv/versions/3.9.15/lib/python3.9/site-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/Users/i/.pyenv/versions/3.9.15/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
    return self.load_wsgiapp()
  File "/Users/i/.pyenv/versions/3.9.15/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/Users/i/.pyenv/versions/3.9.15/lib/python3.9/site-packages/gunicorn/util.py", line 359, in import_app
    mod = importlib.import_module(module)
  File "/Users/i/.pyenv/versions/3.9.15/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/Users/i/Dropbox/0DEV/0TDriven/1_BYOWF_2/webapp/app.py", line 1, in <module>
    from bumbo.api import API
  File "/Users/i/.pyenv/versions/3.9.15/lib/python3.9/site-packages/bumbo/api.py", line 8, in <module>
    from jinja2 import Environment, FileSystemLoader
  File "/Users/i/.pyenv/versions/3.9.15/lib/python3.9/site-packages/jinja2/__init__.py", line 33, in <module>
    from jinja2.environment import Environment, Template
  File "/Users/i/.pyenv/versions/3.9.15/lib/python3.9/site-packages/jinja2/environment.py", line 16, in <module>
    from jinja2.defaults import BLOCK_START_STRING, \
  File "/Users/i/.pyenv/versions/3.9.15/lib/python3.9/site-packages/jinja2/defaults.py", line 31, in <module>
    from jinja2.filters import FILTERS as DEFAULT_FILTERS
  File "/Users/i/.pyenv/versions/3.9.15/lib/python3.9/site-packages/jinja2/filters.py", line 1176, in <module>
    'string':               soft_unicode,
NameError: name 'soft_unicode' is not defined
[2022-12-22 17:30:31 +0000] [84741] [INFO] Worker exiting (pid: 84741)
[2022-12-22 17:30:31 +0000] [84731] [INFO] Shutting down: Master
[2022-12-22 17:30:31 +0000] [84731] [INFO] Reason: Worker failed to boot.

I've tried with my own type along code (on Python 3.10.8) and using the author's bumbo module (using Python 3.9.15) with the same results. Any assistance appreciated


问:
Why do some chars appear smaller in Visual Studio 2019/2022?
It's especially about those 2 chars: { and /

They appear from time to time smaller then usual. Some times all { look tiny.
An example with /:

Notice the 1. and 4. / (which is standard size), and 2. and 3. one.

Another example with }:

Notice the last } and the one before (which is standard).

Are there any specific settings which I'm missing? Or is it a bug?


问:
Ojdbc driver misbehaving in wildfly26
I'm using Wildfly26 and in my code I have this simple query:

```<code>@NamedQuery(name = "fixed-price.initialSetupPeriod", query = "SELECT e FROM FixedPriceException e WHERE e.flgAct ='S' AND e.datFim >= :start AND e.datIni <= :end")})
final Query q = em.createNamedQuery("fixed-price.initialSetupPeriod");
        q.setParameter("start", interval.getStart(), TemporalType.DATE);
        q.setParameter("end", interval.getEnd(), TemporalType.DATE);
        @SuppressWarnings("unchecked")
        final List<FixedPriceException> priceLimits = q.getResultList();
        if (priceLimits == null) {
            return;
        }
</code>```

Previously, when I use this ojdbc driver com.oracle.database.jdbc:ojdbc6:11.2.0.4 I could use TemporalType.DATE to unsure that the query only checks the date by day and ignores the time (hour and minutes).
When I upgrade the ojdbc driver this same query starts looking also to time (hour and minutes), which changed the behavior of my code to something unexpected.

Any of this ojdbc drivers misbehaving:

com.oracle.database.jdbc:ojdbc11:21.8.0.0  (first I try when
upgrade)

com.oracle.database.jdbc:ojdbc10:19.17.0.0

com.oracle.database.jdbc:ojdbc8:21.8.0.0

I upgrade this ojdbc driver when I did Wildfly9 migration to Wildfly26.

Why does this happen?

Title: Ojdbc driver misbehaving in wildfly26

Body:
I'm using Wildfly26 and in my code I have this simple query:

@NamedQuery(name = "fixed-price.initialSetupPeriod", query = "SELECT e FROM FixedPriceException e WHERE e.flgAct ='S' AND e.datFim >= :start AND e.datIni <= :end")})
final Query q = em.createNamedQuery("fixed-price.initialSetupPeriod");
        q.setParameter("start", interval.getStart(), TemporalType.DATE);
        q.setParameter("end", interval.getEnd(), TemporalType.DATE);
        @SuppressWarnings("unchecked")
        final List<FixedPriceException> priceLimits = q.getResultList();
        if (priceLimits == null) {
            return;
        }

Previously, when I use this ojdbc driver com.oracle.database.jdbc:ojdbc6:11.2.0.4 I could use TemporalType.DATE to unsure that the query only checks the date by day and ignores the time (hour and minutes).
When I upgrade the ojdbc driver this same query starts looking also to time (hour and minutes), which changed the behavior of my code to something unexpected.

Any of this ojdbc drivers misbehaving:

com.oracle.database.jdbc:ojdbc11:21.8.0.0  (first I try when
upgrade)

com.oracle.database.jdbc:ojdbc10:19.17.0.0

com.oracle.database.jdbc:ojdbc8:21.8.0.0

I upgrade this ojdbc driver when I did Wildfly9 migration to Wildfly26.

Why does this happen?


问:
Json response with dynamic values on one of the nodes into SQL Server table
I have a JSON API which I convert into an SQL table successfully but one of the columns got multi in it and they are very different from each other. So how can I split the JSON value in the details column into multiple columns? for example Page,PageLink,Property,District.....

Here is my table with the details column which has multi values

ID
ContactID
ActivityDate
EventID
EventName
Source
SourceName
details

23
223
2020-10-26
109
BIK Pages
18
LeadGenerationForm
{"Page" : "thank-you","PageLink" : "https://*****/thank-you"}

8223
1112
2020-10-12
118
Request call back
19
Baitak Platform
{"Property" : "(TxxxxE-009","District " : "ddd","Price" : "22","UnitType" : "Plot"}

8
1
2020-10-12
127
liveturquoisecampaign
18
LeadGenerationForm
{"Source" : " Views","City" : "s"}


问:
How to use jQuery UI Sortable object inside the TinyMCE editor?
I have a simple list of 3 elements inside a Tinymce editor as HTML content:

```<code><ul id="sortable">
  <li draggable="true">Item 1</li>
  <li draggable="true">Item 2</li>
  <li draggable="true">Item 3</li>
</ul>
<script>$(function() {
  $('#sortable').sortable();
});</script>
</code>```

If I use tinymce I can not drag and drop the list elements but without it, no problem.

Is there any collision between drag and drop events from Tinymce and jQuery UI?

Body:
I have a simple list of 3 elements inside a Tinymce editor as HTML content:

Item 1

Item 2

Item 3

If I use tinymce I can not drag and drop the list elements but without it, no problem.

Is there any collision between drag and drop events from Tinymce and jQuery UI?


问:
How to resolve Type 'K' cannot be used to index type 'ScopeTableType[L]' in TypeScript?
I have this TypeScript playground now. Here is the code:

```<code>export enum Scope {
  Form = "form",
  Nest = "nest",
}

export type ScopeKeyListType<
  L extends Scope,
  T extends ScopeType<L>,
> = T['parent'] extends ScopeType<infer A extends Scope>
  ? keyof T['data'] | ScopeKeyListType<A, T['parent']>
  : keyof T['data']

export type ScopeNestDataType = {
  index: number;
  nest: {
    foo: string;
    bar: boolean;
  };
};

export type ScopeFormDataType = {
  hello: string;
  world: number;
};

export type ScopeTableType = {
  form: ScopeFormDataType;
  nest: ScopeNestDataType;
};

export type ScopeType<
  A extends Scope,
  B extends unknown = unknown
> = {
  data: ScopeTableType[A];
  like: A;
  parent?: B extends ScopeType<infer T extends Scope, infer Q>
    ? B
    : never
};

export type ScopeValueType<
  L extends Scope,
  T extends ScopeType<L>,
  K extends string | number | symbol,
> = T['data'] extends { [key in K]: unknown }
  ? T['data'][K]
  : T['parent'] extends ScopeType<infer A extends Scope>
  ? ScopeValueType<A, T['parent'], K>
  : never

export type ParentScopeType<S> =
  | S
  | (S extends ScopeType<infer X, infer Y>
      ? Y extends ScopeType<infer A, infer B>
        ? ParentScopeType<Y>
        : never
      : never)

export function setPropertyValueOnScope<
  L extends Scope,
  S extends ScopeType<L>,
  K extends ScopeKeyListType<L, S>
>(scope: S, property: K, value: ScopeValueType<L, S, K>): void {
  if (property in scope.data) {
    scope.data[property] = value;
  } else if (scope.parent) {
    setPropertyValueOnScope(scope.parent, property, value);
  } else {
    throw new Error(`Property not defined on scope`);
  }
}

export function getPropertyValueFromScope<
  L extends Scope,
  S extends ScopeType<L>,
  K extends ScopeKeyListType<L, S>,
>(scope: S, path: K): ScopeValueType<L, S, K> | undefined {
  let source: ParentScopeType<S> | undefined = scope

  while (source) {
    if (path in source.data) {
      break
    } else {
      source = source.parent
    }
  }

  if (!source) {
    return
  }

  return source.data[path]
}
</code>```

How do I resolve this conundrum? The first error occurs in the function setPropertyValueOnScope at this line:

```<code>scope.data[property] = value;
</code>```

Error is:

```<code>Type 'K' cannot be used to index type 'ScopeTableType[L]'.(2536)
</code>```

I checked that the keys can be passed to props in a more primitive example here, so it seems like this bigger example should work, but for some reason it's not. Can you spot why it's not working and how to fix it?

Body:
I have <a href="https://www.typescriptlang.org/play?#code/KYDwDg9gTgLgBMAdgVwLZwMoGMJmHAbwCg44AxadAXjgCIAzS2gGhLgDlgBneG2xbjBZEAvkSKhIsODACeeTDjwBpYLIAyASx4AVecAA8bdQhAwkAEy6LcwVqR2nziKzbx68B9QD5W3uDQ6ANoA5GAAhlBIMCEAuk6W1ti2HoaaiPTAUHAAggkuSUrA3mwA-HAA1moQ9HDBIRbhMOFxcAA+bsCqGtowqQY5zHWhEVGIMbElpABcldW19Y3NceKS0PByCsl4nDwAIk3hqQGEbOkWoLMoqABGWQDcbAI8s8SkpIwQszxQ6QDmj3ecBukVmNwgEAANsBwohAXARI9EatwOsZPpOhQoKgDs1jjQ3nAABbASGQr5wH7-eEAd2gkIsVzQdygSMeElR0k2+G2wB04Ru0Pxpw+lFmvKxOMOqXhzxg4qKuxguKO+jZKKkGwxvP6bDyoGcrl59jgACF8q5kIgKogIDTECcrTa7YgiP4CWwluEFSkBUL9EEcrF4ZDNFVZjl4aNoqVZuaDYlOv10plso4EwVOkMU1k4ABFKbvcqmtgzOACABuWVE7LWXO1RQAauFIcg+fojKQTBmjUUTemzImdR2fCblBbrFTEH92uXmbmOlxZLcoX4TotDq0e9YCHAglVZHB0nBlLFZk7bfaEWVhg1N7Egqe2LN6tHxlvB5nh54c9l9Z-e1sQtyl5ZtW3bTxBlvN8JiGZRCyuYAqygDU0W5OAAAVImib9DAwd02A6DBCLgAAKDAJyTDtfzgAANbMMlzABNQsgXKJjKNwgwaKgmjTVYoE4HKLCxhgLiWNLQTEOQySy0rLIAEpUOkegrSwGBNAgB0uGAGAMKgWxYFkMC2wAeUQXlOzgbsAMKWwTQo7cqM8Uc2HHJzeW6LRdBHIZ8LdUiuCKcUhjAAy8CM2ZlCGCsWzbH08BMiDDHUPy4O8BTZgrCBNAsEUj1qUiwsMuQj20ooADovQU-LSCC2wqsOIJioiuR4hoWLwPhEQEEhHSCrI+q8AqmCasJOrdP0krjLi4BzN5QLKpg0LwqyOQYtmhTut6-rxpkIkDJpctgCOgBRKADKgUiAAMptaw9bXgC56HSYA8q0ykimura2DEMQOU1OBVMQdTNIdP5JtWoykrIAzUEs4xOL7NhHNs5yUt8NykdsLzen6VLMEx7xFtsEK4AiGAiSizLOiS-G0pPfwOitZ7XrywloXgLgIGQKAsGAWYRJwop+nw2cWeAF6BDymghuAcRSBpIlNGhQaeb54AxskzRCopokyspdX+ca5otcE4EonCCpJJ60ldtkw3ef5k5uad4ARuw8Ybd+hWBtIgBCV2NbN94ohgXnXVIf7SDDiPHY1k3wmapoiViUQgA" rel="nofollow noreferrer">this TypeScript playground now. Here is the code:

export enum Scope {
  Form = "form",
  Nest = "nest",
}

export type ScopeKeyListType<
  L extends Scope,
  T extends ScopeType<L>,
> = T['parent'] extends ScopeType<infer A extends Scope>
  ? keyof T['data'] | ScopeKeyListType
  : keyof T['data']

export type ScopeNestDataType = {
  index: number;
  nest: {
    foo: string;
    bar: boolean;
  };
};

export type ScopeFormDataType = {
  hello: string;
  world: number;
};

export type ScopeTableType = {
  form: ScopeFormDataType;
  nest: ScopeNestDataType;
};

export type ScopeType = {
  data: ScopeTableType[A];
  like: A;
  parent?: B extends ScopeType<infer T extends Scope, infer Q>
    ? B
    : never
};

export type ScopeValueType<
  L extends Scope,
  T extends ScopeType<L>,
  K extends string | number | symbol,
> = T['data'] extends { [key in K]: unknown }
  ? T['data'][K]
  : T['parent'] extends ScopeType<infer A extends Scope>
  ? ScopeValueType
  : never

export type ParentScopeType<S> =
  | S
  | (S extends ScopeType<infer X, infer Y>
      ? Y extends ScopeType<infer A, infer B>
        ? ParentScopeType<Y>
        : never
      : never)

export function setPropertyValueOnScope<
  L extends Scope,
  S extends ScopeType<L>,
  K extends ScopeKeyListType<L, S>
>(scope: S, property: K, value: ScopeValueType<L, S, K>): void {
  if (property in scope.data) {
    scope.data[property] = value;
  } else if (scope.parent) {
    setPropertyValueOnScope(scope.parent, property, value);
  } else {
    throw new Error(`Property not defined on scope`);
  }
}

export function getPropertyValueFromScope<
  L extends Scope,
  S extends ScopeType<L>,
  K extends ScopeKeyListType<L, S>,
>(scope: S, path: K): ScopeValueType<L, S, K> | undefined {
  let source: ParentScopeType<S> | undefined = scope

  while (source) {
    if (path in source.data) {
      break
    } else {
      source = source.parent
    }
  }

  if (!source) {
    return
  }

  return source.data[path]
}

How do I resolve this conundrum? The first error occurs in the function setPropertyValueOnScope at this line:

scope.data[property] = value;

Error is:

Type 'K' cannot be used to index type 'ScopeTableType[L]'.(2536)

I checked that the keys can be passed to props in a more primitive example <a href="https://www.typescriptlang.org/play?#code/FAFwngDgpgBA0lMBnAPAFQHwwLwwNaID2AZjGsMMQK4B2AxiAJaE0xJQgAKAToRCsBhkYUAB4goNACZIYhAEYArKAwA0g+CPGSZ8RKkzAMACgWKAXGVUwIvCJbjWAbgEMANlSiW0AbTgBdAEpLJ0JGKRgAbw0zH1s+fxwYVw8oYABfCnBoGAAxQkJ0LQlpWSQQbkYaAHMYAB8YGioAW3kobnq2MFbCNyxcckpaBmZWdi47ACYBITRinVkzFRB1ITh50ryClARkdAwMI1Mlb2t4+3hnd09vPyCQsIjooVjzxNwUzwysyFgAVXY3DQvySzxEzRcjDclnKlRq32AdBY5RgVEBlgB7WBOVwYKgEKhlgA5MQCgABeQubgAOiRzSJCPGPD4KExQN+1iJ+MhbiJJjR7U53KhRKFohczQgbigtMI9MCQA" rel="nofollow noreferrer">here, so it seems like this bigger example should work, but for some reason it's not. Can you spot why it's not working and how to fix it?


问:
How can Test Web Component inside React Component
How can I test a web component inside a component in React?

```<code>import React from 'react';

function Form() {
  return <div>
    <label htmlFor="">Name:</label>
    <custom-input
      name='name'
      data-testid='name-input'
      onChange={(e) => handleName(e.target.value)}
    />
  </div>
}

export default Form;
</code>```

Any suggestions?

Body:
How can I test a web component inside a component in React?

import React from 'react';

function Form() {
  return

    Name:
    <custom-input
      name='name'
      data-testid='name-input'
      onChange={(e) => handleName(e.target.value)}
    />

}

export default Form;

Any suggestions?


问:
Can I enable List<T> polymorphism in a [Column(TypeName = "json")]
I'm using Postgresql with Entity Framework Core via the Npgsql.EntityFrameworkCore.PostgreSQLlibrary.

I have a property of a complex class typ that is streamed as JSON using [Column(TypeName = "json")]

One of the properties in this complex class looks like this.

public List<ContactInformation> ContactInformation { get; set; } = new();
```
<p>Where the classes involved are:</p>
<pre class="lang-cs prettyprint-override"><code>public class ContactInformation
{
    public string Name { get; set; } = "";
}

public class ContactTelephone : ContactInformation
{
    public string? PhoneNumber { get; set; }
}

public class ContactEmail : ContactInformation
{
    public string? EmailAddress { get; set; }
}
</code>```

Is there a way I can have this list of different object types serialized, deserialized as the same types, and also to be able to write LINQ such as .Where(x => x is ContactEmail && (x as ContactEmail).EmailAddress == "me@home.com") (or something equivalent?

I need to store a collection of information that has been collected from multiple sources (later sources overriding the values from earlier sources) and then flatten them in a structure like above - which I would like to be json because I want to easily make snapshots of the values at a specific point in time (when a search is performed and the results saved).

Body:
I'm using Postgresql with Entity Framework Core via the Npgsql.EntityFrameworkCore.PostgreSQLlibrary.

I have a property of a complex class typ that is streamed as JSON using [Column(TypeName = "json")]

One of the properties in this complex class looks like this.

public List<ContactInformation> ContactInformation { get; set; } = new();

Where the classes involved are:

public class ContactInformation
{
    public string Name { get; set; } = "";
}

public class ContactTelephone : ContactInformation
{
    public string? PhoneNumber { get; set; }
}

public class ContactEmail : ContactInformation
{
    public string? EmailAddress { get; set; }
}

Is there a way I can have this list of different object types serialized, deserialized as the same types, and also to be able to write LINQ such as .Where(x => x is ContactEmail && (x as ContactEmail).EmailAddress == "me@home.com") (or something equivalent?

I need to store a collection of information that has been collected from multiple sources (later sources overriding the values from earlier sources) and then flatten them in a structure like above - which I would like to be json because I want to easily make snapshots of the values at a specific point in time (when a search is performed and the results saved).


问:
Angular.js if we have form-control inside another form control how to get $touched event of inner form-control?
I have this code where I have a form-control label as a button and inside this button, I have a file upload option this is written this way as UI implementation requirements were such.

```<code>      <div class="form-group"

       ng-class="{ 'has-error': (form.fileuploadlabel.fileupload.$touched) && form.fileuploadlabel.fileupload.$invalid }}">

          <label class="btn btn-white form-control" name="fileuploadlabel">

            <span ng-show="viewmodel.file">{{ viewmodel.file.name }}</span>

            <i class="fa fa-cloud-upload "></i>

            <span class="control-label" ng-hide="viewmodel.file">Upload</span>

            <input

            class="form-control"

              file-upload="viewmodel.file"

              type="file"

              style="display: none;"

              id="file"

              ng-required="true"

              name="fileupload"

            />

          </label>

          </div>
</code>```

I need to get the $touched event to validate the form but form.fileuploadlabel.fileupload.$touched is not working I am new to angular and am trying to figure it out please help!!!

Body:
I have this code where I have a form-control label as a button and inside this button, I have a file upload option this is written this way as UI implementation requirements were such.

            {{ viewmodel.file.name }}

            Upload

            <input

            class="form-control"

              file-upload="viewmodel.file"

              type="file"

              style="display: none;"

              id="file"

              ng-required="true"

              name="fileupload"

            />

I need to get the $touched event to validate the form but form.fileuploadlabel.fileupload.$touched is not working I am new to angular and am trying to figure it out please help!!!


问:
Getting undefined symbols for arm64 (using curlcpp)
I am currently trying to use the curlcpp library; however, when I try to make an API call to OpenWeatherMaps I receive a "undefined symbols for architecture arm64" error below:

```<code>Undefined symbols for architecture arm64:
  "__ZN4curl14curl_exceptionC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_", referenced from:
      __ZN4curl19curl_easy_exceptionC1ERK8CURLcodeRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE in main.cpp.o
  "_curl_easy_setopt", referenced from:
      __ZN4curl9curl_easy3addIL10CURLoption10002EEEvNS_6detail8option_tIXT_EE4typeE in main.cpp.o
  "_curl_easy_strerror", referenced from:
      __ZN4curl19curl_easy_exceptionC1ERK8CURLcodeRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE in main.cpp.o
ld: symbol(s) not found for architecture arm64
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
</code>```

I am currently using CLion, on M1 MacOS.  My CMak files looks like this:

```<code>cmake_minimum_required(VERSION 3.24)
project(TerminalWeather)

set(CMAKE_CXX_STANDARD 23)

INCLUDE_DIRECTORIES(/opt/homebrew/Cellar/curlcpp/2.1/include/curlcpp)
LINK_LIBRARIES(/opt/homebrew/lib/libcurlcpp.dylib)

add_executable(TerminalWeather src/main.cpp)
</code>```

This is what my main C++ file looks like:

#include <iostream>
#include <curlcpp/curl_easy.h>

using namespace std;

int main() {
    using curl::curl_easy, curl::curl_easy_exception;

    /* object handler to make the URL requests */
    curl_easy handler;
    handler.add<CURLOPT_URL>("https://api.openweathermap.org/data/2.5/weather?q={myCity}&units=metric&appid={myAPIKey}");

    try {
        handler.perform();
    } catch(curl_easy_exception& ce) {
        cout << ce.what() << endl;
    }

    return 0;
}
```

Could this error be because I am not linking the library properly? I am new to C++ and am not sure how to resolve the issue after looking everywhere.

Thank you all for the help

Body:
I am currently trying to use the curlcpp library; however, when I try to make an API call to OpenWeatherMaps I receive a "undefined symbols for architecture arm64" error below:

Undefined symbols for architecture arm64:
  "__ZN4curl14curl_exceptionC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_", referenced from:
      __ZN4curl19curl_easy_exceptionC1ERK8CURLcodeRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE in main.cpp.o
  "_curl_easy_setopt", referenced from:
      __ZN4curl9curl_easy3addIL10CURLoption10002EEEvNS_6detail8option_tIXT_EE4typeE in main.cpp.o
  "_curl_easy_strerror", referenced from:
      __ZN4curl19curl_easy_exceptionC1ERK8CURLcodeRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE in main.cpp.o
ld: symbol(s) not found for architecture arm64
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

I am currently using CLion, on M1 MacOS.  My CMak files looks like this:

cmake_minimum_required(VERSION 3.24)
project(TerminalWeather)

set(CMAKE_CXX_STANDARD 23)

INCLUDE_DIRECTORIES(/opt/homebrew/Cellar/curlcpp/2.1/include/curlcpp)
LINK_LIBRARIES(/opt/homebrew/lib/libcurlcpp.dylib)

add_executable(TerminalWeather src/main.cpp)

This is what my main C++ file looks like:

#include <iostream>
#include <curlcpp/curl_easy.h>

using namespace std;

int main() {
    using curl::curl_easy, curl::curl_easy_exception;

    /* object handler to make the URL requests */
    curl_easy handler;
    handler.add<CURLOPT_URL>("https://api.openweathermap.org/data/2.5/weather?q={myCity}&units=metric&appid={myAPIKey}");

    try {
        handler.perform();
    } catch(curl_easy_exception& ce) {
        cout << ce.what() << endl;
    }

    return 0;
}

Could this error be because I am not linking the library properly? I am new to C++ and am not sure how to resolve the issue after looking everywhere.

Thank you all for the help


问:
How to create a link with user ID as path variable in thymeleaf
I have this URL:

```<code>http://localhost:8080/api/wallet/userWallet/balance/1
</code>```

That is actually this controller:

```<code>@GetMapping("/userWallet/balance/{user_id}")
public String getUserWallet(@PathVariable(value = "user_id") Long user_id, Model model) {
    model.addAttribute("wallet", walletService.findDistinctIdByUserId(user_id));
    return "user_profile";
}
</code>```

That controller list all wallets that user with ID 1 in this example have.

Now, I want to create a home page with a navigation, for example link that will says "My wallets" and after user click on it, user should be redirected to /api/wallet/userWallet/balance/1

How I can achieve this?

I tried with something like this:

```<code><a th:each="user: ${users}" th:href="@{/api/wallet/userWallet/balance/{user_id} (user_id=${user.id})}">My Wallets</a>
</code>```

But there is nothing on page, HTML is blank, no errors on stack track, no errors in console, on inspect element I cant even see that tag, just empty HTML page.

I have a felling that I'm missing something about getting user ID that is logged but cant find out what.

User entity:

```<code>@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@NotEmpty
@Size(min = 3, max = 20)
private String username;

@NotEmpty(message = "Please, insert a first name")
private String firstName;

@NotEmpty(message = "Please, insert a last name")
private String lastName;

@NotEmpty
@Size(max = 50)
@Email
private String email;

@NotEmpty
@Size(min = 6)
private String password;

@ManyToMany(fetch = FetchType.LAZY)
@JoinTable(name = "user_roles",
        joinColumns = @JoinColumn(name = "user_id"),
        inverseJoinColumns = @JoinColumn(name = "role_id"))
private Set<Role> roles = new HashSet<>();
</code>```

Wallet entity:

```<code>  @Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@NotEmpty(message = "Please, insert a wallet name")
private String walletName;

private double initialBalance;

@ManyToOne(fetch = FetchType.LAZY, optional = false)
@JoinColumn(name = "user_id", nullable = false, referencedColumnName = "id", insertable = false, updatable = false)
@OnDelete(action = OnDeleteAction.CASCADE)
@JsonIgnore
private User user;

@Column(name = "user_id", nullable = false)
private Long userId;
</code>```

Body:
I have this URL:

http://localhost:8080/api/wallet/userWallet/balance/1

That is actually this controller:

@GetMapping("/userWallet/balance/{user_id}")
public String getUserWallet(@PathVariable(value = "user_id") Long user_id, Model model) {
    model.addAttribute("wallet", walletService.findDistinctIdByUserId(user_id));
    return "user_profile";
}

That controller list all wallets that user with ID 1 in this example have.

Now, I want to create a home page with a navigation, for example link that will says "My wallets" and after user click on it, user should be redirected to /api/wallet/userWallet/balance/1

How I can achieve this?

I tried with something like this:

My Wallets

But there is nothing on page, HTML is blank, no errors on stack track, no errors in console, on inspect element I cant even see that tag, just empty HTML page.

I have a felling that I'm missing something about getting user ID that is logged but cant find out what.

User entity:

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@NotEmpty
@Size(min = 3, max = 20)
private String username;

@NotEmpty(message = "Please, insert a first name")
private String firstName;

@NotEmpty(message = "Please, insert a last name")
private String lastName;

@NotEmpty
@Size(max = 50)
@Email
private String email;

@NotEmpty
@Size(min = 6)
private String password;

@ManyToMany(fetch = FetchType.LAZY)
@JoinTable(name = "user_roles",
        joinColumns = @JoinColumn(name = "user_id"),
        inverseJoinColumns = @JoinColumn(name = "role_id"))
private Set<Role> roles = new HashSet<>();

Wallet entity:

  @Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@NotEmpty(message = "Please, insert a wallet name")
private String walletName;

private double initialBalance;

@ManyToOne(fetch = FetchType.LAZY, optional = false)
@JoinColumn(name = "user_id", nullable = false, referencedColumnName = "id", insertable = false, updatable = false)
@OnDelete(action = OnDeleteAction.CASCADE)
@JsonIgnore
private User user;

@Column(name = "user_id", nullable = false)
private Long userId;


问:
React native: Horizontal FlatList flickers it's container background
When scrolling fast from RTL on a horizontal flatlist the container of flatlist background is shown for a quick instance on Android device. Is there a way to prevent this behavior?

You can see the example to reproduce issue at snack https://snack.expo.dev/@danro/flatlist-selectable

To reproduce error select android device and scroll to second/third item then quickly scroll to first item and you will observe the red background I set on parent container.


问:
Accessing a protocol's associated type in SwiftUI view produces compilation error
I have a protocol with an associated type and a property. When I try to access the property in a SwiftUI View using an if let statement, I get the compilation error 'Command CompileSwift failed with a nonzero exit code' (Xcode 14.1) without any more error information. Why does this not compile?

Minimum reproducible example:

```<code>protocol MyProtocol {
    associatedtype MyAssociatedType
    var myAssociatedType: MyAssociatedType { get set }
}

struct MyView: View {
    @Binding var myProtocol: (any MyProtocol)

    var body: some View {
        Group {
            if let string = $myProtocol.myAssociatedType as? Binding<String> {
                TextField("", text: string)
            } else {
                EmptyView()
            }
        }
    }
}
</code>```

Body:
I have a protocol with an associated type and a property. When I try to access the property in a SwiftUI View using an if let statement, I get the compilation error 'Command CompileSwift failed with a nonzero exit code' (Xcode 14.1) without any more error information. Why does this not compile?

Minimum reproducible example:

protocol MyProtocol {
    associatedtype MyAssociatedType
    var myAssociatedType: MyAssociatedType { get set }
}

struct MyView: View {
    @Binding var myProtocol: (any MyProtocol)

    var body: some View {
        Group {
            if let string = $myProtocol.myAssociatedType as? Binding<String> {
                TextField("", text: string)
            } else {
                EmptyView()
            }
        }
    }
}


问:
Open a pop up when you click a 3 dot button beside a text box to search something in pop up. click one of the returned data in search to fill text box
Hi I may have to improve how i ask this question but i will try my best on first go. I want to have text box with like a ... button beside it. When user clicks 3 dot button it should open up a pop up. In pop up i will have search box. if you type something in search box and click search button in pop up it will trigger an api call which will return data to be displayed in pop up in some angular tabular form. we use ag-grid in our project to display stuff like this.

for pop up i looked at https://www.primefaces.org/primeng/overlaypanel but not exactly fits this purpose i think. Any suggestions?


问:
How to send pdf file along with XML body using Rest assured?
I am trying to send a PDF file along with the XML payload for a soap request using Rest assured.. Without PDF file, request works fine but it gives error if I try to add pdf file along with the soap request

I have been trying this but it gives server error 500:

```<code>FileInputStream fis = new FileInputStream ("x.xml");

File file = new File("y.pdf");
RestAssured.baseURI = "wsdl";

Response response = given().multipart("file", file, "application/pdf")
    .relaxedHttpsValidation()
    .header("content-type", "multipart/xml").and()
    .body(IOUtils.toString(fis, "UTF-8")).when()
    .post("resource name").then().extract().response();
</code>```

Body:
I am trying to send a PDF file along with the XML payload for a soap request using Rest assured.. Without PDF file, request works fine but it gives error if I try to add pdf file along with the soap request

I have been trying this but it gives server error 500:

FileInputStream fis = new FileInputStream ("x.xml");

File file = new File("y.pdf");
RestAssured.baseURI = "wsdl";

Response response = given().multipart("file", file, "application/pdf")
    .relaxedHttpsValidation()
    .header("content-type", "multipart/xml").and()
    .body(IOUtils.toString(fis, "UTF-8")).when()
    .post("resource name").then().extract().response();