问:
How to know that a single user is connected through websocket from multiple devices? In django
I'm working on social media app in django. I have one user who is logged in from multiple devices and connected to websocket. How do i know that from which devices user is connected through websocket and through which is not.
So i can send push notifications to user's device from which user is not connected.?

For now im handling it through making a table called user devices. This table is connected to user table with foreign key. So whenever user login from a particular device Im storing its information like device id, device token, is_online.
And whenever user gets connected through websocket im Changing its state to is online true. And whenever user disconnects from websocket im Changing it to false according to multiple devices.
I just want to know is there any more efficient way then this.


来源: stackexchange

问:
Checkbox in flutter with maestro
i would like to manage a checkbox in flutter with Maestro Mobile Dev (https://maestro.mobile.dev/) but maestro doesn't identify my widget

```<code>CheckboxListTile(
   title: Text('localizations.welcomeDisclaimerChoice'),
   value: checkedValue,
   onChanged: (newValue) {
      setState(() {
          checkedValue = newValue!;
      });
   },
);
</code>```

i don't find semantic way to resolve my issue
Any help

Thx

ContentLicense: CC BY-SA 4.0

Title: Checkbox in flutter with maestro

Body:
i would like to manage a checkbox in flutter with Maestro Mobile Dev (https://maestro.mobile.dev/) but maestro doesn't identify my widget

CheckboxListTile(
   title: Text('localizations.welcomeDisclaimerChoice'),
   value: checkedValue,
   onChanged: (newValue) {
      setState(() {
          checkedValue = newValue!;
      });
   },
);

i don't find semantic way to resolve my issue
Any help

Thx


问:
After loading my project from git on a different computer, com.unity.ugui scripts break
```<code>Library\PackageCache\com.unity.ugui@1.0.0\Runtime\EventSystem\EventData\BaseEventData.cs(44,30): error CS0246: The type or namespace name 'EventSystem' could not be found (are you missing a using directive or an assembly reference?)
</code>```
```<code>Library\PackageCache\com.unity.ugui@1.0.0\Runtime\UI\Core\DefaultControls.cs(140,61): error CS0246: The type or namespace name 'Selectable' could not be found (are you missing a using directive or an assembly reference?)
</code>```
```<code>Library\PackageCache\com.unity.ugui@1.0.0\Runtime\EventSystem\InputModules\PointerInputModule.cs(10,48): error CS0246: The type or namespace name 'BaseInputModule' could not be found (are you missing a using directive or an assembly reference?)
</code>```

I got over 100 errors in Safe Mode similar to this. All the errors are saying that some namespace or element doesn't exist in the com.unity.ugui script. It all happened after I cloned my repo and opened it. There were no errors when I commited.

I tried something with the Input System packages but that did not do anything. I tried reinstalling but I'm not sure if it did because it's a dependency.

Here is a screenshot of some errors

Body:
Library\PackageCache\com.unity.ugui@1.0.0\Runtime\EventSystem\EventData\BaseEventData.cs(44,30): error CS0246: The type or namespace name 'EventSystem' could not be found (are you missing a using directive or an assembly reference?)

Library\PackageCache\com.unity.ugui@1.0.0\Runtime\UI\Core\DefaultControls.cs(140,61): error CS0246: The type or namespace name 'Selectable' could not be found (are you missing a using directive or an assembly reference?)

Library\PackageCache\com.unity.ugui@1.0.0\Runtime\EventSystem\InputModules\PointerInputModule.cs(10,48): error CS0246: The type or namespace name 'BaseInputModule' could not be found (are you missing a using directive or an assembly reference?)

I got over 100 errors in Safe Mode similar to this. All the errors are saying that some namespace or element doesn't exist in the com.unity.ugui script. It all happened after I cloned my repo and opened it. There were no errors when I commited.

I tried something with the Input System packages but that did not do anything. I tried reinstalling but I'm not sure if it did because it's a dependency.

Here is a screenshot of some errors


问:
Custom Javascript in Swagger Swashbuckle in asp.net core
I'm using asp.net core with Swagger Swashbuckle.

I would like to have a custom script and I'm using below code:

```<code> app
            .UseSwagger()
            .UseSwaggerUI(options =>
            {
                options.SwaggerEndpoint($"/swagger/GroupName/swagger.json", GroupName);
                options.InjectJavascript("../assets/swaggerinit.js");
            });
</code>```

The script has been included in the DOM but in the header!

I want to generate the script after the main swagger-ut js,

Is there a way to bring the custom.js to the bottom of the page?

Body:
I'm using asp.net core with Swagger Swashbuckle.

I would like to have a custom script and I'm using below code:

 app
            .UseSwagger()
            .UseSwaggerUI(options =>
            {
                options.SwaggerEndpoint($"/swagger/GroupName/swagger.json", GroupName);
                options.InjectJavascript("../assets/swaggerinit.js");
            });

The script has been included in the DOM but in the header!

I want to generate the script after the main swagger-ut js,

Is there a way to bring the custom.js to the bottom of the page?


问:
Python, using numpy solve a dominant matrix
I need to make this code solve if the matrix is a dominant diagonal.

Maybe problem is here:
abs(a[:, i][i + 1:]) >= np.sum(abs(a[:i]) + abs(a[:i+1]))

```<code>import numpy as np

a = np.loadtxt("3.txt")

def diagonal_dominant():

  b = True

  for i in range(a.shape[1]):

    if abs(a[:, i][i + 1:]) >= np.sum(abs(a[:i]) + abs(a[:i+1]))

       b = False

    if b: print("diagonal-dominant ")

    else: print("not diagonal-dominant")

diagonal_dominant()
</code>```

Body:
I need to make this code solve if the matrix is a dominant diagonal.

Maybe problem is here:
abs(a[:, i][i + 1:]) >= np.sum(abs(a[:i]) + abs(a[:i+1]))

import numpy as np

a = np.loadtxt("3.txt")

def diagonal_dominant():

  b = True

  for i in range(a.shape[1]):

    if abs(a[:, i][i + 1:]) >= np.sum(abs(a[:i]) + abs(a[:i+1]))

       b = False

    if b: print("diagonal-dominant ")

    else: print("not diagonal-dominant")

diagonal_dominant()


问:
MySQL combining multiple columns with GROUP_CONCAT, per row
I have some objects which have duplicates. One table stores the objects (the 'primaries'); another stores the one-to-many relation of objects to their duplicates (the 'secondaries'):

```<code>Objects
-------
`obj`
A1
A1a
A1b
A2
</code>```
```<code>Duplicates
----------
`primary`,`secondary`
A1, A1a
A1, A1b
</code>```

I'm trying to devise a single query that uses GROUP_CONCAT to return a summary of objects and their duplicates, returning one row per object: [obj, primary, combined secondary columns], like:

```<code> A1,   A1,(A1a,A1b)
 A1a,  A1,(A1a,A1b)
 A1b,  A1,(A1a,A1b)
 A2,   NULL
</code>```

Trying to do

```<code>SELECT `obj`, `primary`, GROUP_CONCAT(`secondary`)
FROM `Objects`
LEFT JOIN `Duplicates` on (`obj`=`primary` OR `obj`=`secondary`)
</code>```

is returning only a single row, containing a concat of all secondaries from all rows:

```<code> a1a,a1a,  a1b,a1b,a1c,a1c,a2b,a2b
</code>```

Thanks for any help!

@PM 77-1 (thanks) suggested adding a GROUP BY clause. I tried this:

```<code>SELECT `obj`, `primary`, GROUP_CONCAT(`secondary`)
FROM `Objects`
LEFT JOIN `Duplicates` on (`obj`=`primary` OR `obj`=`secondary`) GROUP BY `obj`
</code>```

which improved things, and gives 4 rows, one for each instance of obj, and the results are what I want for A1 and A2, but each of obj A1a and A1b should be A1a,A1b.

```<code>obj primary GROUP_CONCAT(`secondary`)
A1  A1      A1a,A1b
A1a A1      A1a
A1b A1      A1b
A2  NULL    NULL

</code>```

[BTW I forgot that primary is a reserved word so in my test implementation this is actually primaryy!]

So, still stuck on this...

Edit:

I'm not stuck anymore! The result above is what I wanted! Thanks to @PM 77-1.

Body:
I have some objects which have duplicates. One table stores the objects (the 'primaries'); another stores the one-to-many relation of objects to their duplicates (the 'secondaries'):

Objects
-------
`obj`
A1
A1a
A1b
A2

Duplicates
----------
`primary`,`secondary`
A1, A1a
A1, A1b

I'm trying to devise a single query that uses GROUP_CONCAT to return a summary of objects and their duplicates, returning one row per object: [obj, primary, combined secondary columns], like:

 A1,   A1,(A1a,A1b)
 A1a,  A1,(A1a,A1b)
 A1b,  A1,(A1a,A1b)
 A2,   NULL

Trying to do

SELECT `obj`, `primary`, GROUP_CONCAT(`secondary`)
FROM `Objects`
LEFT JOIN `Duplicates` on (`obj`=`primary` OR `obj`=`secondary`)

is returning only a single row, containing a concat of all secondaries from all rows:

 a1a,a1a,  a1b,a1b,a1c,a1c,a2b,a2b

Thanks for any help!

@PM 77-1 (thanks) suggested adding a GROUP BY clause. I tried this:

SELECT `obj`, `primary`, GROUP_CONCAT(`secondary`)
FROM `Objects`
LEFT JOIN `Duplicates` on (`obj`=`primary` OR `obj`=`secondary`) GROUP BY `obj`

which improved things, and gives 4 rows, one for each instance of obj, and the results are what I want for A1 and A2, but each of obj A1a and A1b should be A1a,A1b.

obj primary GROUP_CONCAT(`secondary`)
A1  A1      A1a,A1b
A1a A1      A1a
A1b A1      A1b
A2  NULL    NULL

[BTW I forgot that primary is a reserved word so in my test implementation this is actually primaryy!]

So, still stuck on this...

Edit:

I'm not stuck anymore! The result above is what I wanted! Thanks to @PM 77-1.


问:
AWS Cognito: Receive sorted user list
I'm using Python with boto3 for accessing my AWS Cognito user data information.

Problem

I'm using list_users to retrieve a paginated list of users to eventually show them in a web browser.
Problem is, the list is not sorted. So entries are difficult to find and every time I reload my Web UI a different order is shown.

How can I receive a sorted list of users.

In the documentation I cannot find any information about sorting.

Title: AWS Cognito: Receive sorted user list


问:
How do I create inner glow around rounded corners progress bar WPF
Am trying to make progress bar with inner glow effect. I have no idea how to make that effect inside progress bar and am not sure how to achieve it without using images.

What I have done so far:

With style code:

```<code>    <Style x:Key="Hunger_Bar" TargetType="{x:Type ProgressBar}">
        <Setter Property="Background" Value="#000000"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ProgressBar}">
                    <Grid Name="TemplateRoot" SnapsToDevicePixels="true">
                        <Border CornerRadius="10" Background="#1d1d1d"/>
                        <Border Name="PART_Track" CornerRadius="10" Background="Transparent"/>
                        <Decorator x:Name="PART_Indicator" HorizontalAlignment="Left" Margin="0">
                            <Grid Name="Foreground">
                                <Border CornerRadius="10" Background="#49891e" Name="Indicator">
                                    <TextBlock Text="50%" Foreground="White" FontFamily="Poppins" FontSize="9" HorizontalAlignment="Center" VerticalAlignment="Center" />
                                </Border>
                            </Grid>

                        </Decorator>
                        <TextBlock Text="Hunger" HorizontalAlignment="Right" Foreground="White" Margin="0,0,10,0"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</code>```

What am trying to achieve (from project visualization):

Here I have 2 HEX colors for fill: inner background(#49891e) and glow effect around it is #67a73c.

Thank you for any help!

Body:
Am trying to make progress bar with inner glow effect. I have no idea how to make that effect inside progress bar and am not sure how to achieve it without using images.

What I have done so far:

With style code:

What am trying to achieve (from project visualization):

Here I have 2 HEX colors for fill: inner background(#49891e) and glow effect around it is #67a73c.

Thank you for any help!


问:
Android search in a ListView (Android API Level 8)
We are trying to replicate the SearchBar on Android (SDK Level 8). We know that there is a SearchView in Android Level 11 but our devices run on level 8. Is there any widgets or any ways to search a ListView without having to upgrade our devices?

We are trying to mimic the search like the iPhone SDK.

ContentLicense: CC BY-SA 3.0


问:
Jenkins job to check if the syntax of any given YAML file is correct
I am trying to build a Jenkins Job to check if the syntax of any given YAML file is correct for project requirement. Is this possible?

The only validators I find are online web portals based where you copy paste your code and check for the syntax. Is this possible to achieve via Jenkins job job.??


问:
Send powershell output to nodejs service
Running a Powershell script from a nodejs service and want to print whether info or warning or error to the nodejs service console.

Only getting the nodejs service output in the console,

NodeJS Service:

```<code>const express = require("express");
const bodyParser = require("body-parser");
const app = express();
const shell = require('shelljs');
const { stdout, stderr } = require("process");
const { rmSync } = require("fs");

//Varaible Declaration
let dbListQuote = "";

app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());

app.get('/health', function (req, res) {
    console.log("Request for health service");
    res.send('OK');
});

app.get('/triggerDatabaseBackup', function (req, res) {
    //Validation for both the parameters like 'dbList' & 'target folder'
    if (req.query.DatabaseList != null && req.query.TargetFolder != null && req.query.DatabaseList != "" && req.query.TargetFolder != "") {
        console.log("Required parameters for database back-up are provided");

        //validation for missing "" for the DBList
        if (req.query.DatabaseList.startsWith('"') && req.query.DatabaseList.slice(-1) === '"') {
        }
        else {
            dbListQuote = '"' + req.query.DatabaseList + '"';
        }

        const dbListTemp = dbListQuote.split(",");
        const dbList = dbListTemp.join("\",\"");
        const targetBackUp_Folder = req.query.TargetFolder;
        const ipAddress = req.query.ipAddress;
        const sqlServer = req.query.sqlServer;
        console.log('Request of database backup for', dbList, 'has been triggered sucessfully !!!');
        let executePowerShellCommand = shell.exec(`C:\\DbAutomationService\\powerTest.ps1 ${ipAddress} ${sqlServer} ${dbList} ${targetBackUp_Folder}`, { 'shell': 'powershell.exe' }, (error, stdout, stderr) => {

            if (error !== null) {
                console.log(error);
            } else {
                console.log('stdout: ' + stdout);
                console.log('stderr: ' + stderr);
            }
        })
        res.status(200).json('Success! Database-backup Completed!')
    }
    else {
        console.log("Parameter Missing");
    }

})

var server = app.listen(9045, function () {
    var host = server.address().address;
    var port = server.address().port;
    console.log("Database Automation Service is listening on :", port);
});
</code>```

PowerShell Script:

```<code>function createDbBackUp() {
    [CmdletBinding()]
    Param(
        [Parameter(Mandatory = $True)] [string[]][AllowNull()][AllowEmptyCollection()] $ipAddress,
        [Parameter(Mandatory = $True)] [string][AllowNull()][AllowEmptyString()] $sqlServer,
        [Parameter(Mandatory = $True)] [string[]][AllowNull()][AllowEmptyCollection()] $db_List,
        #[Parameter(Mandatory = $True)] [string][AllowNull()][AllowEmptyString()] $source_folder
        [Parameter(Mandatory = $True)] [string][AllowNull()][AllowEmptyString()] $targetBackUp_Folder
    )
    $sqlServerAddressFinal = $args[0];
    $sqlServerNameFinal = $args[1];
    $targetFolderForBackUpFiles= $args[3];
    $databaseList = @();;
    $databaseList += $args[2];
    $dbFinal = $databaseList.Split(',');
    foreach ($str in $dbFinal) {
        Write-Host $str;
    }
    if(-Not ($BackFolderContentsValidator.Count -eq 0) -or ($BackFolderContentsValidator.Count -eq 0)){
        for ($i = 0; $i -le $dbFinal.Count -1 ; $i++){
            $DatabaseName= $dbFinal[$i];
            $Folder=$targetFolderForBackUpFiles;
            $FolderLocation =$Folder+$DatabaseName+".bak";
            Write-Host $DatabaseName "is the current database";
            $Query = "USE master
                    GO
                    --Step-1 : Take Backup
                    BEGIN TRY
                       Backup Database $DatabaseName To Disk =  '$FolderLocation' With Format;
                       IF @@ERROR <>0
                       BEGIN
                         PRINT 'Error occured while taking backups'
                         RETURN
                       END
                       PRINT 'Backups taken Successfull!!'
                    END TRY
                    BEGIN CATCH
                    PRINT 'Errors occured!'
                    END CATCH"
            $ServerInstance = $sqlServerNameFinal
                try{
                    #Invoker
                    #$BackupDatabase= Invoke-Sqlcmd -ServerInstance $ServerInstance -Database master -Query $Query -QueryTimeout 5400
                }
                catch {
                    throw (New-Object System.Exception "Error while invoking the sql command "$_.Exception);
                }
        }
    }
    else{
            Write-Host "Folder which holds the databases back up is not empty, there are older back up present inside the folder";
    }

}
createDbBackUp -ipAddress ${ipAddress} -sqlServer ${sqlServer} -db_List $db_List -targetBackUp_Folder $targetBackUp_Folder
</code>```

The scripts are working fine but I want to write the output of the PowerShell script to the nodejs service console. But the current script is not printing? am I missing something?

Body:
Running a Powershell script from a nodejs service and want to print whether info or warning or error to the nodejs service console.

Only getting the nodejs service output in the console,

NodeJS Service:

const express = require("express");
const bodyParser = require("body-parser");
const app = express();
const shell = require('shelljs');
const { stdout, stderr } = require("process");
const { rmSync } = require("fs");

//Varaible Declaration
let dbListQuote = "";

app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());

app.get('/health', function (req, res) {
    console.log("Request for health service");
    res.send('OK');
});

app.get('/triggerDatabaseBackup', function (req, res) {
    //Validation for both the parameters like 'dbList' & 'target folder'
    if (req.query.DatabaseList != null && req.query.TargetFolder != null && req.query.DatabaseList != "" && req.query.TargetFolder != "") {
        console.log("Required parameters for database back-up are provided");

        //validation for missing "" for the DBList
        if (req.query.DatabaseList.startsWith('"') && req.query.DatabaseList.slice(-1) === '"') {
        }
        else {
            dbListQuote = '"' + req.query.DatabaseList + '"';
        }

        const dbListTemp = dbListQuote.split(",");
        const dbList = dbListTemp.join("\",\"");
        const targetBackUp_Folder = req.query.TargetFolder;
        const ipAddress = req.query.ipAddress;
        const sqlServer = req.query.sqlServer;
        console.log('Request of database backup for', dbList, 'has been triggered sucessfully !!!');
        let executePowerShellCommand = shell.exec(`C:\\DbAutomationService\\powerTest.ps1 ${ipAddress} ${sqlServer} ${dbList} ${targetBackUp_Folder}`, { 'shell': 'powershell.exe' }, (error, stdout, stderr) => {

            if (error !== null) {
                console.log(error);
            } else {
                console.log('stdout: ' + stdout);
                console.log('stderr: ' + stderr);
            }
        })
        res.status(200).json('Success! Database-backup Completed!')
    }
    else {
        console.log("Parameter Missing");
    }

})

var server = app.listen(9045, function () {
    var host = server.address().address;
    var port = server.address().port;
    console.log("Database Automation Service is listening on :", port);
});

PowerShell Script:

function createDbBackUp() {
    [CmdletBinding()]
    Param(
        [Parameter(Mandatory = $True)] [string[]][AllowNull()][AllowEmptyCollection()] $ipAddress,
        [Parameter(Mandatory = $True)] [string][AllowNull()][AllowEmptyString()] $sqlServer,
        [Parameter(Mandatory = $True)] [string[]][AllowNull()][AllowEmptyCollection()] $db_List,
        #[Parameter(Mandatory = $True)] [string][AllowNull()][AllowEmptyString()] $source_folder
        [Parameter(Mandatory = $True)] [string][AllowNull()][AllowEmptyString()] $targetBackUp_Folder
    )
    $sqlServerAddressFinal = $args[0];
    $sqlServerNameFinal = $args[1];
    $targetFolderForBackUpFiles= $args[3];
    $databaseList = @();;
    $databaseList += $args[2];
    $dbFinal = $databaseList.Split(',');
    foreach ($str in $dbFinal) {
        Write-Host $str;
    }
    if(-Not ($BackFolderContentsValidator.Count -eq 0) -or ($BackFolderContentsValidator.Count -eq 0)){
        for ($i = 0; $i -le $dbFinal.Count -1 ; $i++){
            $DatabaseName= $dbFinal[$i];
            $Folder=$targetFolderForBackUpFiles;
            $FolderLocation =$Folder+$DatabaseName+".bak";
            Write-Host $DatabaseName "is the current database";
            $Query = "USE master
                    GO
                    --Step-1 : Take Backup
                    BEGIN TRY
                       Backup Database $DatabaseName To Disk =  '$FolderLocation' With Format;
                       IF @@ERROR <>0
                       BEGIN
                         PRINT 'Error occured while taking backups'
                         RETURN
                       END
                       PRINT 'Backups taken Successfull!!'
                    END TRY
                    BEGIN CATCH
                    PRINT 'Errors occured!'
                    END CATCH"
            $ServerInstance = $sqlServerNameFinal
                try{
                    #Invoker
                    #$BackupDatabase= Invoke-Sqlcmd -ServerInstance $ServerInstance -Database master -Query $Query -QueryTimeout 5400
                }
                catch {
                    throw (New-Object System.Exception "Error while invoking the sql command "$_.Exception);
                }
        }
    }
    else{
            Write-Host "Folder which holds the databases back up is not empty, there are older back up present inside the folder";
    }

}
createDbBackUp -ipAddress ${ipAddress} -sqlServer ${sqlServer} -db_List $db_List -targetBackUp_Folder $targetBackUp_Folder

The scripts are working fine but I want to write the output of the PowerShell script to the nodejs service console. But the current script is not printing? am I missing something?


问:
scale_pos_weight grid.fit mismatch
Only the clever can figure out!

If somebody works out the scale_pos_weight in XGBoost, after finding out the best point, if they refit the model with that point, another figure comes up! i.e.:
Best: 0.950298 using {'scale_pos_weight': 1.028}
Baseline (raw) ROC_AUC =  0.87857

Whereas we expected Baseline (raw) ROC_AUC =  0.950298

Why?!

A very simpled stand-alone script is as:

`

```<code>`import numpy as np
from sklearn import datasets
from sklearn.model_selection import cross_val_score
from xgboost import  XGBClassifier
from collections import Counter
from sklearn.model_selection import GridSearchCV
from sklearn.model_selection import RepeatedStratifiedKFold

X, y = datasets.load_iris(return_X_y=True)
y00=y
ee=-1
for jj in y:
    ee+=1
    if y[ee]==2:
        y[ee]=np.random.randint(0,2)

counter = Counter(y)
# estimate scale_pos_weight value
Nsbat = counter[0] / counter[1]
#%%
# from numpy import mean
# from sklearn.datasets import make_classification

# define model
modelXGB = XGBClassifier(use_label_encoder=False,\
                      eval_metric='auc')
# define grid
w0 =np.linspace(0.2,1.1,201)
w1=np.append(w0,Nsbat)
w2=np.append(w1,1)
weights =np.sort(w2)

param_grid = dict(scale_pos_weight=weights)
# define evaluation procedure
cv = RepeatedStratifiedKFold(n_splits=10, n_repeats=3, random_state=1)
# define grid search
grid = GridSearchCV(estimator=modelXGB, param_grid=param_grid, n_jobs=-1, cv=cv, scoring='roc_auc')
# execute the grid search
grid_result = grid.fit(X, y)
# report the best configuration
print("Best: %f using %s" % (grid_result.best_score_, grid_result.best_params_))
#%%
res_imb=np.array(list(grid_result.best_params_.values()))[0]
modelXGB.scale_pos_weight=res_imb
cvs=cross_val_score(modelXGB, X, y, scoring='roc_auc')
baseline = cvs.mean()
print(f'Baseline (raw) ROC_AUC =  {baseline:.5f}')
</code>```

`

```<code>`
</code>```

Title: scale_pos_weight grid.fit mismatch

Body:
Only the clever can figure out!

If somebody works out the scale_pos_weight in XGBoost, after finding out the best point, if they refit the model with that point, another figure comes up! i.e.:
Best: 0.950298 using {'scale_pos_weight': 1.028}
Baseline (raw) ROC_AUC =  0.87857

Whereas we expected Baseline (raw) ROC_AUC =  0.950298

Why?!

A very simpled stand-alone script is as:

`

`import numpy as np
from sklearn import datasets
from sklearn.model_selection import cross_val_score
from xgboost import  XGBClassifier
from collections import Counter
from sklearn.model_selection import GridSearchCV
from sklearn.model_selection import RepeatedStratifiedKFold

X, y = datasets.load_iris(return_X_y=True)
y00=y
ee=-1
for jj in y:
    ee+=1
    if y[ee]==2:
        y[ee]=np.random.randint(0,2)

counter = Counter(y)
# estimate scale_pos_weight value
Nsbat = counter[0] / counter[1]
#%%
# from numpy import mean
# from sklearn.datasets import make_classification

# define model
modelXGB = XGBClassifier(use_label_encoder=False,\
                      eval_metric='auc')
# define grid
w0 =np.linspace(0.2,1.1,201)
w1=np.append(w0,Nsbat)
w2=np.append(w1,1)
weights =np.sort(w2)

param_grid = dict(scale_pos_weight=weights)
# define evaluation procedure
cv = RepeatedStratifiedKFold(n_splits=10, n_repeats=3, random_state=1)
# define grid search
grid = GridSearchCV(estimator=modelXGB, param_grid=param_grid, n_jobs=-1, cv=cv, scoring='roc_auc')
# execute the grid search
grid_result = grid.fit(X, y)
# report the best configuration
print("Best: %f using %s" % (grid_result.best_score_, grid_result.best_params_))
#%%
res_imb=np.array(list(grid_result.best_params_.values()))[0]
modelXGB.scale_pos_weight=res_imb
cvs=cross_val_score(modelXGB, X, y, scoring='roc_auc')
baseline = cvs.mean()
print(f'Baseline (raw) ROC_AUC =  {baseline:.5f}')

`

`


问:
Shadows wont work properly for this THREE.js project
can anyone tell me if i messed up the model or the code in THREE:

the shadows are supposed to show up inside that cube but they're not working as intended


问:
I created new angular project and install boots trap and follow error is comming SassError: Can't find stylesheet to import
I am newto the angular and I recently facing this problem my packege.json is followed,as I am using boootstrap 14.0.0. and Angular CLI: 15.0.4 I have attached picture that I am facing

```<code>{
  "name": "ecommerce",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "watch": "ng build --watch --configuration development",
    "test": "ng test"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^15.0.0",
    "@angular/common": "^15.0.0",
    "@angular/compiler": "^15.0.0",
    "@angular/core": "^15.0.0",
    "@angular/forms": "^15.0.0",
    "@angular/platform-browser": "^15.0.0",
    "@angular/platform-browser-dynamic": "^15.0.0",
    "@angular/router": "^15.0.0",
    "@ng-bootstrap/ng-bootstrap": "^14.0.0",
    "@popperjs/core": "^2.11.6",
    "bootstrap": "^5.2.3",
    "rxjs": "~7.5.0",
    "tslib": "^2.3.0",
    "zone.js": "~0.12.0"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^15.0.4",
    "@angular/cli": "~15.0.4",
    "@angular/compiler-cli": "^15.0.0",
    "@angular/localize": "^15.0.0",
    "@types/jasmine": "~4.3.0",
    "jasmine-core": "~4.5.0",
    "karma": "~6.4.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage": "~2.2.0",
    "karma-jasmine": "~5.1.0",
    "karma-jasmine-html-reporter": "~2.0.0",
    "typescript": "~4.8.2"
  }
}
</code>```

enter code here

Body:
I am newto the angular and I recently facing this problem my packege.json is followed,as I am using boootstrap 14.0.0. and Angular CLI: 15.0.4 I have attached picture that I am facing

{
  "name": "ecommerce",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "watch": "ng build --watch --configuration development",
    "test": "ng test"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^15.0.0",
    "@angular/common": "^15.0.0",
    "@angular/compiler": "^15.0.0",
    "@angular/core": "^15.0.0",
    "@angular/forms": "^15.0.0",
    "@angular/platform-browser": "^15.0.0",
    "@angular/platform-browser-dynamic": "^15.0.0",
    "@angular/router": "^15.0.0",
    "@ng-bootstrap/ng-bootstrap": "^14.0.0",
    "@popperjs/core": "^2.11.6",
    "bootstrap": "^5.2.3",
    "rxjs": "~7.5.0",
    "tslib": "^2.3.0",
    "zone.js": "~0.12.0"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^15.0.4",
    "@angular/cli": "~15.0.4",
    "@angular/compiler-cli": "^15.0.0",
    "@angular/localize": "^15.0.0",
    "@types/jasmine": "~4.3.0",
    "jasmine-core": "~4.5.0",
    "karma": "~6.4.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage": "~2.2.0",
    "karma-jasmine": "~5.1.0",
    "karma-jasmine-html-reporter": "~2.0.0",
    "typescript": "~4.8.2"
  }
}

enter code here


问:
Instagram Private API Login for Android (Paid Service)
I'm looking for someone who could help me to integrate the Login Part (with Encryption) with the last Instagram API version for Useragent.

Actually I have an Android app which runs with the old version of Instagram API (8.2.0) which runs with just Username and Password but I have to update it and it seems I have to encrypt the password...

The github I'm looking is in JAVA (https://github.com/instagram4j/instagram4j), and
I think the missing thing is the ecryption ( public static String encryptPassword(String password, String enc_id, String enc_pub_key) ), but I was not able to integrate it to my project...

Did someone manage to do the login with recent Instagram API version with Android?

Please send me a pm with the budget to Telegram: @autostagram

```<code> @SneakyThrows
public static String encryptPassword(String password, String enc_id, String enc_pub_key) {
    byte[] rand_key = new byte[32], iv = new byte[12];
    SecureRandom sran = new SecureRandom();
    sran.nextBytes(rand_key);
    sran.nextBytes(iv);
    String time = String.valueOf(System.currentTimeMillis() / 1000);

    // Encrypt random key
    String decoded_pub_key =
            new String(Base64.getDecoder().decode(enc_pub_key), StandardCharsets.UTF_8)
                    .replaceAll("-(.*)-|\n", "");
    Cipher rsa_cipher = Cipher.getInstance("RSA/ECB/PKCS1PADDING");
    rsa_cipher.init(Cipher.ENCRYPT_MODE, KeyFactory.getInstance("RSA")
            .generatePublic(
                    new X509EncodedKeySpec(Base64.getDecoder().decode(decoded_pub_key))));
    byte[] rand_key_encrypted = rsa_cipher.doFinal(rand_key);

    // Encrypt password
    Cipher aes_gcm_cipher = Cipher.getInstance("AES/GCM/NoPadding");
    aes_gcm_cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(rand_key, "AES"),
            new GCMParameterSpec(128, iv));
    aes_gcm_cipher.updateAAD(time.getBytes());
    byte[] password_encrypted = aes_gcm_cipher.doFinal(password.getBytes());

    // Write to final byte array
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    out.write(Integer.valueOf(1).byteValue());
    out.write(Integer.valueOf(enc_id).byteValue());
    out.write(iv);
    out.write(ByteBuffer.allocate(2).order(ByteOrder.LITTLE_ENDIAN)
            .putChar((char) rand_key_encrypted.length).array());
    out.write(rand_key_encrypted);
    out.write(Arrays.copyOfRange(password_encrypted, password_encrypted.length - 16,
            password_encrypted.length));
    out.write(Arrays.copyOfRange(password_encrypted, 0, password_encrypted.length - 16));

    return String.format("#PWD_INSTAGRAM:%s:%s:%s", "4", time,
            Base64.getEncoder().encodeToString(out.toByteArray()));
}
</code>```

Body:
I'm looking for someone who could help me to integrate the Login Part (with Encryption) with the last Instagram API version for Useragent.

Actually I have an Android app which runs with the old version of Instagram API (8.2.0) which runs with just Username and Password but I have to update it and it seems I have to encrypt the password...

The github I'm looking is in JAVA (https://github.com/instagram4j/instagram4j), and
I think the missing thing is the ecryption ( public static String encryptPassword(String password, String enc_id, String enc_pub_key) ), but I was not able to integrate it to my project...

Did someone manage to do the login with recent Instagram API version with Android?

Please send me a pm with the budget to Telegram: @autostagram

 @SneakyThrows
public static String encryptPassword(String password, String enc_id, String enc_pub_key) {
    byte[] rand_key = new byte[32], iv = new byte[12];
    SecureRandom sran = new SecureRandom();
    sran.nextBytes(rand_key);
    sran.nextBytes(iv);
    String time = String.valueOf(System.currentTimeMillis() / 1000);

    // Encrypt random key
    String decoded_pub_key =
            new String(Base64.getDecoder().decode(enc_pub_key), StandardCharsets.UTF_8)
                    .replaceAll("-(.*)-|\n", "");
    Cipher rsa_cipher = Cipher.getInstance("RSA/ECB/PKCS1PADDING");
    rsa_cipher.init(Cipher.ENCRYPT_MODE, KeyFactory.getInstance("RSA")
            .generatePublic(
                    new X509EncodedKeySpec(Base64.getDecoder().decode(decoded_pub_key))));
    byte[] rand_key_encrypted = rsa_cipher.doFinal(rand_key);

    // Encrypt password
    Cipher aes_gcm_cipher = Cipher.getInstance("AES/GCM/NoPadding");
    aes_gcm_cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(rand_key, "AES"),
            new GCMParameterSpec(128, iv));
    aes_gcm_cipher.updateAAD(time.getBytes());
    byte[] password_encrypted = aes_gcm_cipher.doFinal(password.getBytes());

    // Write to final byte array
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    out.write(Integer.valueOf(1).byteValue());
    out.write(Integer.valueOf(enc_id).byteValue());
    out.write(iv);
    out.write(ByteBuffer.allocate(2).order(ByteOrder.LITTLE_ENDIAN)
            .putChar((char) rand_key_encrypted.length).array());
    out.write(rand_key_encrypted);
    out.write(Arrays.copyOfRange(password_encrypted, password_encrypted.length - 16,
            password_encrypted.length));
    out.write(Arrays.copyOfRange(password_encrypted, 0, password_encrypted.length - 16));

    return String.format("#PWD_INSTAGRAM:%s:%s:%s", "4", time,
            Base64.getEncoder().encodeToString(out.toByteArray()));
}


问:
JS Fs.readfile works after the bottom code executed
I'm newbie at JS, and I didn't understand a thing.
The problem is, I have a fs.readfile function, and there is while(1){//code} code execution bottom of it.

The example:

```<code>const prompt = require('prompt-sync')();
let fs = require('fs');

function aFuncName() {
  let nms;
  fs.readFileSync('filename.txt', (error, data) => {
    console.log('readfile began!')
    if (error)
      console.log(error);

    try {
      nms = data.toString().match(/\n/).length
        console.log('ind:' + String(ind))
    } catch (TypeError) {
      nms = 0;
    }
    console.log("readfile over!");
  });

  let userarry = [nms]
  while (1) {
    let vars = prompt('varsm):')
  }
}
</code>```

the problem is, the function passes the fs.readfilesync part and begins from let userarry.
I also tried fs.readFile

Body:
I'm newbie at JS, and I didn't understand a thing.
The problem is, I have a fs.readfile function, and there is while(1){//code} code execution bottom of it.

The example:

const prompt = require('prompt-sync')();
let fs = require('fs');

function aFuncName() {
  let nms;
  fs.readFileSync('filename.txt', (error, data) => {
    console.log('readfile began!')
    if (error)
      console.log(error);

    try {
      nms = data.toString().match(/\n/).length
        console.log('ind:' + String(ind))
    } catch (TypeError) {
      nms = 0;
    }
    console.log("readfile over!");
  });

  let userarry = [nms]
  while (1) {
    let vars = prompt('varsm):')
  }
}

the problem is, the function passes the fs.readfilesync part and begins from let userarry.
I also tried fs.readFile


问:
How do I make an exact recreation of a web element's appearance?
I want to create an html and css file that shows an exact recreation of a Reddit comment. Is there an alternative to painstakingly recreating an element manually?

My final goal is to locally generate screenshots of Reddit comments with my own values for the username, number of upvotes, comment text, etc.

As far as I can tell, this problem boils down two tasks.

Task 1 - Aquire the HTML code
This is easily achieved by right clicking an element, selecting 'inspect', copying the html and we're done.

Task 2 - Aquire the CSS code
This is the part that caused problems. Whatever I tried it never resambled style of an actual Reddit comment.

CSS Approch 1 - Copy CSS file(s)
I followed a tutorial on Youtube called How to clone a website where they simply copied the css file. There is about a dozen css files in my case which I could copy, but it would probably still not work when any of the styles are inherited from an ancestor of the comment element.

CSS Approach 2 - Copy Inspected Element Styles
Copy and clean the CSS code that appears in the "Styles" tab when inspecting the Comment element. This didn't work at all and had hardly any effect on the appearance of the html file. Probably because a lot of the styling is inherited from an ancestor element.

CSS Approach 3 - Copy Computed Styles
Did not solve the issue 'cause the computed styles in the Chrome Dev Tools don't seem to include the styling of the descendant elements.

CSS Approach 4 - Using JavaScript and Jquery
Found some Stackoverflow posts (post 1, post 2) that involved the JavaScript function window.getComputedStyle, but I couldn't find a way to use this to extract all the styles for the comment element and all its descendents.

Can someone tell me how I recreate a web element locally?

(Also sorry for the poor formatting. I rarely post.)


问:
How to get the words in a line of a file after a matching word
I'm quite a beginner. I have a file "database.txt" which looks like this

```<code>[1] Death by chocolate muffins
</code>```

The user inserts a number to search for. I have built the key for searching with the user input and strcat and the matching is working but now I want to store the text after the key e.g. Death by chocolate muffins.

```<code>    char *p = NULL;
    int i = 0;
    while(fgets(line, MAX_LINE_LENGTH, fp_database) != NULL) {
        p = strtok(line," ");
        while(p != NULL) {
            words[i] = p;
            if(strcmp(words[i], key_search) == 0) {
                printf("Match found!");
                //print text after key
            }
            p = strtok(NULL," ");
            i++;
        }
    }
</code>```

I found this answer C - How to get a word in a string after a particular word?, but it is only for printing the next word.

Body:
I'm quite a beginner. I have a file "database.txt" which looks like this

[1] Death by chocolate muffins

The user inserts a number to search for. I have built the key for searching with the user input and strcat and the matching is working but now I want to store the text after the key e.g. Death by chocolate muffins.

    char *p = NULL;
    int i = 0;
    while(fgets(line, MAX_LINE_LENGTH, fp_database) != NULL) {
        p = strtok(line," ");
        while(p != NULL) {
            words[i] = p;
            if(strcmp(words[i], key_search) == 0) {
                printf("Match found!");
                //print text after key
            }
            p = strtok(NULL," ");
            i++;
        }
    }

I found this answer C - How to get a word in a string after a particular word?, but it is only for printing the next word.


问:
ValueError: Expected 2D array, got 1D array instead
I'm trying to perform a Supporting Vector Regression. I inputted the data and performed the feature scaling of my dataset, However when I tried to run it, it gives me the error "Expected 2D array, got 1D array instead" for my independent variable.

I've already tried reshaping the x with both (1,-1) and (-1,1), as well as trying

```<code>st_x.fit_transform(y.reshape(-1,1)) and x=np.reshape(y,(10,1))
</code>```

I'll appreciate any help.

Here's what I have done so far:

```<code>import pandas as pdimport numpy as npimport matplotlib.pyplot as plt
</code>```
```<code>dataset=pd.read_excel(r'C:\Users\Sammy\OneDrive - International Campus, Zhejiang University\Desktop\Data\BAYC Data.xlsx')print(dataset)
</code>```
```<code>x=dataset.iloc[:,1].valuesy=dataset.iloc[:,2].values
</code>```
```<code>from sklearn.preprocessing import StandardScaler
</code>```
```<code>st_x=StandardScaler()st_y=StandardScaler()X=st_x.fit_transform(x)Y=st_y.fit_transform(y)fig=plt.figure()ax=fig.add_axes([0,0,1,1])ax.scatter(X,Y,color='r')
</code>```

The error I'm getting is following:

```<code>ValueError                                Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_14872\1100881085.py in <module>
      1 X=st_x.fit_transform(x.reshape(-1,1))
----> 2 Y=st_y.fit_transform(y)

~\anaconda3\lib\site-packages\sklearn\base.py in fit_transform(self, X, y, **fit_params)
    850         if y is None:
    851             # fit method of arity 1 (unsupervised transformation)
--> 852             return self.fit(X, **fit_params).transform(X)
    853         else:
    854             # fit method of arity 2 (supervised transformation)

~\anaconda3\lib\site-packages\sklearn\preprocessing\_data.py in fit(self, X, y, sample_weight)
    804         # Reset internal state before fitting
    805         self._reset()
--> 806         return self.partial_fit(X, y, sample_weight)
    807
    808     def partial_fit(self, X, y=None, sample_weight=None):

~\anaconda3\lib\site-packages\sklearn\preprocessing\_data.py in partial_fit(self, X, y, sample_weight)
    839         """
    840         first_call = not hasattr(self, "n_samples_seen_")
--> 841         X = self._validate_data(
    842             X,
    843             accept_sparse=("csr", "csc"),

~\anaconda3\lib\site-packages\sklearn\base.py in _validate_data(self, X, y, reset, validate_separately, **check_params)
    564             raise ValueError("Validation should be done on X, y or both.")
    565         elif not no_val_X and no_val_y:
--> 566             X = check_array(X, **check_params)
    567             out = X
    568         elif no_val_X and not no_val_y:

~\anaconda3\lib\site-packages\sklearn\utils\validation.py in check_array(array, accept_sparse, accept_large_sparse, dtype, order, copy, force_all_finite, ensure_2d, allow_nd, ensure_min_samples, ensure_min_features, estimator)
    767             # If input is 1D raise error
    768             if array.ndim == 1:
--> 769                 raise ValueError(
    770                     "Expected 2D array, got 1D array instead:\narray={}.\n"
    771                     "Reshape your data either using array.reshape(-1, 1) if "

ValueError: Expected 2D array, got 1D array instead:
array=[622. 931. 639. 263. 249. 210. 167. 156. 236. 217. 150. 130. 114. 126.
 191. 132. 167. 117. 126. 132. 157. 135. 154. 139. 330. 337. 186. 223.
 320. 495. 408. 190. 172. 165. 111.  90.  93. 123. 114.  97.  95.  77.
  97. 126.  81. 111. 105.  84.  74.  73.  74.  74.  87.  95. 198. 130.
  81.  61.  52.  59.  71.  61.  85.  82.  61. 124. 100.  62. 118.  96.
 146. 191.  90. 144. 481. 984. 530. 368. 201. 147. 139. 197. 238. 138.
 120. 135. 118. 123. 107. 117. 113. 108.  78. 103. 164. 109.  81.  92.
  45.  58.  96.  82. 116.  97.  75.  79.  87. 224. 315. 269. 191. 382.
 274. 381. 423. 294. 203. 204. 315. 367. 755. 422. 291. 434. 160. 173.
 157. 121. 276. 345. 186. 226. 237. 106.  69.  99.  93.  95. 102.  73.
  80.  83.  99.  67.  79. 101. 120.  58.  89.  84. 121. 152.  74.  73.
  60.  53.  71.  85.  93.  82.  55.  79.  95. 360. 245. 167. 115. 103.
 119. 109. 108.  95.  68.  60.  93.  60.  86.  93. 106.  84.  93. 100.
  64.  66.  54.  74.  93. 137. 126. 217. 127.  87. 119. 117.  81.  53.
  72.  63.  71.  79.  56.  94.  63.  51.  55.  62.  79.  89.  89.  96.
  54.  51.  55.  56.  63.  95.  84.  61. 114.  68.  72. 103.  72.  79.
  72.  68.  80.  99.  97.  64. 111. 127. 189. 107.  80. 153. 154. 134.
  86.  67.  61.  74.  60.  43.  60.  39.  21.  60.  76.  86.  70.  61.
  89.  90.  70.  82.  45.  86.  53.  77.  78.  79. 125.  84.  75.  72.
  87.  97.  79.  52. 107.  74.  69.  68.  69.  48.  56.  55.  69.  51.
  51.  60.  54.  94. 101. 106.  65.  56.  64.  49.  59.  65.  65.  64.
  65.  55.  40.  83. 103.  62.  62.  59.  76. 125.].
Reshape your data either using array.reshape(-1, 1) if your data has a single feature or array.reshape(1, -1) if it contains a single sample.
</code>```
```<code></code>```

Body:
I'm trying to perform a Supporting Vector Regression. I inputted the data and performed the feature scaling of my dataset, However when I tried to run it, it gives me the error "Expected 2D array, got 1D array instead" for my independent variable.

I've already tried reshaping the x with both (1,-1) and (-1,1), as well as trying

st_x.fit_transform(y.reshape(-1,1)) and x=np.reshape(y,(10,1))

I'll appreciate any help.

Here's what I have done so far:

import pandas as pdimport numpy as npimport matplotlib.pyplot as plt

dataset=pd.read_excel(r'C:\Users\Sammy\OneDrive - International Campus, Zhejiang University\Desktop\Data\BAYC Data.xlsx')print(dataset)

x=dataset.iloc[:,1].valuesy=dataset.iloc[:,2].values

from sklearn.preprocessing import StandardScaler

st_x=StandardScaler()st_y=StandardScaler()X=st_x.fit_transform(x)Y=st_y.fit_transform(y)fig=plt.figure()ax=fig.add_axes([0,0,1,1])ax.scatter(X,Y,color='r')

The error I'm getting is following:

ValueError                                Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_14872\1100881085.py in <module>
      1 X=st_x.fit_transform(x.reshape(-1,1))
----> 2 Y=st_y.fit_transform(y)

~\anaconda3\lib\site-packages\sklearn\base.py in fit_transform(self, X, y, **fit_params)
    850         if y is None:
    851             # fit method of arity 1 (unsupervised transformation)
--> 852             return self.fit(X, **fit_params).transform(X)
    853         else:
    854             # fit method of arity 2 (supervised transformation)

~\anaconda3\lib\site-packages\sklearn\preprocessing\_data.py in fit(self, X, y, sample_weight)
    804         # Reset internal state before fitting
    805         self._reset()
--> 806         return self.partial_fit(X, y, sample_weight)
    807
    808     def partial_fit(self, X, y=None, sample_weight=None):

~\anaconda3\lib\site-packages\sklearn\preprocessing\_data.py in partial_fit(self, X, y, sample_weight)
    839         """
    840         first_call = not hasattr(self, "n_samples_seen_")
--> 841         X = self._validate_data(
    842             X,
    843             accept_sparse=("csr", "csc"),

~\anaconda3\lib\site-packages\sklearn\base.py in _validate_data(self, X, y, reset, validate_separately, **check_params)
    564             raise ValueError("Validation should be done on X, y or both.")
    565         elif not no_val_X and no_val_y:
--> 566             X = check_array(X, **check_params)
    567             out = X
    568         elif no_val_X and not no_val_y:

~\anaconda3\lib\site-packages\sklearn\utils\validation.py in check_array(array, accept_sparse, accept_large_sparse, dtype, order, copy, force_all_finite, ensure_2d, allow_nd, ensure_min_samples, ensure_min_features, estimator)
    767             # If input is 1D raise error
    768             if array.ndim == 1:
--> 769                 raise ValueError(
    770                     "Expected 2D array, got 1D array instead:\narray={}.\n"
    771                     "Reshape your data either using array.reshape(-1, 1) if "

ValueError: Expected 2D array, got 1D array instead:
array=[622. 931. 639. 263. 249. 210. 167. 156. 236. 217. 150. 130. 114. 126.
 191. 132. 167. 117. 126. 132. 157. 135. 154. 139. 330. 337. 186. 223.
 320. 495. 408. 190. 172. 165. 111.  90.  93. 123. 114.  97.  95.  77.
  97. 126.  81. 111. 105.  84.  74.  73.  74.  74.  87.  95. 198. 130.
  81.  61.  52.  59.  71.  61.  85.  82.  61. 124. 100.  62. 118.  96.
 146. 191.  90. 144. 481. 984. 530. 368. 201. 147. 139. 197. 238. 138.
 120. 135. 118. 123. 107. 117. 113. 108.  78. 103. 164. 109.  81.  92.
  45.  58.  96.  82. 116.  97.  75.  79.  87. 224. 315. 269. 191. 382.
 274. 381. 423. 294. 203. 204. 315. 367. 755. 422. 291. 434. 160. 173.
 157. 121. 276. 345. 186. 226. 237. 106.  69.  99.  93.  95. 102.  73.
  80.  83.  99.  67.  79. 101. 120.  58.  89.  84. 121. 152.  74.  73.
  60.  53.  71.  85.  93.  82.  55.  79.  95. 360. 245. 167. 115. 103.
 119. 109. 108.  95.  68.  60.  93.  60.  86.  93. 106.  84.  93. 100.
  64.  66.  54.  74.  93. 137. 126. 217. 127.  87. 119. 117.  81.  53.
  72.  63.  71.  79.  56.  94.  63.  51.  55.  62.  79.  89.  89.  96.
  54.  51.  55.  56.  63.  95.  84.  61. 114.  68.  72. 103.  72.  79.
  72.  68.  80.  99.  97.  64. 111. 127. 189. 107.  80. 153. 154. 134.
  86.  67.  61.  74.  60.  43.  60.  39.  21.  60.  76.  86.  70.  61.
  89.  90.  70.  82.  45.  86.  53.  77.  78.  79. 125.  84.  75.  72.
  87.  97.  79.  52. 107.  74.  69.  68.  69.  48.  56.  55.  69.  51.
  51.  60.  54.  94. 101. 106.  65.  56.  64.  49.  59.  65.  65.  64.
  65.  55.  40.  83. 103.  62.  62.  59.  76. 125.].
Reshape your data either using array.reshape(-1, 1) if your data has a single feature or array.reshape(1, -1) if it contains a single sample.


问:
What is the best way to describe the square brackets that surround an alias in Azure Synapse or the double quote characters in other databases?
I am writing up some documentation and was curious if the special character used to explicitly force column names without causing a keyword clash, is referred to by anything else other than SQUARE BRACKETS (Azure Synapse) or DOUBLE QUOTES (PostgreSQL).

I was thinking something like ALIAS QUALIFIERS but unsure if there's anything else more descriptive.


问:
CocoaMQTT Warning: Enable Backgrounding
I am setting up an app in SwiftUI using CocoaMQTT. I set up a class MQTTManger with the following included in the initializer:

```<code>mqttClient = CocoaMQTT(clientID: "myClientID", host: "192.xxx.yy.zzz, port: 1883)
mqttClient.delegate = self
</code>```

and then connect with

```<code> func connect() {
        if let success = mqttClient?.connect(), success {
            print("Connected")
        } else {
            print("Connection failed")
        }
 }
</code>```

which returns "Connected".

For some reason though, the CocoaMQTTDelegate is not called.

I receive the error message

CocoaMQTT(warning): Enable backgrounding socket failed, please check related permissions

It seems like I need to give the app some kind of permission?

Thanks for pointing me in the right direction.

Title: CocoaMQTT Warning: Enable Backgrounding

Body:
I am setting up an app in SwiftUI using CocoaMQTT. I set up a class MQTTManger with the following included in the initializer:

mqttClient = CocoaMQTT(clientID: "myClientID", host: "192.xxx.yy.zzz, port: 1883)
mqttClient.delegate = self

and then connect with

 func connect() {
        if let success = mqttClient?.connect(), success {
            print("Connected")
        } else {
            print("Connection failed")
        }
 }

which returns "Connected".

For some reason though, the CocoaMQTTDelegate is not called.

I receive the error message

CocoaMQTT(warning): Enable backgrounding socket failed, please check related permissions

It seems like I need to give the app some kind of permission?

Thanks for pointing me in the right direction.


问:
while using this command to install material Ui , I am facing this error
```<code>C:\Users\aniket.srivastava\Desktop\react\website\basicwebsite> npm install @mui/icons-material
npm ERR! Cannot read properties of null (reading 'pickAlgorithm')

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\aniket.srivastava\AppData\Local\npm-cache\_logs\2022-12-23T16_10_26_747Z-debug-0.log
PS C:\Users\aniket.srivastava\Desktop\react\website\basicwebsite>
</code>```

I used this command

```<code>npm install @mui/icons-material
</code>```

Body:
C:\Users\aniket.srivastava\Desktop\react\website\basicwebsite> npm install @mui/icons-material
npm ERR! Cannot read properties of null (reading 'pickAlgorithm')

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\aniket.srivastava\AppData\Local\npm-cache\_logs\2022-12-23T16_10_26_747Z-debug-0.log
PS C:\Users\aniket.srivastava\Desktop\react\website\basicwebsite>

I used this command

npm install @mui/icons-material


问:
How do I write a bare-metal RISC-V program to go from boot to writing to the UART0 on QEMU's `sifive_e` machine?

Background

I'm trying to understand the boot process for a simple RISC-V computer in detail.
I'm not interested in getting all the way to an operating system: I just want to know what happens between poweron and running a bare-metal program to write some data to the UART device.

Since booting is hardware-specific, I picked the SiFive HiFive1 RevB because:

It's relatively cheap

It has both real hardware and can be emulated via QEMU's sifive_e machine

(However, if there is a more appropriate board, I would also like to know)

My goal is to understand all of the code involved in the boot process. I am particularly confused about the role of the following:

Firmware

The bootloader

QEMU's -bios flag

QEMU's -kernel flag

Desired outcome

As proof that I understand all the pieces going into the boot process, I would like to write a program which writes "Hello World" to the UART0 device, and then halts (either with a busy loop, or somehow by powering off the board).

Ideally, I would write all the pieces needed to make this happen in RISC-V assembly. I would also like to avoid using any high level languages, toolchains, and linkers.

A working version for the QEMU virt machine

I have a simple program which works as expected on QEMU's virt machine.
It's a binary file test.bin of RISC-V instructions produced by a python script--it is not produced by gcc or another compiler.

Here is the contents of the file according to objdump:

```<code>> objdump -b binary --architecture=riscv -D test.bin

test.bin:     file format binary

Disassembly of section .data:

0000000000000000 <.data>:
   0:   00100093                li      ra,1
   4:   01c09093                slli    ra,ra,0x1c
   8:   01300113                li      sp,19
   c:   00c11113                slli    sp,sp,0xc
  10:   04800113                li      sp,72
  14:   00208023                sb      sp,0(ra)
  18:   06500113                li      sp,101
  1c:   00208023                sb      sp,0(ra)
  20:   06c00113                li      sp,108
  24:   00208023                sb      sp,0(ra)
  28:   06c00113                li      sp,108
  2c:   00208023                sb      sp,0(ra)
  30:   06f00113                li      sp,111
  34:   00208023                sb      sp,0(ra)
...snip
</code>```

This generates the UART0 address (0x10000000) of the virt machine and places it in register R1.
It then simply writes each byte of "Hello, World" to that address.

I run this file as follows:

```<code>> qemu-system-riscv32 -nographic -machine virt -bios test.bin
Hello, World!
QEMU 7.1.0 monitor - type 'help' for more information
(qemu) quit
</code>```

The final two lines of output here are because QEMU appears to hang, and I use C-a c; quit to exit.

I can also run the image using the -kernel flag:

```<code>> qemu-system-riscv32 -nographic -machine virt -kernel test.bin
Hello, World!
Hello, World!
Hello, World!
...
</code>```

In this case, it loops printing "Hello World" until I quit.
I assume this is because the virt machine has a default bios which sets up handlers for illegal instructions and restarts my program: since test.bin does not busy loop at the end, this triggers the handler and restarts.

Question 1

If I use -bios test.bin, is my code the first code running when the CPU boots, or does some other code run first? (For example "firmware")

Is there a "firmware stage" that happens before the BIOS?

What does the default -bios for QEMU's virt machine do?

Porting to the sifive_e machine

I expected that I could just port this code to the sifive_e machine by changing the UART0 address to 0x10013000

Here is the objdump for the modified code sifive_e.bin, which computes the UART address by adding together R1 and R2:

```<code>   0:   00100093                li      ra,1
   4:   01c09093                slli    ra,ra,0x1c
   8:   01300113                li      sp,19
   c:   00c11113                slli    sp,sp,0xc
  10:   002080b3                add     ra,ra,sp
  14:   04800113                li      sp,72
  18:   00208023                sb      sp,0(ra)
  1c:   06500113                li      sp,101
  20:   00208023                sb      sp,0(ra)
</code>```

However, when I run this as follows:

```<code>qemu-system-riscv32 -nographic -machine sifive_e -bios sifive_e.bin
</code>```

QEMU produces no output and appears to hang. This is also the case if I run it like this:

```<code>qemu-system-riscv32 -nographic -machine sifive_e -kernel sifive_e.bin
</code>```

Question 2

What is missing to make this example work on the sifive_e machine?

Where can I find documentation on the boot process for sifive_e?

Does the boot process of the QEMU sifive_e machine really correspond to that of the HiFive1 RevB board?

Body:
Background

I'm trying to understand the boot process for a simple RISC-V computer in detail.
I'm not interested in getting all the way to an operating system: I just want to know what happens between poweron and running a bare-metal program to write some data to the UART device.

Since booting is hardware-specific, I picked the SiFive HiFive1 RevB because:

It's relatively cheap

It has both real hardware and can be emulated via QEMU's sifive_e machine

(However, if there is a more appropriate board, I would also like to know)

My goal is to understand all of the code involved in the boot process. I am particularly confused about the role of the following:

Firmware

The bootloader

QEMU's -bios flag

QEMU's -kernel flag

Desired outcome

As proof that I understand all the pieces going into the boot process, I would like to write a program which writes "Hello World" to the UART0 device, and then halts (either with a busy loop, or somehow by powering off the board).

Ideally, I would write all the pieces needed to make this happen in RISC-V assembly. I would also like to avoid using any high level languages, toolchains, and linkers.

A working version for the QEMU virt machine

I have a simple program which works as expected on QEMU's virt machine.
It's a binary file test.bin of RISC-V instructions produced by a python script--it is not produced by gcc or another compiler.

Here is the contents of the file according to objdump:

> objdump -b binary --architecture=riscv -D test.bin

test.bin:     file format binary

Disassembly of section .data:

0000000000000000 <.data>:
   0:   00100093                li      ra,1
   4:   01c09093                slli    ra,ra,0x1c
   8:   01300113                li      sp,19
   c:   00c11113                slli    sp,sp,0xc
  10:   04800113                li      sp,72
  14:   00208023                sb      sp,0(ra)
  18:   06500113                li      sp,101
  1c:   00208023                sb      sp,0(ra)
  20:   06c00113                li      sp,108
  24:   00208023                sb      sp,0(ra)
  28:   06c00113                li      sp,108
  2c:   00208023                sb      sp,0(ra)
  30:   06f00113                li      sp,111
  34:   00208023                sb      sp,0(ra)
...snip

This generates the UART0 address (0x10000000) of the virt machine and places it in register R1.
It then simply writes each byte of "Hello, World" to that address.

I run this file as follows:

> qemu-system-riscv32 -nographic -machine virt -bios test.bin
Hello, World!
QEMU 7.1.0 monitor - type 'help' for more information
(qemu) quit

The final two lines of output here are because QEMU appears to hang, and I use C-a c; quit to exit.

I can also run the image using the -kernel flag:

> qemu-system-riscv32 -nographic -machine virt -kernel test.bin
Hello, World!
Hello, World!
Hello, World!
...

In this case, it loops printing "Hello World" until I quit.
I assume this is because the virt machine has a default bios which sets up handlers for illegal instructions and restarts my program: since test.bin does not busy loop at the end, this triggers the handler and restarts.

Question 1

If I use -bios test.bin, is my code the first code running when the CPU boots, or does some other code run first? (For example "firmware")

Is there a "firmware stage" that happens before the BIOS?

What does the default -bios for QEMU's virt machine do?

Porting to the sifive_e machine

I expected that I could just port this code to the sifive_e machine by changing the UART0 address to 0x10013000

Here is the objdump for the modified code sifive_e.bin, which computes the UART address by adding together R1 and R2:

   0:   00100093                li      ra,1
   4:   01c09093                slli    ra,ra,0x1c
   8:   01300113                li      sp,19
   c:   00c11113                slli    sp,sp,0xc
  10:   002080b3                add     ra,ra,sp
  14:   04800113                li      sp,72
  18:   00208023                sb      sp,0(ra)
  1c:   06500113                li      sp,101
  20:   00208023                sb      sp,0(ra)

However, when I run this as follows:

qemu-system-riscv32 -nographic -machine sifive_e -bios sifive_e.bin

QEMU produces no output and appears to hang. This is also the case if I run it like this:

qemu-system-riscv32 -nographic -machine sifive_e -kernel sifive_e.bin

Question 2

What is missing to make this example work on the sifive_e machine?

Where can I find documentation on the boot process for sifive_e?

Does the boot process of the QEMU sifive_e machine really correspond to that of the HiFive1 RevB board?


问:
Typescript highlighting but not showing errors
what could be the reason for not seeing Typescript errors? It shows the underline but not the message with TS hints
.tsx file

Thank you

reinstalled VS code
installed JavaScript and TypeScript Nightly extension


问:
How to get rid of the h1 element that that summernote wraps it's content with
I'm using summernote to create a post in a Laravel project and everything works fine. However, when I display the content {!! post->content !!} the content displays as expected but it's wrapped in an
...
 .

I already have an h1 tag so this causes me to have two h1 tags.

Is there a way to ensure the content is not wrapped in an h1?

An example of an output after checking out the page source

```<code><h1 dir="ltr" style="line-height: 1.38; margin-top: 20pt; margin-bottom: 6pt">
  <br />
  <p dir="ltr" style="line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt">
    <span
      style="
        font-size: 11pt;
        font-family: Arial;
        color: #000000;
        background-color: transparent;
        font-weight: 400;
        font-style: normal;
        font-variant: normal;
        text-decoration: none;
        vertical-align: baseline;
        white-space: pre;
        white-space: pre-wrap;
      "
      >Lorem ipsum dolor sit amet consectetur adipisicing elit. Modi consequatur
      facilis ipsa placeat veniam itaque!</span
    >
  </p>
  <p>
    <b
      style="font-weight: normal"
      id="docs-internal-guid-47f21b1f-7fff-8d45-a008-bd6623b10047"
      ><br
    /></b>
  </p>
  <p dir="ltr" style="line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt">
    <span
      style="
        font-size: 11pt;
        font-family: Arial;
        color: #000000;
        background-color: transparent;
        font-weight: 400;
        font-style: normal;
        font-variant: normal;
        text-decoration: none;
        vertical-align: baseline;
        white-space: pre;
        white-space: pre-wrap;
      "
      >Lorem ipsum dolor sit amet consectetur adipisicing elit. Modi consequatur
      facilis ipsa placeat veniam itaque!
    </span>
  </p>
  <p><br /></p>
</h1>
</code>```

Body:
I'm using summernote to create a post in a Laravel project and everything works fine. However, when I display the content {!! post->content !!} the content displays as expected but it's wrapped in an
...
 .

I already have an h1 tag so this causes me to have two h1 tags.

Is there a way to ensure the content is not wrapped in an h1?

An example of an output after checking out the page source

    Lorem ipsum dolor sit amet consectetur adipisicing elit. Modi consequatur
      facilis ipsa placeat veniam itaque!

    Lorem ipsum dolor sit amet consectetur adipisicing elit. Modi consequatur
      facilis ipsa placeat veniam itaque!


问:
Riverpod Flutter StateError (Bad state: called ProviderSubscription.read on a subscription that was closed)
I'm trying to update my state management solution to Riverpod and I'm all over the place. I get this error when I try to pop a page from my nav stack. I have a provider to save a DocumentSnapshot from firestore so I can call certain fields from it. This is probably where the problem is coming from:

```<code>final docIdProvider = StateProvider<DocumentSnapshot?>((ref) => null);

final docProvider = Provider((ref) {
  final docId = ref.watch(docIdProvider);
  return docId;
});

</code>```

My home page I have a list of trips, the flow goes like this. The issue is when I try to pop from details to home page, or from join to details.

When a user clicks on a trip from the homepage, I update the provider:

```<code>return ListView(
          children: snapshot.data!.docs.map((DocumentSnapshot document) {
            Map<String, dynamic> data =
                document.data()! as Map<String, dynamic>;
            return Card(
              child: ListTile(
                title: Text('From ${data['departure']}'),
                ),
                onTap: () {
                  ref.read(docIdProvider.notifier).state = document;
</code>```

I have a google maps page and other UI where I use the provider to call the fields of the document like so:

```<code>if ((ref.watch(docProvider)!['departure_lat']) >
                ref.watch(docProvider)!['arrival_lat']
</code>```

This is where it goes wrong when I try to pop the stack. the
if ((ref.watch(docProvider)!['departure_lat']) >

Gets highlights and displays the

StateError (Bad state: called ProviderSubscription.read on a subscription that was closed)

code.

I tried creating another riverpod provider as such:

```<code>class DocumentSnapshotNotifier extends StateNotifier<DocumentSnapshot?> {
  DocumentSnapshotNotifier() : super(null);

  DocumentSnapshot? get documentSnapshot => state;

  set documentSnapshot(DocumentSnapshot? documentSnapshot) {
    state = documentSnapshot;
  }

  void updateDocumentSnapshot(DocumentSnapshot? documentSnapshot) {
    state = documentSnapshot;
  }

  void clearDocumentSnapshot() {
    state = null;
  }
}

final documentProvider =
    StateNotifierProvider<DocumentSnapshotNotifier, DocumentSnapshot?>(
        (ref) => DocumentSnapshotNotifier());
</code>```

But I was getting a different error about the widget tree being unstable. Still working out this riverpod solution.

Body:
I'm trying to update my state management solution to Riverpod and I'm all over the place. I get this error when I try to pop a page from my nav stack. I have a provider to save a DocumentSnapshot from firestore so I can call certain fields from it. This is probably where the problem is coming from:

final docIdProvider = StateProvider<DocumentSnapshot?>((ref) => null);

final docProvider = Provider((ref) {
  final docId = ref.watch(docIdProvider);
  return docId;
});

My home page I have a list of trips, the flow goes like this. The issue is when I try to pop from details to home page, or from join to details.

When a user clicks on a trip from the homepage, I update the provider:

return ListView(
          children: snapshot.data!.docs.map((DocumentSnapshot document) {
            Map<String, dynamic> data =
                document.data()! as Map<String, dynamic>;
            return Card(
              child: ListTile(
                title: Text('From ${data['departure']}'),
                ),
                onTap: () {
                  ref.read(docIdProvider.notifier).state = document;

I have a google maps page and other UI where I use the provider to call the fields of the document like so:

if ((ref.watch(docProvider)!['departure_lat']) >
                ref.watch(docProvider)!['arrival_lat']

This is where it goes wrong when I try to pop the stack. the
if ((ref.watch(docProvider)!['departure_lat']) >

Gets highlights and displays the

StateError (Bad state: called ProviderSubscription.read on a subscription that was closed)

code.

I tried creating another riverpod provider as such:

class DocumentSnapshotNotifier extends StateNotifier<DocumentSnapshot?> {
  DocumentSnapshotNotifier() : super(null);

  DocumentSnapshot? get documentSnapshot => state;

  set documentSnapshot(DocumentSnapshot? documentSnapshot) {
    state = documentSnapshot;
  }

  void updateDocumentSnapshot(DocumentSnapshot? documentSnapshot) {
    state = documentSnapshot;
  }

  void clearDocumentSnapshot() {
    state = null;
  }
}

final documentProvider =
    StateNotifierProvider<DocumentSnapshotNotifier, DocumentSnapshot?>(
        (ref) => DocumentSnapshotNotifier());

But I was getting a different error about the widget tree being unstable. Still working out this riverpod solution.


问:
Creating model to predict world population error when using train and test set
I am trying to build a supervised predictive ML model to predict world population, fertility, and life_expectancy for 10 random countries for the years 2017 and 2018.

I have cleaned the data and prepared the data frames, applying the train_test_split function successfully. I then try to create a KN neighbors model using the sklearn algorithm but get an error.

db is the database I am using to create the model and vizinhos the number of neighbors

```<code>def test_split(db, target):

    X_train, X_test, y_train, y_test = train_test_split(db
                                                    target,
                                                    test_size=0.2,
                                                    train_size=0.8,
                                                    random_state=1)
    return X_train, X_test, y_train, y_test

    #Nao esquecer que temos que fazer cross validation

def knn(db, vizinhos, X_train, X_test, y_train, y_test):
    accuracy=[]
    tests=[]
    neighbours = range(1, vizinhos)

    for i in neighbours:
        knn = neighbors.KNeighborsClassifier(n_neighbors = i)
        inn.fit(X_train,y_train)
        predictions = knn.predict(X_test)
        accuracy.append(knn.fit(X_train, y_train).score(X_test,y_test))
        tests.append(knn.fit(X_train, y_train).score(X_train, y_train))

    plt.plot(neighbours, accuracy, label="testing set", color = 'red')
    plt.plot(neighbours, tests, label="training set", color = 'blue')
    plt.xlabel("Number of neighbours")
    plt.ylabel("Accuracy")
    plt.title('KNN Classifier model accuracy as a function of neighbour number')
    plt.legend()
    plt.show()
</code>```

Could someone please explain to me why this is happening and suggest a fix? I can't seem to find a solution for this problem...

Body:
I am trying to build a supervised predictive ML model to predict world population, fertility, and life_expectancy for 10 random countries for the years 2017 and 2018.

I have cleaned the data and prepared the data frames, applying the train_test_split function successfully. I then try to create a KN neighbors model using the sklearn algorithm but get an error.

db is the database I am using to create the model and vizinhos the number of neighbors

def test_split(db, target):

    X_train, X_test, y_train, y_test = train_test_split(db
                                                    target,
                                                    test_size=0.2,
                                                    train_size=0.8,
                                                    random_state=1)
    return X_train, X_test, y_train, y_test

    #Nao esquecer que temos que fazer cross validation

def knn(db, vizinhos, X_train, X_test, y_train, y_test):
    accuracy=[]
    tests=[]
    neighbours = range(1, vizinhos)

    for i in neighbours:
        knn = neighbors.KNeighborsClassifier(n_neighbors = i)
        inn.fit(X_train,y_train)
        predictions = knn.predict(X_test)
        accuracy.append(knn.fit(X_train, y_train).score(X_test,y_test))
        tests.append(knn.fit(X_train, y_train).score(X_train, y_train))

    plt.plot(neighbours, accuracy, label="testing set", color = 'red')
    plt.plot(neighbours, tests, label="training set", color = 'blue')
    plt.xlabel("Number of neighbours")
    plt.ylabel("Accuracy")
    plt.title('KNN Classifier model accuracy as a function of neighbour number')
    plt.legend()
    plt.show()

Could someone please explain to me why this is happening and suggest a fix? I can't seem to find a solution for this problem...


问:
Biopython : trying to do blast alignment online and i got urlerror
I'm trying to use biopython library to do blast online but i got some errors i do not know how to solve it or how to understand it

```<code>      def online_alignment(seq):
        fasta = seq
        result_handle = NCBIWWW.qblast('blastn', 'nt', fasta)
        blast_record = NCBIXML.read(result_handle)
        for alignment in blast_record.alignments:
            for hsp in alignment.hsps:
                print("Sequence: ")
                print(alignment.title)
                print("/n")
                print("length: ")
                print(str(alignment.length))
                print("/n")
                print("e-value: ")
                print(str(hsp.expect))
                print("/n")
                print(hsp.query)
                print(hsp.match)
                print(hsp.sbjct)

    online_alignment("GGTAAGTCCTCT")
</code>```

and i got those errors :

i search about the errors and i found other peoples had the same issue but i didn't found how to solve it

```<code>Traceback (most recent call last):
  File "c:\Users\hp\Desktop\biopy.py", line 135, in <module>
    online_alignment("GGTAAGTCCTCT")
  File "c:\Users\hp\Desktop\biopy.py", line 118, in online_alignment
    result_handle = NCBIWWW.qblast('blastn', 'nt', fasta)
  File "C:\Users\hp\AppData\Roaming\Python\Python310\site-packages\Bio\Blast\NCBIWWW.py", line 226, in qblast
    handle = urlopen(request)
  File "C:\Program Files\Python310\lib\urllib\request.py", line 216, in urlopen
    return opener.open(url, data, timeout)
  File "C:\Program Files\Python310\lib\urllib\request.py", line 519, in open
    response = self._open(req, data)
  File "C:\Program Files\Python310\lib\urllib\request.py", line 536, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
  File "C:\Program Files\Python310\lib\urllib\request.py", line 496, in _call_chain
    result = func(*args)
  File "C:\Program Files\Python310\lib\urllib\request.py", line 1391, in https_open
    return self.do_open(http.client.HTTPSConnection, req,
  File "C:\Program Files\Python310\lib\urllib\request.py", line 1351, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 11002] getaddrinfo failed>
</code>```

Body:
I'm trying to use biopython library to do blast online but i got some errors i do not know how to solve it or how to understand it

      def online_alignment(seq):
        fasta = seq
        result_handle = NCBIWWW.qblast('blastn', 'nt', fasta)
        blast_record = NCBIXML.read(result_handle)
        for alignment in blast_record.alignments:
            for hsp in alignment.hsps:
                print("Sequence: ")
                print(alignment.title)
                print("/n")
                print("length: ")
                print(str(alignment.length))
                print("/n")
                print("e-value: ")
                print(str(hsp.expect))
                print("/n")
                print(hsp.query)
                print(hsp.match)
                print(hsp.sbjct)

    online_alignment("GGTAAGTCCTCT")

and i got those errors :

i search about the errors and i found other peoples had the same issue but i didn't found how to solve it

Traceback (most recent call last):
  File "c:\Users\hp\Desktop\biopy.py", line 135, in <module>
    online_alignment("GGTAAGTCCTCT")
  File "c:\Users\hp\Desktop\biopy.py", line 118, in online_alignment
    result_handle = NCBIWWW.qblast('blastn', 'nt', fasta)
  File "C:\Users\hp\AppData\Roaming\Python\Python310\site-packages\Bio\Blast\NCBIWWW.py", line 226, in qblast
    handle = urlopen(request)
  File "C:\Program Files\Python310\lib\urllib\request.py", line 216, in urlopen
    return opener.open(url, data, timeout)
  File "C:\Program Files\Python310\lib\urllib\request.py", line 519, in open
    response = self._open(req, data)
  File "C:\Program Files\Python310\lib\urllib\request.py", line 536, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
  File "C:\Program Files\Python310\lib\urllib\request.py", line 496, in _call_chain
    result = func(*args)
  File "C:\Program Files\Python310\lib\urllib\request.py", line 1391, in https_open
    return self.do_open(http.client.HTTPSConnection, req,
  File "C:\Program Files\Python310\lib\urllib\request.py", line 1351, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 11002] getaddrinfo failed>


问:
Get an exact error response from websockets (android)
I am trying to connect to server via websockets.
I was able to reach it via postman, but getting server error each time trying to connect.
I would like to see a response from server. How can I do it?

how I establish connection

```<code>val options = IO.Options.builder()
        .setAuth(
//        singletonMap("Authorization", "Token 123") // tried this option as well
        singletonMap("Token", "123")
    ).build()

private var mySocket: Socket = IO.socket("wss://api.myhost.com/v1/listen", options)

</code>```

I have EVENT_CONNECT_ERROR handler:

```<code>socketDeepgram.on(Socket.EVENT_CONNECT_ERROR) {
    it.forEach {
        (it as EngineIOException).printStackTrace()
    }
}
</code>```

which gives me following trace:

```<code>2022-12-23 17:13:55.929 5613-11317/me.echoist.app W/System.err: io.socket.engineio.client.EngineIOException: server error
2022-12-23 17:13:55.930 5613-11317/me.echoist.app W/System.err:     at io.socket.engineio.client.Socket.onPacket(Socket.java:552)
2022-12-23 17:13:55.930 5613-11317/me.echoist.app W/System.err:     at io.socket.engineio.client.Socket.access$1000(Socket.java:29)
2022-12-23 17:13:55.931 5613-11317/me.echoist.app W/System.err:     at io.socket.engineio.client.Socket$5.call(Socket.java:335)
2022-12-23 17:13:55.931 5613-11317/me.echoist.app W/System.err:     at io.socket.emitter.Emitter.emit(Emitter.java:117)
2022-12-23 17:13:55.931 5613-11317/me.echoist.app W/System.err:     at io.socket.engineio.client.Transport.onPacket(Transport.java:124)
2022-12-23 17:13:55.931 5613-11317/me.echoist.app W/System.err:     at io.socket.engineio.client.transports.Polling.access$700(Polling.java:17)
2022-12-23 17:13:55.931 5613-11317/me.echoist.app W/System.err:     at io.socket.engineio.client.transports.Polling$2.call(Polling.java:126)
2022-12-23 17:13:55.932 5613-11317/me.echoist.app W/System.err:     at io.socket.engineio.parser.Parser.decodePayload(Parser.java:127)
2022-12-23 17:13:55.932 5613-11317/me.echoist.app W/System.err:     at io.socket.engineio.client.transports.Polling._onData(Polling.java:131)
2022-12-23 17:13:55.932 5613-11317/me.echoist.app W/System.err:     at io.socket.engineio.client.transports.Polling.onData(Polling.java:101)
2022-12-23 17:13:55.932 5613-11317/me.echoist.app W/System.err:     at io.socket.engineio.client.transports.PollingXHR$5$1.run(PollingXHR.java:115)
2022-12-23 17:13:55.932 5613-11317/me.echoist.app W/System.err:     at io.socket.thread.EventThread$2.run(EventThread.java:80)
2022-12-23 17:13:55.933 5613-11317/me.echoist.app W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
2022-12-23 17:13:55.933 5613-11317/me.echoist.app W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
2022-12-23 17:13:55.933 5613-11317/me.echoist.app W/System.err:     at java.lang.Thread.run(Thread.java:919)
</code>```

socket client version:

```<code>io.socket:socket.io-client:2.1.0
</code>```

I would like to know how to see a full response from ws server to troubleshoot (I was able to see clear error with postman)

Body:
I am trying to connect to server via websockets.
I was able to reach it via postman, but getting server error each time trying to connect.
I would like to see a response from server. How can I do it?

how I establish connection

val options = IO.Options.builder()
        .setAuth(
//        singletonMap("Authorization", "Token 123") // tried this option as well
        singletonMap("Token", "123")
    ).build()

private var mySocket: Socket = IO.socket("wss://api.myhost.com/v1/listen", options)

I have EVENT_CONNECT_ERROR handler:

socketDeepgram.on(Socket.EVENT_CONNECT_ERROR) {
    it.forEach {
        (it as EngineIOException).printStackTrace()
    }
}

which gives me following trace:

2022-12-23 17:13:55.929 5613-11317/me.echoist.app W/System.err: io.socket.engineio.client.EngineIOException: server error
2022-12-23 17:13:55.930 5613-11317/me.echoist.app W/System.err:     at io.socket.engineio.client.Socket.onPacket(Socket.java:552)
2022-12-23 17:13:55.930 5613-11317/me.echoist.app W/System.err:     at io.socket.engineio.client.Socket.access$1000(Socket.java:29)
2022-12-23 17:13:55.931 5613-11317/me.echoist.app W/System.err:     at io.socket.engineio.client.Socket$5.call(Socket.java:335)
2022-12-23 17:13:55.931 5613-11317/me.echoist.app W/System.err:     at io.socket.emitter.Emitter.emit(Emitter.java:117)
2022-12-23 17:13:55.931 5613-11317/me.echoist.app W/System.err:     at io.socket.engineio.client.Transport.onPacket(Transport.java:124)
2022-12-23 17:13:55.931 5613-11317/me.echoist.app W/System.err:     at io.socket.engineio.client.transports.Polling.access$700(Polling.java:17)
2022-12-23 17:13:55.931 5613-11317/me.echoist.app W/System.err:     at io.socket.engineio.client.transports.Polling$2.call(Polling.java:126)
2022-12-23 17:13:55.932 5613-11317/me.echoist.app W/System.err:     at io.socket.engineio.parser.Parser.decodePayload(Parser.java:127)
2022-12-23 17:13:55.932 5613-11317/me.echoist.app W/System.err:     at io.socket.engineio.client.transports.Polling._onData(Polling.java:131)
2022-12-23 17:13:55.932 5613-11317/me.echoist.app W/System.err:     at io.socket.engineio.client.transports.Polling.onData(Polling.java:101)
2022-12-23 17:13:55.932 5613-11317/me.echoist.app W/System.err:     at io.socket.engineio.client.transports.PollingXHR$5$1.run(PollingXHR.java:115)
2022-12-23 17:13:55.932 5613-11317/me.echoist.app W/System.err:     at io.socket.thread.EventThread$2.run(EventThread.java:80)
2022-12-23 17:13:55.933 5613-11317/me.echoist.app W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
2022-12-23 17:13:55.933 5613-11317/me.echoist.app W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
2022-12-23 17:13:55.933 5613-11317/me.echoist.app W/System.err:     at java.lang.Thread.run(Thread.java:919)

socket client version:

io.socket:socket.io-client:2.1.0

I would like to know how to see a full response from ws server to troubleshoot (I was able to see clear error with postman)


问:
Update a module variable accross all Imports
I would like to update a module variable dynamically even after imports

```<code>mod
   __init__.py
      foo = 'some'
      def update_foo(val):
          updates foo
</code>```

when running the code

```<code>import foo
import foo as f

print(foo)
'some'
print(f)
'some'

update_foo('other')

print(foo)
'other'

print(f)
'other'
</code>```

Can someone recommend a pythonic approach for this?
I have tried defining this as a class method by following this link(https://stackoverflow.com/a/55645482). Is there any elegant way to achieve this? I would like to ideally refer to foo directly. My approach now makes me access it by Foo.foo.

Body:
I would like to update a module variable dynamically even after imports

mod
   __init__.py
      foo = 'some'
      def update_foo(val):
          updates foo

when running the code

import foo
import foo as f

print(foo)
'some'
print(f)
'some'

update_foo('other')

print(foo)
'other'

print(f)
'other'

Can someone recommend a pythonic approach for this?
I have tried defining this as a class method by following this link(https://stackoverflow.com/a/55645482). Is there any elegant way to achieve this? I would like to ideally refer to foo directly. My approach now makes me access it by Foo.foo.


问:
How to safely sign commits in VS Code when developing in a container?
I would like use VS Code to develop software which is in a git repo.

But I didn't read every line of code on that software's dependencies, so I will run in on a contaminated remote host or inside a container.

Now I want to make a commit which is signed using my identity on the safe computer which is running the GUI.

If I use the VS Code GUI to do this what is actually happening? And assuming one of the 17,000 dependencies in the project is malicious can it steal my signing private key?


问:
Responsive Design Works With Google Insight But Not On Browser Sizing?
When I check my site with google insight, there is no problem in responsive. But when I resize my browser manually, responsive doesn't come into play and my site doesn't seem responsive. It may even be for this reason, I'm getting a sizing error in the google search console. My website is fully responsive. So where am I doing wrong?

There is not problem with google insight

But Browser Resize Not Active Responsive Css And Not Working


问:
How to prevent the format change of a dataframe when copied into a Excel file?
I have the following line of python code which copies the content of a dataframe into a Excel file:

```<code>unified_dataframe.to_excel('FinancialAnalysis_'+timestr+'_.xlsx', sheet_name='Banks', index=False)
</code>```

The first two columns of my dataframe contains data formatted as text but the remaining columns of the dataframe have data formatted as float but, when they are inserted into the Excel file, they are inserted as text. How can I prevent this or convert the Excel columns of interest from text to float (excluding the headers)?

Edit
To answer the question from @BigBen, below some additional information:
Regarding the unified_dataframe.dtypes, I found out one funny thing. I got the following output:

```<code>Financial KPI                                      object
Year                                               object
BAC (All numbers in thousands)                    float64
C (All numbers in thousands)                      float64
CS (Currency in CHF. All numbers in thousands)    float64
JPM (All numbers in thousands)                    float64
WFC (All numbers in thousands)                    float64
dtype: object
</code>```

However, after the below lines of code which I use, first to calculate the average on one additional column and second to specify the number format of the dataframe before I send them to the Excel file, the dtypes change:

```<code>unified_dataframe['Average'] = unified_dataframe[company_list_average].mean(axis=1)
for i in list_of_columns
    unified_dataframe.loc[:, i] =unified_dataframe[i].map('{:,.0f}'.format)
</code>```

Below the dtypes:

```<code>Financial KPI                                     object
    Year                                              object
    BAC (All numbers in thousands)                    object
    C (All numbers in thousands)                      object
    CS (Currency in CHF. All numbers in thousands)    object
    JPM (All numbers in thousands)                    object
    WFC (All numbers in thousands)                    object
    Average                                           object
    dtype: object
</code>```

Below a print of the first lines of the dataframe

```<code>Financial KPI        Year  ... WFC (All numbers in thousands)     Average
0  Total Revenue         TTM  ...                     74,981,000  91,295,750
1  Total Revenue  12/31/2021  ...                     78,492,000  90,294,250
2  Total Revenue  12/31/2020  ...                     72,340,000  88,209,250
3  Total Revenue  12/31/2019  ...                     85,063,000  91,750,250
4  Total Revenue  12/31/2018  ...                     86,408,000  90,180,000
</code>```

Body:
I have the following line of python code which copies the content of a dataframe into a Excel file:

unified_dataframe.to_excel('FinancialAnalysis_'+timestr+'_.xlsx', sheet_name='Banks', index=False)

The first two columns of my dataframe contains data formatted as text but the remaining columns of the dataframe have data formatted as float but, when they are inserted into the Excel file, they are inserted as text. How can I prevent this or convert the Excel columns of interest from text to float (excluding the headers)?

Edit
To answer the question from @BigBen, below some additional information:
Regarding the unified_dataframe.dtypes, I found out one funny thing. I got the following output:

Financial KPI                                      object
Year                                               object
BAC (All numbers in thousands)                    float64
C (All numbers in thousands)                      float64
CS (Currency in CHF. All numbers in thousands)    float64
JPM (All numbers in thousands)                    float64
WFC (All numbers in thousands)                    float64
dtype: object

However, after the below lines of code which I use, first to calculate the average on one additional column and second to specify the number format of the dataframe before I send them to the Excel file, the dtypes change:

unified_dataframe['Average'] = unified_dataframe[company_list_average].mean(axis=1)
for i in list_of_columns
    unified_dataframe.loc[:, i] =unified_dataframe[i].map('{:,.0f}'.format)

Below the dtypes:

Financial KPI                                     object
    Year                                              object
    BAC (All numbers in thousands)                    object
    C (All numbers in thousands)                      object
    CS (Currency in CHF. All numbers in thousands)    object
    JPM (All numbers in thousands)                    object
    WFC (All numbers in thousands)                    object
    Average                                           object
    dtype: object

Below a print of the first lines of the dataframe

Financial KPI        Year  ... WFC (All numbers in thousands)     Average
0  Total Revenue         TTM  ...                     74,981,000  91,295,750
1  Total Revenue  12/31/2021  ...                     78,492,000  90,294,250
2  Total Revenue  12/31/2020  ...                     72,340,000  88,209,250
3  Total Revenue  12/31/2019  ...                     85,063,000  91,750,250
4  Total Revenue  12/31/2018  ...                     86,408,000  90,180,000


问:
Too small mobile view in boostrap 4
Goog morning,

I look forn an solution to create bigger and more visible mobile view for my bootrstap menu with language switcher. Everything is based on boostrap 4. Ive never tried to write something in bootstrap...

Any help??
`

```<code><link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/"
crossorigin="anonymous">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS"
crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/3.2.1/css/flag-icon.min.css">
<script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
<style type="text/css">
    .phone-link {
        border-radius: 25px;
        background-color: lightblue;
        color: #ffffff;
        padding: 15px 25px;
    }
    .navbar-nav {
        margin-right: 40px;
    }
    .navbar-nav .nav-item {
        padding: 25px;
    }
    @media (max-width: 999px) {
        .phone-link {
            display: none;
        }
    }
    .dropdown.language {
        position: absolute;
        right: 150px;
        width: auto;
        top: 35px;
    }
    @media (max-width: 991px) {
        .dropdown.language {
            right: 100px;
            position: absolute; top: 10px;
        }
    }
</style>

<nav class="navbar navbar-light" style="background-color: #e3f2fd; ">
    <a class="navbar-brand" href="#">
        <img src="https://getbootstrap.com/docs/4.2/assets/brand/bootstrap-solid.svg" width="30" height="75" alt="">
    </a>
    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
        <span class="navbar-toggler-icon"></span>

    </button>
    <div class="collapse navbar-collapse" id="navbarNavDropdown">
        <ul class="navbar-nav">
            <li class="nav-item active">
                <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
            </li>

            <li class="nav-item dropdown">
                <a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                    Dropdown link
                </a>
                <div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink" style="position: absolute; left: 0px; top: 76px">
                    <a class="dropdown-item" href="#">Action</a>
                    <a class="dropdown-item" href="#">Another action</a>
                    <a class="dropdown-item" href="#">Something else here</a>
                </div>
            </li>
        </ul>

    </div>
    <div class="dropdown language">
        <button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" style="width: 160; height: 42">
            <span class="flag-icon flag-icon-us"></span> English
        </button>
        <div class="dropdown-menu dropdown-menu-left text-left language">
            <p style="text-align: left !important">
            <a class="dropdown-item" href="#fr"><span class="flag-icon flag-icon-fr"> </span> French</a>
            <a class="dropdown-item" href="#it"><span class="flag-icon flag-icon-it"> </span> Italian</a>
            <a class="dropdown-item" href="#ru"><span class="flag-icon flag-icon-ru"> </span> Russian</a>
        </div>
    </div>
</nav>
</code>```

`

Mobile view is too small... I want to make elements more bigger and viisble

Title: Too small mobile view in boostrap 4

Body:
Goog morning,

I look forn an solution to create bigger and more visible mobile view for my bootrstap menu with language switcher. Everything is based on boostrap 4. Ive never tried to write something in bootstrap...

Any help??
`

<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/"
crossorigin="anonymous">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS"
crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/3.2.1/css/flag-icon.min.css">

    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">

    </button>

                Home (current)

                    Dropdown link

                    Action
                    Another action
                    Something else here

        <button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" style="width: 160; height: 42">
             English
        </button>

              French
              Italian
              Russian

`

Mobile view is too small... I want to make elements more bigger and viisble