问:
TypeError: Cannot read properties of undefined (reading 'Sequelize')
I'm using express/postgres/sequelize/typescript and I've created this file containing 2 models. Stakeholders and Companies. I get no issues when fetching a list of companies or stakeholders (Company.findAll(), Stakeholder.findAll()).

But as soon as I create an association between these 2 models I get the error:TypeError: Cannot read properties of undefined (reading 'Sequelize')

I need to create a many2many relationship between these models through "Position". Ideally I would have individual files for each model and an index file making the sequelize connection and creating an instance although I can't find any example of how this index file should look like.

These are the versions:

"express": "^4.17.1",

"sequelize": "^6.20.0",

"pg": "^8.7.3",

"pg-hstore": "^2.3.4",

"ts-node-dev": "^1.1.8",

"typescript": "^4.6.4"

"@types/node": "^17.0.35",

"@types/express": "^4.17.13",\

This is my file

```<code>import {Association, CreationOptional, DataTypes, ForeignKey, InferAttributes, InferCreationAttributes, Model, Sequelize} from 'sequelize'
import logger from '../utils/logger/logger'
import {ICompanyDelivery, ICompanyMarket, ICompanyPosBilling, ICompanySettlement, ICompanySubscription, ICompanyVolume, ICompanyWebsite} from '../types/company'

export const sequelize = new Sequelize('postgres://test:test@localhost:5432/board4')
const test = async () => {
  try {
    await sequelize.authenticate()
    console.log('Connection has been established successfully.')
  } catch (error) {
    //@ts-ignore
    error('Unable to connect to the database:', error)
  }
}
test()

export class Company extends Model<InferAttributes<Company>, InferCreationAttributes<Company>> {
  declare companyId:CreationOptional<string>
  declare companyName:string
  declare companyEntityType:string | null
  declare companyVatNumber:string | null
  declare companyRegistrationNumber:string
  declare companyPubliclyListed:boolean | null
  declare companyDateOfIncorporation:Date | null
  declare companyAddress1:string | null
  declare companyAddress2:string | null
  declare companyCity:string | null
  declare companyPostCode:string | null
  declare companyCountry:string | null
  declare companyPhone:string | null
  declare companyEmail:string | null
  declare companyUrl:string | null
  declare companyLogoUrl:string | null
  declare createdAt:CreationOptional<Date>
  declare updatedAt:CreationOptional<Date>

  declare static associations:{
    stakeholders:Association<Company, Stakeholder>
  }
}

export class Stakeholder extends Model<InferAttributes<Stakeholder>, InferCreationAttributes<Stakeholder>> {
  declare stakeholderId:string
  declare stakeholderName:string
  declare username:string
  declare password:string
  declare stakeholderLastname:string
  declare stakeholderEmail:string
  declare stakeholderJobTitle?:string | null
  declare stakeholderSharesPercentage?:number | null
  declare stakeholderDOB?:string | null
  declare stakeholderNationality?:string | null
  declare stakeholderAddress1?:string | null
  declare stakeholderAddress2?:string | null
  declare stakeholderPostCode?:string | null
  declare stakeholderCity?:string | null
  declare stakeholderCountry?:string | null
  declare stakeholderPhone?:string | null
  declare stakeholderPassport?:string | null
  declare stakeholderProofOfAddress?:string | null
  declare stakeholderRole:string
  declare positionCompanyId:ForeignKey<string>

  declare createdAt:CreationOptional<Date>
  declare updatedAt:CreationOptional<Date>

  declare static associations:{
    companies:Association<Stakeholder, Company>
  }
}

Company.belongsToMany(Stakeholder, {through: 'Position', foreignKey: 'positionStakeholderId'})<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<This causes the issue
//Stakeholder.belongsToMany(Company, {through: 'Position', foreignKey: 'positionCompanyId'})

Company.init(
  {
    companyId: {
      type: DataTypes.UUID,
      defaultValue: DataTypes.UUIDV4,
      primaryKey: true
    },
    companyName: {
      type: DataTypes.STRING,
      allowNull: true
    },
    companyEntityType: DataTypes.STRING,
    companyVatNumber: DataTypes.STRING,
    companyRegistrationNumber: {
      type: DataTypes.STRING,
      allowNull: false,
      unique: {
        name: 'uniqueRegistrationNumber',
        msg: 'Company Registration number address already in use'
      },
      validate: {
        notNull: {msg: 'Must be a valid Registration number'}
      }
    },
    companyDateOfIncorporation: DataTypes.DATE,
    companyPubliclyListed: DataTypes.BOOLEAN,
    companyAddress1: DataTypes.STRING,
    companyAddress2: DataTypes.STRING,
    companyCity: DataTypes.STRING,
    companyPostCode: DataTypes.STRING,
    companyCountry: DataTypes.STRING,
    companyPhone: DataTypes.STRING,
    companyEmail: DataTypes.STRING,
    companyUrl: DataTypes.STRING,
    companyLogoUrl: DataTypes.STRING,
    createdAt: DataTypes.DATE,
    updatedAt: DataTypes.DATE,
  },
  {
    sequelize: sequelize,
    underscored: true,
    timestamps: true,
    tableName: 'companies',
  }
)

Stakeholder.init(
  {
    stakeholderId: {
      type: DataTypes.UUID,
      defaultValue: DataTypes.UUIDV4,
      primaryKey: true
    },
    username: {
      allowNull: true,
      type: DataTypes.STRING
    },
    password: {
      allowNull: true,
      type: DataTypes.STRING
    },
    stakeholderRole: {
      type: DataTypes.STRING,
    },
    stakeholderName: DataTypes.STRING,
    stakeholderLastname: DataTypes.STRING,
    stakeholderJobTitle: DataTypes.STRING,
    stakeholderEmail: DataTypes.STRING,
    stakeholderSharesPercentage: DataTypes.INTEGER,
    stakeholderDOB: DataTypes.STRING,
    stakeholderNationality: DataTypes.STRING,
    stakeholderAddress1: DataTypes.STRING,
    stakeholderAddress2: DataTypes.STRING,
    stakeholderPostCode: DataTypes.STRING,
    stakeholderCity: DataTypes.STRING,
    stakeholderCountry: DataTypes.STRING,
    stakeholderPhone: DataTypes.STRING,
    stakeholderPassport: {
      type: DataTypes.STRING,
      set: function (val:any) {
        logger.debug(`${__filename}:${val} is valid?: ${val.fileName && val.fileName.split('.')[1] !== 'undefined'}`)
        if (val.fileName && val.fileName.split('.')[1] !== 'undefined') this.setDataValue('stakeholderPassport', val.fileName)
      }
    },
    stakeholderProofOfAddress: {
      type: DataTypes.STRING,
      set: function (val:any) {
        logger.debug(`${__filename}:${val} is valid?: ${val.fileName && val.fileName.split('.')[1] !== 'undefined'}`)
        if (val.fileName && val.fileName.split('.')[1] !== 'undefined') this.setDataValue('stakeholderProofOfAddress', val.fileName)
      }
    },
    createdAt: DataTypes.DATE,
    updatedAt: DataTypes.DATE,

  },
  {
    sequelize: sequelize,
    timestamps: true,
    tableName: 'stakeholders'
  }
)
</code>```

Body:
I'm using express/postgres/sequelize/typescript and I've created this file containing 2 models. Stakeholders and Companies. I get no issues when fetching a list of companies or stakeholders (Company.findAll(), Stakeholder.findAll()).

But as soon as I create an association between these 2 models I get the error:TypeError: Cannot read properties of undefined (reading 'Sequelize')

I need to create a many2many relationship between these models through "Position". Ideally I would have individual files for each model and an index file making the sequelize connection and creating an instance although I can't find any example of how this index file should look like.

These are the versions:

"express": "^4.17.1",

"sequelize": "^6.20.0",

"pg": "^8.7.3",

"pg-hstore": "^2.3.4",

"ts-node-dev": "^1.1.8",

"typescript": "^4.6.4"

"@types/node": "^17.0.35",

"@types/express": "^4.17.13",\

This is my file

import {Association, CreationOptional, DataTypes, ForeignKey, InferAttributes, InferCreationAttributes, Model, Sequelize} from 'sequelize'
import logger from '../utils/logger/logger'
import {ICompanyDelivery, ICompanyMarket, ICompanyPosBilling, ICompanySettlement, ICompanySubscription, ICompanyVolume, ICompanyWebsite} from '../types/company'

export const sequelize = new Sequelize('postgres://test:test@localhost:5432/board4')
const test = async () => {
  try {
    await sequelize.authenticate()
    console.log('Connection has been established successfully.')
  } catch (error) {
    //@ts-ignore
    error('Unable to connect to the database:', error)
  }
}
test()

export class Company extends Model<InferAttributes<Company>, InferCreationAttributes<Company>> {
  declare companyId:CreationOptional<string>
  declare companyName:string
  declare companyEntityType:string | null
  declare companyVatNumber:string | null
  declare companyRegistrationNumber:string
  declare companyPubliclyListed:boolean | null
  declare companyDateOfIncorporation:Date | null
  declare companyAddress1:string | null
  declare companyAddress2:string | null
  declare companyCity:string | null
  declare companyPostCode:string | null
  declare companyCountry:string | null
  declare companyPhone:string | null
  declare companyEmail:string | null
  declare companyUrl:string | null
  declare companyLogoUrl:string | null
  declare createdAt:CreationOptional<Date>
  declare updatedAt:CreationOptional<Date>

  declare static associations:{
    stakeholders:Association<Company, Stakeholder>
  }
}

export class Stakeholder extends Model<InferAttributes<Stakeholder>, InferCreationAttributes<Stakeholder>> {
  declare stakeholderId:string
  declare stakeholderName:string
  declare username:string
  declare password:string
  declare stakeholderLastname:string
  declare stakeholderEmail:string
  declare stakeholderJobTitle?:string | null
  declare stakeholderSharesPercentage?:number | null
  declare stakeholderDOB?:string | null
  declare stakeholderNationality?:string | null
  declare stakeholderAddress1?:string | null
  declare stakeholderAddress2?:string | null
  declare stakeholderPostCode?:string | null
  declare stakeholderCity?:string | null
  declare stakeholderCountry?:string | null
  declare stakeholderPhone?:string | null
  declare stakeholderPassport?:string | null
  declare stakeholderProofOfAddress?:string | null
  declare stakeholderRole:string
  declare positionCompanyId:ForeignKey<string>

  declare createdAt:CreationOptional<Date>
  declare updatedAt:CreationOptional<Date>

  declare static associations:{
    companies:Association<Stakeholder, Company>
  }
}

Company.belongsToMany(Stakeholder, {through: 'Position', foreignKey: 'positionStakeholderId'})<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<This causes the issue
//Stakeholder.belongsToMany(Company, {through: 'Position', foreignKey: 'positionCompanyId'})

Company.init(
  {
    companyId: {
      type: DataTypes.UUID,
      defaultValue: DataTypes.UUIDV4,
      primaryKey: true
    },
    companyName: {
      type: DataTypes.STRING,
      allowNull: true
    },
    companyEntityType: DataTypes.STRING,
    companyVatNumber: DataTypes.STRING,
    companyRegistrationNumber: {
      type: DataTypes.STRING,
      allowNull: false,
      unique: {
        name: 'uniqueRegistrationNumber',
        msg: 'Company Registration number address already in use'
      },
      validate: {
        notNull: {msg: 'Must be a valid Registration number'}
      }
    },
    companyDateOfIncorporation: DataTypes.DATE,
    companyPubliclyListed: DataTypes.BOOLEAN,
    companyAddress1: DataTypes.STRING,
    companyAddress2: DataTypes.STRING,
    companyCity: DataTypes.STRING,
    companyPostCode: DataTypes.STRING,
    companyCountry: DataTypes.STRING,
    companyPhone: DataTypes.STRING,
    companyEmail: DataTypes.STRING,
    companyUrl: DataTypes.STRING,
    companyLogoUrl: DataTypes.STRING,
    createdAt: DataTypes.DATE,
    updatedAt: DataTypes.DATE,
  },
  {
    sequelize: sequelize,
    underscored: true,
    timestamps: true,
    tableName: 'companies',
  }
)

Stakeholder.init(
  {
    stakeholderId: {
      type: DataTypes.UUID,
      defaultValue: DataTypes.UUIDV4,
      primaryKey: true
    },
    username: {
      allowNull: true,
      type: DataTypes.STRING
    },
    password: {
      allowNull: true,
      type: DataTypes.STRING
    },
    stakeholderRole: {
      type: DataTypes.STRING,
    },
    stakeholderName: DataTypes.STRING,
    stakeholderLastname: DataTypes.STRING,
    stakeholderJobTitle: DataTypes.STRING,
    stakeholderEmail: DataTypes.STRING,
    stakeholderSharesPercentage: DataTypes.INTEGER,
    stakeholderDOB: DataTypes.STRING,
    stakeholderNationality: DataTypes.STRING,
    stakeholderAddress1: DataTypes.STRING,
    stakeholderAddress2: DataTypes.STRING,
    stakeholderPostCode: DataTypes.STRING,
    stakeholderCity: DataTypes.STRING,
    stakeholderCountry: DataTypes.STRING,
    stakeholderPhone: DataTypes.STRING,
    stakeholderPassport: {
      type: DataTypes.STRING,
      set: function (val:any) {
        logger.debug(`${__filename}:${val} is valid?: ${val.fileName && val.fileName.split('.')[1] !== 'undefined'}`)
        if (val.fileName && val.fileName.split('.')[1] !== 'undefined') this.setDataValue('stakeholderPassport', val.fileName)
      }
    },
    stakeholderProofOfAddress: {
      type: DataTypes.STRING,
      set: function (val:any) {
        logger.debug(`${__filename}:${val} is valid?: ${val.fileName && val.fileName.split('.')[1] !== 'undefined'}`)
        if (val.fileName && val.fileName.split('.')[1] !== 'undefined') this.setDataValue('stakeholderProofOfAddress', val.fileName)
      }
    },
    createdAt: DataTypes.DATE,
    updatedAt: DataTypes.DATE,

  },
  {
    sequelize: sequelize,
    timestamps: true,
    tableName: 'stakeholders'
  }
)


来源: stackexchange

问:
AdMob Crash with Android Studio
Hello i'm trying to initialize AdMob SDK to my android project studio . I follow every steps on this link , and I had an erorr
I retraced step by step what I did, and I noticed that it crashed when I added the implementation where it was necessary .
The Application keeps stopping , it's since the time when I added implementation. All was working perfectly before that . Please help me I'm Stucked . The application is always keep stopping , I have a recently system , Java , Java Sdk ...

ContentLicense: CC BY-SA 4.0

Title: AdMob Crash with Android Studio


问:
Fluent Validation : String Contain Another String
i'm trying to see if AzureAdRegister.Scopes Contains The AzureAd.ClientId by something like the spaghetti code below.
and it's crashing once the validation of the model launched, i think this validation rule is not correct, but i was able to make that check without fluent validation for now;
is it because of ToSting() or what? thanks in advance :)</p>
```<code>//for more clarity
public class AzureAd
{
    public string Instance { get; set; }
    public string Domain { get; set; }
    public Guid TenantId { get; set; }
    public Guid ClientId { get; set; }
    public string CallbackPath { get; set; }
    public List<string> Scopes { get; set; }
    public List<string> DefaultScopes { get; set; }
    public string ClientSecret { get; set; }
    public List<string> ClientCertificates { get; set; }
}

public class AzureAdRegister
{
    public string AuthorizationUrl { get; set; }
    public string TokenUrl { get; set; }
    public string Scopes { get; set; }
    public Guid ClientId { get; set; }
}

public class AzureConfiguration
{
    public AzureAd AzureAd { get; set; }
    public AzureAdRegister AzureAdRegister { get; set;}
}

// there is the issue
public class AzureConfigurationValidator : AbstractValidator<AzureConfiguration>
{
    public AzureConfigurationValidator()
    {
        RuleFor(azure => azure.AzureAdRegister.Scopes)
            .Must((azure,scope) => scope.Contains(azure.AzureAd.ClientId.ToString()))
            .WithMessage("the scope of registeration app must contains the client id of the main app");

    }
}
</code>```

Body:
i'm trying to see if AzureAdRegister.Scopes Contains The AzureAd.ClientId by something like the spaghetti code below.
and it's crashing once the validation of the model launched, i think this validation rule is not correct, but i was able to make that check without fluent validation for now;
is it because of ToSting() or what? thanks in advance :)

//for more clarity
public class AzureAd
{
    public string Instance { get; set; }
    public string Domain { get; set; }
    public Guid TenantId { get; set; }
    public Guid ClientId { get; set; }
    public string CallbackPath { get; set; }
    public List<string> Scopes { get; set; }
    public List<string> DefaultScopes { get; set; }
    public string ClientSecret { get; set; }
    public List<string> ClientCertificates { get; set; }
}

public class AzureAdRegister
{
    public string AuthorizationUrl { get; set; }
    public string TokenUrl { get; set; }
    public string Scopes { get; set; }
    public Guid ClientId { get; set; }
}

public class AzureConfiguration
{
    public AzureAd AzureAd { get; set; }
    public AzureAdRegister AzureAdRegister { get; set;}
}

// there is the issue
public class AzureConfigurationValidator : AbstractValidator<AzureConfiguration>
{
    public AzureConfigurationValidator()
    {
        RuleFor(azure => azure.AzureAdRegister.Scopes)
            .Must((azure,scope) => scope.Contains(azure.AzureAd.ClientId.ToString()))
            .WithMessage("the scope of registeration app must contains the client id of the main app");

    }
}


问:
How is possible put QGraphicsView to own method as argument?
So, I have the source code for a training. Where I want to do operation with QGraphicsView named pp in the own class ProcessPicture.
I would ask you, is it possible to put the QGraphicsView object to the method of own class? If yes, please tell me how or lead me on answer.
For a detailed description after releasing button will done the on_processPic_pushButton_released() where is called the method of pp object. This method take a ui->graphicsview as argument. This argument will used in the pp.drawrectangle(ui->graphicsview).

The code is without error or warning, only it is not draw the rectangle to the ui->graphicsview. When I take a source code from pp.drawrectangle() and try it, in the on_processPic_pushButton_released() all is fine. So I think that i miss some knowledge.

Lets look on my source code.

processpicture.h

```<code>#ifndef PROCESSPICTURE_H
#define PROCESSPICTURE_H

#include "QString"
#include "QPicture"
#include "QGraphicsView"

class ProcessPicture
{
public:
    ProcessPicture();
    void draw(QGraphicsView out);
    void draw_rectangle(QGraphicsView out);

private:
    QString path = "***/Untitled.bmp";
    QImage img;
};

#endif // PROCESSPICTURE_H
</code>```

processpicture.cpp

```<code>#include "processpicture.h"
#include "QGraphicsScene"
#include "QGraphicsPixmapItem"

ProcessPicture::ProcessPicture()
{
    img.load(path);
}

void ProcessPicture::draw_rectangle(QGraphicsView out){
    //QGraphicsScene* scene = new QGraphicsScene();
    QGraphicsScene scene;
    QRect rect;
    rect.setRect(10,10,10,10);
    scene.addRect(rect);
    out.setScene(&scene);
    out.show();
}

</code>```

mainwindow.h

```<code>#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include "processpicture.h"

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ProcessPicture *pp;
    //pp = new ProcessPicture;
    ~MainWindow();
private:

private slots:
    void on_processPic_pushButton_released();

private:
    Ui::MainWindow *ui;
    bool event(QEvent *event);
};
#endif // MAINWINDOW_H

</code>```

mainwindow.cpp

```<code>#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    pp = new ProcessPicture;
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::on_processPic_pushButton_released()
{
    //pp->draw(ui->graphicsView);
    pp->draw_rectangle(ui->graphicsView);
}

</code>```

For every non-toxic answer I thank.

Body:
So, I have the source code for a training. Where I want to do operation with QGraphicsView named pp in the own class ProcessPicture.
I would ask you, is it possible to put the QGraphicsView object to the method of own class? If yes, please tell me how or lead me on answer.
For a detailed description after releasing button will done the on_processPic_pushButton_released() where is called the method of pp object. This method take a ui->graphicsview as argument. This argument will used in the pp.drawrectangle(ui->graphicsview).

The code is without error or warning, only it is not draw the rectangle to the ui->graphicsview. When I take a source code from pp.drawrectangle() and try it, in the on_processPic_pushButton_released() all is fine. So I think that i miss some knowledge.

Lets look on my source code.

processpicture.h

#ifndef PROCESSPICTURE_H
#define PROCESSPICTURE_H

#include "QString"
#include "QPicture"
#include "QGraphicsView"

class ProcessPicture
{
public:
    ProcessPicture();
    void draw(QGraphicsView out);
    void draw_rectangle(QGraphicsView out);

private:
    QString path = "***/Untitled.bmp";
    QImage img;
};

#endif // PROCESSPICTURE_H

processpicture.cpp

#include "processpicture.h"
#include "QGraphicsScene"
#include "QGraphicsPixmapItem"

ProcessPicture::ProcessPicture()
{
    img.load(path);
}

void ProcessPicture::draw_rectangle(QGraphicsView out){
    //QGraphicsScene* scene = new QGraphicsScene();
    QGraphicsScene scene;
    QRect rect;
    rect.setRect(10,10,10,10);
    scene.addRect(rect);
    out.setScene(&scene);
    out.show();
}

mainwindow.h

#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include "processpicture.h"

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ProcessPicture *pp;
    //pp = new ProcessPicture;
    ~MainWindow();
private:

private slots:
    void on_processPic_pushButton_released();

private:
    Ui::MainWindow *ui;
    bool event(QEvent *event);
};
#endif // MAINWINDOW_H

mainwindow.cpp

#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    pp = new ProcessPicture;
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::on_processPic_pushButton_released()
{
    //pp->draw(ui->graphicsView);
    pp->draw_rectangle(ui->graphicsView);
}

For every non-toxic answer I thank.


问:
PyLance raises errors due to a misunderstanding of simple logic
I'm coding Python in VScode and started using PyLance to improve my code. However, It isn't pleasing when it does not understand simple logic like the following:

```<code>if a == 1:
   test = (1, 2, 4)
else:
   test = [1, 2, 3]

if a == 1:
   print(test)
else:
   test.append(1)
</code>```

In this example, I got an error that said:

```<code>Cannot access member "append" for type "tuple[Literal[1], Literal[2], Literal[4]]"
  Member "append" is unknown
</code>```

Is there anything to do in such cases?

Body:
I'm coding Python in VScode and started using PyLance to improve my code. However, It isn't pleasing when it does not understand simple logic like the following:

if a == 1:
   test = (1, 2, 4)
else:
   test = [1, 2, 3]

if a == 1:
   print(test)
else:
   test.append(1)

In this example, I got an error that said:

Cannot access member "append" for type "tuple[Literal[1], Literal[2], Literal[4]]"
  Member "append" is unknown

Is there anything to do in such cases?


问:
Only Last frame of a video displayed in Xcode Simulator
I'm applying some signal-processing techniques to a video by extracting a frame from the video and displaying the result to the image view before extracting the next frame. In my program, inside the -(void)viewDidload{}, I have a while loop that loops through 30 images and displays each one to the view. The problem I am having is that the image view ( UIImageView) never shows the image at each loop and only displays the last image. I want the new image to be shown every time a new frame is extracted.

I checked that the code is looping through all the images extracted from the video by pure outing frame count inside the while loop, but the imageview shows nothing.
Here is the problem code:

```<code>@interface ViewController () {
    UIImageView *imageView_;

}
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    imageView_ = [[UIImageView alloc]initWithFrame:CGRectMake(100, 100, 190, 190)];
    imageView_.contentMode = UIViewContentModeScaleAspectFill;

    string data = "eyesample.mp4";
    cv::VideoCapture original_video_data;
    original_video_data.open(data);

    int count = 0;

    int total;
    int nFrames;
    cv::Mat frame;
    frame = NULL;

    total = original_video_data.get(cv::CAP_PROP_FRAME_COUNT);
    cout <<"the total number of frames are :" << total << endl;

    while (count < 30)
    {
        original_video_data >> frame ;

        if (frame.empty()) {
            break;
        }
        nFrames = original_video_data.get(cv::CAP_PROP_POS_FRAMES); // frame elemnt counter
        cout << "Frame: " << nFrames << endl;
        cout << count++ << endl;

        imageView_.image = MatToUIImage(frame);
        [self.view addSubview:imageView_];

    }

   original_video_data.release();
}

</code>```

Body:
I'm applying some signal-processing techniques to a video by extracting a frame from the video and displaying the result to the image view before extracting the next frame. In my program, inside the -(void)viewDidload{}, I have a while loop that loops through 30 images and displays each one to the view. The problem I am having is that the image view ( UIImageView) never shows the image at each loop and only displays the last image. I want the new image to be shown every time a new frame is extracted.

I checked that the code is looping through all the images extracted from the video by pure outing frame count inside the while loop, but the imageview shows nothing.
Here is the problem code:

@interface ViewController () {
    UIImageView *imageView_;

}
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    imageView_ = [[UIImageView alloc]initWithFrame:CGRectMake(100, 100, 190, 190)];
    imageView_.contentMode = UIViewContentModeScaleAspectFill;

    string data = "eyesample.mp4";
    cv::VideoCapture original_video_data;
    original_video_data.open(data);

    int count = 0;

    int total;
    int nFrames;
    cv::Mat frame;
    frame = NULL;

    total = original_video_data.get(cv::CAP_PROP_FRAME_COUNT);
    cout <<"the total number of frames are :" << total << endl;

    while (count < 30)
    {
        original_video_data >> frame ;

        if (frame.empty()) {
            break;
        }
        nFrames = original_video_data.get(cv::CAP_PROP_POS_FRAMES); // frame elemnt counter
        cout << "Frame: " << nFrames << endl;
        cout << count++ << endl;

        imageView_.image = MatToUIImage(frame);
        [self.view addSubview:imageView_];

    }

   original_video_data.release();
}


问:
problems with the autoload of PHP classes
I am new to php and I was doing some tests to make an MVC project with php, the problem is that when using autoload to import the classes, php does not recognize them, but it suggests it when using it, this is my code.

composition of folders and files

```<code>--public
  --index.php
--src
--vendor
--composer.json
--composer.lock
--Router.php
</code>```

composer.json
enter image description here

Router.php
enter image description here

public/index.php
enter image description here

message error

[Wed Dec 28 16:40:52 2022] PHP Fatal error:  Uncaught Error: Class "MVC\Router" not found in C:\apache\htdocs\test\public\index.php:5

try to create everything again using composer init and then update by making a change in composer.json but it didn't work.

I also moved the router class to another folder to see if the error had to do with the routes but it gave me the same error, I appreciate your help in advance

Body:
I am new to php and I was doing some tests to make an MVC project with php, the problem is that when using autoload to import the classes, php does not recognize them, but it suggests it when using it, this is my code.

composition of folders and files

--public
  --index.php
--src
--vendor
--composer.json
--composer.lock
--Router.php

composer.json
enter image description here

Router.php
enter image description here

public/index.php
enter image description here

message error

[Wed Dec 28 16:40:52 2022] PHP Fatal error:  Uncaught Error: Class "MVC\Router" not found in C:\apache\htdocs\test\public\index.php:5

try to create everything again using composer init and then update by making a change in composer.json but it didn't work.

I also moved the router class to another folder to see if the error had to do with the routes but it gave me the same error, I appreciate your help in advance


问:
Only first query is executed in a multi-insert statement using sqlite 'run' in nodejs
For some reason the following code fails to add both users and only Sam is added.

```<code>const sqlite = require('sqlite-async');
  ...
stm = `INSERT INTO users (username, password) VALUES ('Sam','123');
       INSERT INTO users (username, password) VALUES ('JDI','pass');`;
resolve((await this.db.run(stm)));
</code>```

When I run the query with sqlite cli it works.

Any ideas?

Body:
For some reason the following code fails to add both users and only Sam is added.

const sqlite = require('sqlite-async');
  ...
stm = `INSERT INTO users (username, password) VALUES ('Sam','123');
       INSERT INTO users (username, password) VALUES ('JDI','pass');`;
resolve((await this.db.run(stm)));

When I run the query with sqlite cli it works.

Any ideas?


问:
I can not figure out why my app menu is still freezing after I have used threading on tkinter
When I run the app, the run button is still responsive for a few seconds before the entire app freezes but the thread continues running. Where is the problem in my code and how do fix it?

```<code>import threading
from tkinter import *
from tkinter import ttk

class SubExtractor:
    def __init__(self, root):
        self.root = root
        self._create_layout()

    def _create_layout(self):
        self.root.title("Sub Extractor")

        self._menu_bar()

        self.main_frame = ttk.Frame(self.root, padding=(5, 5, 5, 15))

        self._video_frame()
        self._progress_frame()
        self._output_frame()

        self.main_frame.grid()

    def _menu_bar(self):
        self.root.option_add('*tearOff', FALSE)

        menubar = Menu(self.root)
        self.root.config(menu=menubar)

        menu_file = Menu(menubar)
        menu_settings = Menu(menubar)

        menubar.add_cascade(menu=menu_file, label="File")
        menubar.add_cascade(menu=menu_settings, label="Settings")

        menu_file.add_command(label="Open", command=self._open_file)
        menu_file.add_command(label="Close", command=self._close_window)

        menu_settings.add_command(label="Language", command=self._language_settings)
        menu_settings.add_command(label="Extraction", command=self._extraction_settings)

    def _video_frame(self):
        video_frame = ttk.Frame(self.main_frame, borderwidth=2, relief="ridge", width=1000, height=600)
        video_frame.grid()

    def _progress_frame(self):
        progress_frame = ttk.Frame(self.main_frame)
        progress_frame.grid(row=1, sticky="W")

        self.run_button = ttk.Button(progress_frame, text="Run", command=self._run)
        self.run_button.grid(pady=10, padx=30)

        self.progress_bar = ttk.Progressbar(progress_frame, orient=HORIZONTAL, length=800, mode='determinate')
        self.progress_bar.grid(column=2, row=0)

    def _output_frame(self):
        output_frame = ttk.Frame(self.main_frame)
        output_frame.grid(row=2)

        self.text_output_widget = Text(output_frame, width=97, height=12, state="disabled")
        self.text_output_widget.grid()

        output_scroll = ttk.Scrollbar(output_frame, orient=VERTICAL, command=self.text_output_widget.yview)
        output_scroll.grid(column=1, row=0, sticky="N,S")

        self.text_output_widget.configure(yscrollcommand=output_scroll.set)

    def _close_window(self):
        self._stop_run()
        self.root.quit()

    def _stop_run(self):
        self.interrupt = True
        self.run_button.configure(text="Run", command=self._run)

    def _text_to_output(self, text):
        self.text_output_widget.configure(state="normal")
        self.text_output_widget.insert("end", f"{text}\n")
        self.text_output_widget.see("end")
        self.text_output_widget.configure(state="disabled")

    def long_running_method(self):
        num = 100000
        self.progress_bar.configure(maximum=num)
        for i in range(0, num):
            if self.interrupt:
                break
            self._text_to_output(f"Line {i} of {num}")
            self.progress_bar['value'] += 1
        self._stop_run()

    def _run(self):
        self.interrupt = False
        self.run_button.configure(text='Stop', command=self._stop_run)
        threading.Thread(target=self.long_running_method).start()

rt = Tk()
SubtitleExtractorGUI(rt)
rt.mainloop()
</code>```

What I expect to accomplish is for the loop to insert texts in the text widget while I can still freely move and use other buttons on the app.

Body:
When I run the app, the run button is still responsive for a few seconds before the entire app freezes but the thread continues running. Where is the problem in my code and how do fix it?

import threading
from tkinter import *
from tkinter import ttk

class SubExtractor:
    def __init__(self, root):
        self.root = root
        self._create_layout()

    def _create_layout(self):
        self.root.title("Sub Extractor")

        self._menu_bar()

        self.main_frame = ttk.Frame(self.root, padding=(5, 5, 5, 15))

        self._video_frame()
        self._progress_frame()
        self._output_frame()

        self.main_frame.grid()

    def _menu_bar(self):
        self.root.option_add('*tearOff', FALSE)

        menubar = Menu(self.root)
        self.root.config(menu=menubar)

        menu_file = Menu(menubar)
        menu_settings = Menu(menubar)

        menubar.add_cascade(menu=menu_file, label="File")
        menubar.add_cascade(menu=menu_settings, label="Settings")

        menu_file.add_command(label="Open", command=self._open_file)
        menu_file.add_command(label="Close", command=self._close_window)

        menu_settings.add_command(label="Language", command=self._language_settings)
        menu_settings.add_command(label="Extraction", command=self._extraction_settings)

    def _video_frame(self):
        video_frame = ttk.Frame(self.main_frame, borderwidth=2, relief="ridge", width=1000, height=600)
        video_frame.grid()

    def _progress_frame(self):
        progress_frame = ttk.Frame(self.main_frame)
        progress_frame.grid(row=1, sticky="W")

        self.run_button = ttk.Button(progress_frame, text="Run", command=self._run)
        self.run_button.grid(pady=10, padx=30)

        self.progress_bar = ttk.Progressbar(progress_frame, orient=HORIZONTAL, length=800, mode='determinate')
        self.progress_bar.grid(column=2, row=0)

    def _output_frame(self):
        output_frame = ttk.Frame(self.main_frame)
        output_frame.grid(row=2)

        self.text_output_widget = Text(output_frame, width=97, height=12, state="disabled")
        self.text_output_widget.grid()

        output_scroll = ttk.Scrollbar(output_frame, orient=VERTICAL, command=self.text_output_widget.yview)
        output_scroll.grid(column=1, row=0, sticky="N,S")

        self.text_output_widget.configure(yscrollcommand=output_scroll.set)

    def _close_window(self):
        self._stop_run()
        self.root.quit()

    def _stop_run(self):
        self.interrupt = True
        self.run_button.configure(text="Run", command=self._run)

    def _text_to_output(self, text):
        self.text_output_widget.configure(state="normal")
        self.text_output_widget.insert("end", f"{text}\n")
        self.text_output_widget.see("end")
        self.text_output_widget.configure(state="disabled")

    def long_running_method(self):
        num = 100000
        self.progress_bar.configure(maximum=num)
        for i in range(0, num):
            if self.interrupt:
                break
            self._text_to_output(f"Line {i} of {num}")
            self.progress_bar['value'] += 1
        self._stop_run()

    def _run(self):
        self.interrupt = False
        self.run_button.configure(text='Stop', command=self._stop_run)
        threading.Thread(target=self.long_running_method).start()

rt = Tk()
SubtitleExtractorGUI(rt)
rt.mainloop()

What I expect to accomplish is for the loop to insert texts in the text widget while I can still freely move and use other buttons on the app.


问:
What is an interpretation of parts of statsmodels summary of Logistic Regression in Python?
I have results of Logistic Regression from statsmodels in Python like below:

My question is: What is interpretation of marked on yellow columns: coef, std err, z, [0.025, 0.975] ?


问:
How to add pagination to Bootstrap grid html page getting data from pandas dataframe?
I have a web page which includes Crispy Filter and "table" created in Bootstrap grid by iteration from Pandas DataFrame.
Is there some way how to add pagination to this Pandas DataFrame presented in Bootstrap Grid?</p>


问:
Webpack config for multiple apps with a shared folder
Our angular(js) app exists of multiple portals and separate apps. But they share a folder with shared ui components.

The app has the following structure:

```<code>/Styles (for css)
/Assets
/App
 /shared
 / main (this is the landing page with the login logic)
 / portal 1
 / portal 2
 / portal 3
</code>```

Each portal has does not 'know' anything about the other portals. And each portal has its own url path.

So the user goes to site.com and logs in. The user get's the option to go to the portal (depends on the user rights). If the user chooses portal one. The app redirects to site.com/portal1.

I'm struggling to get this working. I've found some old webpack config files, but I don't get this working in webpack 5. Especially with a dev server.

Can anyone get met a help? Thanks!

I tried a few configs. But I cannot find any example config that has this exact use case.

Body:
Our angular(js) app exists of multiple portals and separate apps. But they share a folder with shared ui components.

The app has the following structure:

/Styles (for css)
/Assets
/App
 /shared
 / main (this is the landing page with the login logic)
 / portal 1
 / portal 2
 / portal 3

Each portal has does not 'know' anything about the other portals. And each portal has its own url path.

So the user goes to site.com and logs in. The user get's the option to go to the portal (depends on the user rights). If the user chooses portal one. The app redirects to site.com/portal1.

I'm struggling to get this working. I've found some old webpack config files, but I don't get this working in webpack 5. Especially with a dev server.

Can anyone get met a help? Thanks!

I tried a few configs. But I cannot find any example config that has this exact use case.


问:
Chrome Devtools, Module did not self-register
I would like to have a help in this case below.
So I have to debug a client with chrome devtools remotly, the client already built so I can not rebuild it. It is an .exe file started on a special port in debugging mode.

My problem is, when I would like to use resource, it gave me the error what you can see on the screenshot. Could u give me a suggestion for that? I am not a node js developer, but as I saw some places, everybody suggested the rebuild, but in this case it is not an option for me.

problem

Thank you,


问:
Why doesn't message go to DLQ when retention period expire?
I am using SQS and DLQ to process event. I recently found I am missing messages randomly. One possible reason is the retention period may be reached. But I can't see any messages in DLQ.

Based on AWS doc, it is not clear whether the message goes to DLQ after being deleted. Is there a way to monitor those expired messages?

```<code>You can configure the Amazon SQS message retention period to a value from 1 minute to 14 days. The default is 4 days. Once the message retention quota is reached, your messages are automatically deleted.
</code>```

Body:
I am using SQS and DLQ to process event. I recently found I am missing messages randomly. One possible reason is the retention period may be reached. But I can't see any messages in DLQ.

Based on AWS doc, it is not clear whether the message goes to DLQ after being deleted. Is there a way to monitor those expired messages?

You can configure the Amazon SQS message retention period to a value from 1 minute to 14 days. The default is 4 days. Once the message retention quota is reached, your messages are automatically deleted.


问:
Efficiently display large list of images in multiple rows and columns in Blazor
I am trying to display a list of 1000+ images in Blazor, while keeping it as performant as possible.
The items are displayed in rows, and depending on the size of the browser, the images will become larger/smaller, and the amount of items/row will change.
As of now, the images are loaded in a container with some CSS that sets a width the width of the image and gives it float left, meaning all the images automatically pop up next to each other.
I have the full list of images in my frontend, so I'm not taking from my backend as needed for now.

I would like to display all images in for example 2x my viewport, but not load all the elements that come after.
(https://i.stack.imgur.com/uPTcr.png)

I have tried to use the  component, but that does not seem to work well with having multiple items per row, since this assumes 1 element per row.

Since at the very least I did not want to load all the images at once, I am currently lazyload.js to prevent the images from loading, displaying an empty image if it is not near the viewport. This is not exactly the solution I want however, since I am still adding 1000+ elements to my DOM, causing a delay of a couple of seconds.

Optimally, I would like to have something like the  Component, where I can just give my items, say how many extra rows of images or viewport heights should be loaded, without having to give the height of the items or the amount of columns per row.


问:
How to set value from localStorage to import path. Using vanilla JS and HTML
I have in localStorage array Storage {page-value: 'value'} This value i need use in import. Usually i use import { examples } from "./Objects/Matematika1.js"; In this case everything works well. Array is imported correctly and logic works well. Issue is i need somehow change dynamicky import path. In menu i set IDs and onClick the ID is saved to localStorage

In my case i have value of object name in my localStorage for this demo value is matematika1. I need to use this value while importing.

import { examples } from "./Objects/"+selectedPage+".js"; This code is not working ofc. Google said It's not working like that...

Examples is just array of object. In /Object i have several files with same structured arrays and i need change the path depend on localStorage value.

```<code>import { examples } from "./Objects/Matematika1.js";

//Button logic for showing the result
function toggle(i) {
  const div = document.querySelector(`#result_${i}`);
  if (div.style.display !== "none") {
    div.style.display = "none";
  } else {
    div.style.display = "block";
  }
}
//main logic
const container = document.querySelector("#examples-container");

examples.forEach((ex, i) => {
  const card = document.createElement("div");
  card.classList.add("card");

  const example = document.createElement("div");
  example.classList.add("example");
  example.innerHTML = ex.question;
  card.appendChild(example);

  const button = document.createElement("button");
  button.classList.add("toggle");
  button.innerHTML = "Toggle";
  button.addEventListener("click", () => toggle(i)); // Here is the event listener
  card.appendChild(button);

  const result = document.createElement("div");
  result.id = "result_" + i;
  result.style.display = "none";
  result.classList.add("result");
  result.innerHTML = ex.answer;
  card.appendChild(result);

  container.appendChild(card);
});

//getting localStorage to string variable
const selectedPage = localStorage.getItem("page-value");
selectedPage.toString();
</code>```

Is using localStorage good idea for this is or do you know something better? I practice programing few months so usually i do first idea what i get..

Body:
I have in localStorage array Storage {page-value: 'value'} This value i need use in import. Usually i use import { examples } from "./Objects/Matematika1.js"; In this case everything works well. Array is imported correctly and logic works well. Issue is i need somehow change dynamicky import path. In menu i set IDs and onClick the ID is saved to localStorage

In my case i have value of object name in my localStorage for this demo value is matematika1. I need to use this value while importing.

import { examples } from "./Objects/"+selectedPage+".js"; This code is not working ofc. Google said It's not working like that...

Examples is just array of object. In /Object i have several files with same structured arrays and i need change the path depend on localStorage value.

import { examples } from "./Objects/Matematika1.js";

//Button logic for showing the result
function toggle(i) {
  const div = document.querySelector(`#result_${i}`);
  if (div.style.display !== "none") {
    div.style.display = "none";
  } else {
    div.style.display = "block";
  }
}
//main logic
const container = document.querySelector("#examples-container");

examples.forEach((ex, i) => {
  const card = document.createElement("div");
  card.classList.add("card");

  const example = document.createElement("div");
  example.classList.add("example");
  example.innerHTML = ex.question;
  card.appendChild(example);

  const button = document.createElement("button");
  button.classList.add("toggle");
  button.innerHTML = "Toggle";
  button.addEventListener("click", () => toggle(i)); // Here is the event listener
  card.appendChild(button);

  const result = document.createElement("div");
  result.id = "result_" + i;
  result.style.display = "none";
  result.classList.add("result");
  result.innerHTML = ex.answer;
  card.appendChild(result);

  container.appendChild(card);
});

//getting localStorage to string variable
const selectedPage = localStorage.getItem("page-value");
selectedPage.toString();

Is using localStorage good idea for this is or do you know something better? I practice programing few months so usually i do first idea what i get..


问:
Iframe access on elements
I use an Iframe with an external API, which I don't control. My goal is to add Javascript code in my Website, to change the style of a few elements in the Iframe. First I considered using

```<code>document.getElementById(iframeId).contentWindow.document.getElementById(elementId);
</code>```

but I soon recognized that it will not be successful because I am getting security issues. I tested a bit and found out when I inspect the element in the Iframe, which I want to change, I am able to get the element simply by using:

```<code>document.getElementById(elementId);
</code>```

I don't understand.  Why does this technique only work when I inspect the correct element first? And is there any way I can use this trick for my normal JS backend?

Title: Iframe access on elements

Body:
I use an Iframe with an external API, which I don't control. My goal is to add Javascript code in my Website, to change the style of a few elements in the Iframe. First I considered using

document.getElementById(iframeId).contentWindow.document.getElementById(elementId);

but I soon recognized that it will not be successful because I am getting security issues. I tested a bit and found out when I inspect the element in the Iframe, which I want to change, I am able to get the element simply by using:

document.getElementById(elementId);

I don't understand.  Why does this technique only work when I inspect the correct element first? And is there any way I can use this trick for my normal JS backend?


问:
Kubernetes + Ambassador + Basic Auth + JWT
Created a container with Postgrest (REST API to Postgres tables/views). Postgrest uses JWT authentication to derive user name to connect to the database. Basically a header with "Authorization: Bearer ". The container is deployed inside Kubernetes. To protect from unauthorized access is used Ambassador. Ambassador has basic authentication and requests user and password when trying to access the container.

Trying to access this configuration with Postman or curl can't make it work with both authentications active. So that Ambassador asks for user and password and after authenticating user the request proceeds with the JWT token used by Postgrest. Is there at all a way to do that?

Tried to put both authentications together as header "Authorization: Basic <username:password in base64>, Bearer ". Does not work.
Tried using Poorman's Bearer Authentication from here: API key auth for Ambassador . Also does not work.
Ended up using bypass_auth: true in the Ambassador mapping for the Postgrest container. Considering to try JWT filter in the Ambassador mapping (https://www.getambassador.io/docs/edge-stack/latest/topics/using/filters/jwt).


问:
Missing Class Properties Transform Error using Chart.js in React
I'm trying to generate my first chart in react using Chart.js, and I cannot seem to get over this error. I'm using "react-chartjs-2": "^5.1.0", "chart.js": "^4.1.0", and "react": "^18.2.0".

Here is the Error:

```<code>
    Failed to compile.

    ./node_modules/chart.js/dist/chart.js
    SyntaxError: /Users/johnwomelsdorf/Documents/Code/Ski-Website-              FrontEnd/node_modules/chart.js/dist/chart.js: Missing class properties transform.
    566 |     };
    567 | class DatasetController {

    568 |  static defaults = {};
    |  ^^^^^^^^^^^^^^^^^^^^^
    569 |  static datasetElementType = null;
    570 |  static dataElementType = null;
    571 |  constructor(chart, datasetIndex){.at transformFile.next (\<anonymous\>)
    at run.next (\<anonymous\>)
    at transform.next (\<anonymous\>)\`
</code>```

And here is my Code:
App.js:

```<code>
    import React, { Component } from 'react';
    import Navbar from './components/NavBar';
    import Conditions from './components/conditions';
    import Graph from './components/graph';
    import { Data } from './components/data';

    class App extends Component {
    state = {
    resorts : \['Okemo', 'Snow', 'Hunter', 'Sunapee', 'Stowe'\],
    resort : 'Okemo'
    };

        render() {
           return (
                <div className='main__wrap'>
                    <Navbar />
                    <div className='conditions__box'>
                        <h2>Current Conditions</h2>
                        <Conditions resort = {this.state.resort} />
                   </div>
                    <div className='graph__box'>
                        <h2>Conditions this year</h2>
                        <Graph chartData={Data}/>
                    </div>
                </div>

            );
        };

    }

    export default App;
</code>```

graph.jsx:

```<code>
    import React from 'react';
    import { Chart as ChartJS } from "chart.js/auto"
    import { Line } from 'react-chartjs-2';

    function Graph(chartData) {
    return \<Line data={chartData} /\>;
    }

    export default Graph;
</code>```

data.js:

```<code>
    export const Data = {
        labels: \[1, 2, 3, 4, 5, 6\],
        datasets: \[
        {
            label: "% Lifts Open",
            data: \[33, 40, 80, 90, 100, 60\]
            //borderColor: "rgba(19, 49, 92, 1)",
            //backgroundColor: "rgba(19, 49, 92,0.2)",
        },
        {
            label: "% Trails Open",
            data: \[15, 30, 60, 95, 95, 45\]
            //borderColor: "rgba(141, 169, 196, 1)",
            //backgroundColor: "rgba(141, 169, 196,0.2)",
        },
        {
            label: "% Terrain Open",
            data: \[9, 23, 65, 83, 90, 34\]
            //borderColor: "rgba(19, 64, 116, 1)",
            //backgroundColor: "rgba(19, 64, 116,0.2)",
        }
        ]
    };
</code>```

Thank you, hoping this is a simple misunderstanding on my part.

I have tried changing the shape of the data, as well as the way it is called by the graph.

Body:
I'm trying to generate my first chart in react using Chart.js, and I cannot seem to get over this error. I'm using "react-chartjs-2": "^5.1.0", "chart.js": "^4.1.0", and "react": "^18.2.0".

Here is the Error:

    Failed to compile.

    ./node_modules/chart.js/dist/chart.js
    SyntaxError: /Users/johnwomelsdorf/Documents/Code/Ski-Website-              FrontEnd/node_modules/chart.js/dist/chart.js: Missing class properties transform.
    566 |     };
    567 | class DatasetController {

    568 |  static defaults = {};
    |  ^^^^^^^^^^^^^^^^^^^^^
    569 |  static datasetElementType = null;
    570 |  static dataElementType = null;
    571 |  constructor(chart, datasetIndex){.at transformFile.next (\<anonymous\>)
    at run.next (\<anonymous\>)
    at transform.next (\<anonymous\>)\`

And here is my Code:
App.js:

    import React, { Component } from 'react';
    import Navbar from './components/NavBar';
    import Conditions from './components/conditions';
    import Graph from './components/graph';
    import { Data } from './components/data';

    class App extends Component {
    state = {
    resorts : \['Okemo', 'Snow', 'Hunter', 'Sunapee', 'Stowe'\],
    resort : 'Okemo'
    };

        render() {
           return (

                    <Navbar />

Current Conditions

                        <Conditions resort = {this.state.resort} />

Conditions this year

                        <Graph chartData={Data}/>

            );
        };

    }

    export default App;

graph.jsx:

    import React from 'react';
    import { Chart as ChartJS } from "chart.js/auto"
    import { Line } from 'react-chartjs-2';

    function Graph(chartData) {
    return \<Line data={chartData} /\>;
    }

    export default Graph;

data.js:

    export const Data = {
        labels: \[1, 2, 3, 4, 5, 6\],
        datasets: \[
        {
            label: "% Lifts Open",
            data: \[33, 40, 80, 90, 100, 60\]
            //borderColor: "rgba(19, 49, 92, 1)",
            //backgroundColor: "rgba(19, 49, 92,0.2)",
        },
        {
            label: "% Trails Open",
            data: \[15, 30, 60, 95, 95, 45\]
            //borderColor: "rgba(141, 169, 196, 1)",
            //backgroundColor: "rgba(141, 169, 196,0.2)",
        },
        {
            label: "% Terrain Open",
            data: \[9, 23, 65, 83, 90, 34\]
            //borderColor: "rgba(19, 64, 116, 1)",
            //backgroundColor: "rgba(19, 64, 116,0.2)",
        }
        ]
    };

Thank you, hoping this is a simple misunderstanding on my part.

I have tried changing the shape of the data, as well as the way it is called by the graph.


问:
Querydsl Spring 3 compilation problems
When I am trying to build my project I get "Compilation failure
[ERROR] Attempt to recreate a file for type NoteApp.Repository.Entities.QNote
" error. My code is generating Qclass as expected, but I can't make it work past it.

My pom file

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>

   <parent>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-parent</artifactId>
      <version>3.0.1</version>
      <relativePath/>
   </parent>

   <groupId>pl.wawrzyniak</groupId>
   <artifactId>NoteApp</artifactId>
   <version>0.0.1-SNAPSHOT</version>
   <name>NoteApp</name>
   <description>Simple note app for CV</description>
   <properties>
      <java.version>17</java.version>
   </properties>
   <dependencies>
      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-data-jpa</artifactId>
      </dependency>
      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-web</artifactId>
      </dependency>

      <dependency>
         <groupId>com.h2database</groupId>
         <artifactId>h2</artifactId>
         <scope>runtime</scope>
      </dependency>

      <dependency>
         <groupId>com.querydsl</groupId>
         <artifactId>querydsl-apt</artifactId>
         <version>5.0.0</version>
         <scope>provided</scope>
         <classifier>jakarta</classifier>
      </dependency>
      <dependency>
         <groupId>com.querydsl</groupId>
         <artifactId>querydsl-jpa</artifactId>
         <version>5.0.0</version>
         <classifier>jakarta</classifier>
      </dependency>

      <dependency>
         <groupId>org.modelmapper</groupId>
         <artifactId>modelmapper</artifactId>
         <version>3.1.1</version>
      </dependency>

      <dependency>
         <groupId>org.projectlombok</groupId>
         <artifactId>lombok</artifactId>
         <optional>true</optional>
      </dependency>
      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-test</artifactId>
         <scope>test</scope>
      </dependency>
   </dependencies>

   <build>
      <plugins>
         <plugin>
            <groupId>com.mysema.maven</groupId>
            <artifactId>apt-maven-plugin</artifactId>
            <version>1.1.3</version>
            <executions>
               <execution>
                  <goals>
                     <goal>process</goal>
                  </goals>
                  <configuration>
                     <outputDirectory>target/generated-sources/java</outputDirectory>
                     <processor>com.querydsl.apt.jpa.JPAAnnotationProcessor</processor>
                  </configuration>
               </execution>
            </executions>
         </plugin>

         <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
               <excludes>
                  <exclude>
                     <groupId>org.projectlombok</groupId>
                     <artifactId>lombok</artifactId>
                  </exclude>
               </excludes>
            </configuration>
         </plugin>

      </plugins>
   </build>

</project>

```

Is it something with my code? Or just problems with Spring 3 working with Querydsl?

I don't know what else i can try, sometimes my project is building and compiling till the end, but only when QClasses are not generated at all (which is to expect when there is some problem with recreating them).

Title: Querydsl Spring 3 compilation problems

Body:
When I am trying to build my project I get "Compilation failure
[ERROR] Attempt to recreate a file for type NoteApp.Repository.Entities.QNote
" error. My code is generating Qclass as expected, but I can't make it work past it.

My pom file

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>

   <parent>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-parent</artifactId>
      <version>3.0.1</version>
      <relativePath/>
   </parent>

   <groupId>pl.wawrzyniak</groupId>
   <artifactId>NoteApp</artifactId>
   <version>0.0.1-SNAPSHOT</version>
   <name>NoteApp</name>
   <description>Simple note app for CV</description>
   <properties>
      <java.version>17</java.version>
   </properties>
   <dependencies>
      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-data-jpa</artifactId>
      </dependency>
      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-web</artifactId>
      </dependency>

      <dependency>
         <groupId>com.h2database</groupId>
         <artifactId>h2</artifactId>
         <scope>runtime</scope>
      </dependency>

      <dependency>
         <groupId>com.querydsl</groupId>
         <artifactId>querydsl-apt</artifactId>
         <version>5.0.0</version>
         <scope>provided</scope>
         <classifier>jakarta</classifier>
      </dependency>
      <dependency>
         <groupId>com.querydsl</groupId>
         <artifactId>querydsl-jpa</artifactId>
         <version>5.0.0</version>
         <classifier>jakarta</classifier>
      </dependency>

      <dependency>
         <groupId>org.modelmapper</groupId>
         <artifactId>modelmapper</artifactId>
         <version>3.1.1</version>
      </dependency>

      <dependency>
         <groupId>org.projectlombok</groupId>
         <artifactId>lombok</artifactId>
         <optional>true</optional>
      </dependency>
      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-test</artifactId>
         <scope>test</scope>
      </dependency>
   </dependencies>

   <build>
      <plugins>
         <plugin>
            <groupId>com.mysema.maven</groupId>
            <artifactId>apt-maven-plugin</artifactId>
            <version>1.1.3</version>
            <executions>
               <execution>
                  <goals>
                     <goal>process</goal>
                  </goals>
                  <configuration>
                     <outputDirectory>target/generated-sources/java</outputDirectory>
                     <processor>com.querydsl.apt.jpa.JPAAnnotationProcessor</processor>
                  </configuration>
               </execution>
            </executions>
         </plugin>

         <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
               <excludes>
                  <exclude>
                     <groupId>org.projectlombok</groupId>
                     <artifactId>lombok</artifactId>
                  </exclude>
               </excludes>
            </configuration>
         </plugin>

      </plugins>
   </build>

</project>

Is it something with my code? Or just problems with Spring 3 working with Querydsl?

I don't know what else i can try, sometimes my project is building and compiling till the end, but only when QClasses are not generated at all (which is to expect when there is some problem with recreating them).


问:
How can I import font with JavaScript?
I want to change the typeface of a blotter.js animation.
Right now, I can just use the standard-typefaces. What I want to achieve is to use the typeface, that matches the whole design.

I tried to import it as a const. But it's still either displayed with the default typeface or the typo get's really buggy.

`

```<code>const timmonsNy = new FontFace("timmonsNy", "url(./typefaces/TIMMONSNY2.0-Regular.woff2)", {});
        document.fonts.add(timmonsNy);

        let text = new Blotter.Text("404", {
            family: timmonsNy,
            size: 375,
            fill: "#000",
            paddingLeft: 80,
            paddingRight: 80,
            paddingTop: 50,
            paddingBottom: 50,
        })
</code>```

`

Title: How can I import font with JavaScript?

Body:
I want to change the typeface of a blotter.js animation.
Right now, I can just use the standard-typefaces. What I want to achieve is to use the typeface, that matches the whole design.

I tried to import it as a const. But it's still either displayed with the default typeface or the typo get's really buggy.

`

const timmonsNy = new FontFace("timmonsNy", "url(./typefaces/TIMMONSNY2.0-Regular.woff2)", {});
        document.fonts.add(timmonsNy);

        let text = new Blotter.Text("404", {
            family: timmonsNy,
            size: 375,
            fill: "#000",
            paddingLeft: 80,
            paddingRight: 80,
            paddingTop: 50,
            paddingBottom: 50,
        })

`


问:
SD card does not return token on SPI single block read
I have a Buffalo SDHC SD card with 4GB of storage, and a Raspberry Pi Pico. I have connected the SD card to the Pico's relevant SPI pins and have set the SPI clock speed to 1MHz.

I have reset the SD card with command 0, and have received a successful R1 response of 1 (to clarify, that is all I have done).

Now, I want to read a single block (512 bytes), and after researching, the command code is 17 and the arguments is the block index I want to read (in my case, 0 - 0-511 bytes). I have sent the command, and have received an R1 response of 1 (meaning card is in idle mode), however after some research, I was supposed to also receive a "token" containing 0xFE indicating a successful read followed by the bytes in the sector, or an error code.

However, the only things I am receiving after the initial R1 response are 0xFF bytes which would indicate the SD card is idle. I have tried reading several thousand bytes from the SD card, perhaps thinking the read is taking a while, but nothing, I am only receiving 0xFF bytes with the token nowhere to be found.

Does anyone have any advice on why this could be the case? I have looked over my command syntax and have found it to be correct:

(bits + cmd code) 01010001 (32-bit arguments) 00000000 00000000 00000000 00000000 (CRC value set to 0 due to checking disabled + end bit) 00000001

I have also tried experimenting with a different argument and different clock speeds but to no avail.


问:
Why does Skipfiles not skip files on external api's?
I am trying to debug the code. Debugging my own code, which runs in Chrome, is possible. My code makes use of an external API and unfortunately i can not prevent my Debugger from stepping into the API's code.
My debugger always steps from my main.js to the Viewer3D.js file which is located at developer.api.autodesk.com/**/*.js. Then my callStack gets so big, that debugging is impossible.

I added

```<code>"developer.api.autodesk.com/**/*.js"
</code>```

to my launch.json but it still doesn't work. I always get into this file.

This is how my launch.json looks like

```<code>{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Clientseitiges Debuggen",
      "port": 9222,
      "request": "attach",
      "type": "chrome",
      "webRoot": "${workspaceFolder}/wwwroot",
      "skipFiles": ["<node_internals>/**",
                    "developer.api.autodesk.com/**/*.js"],
      "resolveSourceMapLocations": [
        "${workspaceFolder}/**",
        "!**/node_modules/**"
      ]
    },
    {
      "name": "debug meinen viewer",
      "port": 9229,
      "request": "attach",
      "skipFiles": ["<node_internals>/**"],
      "type": "node"
    },
    {
      "type": "node",
      "request": "launch",
      "name": "Launch meinen Viewer",
      "runtimeExecutable": "npm",
      "runtimeArgs": ["start"],
      "envFile": "${workspaceFolder}/.env",
      "skipFiles": ["<node_internals>/**/*.js"]
    }
  ]
}
</code>```

Body:
I am trying to debug the code. Debugging my own code, which runs in Chrome, is possible. My code makes use of an external API and unfortunately i can not prevent my Debugger from stepping into the API's code.
My debugger always steps from my main.js to the Viewer3D.js file which is located at developer.api.autodesk.com/**/*.js. Then my callStack gets so big, that debugging is impossible.

I added

"developer.api.autodesk.com/**/*.js"

to my launch.json but it still doesn't work. I always get into this file.

This is how my launch.json looks like

{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Clientseitiges Debuggen",
      "port": 9222,
      "request": "attach",
      "type": "chrome",
      "webRoot": "${workspaceFolder}/wwwroot",
      "skipFiles": ["<node_internals>/**",
                    "developer.api.autodesk.com/**/*.js"],
      "resolveSourceMapLocations": [
        "${workspaceFolder}/**",
        "!**/node_modules/**"
      ]
    },
    {
      "name": "debug meinen viewer",
      "port": 9229,
      "request": "attach",
      "skipFiles": ["<node_internals>/**"],
      "type": "node"
    },
    {
      "type": "node",
      "request": "launch",
      "name": "Launch meinen Viewer",
      "runtimeExecutable": "npm",
      "runtimeArgs": ["start"],
      "envFile": "${workspaceFolder}/.env",
      "skipFiles": ["<node_internals>/**/*.js"]
    }
  ]
}


问:
Laravel 9 Eloquent - How to get entities that have certain properties in a ManyToMany relationship?
Hello to everybody.

Please help with a query via Eloquent.

I have Building and Pictogram models. Among them is the manyToMany relationship with the connection table. Everything works normally. But I can't figure out how to get Buildings that definitely have Pictograms attached to them. I know how to make a query that returns Buildings that have at least one of the Pictograms I specified.

Example:

```<code>$buildings->whereHas("pictograms", function (Builder $query) use ($selected_pictograms){
   $query->whereIn("slug", $selected_pictograms);
});
</code>```

but I don't know how to get the Buildings that have all of the Pictograms I specified.

Thank you for your help

I'm trying combinations of different procedures using whereIn() or whereRelation() or has() and it still fails

Body:
Hello to everybody.

Please help with a query via Eloquent.

I have Building and Pictogram models. Among them is the manyToMany relationship with the connection table. Everything works normally. But I can't figure out how to get Buildings that definitely have Pictograms attached to them. I know how to make a query that returns Buildings that have at least one of the Pictograms I specified.

Example:

$buildings->whereHas("pictograms", function (Builder $query) use ($selected_pictograms){
   $query->whereIn("slug", $selected_pictograms);
});

but I don't know how to get the Buildings that have all of the Pictograms I specified.

Thank you for your help

I'm trying combinations of different procedures using whereIn() or whereRelation() or has() and it still fails


问:
.NET 6 Web api running locally in ubuntu fails during RESTful calls
I have a web API that was originally built in a local Windows environment. Since then, it has been cloned from the repo and I have been trying to work on it locally via my Ubuntu machine.

The project successfully builds and launches in debug mode enough for me to call an endpoint via swagger.

The call I'm making is just to a simple endpoint, https://localhost:7115/register:

{
    "username": "string",
    "email": "user@example.com",
    "password": "string"
}
```
<p>When I do so it fails and the server response from swagger is:</p>
```Failed to fetch.
Possible Reasons:

CORS
Network Failure
URL scheme must be "http" or "https" for CORS request.
```
<p>When testing through an API checker like insomnia the response is:</p>
```Error: Stream error in the HTTP/2 framing layer
```
<p>why does this work on my Windows machine, but fail on my Ubuntu machine?</p>
<p>The only thing I can think of is my <code>program.cs</code> file, but I can't see anything wrong with it?</p>
<pre class="lang-cs prettyprint-override"><code>
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
using Microsoft.IdentityModel.Tokens;
using PingMessenger.Data.Authentication;
using PingMessenger.Data.Config;
using PingMessenger.Data.Context;
using System.Text;

var MyAllowSpecificOrigins = "_myAllowSpecificOrigins";

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.

builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();

//CORS
builder.Services.AddCors(options =>
{
    options.AddPolicy(name: MyAllowSpecificOrigins,
    policy =>
    {
        policy.WithOrigins("http://localhost:3000/").AllowAnyMethod().AllowAnyHeader();
    });
});

//db
builder.Services.AddDbContext<PingContext>(option =>
    option.UseSqlServer(builder.Configuration.GetConnectionString("PingMessengerDbConnection")));

builder.Services.Configure<AppSettings>(builder.Configuration.GetSection("ConnectionStrings"));

builder.Services.AddDbContext<PingContext>(options => options.UseSqlServer(builder.Configuration.GetConnectionString("PingMessengerDbConnection")));

builder.Services
    .AddIdentity<IdentityUser, IdentityRole>(options => options.SignIn.RequireConfirmedAccount = true)
    .AddEntityFrameworkStores<PingContext>();

// Adding Authentication
builder.Services
    .AddAuthentication(options =>
    {
        options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
        options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
        options.DefaultScheme = JwtBearerDefaults.AuthenticationScheme;
    })

    // Adding Jwt Bearer
    .AddJwtBearer(options =>
    {
        options.SaveToken = true;
        options.RequireHttpsMetadata = false;
        options.TokenValidationParameters = new TokenValidationParameters()
        {
            ValidateIssuer = true,
            ValidateAudience = true,
            ValidAudience = builder.Configuration["JWT:ValidAudience"],
            ValidIssuer = builder.Configuration["JWT:ValidIssuer"],
            IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(builder.Configuration["JWT:Secret"]))
        };
    });

var app = builder.Build();
app.UseCors(x => x
    .AllowAnyMethod()
    .AllowAnyHeader()
    .SetIsOriginAllowed(origin => true) // allow any origin
    .AllowCredentials()); // allow credentials

// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
    app.UseSwagger();
    app.UseSwaggerUI();
}

app.UseSwagger();
app.UseSwaggerUI();
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();
</code>```

Body:
I have a web API that was originally built in a local Windows environment. Since then, it has been cloned from the repo and I have been trying to work on it locally via my Ubuntu machine.

The project successfully builds and launches in debug mode enough for me to call an endpoint via swagger.

The call I'm making is just to a simple endpoint, https://localhost:7115/register:

{
    "username": "string",
    "email": "user@example.com",
    "password": "string"
}

When I do so it fails and the server response from swagger is:

Failed to fetch.
Possible Reasons:

CORS
Network Failure
URL scheme must be "http" or "https" for CORS request.

When testing through an API checker like insomnia the response is:

Error: Stream error in the HTTP/2 framing layer

why does this work on my Windows machine, but fail on my Ubuntu machine?

The only thing I can think of is my program.cs file, but I can't see anything wrong with it?

using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
using Microsoft.IdentityModel.Tokens;
using PingMessenger.Data.Authentication;
using PingMessenger.Data.Config;
using PingMessenger.Data.Context;
using System.Text;

var MyAllowSpecificOrigins = "_myAllowSpecificOrigins";

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.

builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();

//CORS
builder.Services.AddCors(options =>
{
    options.AddPolicy(name: MyAllowSpecificOrigins,
    policy =>
    {
        policy.WithOrigins("http://localhost:3000/").AllowAnyMethod().AllowAnyHeader();
    });
});

//db
builder.Services.AddDbContext<PingContext>(option =>
    option.UseSqlServer(builder.Configuration.GetConnectionString("PingMessengerDbConnection")));

builder.Services.Configure<AppSettings>(builder.Configuration.GetSection("ConnectionStrings"));

builder.Services.AddDbContext<PingContext>(options => options.UseSqlServer(builder.Configuration.GetConnectionString("PingMessengerDbConnection")));

builder.Services
    .AddIdentity<IdentityUser, IdentityRole>(options => options.SignIn.RequireConfirmedAccount = true)
    .AddEntityFrameworkStores<PingContext>();

// Adding Authentication
builder.Services
    .AddAuthentication(options =>
    {
        options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
        options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
        options.DefaultScheme = JwtBearerDefaults.AuthenticationScheme;
    })

    // Adding Jwt Bearer
    .AddJwtBearer(options =>
    {
        options.SaveToken = true;
        options.RequireHttpsMetadata = false;
        options.TokenValidationParameters = new TokenValidationParameters()
        {
            ValidateIssuer = true,
            ValidateAudience = true,
            ValidAudience = builder.Configuration["JWT:ValidAudience"],
            ValidIssuer = builder.Configuration["JWT:ValidIssuer"],
            IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(builder.Configuration["JWT:Secret"]))
        };
    });

var app = builder.Build();
app.UseCors(x => x
    .AllowAnyMethod()
    .AllowAnyHeader()
    .SetIsOriginAllowed(origin => true) // allow any origin
    .AllowCredentials()); // allow credentials

// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
    app.UseSwagger();
    app.UseSwaggerUI();
}

app.UseSwagger();
app.UseSwaggerUI();
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();


问:
Changing order of decimal numbers causing differnet results
I'm learning Python. Maybe this is a silly mistake and not related to Python at all but appreciate some clarity.

I have the following code.

from decimal import Decimal

expense = Decimal('10.00')
v = Decimal('93.93863013698630136986301369')
n = Decimal('46.90520547945205479452054796')
yearly_expense = Decimal('0')

vn = v + n

r1 = expense - yearly_expense + v + n
r2 = expense - yearly_expense + vn

print(r1)
print(r2)
```
<p>When I execute I get</p>
<pre class="lang-bash prettyprint-override"><code>150.8438356164383561643835617
150.8438356164383561643835616
</code>```

Note the last digits. Why the 2 numbers are different?

Body:
I'm learning Python. Maybe this is a silly mistake and not related to Python at all but appreciate some clarity.

I have the following code.

from decimal import Decimal

expense = Decimal('10.00')
v = Decimal('93.93863013698630136986301369')
n = Decimal('46.90520547945205479452054796')
yearly_expense = Decimal('0')

vn = v + n

r1 = expense - yearly_expense + v + n
r2 = expense - yearly_expense + vn

print(r1)
print(r2)

When I execute I get

150.8438356164383561643835617
150.8438356164383561643835616

Note the last digits. Why the 2 numbers are different?


问:
How do I build a Unity project using the Firebase SDK for tvOS?
Using macOS 13.1, tvOS 16.2, Xcode 14.2, Unity 2021.3.16f1, Cocoapods 1.11.3, and Firebase SDK for Unity 10.3.

I am able to build our project for macOS and iOS from Unity without any problems. However, once I re-target tvOS (device, not simulator), the project is raising hundreds of build errors that look like this:

```<code>Undefined symbols for architecture arm64:
  "_Firebase_App_CSharp_AppEnableLogCallback", referenced from:
      _AppUtil_AppEnableLogCallback_m9FE8159D116019E4E918F4B7CEC39687DD64B2EA in Firebase.App.o
      _AppUtilPINVOKE_AppEnableLogCallback_m5BB69B725FD3DF1FE26C20DE516F14E02E82BDB3 in Firebase.App.o
  "_Firebase_App_CSharp_AppGetLogLevel", referenced from:
      _AppUtilPINVOKE_AppGetLogLevel_m1FA70677F6D87B20549848E73B88B7A9CE5E6A33 in Firebase.App.o
      _AppUtil_AppGetLogLevel_m613922E721681B614FB13D09809624C3EA70497E in Firebase.App.o
  "_Firebase_App_CSharp_AppOptionsInternal_ApiKey_get", referenced from:
      _AppOptionsInternal_get_ApiKey_m4FEA968CCE295C61306024A53B87EB462C793FDD in Firebase.App.o
      _AppUtilPINVOKE_AppOptionsInternal_ApiKey_get_mE56BE832D66D5DF3061815D009AE7F2AEB6C59F8 in Firebase.App.o
  "_Firebase_App_CSharp_AppOptionsInternal_ApiKey_set", referenced from:
      _AppOptionsInternal_set_ApiKey_mCF8BDC7C43BB152665C3F48096C5B239291B75DD in Firebase.App.o
      _AppUtilPINVOKE_AppOptionsInternal_ApiKey_set_m47AA8DEF19EB00D363BD710D4AB35D0F71D3810C in Firebase.App.o

</code>```

I looked online, but didn't see anyone else having this problem. It's like there's a file missing from the build, but my searches within the project haven't been turning up anything.

How do I get this to build? Or does the Firebase SDK just not support tvOS?

I was expecting this to build like it does on iOS and macOS.

Body:
Using macOS 13.1, tvOS 16.2, Xcode 14.2, Unity 2021.3.16f1, Cocoapods 1.11.3, and Firebase SDK for Unity 10.3.

I am able to build our project for macOS and iOS from Unity without any problems. However, once I re-target tvOS (device, not simulator), the project is raising hundreds of build errors that look like this:

Undefined symbols for architecture arm64:
  "_Firebase_App_CSharp_AppEnableLogCallback", referenced from:
      _AppUtil_AppEnableLogCallback_m9FE8159D116019E4E918F4B7CEC39687DD64B2EA in Firebase.App.o
      _AppUtilPINVOKE_AppEnableLogCallback_m5BB69B725FD3DF1FE26C20DE516F14E02E82BDB3 in Firebase.App.o
  "_Firebase_App_CSharp_AppGetLogLevel", referenced from:
      _AppUtilPINVOKE_AppGetLogLevel_m1FA70677F6D87B20549848E73B88B7A9CE5E6A33 in Firebase.App.o
      _AppUtil_AppGetLogLevel_m613922E721681B614FB13D09809624C3EA70497E in Firebase.App.o
  "_Firebase_App_CSharp_AppOptionsInternal_ApiKey_get", referenced from:
      _AppOptionsInternal_get_ApiKey_m4FEA968CCE295C61306024A53B87EB462C793FDD in Firebase.App.o
      _AppUtilPINVOKE_AppOptionsInternal_ApiKey_get_mE56BE832D66D5DF3061815D009AE7F2AEB6C59F8 in Firebase.App.o
  "_Firebase_App_CSharp_AppOptionsInternal_ApiKey_set", referenced from:
      _AppOptionsInternal_set_ApiKey_mCF8BDC7C43BB152665C3F48096C5B239291B75DD in Firebase.App.o
      _AppUtilPINVOKE_AppOptionsInternal_ApiKey_set_m47AA8DEF19EB00D363BD710D4AB35D0F71D3810C in Firebase.App.o

I looked online, but didn't see anyone else having this problem. It's like there's a file missing from the build, but my searches within the project haven't been turning up anything.

How do I get this to build? Or does the Firebase SDK just not support tvOS?

I was expecting this to build like it does on iOS and macOS.


问:
Difference on Sales based in conditions on another column in Python
I have below data set, sometimes clients can transfer Amounts from Category A to B, or B to A.
I'm looking to get a new column just when a brand new record is created for Category A just when there is an increase in "TotalPerClient" from previous Month.
for example: value = 20 on July column "BrandNewCat_A" is because there was an increase in "TotalPerCxCateg" A by 70 from previous Month, but also because "TotalPerClient" increased by 20 from previous Month

I used below code to create 2 columns "TotalPerCxCateg" and "TotalPerCx" but now I'm stuck how to create column "BrandNewCateg_A"

```<code>df['TotalPerCxCateg'] =  df.groupby(['Date','Client', 'Categ'])['Amount'].transform('sum')
df['TotalPerCx'] =  df.groupby(['Date','Client'])['Amount'].transform('sum')
</code>```
```<code>Client   Date     ProdID    Amount  Categ
ABC Inc  2022-06      4      50      A
ABC Inc  2022-06      5      50      B
ABC Inc  2022-07      4     120      A
ABC Inc  2022-08      4      40      A
ABC Inc  2022-08      5      40      B
ABC Inc  2022-08      6      30      B
</code>```

Desired output

```<code>Client   Date   ProdID  Amount  Categ TotalPerCxCateg TotalPerCx BrandNewCateg_A
ABC Inc  Jun-22   4      50      A           50             100       0
ABC Inc  Jun-22   5      50      B           50             100       0
ABC Inc  Jul-22   4     120      A           120            120       20
ABC Inc  Aug-22   4      40      A           40             110       0
ABC Inc  Aug-22   5      40      B           70             110       0
ABC Inc  Aug-22   6      30      B           70             110       0
</code>```

Body:
I have below data set, sometimes clients can transfer Amounts from Category A to B, or B to A.
I'm looking to get a new column just when a brand new record is created for Category A just when there is an increase in "TotalPerClient" from previous Month.
for example: value = 20 on July column "BrandNewCat_A" is because there was an increase in "TotalPerCxCateg" A by 70 from previous Month, but also because "TotalPerClient" increased by 20 from previous Month

I used below code to create 2 columns "TotalPerCxCateg" and "TotalPerCx" but now I'm stuck how to create column "BrandNewCateg_A"

df['TotalPerCxCateg'] =  df.groupby(['Date','Client', 'Categ'])['Amount'].transform('sum')
df['TotalPerCx'] =  df.groupby(['Date','Client'])['Amount'].transform('sum')

Client   Date     ProdID    Amount  Categ
ABC Inc  2022-06      4      50      A
ABC Inc  2022-06      5      50      B
ABC Inc  2022-07      4     120      A
ABC Inc  2022-08      4      40      A
ABC Inc  2022-08      5      40      B
ABC Inc  2022-08      6      30      B

Desired output

Client   Date   ProdID  Amount  Categ TotalPerCxCateg TotalPerCx BrandNewCateg_A
ABC Inc  Jun-22   4      50      A           50             100       0
ABC Inc  Jun-22   5      50      B           50             100       0
ABC Inc  Jul-22   4     120      A           120            120       20
ABC Inc  Aug-22   4      40      A           40             110       0
ABC Inc  Aug-22   5      40      B           70             110       0
ABC Inc  Aug-22   6      30      B           70             110       0


问:
All packages are not available for download! The following packages are not available: - Package id emulator
I downloaded Android Studio and I can't correct this error.Help,please

I tried to figure out the SDK Tools?but  it didn't work


问:
store all http request, response with ahoy gem
I want made that all log will store database.
therefore I try setup Ahoy gem in my Rails Api only Project.
Ahoy is awesome gem. but there is not Best pratice on README.md of Ahoy github.

i hope store http request header, reponse header and body with Ahoy.
this code is track_action for storing event in ApplicationController.

```<code>class ApplicationController < ActionController::Base
  after_action :track_action

  protected

  def track_action
     ahoy.track "Viewed #{controller_name}##{action_name}", { request: { header: request.headers },
                                                              response: { headers: response.headers, body: JSON.parse(response.body) } }

  end
end

</code>```

but i got error.

```<code>Completed 500 Internal Server Error in 493ms (Views: 34.8ms | ActiveRecord: 89.1ms | Allocations: 317174)

SystemStackError (stack level too deep):

app/controllers/application_controller.rb:14:in `track_action'
</code>```

What is Best practice ahoy.track for storing all request, response log?

storing all http request, response with Ahoy gem

Body:
I want made that all log will store database.
therefore I try setup Ahoy gem in my Rails Api only Project.
Ahoy is awesome gem. but there is not Best pratice on README.md of Ahoy github.

i hope store http request header, reponse header and body with Ahoy.
this code is track_action for storing event in ApplicationController.

class ApplicationController < ActionController::Base
  after_action :track_action

  protected

  def track_action
     ahoy.track "Viewed #{controller_name}##{action_name}", { request: { header: request.headers },
                                                              response: { headers: response.headers, body: JSON.parse(response.body) } }

  end
end

but i got error.

Completed 500 Internal Server Error in 493ms (Views: 34.8ms | ActiveRecord: 89.1ms | Allocations: 317174)

SystemStackError (stack level too deep):

app/controllers/application_controller.rb:14:in `track_action'

What is Best practice ahoy.track for storing all request, response log?

storing all http request, response with Ahoy gem


问:
Is there a way to set the rowHeight in react-grid-layout library such that all the content in cells appear?
I am using react-grid-layout library to create a board with draggable cards. The content of the cards are not static. Based on the settings input from the user, some components are added to the cards. In each card, there is a title, maximum three lines of summary and maximum 1 line of description as you can see in the image. When the summary is shorter than expected, the content except the title does not appear at all on the card.

I tried to change rowHeight property to make the rows bigger, but although it enlarges the cells with full content, it did not work on the ones with less lines of summary. I also tried to give min-height to my summary element, but then cards started to overlap. What can I do to make all content appear on the cards?
This is where I create GridLayout:
`

```<code><GridLayout
  className="layout"
  style={{
    backgroundColor: colors.N20,
  }}
  layout={newLayout}
  width={cols * 300 + (cols - 1) * 10}
  cols={cols}
  isResizable={false}
  rowHeight={MAX_SUMMARY_LINES < 3 ? 65 : 30}
  onDragStop={(_, __, item) => someFunc(item)}
>
  {newLayout.map((item) => {
    return (
      <div key={item.i}>
        <Card
          summaryNumberOfLines={MAX_SUMMARY_LINES}
          descriptionNumberOfLines={MAX_DESCRIPTION_LINES}
          issue={item.issue}
          isLoading={item.isLoading}
          showAssignee={showAssignee}
          showReporter={showReporter}
        />
      </div>
    );
  })}
</GridLayout>
</code>```

`

Body:
I am using react-grid-layout library to create a board with draggable cards. The content of the cards are not static. Based on the settings input from the user, some components are added to the cards. In each card, there is a title, maximum three lines of summary and maximum 1 line of description as you can see in the image. When the summary is shorter than expected, the content except the title does not appear at all on the card.

I tried to change rowHeight property to make the rows bigger, but although it enlarges the cells with full content, it did not work on the ones with less lines of summary. I also tried to give min-height to my summary element, but then cards started to overlap. What can I do to make all content appear on the cards?
This is where I create GridLayout:
`

<GridLayout
  className="layout"
  style={{
    backgroundColor: colors.N20,
  }}
  layout={newLayout}
  width={cols * 300 + (cols - 1) * 10}
  cols={cols}
  isResizable={false}
  rowHeight={MAX_SUMMARY_LINES < 3 ? 65 : 30}
  onDragStop={(_, __, item) => someFunc(item)}
>
  {newLayout.map((item) => {
    return (

        <Card
          summaryNumberOfLines={MAX_SUMMARY_LINES}
          descriptionNumberOfLines={MAX_DESCRIPTION_LINES}
          issue={item.issue}
          isLoading={item.isLoading}
          showAssignee={showAssignee}
          showReporter={showReporter}
        />

    );
  })}
</GridLayout>

`


问:
How to setup github actions for celery and django?
I have some celery tasks in situated in my django app, in my tests section of the project I have several celery task that does some database work using django orm.
In my local environment, pytest works fine but in github actions the following error is shown.
kombu.exception.OperationalError

In my pytest conftest.py file I have used the following setup [ taken from celery docs ]

```<code>
@pytest.fixture(scope="session")
def celery_config():
    return {"broker_url": "amqp://", "result_backend": "redis://"}

</code>```

but still, the exception is thrown. So, How can I properly create a github workflow that can test celery tasks without the above exception?
My github workflow:

```<code>name: CI

on: [push]

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        python-version: [ '3.10' ]
    services:
      # Label used to access the service container
      elasticsearch:
        image: docker.elastic.co/elasticsearch/elasticsearch:7.9.2
        env:
          discovery.type: single-node
        options: >-
          --health-cmd "curl http://localhost:9200/_cluster/health"
          --health-interval 10s
          --health-timeout 5s
          --health-retries 10
        ports:
          - 9400:9200
      postgres:
        # Docker Hub image
        image: postgres:10.8
        # Provide the password for postgres
        env:
          POSTGRES_USER: django
          POSTGRES_PASSWORD: django
          POSTGRES_DB: django
        ports:
          - 5432:5432
        # Set health checks to wait until postgres has started
        options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
      redis:
        # Docker Hub image
        image: redis
        # Set health checks to wait until redis has started
        options: >-
          --health-cmd "redis-cli ping"
          --health-interval 10s
          --health-timeout 5s
          --health-retries 5
    steps:
    - uses: actions/checkout@v1
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v2
      with:
        python-version: ${{ matrix.python-version }}
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install -r requirements.txt
    - name: Test with pytest
      env:
        ENV: TEST
      run: pytest
</code>```

Body:
I have some celery tasks in situated in my django app, in my tests section of the project I have several celery task that does some database work using django orm.
In my local environment, pytest works fine but in github actions the following error is shown.
kombu.exception.OperationalError

In my pytest conftest.py file I have used the following setup [ taken from celery docs ]

@pytest.fixture(scope="session")
def celery_config():
    return {"broker_url": "amqp://", "result_backend": "redis://"}

but still, the exception is thrown. So, How can I properly create a github workflow that can test celery tasks without the above exception?
My github workflow:

name: CI

on: [push]

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        python-version: [ '3.10' ]
    services:
      # Label used to access the service container
      elasticsearch:
        image: docker.elastic.co/elasticsearch/elasticsearch:7.9.2
        env:
          discovery.type: single-node
        options: >-
          --health-cmd "curl http://localhost:9200/_cluster/health"
          --health-interval 10s
          --health-timeout 5s
          --health-retries 10
        ports:
          - 9400:9200
      postgres:
        # Docker Hub image
        image: postgres:10.8
        # Provide the password for postgres
        env:
          POSTGRES_USER: django
          POSTGRES_PASSWORD: django
          POSTGRES_DB: django
        ports:
          - 5432:5432
        # Set health checks to wait until postgres has started
        options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
      redis:
        # Docker Hub image
        image: redis
        # Set health checks to wait until redis has started
        options: >-
          --health-cmd "redis-cli ping"
          --health-interval 10s
          --health-timeout 5s
          --health-retries 5
    steps:
    - uses: actions/checkout@v1
    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v2
      with:
        python-version: ${{ matrix.python-version }}
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install -r requirements.txt
    - name: Test with pytest
      env:
        ENV: TEST
      run: pytest