问:
Login into a Webpage using C# selenium that has an anti-forgery token
I have two web-scrapes that i am trying to rewrite from access to c#. the access version uses html and vba but can log into the sites no problem. The c# versions using selenium cant get past the login in screen one site uses a CSRF token and the other uses an Antiforgerytoken. I have been using the send keys method to input the user data and then click on the submit button.

the site that uses the CSRF token - I have tried submitting the data by send keys and java but it always states that there is missing login data

the site with the Antiforgerytoken -  i have tried the same as above but with this one the form just reloads in on its self.


来源: stackexchange

问:
C# InfluxDB Wrong time at point insertion
I have some date time issues with using InfluxDBClientFactory WritePoints The date seems to be correct throughout writing it to the DB.

```<code>if (points.Count > 0)
    {
      var influxDBClient = InfluxDBClientFactory.Create(address, token);

       using (var writeApi = influxDBClient.GetWriteApi())
       {
           writeApi.WritePoints(bucket, org, points);
       }
       influxDBClient.Dispose();
     }
</code>```

Checking the date it is correct with 6 points:

1673613918775000000 is 2023/01/13 12:45:19 - so it is correct

However, in the database I get 2023/02/13 07:48:00

Any suggestion what could cause this issue?

ContentLicense: CC BY-SA 4.0

Body:
I have some date time issues with using InfluxDBClientFactory WritePoints The date seems to be correct throughout writing it to the DB.

if (points.Count > 0)
    {
      var influxDBClient = InfluxDBClientFactory.Create(address, token);

       using (var writeApi = influxDBClient.GetWriteApi())
       {
           writeApi.WritePoints(bucket, org, points);
       }
       influxDBClient.Dispose();
     }

Checking the date it is correct with 6 points:

1673613918775000000 is 2023/01/13 12:45:19 - so it is correct

However, in the database I get 2023/02/13 07:48:00

Any suggestion what could cause this issue?


问:
How to calculate the distance based on the latitude and longitude stored in MongoDb using a query
I have a table called geotest in mysql which has columns latitude, longitude, location etc.
I have imported the same table in mongodb.

Below is the query which is used in mysql for calculating the distance, based on the latitudes and longitudes that works perfectly fine.

Tablename : geotest

```<code>column names : lat,long,latfloor,longfloor
</code>```
```<code>SELECT * , 3956 *2 * ASIN( SQRT( POWER( SIN( ( "19.046165"- `lat` ) * PI( ) /180 /2 ) , 2 ) + COS( "19.046165" * PI( ) /180 ) * COS( `lat` * PI( ) /180 ) * POWER( SIN( ( "73.104000" - `long` ) * PI( ) /180 /2 ) , 2 ) ) ) AS distance FROM geotest WHERE `latfloor` = "19" AND `longfloor` = "73" HAVING distance < 0.5 ORDER BY distance LIMIT 0,1;
</code>```

I want to create a query in mongo which will give me similar results as sql.
Have attached the below image of my mongo collection for reference.

I have tried creating mongo query based on mysql query, but it does not work.

```<code>db.geoTest.aggregate([{
 $addFields: {distance: { '$add' :[{3956 *2 *{'$asin':{'$sqrt':{'$pow':{'$sin':((29.900135- $toNumber:'$lat') * 3.141 /180 /2 )}}}}},
                        {$multiply: [{'$cos':  29.900135 * 3.141 /180 } ,{'$cos':  $toDecimal:'$lat' * 3.141 /180 },{'$pow': [{'$sin':( ( 76.914463 - $toNumber:'$long') , 3.141 /180 /2)}]}]}]
                }}}]);
</code>```

I'm new to mongodb and maybe i might have messed up with the syntax.

I want a help for building a mongodb query which will work similar to mysql query shared above.

Body:
I have a table called geotest in mysql which has columns latitude, longitude, location etc.
I have imported the same table in mongodb.

Below is the query which is used in mysql for calculating the distance, based on the latitudes and longitudes that works perfectly fine.

Tablename : geotest

column names : lat,long,latfloor,longfloor

SELECT * , 3956 *2 * ASIN( SQRT( POWER( SIN( ( "19.046165"- `lat` ) * PI( ) /180 /2 ) , 2 ) + COS( "19.046165" * PI( ) /180 ) * COS( `lat` * PI( ) /180 ) * POWER( SIN( ( "73.104000" - `long` ) * PI( ) /180 /2 ) , 2 ) ) ) AS distance FROM geotest WHERE `latfloor` = "19" AND `longfloor` = "73" HAVING distance < 0.5 ORDER BY distance LIMIT 0,1;

I want to create a query in mongo which will give me similar results as sql.
Have attached the below image of my mongo collection for reference.

I have tried creating mongo query based on mysql query, but it does not work.

db.geoTest.aggregate([{
 $addFields: {distance: { '$add' :[{3956 *2 *{'$asin':{'$sqrt':{'$pow':{'$sin':((29.900135- $toNumber:'$lat') * 3.141 /180 /2 )}}}}},
                        {$multiply: [{'$cos':  29.900135 * 3.141 /180 } ,{'$cos':  $toDecimal:'$lat' * 3.141 /180 },{'$pow': [{'$sin':( ( 76.914463 - $toNumber:'$long') , 3.141 /180 /2)}]}]}]
                }}}]);

I'm new to mongodb and maybe i might have messed up with the syntax.

I want a help for building a mongodb query which will work similar to mysql query shared above.


问:
React.Ref<HTMLInputElement | HTMLTextAreaElement>?
I have the following React component, called TextInput. Depending on multiline prop it will render either <input /> or <textarea /> element on which I'd like to attach a ref prop.

```<code>const TextInput = React.forwardRef({
  as = 'label',
  className = '',
  field = {},
  label = 'Field Label',
  multiline = false,
  ...rest
}, ref: any) => {
  const HtmlTag = as || 'label'
  const rootProps = { className, ...rest }
  const inputProps = {...field, ref }
  return (
    <HtmlTag {...rootProps}>
      { label && <span className="label">{ label }</label> }
      { multiline ? <textarea {...inputProps} /> : <input {...field} role="textbox" />
    </HtmlTag>
  )
}
</code>```

What type should the ref be?

Though it would be convenient, I cannot use React.Ref<HTMLInputElement|HTMLTextAreaElement> without seeing errors about mismatched or missing properties because HTMLInputElement & HTMLTextAreaElement have slightly different interfaces.

Body:
I have the following React component, called TextInput. Depending on multiline prop it will render either <input /> or <textarea /> element on which I'd like to attach a ref prop.

const TextInput = React.forwardRef({
  as = 'label',
  className = '',
  field = {},
  label = 'Field Label',
  multiline = false,
  ...rest
}, ref: any) => {
  const HtmlTag = as || 'label'
  const rootProps = { className, ...rest }
  const inputProps = {...field, ref }
  return (
    <HtmlTag {...rootProps}>
      { label && { label } }
      { multiline ? <textarea {...inputProps} /> : <input {...field} role="textbox" />
    </HtmlTag>
  )
}

What type should the ref be?

Though it would be convenient, I cannot use React.Ref<HTMLInputElement|HTMLTextAreaElement> without seeing errors about mismatched or missing properties because HTMLInputElement & HTMLTextAreaElement have slightly different interfaces.


问:
How to open an Excel workbook AND create a pivot chart using VBA Macro?
I am trying to create a VBA Macro that opens an Excel file from a folder and then, in that file, creates a Pivot table. So far, I have been able to create two separate Macros that does each one of these operations separately i.e., one Macro that opens my desired Excel workbook and another Macro that creates the Pivot table for me.

I am looking to write ONE macro that does both of the above operations. Can anyone help me out please?

I am trying the below VBA code but it's giving me a "Run-time error '1004': Application-defined or object-defined error"

Sub Call_a_Macro()

    'Path of the file that has the macro
    Workbooks.Open ("C:\Users\User\File_ABC.xlsm")

    'Create the Pivot Table
    ActiveWorkbook.Worksheets("Sheet1").Range("A1").Select
    Range(Selection, Selection.End(xlToRight)).Select
    Range(Selection, Selection.End(xlDown)).Select
    Application.CutCopyMode = False
    ActiveSheet.ListObjects.Add(xlSrcRange, Selection, , xlYes).Name = _
        "Table2"
    Range("Table2[#All]").Select
    ActiveWorkbook.Worksheets("Sheet1").ListObjects("Table2").Sort.SortFields. _
        Clear
    ActiveWorkbook.Worksheets("Sheet1").ListObjects("Table2").Sort.SortFields. _
        Add2 Key:=Range("Table2[[#All],[Location]]"), SortOn:=xlSortOnValues, _
        Order:=xlAscending, DataOption:=xlSortNormal
    With ActiveWorkbook.Worksheets("Sheet1").ListObjects("Table2").Sort
        .Header = xlYes
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With
    Range("F8").Select
    ActiveCell.FormulaR1C1 = "BC"
    Range("F9").Select
    ActiveCell.FormulaR1C1 = "ON"
    Range("F10").Select
    ActiveCell.FormulaR1C1 = "SK"
    Range("F11").Select
    ActiveCell.FormulaR1C1 = "MK"
    Range("F12").Select
    ActiveCell.FormulaR1C1 = "SS"
    Range("F13").Select
    ActiveCell.FormulaR1C1 = "RR"
    Range("F14").Select
    ActiveCell.FormulaR1C1 = "AC"
    Range("F15").Select
    ActiveCell.FormulaR1C1 = "IO"
    Range("G8").Select
    ActiveCell.FormulaR1C1 = "=COUNTIF(Table2[[#All],[Location]],""*BC*"")"
    Range("G9").Select
    ActiveWindow.SmallScroll Down:=-6
    ActiveCell.FormulaR1C1 = "=COUNTIF(Table2[[#All],[Location]],""*ON*"")"
    Range("G10").Select
    ActiveWindow.SmallScroll Down:=-8
    ActiveCell.FormulaR1C1 = "=COUNTIF(Table2[[#All],[Location]],""SK*"")"
    Range("G11").Select
    ActiveWindow.SmallScroll Down:=-9
    Range("G10").Select
    ActiveCell.FormulaR1C1 = "=COUNTIF(Table2[[#All],[Location]],""*MK*"")"
    Range("G11").Select
    ActiveCell.FormulaR1C1 = "=COUNTIF(Table2[[#All],[Location]],""*SS*"")"
    Range("G12").Select
    ActiveWindow.SmallScroll Down:=-10
    ActiveCell.FormulaR1C1 = "=COUNTIF(Table2[[#All],[Location]],""*RR*"")"
    Range("G13").Select
    ActiveWindow.SmallScroll Down:=-11
    ActiveCell.FormulaR1C1 = _
        "=COUNTIF(Table2[[#All],[Location]],""*AC*"")"
    Range("G14").Select
    ActiveWindow.SmallScroll Down:=-12
    ActiveCell.FormulaR1C1 = "=COUNTIF(Table2[[#All],[Program]],""AC*"")"
    Range("G15").Select
    ActiveWindow.SmallScroll Down:=-13
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = _
        "=COUNTIF(Table2[[#All],[Location]],""*DE*"")-R[-1]C"
    Range("G16").Select

End Sub

```


问:
How can you stop RStudio from displaying the working directory in the mac's dock?
How can you stop RStudio from displaying the working directory in the mac's dock?

Not found in the general preferences.


问:
Azure Dev Ops creates resource and then does not see it
I run a AzDO pipeline consisting of 2 stages.

Stage 1 (Create pre-ADF .. ) will check if there is a key vault exist in the Azure subscription/resource group.  If if it exists, it just passes through , if it does not - it will create it and populate with secrets (secrets are copied from another base key vault).

PowerShell code is very basic, and stage 1 works just fine

```<code>if ( -not(Get-AzKeyVault -VaultName $newKvName -ResourceGroupName $resourceGroupName -
    ErrorAction SilentlyContinue) )
{
  New-AzKeyVault -VaultName $newKvName -ResourceGroupName $resourceGroupName -Location
  $location

$Context = Get-AzContext
Set-AzKeyVaultAccessPolicy -VaultName $newKvName -ServicePrincipalName
$Context.Account.Id -PermissionsToSecrets Get,List,Set

$secretNames = (Get-AzKeyVaultSecret -VaultName $sourceKvName).Name
$secretNames.foreach{
    Write-Host Processing Secret Name $_
    Set-AzKeyVaultSecret -VaultName $newKvName -Name $_ -SecretValue (Get-
    AzKeyVaultSecret -VaultName $sourceKvName -Name $_).SecretValue
}
}
else {
  Write-Host "Key Vault " $newKvName " already exists.  Not creating"
}
</code>```

The stage 1 end with requirement to post aprove it.  So, before approving, I go in and check that Keyvault is there, and secrets are in.

Then stage 2 comes in

It will do few things

) Create Data factory (using PowerShell) - THIS SUCCEEDS ALWAYS.

) Then it will check new KeyVault creted in stage 1 and assign access policy to it for
the data factory that was just created (1.)

Here is a code for step 2:

```<code>Set-AzDataFactoryV2 -ResourceGroupName $varDevResourceGrpName -Name $varDevDataFactory -
Location $varLocation -Force
$principal = (Get-AzDataFactoryV2 -ResourceGroupName $varDevResourceGrpName -Name
$varDevDataFactory).identity.PrincipalId
Write-Host "Data Factory Principal ID = $principal"
Set-AzKeyVaultAccessPolicy -VaultName $varKeyVault -ObjectId $principal -
BypassObjectIdValidation -PermissionsToSecrets Get,List,Set
</code>```

When the line Set-AzKeyVaultAccessPolicy -VaultName $varKeyVault -ObjectId $principal -  BypassObjectIdValidation -PermissionsToSecrets Get,List,Set executes,

pipeline complains that it does not see the KeyVault.

```<code>2023-01-13T15:52:23.1771395Z --------------------------------------------
2023-01-13T15:52:23.7513345Z Data Factory Principal ID = 783c84c1-008f-45f2-9349-
39c04634fecb
2023-01-13T15:52:25.0779247Z ##[error]Vault 'dmKvTest' does not exist in current
subscription.  If this vault exists in your tenant, please switch to the correct
subscription in order to modify the Access Policies of this vault.
2023-01-13T15:52:25.1753010Z ##[error]PowerShell exited with code '1'.
</code>```

This error comes up OFTEN but not every time.  So, I am at loss and it need of help on how to troubleshoot.

Body:
I run a AzDO pipeline consisting of 2 stages.

Stage 1 (Create pre-ADF .. ) will check if there is a key vault exist in the Azure subscription/resource group.  If if it exists, it just passes through , if it does not - it will create it and populate with secrets (secrets are copied from another base key vault).

PowerShell code is very basic, and stage 1 works just fine

if ( -not(Get-AzKeyVault -VaultName $newKvName -ResourceGroupName $resourceGroupName -
    ErrorAction SilentlyContinue) )
{
  New-AzKeyVault -VaultName $newKvName -ResourceGroupName $resourceGroupName -Location
  $location

$Context = Get-AzContext
Set-AzKeyVaultAccessPolicy -VaultName $newKvName -ServicePrincipalName
$Context.Account.Id -PermissionsToSecrets Get,List,Set

$secretNames = (Get-AzKeyVaultSecret -VaultName $sourceKvName).Name
$secretNames.foreach{
    Write-Host Processing Secret Name $_
    Set-AzKeyVaultSecret -VaultName $newKvName -Name $_ -SecretValue (Get-
    AzKeyVaultSecret -VaultName $sourceKvName -Name $_).SecretValue
}
}
else {
  Write-Host "Key Vault " $newKvName " already exists.  Not creating"
}

The stage 1 end with requirement to post aprove it.  So, before approving, I go in and check that Keyvault is there, and secrets are in.

Then stage 2 comes in

It will do few things

) Create Data factory (using PowerShell) - THIS SUCCEEDS ALWAYS.

) Then it will check new KeyVault creted in stage 1 and assign access policy to it for
the data factory that was just created (1.)

Here is a code for step 2:

Set-AzDataFactoryV2 -ResourceGroupName $varDevResourceGrpName -Name $varDevDataFactory -
Location $varLocation -Force
$principal = (Get-AzDataFactoryV2 -ResourceGroupName $varDevResourceGrpName -Name
$varDevDataFactory).identity.PrincipalId
Write-Host "Data Factory Principal ID = $principal"
Set-AzKeyVaultAccessPolicy -VaultName $varKeyVault -ObjectId $principal -
BypassObjectIdValidation -PermissionsToSecrets Get,List,Set

When the line Set-AzKeyVaultAccessPolicy -VaultName $varKeyVault -ObjectId $principal -  BypassObjectIdValidation -PermissionsToSecrets Get,List,Set executes,

pipeline complains that it does not see the KeyVault.

2023-01-13T15:52:23.1771395Z --------------------------------------------
2023-01-13T15:52:23.7513345Z Data Factory Principal ID = 783c84c1-008f-45f2-9349-
39c04634fecb
2023-01-13T15:52:25.0779247Z ##[error]Vault 'dmKvTest' does not exist in current
subscription.  If this vault exists in your tenant, please switch to the correct
subscription in order to modify the Access Policies of this vault.
2023-01-13T15:52:25.1753010Z ##[error]PowerShell exited with code '1'.

This error comes up OFTEN but not every time.  So, I am at loss and it need of help on how to troubleshoot.


问:
Messenger Plugin Not Working on Vercel (Production) Nextjs
The messenger plugin works on my locally hosted nextjs app. But when I host it on vercel, it doesn't show up.

```<code><div id="fb-root"></div>
            <div id="fb-customer-chat" class="fb-customerchat"></div>
            <Script id="my_script">
                {
                    `
                    var chatbox = document.getElementById('fb-customer-chat');
                    chatbox.setAttribute("page_id", "MY_PAGE_ID");
                    chatbox.setAttribute("attribution", "biz_inbox");

                    window.fbAsyncInit = function() {
                        FB.init({
                        xfbml            : true,
                        version          : 'v15.0'
                        });
                    };

                    (function(d, s, id) {
                        var js, fjs = d.getElementsByTagName(s)[0];
                        if (d.getElementById(id)) return;
                        js = d.createElement(s); js.id = id;
                        js.src = 'https://connect.facebook.net/en_US/sdk/xfbml.customerchat.js';
                        fjs.parentNode.insertBefore(js, fjs);
                    }(document, 'script', 'facebook-jssdk'));
                    `
                }
            </Script>
</code>```

I have whitelisted it on my domain.

I tried it using ngrok on local computer and it works perfectly fine.

Body:
The messenger plugin works on my locally hosted nextjs app. But when I host it on vercel, it doesn't show up.

I have whitelisted it on my domain.

I tried it using ngrok on local computer and it works perfectly fine.


问:
Android BroadcastReceiver for SMS stops reacting after some time
I have implemented the starting point of a SMS forwarding app for my personal use. I don't trust SMS forwarding apps in the play store, believe it or not :-)

So, everything works as expected, but only for a certain time, that I cannot exactly define. I think it is about 1-2 hrs.

Then the app will just stop working. If I open the phone and touch the app it will work again for some time.

I pushed the project here, it is really just a Broadcast Receiver right now. The file in question is smsreceiver.kt

https://github.com/asciimo71/smsforwarder

The app does no special "keep me alive" things. I tried to find information in the BroadcastReceiver about that, but I couldn't find things that I would relate to my issue.

Maybe also of interest? I am running this on A50

As far as I understand the BroadcastReceiver, it will plug itself into the background and be alerted as soon as the subscribed intent happens. This is the receiver class and the manifest. The remaining application is a plain app frame from Android Studio.

Maybe I should add, that I think it has something to do with the energy-saver system of Android, but I don't know how to make the receiver responsive regardless of the battery-level. As long as the messages are received, I want them to be forwarded. During my tests, the phone was on a charger and the battery was always 100% full.

```<code>class SmsReceiver : BroadcastReceiver() {
    private var mLastTimeReceived = 0L

    override fun onReceive(p0: Context?, intent: Intent?) {
        val currentTimeMillis = System.currentTimeMillis()
        if (currentTimeMillis - mLastTimeReceived > 200) {
            mLastTimeReceived = currentTimeMillis

            val msgFrom: String?
            val msgText: String?
            val msgs = Intents.getMessagesFromIntent(intent) as Array<SmsMessage?>
            msgText = msgs.joinToString(separator = "") {
                it?.displayMessageBody ?: it?.messageBody ?: "-body missing-"
            }
            msgFrom = msgs[0]?.originatingAddress

            val outgoingText = "${msgText} - forward from ${msgFrom} @ ${java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(msgs[0]?.timestampMillis ?: 0L)}"
            Log.d(TAG, "onReceive: $outgoingText ${msgFrom ?: "no From"}")

            val smsManager = SmsManager.getDefault()
            try {
                val parts = smsManager.divideMessage(outgoingText)

                smsManager.sendMultipartTextMessage(
                    OUTGOING_PHONE,
                    null,
                    parts,
                    null, null
                )
            } catch (e: Throwable) {
                Log.d(TAG, "send: error", e)
            }
        } else {
            Log.d(TAG, "skipped onReceive - received messages too fast")
        }
    }
</code>```
```<code><?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">

    <uses-permission android:name="android.permission.RECEIVE_SMS" />
    <uses-permission android:name="android.permission.SEND_SMS" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />

    <application
        android:allowBackup="true"
        android:dataExtractionRules="@xml/data_extraction_rules"
        android:fullBackupContent="@xml/backup_rules"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.SMSForwarder"
        tools:targetApi="31">
        <activity
            android:name=".MainActivity"
            android:exported="true"
            android:label="@string/app_name"
            android:theme="@style/Theme.SMSForwarder.NoActionBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

            <meta-data
                android:name="android.app.lib_name"
                android:value="" />
        </activity>

        <receiver
            android:name=".SmsReceiver"
            android:enabled="true"
            android:exported="true"
            android:permission="android.permission.BROADCAST_SMS">
            <intent-filter android:priority="1000">
                <action android:name="android.provider.Telephony.SMS_RECEIVED" />
            </intent-filter>
        </receiver>
    </application>

</manifest>
</code>```

Body:
I have implemented the starting point of a SMS forwarding app for my personal use. I don't trust SMS forwarding apps in the play store, believe it or not :-)

So, everything works as expected, but only for a certain time, that I cannot exactly define. I think it is about 1-2 hrs.

Then the app will just stop working. If I open the phone and touch the app it will work again for some time.

I pushed the project here, it is really just a Broadcast Receiver right now. The file in question is smsreceiver.kt

https://github.com/asciimo71/smsforwarder

The app does no special "keep me alive" things. I tried to find information in the BroadcastReceiver about that, but I couldn't find things that I would relate to my issue.

Maybe also of interest? I am running this on A50

As far as I understand the BroadcastReceiver, it will plug itself into the background and be alerted as soon as the subscribed intent happens. This is the receiver class and the manifest. The remaining application is a plain app frame from Android Studio.

Maybe I should add, that I think it has something to do with the energy-saver system of Android, but I don't know how to make the receiver responsive regardless of the battery-level. As long as the messages are received, I want them to be forwarded. During my tests, the phone was on a charger and the battery was always 100% full.

class SmsReceiver : BroadcastReceiver() {
    private var mLastTimeReceived = 0L

    override fun onReceive(p0: Context?, intent: Intent?) {
        val currentTimeMillis = System.currentTimeMillis()
        if (currentTimeMillis - mLastTimeReceived > 200) {
            mLastTimeReceived = currentTimeMillis

            val msgFrom: String?
            val msgText: String?
            val msgs = Intents.getMessagesFromIntent(intent) as Array<SmsMessage?>
            msgText = msgs.joinToString(separator = "") {
                it?.displayMessageBody ?: it?.messageBody ?: "-body missing-"
            }
            msgFrom = msgs[0]?.originatingAddress

            val outgoingText = "${msgText} - forward from ${msgFrom} @ ${java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(msgs[0]?.timestampMillis ?: 0L)}"
            Log.d(TAG, "onReceive: $outgoingText ${msgFrom ?: "no From"}")

            val smsManager = SmsManager.getDefault()
            try {
                val parts = smsManager.divideMessage(outgoingText)

                smsManager.sendMultipartTextMessage(
                    OUTGOING_PHONE,
                    null,
                    parts,
                    null, null
                )
            } catch (e: Throwable) {
                Log.d(TAG, "send: error", e)
            }
        } else {
            Log.d(TAG, "skipped onReceive - received messages too fast")
        }
    }

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">

    <uses-permission android:name="android.permission.RECEIVE_SMS" />
    <uses-permission android:name="android.permission.SEND_SMS" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />

    <application
        android:allowBackup="true"
        android:dataExtractionRules="@xml/data_extraction_rules"
        android:fullBackupContent="@xml/backup_rules"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.SMSForwarder"
        tools:targetApi="31">
        <activity
            android:name=".MainActivity"
            android:exported="true"
            android:label="@string/app_name"
            android:theme="@style/Theme.SMSForwarder.NoActionBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

            <meta-data
                android:name="android.app.lib_name"
                android:value="" />
        </activity>

        <receiver
            android:name=".SmsReceiver"
            android:enabled="true"
            android:exported="true"
            android:permission="android.permission.BROADCAST_SMS">
            <intent-filter android:priority="1000">
                <action android:name="android.provider.Telephony.SMS_RECEIVED" />
            </intent-filter>
        </receiver>
    </application>

</manifest>


问:
What is the correct way to use Dynamodb UpdateItem in Python
Im struggling with the syntax for updating an item in DynamoDb with python.
I get the error that its expecting a dict and not a string.

The type is string as it can either be a dash or a number.

```<code>results_table.update_item(
        Key={'Date': next_wednesday, 'Team A Result?': '-'},
        AttributeUpdates={
            'Team A Result?': values[0],
            'Team B Result?': values[1]}
    )
</code>```

Invalid type for parameter AttributeUpdates.Team A Result?, value: 30, type: <class 'str'>, valid types: <class 'dict'>

Invalid type for parameter AttributeUpdates.Team B Result?, value: 21, type: <class 'str'>, valid types: <class 'dict'>

Body:
Im struggling with the syntax for updating an item in DynamoDb with python.
I get the error that its expecting a dict and not a string.

The type is string as it can either be a dash or a number.

results_table.update_item(
        Key={'Date': next_wednesday, 'Team A Result?': '-'},
        AttributeUpdates={
            'Team A Result?': values[0],
            'Team B Result?': values[1]}
    )

Invalid type for parameter AttributeUpdates.Team A Result?, value: 30, type: <class 'str'>, valid types: <class 'dict'>

Invalid type for parameter AttributeUpdates.Team B Result?, value: 21, type: <class 'str'>, valid types: <class 'dict'>


问:
Nginx proxy_pass to dynamic url captured with regex
I'm trying to set a CORS proxy using Nginx.

My application runs on localhost:8080 (as a docker container) with Nginx. It calls some external resources thus facing CORS issues (remote servers do not have CORS enabled).

Here is the docker-compose file :

```<code>version: '3'

services:
  myapp:
    image: myimage
    ports:
      - 8080:80
    volumes:
      - ./apps:/usr/share/nginx/html/apps
      - ./default.conf:/etc/nginx/conf.d/default.conf
</code>```

And here is the default.conf file :

```<code>server {
    listen       80;
    server_name  localhost;

    #access_log  /var/log/nginx/host.access.log  main;

    location ~ /proxy/(.*) {
        proxy_pass https://$1$is_args$args;
        access_log /var/log/proxy_access.log;
    }

    location / {
        root   /usr/share/nginx/html;
        index  index.html index.htm;
    }
}
</code>```

So my application calls http://localhost:8080/proxy/https://external_domain.com?key=value to bypass CORS restriction.

Problem is there seems to be an issue somewhere in my configuration because the previous request returns 500 error with the following message in logs :
invalid port in upstream "https://external_domain.com?key=value", client: <container_ip>, server: localhost, request: "GET /proxy/external_domain.com?key=value HTTP/1.1", host: "localhost:8080"

I tried alternative solutions using request url params instead of regex, but with no more success.

Body:
I'm trying to set a CORS proxy using Nginx.

My application runs on localhost:8080 (as a docker container) with Nginx. It calls some external resources thus facing CORS issues (remote servers do not have CORS enabled).

Here is the docker-compose file :

version: '3'

services:
  myapp:
    image: myimage
    ports:
      - 8080:80
    volumes:
      - ./apps:/usr/share/nginx/html/apps
      - ./default.conf:/etc/nginx/conf.d/default.conf

And here is the default.conf file :

server {
    listen       80;
    server_name  localhost;

    #access_log  /var/log/nginx/host.access.log  main;

    location ~ /proxy/(.*) {
        proxy_pass https://$1$is_args$args;
        access_log /var/log/proxy_access.log;
    }

    location / {
        root   /usr/share/nginx/html;
        index  index.html index.htm;
    }
}

So my application calls http://localhost:8080/proxy/https://external_domain.com?key=value to bypass CORS restriction.

Problem is there seems to be an issue somewhere in my configuration because the previous request returns 500 error with the following message in logs :
invalid port in upstream "https://external_domain.com?key=value", client: <container_ip>, server: localhost, request: "GET /proxy/external_domain.com?key=value HTTP/1.1", host: "localhost:8080"

I tried alternative solutions using request url params instead of regex, but with no more success.


问:
Validate JSON with Custom JSON schema using C#
I am working on a project in which I need to read an Excel file and validate the dataset.
let's say as an example there is a column called "Date Of Birth" in Excel Sheet, so I need to check whether it's the correct date. because the user might enter number or a just letters into that column. So I can't ask to add Excel validation to that Excel file. so there is no validation in the Excel file. so users can add anything to any column.

and the other one is this excel header is not constant. these headers can change with time.
because of that, I can't create model classes for excel.

So I use "DocumentFormat.OpenXML" to read the Excel file. and use ExpandoObject to store this data set because as I said these headers might be changed.

I created a basic class to save the basic info of the cell

```<code>public class CellDetail
{
    public string CellHeading { get; set; } = string.Empty;
    public string CellValue { get; set; } = string.Empty;
    public string CellReference { get; set; } = string.Empty;

}
</code>```

"cellHeading" is the column Name, "CellValue" is the value of the cell, "CellReference" is the reference of the cell means as an example B12. Column "B" 12th line.

I was able to read the Excel sheet and create the dataset. finally I created JSON with this dataset

```<code>  private ExpandoObject ConvertCellToExpandoObject(SpreadsheetDocument spreadsheetDocument, Cell cell)
        {
            var cellDetail = _excelFileService.GetCellValue(spreadsheetDocument, cell);

            dynamic item = new ExpandoObject();
            item.Id = cellDetail.CellReference;
            item.CellDetail = new CellDetail { CellHeading = cellDetail.CellHeading, CellValue = cellDetail.CellValue, CellReference = cellDetail .CellReference };

            return item;

        }

public string ExcelDataSetToJSON()
        {
            List<ExpandoObject> allCellsInOneRow = new List<ExpandoObject>();
            List<List<ExpandoObject>> excelDataSet = new();
            SpreadsheetDocument spreadsheetDocument;
            var sheet = _excelFileService.GetSheetDataBySheetName(FILEPATH, SHEETNAME);
            var rowList = sheet.Elements<Row>();

            using (spreadsheetDocument = SpreadsheetDocument.Open(FILEPATH, false))
            {
                foreach (var row in rowList)
                {
                    var cellList = row.Elements<Cell>().Take(6);
                    foreach (Cell cell in cellList)
                    {
                        var cellDetailInExpando = ConvertCellToExpandoObject(spreadsheetDocument, cell);
                        allCellsInOneRow.Add(cellDetailInExpando);
                    }

                    excelDataSet.Add(allCellsInOneRow);
                    allCellsInOneRow = new List<ExpandoObject>();

                }

            }
            return Newtonsoft.Json.JsonConvert.SerializeObject(excelDataSet);

        }
</code>```

"ExcelDataSetToJSON" method return a JSON. it's look like this

so now I need to validate this JSON with JSON schema validation. still I didn't create JSON schema to validate the JSON. I saw one of the NuGet package named "Json.NET Schema". that used to validate JSON. I need to implement something like that.

I need to check mainly these things in the JSON

value should be number,

value should be string,

Minimum & maximum range,

value should be correct date

value should be one of the given options

how do I implement my own custom schema and do these validation?

Body:
I am working on a project in which I need to read an Excel file and validate the dataset.
let's say as an example there is a column called "Date Of Birth" in Excel Sheet, so I need to check whether it's the correct date. because the user might enter number or a just letters into that column. So I can't ask to add Excel validation to that Excel file. so there is no validation in the Excel file. so users can add anything to any column.

and the other one is this excel header is not constant. these headers can change with time.
because of that, I can't create model classes for excel.

So I use "DocumentFormat.OpenXML" to read the Excel file. and use ExpandoObject to store this data set because as I said these headers might be changed.

I created a basic class to save the basic info of the cell

public class CellDetail
{
    public string CellHeading { get; set; } = string.Empty;
    public string CellValue { get; set; } = string.Empty;
    public string CellReference { get; set; } = string.Empty;

}

"cellHeading" is the column Name, "CellValue" is the value of the cell, "CellReference" is the reference of the cell means as an example B12. Column "B" 12th line.

I was able to read the Excel sheet and create the dataset. finally I created JSON with this dataset

  private ExpandoObject ConvertCellToExpandoObject(SpreadsheetDocument spreadsheetDocument, Cell cell)
        {
            var cellDetail = _excelFileService.GetCellValue(spreadsheetDocument, cell);

            dynamic item = new ExpandoObject();
            item.Id = cellDetail.CellReference;
            item.CellDetail = new CellDetail { CellHeading = cellDetail.CellHeading, CellValue = cellDetail.CellValue, CellReference = cellDetail .CellReference };

            return item;

        }

public string ExcelDataSetToJSON()
        {
            List<ExpandoObject> allCellsInOneRow = new List<ExpandoObject>();
            List<List<ExpandoObject>> excelDataSet = new();
            SpreadsheetDocument spreadsheetDocument;
            var sheet = _excelFileService.GetSheetDataBySheetName(FILEPATH, SHEETNAME);
            var rowList = sheet.Elements<Row>();

            using (spreadsheetDocument = SpreadsheetDocument.Open(FILEPATH, false))
            {
                foreach (var row in rowList)
                {
                    var cellList = row.Elements<Cell>().Take(6);
                    foreach (Cell cell in cellList)
                    {
                        var cellDetailInExpando = ConvertCellToExpandoObject(spreadsheetDocument, cell);
                        allCellsInOneRow.Add(cellDetailInExpando);
                    }

                    excelDataSet.Add(allCellsInOneRow);
                    allCellsInOneRow = new List<ExpandoObject>();

                }

            }
            return Newtonsoft.Json.JsonConvert.SerializeObject(excelDataSet);

        }

"ExcelDataSetToJSON" method return a JSON. it's look like this

so now I need to validate this JSON with JSON schema validation. still I didn't create JSON schema to validate the JSON. I saw one of the NuGet package named "Json.NET Schema". that used to validate JSON. I need to implement something like that.

I need to check mainly these things in the JSON

value should be number,

value should be string,

Minimum & maximum range,

value should be correct date

value should be one of the given options

how do I implement my own custom schema and do these validation?


问:
Power BI totally how to hide menu from appearing in PDF
I have got a report where I have got several slicers group together and I have 2 button where I show and hide the slicers.  When the slicers are hidden and I do a PDF the menu bar with the show slicer still appears, is there a way I can remove the menu bar from displaying in PDF please ?

Many Thanks

I do not want the menu bar to display on the left hand side in PDF format as I need to sent this to the client and it looks strange that on the left there is a menu bar with the show menu bar on it.


问:
unable to pass value to the sass mixin variable
I am trying to write a mixin that will take the HEX color code and convert it to HSL. Every time the code is compiled it gives an error. tried to use @return to pass the variable but that also not working. help me fix the code.

Thanks in advance.

Error:

```<code>Compilation Error
Error: Undefined variable.
   ╷
43 │         $hue : $hue * 60;
   │                ^^^^
   ╵
</code>```

code inside _mixin.scss:

```<code>@mixin hex-to-hsl($hex) {
    $red:   red($hex);
    $green: green($hex);
    $blue:  blue($hex);

    $max: max($red, $green, $blue);
    $min: min($red, $green, $blue);

    $delta: calc($max - $min);

    $lightness: calc(($max + $min) / 2);

    @if ($delta == 0) {
        $hue: 0;
        $saturation: 0;
    } @else {
        @if ($lightness < 0.5) {
            $saturation : calc($delta / ($max + $min));
        } @else {
            $saturation : calc($delta / (2 - $max - $min));
        }

        @if ($red == $max) {
            $hue : calc(($green - $blue) / $delta);
        } @else if ($green == $max) {
            $hue : calc(2 + ($blue - $red) / $delta);
        } @else {
            $hue : calc(4 + ($red - $green) / $delta);

        }

        $hue : $hue * 60;
        @if ($hue < 0) {
            $hue : calc($hue + 360);
        }

    }
    color: hsl($hue, $saturation * 100%, $lightness * 100%);
}

</code>```

code in main.scss

```<code>$main-color: #4F6D7A;

.text3 {
    @include hex-to-hsl($main-color);
}
</code>```

Body:
I am trying to write a mixin that will take the HEX color code and convert it to HSL. Every time the code is compiled it gives an error. tried to use @return to pass the variable but that also not working. help me fix the code.

Thanks in advance.

Error:

Compilation Error
Error: Undefined variable.
   ╷
43 │         $hue : $hue * 60;
   │                ^^^^
   ╵

code inside _mixin.scss:

@mixin hex-to-hsl($hex) {
    $red:   red($hex);
    $green: green($hex);
    $blue:  blue($hex);

    $max: max($red, $green, $blue);
    $min: min($red, $green, $blue);

    $delta: calc($max - $min);

    $lightness: calc(($max + $min) / 2);

    @if ($delta == 0) {
        $hue: 0;
        $saturation: 0;
    } @else {
        @if ($lightness < 0.5) {
            $saturation : calc($delta / ($max + $min));
        } @else {
            $saturation : calc($delta / (2 - $max - $min));
        }

        @if ($red == $max) {
            $hue : calc(($green - $blue) / $delta);
        } @else if ($green == $max) {
            $hue : calc(2 + ($blue - $red) / $delta);
        } @else {
            $hue : calc(4 + ($red - $green) / $delta);

        }

        $hue : $hue * 60;
        @if ($hue < 0) {
            $hue : calc($hue + 360);
        }

    }
    color: hsl($hue, $saturation * 100%, $lightness * 100%);
}

code in main.scss

$main-color: #4F6D7A;

.text3 {
    @include hex-to-hsl($main-color);
}


问:
How can i update the appearance for NavigationBar and TabBar when using UISearchController?
In my UIKit-App, i am using a UITabBarController with two viewControllers: HomeViewController and SearchViewController. Every viewController is embedded inside a UINavigationController.

Inside my SearchViewController i setup a UISearchController like this:

func setupSearchController() {
   let searchResultsViewController = SearchResultsViewController()
   let searchController = UISearchController(searchResultsController: searchResultsViewController)
   searchController.showsSearchResultsController = true
   searchController.searchResultsUpdater = searchResultsViewController
   searchController.obscuresBackgroundDuringPresentation = false
   searchResultsViewController.searchController = searchController
   navigationItem.searchController = searchController
}
```
<p>I set <code>showsSearchResultsController = true</code> because i want to display search history items in a uicollectionview list when the searchbar is active and the user has not typed yet. That works, but now to the problem:</p>
<p>When a user selects one item, i want to display a fully different UICollectionView with the results. Instead of pushing a new viewcontroller, i want to show it over the current list. To do that, i implemented a child viewController, like this:</p>
<pre class="lang-swift prettyprint-override"><code>func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
   guard let selectedItem = dataSource.itemIdentifier(for: indexPath, animated: true) else {
      collectionView.deselectItem(at: indexPath, animated: true)
      return
   }
   collectionView.deselectItem(at: indexPath, animated: true)
   searchController.searchBar.resignFirstResponder()
   searchController.searchBar.text = selectedItem.text

   let resultsViewController = ResultsViewController()
   addChild(resultsViewController)
   view.addSubView(resultsViewController)
   resultsViewController.didMove(toParent: self)
}
</code>```

The result looks like this:

As you can see, the background of the UISearchBar and the UITabBar is not translucent, i don't know why this happen. I setup the the collectionView on the resultsViewController like this using SnapKit

func setupCollectionView() {
   view.addSubview(collectionView)
   collectionView.snp.makeConstraints {
      $0.edges.equalToSuperview()
   }
}
```
<p>But when i was set the constraints to <code>$0.edges.equalTo(view.safeAreaLayoutGuide)</code> the result looks like this:</p>
<p><img src="https://i.stack.imgur.com/96gpvl.png" alt="enter image description here" /></p>
<p>Definitely better than before, but I have now lost the translucent effect completely. From my point of view, the problem seems to be related to the constraints in some way. But what do I have to change to get the translucent effect back?</p>
<p><strong>EDIT</strong></p>
<p>I don't know if it's the right solution, but i was able to fix the error by removing the collectionView before initializing the child view controller like this:</p>
<pre class="lang-swift prettyprint-override"><code>func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
   // ...
   collectionView.removeFromSuperView()

   let resultsViewController = ResultsViewController()
   addChild(resultsViewController)
   view.addSubView(resultsViewController)
   resultsViewController.didMove(toParent: self)
}
</code>```

Body:
In my UIKit-App, i am using a UITabBarController with two viewControllers: HomeViewController and SearchViewController. Every viewController is embedded inside a UINavigationController.

Inside my SearchViewController i setup a UISearchController like this:

func setupSearchController() {
   let searchResultsViewController = SearchResultsViewController()
   let searchController = UISearchController(searchResultsController: searchResultsViewController)
   searchController.showsSearchResultsController = true
   searchController.searchResultsUpdater = searchResultsViewController
   searchController.obscuresBackgroundDuringPresentation = false
   searchResultsViewController.searchController = searchController
   navigationItem.searchController = searchController
}

I set showsSearchResultsController = true because i want to display search history items in a uicollectionview list when the searchbar is active and the user has not typed yet. That works, but now to the problem:

When a user selects one item, i want to display a fully different UICollectionView with the results. Instead of pushing a new viewcontroller, i want to show it over the current list. To do that, i implemented a child viewController, like this:

func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
   guard let selectedItem = dataSource.itemIdentifier(for: indexPath, animated: true) else {
      collectionView.deselectItem(at: indexPath, animated: true)
      return
   }
   collectionView.deselectItem(at: indexPath, animated: true)
   searchController.searchBar.resignFirstResponder()
   searchController.searchBar.text = selectedItem.text

   let resultsViewController = ResultsViewController()
   addChild(resultsViewController)
   view.addSubView(resultsViewController)
   resultsViewController.didMove(toParent: self)
}

The result looks like this:

As you can see, the background of the UISearchBar and the UITabBar is not translucent, i don't know why this happen. I setup the the collectionView on the resultsViewController like this using SnapKit

func setupCollectionView() {
   view.addSubview(collectionView)
   collectionView.snp.makeConstraints {
      $0.edges.equalToSuperview()
   }
}

But when i was set the constraints to $0.edges.equalTo(view.safeAreaLayoutGuide) the result looks like this:

Definitely better than before, but I have now lost the translucent effect completely. From my point of view, the problem seems to be related to the constraints in some way. But what do I have to change to get the translucent effect back?

EDIT

I don't know if it's the right solution, but i was able to fix the error by removing the collectionView before initializing the child view controller like this:

func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
   // ...
   collectionView.removeFromSuperView()

   let resultsViewController = ResultsViewController()
   addChild(resultsViewController)
   view.addSubView(resultsViewController)
   resultsViewController.didMove(toParent: self)
}


问:
Allure report on RobotFramework
I'm executing a test in RobotFramework and I'd like to display the report in Allure but I'm getting an error instead. This is what I'm executing:

```<code>robot --listener allure_robotframework;results -d logs --variable ENV:SNP --exitonfailure MyTest.robot
</code>```

The test will run just fine and at the end I run this command:

```<code>allure serve  ./results
</code>```

Traceback (most recent call last):
File "C:\Users\nbrito\Anaconda3\envs\frameworkAutomacao2\Lib\site-packages\allure.py", line 1, in
from allure_commons.allure import title
File "C:\Users\nbrito\Anaconda3\envs\frameworkAutomacao2\Lib\site-packages\allure_commons_init.py", line 1, in
from allure_commons.hooks import hookimpl  # noqa: F401
File "C:\Users\nbrito\Anaconda3\envs\frameworkAutomacao2\Lib\site-packages\allure_commons_hooks.py", line 1, in

from pluggy import HookspecMarker, HookimplMarker
File "C:\Users\nbrito\Anaconda3\envs\frameworkAutomacao2\Lib\site-packages\pluggy_init.py", line 16, in

from ._manager import PluginManager, PluginValidationError
File "C:\Users\nbrito\Anaconda3\envs\frameworkAutomacao2\Lib\site-packages\pluggy_manager.py", line 181
f"did not find any {self.project_name!r} hooks in {module_or_class!r}"
^
SyntaxError: invalid syntax

I checked the env virables and my currenct virtual env is mentioned in PATH. This is what I get when I type where python

C:\Users\nbrito\Anaconda3\envs\frameworkAutomacao2\python.exe
C:\Users\nbrito\Anaconda3\python.exe
C:\Users\nbrito\AppData\Local\Microsoft\WindowsApps\python.exe

Please, can you help me to fix this?

Title: Allure report on RobotFramework

Body:
I'm executing a test in RobotFramework and I'd like to display the report in Allure but I'm getting an error instead. This is what I'm executing:

robot --listener allure_robotframework;results -d logs --variable ENV:SNP --exitonfailure MyTest.robot

The test will run just fine and at the end I run this command:

allure serve  ./results

Traceback (most recent call last):
File "C:\Users\nbrito\Anaconda3\envs\frameworkAutomacao2\Lib\site-packages\allure.py", line 1, in
from allure_commons.allure import title
File "C:\Users\nbrito\Anaconda3\envs\frameworkAutomacao2\Lib\site-packages\allure_commons_init.py", line 1, in
from allure_commons.hooks import hookimpl  # noqa: F401
File "C:\Users\nbrito\Anaconda3\envs\frameworkAutomacao2\Lib\site-packages\allure_commons_hooks.py", line 1, in

from pluggy import HookspecMarker, HookimplMarker
File "C:\Users\nbrito\Anaconda3\envs\frameworkAutomacao2\Lib\site-packages\pluggy_init.py", line 16, in

from ._manager import PluginManager, PluginValidationError
File "C:\Users\nbrito\Anaconda3\envs\frameworkAutomacao2\Lib\site-packages\pluggy_manager.py", line 181
f"did not find any {self.project_name!r} hooks in {module_or_class!r}"
^
SyntaxError: invalid syntax

I checked the env virables and my currenct virtual env is mentioned in PATH. This is what I get when I type where python

C:\Users\nbrito\Anaconda3\envs\frameworkAutomacao2\python.exe
C:\Users\nbrito\Anaconda3\python.exe
C:\Users\nbrito\AppData\Local\Microsoft\WindowsApps\python.exe

Please, can you help me to fix this?


问:
Conversion from redux-saga to redux/toolkit
How can I convert this code wrote using redux-saga with redux/toolkit?

```<code>yield all(action.payload.map((doc) => call(insertDoc, doc)));
</code>```

where insertDoc is another function.

Thanks

Matthew

Body:
How can I convert this code wrote using redux-saga with redux/toolkit?

yield all(action.payload.map((doc) => call(insertDoc, doc)));

where insertDoc is another function.

Thanks

Matthew


问:
How to delete starting rows of an Excel sheet (.xls format) in python?
The excel file (.xls) contains 20 invalid rows at the beginning that I would like to delete.

I tried to skip rows by pd.read_excel(file_name, sheet_name = "Sheet1", skiprows=range(1, 21), it didn't work.

It throws an assertion error  assert _unused_i == nstrings - 1

openpyxl throws: openpyxl.utils.exceptions.InvalidFileException: openpyxl does not support the old .xls file format, please use xlrd to read this file, or convert it to the more recent .xlsx file format.

Manually deleting the top 20 rows and loading it with pandas work. I'm struggling to delete the top 20 rows programmatically.


问:
How to run Robust ANCOVA for 2 continuous variables and 1 grouping factor
My data is: total death rate (response variable), total case rate (covariate), continent (grouping factor)

When entering the code below:

```<code>ancova(Total_Deaths_Per_Million~Total_Cases_Per_Million+factor(Continent), data=CasesandDeathsCleanAfricaEurpoe)
</code>```

Error code says the degrees of freedom must be greater than or equal to 2.

Please can someone specify what I need to do to avoid this

example of data.frame

(https://i.stack.imgur.com/XVnLb.png)

Body:
My data is: total death rate (response variable), total case rate (covariate), continent (grouping factor)

When entering the code below:

ancova(Total_Deaths_Per_Million~Total_Cases_Per_Million+factor(Continent), data=CasesandDeathsCleanAfricaEurpoe)

Error code says the degrees of freedom must be greater than or equal to 2.

Please can someone specify what I need to do to avoid this

example of data.frame

(https://i.stack.imgur.com/XVnLb.png)


问:
How do I add a Flutter single page app into an Eleventy website?
Eleventy is of course a static website generator.  I have a number of pages that are written in markdown files.

I have a Flutter app built as a single page website.  Its structure is similar to the below (I didn't include all the files)

```<code>\assets
\canvaskit
\icons
flutter.js
index.html
main.dart.js
</code>```

How do I include that in my static page generated eleventy website?

Body:
Eleventy is of course a static website generator.  I have a number of pages that are written in markdown files.

I have a Flutter app built as a single page website.  Its structure is similar to the below (I didn't include all the files)

\assets
\canvaskit
\icons
flutter.js
index.html
main.dart.js

How do I include that in my static page generated eleventy website?


问:
Apache Netbeans IDE not responding
I have installed Apache Netbean 16 and doesnt respong as soon as its launches,
I have tried other versions of the same thing.

So am probably doing something wrong with installation

My system is
Processor   Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz, 2601 Mhz, 4 Core(s), 8 Logical Processor(s)
RAM: 32GB
C-drive 2GB free of 99GB
D- drive 170GB free of 900GB

the apache is installed on the D drive

Title: Apache Netbeans IDE not responding


问:
Get low latency terminal events without having seperate threads?
I am trying to make an interactive terminal application with a tui in C. I can get blocking keyboard input with getc/read and get resizesignal (SIGWINCH) with waitsig, but then I need to have multiple threads because they are blocking. Or I can check for non blocking keypress and terminal resize in a loop with ioctl, but then either the cpu usage is high or I have to sleep some time (which increases the latency). Is there a better way to do this? Or a function that waits for ANY terminal event, so I only need one extra thread? The main thread is going to be used to draw/update the terminal screen.

I tried to have a mainloop that checks for keypress and terminal resize every time it draws, but this is really inefficient.


问:
linker command failed with exit code 1 appflow
i'm trying to generate an Ios Build on AppFlow but i'm getting the follow issue:

```<code>▸ Compiling CDVIonicKeyboard.m
▸ Compiling CDVInAppBrowserOptions.m
▸ Compiling CDVInAppBrowserNavigationController.m
▸ Compiling CDVDevice.m
▸ Compiling AppDelegate.m
▸ Compiling AppDelegate+FirebasePlugin.m
▸ Linking Doação do Bem

❌  ld: framework not found Pods_Doac_a_o_do_Bem

❌  clang: error: linker command failed with exit code 1 (use -v to see invocation)

** ARCHIVE FAILED **

The following build commands failed:
    Ld /Users/ionic/Library/Developer/Xcode/DerivedData/Doação-beqnnqghtsgeefgbqzrcwiwhvhex/Build/Intermediates.noindex/ArchiveIntermediates/Doação do Bem/InstallationBuildProductsLocation/Applications/Doação.app/Doação normal
(1 failure)
[15:00:46]: Exit status: 65

+---------------+-------------------------+
|            Build environment            |
+---------------+-------------------------+
| xcode_path    | /Applications/Xcode.app |
| gym_version   | 2.185.0                 |
| export_method | development             |
| sdk           | iPhoneOS14.5.sdk        |
+---------------+-------------------------+

[15:00:46]: ▸ /Users/ionic/builds/inovacao/doacao/platforms/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'FBSDKShareKit' from project 'Pods')
[15:00:46]: ▸ /Users/ionic/builds/inovacao/doacao/platforms/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'FBSDKLoginKit' from project 'Pods')
[15:00:46]: ▸ /Users/ionic/builds/inovacao/doacao/platforms/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'FirebaseCoreDiagnostics' from project 'Pods')
[15:00:46]: ▸ /Users/ionic/builds/inovacao/doacao/platforms/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'FirebaseMessaging' from project 'Pods')
[15:00:46]: ▸ /Users/ionic/builds/inovacao/doacao/platforms/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'FirebaseRemoteConfig' from project 'Pods')
[15:00:46]:
[15:00:46]: ⬆  Check out the few lines of raw `xcodebuild` output above for potential hints on how to solve this error
[15:00:46]:   For the complete and more detailed error log, check the full log at:
[15:00:46]:   /Users/ionic/Library/Logs/gym/Doação-Doação.log
[15:00:46]:
[15:00:46]: Your `export_method` in gym is defined as `development`
[15:00:46]: which might cause problems when signing your application
[15:00:46]: Are you sure want to build and export for development?
[15:00:46]: Please make sure to define the correct export methods when calling
[15:00:46]: gym in your Fastfile or from the command line
[15:00:46]:
[15:00:46]:
[15:00:46]: Looks like fastlane ran into a build/archive error with your project
[15:00:46]: It's hard to tell what's causing the error, so we wrote some guides on how
[15:00:46]: to troubleshoot build and signing issues: https://docs.fastlane.tools/codesigning/getting-started/
[15:00:46]: Before submitting an issue on GitHub, please follow the guide above and make
[15:00:46]: sure your project is set up correctly.
[15:00:46]: fastlane uses `xcodebuild` commands to generate your binary, you can see the
[15:00:46]: the full commands printed out in yellow in the above log.
[15:00:46]: Make sure to inspect the output above, as usually you'll find more error information there
[15:00:46]:
[15:00:46]: -------------------------
[15:00:46]: --- Step: upload_logs ---
[15:00:46]: -------------------------
[15:00:58]: Unable to upload package list log. Skipping.
[15:01:07]: ---------------------------
[15:01:07]: --- Step: shell command ---
[15:01:07]: ---------------------------
[15:01:07]: -----------------------------
[15:01:07]: --- Step: delete_keychain ---
[15:01:07]: -----------------------------
[15:01:07]: Error building the application - see the log above
+-------------------------------------+-----------------------------------------------------------------------------------------------------------------+
|                                                                     Lane Context                                                                      |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------------+
| DEFAULT_PLATFORM                    | ios                                                                                |
| PLATFORM_NAME                       | ios                                                                                |
| LANE_NAME                           | ios build_ionic                                                                                |
| NODE_PACKAGE_MANAGER                | npm                                                                                |
| PROJECT_WEB_DIR                     | www                                                                                |
| KEYCHAIN_PATH                       | ~/Library/Keychains/IonicKeychain                                                                               |
| DOWNLOAD_CERTS_PROVISION_FILE_UUID  | 5be2531f-1aa3-4edf-b681-f04bc2e9e92e                                                                            |
| DOWNLOAD_CERTS_CODESIGNING_IDENTITY | iPhone Developer: Vinicius Gomes (42QSQ9W96V)                                                                   |
| DOWNLOAD_CERTS_TEAM_ID              | 8PZLTG83YY                                                                                |
| DOWNLOAD_CERTS_CERT_PATH            | /Users/ionic/builds/inovacao/doacao/cert_file.p12                                            |
| SIGH_PROFILE_PATHS                  | ["/Users/ionic/builds/inovacao/doacao/5be2531f-1aa3-4edf-b681-f04bc2e9e92e.mobileprovision"] |
| XCODE_PROJECT_NAME                  | Doação                                                                                |
| XCODE_PROJECT_PATH                  | /Users/ionic/builds/inovacao/doacao/platforms/ios/Doação.xcodeproj                    |
| XCODE_WORKSPACE_PATH                | /Users/ionic/builds/inovacao/doacao/platforms/ios/Doação do Bem.xcworkspace
|
+-------------------------------------+-----------------------------------------------------------------------------------------------------------------+
[15:01:07]: Error building the application - see the log above

[!] Error building the application - see the log above
+------+----------------------------------+-------------+
|                   fastlane summary                    |
+------+----------------------------------+-------------+
| Step | Action                           | Time (in s) |
+------+----------------------------------+-------------+
| 1    | add_extra_platforms              | 0           |
| 2    | default_platform                 | 0           |
| 3    | build_summary                    | 5           |
| 4    | detect_native_type               | 0           |
| 5    | Switch to ios build_cordova lane | 0           |
| 6    | detect_package_manager           | 0           |
| 7    | add_git_credentials              | 0           |
| 8    | get_appflow_config               | 0           |
| 9    | dependency_install               | 48          |
| 10   | get_web_dir                      | 0           |
| 11   | modify_config_xml                | 0           |
| 12   | create_keychain                  | 0           |
| 13   | download_certs                   | 1           |
| 14   | import_certificate               | 0           |
| 15   | build_pro_app                    | 32          |
| 16   | add_cordova_to_index             | 0           |
| 17   | cordova platform add ios         | 242         |
| 18   | get_xcode_project_paths          | 0           |
| 19   | update_code_signing_settings     | 0           |
|    | gym                              | 361         |
| 21   | upload_logs                      | 21          |
| 22   | shell command                    | 0           |
| 23   | delete_keychain                  | 0           |
+------+----------------------------------+-------------+

[15:01:07]: fastlane finished with errors
Running after script...
$ clean-up
ERROR: Job failed: Process exited with: 1. Reason was:  ()
</code>```

Infos:

```<code>Ionic:

   Ionic CLI          : 5.4.16 (C:\Users\guilh\AppData\Roaming\nvm\v18.12.1\node_modules\ionic)
   Ionic Framework    : ionic-angular 3.9.5
   @ionic/app-scripts : 3.2.2

Cordova:

   Cordova CLI       : 11.0.0 (cordova-lib@11.1.0)
   Cordova Platforms : android 8.1.0, browser 6.0.0
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 5.0.0, (and 13 other plugins)

Utility:

   cordova-res : 0.15.4
   native-run  : not installed

System:

   Android SDK Tools : 26.1.1 (C:\Users\guilh\AppData\Local\Android\Sdk)
   NodeJS            : v18.12.1 (C:\Users\guilh\AppData\Roaming\nvm\v18.12.1\node.exe)
   npm               : 9.2.0
   OS                : Windows 10
</code>```

plugins:
cordova-plugin-androidx-adapter 1.1.3 "cordova-plugin-androidx-adapter"
cordova-plugin-androidx 1.0.2 "cordova-plugin-androidx"
cordova-plugin-device 2.1.0 "Device"
cordova-plugin-facebook4 6.4.0 "Facebook Connect"
cordova-plugin-firebasex 7.0.2 "Google Firebase Plugin"
cordova-plugin-geolocation 4.0.2 "Geolocation"
cordova-plugin-inappbrowser 4.1.0 "InAppBrowser"
cordova-plugin-ionic-keyboard 2.2.0 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 5.0.0 "cordova-plugin-ionic-webview"
cordova-plugin-request-location-accuracy 2.3.0 "Request Location Accuracy"
cordova-plugin-sign-in-with-apple 0.1.2 "cordova-plugin-sign-in-with-apple"
cordova-plugin-splashscreen 5.0.4 "Splashscreen"
cordova-plugin-statusbar 2.4.3 "StatusBar"
cordova-plugin-whitelist 1.3.5 "Whitelist"
cordova-plugin-x-socialsharing 5.6.8 "SocialSharing"
cordova-sqlite-storage 5.1.0 "Cordova sqlite storage plugin - cordova-sqlite-storage plugin version"
es6-promise-plugin 4.2.2 "Promise"

i've tried to change versions of plugins and a lot of thing, but nothing resolved this. Also i tried to remove some os plugins buth none of all worked

Body:
i'm trying to generate an Ios Build on AppFlow but i'm getting the follow issue:

▸ Compiling CDVIonicKeyboard.m
▸ Compiling CDVInAppBrowserOptions.m
▸ Compiling CDVInAppBrowserNavigationController.m
▸ Compiling CDVDevice.m
▸ Compiling AppDelegate.m
▸ Compiling AppDelegate+FirebasePlugin.m
▸ Linking Doação do Bem

❌  ld: framework not found Pods_Doac_a_o_do_Bem

❌  clang: error: linker command failed with exit code 1 (use -v to see invocation)

** ARCHIVE FAILED **

The following build commands failed:
    Ld /Users/ionic/Library/Developer/Xcode/DerivedData/Doação-beqnnqghtsgeefgbqzrcwiwhvhex/Build/Intermediates.noindex/ArchiveIntermediates/Doação do Bem/InstallationBuildProductsLocation/Applications/Doação.app/Doação normal
(1 failure)
[15:00:46]: Exit status: 65

+---------------+-------------------------+
|            Build environment            |
+---------------+-------------------------+
| xcode_path    | /Applications/Xcode.app |
| gym_version   | 2.185.0                 |
| export_method | development             |
| sdk           | iPhoneOS14.5.sdk        |
+---------------+-------------------------+

[15:00:46]: ▸ /Users/ionic/builds/inovacao/doacao/platforms/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'FBSDKShareKit' from project 'Pods')
[15:00:46]: ▸ /Users/ionic/builds/inovacao/doacao/platforms/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'FBSDKLoginKit' from project 'Pods')
[15:00:46]: ▸ /Users/ionic/builds/inovacao/doacao/platforms/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'FirebaseCoreDiagnostics' from project 'Pods')
[15:00:46]: ▸ /Users/ionic/builds/inovacao/doacao/platforms/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'FirebaseMessaging' from project 'Pods')
[15:00:46]: ▸ /Users/ionic/builds/inovacao/doacao/platforms/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.5.99. (in target 'FirebaseRemoteConfig' from project 'Pods')
[15:00:46]:
[15:00:46]: ⬆  Check out the few lines of raw `xcodebuild` output above for potential hints on how to solve this error
[15:00:46]:   For the complete and more detailed error log, check the full log at:
[15:00:46]:   /Users/ionic/Library/Logs/gym/Doação-Doação.log
[15:00:46]:
[15:00:46]: Your `export_method` in gym is defined as `development`
[15:00:46]: which might cause problems when signing your application
[15:00:46]: Are you sure want to build and export for development?
[15:00:46]: Please make sure to define the correct export methods when calling
[15:00:46]: gym in your Fastfile or from the command line
[15:00:46]:
[15:00:46]:
[15:00:46]: Looks like fastlane ran into a build/archive error with your project
[15:00:46]: It's hard to tell what's causing the error, so we wrote some guides on how
[15:00:46]: to troubleshoot build and signing issues: https://docs.fastlane.tools/codesigning/getting-started/
[15:00:46]: Before submitting an issue on GitHub, please follow the guide above and make
[15:00:46]: sure your project is set up correctly.
[15:00:46]: fastlane uses `xcodebuild` commands to generate your binary, you can see the
[15:00:46]: the full commands printed out in yellow in the above log.
[15:00:46]: Make sure to inspect the output above, as usually you'll find more error information there
[15:00:46]:
[15:00:46]: -------------------------
[15:00:46]: --- Step: upload_logs ---
[15:00:46]: -------------------------
[15:00:58]: Unable to upload package list log. Skipping.
[15:01:07]: ---------------------------
[15:01:07]: --- Step: shell command ---
[15:01:07]: ---------------------------
[15:01:07]: -----------------------------
[15:01:07]: --- Step: delete_keychain ---
[15:01:07]: -----------------------------
[15:01:07]: Error building the application - see the log above
+-------------------------------------+-----------------------------------------------------------------------------------------------------------------+
|                                                                     Lane Context                                                                      |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------------+
| DEFAULT_PLATFORM                    | ios                                                                                |
| PLATFORM_NAME                       | ios                                                                                |
| LANE_NAME                           | ios build_ionic                                                                                |
| NODE_PACKAGE_MANAGER                | npm                                                                                |
| PROJECT_WEB_DIR                     | www                                                                                |
| KEYCHAIN_PATH                       | ~/Library/Keychains/IonicKeychain                                                                               |
| DOWNLOAD_CERTS_PROVISION_FILE_UUID  | 5be2531f-1aa3-4edf-b681-f04bc2e9e92e                                                                            |
| DOWNLOAD_CERTS_CODESIGNING_IDENTITY | iPhone Developer: Vinicius Gomes (42QSQ9W96V)                                                                   |
| DOWNLOAD_CERTS_TEAM_ID              | 8PZLTG83YY                                                                                |
| DOWNLOAD_CERTS_CERT_PATH            | /Users/ionic/builds/inovacao/doacao/cert_file.p12                                            |
| SIGH_PROFILE_PATHS                  | ["/Users/ionic/builds/inovacao/doacao/5be2531f-1aa3-4edf-b681-f04bc2e9e92e.mobileprovision"] |
| XCODE_PROJECT_NAME                  | Doação                                                                                |
| XCODE_PROJECT_PATH                  | /Users/ionic/builds/inovacao/doacao/platforms/ios/Doação.xcodeproj                    |
| XCODE_WORKSPACE_PATH                | /Users/ionic/builds/inovacao/doacao/platforms/ios/Doação do Bem.xcworkspace
|
+-------------------------------------+-----------------------------------------------------------------------------------------------------------------+
[15:01:07]: Error building the application - see the log above

[!] Error building the application - see the log above
+------+----------------------------------+-------------+
|                   fastlane summary                    |
+------+----------------------------------+-------------+
| Step | Action                           | Time (in s) |
+------+----------------------------------+-------------+
| 1    | add_extra_platforms              | 0           |
| 2    | default_platform                 | 0           |
| 3    | build_summary                    | 5           |
| 4    | detect_native_type               | 0           |
| 5    | Switch to ios build_cordova lane | 0           |
| 6    | detect_package_manager           | 0           |
| 7    | add_git_credentials              | 0           |
| 8    | get_appflow_config               | 0           |
| 9    | dependency_install               | 48          |
| 10   | get_web_dir                      | 0           |
| 11   | modify_config_xml                | 0           |
| 12   | create_keychain                  | 0           |
| 13   | download_certs                   | 1           |
| 14   | import_certificate               | 0           |
| 15   | build_pro_app                    | 32          |
| 16   | add_cordova_to_index             | 0           |
| 17   | cordova platform add ios         | 242         |
| 18   | get_xcode_project_paths          | 0           |
| 19   | update_code_signing_settings     | 0           |
|    | gym                              | 361         |
| 21   | upload_logs                      | 21          |
| 22   | shell command                    | 0           |
| 23   | delete_keychain                  | 0           |
+------+----------------------------------+-------------+

[15:01:07]: fastlane finished with errors
Running after script...
$ clean-up
ERROR: Job failed: Process exited with: 1. Reason was:  ()

Infos:

Ionic:

   Ionic CLI          : 5.4.16 (C:\Users\guilh\AppData\Roaming\nvm\v18.12.1\node_modules\ionic)
   Ionic Framework    : ionic-angular 3.9.5
   @ionic/app-scripts : 3.2.2

Cordova:

   Cordova CLI       : 11.0.0 (cordova-lib@11.1.0)
   Cordova Platforms : android 8.1.0, browser 6.0.0
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 5.0.0, (and 13 other plugins)

Utility:

   cordova-res : 0.15.4
   native-run  : not installed

System:

   Android SDK Tools : 26.1.1 (C:\Users\guilh\AppData\Local\Android\Sdk)
   NodeJS            : v18.12.1 (C:\Users\guilh\AppData\Roaming\nvm\v18.12.1\node.exe)
   npm               : 9.2.0
   OS                : Windows 10

plugins:
cordova-plugin-androidx-adapter 1.1.3 "cordova-plugin-androidx-adapter"
cordova-plugin-androidx 1.0.2 "cordova-plugin-androidx"
cordova-plugin-device 2.1.0 "Device"
cordova-plugin-facebook4 6.4.0 "Facebook Connect"
cordova-plugin-firebasex 7.0.2 "Google Firebase Plugin"
cordova-plugin-geolocation 4.0.2 "Geolocation"
cordova-plugin-inappbrowser 4.1.0 "InAppBrowser"
cordova-plugin-ionic-keyboard 2.2.0 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 5.0.0 "cordova-plugin-ionic-webview"
cordova-plugin-request-location-accuracy 2.3.0 "Request Location Accuracy"
cordova-plugin-sign-in-with-apple 0.1.2 "cordova-plugin-sign-in-with-apple"
cordova-plugin-splashscreen 5.0.4 "Splashscreen"
cordova-plugin-statusbar 2.4.3 "StatusBar"
cordova-plugin-whitelist 1.3.5 "Whitelist"
cordova-plugin-x-socialsharing 5.6.8 "SocialSharing"
cordova-sqlite-storage 5.1.0 "Cordova sqlite storage plugin - cordova-sqlite-storage plugin version"
es6-promise-plugin 4.2.2 "Promise"

i've tried to change versions of plugins and a lot of thing, but nothing resolved this. Also i tried to remove some os plugins buth none of all worked


问:
Dispalyname in Firebase is null React native app
how I can affectation the username to dispalyname and show in home page please help me I tired to find solution but without any resuat

I work with react native and Firebase

(https://i.stack.imgur.com/KeKLh.png)]
(https://i.stack.imgur.com/IXjDh.png)](https://i.stack.imgur.com/vvMDS.png)i.stack.imgur.com/Vn4N0.png)

enter image description here

show user name in home page


问:
How to switch between multiple result sets in Sybase using JDBC
I have some code to test the migration of a sybase database into a SQL Server one. A part of the testing is to execute stored procedures in both databases and compare the results.

I have a stored procedure that returns 10+ result sets. The issue is that with Sybase, when I try to switch from one result set to the other, it fails. The 2nd result set ends up being null which means I'm only getting result set back in Sybase. This code works for SQL server.

Any idea how to get this to work for Sybase?

I'm using java 8 and JConn 4.

```<code> public static void storedProc(){

        String strConnectionString = "jdbc:sybase:Tds:host:port?";
        String strUsername = "username";
        String strPassword = "pass";

        String strQuery = "exec storedprocedure";

        Connection connection = JDBCUtils.databaseConnection(strConnectionString, strUsername, strPassword);

        PreparedStatement preparedStatement = connection.prepareStatement(strQuery, ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);

        int intResulSet = 0;
        int count = 0;
        try{

            preparedStatement.executeQuery();

            ResultSet resultSet = preparedStatement.getResultSet();

            while (resultSet!=null) {
                intResulSet +=1;
                System.out.println(resultSet);
                System.out.println("Result Set: " + intResulSet);
                if (!resultSet.next()) {
                    System.out.println("Result Set is Empty");
                } else {
                    do {
                        count+=1;
                        System.out.println(count);
                    } while (resultSet.next());
                }
                preparedStatement.getMoreResults(Statement.CLOSE_CURRENT_RESULT);;
                resultSet = preparedStatement.getResultSet();
                System.out.println(resultSet);

            }

        } catch (SQLException e) {
            System.out.println(e.getMessage());
        }

       connection.close();
}
</code>```

This is just a piece of my code. Not doing any of the comparisons here. This is just trying to successfully switch from one resultset to the next.

This same exact code switches through and prints results for all the result sets in SQL, but unfortunately, no luck in Sybase.

I've also tried to use callable statement instead of prepared statement and same issue.

Body:
I have some code to test the migration of a sybase database into a SQL Server one. A part of the testing is to execute stored procedures in both databases and compare the results.

I have a stored procedure that returns 10+ result sets. The issue is that with Sybase, when I try to switch from one result set to the other, it fails. The 2nd result set ends up being null which means I'm only getting result set back in Sybase. This code works for SQL server.

Any idea how to get this to work for Sybase?

I'm using java 8 and JConn 4.

 public static void storedProc(){

        String strConnectionString = "jdbc:sybase:Tds:host:port?";
        String strUsername = "username";
        String strPassword = "pass";

        String strQuery = "exec storedprocedure";

        Connection connection = JDBCUtils.databaseConnection(strConnectionString, strUsername, strPassword);

        PreparedStatement preparedStatement = connection.prepareStatement(strQuery, ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);

        int intResulSet = 0;
        int count = 0;
        try{

            preparedStatement.executeQuery();

            ResultSet resultSet = preparedStatement.getResultSet();

            while (resultSet!=null) {
                intResulSet +=1;
                System.out.println(resultSet);
                System.out.println("Result Set: " + intResulSet);
                if (!resultSet.next()) {
                    System.out.println("Result Set is Empty");
                } else {
                    do {
                        count+=1;
                        System.out.println(count);
                    } while (resultSet.next());
                }
                preparedStatement.getMoreResults(Statement.CLOSE_CURRENT_RESULT);;
                resultSet = preparedStatement.getResultSet();
                System.out.println(resultSet);

            }

        } catch (SQLException e) {
            System.out.println(e.getMessage());
        }

       connection.close();
}

This is just a piece of my code. Not doing any of the comparisons here. This is just trying to successfully switch from one resultset to the next.

This same exact code switches through and prints results for all the result sets in SQL, but unfortunately, no luck in Sybase.

I've also tried to use callable statement instead of prepared statement and same issue.


问:
I have to refresh page everytime to load content even if I am using reactrouter
I am using React Router for client-side routing in my web application, but I am experiencing an issue where I have to reload the page every time I navigate to a new route.

I have verified that the correct components are being rendered and that the URL is updating correctly, but the page still needs to be reloaded for the changes to take effect. How can I fix this issue?

App.js

```<code>import './App.css';
import React, { Component } from 'react'
import NavBar from './components/NavBar';
import News from './components/News';
import {
  BrowserRouter as Router,
  Switch,
  Route
} from "react-router-dom";

export default class App extends Component {
  render() {
    return (
      <div>
        <Router>
          <NavBar />
          <Switch>
            <Route exact path="/">
              <News key="general" pageSize='15' country='us' category='general' />
            </Route>
            <Route exact path="/Business">
              <News key="business" pageSize='15' country='us' category='business' />
            </Route>
            <Route exact path="/Entertainment">
              <News key="entertainment" pageSize='15' country='us' category='entertainment' />
            </Route>
            <Route exact path="/Health">
              <News key="health" pageSize='15' country='us' category='health' />
            </Route>
            <Route exact path="/Science">
              <News key="science" pageSize='15' country='us' category='science' />
            </Route>
            <Route exact path="/Sports">
              <News key="sports" pageSize='15' country='us' category='sports' />
            </Route>
            <Route exact path="/Technology">
              <News key="technology" pageSize='15' country='us' category='technology' />
            </Route>
          </Switch>
        </Router>
      </div>
    )
  }
}
</code>```

navbar.js

```<code>import React from 'react'
import { Link } from 'react-router-dom'

export default function NavBar() {
  return (
    <div>
      <nav className="navbar navbar-expand-lg navbar-dark bg-dark">
        <div className="container-fluid">
          <Link className="navbar-brand" to="/">NewsMonkey</Link>
          <button className="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
            <span className="navbar-toggler-icon"></span>
          </button>
          <div className="collapse navbar-collapse" id="navbarSupportedContent">
            <ul className="navbar-nav me-auto mb-2 mb-lg-0">
              <li className="nav-item">
                <Link className="nav-link" aria-current="page" to="/">Home</Link>
              </li>
              <li className="nav-item"><Link className="nav-link" to="/business">Business</Link></li>
              <li className="nav-item"><Link className="nav-link" to="/entertainment">Entertainment</Link></li>
              <li className="nav-item"><Link className="nav-link" to="/general">General</Link></li>
              <li className="nav-item"><Link className="nav-link" to="/health">Health</Link></li>
              <li className="nav-item"><Link className="nav-link" to="/science">Science</Link></li>
              <li className="nav-item"><Link className="nav-link" to="/sports">Sports</Link></li>
              <li className="nav-item"><Link className="nav-link" to="/technology">Technology</Link></li>
            </ul>
          </div>
        </div>
      </nav>
    </div>
  )
}
</code>```

Body:
I am using React Router for client-side routing in my web application, but I am experiencing an issue where I have to reload the page every time I navigate to a new route.

I have verified that the correct components are being rendered and that the URL is updating correctly, but the page still needs to be reloaded for the changes to take effect. How can I fix this issue?

App.js

import './App.css';
import React, { Component } from 'react'
import NavBar from './components/NavBar';
import News from './components/News';
import {
  BrowserRouter as Router,
  Switch,
  Route
} from "react-router-dom";

export default class App extends Component {
  render() {
    return (

        <Router>
          <NavBar />
          <Switch>
            <Route exact path="/">
              <News key="general" pageSize='15' country='us' category='general' />
            </Route>
            <Route exact path="/Business">
              <News key="business" pageSize='15' country='us' category='business' />
            </Route>
            <Route exact path="/Entertainment">
              <News key="entertainment" pageSize='15' country='us' category='entertainment' />
            </Route>
            <Route exact path="/Health">
              <News key="health" pageSize='15' country='us' category='health' />
            </Route>
            <Route exact path="/Science">
              <News key="science" pageSize='15' country='us' category='science' />
            </Route>
            <Route exact path="/Sports">
              <News key="sports" pageSize='15' country='us' category='sports' />
            </Route>
            <Route exact path="/Technology">
              <News key="technology" pageSize='15' country='us' category='technology' />
            </Route>
          </Switch>
        </Router>

    )
  }
}

navbar.js

import React from 'react'
import { Link } from 'react-router-dom'

export default function NavBar() {
  return (

          <Link className="navbar-brand" to="/">NewsMonkey</Link>
          <button className="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">

          </button>

                <Link className="nav-link" aria-current="page" to="/">Home</Link>

<Link className="nav-link" to="/business">Business</Link>

<Link className="nav-link" to="/entertainment">Entertainment</Link>

<Link className="nav-link" to="/general">General</Link>

<Link className="nav-link" to="/health">Health</Link>

<Link className="nav-link" to="/science">Science</Link>

<Link className="nav-link" to="/sports">Sports</Link>

<Link className="nav-link" to="/technology">Technology</Link>

  )
}


问:
Django - allauth: How to keep only the allauth login url
How can I remove the allauth signup URL while keeping the login URL in Django? I am using the allauth package for authentication and I would like to only keep the login URL while removing the rest URLs as i have project that needs only the login. Can anyone provide a code snippet on how to achieve this?

I have tried using the url method to exclude the rest urls from my URL patterns, but that also broke the login URL. I was expecting to only remove the signup URL while keeping the login URL accessible through allauth package in Django

edit: my urlpatterns

```<code>urlpatterns = [path('', include('Departments.urls')),
           path('', include('Managements.urls')),
           path('', include('Registration.urls')),
           path('accounts/', include('allauth.urls')),]
</code>```

Body:
How can I remove the allauth signup URL while keeping the login URL in Django? I am using the allauth package for authentication and I would like to only keep the login URL while removing the rest URLs as i have project that needs only the login. Can anyone provide a code snippet on how to achieve this?

I have tried using the url method to exclude the rest urls from my URL patterns, but that also broke the login URL. I was expecting to only remove the signup URL while keeping the login URL accessible through allauth package in Django

edit: my urlpatterns

urlpatterns = [path('', include('Departments.urls')),
           path('', include('Managements.urls')),
           path('', include('Registration.urls')),
           path('accounts/', include('allauth.urls')),]


问:
Sensu-Go ::: Set handler for keepalive check with puppet
I want to be able to get notified when a server is down.

Puppet: sensu/sensu-puppet v5.9.0

Based on https://github.com/sensu/sensu-go/issues/1960, I tried this code without success.

Since there is a special static handler called "keepalive", I create a set handler "keepalive" and include my telegram handler (telegram_ops) in it.

BACKEND Code

```<code>class { 'sensu':
  api_host                     => 'sensu3.mydomain.com',
  password                     => '****',
  agent_password               => '****',
  agent_entity_config_password => '****',
  ssl_ca_source => 'puppet:///modules/common/ssl/ca.crt',
}

include sensu::cli

class { 'sensu::backend':
  ssl_cert_source => 'puppet:///modules/common/ssl/my.crt',
  ssl_key_source  => 'puppet:///modules/common/ssl/my.key',
  config_hash     => {
    'deregistration-handler' => 'deregistration',
    'event-log-file'         => '/var/log/sensu/events.log'
  }
}

sensu_bonsai_asset { 'sensu/check-cpu-usage':
  ensure  => 'present',
  version => 'latest',
  }
sensu_check { 'check-cpu':
  ensure         => 'present',
  labels         => {'contacts' => 'ops'},
  handlers       => ['telegram_ops'],
  command        => 'check-cpu-usage -w 75 -c 85',
  interval       => 60,
  subscriptions  => 'linux',
  publish        => true,
  runtime_assets => ['sensu/check-cpu-usage']
}

sensu_bonsai_asset { 'sensu/sensu-go-has-contact-filter':
  ensure  => 'present',
  version => '0.2.0',
}
sensu_filter { 'contact_ops':
  ensure         => 'present',
  action         => 'allow',
  runtime_assets => ['sensu/sensu-go-has-contact-filter'],
  expressions    => ['has_contact(event, "ops")'],
}

sensu_filter { 'first_occurrence':
  ensure         => 'present',
  action         => 'allow',
  expressions    => ['event.check.occurrences == 1'],
}

sensu_bonsai_asset { 'Thor77/sensu-telegram-handler':
  ensure  => 'present'
}
sensu_handler { 'telegram_ops':
  ensure          => 'present',
  type            => 'pipe',
  command         => 'sensu-telegram-handler --api-token **** --chatid -****',
  timeout         => 10,
  runtime_assets  => ['Thor77/sensu-telegram-handler'],
  filters         => [
    'is_incident',
    'not_silenced',
    'contact_ops',
    'first_occurrence'
  ],
}
sensu_handler { 'keepalive':
  ensure    => 'present',
  type      => 'set',
  handlers  => ['telegram_ops'],
}
</code>```

AGENT Code (Very simple code.)

```<code>class { 'sensu::agent':
  subscriptions => ['default', 'linux', $hostname, 'nuc']
}
</code>```

It does not work. If I suddenly shutdown a server, nothing happeds.

What is the proper way to do this?

It is posible any other aproach?

Long time ago there was another solution, class sensu had the parameter client_keepalive but it is not available anymore.

Thanks.

Body:
I want to be able to get notified when a server is down.

Puppet: sensu/sensu-puppet v5.9.0

Based on https://github.com/sensu/sensu-go/issues/1960, I tried this code without success.

Since there is a special static handler called "keepalive", I create a set handler "keepalive" and include my telegram handler (telegram_ops) in it.

BACKEND Code

class { 'sensu':
  api_host                     => 'sensu3.mydomain.com',
  password                     => '****',
  agent_password               => '****',
  agent_entity_config_password => '****',
  ssl_ca_source => 'puppet:///modules/common/ssl/ca.crt',
}

include sensu::cli

class { 'sensu::backend':
  ssl_cert_source => 'puppet:///modules/common/ssl/my.crt',
  ssl_key_source  => 'puppet:///modules/common/ssl/my.key',
  config_hash     => {
    'deregistration-handler' => 'deregistration',
    'event-log-file'         => '/var/log/sensu/events.log'
  }
}

sensu_bonsai_asset { 'sensu/check-cpu-usage':
  ensure  => 'present',
  version => 'latest',
  }
sensu_check { 'check-cpu':
  ensure         => 'present',
  labels         => {'contacts' => 'ops'},
  handlers       => ['telegram_ops'],
  command        => 'check-cpu-usage -w 75 -c 85',
  interval       => 60,
  subscriptions  => 'linux',
  publish        => true,
  runtime_assets => ['sensu/check-cpu-usage']
}

sensu_bonsai_asset { 'sensu/sensu-go-has-contact-filter':
  ensure  => 'present',
  version => '0.2.0',
}
sensu_filter { 'contact_ops':
  ensure         => 'present',
  action         => 'allow',
  runtime_assets => ['sensu/sensu-go-has-contact-filter'],
  expressions    => ['has_contact(event, "ops")'],
}

sensu_filter { 'first_occurrence':
  ensure         => 'present',
  action         => 'allow',
  expressions    => ['event.check.occurrences == 1'],
}

sensu_bonsai_asset { 'Thor77/sensu-telegram-handler':
  ensure  => 'present'
}
sensu_handler { 'telegram_ops':
  ensure          => 'present',
  type            => 'pipe',
  command         => 'sensu-telegram-handler --api-token **** --chatid -****',
  timeout         => 10,
  runtime_assets  => ['Thor77/sensu-telegram-handler'],
  filters         => [
    'is_incident',
    'not_silenced',
    'contact_ops',
    'first_occurrence'
  ],
}
sensu_handler { 'keepalive':
  ensure    => 'present',
  type      => 'set',
  handlers  => ['telegram_ops'],
}

AGENT Code (Very simple code.)

class { 'sensu::agent':
  subscriptions => ['default', 'linux', $hostname, 'nuc']
}

It does not work. If I suddenly shutdown a server, nothing happeds.

What is the proper way to do this?

It is posible any other aproach?

Long time ago there was another solution, class sensu had the parameter client_keepalive but it is not available anymore.

Thanks.


问:
How to loop through all LCOV coverage projects in cmake
Using this link https://github.com/QianYizhou/gtest-cmake-gcov-example I was able to generate LCOV reports for my C++ project code coverage.

For example, I have 5 projects in my solution. 4 libraries and 1 executable. Each projects contains it's own CMakeLists.txt

As per the steps given in the above github link, I added

```<code>    SETUP_TARGET_FOR_COVERAGE(
    coverage_${PROJECT_NAME}  # Name for custom target.
    ${PROJECT_NAME}         # Name of the test driver executable that runs the tests.
    # NOTE! This should always have a ZERO as exit code
    # otherwise the coverage generation will not complete.

    ${CMAKE_PROJECT_ROOT_DIR}application/TestReports/coverage_${PROJECT_NAME}_dir            # Name of output directory.
    )
endif()
</code>```

so when I completed my cmake build command when the make file is generated, I can see these 5 projects. so for example, if one of my project name is abc,

in command line if I type make space tab key I can see coverage_abc

Here my question comes. I am integrating this into my pipeline, so rather than giving these project names individually can I iterate the makefile and generate make command?

Body:
Using this link https://github.com/QianYizhou/gtest-cmake-gcov-example I was able to generate LCOV reports for my C++ project code coverage.

For example, I have 5 projects in my solution. 4 libraries and 1 executable. Each projects contains it's own CMakeLists.txt

As per the steps given in the above github link, I added

    SETUP_TARGET_FOR_COVERAGE(
    coverage_${PROJECT_NAME}  # Name for custom target.
    ${PROJECT_NAME}         # Name of the test driver executable that runs the tests.
    # NOTE! This should always have a ZERO as exit code
    # otherwise the coverage generation will not complete.

    ${CMAKE_PROJECT_ROOT_DIR}application/TestReports/coverage_${PROJECT_NAME}_dir            # Name of output directory.
    )
endif()

so when I completed my cmake build command when the make file is generated, I can see these 5 projects. so for example, if one of my project name is abc,

in command line if I type make space tab key I can see coverage_abc

Here my question comes. I am integrating this into my pipeline, so rather than giving these project names individually can I iterate the makefile and generate make command?


问:
Is there a way to add the GRASS v.centerline function to the QGIS Toolbox GRASS functions?
The standard GRASS plugin in QGIS does not include the v.centerline function in the Toolbox..  it may be an extension that needs to be added..   is there a way to add v.centerline to the GRASS functions in the QGIS toolbox?  Would prefer not having to try and learn using the separate GRASS environment to try and use v.centerline.

Tried finding procedure on web to add v.centerline as extension to GRASS functions in QGIS Toolbox, but without success..