问:
Unable to understand why the error is occurring
I have been trying to concatenate two strings and assign them to a cell in an excel sheet. I am however unable to understand why the below-shown error is occurring as I cannot find any error in the functioning of the rest of the code

the error shown is:

```<code>Traceback (most recent call last):
  File "C:\Users\AdvaitSNambiar\Desktop\Myfolder\SUTT task\Final\task1test-2-final.py", line 63, in <module>
    ws['D' + str(i) ].value = ws['D' + str(i)].value + '+ EEE'
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
</code>```
```<code>if (h2 == 'A3'):
                ws['D' + str(i) ].value = ws['D' + str(i)].value + '+ EEE'
</code>```

this was the concatenation I tried to perform

my code is given below

```<code>import openpyxl
from openpyxl import load_workbook
wb = load_workbook('names.xlsx')
ws = wb.active
i = 0

while(i<24):
    i = 2
    while(i<24):
        idnum = ws['A' + str(i)]
        idnum1 = idnum.value
        idnum2 = idnum1[4:8]
        if (idnum2 == 'AAPS'):
            ws['D' + str(i)] = 'ECE'
        if (idnum2 == 'ABPS'):
            ws['D' + str(i) ] = 'Manu'
        if (idnum2 == 'A1PS'):
            ws['D' + str(i)] = 'chemical'
        if (idnum2 == 'A2PS'):
            ws['D' + str(i) ] = 'civil'
        if (idnum2 == 'A3PS'):
            ws['D' + str(i) ] = 'EEE'
        if (idnum2 == 'A4PS'):
            ws['D' + str(i)] = 'Mech'
        if (idnum2 == 'A5PS'):
            ws['D' + str(i) ] = 'pharma'
        if (idnum2 == 'A7PS'):
            ws['D' + str(i) ] = 'CSE'
        if (idnum2 == 'A8PS'):
            ws['D' + str(i) ] = 'ENI'
        if (idnum2 == 'B1PS'):
            ws['D' + str(i) ] = 'MSc Bio'
        if (idnum2 == 'B2PS'):
            ws['D' + str(i) ] = 'MSc Chem'
        if (idnum2 == 'B3PS'):
            ws['D' + str(i) ] = 'MSc Eco'
        if (idnum2 == 'B4PS'):
            ws['D' + str(i) ] = 'MSc Math'
        if (idnum2 == 'B5PS'):
            ws['D' + str(i) ] = 'MSc Physics'
        if (idnum2[-2:] != 'PS'):
            h1=idnum2[0:3]
            h2=idnum2[-2:]
            if (h1 == 'B1'):
                ws['D' + str(i) ].value = 'MSc Bio'
            if (h1 == 'B2'):
                ws['D' + str(i) ].value = 'MSc Chem'
            if (h1 == 'B3'):
                ws['D' + str(i) ].value = 'MSc Eco'
            if (h1 == 'B4'):
                ws['D' + str(i) ].value = 'MSc Math'
            if (h1 == 'B5'):
                ws['D' + str(i) ].value = 'MSc Physics'
            if (h2 == 'AA'):
                ws['D' + str(i)].value  = ws['D' + str(i)].value + '+ ECE'
            if (h2 == 'AB'):
                ws['D' + str(i) ].value = ws['D' + str(i)].value + '+ Manu'
            if (h2 == 'A1'):
                ws['D' + str(i)].value  = ws['D' + str(i)].value + '+ chemical'
            if (h2 == 'A2'):
                ws['D' + str(i) ].value = ws['D' + str(i)].value + '+ civil'
            if (h2 == 'A3'):
                ws['D' + str(i) ].value = ws['D' + str(i)].value + '+ EEE'
            if (h2 == 'A4'):
                ws['D' + str(i)].value  = ws['D' + str(i)].value + '+ Mech'
            if (h2 == 'A7'):
                ws['D' + str(i) ].value = ws['D' + str(i)].value + '+ CSE'
            if (h2 == 'A8'):
                ws['D' + str(i) ].value = ws['D' + str(i)].value + '+ ENI'
        i=i+1

j = 2
while(j<24):
    idnum3 = ws['A' + str(j)]
    idnum4 = idnum3.value
    idnum5 = idnum4[8:12]
    ws['E' + str(j)] = 'f2022' +idnum4+ '@pilani.bits-pilani.ac.in'
    j=j+1

wb.save('names.xlsx')

import pandas as pd

df1 = pd.read_excel('names.xlsx')

print(df1)

excel_data = pd.read_excel('names.xlsx',sheet_name='Sheet1')

json_str = excel_data.to_json(orient='records')

print('Excel Sheet to JSON:\n', json_str)

</code>```

Body:
I have been trying to concatenate two strings and assign them to a cell in an excel sheet. I am however unable to understand why the below-shown error is occurring as I cannot find any error in the functioning of the rest of the code

the error shown is:

Traceback (most recent call last):
  File "C:\Users\AdvaitSNambiar\Desktop\Myfolder\SUTT task\Final\task1test-2-final.py", line 63, in <module>
    ws['D' + str(i) ].value = ws['D' + str(i)].value + '+ EEE'
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

if (h2 == 'A3'):
                ws['D' + str(i) ].value = ws['D' + str(i)].value + '+ EEE'

this was the concatenation I tried to perform

my code is given below

import openpyxl
from openpyxl import load_workbook
wb = load_workbook('names.xlsx')
ws = wb.active
i = 0

while(i<24):
    i = 2
    while(i<24):
        idnum = ws['A' + str(i)]
        idnum1 = idnum.value
        idnum2 = idnum1[4:8]
        if (idnum2 == 'AAPS'):
            ws['D' + str(i)] = 'ECE'
        if (idnum2 == 'ABPS'):
            ws['D' + str(i) ] = 'Manu'
        if (idnum2 == 'A1PS'):
            ws['D' + str(i)] = 'chemical'
        if (idnum2 == 'A2PS'):
            ws['D' + str(i) ] = 'civil'
        if (idnum2 == 'A3PS'):
            ws['D' + str(i) ] = 'EEE'
        if (idnum2 == 'A4PS'):
            ws['D' + str(i)] = 'Mech'
        if (idnum2 == 'A5PS'):
            ws['D' + str(i) ] = 'pharma'
        if (idnum2 == 'A7PS'):
            ws['D' + str(i) ] = 'CSE'
        if (idnum2 == 'A8PS'):
            ws['D' + str(i) ] = 'ENI'
        if (idnum2 == 'B1PS'):
            ws['D' + str(i) ] = 'MSc Bio'
        if (idnum2 == 'B2PS'):
            ws['D' + str(i) ] = 'MSc Chem'
        if (idnum2 == 'B3PS'):
            ws['D' + str(i) ] = 'MSc Eco'
        if (idnum2 == 'B4PS'):
            ws['D' + str(i) ] = 'MSc Math'
        if (idnum2 == 'B5PS'):
            ws['D' + str(i) ] = 'MSc Physics'
        if (idnum2[-2:] != 'PS'):
            h1=idnum2[0:3]
            h2=idnum2[-2:]
            if (h1 == 'B1'):
                ws['D' + str(i) ].value = 'MSc Bio'
            if (h1 == 'B2'):
                ws['D' + str(i) ].value = 'MSc Chem'
            if (h1 == 'B3'):
                ws['D' + str(i) ].value = 'MSc Eco'
            if (h1 == 'B4'):
                ws['D' + str(i) ].value = 'MSc Math'
            if (h1 == 'B5'):
                ws['D' + str(i) ].value = 'MSc Physics'
            if (h2 == 'AA'):
                ws['D' + str(i)].value  = ws['D' + str(i)].value + '+ ECE'
            if (h2 == 'AB'):
                ws['D' + str(i) ].value = ws['D' + str(i)].value + '+ Manu'
            if (h2 == 'A1'):
                ws['D' + str(i)].value  = ws['D' + str(i)].value + '+ chemical'
            if (h2 == 'A2'):
                ws['D' + str(i) ].value = ws['D' + str(i)].value + '+ civil'
            if (h2 == 'A3'):
                ws['D' + str(i) ].value = ws['D' + str(i)].value + '+ EEE'
            if (h2 == 'A4'):
                ws['D' + str(i)].value  = ws['D' + str(i)].value + '+ Mech'
            if (h2 == 'A7'):
                ws['D' + str(i) ].value = ws['D' + str(i)].value + '+ CSE'
            if (h2 == 'A8'):
                ws['D' + str(i) ].value = ws['D' + str(i)].value + '+ ENI'
        i=i+1

j = 2
while(j<24):
    idnum3 = ws['A' + str(j)]
    idnum4 = idnum3.value
    idnum5 = idnum4[8:12]
    ws['E' + str(j)] = 'f2022' +idnum4+ '@pilani.bits-pilani.ac.in'
    j=j+1

wb.save('names.xlsx')

import pandas as pd

df1 = pd.read_excel('names.xlsx')

print(df1)

excel_data = pd.read_excel('names.xlsx',sheet_name='Sheet1')

json_str = excel_data.to_json(orient='records')

print('Excel Sheet to JSON:\n', json_str)


来源: stackexchange

问:
Google Cloud Java project cannot find endpoint library
I am trying to connect an app-engine application to a Tensforflow model running on a Vertex AI endpoint.
It works if I provide my personal authentication details but these need to be refreshed all the time.

Going through the documentation it sounds like App Engine can authenticate to an endpoint automatically using the endpoint APIs - Based on this example

Unfortunately Eclipse cannot find "com.google.cloud.aiplatform.*" and I am not sure which library should include this.

The documentation provides a list of all the standard libraries which can be defined in the Eclispe built-path but I am under the impression the endpoint API is not part of it.

Would be great to understand if there is a standard library I could add to make this work like "Google Cloud Platform Libraries -> Cloud Datastore"

Alternatively I could use another authentication method like an API keys but I could not figure out which service account needs which API key to authenticate against my end point.

Thank you

I am trying to compile the sample example provided here with Java 8 but Eclipse cannot find the library.

I was expecting to activate a standard Google Cloud library to get the example running and then figure out the authentication against the Google Cloud Endpoint.

ContentLicense: CC BY-SA 4.0


问:
Error in as.data.frame.default(y) : cannot coerce class ‘"function"’ to a data.frame
```<code># Use x in the left_join() function
combined_tb <-
  x %>%
  left_join(presentation.tree, by = "toElementId", copy = TRUE) %>%
  left_join(labels, by = c("toElementId"="elementId"), copy = TRUE) %>%
  select(roleId, fromElementId, toElementId, order, fromHref,
         toHref, concept, period, unit, value, decimals, labelString)
</code>```

I do get this error message:

Error in as.data.frame.default(y) :
cannot coerce class ‘"function"’ to a data.frame

I don't know what to do.

I tried to solve the issue but nothing works

Body:
# Use x in the left_join() function
combined_tb <-
  x %>%
  left_join(presentation.tree, by = "toElementId", copy = TRUE) %>%
  left_join(labels, by = c("toElementId"="elementId"), copy = TRUE) %>%
  select(roleId, fromElementId, toElementId, order, fromHref,
         toHref, concept, period, unit, value, decimals, labelString)

I do get this error message:

Error in as.data.frame.default(y) :
cannot coerce class ‘"function"’ to a data.frame

I don't know what to do.

I tried to solve the issue but nothing works


问:
When len() judges variables, it prompts TypeError: object of type 'NoneType' has no len()
get_magnet_hash() returns None or a list of 0~n elements.

```<code>def get_magnet(detail_url):
    magnet = get_magnet_hash(detail_url)
    print(type(magnet))
    if magnet != None:
        if len(magnet) == 0:
            return None
        return 'magnet:?xt=urn:btih:'+magnet[0]
    return None
</code>```

The if len(magnet) == 0:return None here is redundant, but I can only write it like this. If it is written as follows, then the code will prompt TypeError after running.

```<code>def get_magnet(detail_url):
    magnet = get_magnet_hash(detail_url)
    print(type(magnet))
    # This is wrong
    if (magnet != None) & (len(magnet) != 0):
        return 'magnet:?xt=urn:btih:'+magnet[0]
    return None
</code>```

I can't understand here, I'm a beginner in Python, can someone help me?

I'm hoping someone will tell me what's going on here, and why using a cleaner structure doesn't work? thank you!

Body:
get_magnet_hash() returns None or a list of 0~n elements.

def get_magnet(detail_url):
    magnet = get_magnet_hash(detail_url)
    print(type(magnet))
    if magnet != None:
        if len(magnet) == 0:
            return None
        return 'magnet:?xt=urn:btih:'+magnet[0]
    return None

The if len(magnet) == 0:return None here is redundant, but I can only write it like this. If it is written as follows, then the code will prompt TypeError after running.

def get_magnet(detail_url):
    magnet = get_magnet_hash(detail_url)
    print(type(magnet))
    # This is wrong
    if (magnet != None) & (len(magnet) != 0):
        return 'magnet:?xt=urn:btih:'+magnet[0]
    return None

I can't understand here, I'm a beginner in Python, can someone help me?

I'm hoping someone will tell me what's going on here, and why using a cleaner structure doesn't work? thank you!


问:
In flutter while I am running app on iOS simulator screen is getting black while I am testing build ask in Android phones it is working fine
enter image description here

Everything is fine while running flutter doctor command


问:
how to raise a entity with mouse when x, y was locked in cesium
I want to change a point’s height by mouse, only height, because longitude and latitude was fixed.
please give some idea..., thanks

The effect is as follows
picture

I try to convert mouse's position to coordinates it's useless, and I try to convert to screen pixel to distance the Proportional problem was happen


问:
Paragraph alignment changes on some files Adobe Acrobat convert
I'm trying to extract text from PDF by converting PDF to HTML using Adobe Acrobat SDK and Python as Acrobat is the only tool that gives out the proper structure of the actual PDF. Some files are okay but in some files, one or two paragraphs leave out somehow, but, the exact paragraph in the pdf looks perfect. It would be great if someone sheds light on this, please.

My Python code to convert:

```<code>src = 'location to pdf file'
AvDoc = Dispatch("AcroExch.AVDoc")
if AvDoc.Open(src, ""):
    pdDoc = AvDoc.GetPDDoc()
    jsObject = pdDoc.GetJSObject()
    jsObject.SaveAs(filename+ ".html", "com.adobe.acrobat.html")
</code>```

Sample PDF file:

20.pdf

Respective HTML file:

20.pdf.html

It's not happening in all PDFs. if you think it might be caused by an empty signature widget, all PDFs have them.

If you consider the '2.' point in the HTML, it is totally collapsed and out of the 'ol' tag which contains other points in a perfect structure.

Please help.

Body:
I'm trying to extract text from PDF by converting PDF to HTML using Adobe Acrobat SDK and Python as Acrobat is the only tool that gives out the proper structure of the actual PDF. Some files are okay but in some files, one or two paragraphs leave out somehow, but, the exact paragraph in the pdf looks perfect. It would be great if someone sheds light on this, please.

My Python code to convert:

src = 'location to pdf file'
AvDoc = Dispatch("AcroExch.AVDoc")
if AvDoc.Open(src, ""):
    pdDoc = AvDoc.GetPDDoc()
    jsObject = pdDoc.GetJSObject()
    jsObject.SaveAs(filename+ ".html", "com.adobe.acrobat.html")

Sample PDF file:

20.pdf

Respective HTML file:

20.pdf.html

It's not happening in all PDFs. if you think it might be caused by an empty signature widget, all PDFs have them.

If you consider the '2.' point in the HTML, it is totally collapsed and out of the 'ol' tag which contains other points in a perfect structure.

Please help.


问:
How to add user last login date in Azure AD B2C?
I created a custom attribute in Azure AD B2C in TrustFrameforkExtensions.xml

Add ClaimType

```<code><ClaimType Id="extension_LastLogin">
    <DisplayName>extension_LastLogin</DisplayName>
    <DataType>dateTime</DataType>
    <DefaultPartnerClaimTypes>
        <Protocol Name="OpenIdConnect" PartnerClaimType="lastLogin"/>
    </DefaultPartnerClaimTypes>
</ClaimType>
</code>```

Add ClaimsTransformation

```<code><ClaimsTransformation Id="GetLastLoginDateTime" TransformationMethod="GetCurrentDateTime">
    <OutputClaims>
        <OutputClaim ClaimTypeReferenceId="extension_LastLogin" TransformationClaimType="currentDateTime"/>
    </OutputClaims>
</ClaimsTransformation>
</code>```

Add in TechnicalPrifile this

```<code><InputClaimsTransformations>
    <InputClaimsTransformation ReferenceId="GetLastLoginDateTime" />
</InputClaimsTransformations>
<InputClaims>
    <InputClaim ClaimTypeReferenceId="extension_LastLogin" />
</InputClaims>
<OutputClaims>
    <OutputClaim ClaimTypeReferenceId="extension_LastLogin" />
</OutputClaims>
</code>```

Also added Claims to RelyingParty (SignUp\LogIn and others.)

This is not the first field which I`ve added, but the only problem with this.
But when I try to get the attribute value using .Net SDK, there is no such field.

This field exists in claims in AuthenticationContext, But not exists in Graph API response

Body:
I created a custom attribute in Azure AD B2C in TrustFrameforkExtensions.xml

Add ClaimType

<ClaimType Id="extension_LastLogin">
    <DisplayName>extension_LastLogin</DisplayName>
    <DataType>dateTime</DataType>
    <DefaultPartnerClaimTypes>
        <Protocol Name="OpenIdConnect" PartnerClaimType="lastLogin"/>
    </DefaultPartnerClaimTypes>
</ClaimType>

Add ClaimsTransformation

<ClaimsTransformation Id="GetLastLoginDateTime" TransformationMethod="GetCurrentDateTime">
    <OutputClaims>
        <OutputClaim ClaimTypeReferenceId="extension_LastLogin" TransformationClaimType="currentDateTime"/>
    </OutputClaims>
</ClaimsTransformation>

Add in TechnicalPrifile this

<InputClaimsTransformations>
    <InputClaimsTransformation ReferenceId="GetLastLoginDateTime" />
</InputClaimsTransformations>
<InputClaims>
    <InputClaim ClaimTypeReferenceId="extension_LastLogin" />
</InputClaims>
<OutputClaims>
    <OutputClaim ClaimTypeReferenceId="extension_LastLogin" />
</OutputClaims>

Also added Claims to RelyingParty (SignUp\LogIn and others.)

This is not the first field which I`ve added, but the only problem with this.
But when I try to get the attribute value using .Net SDK, there is no such field.

This field exists in claims in AuthenticationContext, But not exists in Graph API response


问:
Mysql and php correct way to output data
I am working with PHP and MySQL, this is just a simple example of what I need.
I want to collect data as is shown in the last table. Combine data from all 3 tables.

What is the right way to print them as they are in the last table on the image instead of having every record as a new row after joining tables?
Should I use subquery somehow or 1st loop through "users" and for each user 2nd loop through "discipline" and then 3rd loop through "fight" and print out wins for each fight of each user?
Data does not have to be exactly printed as shown, just to have in the output table for each user, total number of wins with each discipline sorted by total number of wins (sorting is working already).

Many thanks in advance.

db structure:

I was able to get results but looping 3 times. I am hoping there is a better, cleaner solution.


问:
SqlKata exec stored procedure
I have tried different ways with the QueryFactory to execute a stored procedure that contains a parameter. However, an error message always comes up.

Example 1:

```<code>Dim DtChange As New LastChangeOnTableDataTable,Compiler As New SqlServerCompiler
Dim Con As New SqlClient.SqlConnection(ConRelease), Db As New QueryFactory(Con, Compiler)
Dim Query = Db.Select("exec LastChangeOnTable @TableName",MyTable.TableName)

</code>```

error message: System.Data.SqlClient.SqlException: The @TableName scalar variable must be declared

Example 2:

```<code>Dim DtChange As New LastChangeOnTableDataTable,Compiler As New SqlServerCompiler
Dim Con As New SqlClient.SqlConnection(ConRelease), Db As New QueryFactory(Con, Compiler)
Dim Query = Db.Select("LastChangeOnTable @TableName",MyTable.TableName)
</code>```

Same error message as in example 1.

Example 3:

```<code>Dim DtChange As New LastChangeOnTableDataTable,Compiler As New SqlServerCompiler
Dim Con As New SqlClient.SqlConnection(ConRelease), Db As New QueryFactory(Con, Compiler)
Dim Query = Db.Select("LastChangeOnTable",MyTable.TableName)
</code>```

error message: System.Data.SqlClient.SqlException: "The procedure or function 'LastChangeOnTable' expects the @TableName parameter, which was not provided."

The error message always occurs at the line Dim Query = Db.Select

What am I doing wrong? I could not find anything in the SqlKata documentation. And neither through the Google search nor through the forum search I could not find anything helpful.

Title: SqlKata exec stored procedure

Body:
I have tried different ways with the QueryFactory to execute a stored procedure that contains a parameter. However, an error message always comes up.

Example 1:

Dim DtChange As New LastChangeOnTableDataTable,Compiler As New SqlServerCompiler
Dim Con As New SqlClient.SqlConnection(ConRelease), Db As New QueryFactory(Con, Compiler)
Dim Query = Db.Select("exec LastChangeOnTable @TableName",MyTable.TableName)

error message: System.Data.SqlClient.SqlException: The @TableName scalar variable must be declared

Example 2:

Dim DtChange As New LastChangeOnTableDataTable,Compiler As New SqlServerCompiler
Dim Con As New SqlClient.SqlConnection(ConRelease), Db As New QueryFactory(Con, Compiler)
Dim Query = Db.Select("LastChangeOnTable @TableName",MyTable.TableName)

Same error message as in example 1.

Example 3:

Dim DtChange As New LastChangeOnTableDataTable,Compiler As New SqlServerCompiler
Dim Con As New SqlClient.SqlConnection(ConRelease), Db As New QueryFactory(Con, Compiler)
Dim Query = Db.Select("LastChangeOnTable",MyTable.TableName)

error message: System.Data.SqlClient.SqlException: "The procedure or function 'LastChangeOnTable' expects the @TableName parameter, which was not provided."

The error message always occurs at the line Dim Query = Db.Select

What am I doing wrong? I could not find anything in the SqlKata documentation. And neither through the Google search nor through the forum search I could not find anything helpful.


问:
Any difference between the varaible defined by the command line and the option in the `CMakeLists.txt`
Here is the shell script which invokes the cmake

```<code>rm -rf build && mkdir build && cd build && cmake .. -DWITH_FOO=ON
</code>```

Here is the CMakeLists.txt:

```<code>cmake_minimum_required(VERSION 3.13)

option(WITH_FOO "whether FOO is enabled or not" off)

if(WITH_FOO)
    message("Attention! FOO is enabled!")
    add_compile_definitions(WITH_FOO_ENABLED)
endif()

add_executable(demo main.c)
</code>```

Here is the content of the main.c:

```<code>int main(){return 0;}
</code>```

Here is the output when the aforementioned shell script is called:

```<code>-- The C compiler identification is GNU 4.9.4
-- The CXX compiler identification is GNU 4.9.4
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
Attention! FOO is enabled!
-- Configuring done
-- Generating done
-- Build files have been written to: /data/Jhon/demo/build
</code>```

Is there a variable named WITH_FOO that has ever been defined by the aforementioned command line(i.e. cmake .. -DWITH_FOO=ON)?

If the answer is yes, then does the  option also define a variable named WITH_FOO if the command line is cmake .. without -DWITH_FOO=ON?

Body:
Here is the shell script which invokes the cmake

rm -rf build && mkdir build && cd build && cmake .. -DWITH_FOO=ON

Here is the CMakeLists.txt:

cmake_minimum_required(VERSION 3.13)

option(WITH_FOO "whether FOO is enabled or not" off)

if(WITH_FOO)
    message("Attention! FOO is enabled!")
    add_compile_definitions(WITH_FOO_ENABLED)
endif()

add_executable(demo main.c)

Here is the content of the main.c:

int main(){return 0;}

Here is the output when the aforementioned shell script is called:

-- The C compiler identification is GNU 4.9.4
-- The CXX compiler identification is GNU 4.9.4
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
Attention! FOO is enabled!
-- Configuring done
-- Generating done
-- Build files have been written to: /data/Jhon/demo/build

Is there a variable named WITH_FOO that has ever been defined by the aforementioned command line(i.e. cmake .. -DWITH_FOO=ON)?

If the answer is yes, then does the  option also define a variable named WITH_FOO if the command line is cmake .. without -DWITH_FOO=ON?


问:
#1109 - Unknown table 'master_benang' in field list
```<code>BEGIN
            IF (master_benang.jenis_benang = NEW.jenis_benang && NEW.LOT = master_benang.LOT)
            THEN
            UPDATE master_benang
            SET BOX_KRG= BOX_KRG + NEW.BOX_KRG,
             KG= KG + NEW.KG,
             BALE= BALE + NEW.BALE
             WHERE jenis_benang = NEW.jenis_benang && LOT = NEW.LOT ;
            ELSE
            INSERT INTO master_benang (id_supplier, jenis_benang, tipe_benang, LOT, BOX_KRG, KG, BALE, keterangan)
            VALUES(NEW.id_supplier, NEW.jenis_benang, NEW.tipe_benang, NEW.LOT, NEW.BOX_KRG, NEW.KG, NEW.BALE, NEW.keterangan);
             END IF;
            END
</code>```

I tried the trigger above and it doesn't have any problem when I run it but when I insert data in the table which has the trigger the code doesn't work and shows an error
#1109 - Unknown table 'master_benang' in field list

Body:
BEGIN
            IF (master_benang.jenis_benang = NEW.jenis_benang && NEW.LOT = master_benang.LOT)
            THEN
            UPDATE master_benang
            SET BOX_KRG= BOX_KRG + NEW.BOX_KRG,
             KG= KG + NEW.KG,
             BALE= BALE + NEW.BALE
             WHERE jenis_benang = NEW.jenis_benang && LOT = NEW.LOT ;
            ELSE
            INSERT INTO master_benang (id_supplier, jenis_benang, tipe_benang, LOT, BOX_KRG, KG, BALE, keterangan)
            VALUES(NEW.id_supplier, NEW.jenis_benang, NEW.tipe_benang, NEW.LOT, NEW.BOX_KRG, NEW.KG, NEW.BALE, NEW.keterangan);
             END IF;
            END

I tried the trigger above and it doesn't have any problem when I run it but when I insert data in the table which has the trigger the code doesn't work and shows an error
#1109 - Unknown table 'master_benang' in field list


问:
Testing Data grid
I want to test the functionality of changing page size using RTL and enzyme. I wrote the test case but it's not working. I think the modal is not getting opened when I am triggering the click. This is the test case that I wrote. I have also attached the

```<code>describe('Datagrid',() => {
    it('change page size', async () => {
        render(<DataGridDemo />)
        const reqbtn = await screen.findByRole('button', {
            name: /rows per page: 5/i
        })
        await act(async ()=> {
            await fireEvent.click(reqbtn)

        })
        const modal = await screen.findByRole('presentation')
        console.log(prettyDOM(modal))
        fireEvent.click(screen.getByRole('option', { name: /10/i }))
    })
})
</code>```

codesandbox

Title: Testing Data grid

Body:
I want to test the functionality of changing page size using RTL and enzyme. I wrote the test case but it's not working. I think the modal is not getting opened when I am triggering the click. This is the test case that I wrote. I have also attached the

describe('Datagrid',() => {
    it('change page size', async () => {
        render(<DataGridDemo />)
        const reqbtn = await screen.findByRole('button', {
            name: /rows per page: 5/i
        })
        await act(async ()=> {
            await fireEvent.click(reqbtn)

        })
        const modal = await screen.findByRole('presentation')
        console.log(prettyDOM(modal))
        fireEvent.click(screen.getByRole('option', { name: /10/i }))
    })
})

codesandbox


问:
Issue with Index was out of range. Must be non-negative and less than the size of the collection

Please help me to solve this error as I tried in more than one way
When I try to change in cell number 5, the error appears, but the error does not appear if I try to change in any other cell

```<code>Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        For item As Integer = 0 To Employee_Shift_DetailDataGridView.RowCount - 1

            Employee_Shift_DetailDataGridView.Rows(item).Cells(5).Value = "001"

        Next
    End Sub
</code>```

Thanks.

I tried to change the selection mode

Body:
Please help me to solve this error as I tried in more than one way
When I try to change in cell number 5, the error appears, but the error does not appear if I try to change in any other cell

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        For item As Integer = 0 To Employee_Shift_DetailDataGridView.RowCount - 1

            Employee_Shift_DetailDataGridView.Rows(item).Cells(5).Value = "001"

        Next
    End Sub

Thanks.

I tried to change the selection mode


问:
Extract password protected RAR file into memory and run exe from memory using C#
I have created .NET core 6.0 C# Winform Application.

Example:
I have a folder Teracopy\teracopy.exe
Created password protected file Teracopy.rar
password is:  123

How can I unrar this file directly into memory and run teracopy.exe from memory?
(Without extracting in Disk)

Is there any way to do this?
I able to extract password protected rar files to disk.

For security purpose I don't want to extract them into disk.


问:
How can we handle long running processes using serverless architecture in azure?
I'm looking for something similar to ECS task where it will just run the long running task like terraform scripts without any time limit.
Do we have any better approach in serverless architecture where we can just ask to perform a long running task and wait till it gets completed without timeout. Also we can not logically break the functionality or store the current status of the task and call the other function to perform the task.

I have already explored durable function where each function (starter/orchestrator/activity) still has the time limit. In AWS we can ask lambda to trigger ecs task and ecs task can perform the long running process. I'm looking for something similar in azure.


问:
View gets returned only on reload in laravel
So here's my update function in orderDetials controller. when I click the submit button in the editing form, it gives my a 404 page and when I reload the page it gets the record saved and return the view. So why doesn't it work from the first time and work when I reload the page.

```<code>public function update(UpdateOrderDetailRequest $request, OrderDetail $orderDetail)
{
    $orderDetail->update($request->all());

    $item_id =$request->input('order_item_id');

    $item = Product::findOrFail($item_id);

    $amount = $item->price * $request['quantity'];

    $order_id = $orderDetail->order_id;

    $old_total = $order->subtotal;

    $total = $old_total +  $amount;

    $order->update(['subtotal' => $total]);

    $orderDetail->update(['amount' => $amount]);

    return redirect()->action([HomeController::class, 'index']);
}
</code>```

edit view

```<code>        <form method="POST" action="{{ route("admin.order-details.update", [$orderDetail->id]) }}" enctype="multipart/form-data">
        @method('PUT')
        @csrf
        <div class="form-group">
            <label class="required" for="order_item_id">{{ trans('cruds.orderDetail.fields.order_item') }}</label>
            <select class="form-control select2 {{ $errors->has('order_item') ? 'is-invalid' : '' }}" name="order_item_id" id="order_item_id" required>
                @foreach($order_items as $id => $entry)
                    <option style="color:black;" value="{{ $id }}" {{ (old('order_item_id') ? old('order_item_id') : $orderDetail->order_item->id ?? '') == $id ? 'selected' : '' }}>{{ $entry }}</option>
                @endforeach
            </select>
            @if($errors->has('order_item'))
                <div class="invalid-feedback">
                    {{ $errors->first('order_item') }}
                </div>
            @endif
            <span class="help-block">{{ trans('cruds.orderDetail.fields.order_item_helper') }}</span>
        </div>
        <div class="form-group">
            <label class="required" for="quantity">{{ trans('cruds.orderDetail.fields.quantity') }}</label>
            <input class="form-control {{ $errors->has('quantity') ? 'is-invalid' : '' }}" type="number" name="quantity" id="quantity" value="{{ old('quantity', $orderDetail->quantity) }}" step="1" required>
            @if($errors->has('quantity'))
                <div class="invalid-feedback">
                    {{ $errors->first('quantity') }}
                </div>
            @endif
            <span class="help-block">{{ trans('cruds.orderDetail.fields.quantity_helper') }}</span>
        </div>
        <div class="form-group">
            <button class="btn btn-outline-theme" type="submit">
                {{ trans('global.save') }}
            </button>
        </div>
    </form>
</code>```

Body:
So here's my update function in orderDetials controller. when I click the submit button in the editing form, it gives my a 404 page and when I reload the page it gets the record saved and return the view. So why doesn't it work from the first time and work when I reload the page.

public function update(UpdateOrderDetailRequest $request, OrderDetail $orderDetail)
{
    $orderDetail->update($request->all());

    $item_id =$request->input('order_item_id');

    $item = Product::findOrFail($item_id);

    $amount = $item->price * $request['quantity'];

    $order_id = $orderDetail->order_id;

    $old_total = $order->subtotal;

    $total = $old_total +  $amount;

    $order->update(['subtotal' => $total]);

    $orderDetail->update(['amount' => $amount]);

    return redirect()->action([HomeController::class, 'index']);
}

edit view

        <form method="POST" action="{{ route("admin.order-details.update", [$orderDetail->id]) }}" enctype="multipart/form-data">
        @method('PUT')
        @csrf

            {{ trans('cruds.orderDetail.fields.order_item') }}
            <select class="form-control select2 {{ $errors->has('order_item') ? 'is-invalid' : '' }}" name="order_item_id" id="order_item_id" required>
                @foreach($order_items as $id => $entry)
                    <option style="color:black;" value="{{ $id }}" {{ (old('order_item_id') ? old('order_item_id') : $orderDetail->order_item->id ?? '') == $id ? 'selected' : '' }}>{{ $entry }}</option>
                @endforeach
            </select>
            @if($errors->has('order_item'))

                    {{ $errors->first('order_item') }}

            @endif
            {{ trans('cruds.orderDetail.fields.order_item_helper') }}

            {{ trans('cruds.orderDetail.fields.quantity') }}
            <input class="form-control {{ $errors->has('quantity') ? 'is-invalid' : '' }}" type="number" name="quantity" id="quantity" value="{{ old('quantity', $orderDetail->quantity) }}" step="1" required>
            @if($errors->has('quantity'))

                    {{ $errors->first('quantity') }}

            @endif
            {{ trans('cruds.orderDetail.fields.quantity_helper') }}

            <button class="btn btn-outline-theme" type="submit">
                {{ trans('global.save') }}
            </button>

    </form>


问:
How to get Public Instagram User Posts with React?
I have a REACT application, it is a portfolio site for a children's fashion store, I want to link the instagram posts on the site.
The store's Instagram is a public instagram.
In the old days I could easily get everything related to a particular instagram profile using the URL https://www.instagram.com/nameOfPublicUser/?a__=1
Today I get a Cross-Origin Read Blocking (CORB) error where the API call is not allowed.
Reading the developers.facebook.com documentation, they tell me to use the GraphAPI.

Reading the GRAPHAPI documentation, it informs us that it is necessary to get access tokens to be able to use the GraphAPI.

Reading the ACCESS TOKEN documentation, in order to perform queries to the graphAPI we must have the permission of the user that is accessing our application, i.e., my brochure site. From the moment he logs in we need to get his authorization, and we do this through Facebook Login.

Reading the FACEBOOK LOGIN documentation, we must "register" our app at developers.facebook.com and implement the Facebook SDK for Javascript.

Anyway, so much work to just pull PUBLIC data from a PUBLIC profile to display on my site.
Is there an easy call API to bring up the POSTS from a public instagram profile?


问:
"this.root() is null" errors when using clipPath and MaskPath - SVG.js
I have a routine that attaches an image to my SVG canvas and on load, it creates a rectangle with rounded corners so I can clip the image. This is run multiple times, fed by an array of image addresses.

Method 1 - clipWith()

The clipping does work (the final image looks fine) but it's throwing errors in the console on the on the clipWith() line:

```<code>this.root() is null
</code>```

Errors occur with each run through the same array of images but on different images each time.

```<code>const newImage = newNested.image(imageData, (e) => {
  const newWidth = e.target.naturalHeight;
  const newHeight = e.target.naturalWidth;
  const clipper = newNested.clip();
  clipper.rect(newWidth, newHeight).attr({ rx: 5, ry: 5 }).fill('#000');
  newImage.clipWith(clipper);
}
</code>```

Method 2 - maskWith()

Same error as above whilst the output SVG is fine:

```<code>const newImage = newNested.image(imageData, (e) => {
  const newWidth = e.target.naturalHeight;
  const newHeight = e.target.naturalWidth;
  const masker = newNested.rect(newWidth, newHeight).attr({ rx: 5, ry: 5 }).fill('#000');
  newImage.maskWith(masker);
}
</code>```

Method 3 - SVG.ClipPath()

I have also looked through the docs and the Github issues and found other ways to render a clipping mask:

```<code>const newImage = newNested.image(imageData, (e) => {
  const newWidth = e.target.naturalHeight;
  const newHeight = e.target.naturalWidth;
  const clipPath = new SVG.ClipPath();
  clipPath.rect(newWidth, newHeight).attr({ rx: imageNode.r, ry: imageNode.r }).fill('#000');
  newImage.clipWith(clipPath);
}
</code>```

Yet this throws the following error:

```<code> Uncaught TypeError: _svgdotjs_svg_js__WEBPACK_IMPORTED_MODULE_2__.SVG.ClipPath is not a constructor
</code>```

And from looking at the docs, there is this one line that doesn't explain if this is related but trying it with SVGElement.ClipPath() got the same result:

Note: All properties that were former available on the global SVG
object need to be imported now, see example below:

import { SVG, extend as SVGextend, Element as SVGElement } from'@svgdotjs/svg.js'

Body:
I have a routine that attaches an image to my SVG canvas and on load, it creates a rectangle with rounded corners so I can clip the image. This is run multiple times, fed by an array of image addresses.

Method 1 - clipWith()

The clipping does work (the final image looks fine) but it's throwing errors in the console on the on the clipWith() line:

this.root() is null

Errors occur with each run through the same array of images but on different images each time.

const newImage = newNested.image(imageData, (e) => {
  const newWidth = e.target.naturalHeight;
  const newHeight = e.target.naturalWidth;
  const clipper = newNested.clip();
  clipper.rect(newWidth, newHeight).attr({ rx: 5, ry: 5 }).fill('#000');
  newImage.clipWith(clipper);
}

Method 2 - maskWith()

Same error as above whilst the output SVG is fine:

const newImage = newNested.image(imageData, (e) => {
  const newWidth = e.target.naturalHeight;
  const newHeight = e.target.naturalWidth;
  const masker = newNested.rect(newWidth, newHeight).attr({ rx: 5, ry: 5 }).fill('#000');
  newImage.maskWith(masker);
}

Method 3 - SVG.ClipPath()

I have also looked through the docs and the Github issues and found other ways to render a clipping mask:

const newImage = newNested.image(imageData, (e) => {
  const newWidth = e.target.naturalHeight;
  const newHeight = e.target.naturalWidth;
  const clipPath = new SVG.ClipPath();
  clipPath.rect(newWidth, newHeight).attr({ rx: imageNode.r, ry: imageNode.r }).fill('#000');
  newImage.clipWith(clipPath);
}

Yet this throws the following error:

 Uncaught TypeError: _svgdotjs_svg_js__WEBPACK_IMPORTED_MODULE_2__.SVG.ClipPath is not a constructor

And from looking at the docs, there is this one line that doesn't explain if this is related but trying it with SVGElement.ClipPath() got the same result:

Note: All properties that were former available on the global SVG
object need to be imported now, see example below:

import { SVG, extend as SVGextend, Element as SVGElement } from'@svgdotjs/svg.js'


问:
The fallback between variable and the `option`
As the answer, which says that[emphasize mine]:

WITH_FOO is the option, not a variable. unset(WITH_FOO) tries to unset the variable WITH_FOO, that does not exits. The variable does not exist and if(WITH_FOO) fallbacks to value of the option WITH_FOO. You might want to set the variable set(WITH_FOO OFF).

How to understand the fallback in the right way?

The command line cmake .. -DMacro_name=value always defines a variable? And the option does not define a variable if there is no variable with the same name has been defined?

Here is the shell script which invokes the cmake

```<code>rm -rf build && mkdir build && cd build && cmake .. -DPULISH_VERSION=ON
</code>```

Here is the CMakeLists.txt:

```<code>cmake_minimum_required(VERSION 3.13)

option(WITH_FOO "whether FOO is enabled or not" on)
option(PULISH_VERSION "whether is the pulished verion or not" on)

if(PULISH_VERSION)
    if(WITH_FOO)
        message("FOO should not be enabled for the published version.")
        unset(WITH_FOO)
    endif()
endif()

if(WITH_FOO)
    message("Attention! FOO is enabled!")
    add_compile_definitions(WITH_FOO_ENABLED)
endif()

add_executable(demo main.c)
</code>```

Body:
As the answer, which says that[emphasize mine]:

WITH_FOO is the option, not a variable. unset(WITH_FOO) tries to unset the variable WITH_FOO, that does not exits. The variable does not exist and if(WITH_FOO) fallbacks to value of the option WITH_FOO. You might want to set the variable set(WITH_FOO OFF).

How to understand the fallback in the right way?

The command line cmake .. -DMacro_name=value always defines a variable? And the option does not define a variable if there is no variable with the same name has been defined?

Here is the shell script which invokes the cmake

rm -rf build && mkdir build && cd build && cmake .. -DPULISH_VERSION=ON

Here is the CMakeLists.txt:

cmake_minimum_required(VERSION 3.13)

option(WITH_FOO "whether FOO is enabled or not" on)
option(PULISH_VERSION "whether is the pulished verion or not" on)

if(PULISH_VERSION)
    if(WITH_FOO)
        message("FOO should not be enabled for the published version.")
        unset(WITH_FOO)
    endif()
endif()

if(WITH_FOO)
    message("Attention! FOO is enabled!")
    add_compile_definitions(WITH_FOO_ENABLED)
endif()

add_executable(demo main.c)


问:
Extracting data from a CSV to show in a GUI
I'm trying to find a way to display data from a csv in a GUI.

For the first part it is already working:
(I'm fairly new to coding, so im not quite sure, how much information is needed here)

```<code>
class PreoperativeDialog(QDialog):
    """Dialog to introduce all important information of preoperative data ('indication check')"""

    def __init__(self, parent=None):
        """Initializer."""
        super().__init__(parent)

        self.date = 'preoperative'  # defines the date at which data are taken from/saved at
        subj_details = General.read_current_subj()
        General.synchronize_data_with_general(self.date, subj_details.id[0],
                                              messagebox=False)

        # ====================    Create General Layout      ====================
.
.
.

def updatetext(self):
    """adds information extracted from database already provided"""

    df_subj = Content.extract_saved_data(self.date)

    self.lineEditFirstDiagnosed.setText(str(df_subj["First_Diagnosed_preop"][0])) \
        if str(df_subj["First_Diagnosed_preop"][0]) != 'nan' else self.lineEditFirstDiagnosed.setText('')
    self.lineEditAdmNeurIndCheck.setText(str(df_subj['Admission_preop'][0])) \
        if str(df_subj["Admission_preop"][0]) != 'nan' else self.lineEditAdmNeurIndCheck.setText('')
    self.DismNeurIndCheckLabel.setText(str(df_subj['Dismissal_preop'][0])) \
        if str(df_subj["Dismissal_preop"][0]) != 'nan' else self.DismNeurIndCheckLabel.setText('')
    self.lineEditOutpatientContact.setText(str(df_subj['Outpat_Contact_preop'][0])) \
        if str(df_subj["Outpat_Contact_preop"][0]) != 'nan' else self.lineEditOutpatientContact.setText('')
    self.lineEditNChContact.setText(str(df_subj['nch_preop'][0])) \
        if str(df_subj["nch_preop"][0]) != 'nan' else self.lineEditNChContact.setText('')
    self.lineEditDBSconferenceDate.setText(str(df_subj['DBS_Conference_preop'][0])) \
        if str(df_subj["DBS_Conference_preop"][0]) != 'nan' else self.lineEditDBSconferenceDate.setText('')

return
</code>```

my helper functions:

```<code>class Content:
    def __init__(self, _debug=False):
        pass

    @staticmethod
    def extract_saved_data(condition):
        """ defines a list of columns for the csv files in the data folder; if id not found,
        dictionary remains empty"""

        subj_id = General.read_current_subj().id[0] # reads data from curent_subj (saved in ./tmp)
        df = General.import_dataframe('{}.csv'.format(condition), separator_csv=',')
        if df.shape[1] == 1:
            df = General.import_dataframe('{}.csv'.format(condition), separator_csv=';')
        df_subj = df.iloc[df.index[df['ID'] == subj_id].tolist()].to_dict('list')

list_preop = ["ID", "PID", "Gender",.... #some more stuff here ]

return df_subj
</code>```

This part works great and all the information is extracted from the csv.

Now the problem:

I also have a button, that brings me to a different GUI:

```<code>self.ButtonEnterMedication.clicked.connect(self.onClickedMedication)

</code>```

In the new window the same thing should happen. Available data from the CSV shoud be extracted an displayed there, but it doesnt work.

My code looks like this:

```<code>def __init__(self, visit='unknown', parent=None):
    super().__init__(parent)

    # ====================    Create General Layout      ====================

.
.
.

def updatetext(self):
    """adds information extracted from database already provided"""

    df_subj = Content.extract_saved_data(self.date)

    self.lineEditLevodopaCarbidopa.setText(str(df_subj["Levodopa_Carbidopa_preop"][0])) \
        if str(df_subj["Levodopa_Carbidopa_preop"][0]) != 'nan' else self.lineEditLevodopaCarbidopa.setText('')
    self.lineEditLevodopaCarbidopaCR.setText(str(df_subj["Levodopa_Carbidopa_CR_preop"][0])) \
        if str(df_subj["Levodopa_Carbidopa_CR_preop"][0]) != 'nan' else self.lineEditLevodopaCarbidopaCR.setText('')
    self.lineEditEntacapone.setText(str(df_subj["Entacapone_preop"][0])) \
        if str(df_subj["Entacapone_preop"][0]) != 'nan' else self.lineEditEntacapone.setText('')
    self.lineEditTolcapone.setText(str(df_subj["Tolcapone_preop"][0])) \
        if str(df_subj["Tolcapone_preop"][0]) != 'nan' else self.lineEditTolcapone.setText('')
    self.lineEditPramipexole.setText(str(df_subj["Pramipexole_preop"][0])) \
        if str(df_subj["Pramipexole_preop"][0]) != 'nan' else self.lineEditPramipexole.setText('')
    self.lineEditRopinirole.setText(str(df_subj["Ropinirole_preop"][0])) \
        if str(df_subj["Ropinirole_preop"][0]) != 'nan' else self.lineEditRopinirole.setText('')
    self.lineEditRotigotine.setText(str(df_subj["Rotigotine_preop"][0])) \
        if str(df_subj["Rotigotine_preop"][0]) != 'nan' else self.lineEditRotigotine.setText('')
    self.lineEditSelegiline_oral.setText(str(df_subj["Selegiline_preop"][0])) \
        if str(df_subj["Selegiline_preop"][0]) != 'nan' else self.lineEditSelegiline_oral.setText('')

</code>```

So basically I tried the same thing as before. But no data is displayed.

I hope someone can help me.
Thank you!

I tried to use the same kind of code as before, where it worke.

Body:
I'm trying to find a way to display data from a csv in a GUI.

For the first part it is already working:
(I'm fairly new to coding, so im not quite sure, how much information is needed here)

class PreoperativeDialog(QDialog):
    """Dialog to introduce all important information of preoperative data ('indication check')"""

    def __init__(self, parent=None):
        """Initializer."""
        super().__init__(parent)

        self.date = 'preoperative'  # defines the date at which data are taken from/saved at
        subj_details = General.read_current_subj()
        General.synchronize_data_with_general(self.date, subj_details.id[0],
                                              messagebox=False)

        # ====================    Create General Layout      ====================
.
.
.

def updatetext(self):
    """adds information extracted from database already provided"""

    df_subj = Content.extract_saved_data(self.date)

    self.lineEditFirstDiagnosed.setText(str(df_subj["First_Diagnosed_preop"][0])) \
        if str(df_subj["First_Diagnosed_preop"][0]) != 'nan' else self.lineEditFirstDiagnosed.setText('')
    self.lineEditAdmNeurIndCheck.setText(str(df_subj['Admission_preop'][0])) \
        if str(df_subj["Admission_preop"][0]) != 'nan' else self.lineEditAdmNeurIndCheck.setText('')
    self.DismNeurIndCheckLabel.setText(str(df_subj['Dismissal_preop'][0])) \
        if str(df_subj["Dismissal_preop"][0]) != 'nan' else self.DismNeurIndCheckLabel.setText('')
    self.lineEditOutpatientContact.setText(str(df_subj['Outpat_Contact_preop'][0])) \
        if str(df_subj["Outpat_Contact_preop"][0]) != 'nan' else self.lineEditOutpatientContact.setText('')
    self.lineEditNChContact.setText(str(df_subj['nch_preop'][0])) \
        if str(df_subj["nch_preop"][0]) != 'nan' else self.lineEditNChContact.setText('')
    self.lineEditDBSconferenceDate.setText(str(df_subj['DBS_Conference_preop'][0])) \
        if str(df_subj["DBS_Conference_preop"][0]) != 'nan' else self.lineEditDBSconferenceDate.setText('')

return

my helper functions:

class Content:
    def __init__(self, _debug=False):
        pass

    @staticmethod
    def extract_saved_data(condition):
        """ defines a list of columns for the csv files in the data folder; if id not found,
        dictionary remains empty"""

        subj_id = General.read_current_subj().id[0] # reads data from curent_subj (saved in ./tmp)
        df = General.import_dataframe('{}.csv'.format(condition), separator_csv=',')
        if df.shape[1] == 1:
            df = General.import_dataframe('{}.csv'.format(condition), separator_csv=';')
        df_subj = df.iloc[df.index[df['ID'] == subj_id].tolist()].to_dict('list')

list_preop = ["ID", "PID", "Gender",.... #some more stuff here ]

return df_subj

This part works great and all the information is extracted from the csv.

Now the problem:

I also have a button, that brings me to a different GUI:

self.ButtonEnterMedication.clicked.connect(self.onClickedMedication)

In the new window the same thing should happen. Available data from the CSV shoud be extracted an displayed there, but it doesnt work.

My code looks like this:

def __init__(self, visit='unknown', parent=None):
    super().__init__(parent)

    # ====================    Create General Layout      ====================

.
.
.

def updatetext(self):
    """adds information extracted from database already provided"""

    df_subj = Content.extract_saved_data(self.date)

    self.lineEditLevodopaCarbidopa.setText(str(df_subj["Levodopa_Carbidopa_preop"][0])) \
        if str(df_subj["Levodopa_Carbidopa_preop"][0]) != 'nan' else self.lineEditLevodopaCarbidopa.setText('')
    self.lineEditLevodopaCarbidopaCR.setText(str(df_subj["Levodopa_Carbidopa_CR_preop"][0])) \
        if str(df_subj["Levodopa_Carbidopa_CR_preop"][0]) != 'nan' else self.lineEditLevodopaCarbidopaCR.setText('')
    self.lineEditEntacapone.setText(str(df_subj["Entacapone_preop"][0])) \
        if str(df_subj["Entacapone_preop"][0]) != 'nan' else self.lineEditEntacapone.setText('')
    self.lineEditTolcapone.setText(str(df_subj["Tolcapone_preop"][0])) \
        if str(df_subj["Tolcapone_preop"][0]) != 'nan' else self.lineEditTolcapone.setText('')
    self.lineEditPramipexole.setText(str(df_subj["Pramipexole_preop"][0])) \
        if str(df_subj["Pramipexole_preop"][0]) != 'nan' else self.lineEditPramipexole.setText('')
    self.lineEditRopinirole.setText(str(df_subj["Ropinirole_preop"][0])) \
        if str(df_subj["Ropinirole_preop"][0]) != 'nan' else self.lineEditRopinirole.setText('')
    self.lineEditRotigotine.setText(str(df_subj["Rotigotine_preop"][0])) \
        if str(df_subj["Rotigotine_preop"][0]) != 'nan' else self.lineEditRotigotine.setText('')
    self.lineEditSelegiline_oral.setText(str(df_subj["Selegiline_preop"][0])) \
        if str(df_subj["Selegiline_preop"][0]) != 'nan' else self.lineEditSelegiline_oral.setText('')

So basically I tried the same thing as before. But no data is displayed.

I hope someone can help me.
Thank you!

I tried to use the same kind of code as before, where it worke.


问:
Search from the saved MarkupStrings of Emails using entity framework filters
I am developing an application of Blzaor Server .NET Core in which I am maintaining a backup or history of all the emails sent. For saving the emails, I am saving the whole MarkupString(HTML String) of the email.

I want to search text in the MarkupString of the email using EF Core filters.

The problem that I am facing is that I am trying to search for a simple text from the HTML. For example, if I search "I am playing Cricket" then in the markup string it can be something like .

"I am playing Cricket" so "I am playing Cricket".Contain("I am playing Cricket") will return false.

As I am using EF filters so Its an expression and we can't make conversions of MarkUp string to simple text in the expression (EF core does not allow that).

I don't know how to achieve this. Can someone help, please?

Thanks a lot in advance


问:
Nexus: How to download a gzipped or other compressed file in a script tag?
I can upload an umd.min.js or umd.min.js.gz or umd.min.br file to nexus or all of them.

Now I want to use them in a  tag, while compressing the data during transfer, so save data, and speeding up the download.

I tried the following:

```

The Problems I encountered:

When loading the .gz or .br files: The resource from “https://repo.vidis.schule/repository/vidis-cdn-snapshots/1.10.0-snapshot/vidisLogin.umd.js.br” was blocked due to MIME type (“application/x-brotli”) mismatch (X-Content-Type-Options: nosniff) => The Mime-Types are not compatible, or nexus has to stop setting the no-sniff X-Content-Type-Options Header

When loading the .gz or .br files: The Request is accepted with 200 but no data is being transferred. Directly using the nexus download link works however.

When loading the .js file, the data is not compressed. In particular the Content-Encoding is not being set: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding

Body:
I can upload an umd.min.js or umd.min.js.gz or umd.min.br file to nexus or all of them.

Now I want to use them in a  tag, while compressing the data during transfer, so save data, and speeding up the download.

I tried the following:

The Problems I encountered:

When loading the .gz or .br files: The resource from “https://repo.vidis.schule/repository/vidis-cdn-snapshots/1.10.0-snapshot/vidisLogin.umd.js.br” was blocked due to MIME type (“application/x-brotli”) mismatch (X-Content-Type-Options: nosniff) => The Mime-Types are not compatible, or nexus has to stop setting the no-sniff X-Content-Type-Options Header

When loading the .gz or .br files: The Request is accepted with 200 but no data is being transferred. Directly using the nexus download link works however.

When loading the .js file, the data is not compressed. In particular the Content-Encoding is not being set: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding


问:
Warning: You are using these overridden dependencies

My friend shared the project with me from drive. The project is working on my friend. But it doesn't work for me. I get a package error and it doesn't work even though my device is connected.

My friend shared the project with me from drive. The project is working on my friend. But it doesn't work for me. I get a package error and it doesn't work even though my device is connected.


问:
Why my auto click tool doesnt work when clicking?
```<code>using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace AutoClickerC
{
    public partial class Form1 : Form
    {
        #region dlls
        [DllImport("User32.Dll", EntryPoint = "PostMessageA")]
        private static extern bool PostMessage(IntPtr hWnd, uint msg, int wParam, int lParam);

        [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
        private static extern IntPtr GetForegroundWindow();

        [DllImport("user32.dll", SetLastError = true)]
        private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);

        [DllImport("User32.dll")]
        private static extern short GetAsyncKeyState(System.Windows.Forms.Keys vKey);

        #endregion
        public Form1()
        {
            InitializeComponent();
        }

        private void btnToggle_Click(object sender, EventArgs e)
        {
            if (btnToggle.Text.Contains("enable"))
            {
                btnToggle.ForeColor = Color.FromArgb(80, 80, 80);
                btnToggle.FillColor = Color.Salmon;
                btnToggle.Text = "disable";
            }
            else if (btnToggle.Text.Contains("disable"))
            {
                btnToggle.ForeColor = Color.Salmon;
                btnToggle.FillColor = Color.FromArgb(80, 80, 80);
                btnToggle.Text = "enable";
            }
        }

        private void btnToggle_TextChanged(object sender, EventArgs e)
        {
            if (btnToggle.Text.Contains("disable"))
            {
                Autoclicker.Start();
            }
            else
            {
                Autoclicker.Stop();
            }
        }

        private void lbvalueC_Click(object sender, EventArgs e)
        {

        }

        private void tbToggle_Scroll(object sender, ScrollEventArgs e)
        {
            CPSValue.Text = (CPSTrackabr.Value.ToString() + " CPS");
        }

        int min;
        int max;
        IntPtr hWnd;
        public string getActiveWindowName()
        {
            try
            {
                var activateHandle = GetForegroundWindow();

                Process[] processes = Process.GetProcesses();
                foreach (Process clsProcess in processes)
                {
                    if (activateHandle == clsProcess.MainWindowHandle)
                    {
                        string processName = clsProcess.ProcessName;
                        return processName;
                    }
                }
            }
            catch { }
            return null;
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            if (btnToggle.Text.Contains("disable"))
            {
                min = CPSTrackabr.Value - 6;
                max = CPSTrackabr.Value + 6;
                Random rand = new Random();
                randomTB.Value = (rand.Next(min, max));
            }
        }

        private async void AutoClicker_Tick(object sender, EventArgs e)
        {
            try
            {
            Autoclicker.Interval = 1000 / randomTB.Value;
            }
            catch { }
            if (btnToggle.Text.Contains("disable"))
            {
                Process[] processes = Process.GetProcessesByName("javaw");
                foreach (Process process in processes)
                {
                    hWnd = FindWindow(null, process.MainWindowTitle);
                }

                string currentwindow = getActiveWindowName();
                if (currentwindow == null)
                {
                    return;
                }

                if (currentwindow.Contains("javaw"))
                {
                    if (MouseButtons == MouseButtons.Left)
                    {
                        PostMessage(hWnd, 0x0201, 0, 0);
                        await Task.Delay(30);
                        PostMessage(hWnd, 0x0202, 0, 0);
                    }

                }

            }
        }
    }
}

</code>```

I Dont know why its doesnt work, i'm learning to make auto click tool. My code like the example on ytb but its doesnt work, everything is okay, except auto click still doesnt work. Did im wrong somewhere? I mean, im tried so many tutorial on ytb, but until final part, auto click still not working in spite of some part still working. Im coding on VS community 2022, windowform .NET FrameWork and aslo using laptop acer nitro 5 with windows 11.Need somehelp, im hopeless now :(

Body:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace AutoClickerC
{
    public partial class Form1 : Form
    {
        #region dlls
        [DllImport("User32.Dll", EntryPoint = "PostMessageA")]
        private static extern bool PostMessage(IntPtr hWnd, uint msg, int wParam, int lParam);

        [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
        private static extern IntPtr GetForegroundWindow();

        [DllImport("user32.dll", SetLastError = true)]
        private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);

        [DllImport("User32.dll")]
        private static extern short GetAsyncKeyState(System.Windows.Forms.Keys vKey);

        #endregion
        public Form1()
        {
            InitializeComponent();
        }

        private void btnToggle_Click(object sender, EventArgs e)
        {
            if (btnToggle.Text.Contains("enable"))
            {
                btnToggle.ForeColor = Color.FromArgb(80, 80, 80);
                btnToggle.FillColor = Color.Salmon;
                btnToggle.Text = "disable";
            }
            else if (btnToggle.Text.Contains("disable"))
            {
                btnToggle.ForeColor = Color.Salmon;
                btnToggle.FillColor = Color.FromArgb(80, 80, 80);
                btnToggle.Text = "enable";
            }
        }

        private void btnToggle_TextChanged(object sender, EventArgs e)
        {
            if (btnToggle.Text.Contains("disable"))
            {
                Autoclicker.Start();
            }
            else
            {
                Autoclicker.Stop();
            }
        }

        private void lbvalueC_Click(object sender, EventArgs e)
        {

        }

        private void tbToggle_Scroll(object sender, ScrollEventArgs e)
        {
            CPSValue.Text = (CPSTrackabr.Value.ToString() + " CPS");
        }

        int min;
        int max;
        IntPtr hWnd;
        public string getActiveWindowName()
        {
            try
            {
                var activateHandle = GetForegroundWindow();

                Process[] processes = Process.GetProcesses();
                foreach (Process clsProcess in processes)
                {
                    if (activateHandle == clsProcess.MainWindowHandle)
                    {
                        string processName = clsProcess.ProcessName;
                        return processName;
                    }
                }
            }
            catch { }
            return null;
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            if (btnToggle.Text.Contains("disable"))
            {
                min = CPSTrackabr.Value - 6;
                max = CPSTrackabr.Value + 6;
                Random rand = new Random();
                randomTB.Value = (rand.Next(min, max));
            }
        }

        private async void AutoClicker_Tick(object sender, EventArgs e)
        {
            try
            {
            Autoclicker.Interval = 1000 / randomTB.Value;
            }
            catch { }
            if (btnToggle.Text.Contains("disable"))
            {
                Process[] processes = Process.GetProcessesByName("javaw");
                foreach (Process process in processes)
                {
                    hWnd = FindWindow(null, process.MainWindowTitle);
                }

                string currentwindow = getActiveWindowName();
                if (currentwindow == null)
                {
                    return;
                }

                if (currentwindow.Contains("javaw"))
                {
                    if (MouseButtons == MouseButtons.Left)
                    {
                        PostMessage(hWnd, 0x0201, 0, 0);
                        await Task.Delay(30);
                        PostMessage(hWnd, 0x0202, 0, 0);
                    }

                }

            }
        }
    }
}

I Dont know why its doesnt work, i'm learning to make auto click tool. My code like the example on ytb but its doesnt work, everything is okay, except auto click still doesnt work. Did im wrong somewhere? I mean, im tried so many tutorial on ytb, but until final part, auto click still not working in spite of some part still working. Im coding on VS community 2022, windowform .NET FrameWork and aslo using laptop acer nitro 5 with windows 11.Need somehelp, im hopeless now :(


问:
JSON response with nested calculated key in ROR
I have a model and I need to group some of relations and make json response.

For example i have Models:

users: {
  orders
  ...
}

orders: {
  order_group
  items
  ...
}

items: { ... }

order_groups: { ... }
```
<p>I need to return JSON of users with all uniq order_groups and all items in each order_group:</p>
<pre class="lang-json prettyprint-override"><code>users: [
  {
    order_groups: [
      {
        items: [ ... ]
      }
    ]
  }
}
</code>```

I have jBuilder and ALBA serializer.

I'm thinking of choosing ALBA serializer but how to describe this structure of fields?
order_groups is calculated key with another calculated key items inside.

I cant make has_many association with calculated column. And I can't create serializer for order_groups model because it doesn't have relation with items

With jbuilder it will be much easier, but lot of people doesn't like it.
Trying to go with trends

Body:
I have a model and I need to group some of relations and make json response.

For example i have Models:

users: {
  orders
  ...
}

orders: {
  order_group
  items
  ...
}

items: { ... }

order_groups: { ... }

I need to return JSON of users with all uniq order_groups and all items in each order_group:

users: [
  {
    order_groups: [
      {
        items: [ ... ]
      }
    ]
  }
}

I have jBuilder and ALBA serializer.

I'm thinking of choosing ALBA serializer but how to describe this structure of fields?
order_groups is calculated key with another calculated key items inside.

I cant make has_many association with calculated column. And I can't create serializer for order_groups model because it doesn't have relation with items

With jbuilder it will be much easier, but lot of people doesn't like it.
Trying to go with trends


问:
Word template not found via bookdown word_document2
I have trouble creating a word document via shiny app. I want to use a specific word template which lives in the same folder as the app, together with my markdown. This works for the normal output: word_document as it should. But for output: bookdown::word_document2 it does not use the template.

There are some similar questions to mine, but those use the standard word_document and NOT bookdown::word_document2.

The download handler copies the template together with the report to the temporary folder and knits the document. I have commands to list files in the temp folder and it lists the word template, so it seems to be there. When I knit the document by hand, it works fine. But via the download button from the shiny app, it does not use the word template.

I don't know how to provide my template here in SO. But what I did in my template is to change color for H1 and H2.
I uploaded it to dropbox, hope it will stay there for a while.

myTemplate.docx

app.R

```<code>library(shiny)

temp_folder <- tempfile()
dir.create(temp_folder)

shinyApp(
  ui = fluidPage(
    textInput("headline1", "H1", value = "Headline 1"),
    textInput("headline2", "H2", value = "Headline 2"),
    downloadButton("report", "Generate report")
  ),

  server = function(input, output,session) {
    output$report <- downloadHandler(
      filename = "myReport.docx",
      content = function(file) {
        tempReport <- file.path(temp_folder, "myReport.Rmd")
        file.copy("myReport.Rmd", tempReport, overwrite = TRUE)
        tempTemplate <- file.path(temp_folder, "myTemplate.docx")
        file.copy("myTemplate.docx", tempTemplate, overwrite = TRUE)
        params <- list(
          headline1=input$headline1,
          headline2=input$headline2
        )
        rmarkdown::render(tempReport,
                          'word_document',
                          output_file=file,
                          params=params,
                          encoding="UTF-8",
                          envir=new.env(parent=globalenv())
        )
      }
    )
  }
)
</code>```

myReport.Rmd

```<code>---
title: "reference test"
output:
   bookdown::word_document2:
    reference_docx: myTemplate.docx

params:
  headline1: NA
  headline2: NA
---

```{r setup, include=FALSE}
library(knitr)
library(rmarkdown)
library(bookdown)
headline1 <- params$headline1
headline2 <- params$headline2
```
# my written headline

# test `r headline1`

test test

## my written second level headline

## test `r headline2`
```{r}
print(list.files())
print(getwd())
```

1 2 3
</code>```

Body:
I have trouble creating a word document via shiny app. I want to use a specific word template which lives in the same folder as the app, together with my markdown. This works for the normal output: word_document as it should. But for output: bookdown::word_document2 it does not use the template.

There are some similar questions to mine, but those use the standard word_document and NOT bookdown::word_document2.

The download handler copies the template together with the report to the temporary folder and knits the document. I have commands to list files in the temp folder and it lists the word template, so it seems to be there. When I knit the document by hand, it works fine. But via the download button from the shiny app, it does not use the word template.

I don't know how to provide my template here in SO. But what I did in my template is to change color for H1 and H2.
I uploaded it to dropbox, hope it will stay there for a while.

myTemplate.docx

app.R

library(shiny)

temp_folder <- tempfile()
dir.create(temp_folder)

shinyApp(
  ui = fluidPage(
    textInput("headline1", "H1", value = "Headline 1"),
    textInput("headline2", "H2", value = "Headline 2"),
    downloadButton("report", "Generate report")
  ),

  server = function(input, output,session) {
    output$report <- downloadHandler(
      filename = "myReport.docx",
      content = function(file) {
        tempReport <- file.path(temp_folder, "myReport.Rmd")
        file.copy("myReport.Rmd", tempReport, overwrite = TRUE)
        tempTemplate <- file.path(temp_folder, "myTemplate.docx")
        file.copy("myTemplate.docx", tempTemplate, overwrite = TRUE)
        params <- list(
          headline1=input$headline1,
          headline2=input$headline2
        )
        rmarkdown::render(tempReport,
                          'word_document',
                          output_file=file,
                          params=params,
                          encoding="UTF-8",
                          envir=new.env(parent=globalenv())
        )
      }
    )
  }
)

myReport.Rmd

---
title: "reference test"
output:
   bookdown::word_document2:
    reference_docx: myTemplate.docx

params:
  headline1: NA
  headline2: NA
---

```{r setup, include=FALSE}
library(knitr)
library(rmarkdown)
library(bookdown)
headline1 <- params$headline1
headline2 <- params$headline2
```
# my written headline

# test `r headline1`

test test

## my written second level headline

## test `r headline2`
```{r}
print(list.files())
print(getwd())
```

1 2 3


问:
How do i make require to transpile files in Node ESM project
I'm migrating a project from CJS to ESM and the project uses "sequelize-cli": "^6.4.1" which doesn't support ESM yet. I need sequelize-cli for migrations and seeding. So my question is how do i make require transpile those migrations and seeders without causing ESM errors? (if this isn't clear, i'll like to explain further)

I tried running npx sequelize-cli db:migrate for migrations.
I was expecting migrations (in ESM) to run but it didn't.
I got this error ERROR: Error [ERR_REQUIRE_ESM]: Must use import to load ES Module:


问:
I am uploading file using MS graph API with msgraph-sdk library but didn't getting http response code here is my code
here i used msgraph-sdk php library i am uploading file. everything is working proper even file also uploaded and getting proper response but didn't getting http status code. please help</p>
```<code>$headers = array(
                "Content-Length"=> $numBytes,
                "Content-Range"=> $content_range
            );
$uploadByte = $graph->createRequest("PUT", $graph_url)
                    ->addHeaders($headers)
                    ->attachBody($data)
                    ->setReturnType(Model\UploadSession::class)
                    ->setTimeout("10000")
                    ->execute();

$arraydata = (array)$uploadByte->getProperties();
print_r($arraydata);
echo '```';
$httpcode = (array)$uploadByte->getStatus();
</code>```

Body:
here i used msgraph-sdk php library i am uploading file. everything is working proper even file also uploaded and getting proper response but didn't getting http status code. please help

$headers = array(
                "Content-Length"=> $numBytes,
                "Content-Range"=> $content_range
            );
$uploadByte = $graph->createRequest("PUT", $graph_url)
                    ->addHeaders($headers)
                    ->attachBody($data)
                    ->setReturnType(Model\UploadSession::class)
                    ->setTimeout("10000")
                    ->execute();

$arraydata = (array)$uploadByte->getProperties();
print_r($arraydata);
echo '
';
$httpcode = (array)$uploadByte->getStatus();


问:
Referenced sniff "PHPCSUtils" does not exist
I have PhpStorm and installed "squizlabs/php_codesniffer". When I try to use (e.g. modify the source code), PhpStorm sends me a little error every time, as

Referenced sniff "PHPCSUtils" does not exist

I tried to get that PHPCSUtils like that:

```<code>composer config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
composer require phpcsstandards/phpcsutils:"^1.0"
</code>```

from here: https://phpcsutils.com/

but it then says:

Your requirements could not be resolved to an installable set of packages.

Problem 1

- Root composer.json requires phpcsstandards/phpcsutils ^1.0, found phpcsstandards/phpcsutils[dev-stable, dev-develop, 1.0.0-alpha1,
..., 1.x-dev (alias of dev-stable)] but it does not match your
minimum-stability.

When I try composer require phpcsstandards/phpcsutils:"dev-stable" I get

Your requirements could not be resolved to an installable set of packages.

Problem 1

- Root composer.json requires phpcsstandards/phpcsutils dev-stable -> satisfiable by phpcsstandards/phpcsutils[dev-stable].

- phpcsstandards/phpcsutils dev-stable requires squizlabs/php_codesniffer ^3.7.1 || 4.0.x-dev@dev -> satisfiable by
squizlabs/php_codesniffer[3.7.1] from composer repo
(https://repo.packagist.org) but squizlabs/php_codesniffer is the root
package and cannot be modified. See
https://getcomposer.org/dep-on-root for details and assistance.

but that's a lie, I got 3.7.1 phpcodesniffer version:

```<code>phpcs --version
</code>```

PHP_CodeSniffer version 3.7.1 (stable) by Squiz (http://www.squiz.net)

my composer.json is:

```<code>{
    "require": {
        "squizlabs/php_codesniffer": "^3.7"
    }
}
</code>```

the phpcs composer.json is:

```<code>{
    "name": "squizlabs/php_codesniffer",
    "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
    "type": "library",
    "keywords": [
        "phpcs",
        "standards"
    ],
    "homepage": "https://github.com/squizlabs/PHP_CodeSniffer",
    "license": "BSD-3-Clause",
    "authors": [
        {
            "name": "Greg Sherwood",
            "role": "lead"
        }
    ],
    "support": {
        "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues",
        "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki",
        "source": "https://github.com/squizlabs/PHP_CodeSniffer"
    },
    "extra": {
        "branch-alias": {
            "dev-master": "3.x-dev"
        }
    },
    "require": {
        "php": ">=5.4.0",
        "ext-tokenizer": "*",
        "ext-xmlwriter": "*",
        "ext-simplexml": "*"
    },
    "require-dev": {
        "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
    },
    "bin": [
        "bin/phpcs",
        "bin/phpcbf"
    ],
    "config": {
        "allow-plugins": {
            "dealerdirect/phpcodesniffer-composer-installer": true
        }
    }
}
</code>```

Body:
I have PhpStorm and installed "squizlabs/php_codesniffer". When I try to use (e.g. modify the source code), PhpStorm sends me a little error every time, as

Referenced sniff "PHPCSUtils" does not exist

I tried to get that PHPCSUtils like that:

composer config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
composer require phpcsstandards/phpcsutils:"^1.0"

from here: https://phpcsutils.com/

but it then says:

Your requirements could not be resolved to an installable set of packages.

Problem 1

- Root composer.json requires phpcsstandards/phpcsutils ^1.0, found phpcsstandards/phpcsutils[dev-stable, dev-develop, 1.0.0-alpha1,
..., 1.x-dev (alias of dev-stable)] but it does not match your
minimum-stability.

When I try composer require phpcsstandards/phpcsutils:"dev-stable" I get

Your requirements could not be resolved to an installable set of packages.

Problem 1

- Root composer.json requires phpcsstandards/phpcsutils dev-stable -> satisfiable by phpcsstandards/phpcsutils[dev-stable].

- phpcsstandards/phpcsutils dev-stable requires squizlabs/php_codesniffer ^3.7.1 || 4.0.x-dev@dev -> satisfiable by
squizlabs/php_codesniffer[3.7.1] from composer repo
(https://repo.packagist.org) but squizlabs/php_codesniffer is the root
package and cannot be modified. See
https://getcomposer.org/dep-on-root for details and assistance.

but that's a lie, I got 3.7.1 phpcodesniffer version:

phpcs --version

PHP_CodeSniffer version 3.7.1 (stable) by Squiz (http://www.squiz.net)

my composer.json is:

{
    "require": {
        "squizlabs/php_codesniffer": "^3.7"
    }
}

the phpcs composer.json is:

{
    "name": "squizlabs/php_codesniffer",
    "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
    "type": "library",
    "keywords": [
        "phpcs",
        "standards"
    ],
    "homepage": "https://github.com/squizlabs/PHP_CodeSniffer",
    "license": "BSD-3-Clause",
    "authors": [
        {
            "name": "Greg Sherwood",
            "role": "lead"
        }
    ],
    "support": {
        "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues",
        "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki",
        "source": "https://github.com/squizlabs/PHP_CodeSniffer"
    },
    "extra": {
        "branch-alias": {
            "dev-master": "3.x-dev"
        }
    },
    "require": {
        "php": ">=5.4.0",
        "ext-tokenizer": "*",
        "ext-xmlwriter": "*",
        "ext-simplexml": "*"
    },
    "require-dev": {
        "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
    },
    "bin": [
        "bin/phpcs",
        "bin/phpcbf"
    ],
    "config": {
        "allow-plugins": {
            "dealerdirect/phpcodesniffer-composer-installer": true
        }
    }
}


问:
Creating Symfony Application doesn't work
When I create a new symfony application with the command "symfony new --webapp app", in the repository src, I don't have the controller repository nor the kernel.php.
During the installation and after, I don't have error messages.

I always created my projects like that without problems. It's why I don't understand what happens.

PHP version : 8.1.8

Symfony version : 6.2

I also tried the command

```<code>composer create-project symfony/skeleton:"6.2.*" my_project_directory
</code>```

but the problem is the same. I've also checked

```<code>symfony check:requirements
</code>```

And according to this everything isfine.

And naturally, when I wanted to create a controller, the console tells me the class kernel was not found.

Body:
When I create a new symfony application with the command "symfony new --webapp app", in the repository src, I don't have the controller repository nor the kernel.php.
During the installation and after, I don't have error messages.

I always created my projects like that without problems. It's why I don't understand what happens.

PHP version : 8.1.8

Symfony version : 6.2

I also tried the command

composer create-project symfony/skeleton:"6.2.*" my_project_directory

but the problem is the same. I've also checked

symfony check:requirements

And according to this everything isfine.

And naturally, when I wanted to create a controller, the console tells me the class kernel was not found.


问:
Rollup.js code splitting - Prevent extra bundle to be created
I'm trying to generate two bundles (only two) using Rollup.js:

commonBundle.js

bundle2.js

bundle2.js depends on commonBundle.js.

The current result of rollup -c is actually 3 files instead of the 2 I want:

commonBundle.js

bundle2.js

commonDep-6c053814.js

Yes, commonDep.ts is indeed used by both commonBundle.ts and bundle2.ts. But since bundle2.ts depends on commonBundle.ts I was expecting the common dependency (commonDep.ts) to be included in the resulting commonBundle.js, not to be a separate bundle!

Is there a way to make all shared dependencies to be bundled inside a single bundle that needs to be imported by the others?

rollup.config.mjs :

```<code>export default {
  input: {
    commonBundle: "./src/commonBundle.ts",
    bundle2: "./src/bundle2.ts"
  },
  output: {
    dir: "./public",
    format: "es"
  },
  plugins: [resolve({ browser: true }), commonjs(), typescript()]
};
</code>```

commonBundle.ts :

```<code>import { sayHello } from "./commonDep";
export * from "./commonDep"; // export all common dependencies!

export function commonBundleFunction() {
  sayHello("from common bundle");
}
</code>```

bundle2.ts :

```<code>import "./commonBundle"; // depends on the common bundle!!!
import { sayHello } from "./commonDep";

export function bundle2Function() {
  sayHello("from bundle2");
}
</code>```

commonDep.ts :

```<code>export function sayHello(name: string) {
  console.log("Hello " + name);
}
</code>```

Body:
I'm trying to generate two bundles (only two) using Rollup.js:

commonBundle.js

bundle2.js

bundle2.js depends on commonBundle.js.

The current result of rollup -c is actually 3 files instead of the 2 I want:

commonBundle.js

bundle2.js

commonDep-6c053814.js

Yes, commonDep.ts is indeed used by both commonBundle.ts and bundle2.ts. But since bundle2.ts depends on commonBundle.ts I was expecting the common dependency (commonDep.ts) to be included in the resulting commonBundle.js, not to be a separate bundle!

Is there a way to make all shared dependencies to be bundled inside a single bundle that needs to be imported by the others?

rollup.config.mjs :

export default {
  input: {
    commonBundle: "./src/commonBundle.ts",
    bundle2: "./src/bundle2.ts"
  },
  output: {
    dir: "./public",
    format: "es"
  },
  plugins: [resolve({ browser: true }), commonjs(), typescript()]
};

commonBundle.ts :

import { sayHello } from "./commonDep";
export * from "./commonDep"; // export all common dependencies!

export function commonBundleFunction() {
  sayHello("from common bundle");
}

bundle2.ts :

import "./commonBundle"; // depends on the common bundle!!!
import { sayHello } from "./commonDep";

export function bundle2Function() {
  sayHello("from bundle2");
}

commonDep.ts :

export function sayHello(name: string) {
  console.log("Hello " + name);
}


问:
bootstrap v 5 shows strange behavior with classes btn and ms-1
today I encountered a strange behavior in bootstrap v5:

```<code> <button class="btn btn-primary">

              <img

                v-svg-inline

                src="@/assets/icons/printer.svg"

                width="20"

                height="20"

              />

            </button>
</code>```

leads to:

So far so good.

However,

```<code><button class="btn btn-primary ms-1">

              <img

                v-svg-inline

                src="@/assets/icons/printer.svg"

                width="20"

                height="20"

              />

            </button>
</code>```

leads to

As you can see, now three dots next to the image appear . This happens only when I scroll in (100% and more). Furthermore with the Selector (F12) I cannot click it, cannot even find the dots in the DOM.

Question:
Has anyone of you ever experienced something similar? And why does ms-1 lead to the "three dots"?

I could narrow it down to the fact, that comes and goes with the "ms-1" class. This, however, does not really help me.

Any information is highly appreciated :)

Thank you very much and have a great day!

Body:
today I encountered a strange behavior in bootstrap v5:

 <button class="btn btn-primary">

            </button>

leads to:

So far so good.

However,

<button class="btn btn-primary ms-1">

            </button>

leads to

As you can see, now three dots next to the image appear . This happens only when I scroll in (100% and more). Furthermore with the Selector (F12) I cannot click it, cannot even find the dots in the DOM.

Question:
Has anyone of you ever experienced something similar? And why does ms-1 lead to the "three dots"?

I could narrow it down to the fact, that comes and goes with the "ms-1" class. This, however, does not really help me.

Any information is highly appreciated :)

Thank you very much and have a great day!


问:
LAMP INSTALLATION error dzdo: apt: command not found
Iam getting this error while installing LAMP with dzdo commands can anyone help with this

Trying to install LAMP IN Linux with dzdo commands


问:
Entity Framework Core - Detach related entities except if they are a parent entity
The problem I'm trying to overcome is that I'm trying to detach all entities in DbContext.ChangeTracker if they are not the principal entity that I'm changing to avoid inserting child items of a parent entity when inserting the parent.

The reason to why I want this kind of behaviour is because we're migrating from the existing codebase to Entity Framework. I need to implement an interface that is currently used in the existing codebase as follows:

parentRepository.InsertItemAsync(parentEntity, cancellationToken);
childRepository.InsertItemAsync(childEntity, cancellationToken);
```
<p>Changing all the existing codebase is not an option so I need to make my implementation of the interface behave the same way that the code that already exists.</p>
<p>I came up with a solution but it only works on parent entities. I detach all entities in the DbContext.ChangeTracker that are not of the type of the entity managed by that repository. Like this:</p>
<pre class="lang-cs prettyprint-override"><code>/// <summary>
/// Detach all entities that are not managed by this repository.
/// </summary>
private void DetachRelatedEntities()
{
    EntityEntry[] entities = _dbContext.ChangeTracker.Entries().ToArray();

    foreach (EntityEntry? e in entities)
    {
        var entityType = e.Entity.GetType();

        if (entityType != typeof(T))
            e.State = EntityState.Detached;
    }
}

// <T> is the type of the entity that the IRepository<T> manages.
</code>```

The problem is that when it is a child entity, it detaches its parent because it meets the condition of the if, and when the parent is detached the childs are automatically detached by Entity Framework.

Is there a way that I can make the condition more strict and it only applies when "entityType" is not a parent entity of "T"? Or is there a way to detect that the entity "T" has a FK and get the type of the entity of the FK?

Since this may be hard to understand without seeing the code, I describe here one of the methods I've implemented and what I'm trying to achieve:

```<code>public async Task InsertItemsAsync(IEnumerable<T> items, CancellationToken cancellationToken = default)
{
    if (items.ToList().TrueForAll(i => !Set.AsNoTrackingWithIdentityResolution().Any(s => s.Id == i.Id)))
    {
        Set.AddRange(items);

        DetachRelatedEntites(); // This is what I'm trying to achieve and its not working. I want to detach all entities that are not "T" entity so I can add them later separately.

        await _dbContext.SaveChangesAsync(cancellationToken);

        DetachEntities(); // Here I detach all entities to avoid "Entity is being tracked by another context". This is already working.
        return;
    }

    throw new InvalidOperationException($"An item of {nameof(items)} already exists in the DB.");
}
</code>```

Thank you for your time.

Body:
The problem I'm trying to overcome is that I'm trying to detach all entities in DbContext.ChangeTracker if they are not the principal entity that I'm changing to avoid inserting child items of a parent entity when inserting the parent.

The reason to why I want this kind of behaviour is because we're migrating from the existing codebase to Entity Framework. I need to implement an interface that is currently used in the existing codebase as follows:

parentRepository.InsertItemAsync(parentEntity, cancellationToken);
childRepository.InsertItemAsync(childEntity, cancellationToken);

Changing all the existing codebase is not an option so I need to make my implementation of the interface behave the same way that the code that already exists.

I came up with a solution but it only works on parent entities. I detach all entities in the DbContext.ChangeTracker that are not of the type of the entity managed by that repository. Like this:

///
/// Detach all entities that are not managed by this repository.
///
private void DetachRelatedEntities()
{
    EntityEntry[] entities = _dbContext.ChangeTracker.Entries().ToArray();

    foreach (EntityEntry? e in entities)
    {
        var entityType = e.Entity.GetType();

        if (entityType != typeof(T))
            e.State = EntityState.Detached;
    }
}

// <T> is the type of the entity that the IRepository<T> manages.

The problem is that when it is a child entity, it detaches its parent because it meets the condition of the if, and when the parent is detached the childs are automatically detached by Entity Framework.

Is there a way that I can make the condition more strict and it only applies when "entityType" is not a parent entity of "T"? Or is there a way to detect that the entity "T" has a FK and get the type of the entity of the FK?

Since this may be hard to understand without seeing the code, I describe here one of the methods I've implemented and what I'm trying to achieve:

public async Task InsertItemsAsync(IEnumerable<T> items, CancellationToken cancellationToken = default)
{
    if (items.ToList().TrueForAll(i => !Set.AsNoTrackingWithIdentityResolution().Any(s => s.Id == i.Id)))
    {
        Set.AddRange(items);

        DetachRelatedEntites(); // This is what I'm trying to achieve and its not working. I want to detach all entities that are not "T" entity so I can add them later separately.

        await _dbContext.SaveChangesAsync(cancellationToken);

        DetachEntities(); // Here I detach all entities to avoid "Entity is being tracked by another context". This is already working.
        return;
    }

    throw new InvalidOperationException($"An item of {nameof(items)} already exists in the DB.");
}

Thank you for your time.


问:
Is it possible to display External Maven Repository in Drools-KIE web UI?
I have a docker showcase running of drools 7.18.Final

I would like to connect to my external nexus (maven) repo so that I can download the artifact or add it my project.(Using the UI)

Along the way, there is a thread like this which say it is impossible. and article like this which imply it is doable

My approach is:

Create settings.xml point to my external nexus

Add <property name="kie.maven.settings.custom" value="/opt/jboss/wildfly/standalone/configuration/settings.xml"/> to the standalone-full-drools.xml

If added an settings.xml to .m2 folder, an error will be shown

The above approach is not working but I just want to make sure it is even possible before trying further


问:
How to install globally npm in "hackerrank" IDE?
I am trying to code on HackerRank IDE for an assessment. I couldn't be able to install npm packages globally.</p>


问:
Apache ECharts: How do I draw a dashed red line on top of GeoJson map that got 'map' series
Basically, my setup is similar to https://echarts.apache.org/examples/en/editor.html?c=map-usa.

We need to draw dashed line of custom color on one of the borders.
For example, Texas - New Mexico border.

Tried editing the GeoJson file, and add some line objects, but the problem is that those objects are drawn with same color as state borders.


问:
Import assertion throwing mime type error
I'm trying to dynamically import a json file like:

```<code>let filePath = "../../mapping_data_files/contactMapping.json";
import(filePath, {
        assert: {
            type: 'json'
        }
    }).then(file => {
        console.log(file);
});
</code>```

But as I add the assertion i get the error:

Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "application/json". Strict MIME type checking is enforced for module scripts per HTML spec.

How can I work around it?

If I remove the assert I get
Module {Symbol(Symbol.toStringTag): 'Module'} instead of the content of my json file.

Body:
I'm trying to dynamically import a json file like:

let filePath = "../../mapping_data_files/contactMapping.json";
import(filePath, {
        assert: {
            type: 'json'
        }
    }).then(file => {
        console.log(file);
});

But as I add the assertion i get the error:

Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "application/json". Strict MIME type checking is enforced for module scripts per HTML spec.

How can I work around it?

If I remove the assert I get
Module {Symbol(Symbol.toStringTag): 'Module'} instead of the content of my json file.


问:
Javascript how i call function inside another function
I have this function inside a function, how i call fullName function?</p>
```<code>var person = function(){

  function fullName(){}
}

person.fullName(); This doesn't work
</code>```

Body:
I have this function inside a function, how i call fullName function?

var person = function(){

  function fullName(){}
}

person.fullName(); This doesn't work


问:
Certificate Validation and Revocation (CRL) X509 disable in java code
Does anyone know how to disable checking Certificate Validation and Revocation (CRL) X509 for certain certificate?
I have default turn ON checking Certificate Validation and Revocation in system and can not disable that, because it could affect other certificates:

-Dcom.sun.net.ssl.checkRevocation=true

But for one certain X509 cert I want to turn off validation in java code.


问:
overriding valueOf and toString not working as expected
I am trying to override valueOf and toString

This is becouse I want to add some properties to the premitive values

So I created this below

class Box {
  #value;
  constructor(value) {
    this.#value = value;
  }

  valueOf() {
    return this.#value;
  }

  toString(){
    return this.#value;
  }

  someMethod(){
    return "something else"
  }
}

const t1 =21;
const t2 = 21
const p = new  Box(45);
const s = new  Box(45);
console.log(p === s, t1 === t2)```

notice that t1 and t2 comparesion works great but p and s are not working as expected

Why is that and is there a way to do the thing I want?

Body:
I am trying to override valueOf and toString

This is becouse I want to add some properties to the premitive values

So I created this below

class Box {
  #value;
  constructor(value) {
    this.#value = value;
  }

  valueOf() {
    return this.#value;
  }

  toString(){
    return this.#value;
  }

  someMethod(){
    return "something else"
  }
}

const t1 =21;
const t2 = 21
const p = new  Box(45);
const s = new  Box(45);
console.log(p === s, t1 === t2)

notice that t1 and t2 comparesion works great but p and s are not working as expected

Why is that and is there a way to do the thing I want?


问:
Quasar Framework: how can I pin one/multiple rows to the top of the table - qtable
I am looking to pin one/multiple rows to the top rows of a q-table.

Tried to remove the row from the the rows array but i was not able to injected to the top-row slot.
The problem is how to or if possible to inject another array of rows in the top-row slot.